id
stringlengths
11
11
channel
stringclasses
2 values
channel_id
stringclasses
2 values
title
stringlengths
12
100
categories
sequence
tags
sequence
description
stringlengths
66
5k
text
stringlengths
577
90.4k
segments
list
v2GRWzIhaqQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Meta-Learning through Hebbian Plasticity in Random Networks (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "hebbian", "vision", "car", "ant", "quadruped", "neuroplasticity", "fire together wire together", "reinforcement learning", "deep rl", "deep reinforcement learning", "policy network", "policy gradient", "evolutionary methods", "evolution step", "population", "correlation", "gradient", "episode", "random", "adaptive", "reconfigure", "damage", "injury", "agent" ]
#ai #neuroscience #rl Reinforcement Learning is a powerful tool, but it lacks biological plausibility because it learns a fixed policy network. Animals use neuroplasticity to reconfigure their policies on the fly and quickly adapt to new situations. This paper uses Hebbian Learning, a biologically inspired technique, to have agents adapt random networks to high-performing solutions as an episode is progressing, leading to agents that can reconfigure themselves in response to new observations. OUTLINE: 0:00 - Intro & Overview 2:30 - Reinforcement Learning vs Hebbian Plasticity 9:00 - Episodes in Hebbian Learning 10:00 - Hebbian Plasticity Rules 18:10 - Quadruped Experiment Results 21:20 - Evolutionary Learning of Hebbian Plasticity 29:10 - More Experimental Results 34:50 - Conclusions 35:30 - Broader Impact Statement Videos: https://twitter.com/risi1979/status/1280544779630186499 Paper: https://arxiv.org/abs/2007.02686 Abstract: Lifelong learning and adaptability are two defining aspects of biological agents. Modern reinforcement learning (RL) approaches have shown significant progress in solving complex tasks, however once training is concluded, the found solutions are typically static and incapable of adapting to new information or perturbations. While it is still not completely understood how biological brains learn and adapt so efficiently from experience, it is believed that synaptic plasticity plays a prominent role in this process. Inspired by this biological mechanism, we propose a search method that, instead of optimizing the weight parameters of neural networks directly, only searches for synapse-specific Hebbian learning rules that allow the network to continuously self-organize its weights during the lifetime of the agent. We demonstrate our approach on several reinforcement learning tasks with different sensory modalities and more than 450K trainable plasticity parameters. We find that starting from completely random weights, the discovered Hebbian rules enable an agent to navigate a dynamical 2D-pixel environment; likewise they allow a simulated 3D quadrupedal robot to learn how to walk while adapting to different morphological damage in the absence of any explicit reward or error signal. Authors: Elias Najarro, Sebastian Risi Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, take a look at the following problem on the left right here. So you have this quadruped and the goal is to have it walk forward or in any direction as far as possible. Now, usually this is the domain of sort of reinforcement learning. So you have inputs, which is the sensors of the joints of the quadruped and you have outputs, which is how much force you want to put on each of the legs and you have to somehow learn a policy to make it walk forward. Reinforcement learning does that by sort of trial and error using an environment to learn the policy directly. However, this paper does something different. What it does is it learns a policy that is adaptive hearing 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 Hebbian plasticity in random networks by Elias Naharo and Sebastian Rizzi. So we'll go through the paper, what it does, what evolutionary methods are really briefly, which they use, what Hebbian plasticity is the difference to classic reinforcement learning. And then we'll look at the experiments and that's going to be it. If you like content like this, as always, don't hesitate to subscribe and share it out. And tell me what you think in the comments. I still read all the comments. So I am very interested in what you think about works like this and about the video itself. Okay, so they say lifelong learning and adaptability are two defining aspects of biological agents. Modern reinforcement learning approaches have shown significant progress in solving complex tasks. However, once training is concluded, the found solutions are typically static and incapable of adapting to new information or perturbations. So they contrast the two things here. Reinforcement learning, as you know, is very powerful in these domains. But its goal is to learn a policy and then that policy is fixed and it's specific to that particular problem. However, biological agents, you know, humans, animals and so on, they are able to adapt usually very, very quickly. They give some sort of examples right here, like if a if an animal is born, it almost immediately knows how to walk. So even if it has some sort of injury, even if it has some sort of disability, usually the animal can walk pretty much instantly. And that means it sort of adapts to the body that it is in sort of reconfigures itself on the fly. And that's what we're going to explore here. So this isn't going to outcompete RL anytime soon. It's just a different way and 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 two different environments, and so on. But the crucial part is that you in train, you learn, and then you freeze during test. In this, in this particular paper right here, they do something different. So let's call that the Hebbian plasticity world. In the Hebbian plasticity world, again, you have your environment, and you play this game. But you play the game in episodes. And at the beginning of each episode, you initialize this using some sort of distribution here, a normal distribution, you initialize the network, and then you learn, you adapt. During the episode, you adapt the network to have good performance. Okay, so this thing right here, these are the Hebbian rules. So you update the network during the episode. And then at the end of the episode, you go back, you initialize the network, again, you start a new episode, and you again adapt that randomly initialized network. So what's actually learned here isn't the weight of the network. What's learned during training is these rules that transform any randomly initialized network into a high performing network. Now, of course, you might just object and say, Hey, wait a minute, I can just basically hard code the, you know, the optimal weights here into these Hebbian rules. Like my rules can simply, you know, not care about the input and simply output whatever good weights there are. And ultimately, that would lead back to RL. But as you will be able to see in the experiments, they also have some videos provided that I invite you to watch, you can really see that the network reconfigures itself. First of all, at the beginning, it reconfigures itself to a good state. But then also, as the episode is progressing, it continuously reconfigures itself, depending on the input. So this is the real power of these Hebbian rules in that during the episode, the network can continuously reconfigure itself in order to achieve higher reward. So it's not just that I can go from the random initialization to a good performing policy, I can adapt that policy depending on what the input is. So at test time in this Hebbian world, what we're going to do is again, we are going to freeze the learning rules. So you have to kind of rethink, we're going to freeze the Hebbian rules, but still, we're going to randomly initialize our policy in each episode. And then we're going to change that during the episode, okay, and then that's ultimately going to give us our reward. So 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 there's a curve like this. And then as imagine you're 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 that you can reconfigure your state in order to adapt to the 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 pads 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 weight based on that, you will see that these constants here, they are per weight. So for each weight in this neural network, we learn a separate rule of how to update that particular weight. So the algorithm can, it can basically decide for a particular way to 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 a linear function of the inputs of the OI and OJ and their product. So I hope this is clear that these Hebbian rules, you learn ABCD and ETA, and that gives rise to an adaptive network that can change and reconfigure itself over the course of an episode, depending on the inputs. And one of the things right here, and we'll get to how you actually learn the rules itself in a second. But one of the things right here is very visible, as I said in this first experiment, where it reconfigures itself continuously, but also in this experiment with this quadruped right here. So this quadruped, usually, it's you know, you simply walk in the direction that's your reward and RL is perfectly fine at this as well. However, this is a bit of a has a bit of a trick to it. Namely, you are always in one of three situations, either you have an undamaged quadruped, or it's kind of left leg, front left leg is damaged, or its front right leg is damaged. Okay, and you don't tell the you simply sample these situations uniformly, and you don't tell the algorithm which situation it is in. Now, if you look at if you compare two methods, one where you directly learn the weights, you learn a fixed policy to solve, you know, this is one task, right, this is one task. And all of these three things appear with equal probability. So you have to learn one policy to make all of this work. If you learn the weights directly, and you don't have a power, like there's no doubt that like a powerful RL approach could deal with this task. But if in this case, if you just put a standard weight learner with the same number of the same size of policy as the Hebbian they compare to, if you put a weight learner on it, it will not be able to solve this task satisfactorily, what it will do is it will say, well, I need one set of rules that make me walk as far as possible as often as possible. So if you can see at the table, I'm already showing you the results right here. The table right here, if you have these static weights, you can see that it's performing pretty well in two out of three situations, right. So it what it basically does, it says, okay, here is what where there's damage, what it does is it says, I'm going to learn to walk with my left leg using my left front leg. That means when I have no damage or damage to the right front leg, I'm just fine. And I'm just going to take the hit basically, where I have damage to the left front leg, because I'm it's just going to suck. So they solved they solve this like walk more than 100 steps. So that doesn't 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 Hebbian rule in the other two methods. But this shows you kind of the difference and the power that these Hebbian rules or these generally neuroplasticity might have because the Hebbian one is perfectly capable of at least in part adapting to the different situations. Now you can see that is not symmetric. Also the Hebbian rules they learn to know there's 860 and there's 440 of a thing that should actually be symmetric, we do expect a drop when there's damage, but it's not symmetric, which means that also the Hebbian rules they kind of randomly focus on one over the other, but at least they're able in some degree to adapt to both. And that's because it depending on the input, you know, it has a rule in there that basically says, well, if the if the back left leg and the front light right leg, you know, if they fire together, then I want to, if they if they fire together, the sensors that show me that they're moving, if they fire together, I'm going to wire them together, because that's how I walk, you know, front, right, back, left, and then the other way around. And if that's not the case, I'm not going to wire them together. So that would be the situation where we have damage. Instead, if they are not wired together, I'm going to, you can do this in the next layer of the neural network, wire these other two things together, you know, if if the first thing is not the case, I'm going to wire these other two things together to make up for that loss. And there you can see there is kind of this logic built into the network. Now, again, I know you can do this with learning a fixed policy, you can achieve the same effects. The point here is just to show that given kind of a same size networks and so on, that you that there might be there might be like a qualitative difference in certain situations. Again, by no means this is meant to outcompete RL or anything like this. Okay, so we'll we went there. Now, how are these rules actually learned? And there we have to again make a distinction that is completely separate from the Hebbian non-Hebbian way. Okay, so the Hebbian non-Hebbian distinction was, do we learn the weights of the policy network directly? Or do we learn the rules to update the weights? Now the question is, whatever we learn, how do we learn it? And again, we have to draw the distinction this time between, I'm going to say classic R, even though the terminology is not really correct, classic RL and evolutionary methods. Okay, so in classic RL, what I would do is I would use my weights in order to obtain a reward. And then I would update my weights. So my delta W would be proportional to the gradient of W of the reward. Okay, so in the classic RL, especially in this is a policy gradient method right now, so I use my policy, my weights to get the reward, and then I would calculate a gradient. And you know, usually the reward isn't differentiable. So you have this reinforced trick in order to pull the reward out. And you can read all of this up if you look at policy gradient, the basic policy gradient methods. But this here tells me I need a gradient, 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 great hint 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. Now 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're now, what we need to learn in our case is these rules to update the rules. And imagine you have an episode and that's kind of episode, you have step, step, step, step, and in each step, these rules are applied, right? In each of these steps, the rules are applied. And at the end, you get a reward. So what you need to do is to back propagate that reward through all the steps and then through all the rules. Okay. And that might be just computationally not feasible or the rules, the rules right here are pretty, pretty easy, but the rules might not be differentiable. You actually have the same problem in general in classic RL as well. But you know, you can cut off time steps and so on. There are various hacks. In any case, there can be advantages to not having that gradient and evolutionary methods are a way to do that. In evolutionary method, usually you are don't train one agent, you train a population of agents. So you have a bunch of these neural network agents in here. And the way you update the neural network agent is you simply let them run, you know, you let them run your app, the episode. So this is your W, one of them, you let them run the episode, they get a reward. And then you can do multiple things. So this depends on the evolutionary method. So you can either pick out the best performing agent, or you can update each agent according to some rule. The goal here is simply to 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 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 Hebbian update rules. As well, you can use RL to learn the fixed weight or the update rules. In this paper, they use evolutionary methods to learn the Hebbian update rules. And they compare mostly with using evolutionary methods to learn the fixed weights. Okay, the exact evolutionary step they use right here is the following. So HT here is going to be the thing that you learn. Now as compared to W being the network weights, H is going to be the Hebbian weights, since we learn the Hebbian weights. So how they'll update each agent is going to be they'll take the Hebbian weights. And this this here is how you update, right? This is your delta H. How do you update the Hebbian weights? Well, what you do is you you perform 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 fi right here is going to be the fitness. And then I'm just going to perform a weighted average. So this is my weighted average of these new solutions. Okay, so if this solution here did pretty well, and this solution did pretty poorly, I want to walk, you know, in this direction. And then again, I do the same thing here from here, I do a bunch of perturbations. And maybe this one did pretty well. And this one did pretty poorly, I want to walk in this direction, and so on. Okay, so that's how you you'll change the you'll change weights or rules or whatever you want in an evolutionary method. As you know, it's pretty easy. It's easier than reinforcement learning, no back prop, no nothing. Basically a black box optimizer. There are more complicated evolutionary methods, but no, we don't go into those here right now. Okay, so again, I've already shown you these results. Now I said these static weights are also with evolutionary method, they also report what you would get with like a RL approach, like PPO, you would get kind of the same thing as they get as they get here. So, oh, sorry, this is not the same as the table. Yeah, I was confused for a second. This here is for the car environment. Okay, this is this vision based environment. So with their method, they get like an 870 rewards with the heavy and based approach. With the static weight, but still evolutionary method, they get a much lower reward. In fact, the heavy and based approach is about the same as you get here with an RL algorithm. And as we said, the RL algorithm more complicated. And if you use like a state of the art RL algorithm, not just PPO, you get a bit of a better performance, but not that much if you look at the actual numbers. So, you know, pretty cool to see that, again, this is not outperforming anything. This is simply showing that you can do that. They do a number of experiments where they go in the episode and they kind of change stuff in the episode. And one cool thing here is that they go and you know, this is an episode. So at the episode, you start with a random network each time in this heavy and setting. And then pretty quickly, the rules adapt for a high performing right. So it starts to walk, it reconfigures itself and starts to walk. The reward here again, it doesn't have access to that, but we can measure it, of course. And then at this step A right here, they simply go to the weights and zero them out. So they just delete these weights right here. And only 10 time steps later, 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 impressive in this very short amount of time able to recover from such an intervention. If you do this, of course, if you do this to your policy network, that's statically learned, it's going to be garbage. But I guess the fair comparison would be to delete the heavy and rules themselves. And you know, so it's not like it's not like this can adapt to new situations, or something like this, this is still learned for particular environments, right. But the point here is that you learn the rules. And this is kind of a study on neuroplasticity. Now, my question actually would be why this diagonal pattern appears. And I have not seen like a clear explanation. Especially is this anti diagonal pattern, it's not so much here in the output layer, right, this is the output layer, there are 21 actions or so. And this one is this, this dimension. So not that much there. But there seems to be this rule. And this is not the case at the beginning, right, you saw the beginning you saw at the beginning, it was pretty random matrix. So why? Why? Yeah, here, pretty random. And then there's this diagonal pattern, I don't know why. If you know, let me know. I mean, it's anti diagonal, maybe it is actually diagonal and the forward, the fully connected layer is just defined as something like 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 Hebbian coefficients, then your algorithm just jumps around kind of in in weight space around the zero point. However, if you actually learn these Hebbian coefficients, as they do, you have like this clear attractor here. And you have these kind of oscillating curves. When, you know, when when you do that, 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 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 mutual societal consequences of this work are hard to predict, but likely similar to other work dealing with more adaptive agent and robots. In particular, by giving the robots the ability to still function when injured could make it easier from them being deployed in areas that have both a positive and negative impact on society. Okay, well, again, this it's not really giving robots the ability to still function when they're injured. I first I thought first I thought, okay, they train it when it's fully functioning, but then they damage it during test time. But as I understand it, as I understand the paper, they already train it with the damaged versions, they just don't tell the algorithm in which version it is right now. So it's not the same as being able to work when injured unless you've specifically trained for it. In this case, again, I could be wrong about this. Yeah. In the very long term robots that can adapt could help in industrial automation or help to care for the elderly. On the other hand, more adaptive robots could also be more easily used for military applications. The approach presented in this paper is far from being deployed in these areas, but 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 statements seem to be you take whatever your method is and you go up until you find, you know, you're basically at technology or something equivalent, because no one actually I've never seen a broader impact statement that writes about the actual thing in the paper, they always go up like one layer or two. And then it basically regresses to technology, even 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 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 that the heavy ins make the rules apparently. I'm not heavy in. Okay, I've 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, "end": 6.6000000000000005, "text": " Hi there, take a look at the following problem on the left right here. So you have this quadruped" }, { "start": 6.6000000000000005, "end": 13.64, "text": " and the goal is to have it walk forward or in any direction as far as possible. Now," }, { "start": 13.64, "end": 18.68, "text": " usually this is the domain of sort of reinforcement learning. So you have inputs, which is the" }, { "start": 18.68, "end": 24.7, "text": " sensors of the joints of the quadruped and you have outputs, which is how much force" }, { "start": 24.7, "end": 30.4, "text": " you want to put on each of the legs and you have to somehow learn a policy to make it" }, { "start": 30.4, "end": 36.76, "text": " walk forward. Reinforcement learning does that by sort of trial and error using an environment" }, { "start": 36.76, "end": 44.2, "text": " to learn the policy directly. However, this paper does something different. What it does" }, { "start": 44.2, "end": 50.8, "text": " is it learns a policy that is adaptive hearing training, which basically means that at the" }, { "start": 50.8, "end": 58.92, "text": " beginning of each episode, the policy is initialized randomly and by policy here, we mean a policy" }, { "start": 58.92, "end": 64.56, "text": " network, policy neural network, which you can see at the bottom. So that's initialized" }, { "start": 64.56, "end": 72.62, "text": " randomly and then during the episode, depending on the input, this network is changed and" }, { "start": 72.62, "end": 80.72, "text": " adapted in order to achieve high performance. So even at test time, the network is started" }, { "start": 80.72, "end": 87.92, "text": " randomly and then adapted during the episode. So this paper deals with this problem and" }, { "start": 87.92, "end": 95.96, "text": " tries to implement this sort of more biologically plausible way of learning a policy, adapting" }, { "start": 95.96, "end": 101.52, "text": " to the environment and achieve ultimately good performance in this task. And it has" }, { "start": 101.52, "end": 107.32, "text": " some nice property, namely that it can deal with these things, as you can see here, front" }, { "start": 107.32, "end": 112.75999999999999, "text": " right leg damage, front left leg damage, but we'll get to that later. But just so you know" }, { "start": 112.75999999999999, "end": 119, "text": " what's coming. So the paper is called Meta learning through Hebbian plasticity in random" }, { "start": 119, "end": 126.08, "text": " networks by Elias Naharo and Sebastian Rizzi. So we'll go through the paper, what it does," }, { "start": 126.08, "end": 131.84, "text": " what evolutionary methods are really briefly, which they use, what Hebbian plasticity is" }, { "start": 131.84, "end": 137.8, "text": " the difference to classic reinforcement learning. And then we'll look at the experiments and" }, { "start": 137.8, "end": 143.72, "text": " that's going to be it. If you like content like this, as always, don't hesitate to subscribe" }, { "start": 143.72, "end": 149.72, "text": " and share it out. And tell me what you think in the comments. I still read all the comments." }, { "start": 149.72, "end": 154.24, "text": " So I am very interested in what you think about works like this and about the video" }, { "start": 154.24, "end": 160.74, "text": " itself. Okay, so they say lifelong learning and adaptability are two defining aspects" }, { "start": 160.74, "end": 166.32000000000002, "text": " of biological agents. Modern reinforcement learning approaches have shown significant" }, { "start": 166.32000000000002, "end": 172.34, "text": " progress in solving complex tasks. However, once training is concluded, the found solutions" }, { "start": 172.34, "end": 179.60000000000002, "text": " are typically static and incapable of adapting to new information or perturbations. So they" }, { "start": 179.60000000000002, "end": 185.32000000000002, "text": " contrast the two things here. Reinforcement learning, as you know, is very powerful in" }, { "start": 185.32, "end": 191.76, "text": " these domains. But its goal is to learn a policy and then that policy is fixed and it's" }, { "start": 191.76, "end": 200.06, "text": " specific to that particular problem. However, biological agents, you know, humans, animals" }, { "start": 200.06, "end": 205.12, "text": " and so on, they are able to adapt usually very, very quickly. They give some sort of" }, { "start": 205.12, "end": 211.88, "text": " examples right here, like if a if an animal is born, it almost immediately knows how to" }, { "start": 211.88, "end": 219.04, "text": " walk. So even if it has some sort of injury, even if it has some sort of disability, usually" }, { "start": 219.04, "end": 226.62, "text": " the animal can walk pretty much instantly. And that means it sort of adapts to the body" }, { "start": 226.62, "end": 231.72, "text": " that it is in sort of reconfigures itself on the fly. And that's what we're going to" }, { "start": 231.72, "end": 238.24, "text": " explore here. So this isn't going to outcompete RL anytime soon. It's just a different way" }, { "start": 238.24, "end": 244.96, "text": " and a biologically more plausible way in order to do that. So again, they say, we still" }, { "start": 244.96, "end": 250.84, "text": " don't know completely how biological brains learn and adapt so efficiently from experience." }, { "start": 250.84, "end": 256.36, "text": " It is believed that synaptic plasticity plays a prominent role in this process. And that's" }, { "start": 256.36, "end": 263.72, "text": " why they are using these Hebbian learning rules in order to configure the network. So" }, { "start": 263.72, "end": 269.56, "text": " let's contrast the two things for a second. In reinforcement learning, what you have is" }, { "start": 269.56, "end": 275.52000000000004, "text": " a policy network. Now the policy network is a neural network that maps sensory inputs" }, { "start": 275.52000000000004, "end": 281.56, "text": " to actions. Okay, so you have the observation goes in, and outcomes in action. This is your" }, { "start": 281.56, "end": 287.44000000000005, "text": " policy network. Now, during training in reinforcement learning, what you do is you have some sort" }, { "start": 287.44000000000005, "end": 293.28000000000003, "text": " of environment, okay, this is the environment. And you play this back and forth game with" }, { "start": 293.28, "end": 301.44, "text": " the environment. And you try to improve this policy network right here as best as you can" }, { "start": 301.44, "end": 310.4, "text": " in order to achieve a high reward. Then during testing, so this is train, then during testing," }, { "start": 310.4, "end": 318.55999999999995, "text": " you freeze, you freeze this network right here. So you freeze the network. And then" }, { "start": 318.56, "end": 323.4, "text": " you simply play that game and you see how well it does. Okay, so this gives you some" }, { "start": 323.4, "end": 327.24, "text": " sort of reward. And that's going to be your testing reward. And you know, that can be" }, { "start": 327.24, "end": 333.28000000000003, "text": " generalization, it can be two different environments, and so on. But the crucial part is that you" }, { "start": 333.28000000000003, "end": 342.16, "text": " in train, you learn, and then you freeze during test. In this, in this particular paper right" }, { "start": 342.16, "end": 349.96000000000004, "text": " here, they do something different. So let's call that the Hebbian plasticity world. In" }, { "start": 349.96000000000004, "end": 357.08000000000004, "text": " the Hebbian plasticity world, again, you have your environment, and you play this game." }, { "start": 357.08000000000004, "end": 364.94000000000005, "text": " But you play the game in episodes. And at the beginning of each episode, you initialize" }, { "start": 364.94000000000005, "end": 369.72, "text": " this using some sort of distribution here, a normal distribution, you initialize the" }, { "start": 369.72, "end": 378.68, "text": " network, and then you learn, you adapt. During the episode, you adapt the network to have" }, { "start": 378.68, "end": 388.90000000000003, "text": " good performance. Okay, so this thing right here, these are the Hebbian rules. So you" }, { "start": 388.90000000000003, "end": 394.44000000000005, "text": " update the network during the episode. And then at the end of the episode, you go back," }, { "start": 394.44, "end": 400.76, "text": " you initialize the network, again, you start a new episode, and you again adapt that randomly" }, { "start": 400.76, "end": 405.96, "text": " initialized network. So what's actually learned here isn't the weight of the network. What's" }, { "start": 405.96, "end": 412.36, "text": " learned during training is these rules that transform any randomly initialized network" }, { "start": 412.36, "end": 419.04, "text": " into a high performing network. Now, of course, you might just object and say, Hey, wait a" }, { "start": 419.04, "end": 426.34000000000003, "text": " minute, I can just basically hard code the, you know, the optimal weights here into these" }, { "start": 426.34000000000003, "end": 432.8, "text": " Hebbian rules. Like my rules can simply, you know, not care about the input and simply" }, { "start": 432.8, "end": 437.76, "text": " output whatever good weights there are. And ultimately, that would lead back to RL. But" }, { "start": 437.76, "end": 443, "text": " as you will be able to see in the experiments, they also have some videos provided that I" }, { "start": 443, "end": 450, "text": " invite you to watch, you can really see that the network reconfigures itself. First of" }, { "start": 450, "end": 455.16, "text": " all, at the beginning, it reconfigures itself to a good state. But then also, as the episode" }, { "start": 455.16, "end": 461.08, "text": " is progressing, it continuously reconfigures itself, depending on the input. So this is" }, { "start": 461.08, "end": 466.08, "text": " the real power of these Hebbian rules in that during the episode, the network can continuously" }, { "start": 466.08, "end": 471.84, "text": " reconfigure itself in order to achieve higher reward. So it's not just that I can go from" }, { "start": 471.84, "end": 477, "text": " the random initialization to a good performing policy, I can adapt that policy depending" }, { "start": 477, "end": 484.38, "text": " on what the input is. So at test time in this Hebbian world, what we're going to do is again," }, { "start": 484.38, "end": 489.73999999999995, "text": " we are going to freeze the learning rules. So you have to kind of rethink, we're going" }, { "start": 489.73999999999995, "end": 498.9, "text": " to freeze the Hebbian rules, but still, we're going to randomly initialize our policy in" }, { "start": 498.9, "end": 506.28, "text": " each episode. And then we're going to change that during the episode, okay, and then that's" }, { "start": 506.28, "end": 513.06, "text": " ultimately going to give us our reward. So the thing that's learned is just something" }, { "start": 513.06, "end": 520.02, "text": " different. Here, you learn the weights directly in the RL setting. And then the Hebbian plasticity" }, { "start": 520.02, "end": 525.76, "text": " setting, you learn the rules to update the weights dynamically depending on the input." }, { "start": 525.76, "end": 532.84, "text": " This is a form of meta learning, right? It's not exactly but it is a form of meta learning." }, { "start": 532.84, "end": 538.5, "text": " So let's see what those Hebbian rules are. And you can as again, you can see this right" }, { "start": 538.5, "end": 545.78, "text": " here during training. So this is one episode. And it always starts with these random networks" }, { "start": 545.78, "end": 551.28, "text": " at the beginning. And then you can see as you progress, there is structure emerging." }, { "start": 551.28, "end": 556.68, "text": " And again, I linked to the videos. And you can see that during the episode, even this" }, { "start": 556.68, "end": 562.28, "text": " is changing, and this is especially visible on their other example that they have here," }, { "start": 562.28, "end": 567.68, "text": " like this, this car example. So in this car example, during the video, you'll see that" }, { "start": 567.68, "end": 572.92, "text": " there's a curve like this. And then as imagine you're a driver, like there is a kind of a" }, { "start": 572.92, "end": 579.4, "text": " left curve coming and you adjust your mental state, let's say, to say, okay, I don't know" }, { "start": 579.4, "end": 584.0799999999999, "text": " what's around the curve, I need to be ready to break and so on. And then there is a straight" }, { "start": 584.0799999999999, "end": 588.6, "text": " piece coming and you'll be like, well, I see everything, you know, I can focus on different" }, { "start": 588.6, "end": 594.84, "text": " things that you can reconfigure your state in order to adapt to the the observation." }, { "start": 594.84, "end": 599.28, "text": " And that's exactly what you'll see in that video is that the weights are continuously" }, { "start": 599.28, "end": 604.72, "text": " updating, not so much in these quarter pads to which we'll get later. So these Hebbian" }, { "start": 604.72, "end": 612.28, "text": " rules, what do they look like? These are biologically inspired rules. And they say the following." }, { "start": 612.28, "end": 621.72, "text": " So this here is the delta W I J. And our perspective of policy networks is going to be that this" }, { "start": 621.72, "end": 627.84, "text": " is a neural network, as we said, and we'll just pick up one layer right here. And there" }, { "start": 627.84, "end": 631.84, "text": " is going to be weights right here, you know, weights from all to all these are going to" }, { "start": 631.84, "end": 638.72, "text": " be fully connected networks, and like this, and there's going to be neuron I somewhere" }, { "start": 638.72, "end": 645.44, "text": " here and neuron J somewhere here. Okay, so neuron I and neuron J are going to have a" }, { "start": 645.44, "end": 651.48, "text": " connection together, this thing right here. And there's going this, the question is going" }, { "start": 651.48, "end": 657.84, "text": " to be how do we update that weight from one time step to the next? Remembering the weights" }, { "start": 657.84, "end": 664.22, "text": " here are changed in each time step, each time step during the episode, we update the weights." }, { "start": 664.22, "end": 670.6800000000001, "text": " So how are they going to be updated? Let's contrast this first to classic reinforcement" }, { "start": 670.6800000000001, "end": 675.5600000000001, "text": " learning. So in classic reinforcement learning, we would keep these weights the same during" }, { "start": 675.5600000000001, "end": 680.52, "text": " the entire episode. And then at the end of the episode, right, we keep those the same." }, { "start": 680.52, "end": 683.96, "text": " And at the end of the episode, we'll get a reward. And then we'll go back, we'll look" }, { "start": 683.96, "end": 688.12, "text": " back and say, how do we need to change the weights such that in the next episode, the" }, { "start": 688.12, "end": 694.24, "text": " reward will be higher. And in again, in classic reinforcement learning, for example, in policy" }, { "start": 694.24, "end": 700.9000000000001, "text": " gradient methods, you will actually calculate a gradient with respect to these weights right" }, { "start": 700.9000000000001, "end": 707.24, "text": " here. Actually, let's let's go into that later when we contrast evolutionary methods. So" }, { "start": 707.24, "end": 711.24, "text": " the important part right here is that we change the weights in each time step. So how do we" }, { "start": 711.24, "end": 716.4, "text": " change the weights? Of course, we don't have access to the reward, right, in order to change" }, { "start": 716.4, "end": 721.1, "text": " the weights, the reward is going to come into play when we change the rules to change the" }, { "start": 721.1, "end": 726.36, "text": " weights. But during the episode, we don't have the reward. At least we assume we only" }, { "start": 726.36, "end": 733.1, "text": " get kind of the reward at the end. So we need a different method. And the method is going" }, { "start": 733.1, "end": 739, "text": " to be the following right here. The important things in this formula are going to be so" }, { "start": 739, "end": 745.14, "text": " how do we change the weights that's dependent on two quantities that appear during each" }, { "start": 745.14, "end": 752.32, "text": " time step, oh, I and oh, j. And these are going to be the outputs of neuron i and neuron" }, { "start": 752.32, "end": 759.32, "text": " j. So how do we change the connection that's going to be dependent on the output of neuron" }, { "start": 759.32, "end": 764.58, "text": " i, which is here called the pre synaptic output, and the output of neuron j, which is going" }, { "start": 764.58, "end": 773.12, "text": " to be the post synaptic output. The rule, the kind of mantra here is the fire together" }, { "start": 773.12, "end": 779.5, "text": " wire together means that if two neurons are active at the same time regularly, then they" }, { "start": 779.5, "end": 786.34, "text": " probably should be connected together because they already correlate. And you can see right" }, { "start": 786.34, "end": 793.44, "text": " here that there is a term in this formula that is oh, i times oh, j. So this here is" }, { "start": 793.44, "end": 801.84, "text": " the correlation between or the covariance, or just the product, if we're exact between" }, { "start": 801.84, "end": 807.5200000000001, "text": " these two neurons. And if they are both active regularly, then this quantity is going to" }, { "start": 807.5200000000001, "end": 812.7, "text": " be high. And if they're both not active regularly that or if one is active and the other one" }, { "start": 812.7, "end": 819.22, "text": " isn't that quantity is going to be low. And the a parameter here specifies how the weights" }, { "start": 819.22, "end": 827.84, "text": " are updated in response to this. So the a, b, c, d, and eta parameters right here are" }, { "start": 827.84, "end": 833.44, "text": " these are the learned parameters, these are going to be your learned rules to update the" }, { "start": 833.44, "end": 840.08, "text": " weights. So these change once after once per learning step was a once per. So after the" }, { "start": 840.08, "end": 844.1600000000001, "text": " episode is done, you're going to change these capital constants right here, including the" }, { "start": 844.16, "end": 852.02, "text": " eta, which is the learning rate. These things right here, these are per step. So this is" }, { "start": 852.02, "end": 856.8, "text": " each step gives you a different oh, i and oh, j. And then you'll adjust the weight based" }, { "start": 856.8, "end": 862.88, "text": " on that, you will see that these constants here, they are per weight. So for each weight" }, { "start": 862.88, "end": 869.76, "text": " in this neural network, we learn a separate rule of how to update that particular weight." }, { "start": 869.76, "end": 876, "text": " So the algorithm can, it can basically decide for a particular way to can decide, well," }, { "start": 876, "end": 882.42, "text": " if these two things fire together often, I want to update my weight very heavily in response" }, { "start": 882.42, "end": 891.76, "text": " to that. Okay, so if the a is very high, that means the connection responds very thoroughly" }, { "start": 891.76, "end": 897.64, "text": " to when the two neurons fire together. That is not the same as to say that connection" }, { "start": 897.64, "end": 903.4, "text": " should always be very strong, it's dependent on the input. So only when this quantity is" }, { "start": 903.4, "end": 910.1999999999999, "text": " high, should the network or should the weight be updated, and the a parameter modulates" }, { "start": 910.1999999999999, "end": 917.48, "text": " how well it's updated or how how strongly it's up, it can also be negative, it can be" }, { "start": 917.48, "end": 922.96, "text": " zero, basically meaning that, you know, it doesn't matter if they fire together, I don't" }, { "start": 922.96, "end": 927.6, "text": " want to update the weight, this particular weight in response to that. So you can see" }, { "start": 927.6, "end": 934.12, "text": " that you can learn these rules that can adapt to different inputs, because all of the changes" }, { "start": 934.12, "end": 942.88, "text": " the delta here is dependent on the inputs. So on the correlation, but also on the different" }, { "start": 942.88, "end": 950.32, "text": " inputs themselves. And then there is also a constant right here. Okay, this, as you" }, { "start": 950.32, "end": 959.9200000000001, "text": " can see, it's a linear function of the inputs of the OI and OJ and their product. So I hope" }, { "start": 959.9200000000001, "end": 967.88, "text": " this is clear that these Hebbian rules, you learn ABCD and ETA, and that gives rise to" }, { "start": 967.88, "end": 974.4000000000001, "text": " an adaptive network that can change and reconfigure itself over the course of an episode, depending" }, { "start": 974.4, "end": 981.88, "text": " on the inputs. And one of the things right here, and we'll get to how you actually learn" }, { "start": 981.88, "end": 986.64, "text": " the rules itself in a second. But one of the things right here is very visible, as I said" }, { "start": 986.64, "end": 992.88, "text": " in this first experiment, where it reconfigures itself continuously, but also in this experiment" }, { "start": 992.88, "end": 998.88, "text": " with this quadruped right here. So this quadruped, usually, it's you know, you simply walk in" }, { "start": 998.88, "end": 1004.88, "text": " the direction that's your reward and RL is perfectly fine at this as well. However, this" }, { "start": 1004.88, "end": 1010.88, "text": " is a bit of a has a bit of a trick to it. Namely, you are always in one of three situations," }, { "start": 1010.88, "end": 1019.4399999999999, "text": " either you have an undamaged quadruped, or it's kind of left leg, front left leg is damaged," }, { "start": 1019.4399999999999, "end": 1026.64, "text": " or its front right leg is damaged. Okay, and you don't tell the you simply sample these" }, { "start": 1026.64, "end": 1033.76, "text": " situations uniformly, and you don't tell the algorithm which situation it is in. Now, if" }, { "start": 1033.76, "end": 1040.0400000000002, "text": " you look at if you compare two methods, one where you directly learn the weights, you" }, { "start": 1040.0400000000002, "end": 1046.88, "text": " learn a fixed policy to solve, you know, this is one task, right, this is one task. And" }, { "start": 1046.88, "end": 1052.8400000000001, "text": " all of these three things appear with equal probability. So you have to learn one policy" }, { "start": 1052.84, "end": 1059.36, "text": " to make all of this work. If you learn the weights directly, and you don't have a power," }, { "start": 1059.36, "end": 1063.76, "text": " like there's no doubt that like a powerful RL approach could deal with this task. But" }, { "start": 1063.76, "end": 1070.36, "text": " if in this case, if you just put a standard weight learner with the same number of the" }, { "start": 1070.36, "end": 1077.04, "text": " same size of policy as the Hebbian they compare to, if you put a weight learner on it, it" }, { "start": 1077.04, "end": 1082.8, "text": " will not be able to solve this task satisfactorily, what it will do is it will say, well, I need" }, { "start": 1082.8, "end": 1089.28, "text": " one set of rules that make me walk as far as possible as often as possible. So if you" }, { "start": 1089.28, "end": 1095.48, "text": " can see at the table, I'm already showing you the results right here. The table right" }, { "start": 1095.48, "end": 1101.84, "text": " here, if you have these static weights, you can see that it's performing pretty well in" }, { "start": 1101.84, "end": 1110.04, "text": " two out of three situations, right. So it what it basically does, it says, okay, here" }, { "start": 1110.04, "end": 1116.3999999999999, "text": " is what where there's damage, what it does is it says, I'm going to learn to walk with" }, { "start": 1116.3999999999999, "end": 1122.72, "text": " my left leg using my left front leg. That means when I have no damage or damage to the" }, { "start": 1122.72, "end": 1128.36, "text": " right front leg, I'm just fine. And I'm just going to take the hit basically, where I have" }, { "start": 1128.36, "end": 1132.76, "text": " damage to the left front leg, because I'm it's just going to suck. So they solved they" }, { "start": 1132.76, "end": 1138.28, "text": " solve this like walk more than 100 steps. So that doesn't it, since it can only learn" }, { "start": 1138.28, "end": 1146.52, "text": " a fixed policy, it basically discards the case where there's damage to the left front" }, { "start": 1146.52, "end": 1152.02, "text": " leg, it takes that hit in order to be better in the other two methods, you can see it's" }, { "start": 1152.02, "end": 1157.96, "text": " outperforming the Hebbian rule in the other two methods. But this shows you kind of the" }, { "start": 1157.96, "end": 1164.22, "text": " difference and the power that these Hebbian rules or these generally neuroplasticity might" }, { "start": 1164.22, "end": 1172.56, "text": " have because the Hebbian one is perfectly capable of at least in part adapting to the" }, { "start": 1172.56, "end": 1178.32, "text": " different situations. Now you can see that is not symmetric. Also the Hebbian rules they" }, { "start": 1178.32, "end": 1185.28, "text": " learn to know there's 860 and there's 440 of a thing that should actually be symmetric," }, { "start": 1185.28, "end": 1191.74, "text": " we do expect a drop when there's damage, but it's not symmetric, which means that also" }, { "start": 1191.74, "end": 1198.44, "text": " the Hebbian rules they kind of randomly focus on one over the other, but at least they're" }, { "start": 1198.44, "end": 1206.2, "text": " able in some degree to adapt to both. And that's because it depending on the input," }, { "start": 1206.2, "end": 1211.1200000000001, "text": " you know, it has a rule in there that basically says, well, if the if the back left leg and" }, { "start": 1211.1200000000001, "end": 1217.72, "text": " the front light right leg, you know, if they fire together, then I want to, if they if" }, { "start": 1217.72, "end": 1222.44, "text": " they fire together, the sensors that show me that they're moving, if they fire together," }, { "start": 1222.44, "end": 1227.4, "text": " I'm going to wire them together, because that's how I walk, you know, front, right, back," }, { "start": 1227.4, "end": 1233.24, "text": " left, and then the other way around. And if that's not the case, I'm not going to wire" }, { "start": 1233.24, "end": 1237.44, "text": " them together. So that would be the situation where we have damage. Instead, if they are" }, { "start": 1237.44, "end": 1242.28, "text": " not wired together, I'm going to, you can do this in the next layer of the neural network," }, { "start": 1242.28, "end": 1247.72, "text": " wire these other two things together, you know, if if the first thing is not the case," }, { "start": 1247.72, "end": 1253.76, "text": " I'm going to wire these other two things together to make up for that loss. And there you can" }, { "start": 1253.76, "end": 1259.48, "text": " see there is kind of this logic built into the network. Now, again, I know you can do" }, { "start": 1259.48, "end": 1264.92, "text": " this with learning a fixed policy, you can achieve the same effects. The point here is" }, { "start": 1264.92, "end": 1272.76, "text": " just to show that given kind of a same size networks and so on, that you that there might" }, { "start": 1272.76, "end": 1279.0800000000002, "text": " be there might be like a qualitative difference in certain situations. Again, by no means" }, { "start": 1279.0800000000002, "end": 1288.4, "text": " this is meant to outcompete RL or anything like this. Okay, so we'll we went there. Now," }, { "start": 1288.4, "end": 1293.64, "text": " how are these rules actually learned? And there we have to again make a distinction" }, { "start": 1293.64, "end": 1300.68, "text": " that is completely separate from the Hebbian non-Hebbian way. Okay, so the Hebbian non-Hebbian" }, { "start": 1300.68, "end": 1306.0400000000002, "text": " distinction was, do we learn the weights of the policy network directly? Or do we learn" }, { "start": 1306.0400000000002, "end": 1312.96, "text": " the rules to update the weights? Now the question is, whatever we learn, how do we learn it?" }, { "start": 1312.96, "end": 1318.1200000000001, "text": " And again, we have to draw the distinction this time between, I'm going to say classic" }, { "start": 1318.12, "end": 1325.4799999999998, "text": " R, even though the terminology is not really correct, classic RL and evolutionary methods." }, { "start": 1325.4799999999998, "end": 1332.6799999999998, "text": " Okay, so in classic RL, what I would do is I would use my weights in order to obtain" }, { "start": 1332.6799999999998, "end": 1342.04, "text": " a reward. And then I would update my weights. So my delta W would be proportional to the" }, { "start": 1342.04, "end": 1350.72, "text": " gradient of W of the reward. Okay, so in the classic RL, especially in this is a policy" }, { "start": 1350.72, "end": 1355.8, "text": " gradient method right now, so I use my policy, my weights to get the reward, and then I would" }, { "start": 1355.8, "end": 1361.68, "text": " calculate a gradient. And you know, usually the reward isn't differentiable. So you have" }, { "start": 1361.68, "end": 1368.72, "text": " this reinforced trick in order to pull the reward out. And you can read all of this up" }, { "start": 1368.72, "end": 1375.96, "text": " if you look at policy gradient, the basic policy gradient methods. But this here tells" }, { "start": 1375.96, "end": 1383.92, "text": " me I need a gradient, usually this is going to be the reward times the gradient of my" }, { "start": 1383.92, "end": 1394.6000000000001, "text": " FW of my input. So what this means is, what this means is that if my reward is high, then" }, { "start": 1394.6, "end": 1403.24, "text": " I just want to know, what do I need to do to make more of what I just did? Okay, and" }, { "start": 1403.24, "end": 1410.36, "text": " the great hint ensures that for every single weight in your neural network, you know what" }, { "start": 1410.36, "end": 1416.9599999999998, "text": " to do. So the gradient means that I have an exact handle on how do I need to change this" }, { "start": 1416.9599999999998, "end": 1422.52, "text": " weight? How do I need to change that weight? How do I need to change this weight in order" }, { "start": 1422.52, "end": 1427.6399999999999, "text": " if the reward is high, and because of this multiplication here, I want to make more of" }, { "start": 1427.6399999999999, "end": 1432.6, "text": " what I just did. And the gradient tells me how. If the reward is low, on the other hand," }, { "start": 1432.6, "end": 1438.44, "text": " I want to make less of what I just did. But also the gradient tells me how that can be" }, { "start": 1438.44, "end": 1445.08, "text": " achieved. I simply go into the other direction than I would if the reward is high. In evolutionary" }, { "start": 1445.08, "end": 1451.6399999999999, "text": " methods, we don't have, we don't do this gradient calculation. Now there can be advantages to" }, { "start": 1451.64, "end": 1456.72, "text": " not doing gradient calculation. Sometimes backpropagation simply isn't possible. Even" }, { "start": 1456.72, "end": 1463.64, "text": " if it is possible, and this is maybe the case where we're now, what we need to learn in" }, { "start": 1463.64, "end": 1468.88, "text": " our case is these rules to update the rules. And imagine you have an episode and that's" }, { "start": 1468.88, "end": 1475.68, "text": " kind of episode, you have step, step, step, step, and in each step, these rules are applied," }, { "start": 1475.68, "end": 1480.6200000000001, "text": " right? In each of these steps, the rules are applied. And at the end, you get a reward." }, { "start": 1480.62, "end": 1486.6799999999998, "text": " So what you need to do is to back propagate that reward through all the steps and then" }, { "start": 1486.6799999999998, "end": 1491.9599999999998, "text": " through all the rules. Okay. And that might be just computationally not feasible or the" }, { "start": 1491.9599999999998, "end": 1499.4799999999998, "text": " rules, the rules right here are pretty, pretty easy, but the rules might not be differentiable." }, { "start": 1499.4799999999998, "end": 1505.8799999999999, "text": " You actually have the same problem in general in classic RL as well. But you know, you can" }, { "start": 1505.8799999999999, "end": 1510.36, "text": " cut off time steps and so on. There are various hacks. In any case, there can be advantages" }, { "start": 1510.36, "end": 1516.4399999999998, "text": " to not having that gradient and evolutionary methods are a way to do that. In evolutionary" }, { "start": 1516.4399999999998, "end": 1523.24, "text": " method, usually you are don't train one agent, you train a population of agents. So you have" }, { "start": 1523.24, "end": 1531.32, "text": " a bunch of these neural network agents in here. And the way you update the neural network" }, { "start": 1531.32, "end": 1535.9199999999998, "text": " agent is you simply let them run, you know, you let them run your app, the episode. So" }, { "start": 1535.92, "end": 1544.92, "text": " this is your W, one of them, you let them run the episode, they get a reward. And then" }, { "start": 1544.92, "end": 1548.88, "text": " you can do multiple things. So this depends on the evolutionary method. So you can either" }, { "start": 1548.88, "end": 1557.14, "text": " pick out the best performing agent, or you can update each agent according to some rule." }, { "start": 1557.14, "end": 1562.8000000000002, "text": " The goal here is simply to basically, you always want to take your weights, you want" }, { "start": 1562.8, "end": 1568.84, "text": " to add some noise to them. And you want to see, does it get better or worse? If it gets" }, { "start": 1568.84, "end": 1574.28, "text": " better, good. If it gets worse, not good. Okay, the difference is without the gradient," }, { "start": 1574.28, "end": 1578.36, "text": " you don't have a handle on how do you need to change each individual weight. All you" }, { "start": 1578.36, "end": 1583.04, "text": " can do is basically random walk and observe what happens. And if the random walk is, you" }, { "start": 1583.04, "end": 1588.68, "text": " know, turns out to be good, you go more into that direction of that random walk. So it's" }, { "start": 1588.68, "end": 1596.42, "text": " sort of a sort of a poor man's gradient method in these evolutionary methods. Again, completely" }, { "start": 1596.42, "end": 1601.68, "text": " independent of what we learn, you can use the evolutionary method to learn the fixed" }, { "start": 1601.68, "end": 1608, "text": " weights. And that's what actually what happens in the table I've shown you below. Or you" }, { "start": 1608, "end": 1612.44, "text": " can use the evolutionary method to learn the Hebbian update rules. As well, you can use" }, { "start": 1612.44, "end": 1617.44, "text": " RL to learn the fixed weight or the update rules. In this paper, they use evolutionary" }, { "start": 1617.44, "end": 1624.3200000000002, "text": " methods to learn the Hebbian update rules. And they compare mostly with using evolutionary" }, { "start": 1624.3200000000002, "end": 1632.8400000000001, "text": " methods to learn the fixed weights. Okay, the exact evolutionary step they use right" }, { "start": 1632.8400000000001, "end": 1638.88, "text": " here is the following. So HT here is going to be the thing that you learn. Now as compared" }, { "start": 1638.88, "end": 1644.64, "text": " to W being the network weights, H is going to be the Hebbian weights, since we learn" }, { "start": 1644.64, "end": 1652.0400000000002, "text": " the Hebbian weights. So how they'll update each agent is going to be they'll take the" }, { "start": 1652.0400000000002, "end": 1658.2, "text": " Hebbian weights. And this this here is how you update, right? This is your delta H. How" }, { "start": 1658.2, "end": 1666.72, "text": " do you update the Hebbian weights? Well, what you do is you you perform in random perturbations." }, { "start": 1666.72, "end": 1673.2, "text": " So I take my weights and I add noise. I just add noise. Okay, so I I'm here. And I just" }, { "start": 1673.2, "end": 1680.64, "text": " make a bunch of versions of it. And then I observe how well are these versions doing?" }, { "start": 1680.64, "end": 1685.8, "text": " So how well are my random perturbations doing? This is going to be the fitness fi right here" }, { "start": 1685.8, "end": 1691.44, "text": " is going to be the fitness. And then I'm just going to perform a weighted average. So this" }, { "start": 1691.44, "end": 1700.3, "text": " is my weighted average of these new solutions. Okay, so if this solution here did pretty" }, { "start": 1700.3, "end": 1707.32, "text": " well, and this solution did pretty poorly, I want to walk, you know, in this direction." }, { "start": 1707.32, "end": 1714.6399999999999, "text": " And then again, I do the same thing here from here, I do a bunch of perturbations. And maybe" }, { "start": 1714.6399999999999, "end": 1719.24, "text": " this one did pretty well. And this one did pretty poorly, I want to walk in this direction," }, { "start": 1719.24, "end": 1727.7, "text": " and so on. Okay, so that's how you you'll change the you'll change weights or rules" }, { "start": 1727.7, "end": 1734.44, "text": " or whatever you want in an evolutionary method. As you know, it's pretty easy. It's easier" }, { "start": 1734.44, "end": 1741.6200000000001, "text": " than reinforcement learning, no back prop, no nothing. Basically a black box optimizer." }, { "start": 1741.6200000000001, "end": 1747.48, "text": " There are more complicated evolutionary methods, but no, we don't go into those here right" }, { "start": 1747.48, "end": 1756.3600000000001, "text": " now. Okay, so again, I've already shown you these results. Now I said these static weights" }, { "start": 1756.36, "end": 1763.28, "text": " are also with evolutionary method, they also report what you would get with like a RL approach," }, { "start": 1763.28, "end": 1774.32, "text": " like PPO, you would get kind of the same thing as they get as they get here. So, oh, sorry," }, { "start": 1774.32, "end": 1779.4399999999998, "text": " this is not the same as the table. Yeah, I was confused for a second. This here is for" }, { "start": 1779.44, "end": 1786.64, "text": " the car environment. Okay, this is this vision based environment. So with their method, they" }, { "start": 1786.64, "end": 1794.26, "text": " get like an 870 rewards with the heavy and based approach. With the static weight, but" }, { "start": 1794.26, "end": 1799.8, "text": " still evolutionary method, they get a much lower reward. In fact, the heavy and based" }, { "start": 1799.8, "end": 1806.56, "text": " approach is about the same as you get here with an RL algorithm. And as we said, the" }, { "start": 1806.56, "end": 1815.2, "text": " RL algorithm more complicated. And if you use like a state of the art RL algorithm," }, { "start": 1815.2, "end": 1822.12, "text": " not just PPO, you get a bit of a better performance, but not that much if you look at the actual" }, { "start": 1822.12, "end": 1829.24, "text": " numbers. So, you know, pretty cool to see that, again, this is not outperforming anything." }, { "start": 1829.24, "end": 1837.32, "text": " This is simply showing that you can do that. They do a number of experiments where they" }, { "start": 1837.32, "end": 1843.32, "text": " go in the episode and they kind of change stuff in the episode. And one cool thing here" }, { "start": 1843.32, "end": 1850, "text": " is that they go and you know, this is an episode. So at the episode, you start with a random" }, { "start": 1850, "end": 1856.44, "text": " network each time in this heavy and setting. And then pretty quickly, the rules adapt for" }, { "start": 1856.44, "end": 1863.24, "text": " a high performing right. So it starts to walk, it reconfigures itself and starts to walk." }, { "start": 1863.24, "end": 1867.74, "text": " The reward here again, it doesn't have access to that, but we can measure it, of course." }, { "start": 1867.74, "end": 1874.72, "text": " And then at this step A right here, they simply go to the weights and zero them out. So they" }, { "start": 1874.72, "end": 1881.98, "text": " just delete these weights right here. And only 10 time steps later, it has reconfigured" }, { "start": 1881.98, "end": 1888.8, "text": " itself as you can see right here in order to walk again. So 10 time steps later, reconfigures" }, { "start": 1888.8, "end": 1894.92, "text": " itself, reconfigures itself. And after a short while right here, it's back to its kind of" }, { "start": 1894.92, "end": 1904.56, "text": " original performance, as you can see. So that's, I'd say that's fairly impressive in this very" }, { "start": 1904.56, "end": 1911.4, "text": " short amount of time able to recover from such an intervention. If you do this, of course," }, { "start": 1911.4, "end": 1916.3400000000001, "text": " if you do this to your policy network, that's statically learned, it's going to be garbage." }, { "start": 1916.3400000000001, "end": 1921.44, "text": " But I guess the fair comparison would be to delete the heavy and rules themselves. And" }, { "start": 1921.44, "end": 1929.5600000000002, "text": " you know, so it's not like it's not like this can adapt to new situations, or something" }, { "start": 1929.5600000000002, "end": 1934.3600000000001, "text": " like this, this is still learned for particular environments, right. But the point here is" }, { "start": 1934.3600000000001, "end": 1941.1000000000001, "text": " that you learn the rules. And this is kind of a study on neuroplasticity. Now, my question" }, { "start": 1941.1, "end": 1948.6399999999999, "text": " actually would be why this diagonal pattern appears. And I have not seen like a clear" }, { "start": 1948.6399999999999, "end": 1955.6999999999998, "text": " explanation. Especially is this anti diagonal pattern, it's not so much here in the output" }, { "start": 1955.6999999999998, "end": 1961.9599999999998, "text": " layer, right, this is the output layer, there are 21 actions or so. And this one is this," }, { "start": 1961.9599999999998, "end": 1968.1, "text": " this dimension. So not that much there. But there seems to be this rule. And this is not" }, { "start": 1968.1, "end": 1973.48, "text": " the case at the beginning, right, you saw the beginning you saw at the beginning, it" }, { "start": 1973.48, "end": 1982.84, "text": " was pretty random matrix. So why? Why? Yeah, here, pretty random. And then there's this" }, { "start": 1982.84, "end": 1989.76, "text": " diagonal pattern, I don't know why. If you know, let me know. I mean, it's anti diagonal," }, { "start": 1989.76, "end": 1994.48, "text": " maybe it is actually diagonal and the forward, the fully connected layer is just defined" }, { "start": 1994.48, "end": 2005.56, "text": " as something like WT times x. And but maybe this also depends on the random initialization." }, { "start": 2005.56, "end": 2012.1200000000001, "text": " But there is no inherent way why particular neuron would, you know, care about sending" }, { "start": 2012.1200000000001, "end": 2022.6, "text": " information to like the same height of neuron on the other side. Or is there? I don't know" }, { "start": 2022.6, "end": 2029.8799999999999, "text": " I'm so is this a property of the evolutionary or the learning rules? It seems not because" }, { "start": 2029.8799999999999, "end": 2038.56, "text": " the learning rules don't depend on the position. I'm genuinely confused about this. And maybe," }, { "start": 2038.56, "end": 2042.9199999999998, "text": " you know, maybe they've written it somewhere, and I've just overlooked it, though. I, they" }, { "start": 2042.9199999999998, "end": 2047.12, "text": " do reference it, they say, oh, there's this diagonal pattern appearing, but I don't think" }, { "start": 2047.12, "end": 2057.2799999999997, "text": " they ever say why it is diagonal. Okay, I might just be I might just be real dumb. Yeah." }, { "start": 2057.2799999999997, "end": 2061.44, "text": " So they also, you know, they do some more experiments, they show, for example, that" }, { "start": 2061.44, "end": 2067.18, "text": " if you just have random Hebbian coefficients, then your algorithm just jumps around kind" }, { "start": 2067.18, "end": 2073.12, "text": " of in in weight space around the zero point. However, if you actually learn these Hebbian" }, { "start": 2073.12, "end": 2078.2799999999997, "text": " coefficients, as they do, you have like this clear attractor here. And you have these kind" }, { "start": 2078.2799999999997, "end": 2085.72, "text": " of oscillating curves. When, you know, when when you do that, and you can see here in" }, { "start": 2085.72, "end": 2091.24, "text": " the different situations where things are damaged, and so on. So all in all, I think" }, { "start": 2091.24, "end": 2098.12, "text": " it's a pretty interesting study. And I think this neuroplasticity is, it's a different" }, { "start": 2098.12, "end": 2103.6, "text": " way, you know, it's unclear to say if it will ever deliver the performance that RL delivers," }, { "start": 2103.6, "end": 2109.8199999999997, "text": " but certainly there are situations where such plasticity is desired. And if we can also" }, { "start": 2109.8199999999997, "end": 2116.2599999999998, "text": " combine this with greater generalization performance, then, you know, we have agents that can quickly" }, { "start": 2116.2599999999998, "end": 2123.4, "text": " kind of reconfigure. And a lot of work by these these kind of open ended learning community" }, { "start": 2123.4, "end": 2130.36, "text": " also plays into this roles, all in all pretty, pretty cool, non standard way of doing things." }, { "start": 2130.36, "end": 2134.96, "text": " Last thing, the broader impact statement. Every now and then we'll look at a broader" }, { "start": 2134.96, "end": 2139.2000000000003, "text": " impact statement, since these are new, just to get kind of an overview of what they look" }, { "start": 2139.2000000000003, "end": 2143.92, "text": " like. So they say the ethical and mutual societal consequences of this work are hard to predict," }, { "start": 2143.92, "end": 2150.42, "text": " but likely similar to other work dealing with more adaptive agent and robots. In particular," }, { "start": 2150.42, "end": 2154.04, "text": " by giving the robots the ability to still function when injured could make it easier" }, { "start": 2154.04, "end": 2161.16, "text": " from them being deployed in areas that have both a positive and negative impact on society." }, { "start": 2161.16, "end": 2167.52, "text": " Okay, well, again, this it's not really giving robots the ability to still function when" }, { "start": 2167.52, "end": 2174.36, "text": " they're injured. I first I thought first I thought, okay, they train it when it's fully" }, { "start": 2174.36, "end": 2181.48, "text": " functioning, but then they damage it during test time. But as I understand it, as I understand" }, { "start": 2181.48, "end": 2186.76, "text": " the paper, they already train it with the damaged versions, they just don't tell the" }, { "start": 2186.76, "end": 2195.6800000000003, "text": " algorithm in which version it is right now. So it's not the same as being able to work" }, { "start": 2195.6800000000003, "end": 2201, "text": " when injured unless you've specifically trained for it. In this case, again, I could be wrong" }, { "start": 2201, "end": 2207.34, "text": " about this. Yeah. In the very long term robots that can adapt could help in industrial automation" }, { "start": 2207.34, "end": 2213.6, "text": " or help to care for the elderly. On the other hand, more adaptive robots could also be more" }, { "start": 2213.6, "end": 2218.28, "text": " easily used for military applications. The approach presented in this paper is far from" }, { "start": 2218.28, "end": 2222.64, "text": " being deployed in these areas, but it's important to discuss its potential long term consequences" }, { "start": 2222.64, "end": 2229.92, "text": " early on. Now, okay, so let's evaluate the broader impact statement. Let's, well, the" }, { "start": 2229.92, "end": 2238.4, "text": " first check to do is always to simply replace whatever their method is with the word technology." }, { "start": 2238.4, "end": 2248.76, "text": " Okay, so let's do that. In the very long term, technology could help in industrial automation" }, { "start": 2248.76, "end": 2254.4, "text": " or help to care for the elderly. Check. On the other hand, technology could also be more" }, { "start": 2254.4, "end": 2261.08, "text": " easily used for military application. Check. Technology is far from being deployed in these" }, { "start": 2261.08, "end": 2269.4, "text": " areas. Okay, I guess some technology isn't, but advanced technology. Yeah. So again, the" }, { "start": 2269.4, "end": 2273.88, "text": " rule for broader impact statements seem to be you take whatever your method is and you" }, { "start": 2273.88, "end": 2282.78, "text": " go up until you find, you know, you're basically at technology or something equivalent, because" }, { "start": 2282.78, "end": 2288.5600000000004, "text": " no one actually I've never seen a broader impact statement that writes about the actual" }, { "start": 2288.5600000000004, "end": 2294.36, "text": " thing in the paper, they always go up like one layer or two. And then it basically regresses" }, { "start": 2294.36, "end": 2302.0400000000004, "text": " to technology, even even though very few papers actually would be able to discuss their particular" }, { "start": 2302.0400000000004, "end": 2309.2000000000003, "text": " thing, but you know, and that and then in terms of guidelines on broader impact statement," }, { "start": 2309.2, "end": 2313.96, "text": " this one is missing, there's there's always this, the holy trifecta. So the holy trifecta" }, { "start": 2313.96, "end": 2318.6, "text": " is you go like a, you know, like you're a, you're a Catholic, you go with your finger" }, { "start": 2318.6, "end": 2325.3599999999997, "text": " to your head, chest, left and right. And you say technology good, technology bad, technology" }, { "start": 2325.3599999999997, "end": 2331.7999999999997, "text": " biased. Okay, so you want to write a broader impact statement, go up the layers, technology," }, { "start": 2331.8, "end": 2339.52, "text": " good bad bias, and we're missing the bias here. So that's, you know, I'm just following" }, { "start": 2339.52, "end": 2343.76, "text": " what these guidelines to broader impact statements are. I don't make the rules. I'm sorry that" }, { "start": 2343.76, "end": 2350.96, "text": " the heavy ins make the rules apparently. I'm not heavy in. Okay, I've I hope you've enjoyed" }, { "start": 2350.96, "end": 2356.1200000000003, "text": " this paper and this video. Let me know what you think. Check out the videos that they" }, { "start": 2356.12, "end": 2361.56, "text": " have. I'll link them. And with that, I wish you a pleasant day. Bye bye." } ]
nv6oFDp6rNQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Hopfield Networks is All You Need (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "schmidhuber", "hochreiter", "lstm", "gru", "rnn", "hopfield", "attention", "attention is all you need", "transformer", "bert", "query", "key", "value", "routing", "pattern", "retrieval", "store", "error", "exponental", "binary", "continuous", "hopfield network", "lse", "energy function", "update rule", "metastable", "separation" ]
#ai #transformer #attention Hopfield Networks are one of the classic models of biological memory networks. This paper generalizes modern Hopfield Networks to continuous states and shows that the corresponding update rule is equal to the attention mechanism used in modern Transformers. It further analyzes a pre-trained BERT model through the lens of Hopfield Networks and uses a Hopfield Attention Layer to perform Immune Repertoire Classification. OUTLINE: 0:00 - Intro & Overview 1:35 - Binary Hopfield Networks 5:55 - Continuous Hopfield Networks 8:15 - Update Rules & Energy Functions 13:30 - Connection to Transformers 14:35 - Hopfield Attention Layers 26:45 - Theoretical Analysis 48:10 - Investigating BERT 1:02:30 - Immune Repertoire Classification Paper: https://arxiv.org/abs/2008.02217 Code: https://github.com/ml-jku/hopfield-layers Immune Repertoire Classification Paper: https://arxiv.org/abs/2007.13505 My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM Abstract: We show that the transformer attention mechanism is the update rule of a modern Hopfield network with continuous states. This new Hopfield network can store exponentially (with the dimension) many patterns, converges with one update, and has exponentially small retrieval errors. The number of stored patterns is traded off against convergence speed and retrieval error. The new Hopfield network has three types of energy minima (fixed points of the update): (1) global fixed point averaging over all patterns, (2) metastable states averaging over a subset of patterns, and (3) fixed points which store a single pattern. Transformer and BERT models operate in their first layers preferably in the global averaging regime, while they operate in higher layers in metastable states. The gradient in transformers is maximal for metastable states, is uniformly distributed for global averaging, and vanishes for a fixed point near a stored pattern. Using the Hopfield network interpretation, we analyzed learning of transformer and BERT models. Learning starts with attention heads that average and then most of them switch to metastable states. However, the majority of heads in the first layers still averages and can be replaced by averaging, e.g. our proposed Gaussian weighting. In contrast, heads in the last layers steadily learn and seem to use metastable states to collect information created in lower layers. These heads seem to be a promising target for improving transformers. Neural networks with Hopfield networks outperform other methods on immune repertoire classification, where the Hopfield net stores several hundreds of thousands of patterns. We provide a new PyTorch layer called "Hopfield", which allows to equip deep learning architectures with modern Hopfield networks as a new powerful concept comprising pooling, memory, and attention. GitHub: this https URL Authors: Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, Victor Greiff, David Kreil, Michael Kopp, Günter Klambauer, Johannes Brandstetter, Sepp Hochreiter Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there. Today we'll look at hopfield networks is all you need by researchers from the Johannes Kepler University in Linz and the University of Oslo. So on high level this paper proposes a new type of hopfield networks that generalizes modern hopfield networks from binary patterns to continuous patterns and then shows that the retrieval update rule of these new hopfield networks is equivalent to the attention mechanism that's used in modern transformers. And it's actually a more general formulation of the attention mechanism and therefore it can be used to do kind of a variety of things to improve modern deep learning. And it also has a companion paper where it applies this to some kind of immunology research and achieves state-of-the-art in a task that is specifically suited to this type of attention. Alright let's dive in together we'll go over what this paper does what it proposes and so on. If you like pay if you like videos like this consider subscribing, you know sharing it out and I hope you're enjoying this. Alright also thanks to my discord community for you know very helpful bringing me up to speed on this paper. Super interesting discussions there. If you're not on our discord yet I invite you to join it's fun. Okay so what is a hopfield network? A hopfield network is a pretty kind of old style, an 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 5. So for example 10100 or 11010 and you'd have a list of these patterns and what your goal would be is to store these patterns in the neural network such that and 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 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 want a pattern that starts with 110 and you give that to the network and there would be a so-called update rule and the update rule is kind of an internal rule. So let's just go through this. So here this 110 maybe this is 110 and 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 the network weights have been adjusted correctly this will turn out then at the end of applying this update rule that this is a 1 and this is a 0 and therefore this pattern here is retrieved. Now had I input 101 at the beginning then the outcome would be different. Hopefully this pattern here would have been retrieved. 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 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 and I won't have a chance to to retrieve the one I want or the update rule will make a mistake so you might think this might be like five because I have five neurons or maybe ten because I have ten connections but it turns out that in modern hopfield networks with the appropriate update rule you can store exponentially many patterns in these networks exponentially many in the in the dimension of the in the dimension of the patterns and here I guess that would be the length of the pattern so this is a little bit surprising the kind of storage capacity of these networks and will this this paper here generalizes that to continuous to continuous states so what do we mean with continuous states I guess I mean continuous patterns so no longer is a pattern a binary string but a pattern now is a string of floating point numbers like 0.5 1.3 and so on and you know a string of floating or a sequence of floating point numbers is naturally depicted as a vector okay so our patterns are going to be different vectors that we store and you know in high dimensions that the 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 that works that hold for binary strings still hold if you go to these kind of continuous to these vector patterns that means you can store exponentially many patterns in the dimensions of the vector which is pretty surprising right because you'd think like you know after you have one vector per dimension that you know after that it might get a bit shaky but no you can actually store exponentially many that's pretty surprising and this paper is a lot about how to do that and the fact that that 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 all lead to different properties but what an update rule does ultimately is it minimizes what's called an energy so every type of hopfield network is associated with an energy function and this the energy function of the modern hopfield network for binary strings is this energy function right here so with X X is the pattern the pattern this is the kind of state of the hopfield network and these are the whatever is stored in the network and then the X here is the query that you enter into the network and then the energy here tells you this quantity you have to minimize this quantity in order to retrieve the pattern that you want okay now we are never directly working with the energy as such so what you could do is for example use backprop or something to use gradient descent to decrease the energy but usually along with an energy function comes an update function and the update function is what I've talked about here like you do something and then the network does something and then you get the pattern out what the network does is it minimizes its energy function and the update rule is made such that the corresponding energy function is minimized so the energy function is more like a theoretical consideration that you say okay here is my energy function of my hopfield network and the there will be a corresponding update rule that minimizes that energy function and if you use that update rule maybe multiple times then the energy function will be minimized and you will have retrieved your pattern or not if if you have too many patterns stored it might also fail right so they they say what the update rules are in the in the text here for the old hopfield networks but we're not really interested in the old ones we're interested in the ones that this paper cares about namely where the patterns that you store in the hopfield network are these vectors over our vector patterns and the query is also a vector pattern so you want to store all of these patterns into the hopfield network I'm gonna draw it like this here I'm gonna 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 you that 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 are now have continuous states and continuous queries this if you minimize the energy it basically means that your query can never you know go to infinity because you have the the query right here in the energy function the update rule is this right here and we'll look at that in a moment but remember the update rule is what you actually implement in code so if I if I have a query right here I plug it in here this is the state of my hopfield network and I apply this rule multiple times and out comes the kind of answer of the hopfield network to my question so the I input this and the out comes 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 so if you rewrite the beta here which is the softmax temperature in a way to be 1 over square root of D and if you take the query the psi here to be the query matrix and if you take the X here to be the key matrix then this is equivalent to the update or sorry the attention mechanism of a modern transformer so that's the point of the paper is that we can look at the transformer attention mechanism as a hopfield network and they have this interesting this interesting diagram at the end right here so the appendix you know this is typical I guess sep hoher I remember the cellul paper had like 60 pages of machine proof appendix this also this is 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 the input is so you have an input right here so this is attention mechanisms or at least transformers they work on sequences or sets of objects and from these you'll generate three things you'll generate the you'll generate the queries the keys and the values now you can either generate the queries from the same objects which would be self attention or you can generate the queries from like a different object over here it doesn't it doesn't matter too much for our discussions but either you you know have a reference input or you have you know this kind of same input all the way and then what you do is use three different heads or three different matrices to transform that input into queries keys and values so I often conceptualize this as you have kind of your input set and each of the input sets outputs a key and also each one which would be a vector and also each one outputs a query so I often draw this here the same sequence and each one outputs a query and the query sort of the query is kind of a request for information so the key exposes sort of what exposes something about the input here so this could be a sentence down here this could be my cat is very pretty and the the the vector the key vector right here could encode something like this is a noun or this is an animal or anything like this right and the query here it could ask for for other things so for example since this is cat this vector right here the query vector is generated from that you know token cat now it could recognize that cat is a noun and it could ask the other nodes to basically say are there any adjectives around here because you know adjectives because it itself is a noun it's the object of the sentence right it could ask are there any kind of adjectives that describe the object because that would be naturally a thing to ask if you were the noun you would want to know are there any kind of modifiers for for me so it could output the query and the query here could mean you know this direction could mean adjectives and you see here the word pretty is an adjective so it itself would output a key that says by the way I'm an adjective right so if the cat asks then if this node asks for an adjective and this outputs the 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 yeah but the this routing of information happens here where you multiply the queries and the keys and then you put a softmax over them okay so if you just look from the perspective of a single node like this node here this cat node what it would do is it would inner product its own query vector with all of the key vectors right so it would build an inner product with all of these and then it would normalize it would put it through a softmax which will kind of give it a distribution right so here would give it like so this is actually matches because my well my is also very important for cat this this this is just an accident I did not plan this this here this also well many things match but 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 then whatever comes out is not the query but it's also not that only key that matches right it's kind of a weighted average but with that key dominating okay now since you know in a hopfield network what we would do is we would go again we would put this new thing the red thing instead of the query vector okay so we would use this aggregated keys this weighted average as a new query vector for that node right here so we duplicate that node over here I'll use that query vector again and do the same thing again okay inner product with all of the query vectors and now since this is already an aggregate of the query vectors what's going to happen of course the distribution that's going to come out is going to be weighted even more heavily into the direction so let's make it even wider into the direction of that key that matches okay and you can pretty clearly see if I do that iteratively then that will lead to a situation where everything is like very low except that one key will sort of dominate the distribution and ultra high and ultra wide okay and that's how that's exactly how a hopfield network works right I would input the query which would be sort of what I want right I kind of know what I want okay and then I apply this rule multiple times and with each time I refine refine refine until I decide on a pattern the hopfield network is made for pattern retrieval and these here are the patterns that I want to retrieve so here the patterns aren't kind of stored in the network beforehand but the patterns are also generated like in an attention layer so the keys are generated by the previous layer or by these matrices but that doesn't matter for the hopfield network update rule so you see here that the attention mechanism can be interpreted as simply one step making one step of this update rule but you can think of making actually multiple steps and retrieving the particular key so you know deciding on a sort of a hard routing of particular information now that only works if if there are no other vectors that are close to that particular key right so if the query is this and you know the way I drew it here you can see that there are many there is this one and this one and this one that matches so technically the way I drew it what would happen most likely is no many no matter how many times you apply your update rule it would sort of result in kind of the average of the three keys right so because they're all matching and they would all contribute to that weighted average of the query in the next step and then that means basically the conversions would be to something in the middle and that's going to be a central point of this paper in which situation we are so they call the first part is retrieving a single pattern and they call the second situation where you have multiple patterns that all match that are not well separated from each other they call this a meta stable state and it's going to be pretty interesting to look at transform like BERT language models and look at where they actually are are they actually operating in this single pattern retrieval mode or are they operating in the meta stable state mode all right so here you can see it in the diagram the only thing different this from a hop field network sorry from an attention mechanism is this branch right here so here you ask do you want to do multiple updates after you've you've multiplied the queries and the keys do you want to do multiple updates if yes so if you're in a this hop field network situation you want to do multiple updates then you go back as you can see and you do you use the keys together with the output of the softmax to generate a new query so this query queue here is now generated from the output here and the key so the keys are the same these are this is the same thing it's just put here twice okay this is exactly what we discussed okay I hope that's some somehow clear that these the the attention mechanism is simply a one step hop field network pattern retrieval algorithm with a particular update rule that is that is matches this energy function that they propose right here of course they do this you know particularly because the update rule that turns out is the transformer update rule but but I actually don't know if they backwards engineered the energy function to match the transformer or if they first came up with a continuous hop field networks and then just kind of discovered that it's like the transformer will maybe never find out okay so let's go there are a couple of theorems I believe there are four five theorems right here that show that kind of make some points about this about this stuff and we'll go through them won't go through the proofs or any you know super in-depth meaning but it's pretty cool to go through them and they are proved very rigorously as I said there's a 70 page appendix so have a look at that if you're up for it okay so they say here we have an update rule this is our update rule for our new hop field networks so the first theorem they serve 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 sorry for t goes to infinity yeah if this is a fixed point basically saying that if I apply this update rule here over and over and over again it will it will make this energy function converge to a fixed it will make this energy function converge don't want to say anything mistakenly here or claim too much but that basically connects the update rule to the energy okay so just showing like this really is the update rule for that particular energy function okay now as as itself it's not super duper interesting yet but now we get to theorem 2 so theorem 2 for the iteration that's the update rule that we just looked at we have we have that this convergence holds as t goes to infinity for some stationary point furthermore this quantity here goes to zero so that means this is the the update at t plus one and this is the update at t and the difference between them goes to zero so that means not only does the energy converge but the iterates themselves 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 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 3 converges to some fixed point so you know 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 for Hopfield network is so we've established that the update rule minimizes the appropriate energy and the update rule will converge at some point which means that we can you know if it converges we can retrieve the pattern that it converges to so now we define how many patterns can we actually store for that we need to know what does it mean for a pattern to be stored so we assume that we have patterns and these patterns are called X okay X I we have n different patterns each one is called X with a subscript we assume that around every pattern a sphere is given so how do we imagine this we have these patterns and this is this is just a space that they consider patterns of the on a sphere but we'll just conceptualize it as this will have a space there are patterns we want to store okay and we'll say around every pattern there is a sphere okay sphere like this and naturally the patterns are going to be there's going to be a notion of well separated patterns and you can imagine this a little bit like these spheres won't be touching each other if these spheres aren't touching each other that means that the patterns are kind of well separated and that means that if we initialize the query remember the query here is a vector that kind of sort of looks like a pattern and that means the query is kind of close to the pattern in some notion of distance so if we initialize the query somewhere in that sphere then it might if it converges to that sphere to that pattern then we retrieve the pattern okay now it gets a bit more complicated than this but not much more we say a pattern is stored if there is a single fixed point inside the sphere to which all points that start inside the sphere converge and none of the spheres intersect so the sphere of point I doesn't intersect with the sphere of point J so that's where we say all these spheres are non intersecting we say X 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 X I this is the actual pattern and you have X I star this is the retrieved pattern so these hopeful they don't always have to give you the same thing that you stored that's part of the the nature of continuous neural networks whatnot so for every sphere we say there is a pattern there is a sphere now we as pattern is stored if every I can start wherever I want in this sphere okay wherever I want it will always converge to a point that's inside the sphere 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 can't guarantee it now there are going to be theorems that deal exactly with this retrieval error but first you can see that here if if these spheres become larger you you can't accurately store a pattern anymore so this is the kind of ideal situation but there are also situations where these spheres you know if I have these patterns right here these spheres are so large kind of the the attractions of the patterns are so large that if I start let's say here then I don't converge to either of these two patterns I converge to like something in the middle I converge to maybe this point right here and that's going to be one of these meta stable states okay we're going to encounter situations like this but we're also going to encounter situations like this and the bottom thing isn't necessarily bad and that's what you have to keep in mind and yeah as I said we'll get to it but just keep this kind of sphere image in mind okay so first we'll just deal with the you know the up the top situation where we store patterns and then retrieve patterns so we'll assume a failure probability which is P and P is going to be no pretty pretty low for their example so they have P equals 0.001 you know like a 0.1 percent 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 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 examples here are where C is something like 3 and D is 20 so if you were to add a 21st dimension then your I guess storage capacity would increase by a factor of 3 which pretty cool alright so this is how many that we can store infinitely not sorry exponentially many patterns in these networks now they deal they say the next theorem states that the update rule typically converges after one update if the patterns are well separated okay so if we're in a situation where these patterns are well separated which is kind of like this but you can also imagine this in terms of dot products because we operate in the space of dot products so if the patterns are well separated that sort of means that they all kind of sort of point away from each other and this notion of separation is going to be captured by this quantity right here this is the separation of example of pattern I which is just the inner product with itself minus the maximum inner product with any other pattern and this quantity is going to be 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 I have a query calculate the inner product with all of those then I reweigh all of the patterns by that inner product by the softmax then I use that new thing as a query again and so on as we discussed it will converge to the closest pattern but this theorem says it actually converges pretty fast and here I have my problems with saying that it converges after one step typically converges after one update because that you know genuinely depends on a lot of constants as we'll see but it does converge exponentially fast in this separation constant as a theorem for says with query psi 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 Jacobian and its value in the mean value theorem are the following so here you can see this is the distance between the updated psi after one step and the and the fixed point right here this is what it converges to is going to be the distance as it was before times this thing right here so you can see since this is a this is a multiplicative update and in this Jacobian so this is expanded down here this is this you can see here you have the you have this sorry yeah this is this so this is bounded by that you have the exponent the exponential function negative this separation right here so the higher the separation the faster this algorithm converges okay to say that it converges after one step is you know it might be a bit of bragging I don't know if this is a common thing if you have like an exponential convergence that you are allowed to say it's after one step I'm not sure especially what I'm not sure about is that you have n here as linear constants in that factor okay so if you if you and that's what they do in their code so if you look at their code and the codes available which is pretty cool it's implemented in pytorch as a general module that can you can just drop in so this is not only for transformers this is for you can replace like LSTM's you can replace pooling mechanisms you can you know do a whole bunch of stuff in their paper in the company paper they do this multi instance learning with giant sets on using these hopfield layers so pretty pretty cool this code is definitely worth kind of checking out and maybe you want to replace some stuff with you but the question is how many of these update steps should you do right because we looked at the diagram at least in the attention mechanism it seems like you have attention layers right you have a transformer and the transformer consists of you know you have this input right here and you go through layer layer layer layer layer and in each layer there's contained in it and one of these attention mechanism right this entire thing is in this layer okay and now if you interpret this as a hopfield network and you want to do multiple steps that means you go this branch right here so in each layer potentially you do multiple steps of these things so for whatever computational constraints transformers had already this will certainly make it worse but also you need to decide how many steps you want to do now you can hard code that of course but they say you should do these steps until this norm here until the norm between the old and the new is small enough so where is that so you can't measure how close you are to the convergence points right because you don't know in practice but you can measure how far you're away you can measure where did we have it you can measure this quantity right here that's something you can measure how far two iterates are apart so what you'll simply do is you'll measure that and if that is small enough then you'll you'll stop but that I guess is very related to this so how if you we've already proven it converges to this X star so I guess we can approximate this quantity right here with the quantity above and that tells you how many updates you need to do and that quantity is linear not only linear but actually here quadratic in n I don't care you know yes it's exponential in the separation but it's quadratic in n and if I've learned anything from kind of my fast code courses is that constants actually matter when you're not dealing with infinity with an infinite number of steps so the number of the number of steps you need to do I guess will depend on the sequence length in a quadratic fashion so I'm not sure you can always claim this is convergence in one step now I might be super mistaken here and none of this will can none of this actually makes a difference in the in the light of the exponential decay here but I would just I'm just a bit worried saying this usually converges in one step it's clear I guess why they do it right because the attention mechanism in transformers is a one-step application of this rule and this here is kind of a theoretical justification for interpreting this precisely as a hopfield network because you'd say well in a hopfield network you would do multiple steps but wait wait we can actually prove that even if you interpret it as a hopfield network you it can it usually converges after one step so what you're actually doing in a transformer is applying a hopfield network update rule to convergence so yeah I'm not yeah I might be bickering on a high level here luxury problems theorem five then says so theorem four is how fast does this converge theorem five the last theorem right here says that the retrieval error of a pattern 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 theorems one and two deal with the convergence of this algorithm and the fact that it actually minimizes the proposed energy then theorem three says you can store exponentially many patterns in terms of the dimension of your space and theorems four and five say that this update rule will converge exponentially fast after after one step if you believe that and the retrieval error will also go down exponentially fast with the number of update steps that you do okay that sounds pretty pretty pretty good but we've heard it it's very dependent on how well separated these patterns are and it turns out that is you know at least in transformers they aren't always well separated and that might be on purpose remember the the states here the patterns aren't pre stored like in a classic hopfield network but the patterns if you interpret an attention mechanism as this are also generated by the network itself so the pattern matrix that you retrieve from and the query are generated by the attention mechanism in this case as I said this is applicable to many many more domains than just this but yeah so there's another slight modification that you have to do to make this actually equivalent to an attention mechanism and that is you'll have to recast the value because usually what you'll do is you have some sort of input and then you make queries keys and values from that using different heads the only thing to make it formally equivalent is you have to make the values generated from the keys so the keys give rise to the values as you can see right here that you first multiply with the key matrix and then with the value matrix I think that's you know that I don't I doubt that this will will change anything if you if you the only way that could really change anything is if this matrix here would be super low rank like collapse the space of into like very few dimensions which the value matrix wouldn't do so you know but just letting you know that the technical equality requires this slight modification okay now we said that it might not you know be that this is always super well separate and you retrieve a single pattern and that's what they research here in a pre trained BERT model so they take a pre trained BERT model from I guess from hugging face and they run they just run a data set through it and what they do is so for each for each query and sorry for each attention head because you have multiple ones of these attention heads right in each layer so in each layer you have multiple of these heads for each head they look at over the course of the whole data set how do these softmax distributions look like so when you believe that this is a hopfield network and you believe that this converges in one step then if the patterns are well separated what we would expect is a distribution as we said like this okay there 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 hopfield network sort of failed right it wouldn't give you back one particular pattern so they have I think that's a pretty it's a pretty smart experiment they look how many bars do we need to add how many of these bars in the softmax distribution do we need to add to reach 90% so it depends a bit on the temperature of the softmax which is hard coded in attention mechanism bdb is 1 this squared over d so they say how many do we need to add to get to 0.9 to 90% of the mass of this distribution and if this is the hopfield network where you retrieve one pattern then one will be enough right one of these bars will probably be I don't know like 99% okay but there are other cases imagine the case where the patterns and the query you retrieve the spheres that it gives rise to are all like overlapping okay so what that will do is it won't converge to any particular pattern but the attractor space in this kind so you can imagine if you have two spheres that are apart from each other the update rule converges either so if it's closer to here it converge here if it's closer to here it'll converge here but if they are overlapping like this the energy landscape will actually make it such that it will neither if it starts somewhere it will neither converge to here nor to here it will actually converge to somewhere in the middle okay into the mean of the stored patterns and if we take that to the extreme what could be is it could be that the softmax distribution looks completely uniform okay which would basically mean that you know I don't care where my information comes from just average and this has its applications so if you for example want to make a sentiment classifier very cheap way to do that is to simply take pre-trained word embeddings like glove or word2vec you know assign each word word embedding and then just average the word embeddings okay and you count on the fact if there are a lot of kind of negative words in there like bad sad angry the word embedding kind of will you know reflect that and the average word embedding will point more into the bad direction and if there's a lot of happy words the average will point into the happy direction okay so there are applications of averaging information not caring particularly where it comes from and in that case what we'd expect is that this number and we'll call that so we'll call that the number K in this case it equals one but in this case K equals I guess N the number of inputs okay because we need well not maybe N but you know approximately we need almost all of them to to reach the 90% okay and there is an in-between and these are called these meta stable states where 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 Hopfield update rules as somehow you know getting not going to a particular pattern but going to sort of a cluster and this is if you ask something like hey is there any adjective around right and all of these patterns they kind of overlap in that space in that query space of adjective they overlap and therefore the update rule would converge to sort of the mean which would basically say yes there is an adjective here right and the information would not be routed so that the distribution if we start here writing we converge to this the distribution would look something like small small small and then you'd have a couple of large ones all right you'd have like maybe two or three or four of large ones and these would exactly correspond to the patterns here so the information will be routed from all of those in that cluster to this particular note that asks the query okay these are these are what's called these meta stable states and what they do is they calculate over the entire data set this number K and here they show you the distribution so in these plots what you'll see is over the entire data set K goes into that direction so I guess let's go to Tiz here this 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 or like very few numbers okay so these blue ones would be these are your typical like when you retrieve one particular pattern so this attention head 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 these green and orange ones correspond to these meta stable states where there's kind of an implicit clustering done in the in this space of attention whereas the blue ones they correspond to attention 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 I need all of these bars to get to the 90% or I need almost all of them which basically means it's a uniform distribution right so it's like I don't care where information comes from just average whatever average I just want the average in some particular space and as we said that also has its uses interesting how this translate through so this here is as we go down the BERT model on the bottom 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 interpret this as you as you want I'm gonna 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 this is where I guess this is where the thinking happens so this is sort of pre-processing I'm just making stuff up here by the way this is this must be a no way true this is maybe thinking and this this here this might already be output again because you know after that you have language modeling or classification so this might already be like aggregating types of information this is how I sort of interpreted okay yeah so so this these these experiments are pretty pretty pretty interesting and here they have they do these are the last experiments for this paper they do an interesting experiment where they actually replace the attention heads by simply an average mechanism and later they actually replace them by Gaussians but in this case they simply average and they show that look if I replace layer one with this averaging the perplexity doesn't rise that much 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 contrast to how much red and orange ones there are so here you have lots of blue ones and you can see that the error kind of goes up and interestingly here you have more meta stable states at the end but still the perplexity goes up more so I guess you can only really replace the red ones with the averaging so this is always averaging in one particular layer and they go into more detail here where they say look this is this is layer 6 and this is layer 12 so this is one particular attention head from layer 6 and layer 12 and the updates don't be confused it goes in this direction okay I was confused at first and you can see right here this number K at first you know it's kind of spread out but then it pretty quickly converges to a very small number and there is this kind of point right here I don't know if the learning rates decrease I don't think so I think that's just kind of a a phase transition right here this is the blue line by the way the blue training line a phase transition where all of a sudden these just these attention heads they somehow decide okay this is the thing I want to specialize in this is the type of task I want like a sub task of linguistic sub task I want to specialize in and then they concentrate on one particular pattern per input so they are really specializing whereas in the last layer you see here that even during training they are sort of continuously learning so first they also do this averaging then they go into this meta stable region right this is this meta stable region K isn't one but also K isn't a very high number so they continuously learn and it's even indicative of this training might not be done here first of all and second of all it would be really interesting to see how this works out with you know sizes of transformers and like especially these these huge transformers just the fact that they can keep learning the more we train them might be you know be interpreted in the light of what kind of states they converge to and the fact that their attention heads I don't know how does this go on do they stay in the meta stable states because it makes sense to have meta stable states as I said it makes sense to kind of cluster things or are they simply into is this simply an intermediate step and if you go really far down they would actually also converge to the K equals one where they really specialize or if you do we need more attention heads for this I don't know it's just I think this is just the the beginning of kind of research in this direction I think just this kind of number K how it's how it's made it's pretty simple and apparently it's pretty pretty revealing so you know that's pretty cool so that was the paper and its experiments it's it's a pretty sizable paper as I said even the paper itself is ten pages and then there is this immune repertoire classification which I will like spend one minute looking at it so you have you have these set classifications so for each human you obtain a set of immune receptors and you simply obtain one label whether that human is immune to a particular disease or not and your task is kind and then a different human has a different set you have no idea which one of these things is responsible for it being for the human being for the human being immune or not in fact there is a you can't even decide based on these you can only decide based on like sub sequences of these and they might be in combination with each other so there might not be a single one responsible but like a combination but you don't have labels for the individual ones and you have different ones per human and they are different length all of this is just a giant giant task and you have many of them you have 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 hop field attention mechanism or with with learned queries over these things and then they train on the output label and surprisingly that actually works even with tens of thousands of inside sequences and only one label for all of them and so they they achieve I guess favorable results compared to other baselines on this task using these hop field network which is pretty interesting but I let you look at that paper yourself so I hope this somehow made it a bit clear what happens here and it would actually be pretty interesting if we you know to see what happens if we just do maybe two rounds of these updates is this even desirable right is it desirable to run this to convergence is there something good about not running into convergence or does it actually not matter because it actually does converge in one step I don't know but have a look at the code it's pretty cool and I hope you 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 next time bye bye
[ { "start": 0, "end": 4.86, "text": " Hi there. Today we'll look at hopfield networks is all you need by researchers" }, { "start": 4.86, "end": 11.64, "text": " from the Johannes Kepler University in Linz and the University of Oslo. So on" }, { "start": 11.64, "end": 17.2, "text": " high level this paper proposes a new type of hopfield networks that generalizes" }, { "start": 17.2, "end": 22.740000000000002, "text": " modern hopfield networks from binary patterns to continuous patterns and then" }, { "start": 22.740000000000002, "end": 29.060000000000002, "text": " shows that the retrieval update rule of these new hopfield networks is equivalent" }, { "start": 29.06, "end": 35.36, "text": " to the attention mechanism that's used in modern transformers. And it's actually a" }, { "start": 35.36, "end": 39.8, "text": " more general formulation of the attention mechanism and therefore it can" }, { "start": 39.8, "end": 44.68, "text": " be used to do kind of a variety of things to improve modern deep learning." }, { "start": 44.68, "end": 50.2, "text": " And it also has a companion paper where it applies this to some kind of" }, { "start": 50.2, "end": 56.04, "text": " immunology research and achieves state-of-the-art in a task that is" }, { "start": 56.04, "end": 62, "text": " specifically suited to this type of attention. Alright let's dive in together" }, { "start": 62, "end": 69.12, "text": " we'll go over what this paper does what it proposes and so on. If you like pay if" }, { "start": 69.12, "end": 73.32, "text": " you like videos like this consider subscribing, you know sharing it out and" }, { "start": 73.32, "end": 82.12, "text": " I hope you're enjoying this. Alright also thanks to my discord community for you" }, { "start": 82.12, "end": 87.88000000000001, "text": " know very helpful bringing me up to speed on this paper. Super interesting" }, { "start": 87.88000000000001, "end": 92.92, "text": " discussions there. If you're not on our discord yet I invite you to join it's" }, { "start": 92.92, "end": 102.10000000000001, "text": " fun. Okay so what is a hopfield network? A hopfield network is a pretty kind of" }, { "start": 102.10000000000001, "end": 110.36000000000001, "text": " old style, an old conceptualization of a neural network. So in a hopfield network" }, { "start": 110.36, "end": 115.92, "text": " what your goal would be is you can conceptualize it as a bit of a neural" }, { "start": 115.92, "end": 122.64, "text": " network. So let's say we have five neurons or something like this. What your" }, { "start": 122.64, "end": 127.1, "text": " goal would be is to have a neural network where you can store so-called" }, { "start": 127.1, "end": 134.07999999999998, "text": " patterns and a pattern in this case would be a binary string of size 5. So" }, { "start": 134.08, "end": 143.84, "text": " for example 10100 or 11010 and you'd have a list of these patterns and what" }, { "start": 143.84, "end": 148.84, "text": " your goal would be is to store these patterns in the neural network such that" }, { "start": 148.84, "end": 152.76000000000002, "text": " and here you know we'll just consider everything to be sort of connected to" }, { "start": 152.76000000000002, "end": 160.48000000000002, "text": " everything else and what your goal would be in this is that you can kind of store" }, { "start": 160.48, "end": 167.16, "text": " patterns inside this neural network and you adjust the weights somehow. So this" }, { "start": 167.16, "end": 173.64, "text": " was as I said this was this was this is kind of an old model. You store you adapt" }, { "start": 173.64, "end": 177.72, "text": " the weights such that you store these patterns. And what does it mean for a" }, { "start": 177.72, "end": 182.48, "text": " pattern to be stored? If you have stored a pattern you will then be" }, { "start": 182.48, "end": 187.35999999999999, "text": " able to retrieve it and you retrieve a pattern in these kind of old style" }, { "start": 187.36, "end": 193.68, "text": " Hopfield networks by providing a partial pattern. So what you'll say is for" }, { "start": 193.68, "end": 199.44000000000003, "text": " example I want a pattern that starts with 110 and you give that to the" }, { "start": 199.44000000000003, "end": 204.48000000000002, "text": " network and there would be a so-called update rule and the update rule is kind" }, { "start": 204.48000000000002, "end": 211.36, "text": " of an internal rule. So let's just go through this. So here this 110 maybe" }, { "start": 211.36, "end": 217.64000000000001, "text": " this is 110 and then they would kind of send messages around so this update" }, { "start": 217.64000000000001, "end": 224.28, "text": " rule would somehow adjust the value of this and this neuron here to what's most" }, { "start": 224.28, "end": 229.24, "text": " compatible with the network weights and if the network weights have been" }, { "start": 229.24, "end": 234.20000000000002, "text": " adjusted correctly this will turn out then at the end of applying this update" }, { "start": 234.20000000000002, "end": 240.8, "text": " rule that this is a 1 and this is a 0 and therefore this pattern here is" }, { "start": 240.8, "end": 248.76000000000002, "text": " retrieved. Now had I input 101 at the beginning then the outcome would be" }, { "start": 248.76000000000002, "end": 254, "text": " different. Hopefully this pattern here would have been retrieved. So you" }, { "start": 254, "end": 259.40000000000003, "text": " can see the applications of this like you can have the first three digits as" }, { "start": 259.40000000000003, "end": 263.92, "text": " sort of a database key and then the last ones as sort of the value that you store" }, { "start": 263.92, "end": 267.84000000000003, "text": " along with it and then you can simply provide the first few. You can also" }, { "start": 267.84, "end": 273.96, "text": " provide you don't always have to provide three so this all depends. This is" }, { "start": 273.96, "end": 278.64, "text": " sort of an as I said an old conceptualization of neural networks so" }, { "start": 278.64, "end": 283.52, "text": " people were imagining that this is kind of how the brain works you know fire" }, { "start": 283.52, "end": 291.35999999999996, "text": " together wire together and also with research into this it turns out that you" }, { "start": 291.35999999999996, "end": 294.59999999999997, "text": " know you might think you know there's there's kind of five neurons so maybe I" }, { "start": 294.6, "end": 299.08000000000004, "text": " can store five different patterns you know accurately because if I store too" }, { "start": 299.08000000000004, "end": 305.56, "text": " many patterns right if I have many many many many patterns then I can't expect" }, { "start": 305.56, "end": 310.44, "text": " to be able to retrieve all the patterns again because some of them will just be" }, { "start": 310.44, "end": 317.08000000000004, "text": " so equal that you know many will start maybe with this and and I won't have a" }, { "start": 317.08000000000004, "end": 324.08000000000004, "text": " chance to to retrieve the one I want or the update rule will make a mistake so" }, { "start": 324.08, "end": 327.4, "text": " you might think this might be like five because I have five neurons or maybe ten" }, { "start": 327.4, "end": 332.91999999999996, "text": " because I have ten connections but it turns out that in modern hopfield" }, { "start": 332.91999999999996, "end": 338.91999999999996, "text": " networks with the appropriate update rule you can store exponentially many" }, { "start": 338.91999999999996, "end": 345.76, "text": " patterns in these networks exponentially many in the in the dimension of the in" }, { "start": 345.76, "end": 349.26, "text": " the dimension of the patterns and here I guess that would be the length of the" }, { "start": 349.26, "end": 354.65999999999997, "text": " pattern so this is a little bit surprising the kind of storage capacity" }, { "start": 354.65999999999997, "end": 363.36, "text": " of these networks and will this this paper here generalizes that to continuous" }, { "start": 363.36, "end": 368.84, "text": " to continuous states so what do we mean with continuous states I guess I mean" }, { "start": 368.84, "end": 374.59999999999997, "text": " continuous patterns so no longer is a pattern a binary string but a pattern" }, { "start": 374.6, "end": 382.84000000000003, "text": " now is a string of floating point numbers like 0.5 1.3 and so on and you" }, { "start": 382.84000000000003, "end": 387.24, "text": " know a string of floating or a sequence of floating point numbers is naturally" }, { "start": 387.24, "end": 392.44, "text": " depicted as a vector okay so our patterns are going to be different" }, { "start": 392.44, "end": 400.24, "text": " vectors that we store and you know in high dimensions that the the vectors" }, { "start": 400.24, "end": 405, "text": " will be kind of separated well from each other as long as we don't have too many" }, { "start": 405, "end": 411.64, "text": " but this paper shows that all these properties for the modern hopfield that" }, { "start": 411.64, "end": 417.40000000000003, "text": " works that hold for binary strings still hold if you go to these kind of" }, { "start": 417.40000000000003, "end": 423.68, "text": " continuous to these vector patterns that means you can store exponentially many" }, { "start": 423.68, "end": 428.52, "text": " patterns in the dimensions of the vector which is pretty surprising right" }, { "start": 428.52, "end": 434.2, "text": " because you'd think like you know after you have one vector per dimension that" }, { "start": 434.2, "end": 438.71999999999997, "text": " you know after that it might get a bit shaky but no you can actually store" }, { "start": 438.71999999999997, "end": 444.08, "text": " exponentially many that's pretty surprising and this paper is a lot about" }, { "start": 444.08, "end": 449.35999999999996, "text": " how to do that and the fact that that happens and so on so we've talked about" }, { "start": 449.35999999999996, "end": 455.84, "text": " update rules for these kind of hopfield networks and I haven't really specified" }, { "start": 455.84, "end": 459.79999999999995, "text": " what that is I've just said that you know I enter a pattern and then the" }, { "start": 459.79999999999995, "end": 465.47999999999996, "text": " network does something and outcomes outcomes the whatever the pattern that" }, { "start": 465.47999999999996, "end": 472.03999999999996, "text": " matches my query so this here is called a query you might already this is on" }, { "start": 472.03999999999996, "end": 478.59999999999997, "text": " purpose like the kind of overlap between the attention mechanism lingo and the" }, { "start": 478.59999999999997, "end": 482.96, "text": " hopfield network lingo we're going to conflate the two to kind of make clear" }, { "start": 482.96, "end": 488.12, "text": " where the two overlap if you don't know what an attention mechanism is or aren't" }, { "start": 488.12, "end": 492.59999999999997, "text": " familiar with it watch my video on attention is all you need once you watch" }, { "start": 492.59999999999997, "end": 499.88, "text": " that this video will make a lot more sense all right so in what the update" }, { "start": 499.88, "end": 504.44, "text": " rule does is specifically in the update rule that there isn't only one right" }, { "start": 504.44, "end": 508.52, "text": " there are many different proposals of hopfield networks and they all lead to" }, { "start": 508.52, "end": 513.88, "text": " different properties but what an update rule does ultimately is it minimizes" }, { "start": 513.88, "end": 520, "text": " what's called an energy so every type of hopfield network is associated with an" }, { "start": 520, "end": 526.1999999999999, "text": " energy function and this the energy function of the modern hopfield network" }, { "start": 526.1999999999999, "end": 533.96, "text": " for binary strings is this energy function right here so with X X is the" }, { "start": 533.96, "end": 540.72, "text": " pattern the pattern this is the kind of state of the hopfield network and these" }, { "start": 540.72, "end": 545.08, "text": " are the whatever is stored in the network and then the X here is the" }, { "start": 545.08, "end": 553.32, "text": " query that you enter into the network and then the energy here tells you this" }, { "start": 553.32, "end": 558.1800000000001, "text": " quantity you have to minimize this quantity in order to retrieve the" }, { "start": 558.18, "end": 564.16, "text": " pattern that you want okay now we are never directly working with the energy" }, { "start": 564.16, "end": 568.7199999999999, "text": " as such so what you could do is for example use backprop or something to" }, { "start": 568.7199999999999, "end": 576.2399999999999, "text": " use gradient descent to decrease the energy but usually along with an energy" }, { "start": 576.2399999999999, "end": 581.4799999999999, "text": " function comes an update function and the update function is what I've talked" }, { "start": 581.4799999999999, "end": 585.04, "text": " about here like you do something and then the network does something and then" }, { "start": 585.04, "end": 590.8399999999999, "text": " you get the pattern out what the network does is it minimizes its energy function" }, { "start": 590.8399999999999, "end": 595.8, "text": " and the update rule is made such that the corresponding energy function is" }, { "start": 595.8, "end": 600.4399999999999, "text": " minimized so the energy function is more like a theoretical consideration that" }, { "start": 600.4399999999999, "end": 605.52, "text": " you say okay here is my energy function of my hopfield network and the there" }, { "start": 605.52, "end": 610.52, "text": " will be a corresponding update rule that minimizes that energy function and if" }, { "start": 610.52, "end": 615.84, "text": " you use that update rule maybe multiple times then the energy function will be" }, { "start": 615.84, "end": 621.48, "text": " minimized and you will have retrieved your pattern or not if if you have too" }, { "start": 621.48, "end": 628.24, "text": " many patterns stored it might also fail right so they they say what the update" }, { "start": 628.24, "end": 633.76, "text": " rules are in the in the text here for the old hopfield networks but we're not" }, { "start": 633.76, "end": 637.76, "text": " really interested in the old ones we're interested in the ones that this paper" }, { "start": 637.76, "end": 641.72, "text": " cares about namely where the patterns that you store in the hopfield network" }, { "start": 641.72, "end": 648.12, "text": " are these vectors over our vector patterns and the query is also a vector" }, { "start": 648.12, "end": 652.96, "text": " pattern so you want to store all of these patterns into the hopfield network" }, { "start": 652.96, "end": 658.2, "text": " I'm gonna draw it like this here I'm gonna store it into the hopfield" }, { "start": 658.2, "end": 663.2, "text": " network and then after that you want to come up with a query and the query is" }, { "start": 663.2, "end": 670, "text": " like this and in the case of the binary strings we had something like well I" }, { "start": 670, "end": 677.1600000000001, "text": " sort of know half of my binary string now in the vector hopfield network it's" }, { "start": 677.1600000000001, "end": 683.36, "text": " more like well I sort of kind of know the direction that my vector should point" }, { "start": 683.36, "end": 690.6, "text": " in okay and you will read what you want to retrieve is the vector that has kind" }, { "start": 690.6, "end": 696, "text": " of a large inner product okay so if I enter this query into my hopfield" }, { "start": 696, "end": 700.48, "text": " network what I hope is that this vector here is retrieved now you see it's not" }, { "start": 700.48, "end": 705.12, "text": " exactly the same vector like they do point if I translate that here by I it's" }, { "start": 705.12, "end": 712.16, "text": " maybe something like this but so they are different but you want to say well I" }, { "start": 712.16, "end": 716.88, "text": " kind of know what I want I kind of want something like this and then the hopfield" }, { "start": 716.88, "end": 720.64, "text": " network would answer with oh I have something like this it's this right here" }, { "start": 720.64, "end": 727, "text": " okay so you that the connection to attention mechanism should become pretty" }, { "start": 727, "end": 733.64, "text": " pretty obvious right now but you know the to actually establish this formally" }, { "start": 733.64, "end": 740.04, "text": " is the kind of the point of this paper and you know it's pretty cool to see so" }, { "start": 740.04, "end": 745.2, "text": " they formulate this new energy right here this is the energy of this new" }, { "start": 745.2, "end": 752, "text": " continuous hopfield network specifically they have to have this term right here" }, { "start": 752, "end": 755.96, "text": " because they are now have continuous states and continuous queries this if" }, { "start": 755.96, "end": 760.2800000000001, "text": " you minimize the energy it basically means that your query can never you know" }, { "start": 760.2800000000001, "end": 766.5600000000001, "text": " go to infinity because you have the the query right here in the energy function" }, { "start": 766.5600000000001, "end": 772.9200000000001, "text": " the update rule is this right here and we'll look at that in a moment but" }, { "start": 772.92, "end": 780.56, "text": " remember the update rule is what you actually implement in code so if I if I" }, { "start": 780.56, "end": 786.3199999999999, "text": " have a query right here I plug it in here this is the state of my hopfield" }, { "start": 786.3199999999999, "end": 795.28, "text": " network and I apply this rule multiple times and out comes the kind of answer" }, { "start": 795.28, "end": 802.48, "text": " of the hopfield network to my question so the I input this and the out comes" }, { "start": 802.48, "end": 808.96, "text": " this after I update after I apply the update rule maybe multiple times right" }, { "start": 808.96, "end": 815.84, "text": " and interestingly you can already see that this here if you rewrite a bunch of" }, { "start": 815.84, "end": 819.48, "text": " these quantities so if you rewrite the beta here which is the softmax" }, { "start": 819.48, "end": 826.3000000000001, "text": " temperature in a way to be 1 over square root of D and if you take the query the" }, { "start": 826.3000000000001, "end": 832.16, "text": " psi here to be the query matrix and if you take the X here to be the key matrix" }, { "start": 832.16, "end": 838.64, "text": " then this is equivalent to the update or sorry the attention mechanism of a" }, { "start": 838.64, "end": 844.0799999999999, "text": " modern transformer so that's the point of the paper is that we can look at the" }, { "start": 844.0799999999999, "end": 851.56, "text": " transformer attention mechanism as a hopfield network and they have this" }, { "start": 851.56, "end": 861.36, "text": " interesting this interesting diagram at the end right here so the appendix you" }, { "start": 861.36, "end": 868.28, "text": " know this is typical I guess sep hoher I remember the cellul paper had like 60" }, { "start": 868.28, "end": 875.2, "text": " pages of machine proof appendix this also this is like 70 page appendix crazy" }, { "start": 875.2, "end": 880.6800000000001, "text": " but at the end of the appendix you'll find this diagram right here now usually" }, { "start": 880.6800000000001, "end": 887.36, "text": " in an attention mechanism you have whatever the the input is so you have an" }, { "start": 887.36, "end": 892.92, "text": " input right here so this is attention mechanisms or at least transformers they" }, { "start": 892.92, "end": 899.04, "text": " work on sequences or sets of objects and from these you'll generate three things" }, { "start": 899.04, "end": 906.48, "text": " you'll generate the you'll generate the queries the keys and the values now you" }, { "start": 906.48, "end": 910.64, "text": " can either generate the queries from the same objects which would be self" }, { "start": 910.64, "end": 914.5600000000001, "text": " attention or you can generate the queries from like a different object over" }, { "start": 914.56, "end": 921.68, "text": " here it doesn't it doesn't matter too much for our discussions but either you" }, { "start": 921.68, "end": 927.3199999999999, "text": " you know have a reference input or you have you know this kind of same input" }, { "start": 927.3199999999999, "end": 935.28, "text": " all the way and then what you do is use three different heads or three different" }, { "start": 935.28, "end": 942.52, "text": " matrices to transform that input into queries keys and values so I often" }, { "start": 942.52, "end": 947.84, "text": " conceptualize this as you have kind of your input set and each of the input" }, { "start": 947.84, "end": 956.24, "text": " sets outputs a key and also each one which would be a vector and also each" }, { "start": 956.24, "end": 964.6, "text": " one outputs a query so I often draw this here the same sequence and each one" }, { "start": 964.6, "end": 971.76, "text": " outputs a query and the query sort of the query is kind of a request for" }, { "start": 971.76, "end": 979.64, "text": " information so the key exposes sort of what exposes something about the input" }, { "start": 979.64, "end": 986.28, "text": " here so this could be a sentence down here this could be my cat is very pretty" }, { "start": 986.28, "end": 995.36, "text": " and the the the vector the key vector right here could encode something like" }, { "start": 995.36, "end": 1000.8, "text": " this is a noun or this is an animal or anything like this right and the query" }, { "start": 1000.8, "end": 1009.52, "text": " here it could ask for for other things so for example since this is cat this" }, { "start": 1009.52, "end": 1015.4, "text": " vector right here the query vector is generated from that you know token cat" }, { "start": 1015.4, "end": 1024.04, "text": " now it could recognize that cat is a noun and it could ask the other nodes to" }, { "start": 1024.04, "end": 1030.96, "text": " basically say are there any adjectives around here because you know adjectives" }, { "start": 1030.96, "end": 1036.56, "text": " because it itself is a noun it's the object of the sentence right it could" }, { "start": 1036.56, "end": 1040.1599999999999, "text": " ask are there any kind of adjectives that describe the object because that" }, { "start": 1040.1599999999999, "end": 1045.1599999999999, "text": " would be naturally a thing to ask if you were the noun you would want to know are" }, { "start": 1045.1599999999999, "end": 1051.3999999999999, "text": " there any kind of modifiers for for me so it could output the query and the" }, { "start": 1051.4, "end": 1056.1200000000001, "text": " query here could mean you know this direction could mean adjectives and you" }, { "start": 1056.1200000000001, "end": 1064, "text": " see here the word pretty is an adjective so it itself would output a key that" }, { "start": 1064, "end": 1070.64, "text": " says by the way I'm an adjective right so if the cat asks then if this node" }, { "start": 1070.64, "end": 1077.72, "text": " asks for an adjective and this outputs the adjective vector then because the" }, { "start": 1077.72, "end": 1082.64, "text": " inner product between the two things is high this will be routed here so" }, { "start": 1082.64, "end": 1086.16, "text": " attention mechanism is basically information routing that's how I always" }, { "start": 1086.16, "end": 1093.04, "text": " describe it but in this paper we look at it more like these here are the patterns" }, { "start": 1093.04, "end": 1100.44, "text": " that are stored in a hopfield network and I by inputting a query and the dot" }, { "start": 1100.44, "end": 1105.32, "text": " product being the update rule of the hopfield network I retrieve from the" }, { "start": 1105.32, "end": 1111.6399999999999, "text": " hopfield network I retrieve the appropriate pattern that I ask for okay" }, { "start": 1111.6399999999999, "end": 1118.48, "text": " and then you know the values the values are simply a modification of the keys in" }, { "start": 1118.48, "end": 1123.6799999999998, "text": " this form but a lot of people also do keys and values to be the same thing" }, { "start": 1123.6799999999998, "end": 1129.2, "text": " yeah but the this routing of information happens here where you multiply the" }, { "start": 1129.2, "end": 1136.22, "text": " queries and the keys and then you put a softmax over them okay so if you just" }, { "start": 1136.22, "end": 1142, "text": " look from the perspective of a single node like this node here this cat node" }, { "start": 1142, "end": 1148.04, "text": " what it would do is it would inner product its own query vector with all" }, { "start": 1148.04, "end": 1152.96, "text": " of the key vectors right so it would build an inner product with all of these" }, { "start": 1152.96, "end": 1157.1200000000001, "text": " and then it would normalize it would put it through a softmax which will kind of" }, { "start": 1157.12, "end": 1163, "text": " give it a distribution right so here would give it like so this is actually" }, { "start": 1163, "end": 1168.12, "text": " matches because my well my is also very important for cat this this this is just" }, { "start": 1168.12, "end": 1174.3999999999999, "text": " an accident I did not plan this this here this also well many things match but" }, { "start": 1174.3999999999999, "end": 1180.3999999999999, "text": " but in our example we would just say that this last one it's not only higher" }, { "start": 1180.4, "end": 1188.64, "text": " it's also wider it matches very well right and so the information routing" }, { "start": 1188.64, "end": 1195.92, "text": " would route mostly information from this pretty token to the cat token which" }, { "start": 1195.92, "end": 1202.7800000000002, "text": " makes sense in our case right this is the attention mechanism now since if we" }, { "start": 1202.7800000000002, "end": 1209.6000000000001, "text": " are interpreting this as a hopfield network and the update rule here is the" }, { "start": 1209.6, "end": 1215.12, "text": " dot product you can actually think of applying this rule multiple times so" }, { "start": 1215.12, "end": 1222.9199999999998, "text": " what happens now if we and this is where this update rule comes in what happens" }, { "start": 1222.9199999999998, "end": 1230.3999999999999, "text": " if we take this distribution and we don't aggregate the values like usually" }, { "start": 1230.3999999999999, "end": 1235.08, "text": " we would aggregate the values by this distribution what if we aggregate the" }, { "start": 1235.08, "end": 1240.6, "text": " keys by this distribution okay what comes out well if we look at this and" }, { "start": 1240.6, "end": 1245, "text": " you know let's just assume that this key right here matches really well but the" }, { "start": 1245, "end": 1249.6799999999998, "text": " others also match a little bit what would come out would be a weighted" }, { "start": 1249.6799999999998, "end": 1255.1599999999999, "text": " average where a lot of weight is put on this particular key so what will turn" }, { "start": 1255.1599999999999, "end": 1259.52, "text": " out would be something like something that's very close to that key you can" }, { "start": 1259.52, "end": 1267.84, "text": " see I'm going to draw the old key here in green and I'm going to draw the old" }, { "start": 1267.84, "end": 1277.6399999999999, "text": " query in blue so you see that it's then whatever comes out is not the query but" }, { "start": 1277.6399999999999, "end": 1282.48, "text": " it's also not that only key that matches right it's kind of a weighted average" }, { "start": 1282.48, "end": 1288.6, "text": " but with that key dominating okay now since you know in a hopfield network" }, { "start": 1288.6, "end": 1294.28, "text": " what we would do is we would go again we would put this new thing the red thing" }, { "start": 1294.28, "end": 1300.08, "text": " instead of the query vector okay so we would use this aggregated keys this" }, { "start": 1300.08, "end": 1306, "text": " weighted average as a new query vector for that node right here so we duplicate" }, { "start": 1306, "end": 1310.76, "text": " that node over here I'll use that query vector again and do the same thing" }, { "start": 1310.76, "end": 1315.6799999999998, "text": " again okay inner product with all of the query vectors and now since this is" }, { "start": 1315.68, "end": 1320.28, "text": " already an aggregate of the query vectors what's going to happen of course" }, { "start": 1320.28, "end": 1325.28, "text": " the distribution that's going to come out is going to be weighted even more" }, { "start": 1325.28, "end": 1333.44, "text": " heavily into the direction so let's make it even wider into the direction of that" }, { "start": 1333.44, "end": 1339.24, "text": " key that matches okay and you can pretty clearly see if I do that iteratively" }, { "start": 1339.24, "end": 1346.96, "text": " then that will lead to a situation where everything is like very low except that" }, { "start": 1346.96, "end": 1353.76, "text": " one key will sort of dominate the distribution and ultra high and ultra" }, { "start": 1353.76, "end": 1359, "text": " wide okay and that's how that's exactly how a hopfield network works right I" }, { "start": 1359, "end": 1363.72, "text": " would input the query which would be sort of what I want right I kind of know" }, { "start": 1363.72, "end": 1370.08, "text": " what I want okay and then I apply this rule multiple times and with each time I" }, { "start": 1370.08, "end": 1375.88, "text": " refine refine refine until I decide on a pattern the hopfield network is made" }, { "start": 1375.88, "end": 1380.4, "text": " for pattern retrieval and these here are the patterns that I want to retrieve so" }, { "start": 1380.4, "end": 1385.4, "text": " here the patterns aren't kind of stored in the network beforehand but the" }, { "start": 1385.4, "end": 1391.48, "text": " patterns are also generated like in an attention layer so the keys are" }, { "start": 1391.48, "end": 1397.1200000000001, "text": " generated by the previous layer or by these matrices but that doesn't matter" }, { "start": 1397.1200000000001, "end": 1402.28, "text": " for the hopfield network update rule so you see here that the attention mechanism" }, { "start": 1402.28, "end": 1407.1200000000001, "text": " can be interpreted as simply one step making one step of this update rule but" }, { "start": 1407.1200000000001, "end": 1411.72, "text": " you can think of making actually multiple steps and retrieving the" }, { "start": 1411.72, "end": 1418.56, "text": " particular key so you know deciding on a sort of a hard routing of particular" }, { "start": 1418.56, "end": 1427.48, "text": " information now that only works if if there are no other vectors that are" }, { "start": 1427.48, "end": 1432.6399999999999, "text": " close to that particular key right so if the query is this and you know the way I" }, { "start": 1432.6399999999999, "end": 1437.44, "text": " drew it here you can see that there are many there is this one and this one and" }, { "start": 1437.44, "end": 1444.48, "text": " this one that matches so technically the way I drew it what would happen most" }, { "start": 1444.48, "end": 1449.52, "text": " likely is no many no matter how many times you apply your update rule it" }, { "start": 1449.52, "end": 1455.08, "text": " would sort of result in kind of the average of the three keys right so" }, { "start": 1455.08, "end": 1460.3600000000001, "text": " because they're all matching and they would all contribute to that weighted" }, { "start": 1460.3600000000001, "end": 1464.64, "text": " average of the query in the next step and then that means basically the" }, { "start": 1464.64, "end": 1468.48, "text": " conversions would be to something in the middle and that's going to be a central" }, { "start": 1468.48, "end": 1475.28, "text": " point of this paper in which situation we are so they call the first part is" }, { "start": 1475.28, "end": 1479.92, "text": " retrieving a single pattern and they call the second situation where you have" }, { "start": 1479.92, "end": 1484.44, "text": " multiple patterns that all match that are not well separated from each other" }, { "start": 1484.44, "end": 1488.16, "text": " they call this a meta stable state and it's going to be pretty interesting to" }, { "start": 1488.16, "end": 1495.4, "text": " look at transform like BERT language models and look at where they actually" }, { "start": 1495.4, "end": 1500.16, "text": " are are they actually operating in this single pattern retrieval mode or are they" }, { "start": 1500.16, "end": 1508.6000000000001, "text": " operating in the meta stable state mode all right so here you can see it in the" }, { "start": 1508.6000000000001, "end": 1513.92, "text": " diagram the only thing different this from a hop field network sorry from an" }, { "start": 1513.92, "end": 1519.64, "text": " attention mechanism is this branch right here so here you ask do you want to do" }, { "start": 1519.64, "end": 1525.4, "text": " multiple updates after you've you've multiplied the queries and the keys do" }, { "start": 1525.4, "end": 1530.3200000000002, "text": " you want to do multiple updates if yes so if you're in a this hop field network" }, { "start": 1530.3200000000002, "end": 1534.8400000000001, "text": " situation you want to do multiple updates then you go back as you can see" }, { "start": 1534.8400000000001, "end": 1542.5400000000002, "text": " and you do you use the keys together with the output of the softmax to" }, { "start": 1542.5400000000002, "end": 1549.0400000000002, "text": " generate a new query so this query queue here is now generated from the output" }, { "start": 1549.04, "end": 1553.32, "text": " here and the key so the keys are the same these are this is the same thing" }, { "start": 1553.32, "end": 1561.3999999999999, "text": " it's just put here twice okay this is exactly what we discussed okay I hope" }, { "start": 1561.3999999999999, "end": 1566.72, "text": " that's some somehow clear that these the the attention mechanism is simply a one" }, { "start": 1566.72, "end": 1574.24, "text": " step hop field network pattern retrieval algorithm with a particular update rule" }, { "start": 1574.24, "end": 1581.36, "text": " that is that is matches this energy function that they propose right here of" }, { "start": 1581.36, "end": 1585.52, "text": " course they do this you know particularly because the update rule that" }, { "start": 1585.52, "end": 1590.8, "text": " turns out is the transformer update rule but but I actually don't know if they" }, { "start": 1590.8, "end": 1594.74, "text": " backwards engineered the energy function to match the transformer or if they" }, { "start": 1594.74, "end": 1599.84, "text": " first came up with a continuous hop field networks and then just kind of" }, { "start": 1599.84, "end": 1604.8, "text": " discovered that it's like the transformer will maybe never find out" }, { "start": 1604.8, "end": 1613.08, "text": " okay so let's go there are a couple of theorems I believe there are four five" }, { "start": 1613.08, "end": 1619.08, "text": " theorems right here that show that kind of make some points about this about" }, { "start": 1619.08, "end": 1623.28, "text": " this stuff and we'll go through them won't go through the proofs or any you" }, { "start": 1623.28, "end": 1627.9599999999998, "text": " know super in-depth meaning but it's pretty cool to go through them and they" }, { "start": 1627.96, "end": 1632.44, "text": " are proved very rigorously as I said there's a 70 page appendix so have a" }, { "start": 1632.44, "end": 1639.24, "text": " look at that if you're up for it okay so they say here we have an update rule" }, { "start": 1639.24, "end": 1644.68, "text": " this is our update rule for our new hop field networks so the first theorem they" }, { "start": 1644.68, "end": 1651.08, "text": " serve is the update rule that we propose converges globally if we apply" }, { "start": 1651.08, "end": 1659.08, "text": " the update rule repeatedly the energy for t goes equals infinity and the" }, { "start": 1659.08, "end": 1664.96, "text": " energy will converge sorry the energy will converge to a fixed point this" }, { "start": 1664.96, "end": 1671.4399999999998, "text": " being a fixed point for t equals sorry for t goes to infinity yeah if this is" }, { "start": 1671.4399999999998, "end": 1676.1999999999998, "text": " a fixed point basically saying that if I apply this update rule here over and" }, { "start": 1676.2, "end": 1682.88, "text": " over and over again it will it will make this energy function converge to a fixed" }, { "start": 1682.88, "end": 1687.96, "text": " it will make this energy function converge don't want to say anything" }, { "start": 1687.96, "end": 1694.52, "text": " mistakenly here or claim too much but that basically connects the update rule" }, { "start": 1694.52, "end": 1699.64, "text": " to the energy okay so just showing like this really is the update rule for that" }, { "start": 1699.64, "end": 1706.1200000000001, "text": " particular energy function okay now as as itself it's not super duper" }, { "start": 1706.1200000000001, "end": 1714.24, "text": " interesting yet but now we get to theorem 2 so theorem 2 for the iteration" }, { "start": 1714.24, "end": 1722.2, "text": " that's the update rule that we just looked at we have we have that this" }, { "start": 1722.2, "end": 1728.44, "text": " convergence holds as t goes to infinity for some stationary point furthermore" }, { "start": 1728.44, "end": 1738.2, "text": " this quantity here goes to zero so that means this is the the update at t plus" }, { "start": 1738.2, "end": 1744.3600000000001, "text": " one and this is the update at t and the difference between them goes to zero so" }, { "start": 1744.3600000000001, "end": 1748.76, "text": " that means not only does the energy converge but the iterates themselves" }, { "start": 1748.76, "end": 1755.02, "text": " converge so the algorithm actually converges the individual updates of the" }, { "start": 1755.02, "end": 1760, "text": " algorithm so this e new at some point that will no longer change because the" }, { "start": 1760, "end": 1766.08, "text": " the norm between it and the previous one will go to zero you can see that either" }, { "start": 1766.08, "end": 1772.12, "text": " the sequence here converges or in the other case the set of limit points yada" }, { "start": 1772.12, "end": 1779.16, "text": " yada is a connecting subset this is a bit over the top here they say okay it" }, { "start": 1779.16, "end": 1784.52, "text": " can either converge to a point or it can converge to a connected subset but if" }, { "start": 1784.52, "end": 1790.8799999999999, "text": " the loss is finite then any sequence generated by the iteration equation 3" }, { "start": 1790.8799999999999, "end": 1797.76, "text": " converges to some fixed point so you know basically saying that here we oh" }, { "start": 1797.76, "end": 1806.36, "text": " this is not the loss I'm sorry no this is the domain never mind I am an idiot" }, { "start": 1806.36, "end": 1814.24, "text": " this is basically saying that this algorithm will converge okay and they" }, { "start": 1814.24, "end": 1820.48, "text": " define here what it means for a pattern to be stored and retrieved and that's" }, { "start": 1820.48, "end": 1825.04, "text": " for establishing what the kind of storage capacity for Hopfield network" }, { "start": 1825.04, "end": 1829.2, "text": " is so we've established that the update rule minimizes the appropriate energy" }, { "start": 1829.2, "end": 1835.16, "text": " and the update rule will converge at some point which means that we can you" }, { "start": 1835.16, "end": 1841.18, "text": " know if it converges we can retrieve the pattern that it converges to so now we" }, { "start": 1841.18, "end": 1846.04, "text": " define how many patterns can we actually store for that we need to know what does" }, { "start": 1846.04, "end": 1851.4, "text": " it mean for a pattern to be stored so we assume that we have patterns and these" }, { "start": 1851.4, "end": 1856.68, "text": " patterns are called X okay X I we have n different patterns each one is called X" }, { "start": 1856.68, "end": 1865.44, "text": " with a subscript we assume that around every pattern a sphere is given so how" }, { "start": 1865.44, "end": 1871.0800000000002, "text": " do we imagine this we have these patterns and this is this is just a space" }, { "start": 1871.0800000000002, "end": 1876.8200000000002, "text": " that they consider patterns of the on a sphere but we'll just conceptualize it as" }, { "start": 1876.8200000000002, "end": 1880.76, "text": " this will have a space there are patterns we want to store okay and we'll" }, { "start": 1880.76, "end": 1886.92, "text": " say around every pattern there is a sphere okay sphere like this and" }, { "start": 1886.92, "end": 1892.1200000000001, "text": " naturally the patterns are going to be there's going to be a notion of well" }, { "start": 1892.12, "end": 1897.8, "text": " separated patterns and you can imagine this a little bit like these spheres" }, { "start": 1897.8, "end": 1902.32, "text": " won't be touching each other if these spheres aren't touching each other that" }, { "start": 1902.32, "end": 1907.1999999999998, "text": " means that the patterns are kind of well separated and that means that if we" }, { "start": 1907.1999999999998, "end": 1911.52, "text": " initialize the query remember the query here is a vector that kind of sort of" }, { "start": 1911.52, "end": 1915.8, "text": " looks like a pattern and that means the query is kind of close to the pattern in" }, { "start": 1915.8, "end": 1921.08, "text": " some notion of distance so if we initialize the query somewhere in that" }, { "start": 1921.08, "end": 1931.76, "text": " sphere then it might if it converges to that sphere to that pattern then we" }, { "start": 1931.76, "end": 1937.4399999999998, "text": " retrieve the pattern okay now it gets a bit more complicated than this but not" }, { "start": 1937.4399999999998, "end": 1944.6799999999998, "text": " much more we say a pattern is stored if there is a single fixed point inside the" }, { "start": 1944.68, "end": 1951.16, "text": " sphere to which all points that start inside the sphere converge and none of" }, { "start": 1951.16, "end": 1955.88, "text": " the spheres intersect so the sphere of point I doesn't intersect with the" }, { "start": 1955.88, "end": 1961.24, "text": " sphere of point J so that's where we say all these spheres are non intersecting" }, { "start": 1961.24, "end": 1968.24, "text": " we say X is retrieved if the iteration equation 3 converged to the single fixed" }, { "start": 1968.24, "end": 1973.3600000000001, "text": " point in that sphere the retrieval error is the distance so you'll notice you" }, { "start": 1973.36, "end": 1977.8799999999999, "text": " have two things you have X I this is the actual pattern and you have X I star" }, { "start": 1977.8799999999999, "end": 1983, "text": " this is the retrieved pattern so these hopeful they don't always have to give" }, { "start": 1983, "end": 1987.28, "text": " you the same thing that you stored that's part of the the nature of" }, { "start": 1987.28, "end": 1993.6399999999999, "text": " continuous neural networks whatnot so for every sphere we say there is a" }, { "start": 1993.6399999999999, "end": 2002.6799999999998, "text": " pattern there is a sphere now we as pattern is stored if every I can start" }, { "start": 2002.68, "end": 2007.8, "text": " wherever I want in this sphere okay wherever I want it will always converge" }, { "start": 2007.8, "end": 2013.0800000000002, "text": " to a point that's inside the sphere and maybe that point isn't the pattern that" }, { "start": 2013.0800000000002, "end": 2016.76, "text": " I stored but actually this point right here but wherever I start I will always" }, { "start": 2016.76, "end": 2022.1200000000001, "text": " converge to that particular point if that's the case then I have stored this" }, { "start": 2022.1200000000001, "end": 2027.04, "text": " particular pattern now the fact is I don't retrieve this particular pattern I" }, { "start": 2027.04, "end": 2031.8400000000001, "text": " retrieve the blue thing but I can then define the error of retrieval the error" }, { "start": 2031.84, "end": 2037, "text": " of retrieval is simply the distance between the two things ideally this" }, { "start": 2037, "end": 2041.9599999999998, "text": " distance is very small right but you know we can't can't guarantee it now" }, { "start": 2041.9599999999998, "end": 2046.84, "text": " there are going to be theorems that deal exactly with this retrieval error but" }, { "start": 2046.84, "end": 2058.24, "text": " first you can see that here if if these spheres become larger you you can't" }, { "start": 2058.24, "end": 2064.4799999999996, "text": " accurately store a pattern anymore so this is the kind of ideal situation but" }, { "start": 2064.4799999999996, "end": 2068.3199999999997, "text": " there are also situations where these spheres you know if I have these" }, { "start": 2068.3199999999997, "end": 2073.68, "text": " patterns right here these spheres are so large kind of the the attractions of the" }, { "start": 2073.68, "end": 2080.52, "text": " patterns are so large that if I start let's say here then I don't converge to" }, { "start": 2080.52, "end": 2084.24, "text": " either of these two patterns I converge to like something in the middle I" }, { "start": 2084.24, "end": 2089, "text": " converge to maybe this point right here and that's going to be one of these" }, { "start": 2089, "end": 2094.2, "text": " meta stable states okay we're going to encounter situations like this but we're" }, { "start": 2094.2, "end": 2097.52, "text": " also going to encounter situations like this and the bottom thing isn't" }, { "start": 2097.52, "end": 2105.52, "text": " necessarily bad and that's what you have to keep in mind and yeah as I said we'll" }, { "start": 2105.52, "end": 2113.7999999999997, "text": " get to it but just keep this kind of sphere image in mind okay so first we'll" }, { "start": 2113.8, "end": 2118, "text": " just deal with the you know the up the top situation where we store patterns" }, { "start": 2118, "end": 2124.48, "text": " and then retrieve patterns so we'll assume a failure probability which is P" }, { "start": 2124.48, "end": 2129.2400000000002, "text": " and P is going to be no pretty pretty low for their example so they have P" }, { "start": 2129.2400000000002, "end": 2136.28, "text": " equals 0.001 you know like a 0.1 percent error probability of retrieving your" }, { "start": 2136.28, "end": 2142.5600000000004, "text": " pattern things like this and randomly chosen patterns on the sphere with" }, { "start": 2142.56, "end": 2149.52, "text": " radius M we define some constants yada yada yada then with probability 1 minus" }, { "start": 2149.52, "end": 2155.16, "text": " P the number of random patterns that can be stored and stored in the sense of" }, { "start": 2155.16, "end": 2161.92, "text": " having these spheres around them so that you can retrieve them accurately or at" }, { "start": 2161.92, "end": 2168.36, "text": " least you can retrieve something that's close to them is is bounded lower" }, { "start": 2168.36, "end": 2172.48, "text": " bounded by this quantity right here so there's the square root of P there is" }, { "start": 2172.48, "end": 2178.4, "text": " this constant C but then you see that D is in the exponent right here so that" }, { "start": 2178.4, "end": 2183.68, "text": " means it's exponential in the number of dimensions so that's that's pretty cool" }, { "start": 2183.68, "end": 2190.44, "text": " so if you add a dimension you exponentially increase the number of" }, { "start": 2190.44, "end": 2197.16, "text": " the number of patterns you can store and you know that's that is a kind of I" }, { "start": 2197.16, "end": 2202.28, "text": " mean it's it's been known for modern Hopfield networks with binary strings so" }, { "start": 2202.28, "end": 2207.32, "text": " it's not uber surprising but if you have you know it's not what you would imagine" }, { "start": 2207.32, "end": 2213.52, "text": " like that okay so they may give a few examples of these you have to" }, { "start": 2213.52, "end": 2217.32, "text": " accept these constants you know in a particular fashion such that this is" }, { "start": 2217.32, "end": 2223.6800000000003, "text": " given and so on but they say examples here are where C is something like 3" }, { "start": 2223.68, "end": 2235.3999999999996, "text": " and D is 20 so if you were to add a 21st dimension then your I guess storage" }, { "start": 2235.3999999999996, "end": 2244.7599999999998, "text": " capacity would increase by a factor of 3 which pretty cool alright so this is how" }, { "start": 2244.7599999999998, "end": 2249.72, "text": " many that we can store infinitely not sorry exponentially many patterns in" }, { "start": 2249.72, "end": 2260.16, "text": " these networks now they deal they say the next theorem states that the update" }, { "start": 2260.16, "end": 2263.7599999999998, "text": " rule typically converges after one update if the patterns are well" }, { "start": 2263.7599999999998, "end": 2268.74, "text": " separated okay so if we're in a situation where these patterns are well" }, { "start": 2268.74, "end": 2272.2799999999997, "text": " separated which is kind of like this but you can also imagine this in terms of" }, { "start": 2272.2799999999997, "end": 2277.2, "text": " dot products because we operate in the space of dot products so if the patterns" }, { "start": 2277.2, "end": 2281.24, "text": " are well separated that sort of means that they all kind of sort of point away" }, { "start": 2281.24, "end": 2286.62, "text": " from each other and this notion of separation is going to be captured by" }, { "start": 2286.62, "end": 2292.52, "text": " this quantity right here this is the separation of example of pattern I which" }, { "start": 2292.52, "end": 2298.7999999999997, "text": " is just the inner product with itself minus the maximum inner product with any" }, { "start": 2298.7999999999997, "end": 2305.48, "text": " other pattern and this quantity is going to be large when no other pattern is" }, { "start": 2305.48, "end": 2311.78, "text": " close to it so when the separation is large then the update rule the retrieval" }, { "start": 2311.78, "end": 2317.84, "text": " rule of calculating you know I have a query calculate the inner product with" }, { "start": 2317.84, "end": 2324.12, "text": " all of those then I reweigh all of the patterns by that inner product by the" }, { "start": 2324.12, "end": 2329.76, "text": " softmax then I use that new thing as a query again and so on as we discussed it" }, { "start": 2329.76, "end": 2336.88, "text": " will converge to the closest pattern but this theorem says it actually converges" }, { "start": 2336.88, "end": 2342.8, "text": " pretty fast and here I have my problems with saying that it converges after one" }, { "start": 2342.8, "end": 2350.1200000000003, "text": " step typically converges after one update because that you know genuinely" }, { "start": 2350.1200000000003, "end": 2356.32, "text": " depends on a lot of constants as we'll see but it does converge exponentially" }, { "start": 2356.32, "end": 2362.8, "text": " fast in this separation constant as a theorem for says with query psi after" }, { "start": 2362.8, "end": 2368.6400000000003, "text": " one update the distance of the new point to the fixed point is exponentially" }, { "start": 2368.6400000000003, "end": 2374.0800000000004, "text": " small in the separation Delta I the precise bound using Jacobian and its" }, { "start": 2374.0800000000004, "end": 2379.84, "text": " value in the mean value theorem are the following so here you can see this is" }, { "start": 2379.84, "end": 2388.2000000000003, "text": " the distance between the updated psi after one step and the and the fixed" }, { "start": 2388.2000000000003, "end": 2393.88, "text": " point right here this is what it converges to is going to be the" }, { "start": 2393.88, "end": 2400.04, "text": " distance as it was before times this thing right here so you can see since" }, { "start": 2400.04, "end": 2408.1000000000004, "text": " this is a this is a multiplicative update and in this Jacobian so this is" }, { "start": 2408.1, "end": 2418.96, "text": " expanded down here this is this you can see here you have the you have this" }, { "start": 2418.96, "end": 2425.44, "text": " sorry yeah this is this so this is bounded by that you have the exponent" }, { "start": 2425.44, "end": 2431.88, "text": " the exponential function negative this separation right here so the higher the" }, { "start": 2431.88, "end": 2437.64, "text": " separation the faster this algorithm converges okay to say that it converges" }, { "start": 2437.64, "end": 2442.8799999999997, "text": " after one step is you know it might be a bit of bragging I don't know if this is" }, { "start": 2442.8799999999997, "end": 2446.96, "text": " a common thing if you have like an exponential convergence that you are" }, { "start": 2446.96, "end": 2452.48, "text": " allowed to say it's after one step I'm not sure especially what I'm not sure" }, { "start": 2452.48, "end": 2460.24, "text": " about is that you have n here as linear constants in that factor okay so if you" }, { "start": 2460.24, "end": 2466, "text": " if you and that's what they do in their code so if you look at their code and" }, { "start": 2466, "end": 2469.48, "text": " the codes available which is pretty cool it's implemented in pytorch as a" }, { "start": 2469.48, "end": 2473.08, "text": " general module that can you can just drop in so this is not only for" }, { "start": 2473.08, "end": 2477.88, "text": " transformers this is for you can replace like LSTM's you can replace pooling" }, { "start": 2477.88, "end": 2483.6, "text": " mechanisms you can you know do a whole bunch of stuff in their paper in the" }, { "start": 2483.6, "end": 2490.72, "text": " company paper they do this multi instance learning with giant sets on" }, { "start": 2490.72, "end": 2495.56, "text": " using these hopfield layers so pretty pretty cool this code is definitely" }, { "start": 2495.56, "end": 2499.44, "text": " worth kind of checking out and maybe you want to replace some stuff with you but" }, { "start": 2499.44, "end": 2505.44, "text": " the question is how many of these update steps should you do right because we" }, { "start": 2505.44, "end": 2509.92, "text": " looked at the diagram at least in the attention mechanism it seems like you" }, { "start": 2509.92, "end": 2514.36, "text": " have attention layers right you have a transformer and the transformer consists" }, { "start": 2514.36, "end": 2518.2799999999997, "text": " of you know you have this input right here and you go through layer layer" }, { "start": 2518.2799999999997, "end": 2524.64, "text": " layer layer layer and in each layer there's contained in it and one of these" }, { "start": 2524.64, "end": 2531.44, "text": " attention mechanism right this entire thing is in this layer okay and now if" }, { "start": 2531.44, "end": 2536.4, "text": " you interpret this as a hopfield network and you want to do multiple steps that" }, { "start": 2536.4, "end": 2540.3599999999997, "text": " means you go this branch right here so in each layer potentially you do" }, { "start": 2540.3599999999997, "end": 2547.48, "text": " multiple steps of these things so for whatever computational constraints" }, { "start": 2547.48, "end": 2554.04, "text": " transformers had already this will certainly make it worse but also you" }, { "start": 2554.04, "end": 2557.6, "text": " need to decide how many steps you want to do now you can hard code that of" }, { "start": 2557.6, "end": 2564.7599999999998, "text": " course but they say you should do these steps until this norm here until the" }, { "start": 2564.7599999999998, "end": 2570.84, "text": " norm between the old and the new is small enough so where is that so you" }, { "start": 2570.84, "end": 2574.24, "text": " can't measure how close you are to the convergence points right because you" }, { "start": 2574.24, "end": 2579.48, "text": " don't know in practice but you can measure how far you're away you can" }, { "start": 2579.48, "end": 2583.6, "text": " measure where did we have it you can measure this quantity right here that's" }, { "start": 2583.6, "end": 2588.3199999999997, "text": " something you can measure how far two iterates are apart so what you'll simply" }, { "start": 2588.3199999999997, "end": 2594.44, "text": " do is you'll measure that and if that is small enough then you'll you'll stop but" }, { "start": 2594.44, "end": 2600.7599999999998, "text": " that I guess is very related to this so how if you we've already proven it" }, { "start": 2600.7599999999998, "end": 2608.2799999999997, "text": " converges to this X star so I guess we can approximate this quantity right here" }, { "start": 2608.2799999999997, "end": 2612.36, "text": " with the quantity above and that tells you how many updates you need to do and" }, { "start": 2612.36, "end": 2618.7200000000003, "text": " that quantity is linear not only linear but actually here quadratic in n I don't" }, { "start": 2618.7200000000003, "end": 2625.4, "text": " care you know yes it's exponential in the separation but it's quadratic in n" }, { "start": 2625.4, "end": 2633.6, "text": " and if I've learned anything from kind of my fast code courses is that constants" }, { "start": 2633.6, "end": 2637.56, "text": " actually matter when you're not dealing with infinity with an infinite number of" }, { "start": 2637.56, "end": 2645.24, "text": " steps so the number of the number of steps you need to do I guess will" }, { "start": 2645.24, "end": 2649.92, "text": " depend on the sequence length in a quadratic fashion so I'm not sure you" }, { "start": 2649.92, "end": 2655.08, "text": " can always claim this is convergence in one step now I might be super mistaken" }, { "start": 2655.08, "end": 2661.16, "text": " here and none of this will can none of this actually makes a difference in the" }, { "start": 2661.16, "end": 2666.08, "text": " in the light of the exponential decay here but I would just I'm just a bit" }, { "start": 2666.08, "end": 2670.2, "text": " worried saying this usually converges in one step it's clear I guess why they do" }, { "start": 2670.2, "end": 2675.88, "text": " it right because the attention mechanism in transformers is a one-step application" }, { "start": 2675.88, "end": 2681.7999999999997, "text": " of this rule and this here is kind of a theoretical justification for" }, { "start": 2681.7999999999997, "end": 2685.92, "text": " interpreting this precisely as a hopfield network because you'd say well" }, { "start": 2685.92, "end": 2690.12, "text": " in a hopfield network you would do multiple steps but wait wait we can" }, { "start": 2690.12, "end": 2693.84, "text": " actually prove that even if you interpret it as a hopfield network you" }, { "start": 2693.84, "end": 2697.92, "text": " it can it usually converges after one step so what you're actually doing in a" }, { "start": 2697.92, "end": 2703.56, "text": " transformer is applying a hopfield network update rule to convergence so" }, { "start": 2703.56, "end": 2709.2000000000003, "text": " yeah I'm not yeah I might be bickering on a high level here luxury problems" }, { "start": 2709.2000000000003, "end": 2716.92, "text": " theorem five then says so theorem four is how fast does this converge theorem" }, { "start": 2716.92, "end": 2723.2400000000002, "text": " five the last theorem right here says that the retrieval error of a pattern" }, { "start": 2723.24, "end": 2727.2, "text": " then so this is the this is what you converge to and this is what you've" }, { "start": 2727.2, "end": 2735.3199999999997, "text": " stored is bounded by again something that's exponential in the separation" }, { "start": 2735.3199999999997, "end": 2742.8399999999997, "text": " right here as you can see okay so that was the theorem so if we go quickly" }, { "start": 2742.8399999999997, "end": 2747.9599999999996, "text": " through them again theorems one and two deal with the convergence of this" }, { "start": 2747.9599999999996, "end": 2752.4399999999996, "text": " algorithm and the fact that it actually minimizes the proposed energy then" }, { "start": 2752.44, "end": 2759, "text": " theorem three says you can store exponentially many patterns in terms of" }, { "start": 2759, "end": 2766.52, "text": " the dimension of your space and theorems four and five say that this update rule" }, { "start": 2766.52, "end": 2771.84, "text": " will converge exponentially fast after after one step if you believe that and" }, { "start": 2771.84, "end": 2776.96, "text": " the retrieval error will also go down exponentially fast with the number of" }, { "start": 2776.96, "end": 2783.08, "text": " update steps that you do okay that sounds pretty pretty pretty good but" }, { "start": 2783.08, "end": 2788.52, "text": " we've heard it it's very dependent on how well separated these patterns are" }, { "start": 2788.52, "end": 2794.16, "text": " and it turns out that is you know at least in transformers they aren't" }, { "start": 2794.16, "end": 2800.08, "text": " always well separated and that might be on purpose remember the the states here" }, { "start": 2800.08, "end": 2804.92, "text": " the patterns aren't pre stored like in a classic hopfield network but the" }, { "start": 2804.92, "end": 2810.08, "text": " patterns if you interpret an attention mechanism as this are also generated by" }, { "start": 2810.08, "end": 2815.28, "text": " the network itself so the pattern matrix that you retrieve from and the query are" }, { "start": 2815.28, "end": 2821.12, "text": " generated by the attention mechanism in this case as I said this is applicable" }, { "start": 2821.12, "end": 2829.08, "text": " to many many more domains than just this but yeah so there's another slight" }, { "start": 2829.08, "end": 2833.12, "text": " modification that you have to do to make this actually equivalent to an attention" }, { "start": 2833.12, "end": 2838.88, "text": " mechanism and that is you'll have to recast the value because usually what" }, { "start": 2838.88, "end": 2842.88, "text": " you'll do is you have some sort of input and then you make queries keys and" }, { "start": 2842.88, "end": 2847.8399999999997, "text": " values from that using different heads the only thing to make it formally" }, { "start": 2847.8399999999997, "end": 2852.88, "text": " equivalent is you have to make the values generated from the keys so the" }, { "start": 2852.88, "end": 2857.56, "text": " keys give rise to the values as you can see right here that you first multiply" }, { "start": 2857.56, "end": 2861.56, "text": " with the key matrix and then with the value matrix I think that's you know" }, { "start": 2861.56, "end": 2870.52, "text": " that I don't I doubt that this will will change anything if you if you the only" }, { "start": 2870.52, "end": 2874.2, "text": " way that could really change anything is if this matrix here would be super low" }, { "start": 2874.2, "end": 2880.6, "text": " rank like collapse the space of into like very few dimensions which the value" }, { "start": 2880.6, "end": 2885.44, "text": " matrix wouldn't do so you know but just letting you know that the technical" }, { "start": 2885.44, "end": 2894.7200000000003, "text": " equality requires this slight modification okay now we said that it" }, { "start": 2894.7200000000003, "end": 2899.28, "text": " might not you know be that this is always super well separate and you" }, { "start": 2899.28, "end": 2903.76, "text": " retrieve a single pattern and that's what they research here in a pre trained" }, { "start": 2903.76, "end": 2908.26, "text": " BERT model so they take a pre trained BERT model from I guess from hugging" }, { "start": 2908.26, "end": 2915.76, "text": " face and they run they just run a data set through it and what they do is so" }, { "start": 2915.76, "end": 2920.44, "text": " for each for each query and sorry for each attention head because you have" }, { "start": 2920.44, "end": 2926.1600000000003, "text": " multiple ones of these attention heads right in each layer so in each layer you" }, { "start": 2926.1600000000003, "end": 2931.1200000000003, "text": " have multiple of these heads for each head they look at over the course of the" }, { "start": 2931.12, "end": 2938.24, "text": " whole data set how do these softmax distributions look like so when you" }, { "start": 2938.24, "end": 2943.2799999999997, "text": " believe that this is a hopfield network and you believe that this converges in" }, { "start": 2943.2799999999997, "end": 2948.64, "text": " one step then if the patterns are well separated what we would expect is a" }, { "start": 2948.64, "end": 2955.9, "text": " distribution as we said like this okay there would be one dominant pattern" }, { "start": 2955.9, "end": 2959.96, "text": " that you retrieve you know that's what you want to retrieve that's what comes" }, { "start": 2959.96, "end": 2965.96, "text": " out but a bang you retrieve that accurate pattern anything else would" }, { "start": 2965.96, "end": 2969.8, "text": " mean that the hopfield network sort of failed right it wouldn't give you back" }, { "start": 2969.8, "end": 2975.56, "text": " one particular pattern so they have I think that's a pretty it's a pretty" }, { "start": 2975.56, "end": 2982.12, "text": " smart experiment they look how many bars do we need to add how many of these bars" }, { "start": 2982.12, "end": 2988.42, "text": " in the softmax distribution do we need to add to reach 90% so it depends a bit" }, { "start": 2988.42, "end": 2992.16, "text": " on the temperature of the softmax which is hard coded in attention mechanism" }, { "start": 2992.16, "end": 3000.44, "text": " bdb is 1 this squared over d so they say how many do we need to add to get to 0.9" }, { "start": 3000.44, "end": 3009.2000000000003, "text": " to 90% of the mass of this distribution and if this is the hopfield network" }, { "start": 3009.2000000000003, "end": 3014, "text": " where you retrieve one pattern then one will be enough right one of these bars" }, { "start": 3014, "end": 3020.52, "text": " will probably be I don't know like 99% okay but there are other cases imagine" }, { "start": 3020.52, "end": 3026.8, "text": " the case where the patterns and the query you retrieve the spheres that it" }, { "start": 3026.8, "end": 3033.8, "text": " gives rise to are all like overlapping okay so what that will do is it won't" }, { "start": 3033.8, "end": 3039.8, "text": " converge to any particular pattern but the attractor space in this kind so you" }, { "start": 3039.8, "end": 3044.84, "text": " can imagine if you have two spheres that are apart from each other the update" }, { "start": 3044.84, "end": 3049.1600000000003, "text": " rule converges either so if it's closer to here it converge here if it's closer" }, { "start": 3049.1600000000003, "end": 3056.6000000000004, "text": " to here it'll converge here but if they are overlapping like this the energy" }, { "start": 3056.6000000000004, "end": 3061.32, "text": " landscape will actually make it such that it will neither if it starts" }, { "start": 3061.32, "end": 3064.96, "text": " somewhere it will neither converge to here nor to here it will actually" }, { "start": 3064.96, "end": 3071.2, "text": " converge to somewhere in the middle okay into the mean of the stored patterns and" }, { "start": 3071.2, "end": 3077.88, "text": " if we take that to the extreme what could be is it could be that the softmax" }, { "start": 3077.88, "end": 3083.88, "text": " distribution looks completely uniform okay which would basically mean that you" }, { "start": 3083.88, "end": 3088.12, "text": " know I don't care where my information comes from just average and this has its" }, { "start": 3088.12, "end": 3094.36, "text": " applications so if you for example want to make a sentiment classifier very cheap" }, { "start": 3094.36, "end": 3097.88, "text": " way to do that is to simply take pre-trained word embeddings like glove" }, { "start": 3097.88, "end": 3103.2400000000002, "text": " or word2vec you know assign each word word embedding and then just average the" }, { "start": 3103.2400000000002, "end": 3106.6400000000003, "text": " word embeddings okay and you count on the fact if there are a lot of kind of" }, { "start": 3106.6400000000003, "end": 3112.76, "text": " negative words in there like bad sad angry the word embedding kind of will" }, { "start": 3112.76, "end": 3116.5, "text": " you know reflect that and the average word embedding will point more into the" }, { "start": 3116.5, "end": 3121.28, "text": " bad direction and if there's a lot of happy words the average will point into" }, { "start": 3121.28, "end": 3126.8, "text": " the happy direction okay so there are applications of averaging information" }, { "start": 3126.8, "end": 3133.92, "text": " not caring particularly where it comes from and in that case what we'd expect" }, { "start": 3133.92, "end": 3139.44, "text": " is that this number and we'll call that so we'll call that the number K in this" }, { "start": 3139.44, "end": 3146.1200000000003, "text": " case it equals one but in this case K equals I guess N the number of inputs" }, { "start": 3146.12, "end": 3152.08, "text": " okay because we need well not maybe N but you know approximately we need almost" }, { "start": 3152.08, "end": 3160.96, "text": " all of them to to reach the 90% okay and there is an in-between and these are" }, { "start": 3160.96, "end": 3167.12, "text": " called these meta stable states where and the in-between is something like you'd" }, { "start": 3167.12, "end": 3173.64, "text": " have a couple of patterns here a couple here and a couple maybe here it's almost" }, { "start": 3173.64, "end": 3180.44, "text": " like a clustering like and these overlap and these overlap and these overlap but" }, { "start": 3180.44, "end": 3184.8799999999997, "text": " they don't overlap with each other which means that if you start somewhere here" }, { "start": 3184.8799999999997, "end": 3188.2799999999997, "text": " you would converge to the mean but not to the mean of all the patterns but just" }, { "start": 3188.2799999999997, "end": 3193.3199999999997, "text": " to the mean of these patterns and here here and here here so this this is like" }, { "start": 3193.3199999999997, "end": 3197.64, "text": " a clustering in latent space right so you can interpret these Hopfield update" }, { "start": 3197.64, "end": 3203.2, "text": " rules as somehow you know getting not going to a particular pattern but going" }, { "start": 3203.2, "end": 3208.16, "text": " to sort of a cluster and this is if you ask something like hey is there any" }, { "start": 3208.16, "end": 3212.56, "text": " adjective around right and all of these patterns they kind of overlap in that" }, { "start": 3212.56, "end": 3217.3199999999997, "text": " space in that query space of adjective they overlap and therefore the update" }, { "start": 3217.3199999999997, "end": 3221.7999999999997, "text": " rule would converge to sort of the mean which would basically say yes there is" }, { "start": 3221.7999999999997, "end": 3227.4399999999996, "text": " an adjective here right and the information would not be routed so that" }, { "start": 3227.4399999999996, "end": 3232.2799999999997, "text": " the distribution if we start here writing we converge to this the" }, { "start": 3232.28, "end": 3235.76, "text": " distribution would look something like small small small and then you'd have a" }, { "start": 3235.76, "end": 3242.0400000000004, "text": " couple of large ones all right you'd have like maybe two or three or four of" }, { "start": 3242.0400000000004, "end": 3247.0400000000004, "text": " large ones and these would exactly correspond to the patterns here so the" }, { "start": 3247.0400000000004, "end": 3253.6400000000003, "text": " information will be routed from all of those in that cluster to this particular" }, { "start": 3253.6400000000003, "end": 3258.98, "text": " note that asks the query okay these are these are what's called these meta stable" }, { "start": 3258.98, "end": 3263.12, "text": " states and what they do is they calculate over the entire data set this" }, { "start": 3263.12, "end": 3268.6, "text": " number K and here they show you the distribution so in these plots what" }, { "start": 3268.6, "end": 3274.76, "text": " you'll see is over the entire data set K goes into that direction so I guess" }, { "start": 3274.76, "end": 3282.36, "text": " let's go to Tiz here this this seems pretty easy so K is in this direction" }, { "start": 3282.36, "end": 3289.7200000000003, "text": " and this is simply the amount of like how so in each you let a data point run" }, { "start": 3289.7200000000003, "end": 3293.84, "text": " through it you measure K for that particular layer one you see this is" }, { "start": 3293.84, "end": 3300.96, "text": " layer one head four okay this is one layer one attention head and then you" }, { "start": 3300.96, "end": 3310.6400000000003, "text": " can see that the number K is distributed like this okay so contrast this to this" }, { "start": 3310.64, "end": 3316.2799999999997, "text": " head right here where it's a lot of weight on the number one or like very" }, { "start": 3316.2799999999997, "end": 3322, "text": " few numbers okay so these blue ones would be these are your typical like" }, { "start": 3322, "end": 3326.8399999999997, "text": " when you retrieve one particular pattern so this attention head we can sort of" }, { "start": 3326.8399999999997, "end": 3332.72, "text": " conclude in this particular attention head this is very specific it looks at" }, { "start": 3332.72, "end": 3339, "text": " its input it looks at its token and it decides what information do I want and" }, { "start": 3339, "end": 3346.16, "text": " it retrieves one particular thing from the other nodes okay whereas here it's" }, { "start": 3346.16, "end": 3351.44, "text": " more like kind of an averaging it's more like I want this kind of information" }, { "start": 3351.44, "end": 3356.04, "text": " and on average I don't even know what the sequence length is here I guess it's" }, { "start": 3356.04, "end": 3364.56, "text": " maybe 512 so of the 512 the median this number is always the median and median" }, { "start": 3364.56, "end": 3372, "text": " it collects information from 231 of them okay so you can see that this" }, { "start": 3372, "end": 3376.56, "text": " corresponds these green and orange ones correspond to these meta stable states" }, { "start": 3376.56, "end": 3383, "text": " where there's kind of an implicit clustering done in the in this space of" }, { "start": 3383, "end": 3387.2799999999997, "text": " attention whereas the blue ones they correspond to attention heads that ask" }, { "start": 3387.2799999999997, "end": 3393.96, "text": " for particular information retrieve one particular maybe few patterns and happy" }, { "start": 3393.96, "end": 3400.5, "text": " with that and the red ones here you can see that they often just average they" }, { "start": 3400.5, "end": 3406.56, "text": " just you know because K is so high means that I need all of the I need all of" }, { "start": 3406.56, "end": 3410.76, "text": " these bars to get to the 90% or I need almost all of them which basically means" }, { "start": 3410.76, "end": 3415.8, "text": " it's a uniform distribution right so it's like I don't care where information" }, { "start": 3415.8, "end": 3420.32, "text": " comes from just average whatever average I just want the average in some" }, { "start": 3420.32, "end": 3428.56, "text": " particular space and as we said that also has its uses interesting how this" }, { "start": 3428.56, "end": 3433.2400000000002, "text": " translate through so this here is as we go down the BERT model on the bottom of" }, { "start": 3433.2400000000002, "end": 3437.2400000000002, "text": " layer one you see there are a lot of these averaging operations going on so a" }, { "start": 3437.2400000000002, "end": 3441.88, "text": " lot of the heads are simply doing averaging and as you go up the layers" }, { "start": 3441.88, "end": 3448.6000000000004, "text": " the heads get more and more specific in the types of information they seek but" }, { "start": 3448.6, "end": 3452.68, "text": " then again in the last layers interestingly you get into a lot of" }, { "start": 3452.68, "end": 3459.64, "text": " these meta stable states again which I guess I get interpret this as you as you" }, { "start": 3459.64, "end": 3464.2, "text": " want I'm gonna leave this up to you but it sort of says like here you want kind" }, { "start": 3464.2, "end": 3468.2, "text": " of general patterns at the bottom and then the middle layers are kind of the" }, { "start": 3468.2, "end": 3473.38, "text": " logical workhorses so you look for very specific things in the input this is" }, { "start": 3473.38, "end": 3479.96, "text": " this is where I guess this is where the thinking happens so this is sort of" }, { "start": 3479.96, "end": 3486.48, "text": " pre-processing I'm just making stuff up here by the way this is this must be a" }, { "start": 3486.48, "end": 3494.92, "text": " no way true this is maybe thinking and this this here this might already be" }, { "start": 3494.92, "end": 3498.2200000000003, "text": " output again because you know after that you have language modeling or" }, { "start": 3498.22, "end": 3505, "text": " classification so this might already be like aggregating types of information" }, { "start": 3505, "end": 3512.52, "text": " this is how I sort of interpreted okay yeah so so this these these experiments" }, { "start": 3512.52, "end": 3519.7999999999997, "text": " are pretty pretty pretty interesting and here they have they do these are the" }, { "start": 3519.7999999999997, "end": 3524.04, "text": " last experiments for this paper they do an interesting experiment where they" }, { "start": 3524.04, "end": 3530.88, "text": " actually replace the attention heads by simply an average mechanism and later" }, { "start": 3530.88, "end": 3535.12, "text": " they actually replace them by Gaussians but in this case they simply average and" }, { "start": 3535.12, "end": 3540.9, "text": " they show that look if I replace layer one with this averaging the perplexity" }, { "start": 3540.9, "end": 3547.32, "text": " doesn't rise that much so it's pretty good even if I replace an entire layer" }, { "start": 3547.32, "end": 3553.02, "text": " here with averaging it perplexity goes more up and you can see the" }, { "start": 3553.02, "end": 3556.28, "text": " correspondence if you remember the previous plot the correspondence is" }, { "start": 3556.28, "end": 3562.62, "text": " pretty one-to-one with how much blue and green heads there are as contrast to how" }, { "start": 3562.62, "end": 3570.2599999999998, "text": " much red and orange ones there are so here you have lots of blue ones and you" }, { "start": 3570.2599999999998, "end": 3577.16, "text": " can see that the error kind of goes up and interestingly here you have more" }, { "start": 3577.16, "end": 3582.52, "text": " meta stable states at the end but still the perplexity goes up more so I guess" }, { "start": 3582.52, "end": 3588.2, "text": " you can only really replace the red ones with the averaging so this is always" }, { "start": 3588.2, "end": 3596.22, "text": " averaging in one particular layer and they go into more detail here where they" }, { "start": 3596.22, "end": 3601.12, "text": " say look this is this is layer 6 and this is layer 12 so this is one" }, { "start": 3601.12, "end": 3605.44, "text": " particular attention head from layer 6 and layer 12 and the updates don't be" }, { "start": 3605.44, "end": 3610.34, "text": " confused it goes in this direction okay I was confused at first and you can see" }, { "start": 3610.34, "end": 3615.56, "text": " right here this number K at first you know it's kind of spread out but then" }, { "start": 3615.56, "end": 3621.44, "text": " it pretty quickly converges to a very small number and there is this kind of" }, { "start": 3621.44, "end": 3624.52, "text": " point right here I don't know if the learning rates decrease I don't think so" }, { "start": 3624.52, "end": 3628.52, "text": " I think that's just kind of a a phase transition right here this is the blue" }, { "start": 3628.52, "end": 3633.84, "text": " line by the way the blue training line a phase transition where all of a sudden" }, { "start": 3633.84, "end": 3638.4, "text": " these just these attention heads they somehow decide okay this is the thing I" }, { "start": 3638.4, "end": 3643.2400000000002, "text": " want to specialize in this is the type of task I want like a sub task of" }, { "start": 3643.2400000000002, "end": 3647.58, "text": " linguistic sub task I want to specialize in and then they concentrate on one" }, { "start": 3647.58, "end": 3653.58, "text": " particular pattern per input so they are really specializing whereas in the last" }, { "start": 3653.58, "end": 3658.76, "text": " layer you see here that even during training they are sort of continuously" }, { "start": 3658.76, "end": 3663.78, "text": " learning so first they also do this averaging then they go into this meta" }, { "start": 3663.78, "end": 3669.5400000000004, "text": " stable region right this is this meta stable region K isn't one but also K" }, { "start": 3669.5400000000004, "end": 3676.44, "text": " isn't a very high number so they continuously learn and it's even" }, { "start": 3676.44, "end": 3681.96, "text": " indicative of this training might not be done here first of all and second of all" }, { "start": 3681.96, "end": 3686.44, "text": " it would be really interesting to see how this works out with you know sizes of" }, { "start": 3686.44, "end": 3690.7200000000003, "text": " transformers and like especially these these huge transformers just the fact" }, { "start": 3690.72, "end": 3696.9599999999996, "text": " that they can keep learning the more we train them might be you know be" }, { "start": 3696.9599999999996, "end": 3702.4399999999996, "text": " interpreted in the light of what kind of states they converge to and the fact" }, { "start": 3702.4399999999996, "end": 3707, "text": " that their attention heads I don't know how does this go on do they stay in the" }, { "start": 3707, "end": 3711.04, "text": " meta stable states because it makes sense to have meta stable states as I" }, { "start": 3711.04, "end": 3716.8599999999997, "text": " said it makes sense to kind of cluster things or are they simply into is this" }, { "start": 3716.86, "end": 3721.04, "text": " simply an intermediate step and if you go really far down they would actually" }, { "start": 3721.04, "end": 3727.1600000000003, "text": " also converge to the K equals one where they really specialize or if you do we" }, { "start": 3727.1600000000003, "end": 3731.6800000000003, "text": " need more attention heads for this I don't know it's just I think this is" }, { "start": 3731.6800000000003, "end": 3737.1200000000003, "text": " just the the beginning of kind of research in this direction I think just" }, { "start": 3737.1200000000003, "end": 3743.8, "text": " this kind of number K how it's how it's made it's pretty simple and apparently" }, { "start": 3743.8, "end": 3750.04, "text": " it's pretty pretty revealing so you know that's pretty cool so that was the paper" }, { "start": 3750.04, "end": 3755.44, "text": " and its experiments it's it's a pretty sizable paper as I said even the paper" }, { "start": 3755.44, "end": 3760.7200000000003, "text": " itself is ten pages and then there is this immune repertoire classification" }, { "start": 3760.7200000000003, "end": 3766.7200000000003, "text": " which I will like spend one minute looking at it so you have you have these" }, { "start": 3766.7200000000003, "end": 3771.6400000000003, "text": " set classifications so for each human you obtain a set of immune receptors and" }, { "start": 3771.64, "end": 3776.64, "text": " you simply obtain one label whether that human is immune to a particular disease" }, { "start": 3776.64, "end": 3781.52, "text": " or not and your task is kind and then a different human has a different set you" }, { "start": 3781.52, "end": 3786.96, "text": " have no idea which one of these things is responsible for it being for the" }, { "start": 3786.96, "end": 3794.52, "text": " human being for the human being immune or not in fact there is a you can't even" }, { "start": 3794.52, "end": 3799.92, "text": " decide based on these you can only decide based on like sub sequences of" }, { "start": 3799.92, "end": 3803.96, "text": " these and they might be in combination with each other so there might not be a" }, { "start": 3803.96, "end": 3807.84, "text": " single one responsible but like a combination but you don't have labels for" }, { "start": 3807.84, "end": 3811.32, "text": " the individual ones and you have different ones per human and they are" }, { "start": 3811.32, "end": 3817.76, "text": " different length all of this is just a giant giant task and you have many of" }, { "start": 3817.76, "end": 3823.44, "text": " them you have tens of thousands per human right so they build a system here" }, { "start": 3823.44, "end": 3827.76, "text": " where first they do these 1d convolutions to process the inside" }, { "start": 3827.76, "end": 3834.6400000000003, "text": " sequences and then they do this hop field attention mechanism or with with" }, { "start": 3834.6400000000003, "end": 3840.76, "text": " learned queries over these things and then they train on the output label and" }, { "start": 3840.76, "end": 3846.1600000000003, "text": " surprisingly that actually works even with tens of thousands of inside" }, { "start": 3846.1600000000003, "end": 3853.28, "text": " sequences and only one label for all of them and so they they achieve I guess" }, { "start": 3853.28, "end": 3859.0800000000004, "text": " favorable results compared to other baselines on this task using these hop" }, { "start": 3859.0800000000004, "end": 3863.2000000000003, "text": " field network which is pretty interesting but I let you look at that" }, { "start": 3863.2000000000003, "end": 3870.1600000000003, "text": " paper yourself so I hope this somehow made it a bit clear what happens here" }, { "start": 3870.1600000000003, "end": 3877, "text": " and it would actually be pretty interesting if we you know to see what" }, { "start": 3877, "end": 3883.2000000000003, "text": " happens if we just do maybe two rounds of these updates is this even desirable" }, { "start": 3883.2, "end": 3888.24, "text": " right is it desirable to run this to convergence is there something good" }, { "start": 3888.24, "end": 3891.8399999999997, "text": " about not running into convergence or does it actually not matter because it" }, { "start": 3891.8399999999997, "end": 3897.3599999999997, "text": " actually does converge in one step I don't know but have a look at the code" }, { "start": 3897.3599999999997, "end": 3903.7999999999997, "text": " it's pretty cool and I hope you enjoyed this video I'm sure you have many open" }, { "start": 3903.7999999999997, "end": 3909.56, "text": " questions as do I don't hesitate to ask me in the comments or join our discord" }, { "start": 3909.56, "end": 3913.96, "text": " as I said there are lots of helpful people on our discord and I'll see you" }, { "start": 3913.96, "end": 3940.84, "text": " next time bye bye" } ]
udS2OPohs_s
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
I TRAINED AN AI TO SOLVE 2+2 (w/ Live Coding)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "2+2", "twitter", "woke", "math", "algebra", "james lindsay", "culture", "definition", "gan", "generative adversarial networks", "generator", "discriminator", "live coding", "deep learning tutorial" ]
#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. Let's have a look at the accounts arguing right here. You know, James, Eric, you know what all of these have in common? They're humans. Humans arguing about fundamental questions of the universe and culture. What could possibly go wrong? So today, we're going to replace fallible, weak minded humans by AI. We're going to build an AI that's going to answer the question, what is 2 plus 2? Now first thing we're going to do is to import PyTorch. If you're using TensorFlow, what's wrong with you? Come on, just checking whether CUDA is available. CUDA is basically shorthanded AI for magic. So don't worry about that part. Now we're going to borrow quite a bit of code from the PyTorch example, because they've already implemented sort of the same thing. So the model we're going to use right here is going to be a generative adversarial network. Now you might be wondering, hey, is it really smart to build AI on something that's called adversarial? 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. Plink plonk. Let's plop that in here. That looks good. Look at that generator. Those convolutions, batch norms, relu's. 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 two and a plus and a two, and then the output should be, you know, whatever the result of that is. Now as a data set, we're going to use the famous MNIST data set. This data set is a very challenging data set. It's very large data set. But I think in order to tackle an important question like this, we need to go for the cram de la cram of data sets. So MNIST is a data set that contains a lot of these handwritten digits. You might think these are just numbers, but these are more than numbers. These numbers have a meaning. So the computer just sees this in numbers. But as a human, you would see this right here. Be the zero. This data set is filled with digits. Four. Wow. That's one of the things we need. Look at that. A nine. Beautiful. Beautiful. So our goal is going to be to try to make the network learn what two plus two is. Now if you know machine learning, you know that you need training data. So we need a labeled data set of two plus two equals and then whatever two plus two equals. So first, we're going to filter out all of the examples where that show a two. 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 9000. What we'll do is we'll train 9000 times 64 images and the AI is going to learn what two plus two is. Alright, so in each step, we need to create a batch of training samples. What we need is a two plus and two. So for the two is we can just select two of the two's that we had before. Now the plus is a little bit more tricky. So in order to make a plus, there's none in the MNIST data set. You have to understand the MNIST data set is also quite old. I think it was invented before the plus sign was invented. So that's not in the data set. So we have to create a plus by ourselves. It's going to be hard, but we'll give it a try. Now I'm usually way too dumb to use mesh grid, but I'm just gonna try. I mean, you know, what can go wrong? Okay, so as you can see, we're absolutely on the wrong track right here. Ladies and gentlemen, the most beautiful plus in the history of AI. Alright, so we got a plus and we got all of our two's. So now let's put them together. Look at that. Two plus two, next sample, two plus two, next sample, two plus two. 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 four by four. 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. What's this good for? Nothing, nothing. All right, 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 data set because who's to say what two plus two is. And as I said, usually I would outsource this to grad students, but these are humans as well. So we're kind of in a pinch right here. So what we're going to do is employ a heuristic. We're going to ask our machine right here what two plus two for the training examples is. Okay. So in Python, you can do this by typing two plus two. And you know, in this case, that happens to be four, but who knows? So for each of these training examples, we're going to take the class label, which is provided in the data set, and we're going to take these class labels and add them together. And whatever comes out is going to be the label for this. In this case, it's four, you know, 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 need the label of the first sample and the label of the second sample. And our final label is simply going to be label one plus the label two. As I said, this is a heuristic for training the AI. Now, usually in a generative adversarial network or a GAN for short, you'd have something that's called a generator, which we do. And you'd have something that's called a discriminator. Now, I have my problems with this discrimination. There is no space for discrimination in the AI field. So we're going to leave away the discriminator right here. I'm sorry. I'm sorry. We're going to directly go to the loss from the generator. In order to calculate the loss, we need a reference. And for that, we're simply going to go to our data set with our label and find any of the images that correspond to that label. So if our heuristic, if our oracle says two plus two is equal to nine, we're just going to go to our data set, get a nine and put that as a training output. Okay. Okay. So if we look at one of the labels that just happens to be a four in this case, but we're going to go through the entire number of 9000 steps. And in each steps, we'll train 64 of these different combinations of two plus two. And we'll give one of the labels each time and we'll see what the AI comes up with. For that, we need a loss. Now the loss we're going to use here is going to be the L2 loss. Now there's some controversy, but you know, it is the most powerful loss proven and we have to employ the most powerful tools. So let's do that. So our loss here at the beginning is 509. Now that's a lot of loss. That's a big loss. We need to get that loss down. And to do that, we need one of these optimizers. Now optimizers are kind of the secret workhorses of AI and people don't talk about them enough. I wish there was like a field of research that deals with optimizers, like could be called optimization or something like this. I'm not sure. I just, I just think it would make a lot of sense. So my favorite learning rate is three E minus four just because it 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. I'm sorry about this. I think this is it. This is it. This is AI history right here, right now for five steps, 10 steps. All right. I have waited and waited and waited and it's finally done. We have now trained the generator to calculate what two plus two equals from the training data set. So now we actually need to ask it what is two plus two. And of course we can't ask it a sample that it has already seen. We need to take a new sample from the test set as is customary in machine learning. So let's get the MNIST test set. Now the test data set consists of images as does the train data set, but the model has never seen the test data set before. This is a property we call generalization. So let's find two nice twos. All right. That's the first one. Okay. These are two nice twos. Let's put them together. Okay. So this is 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?
[ { "start": 0, "end": 5.08, "text": " Hi there, you might have seen the recent debate about 2 plus 2, where everyone tries to weigh" }, { "start": 5.08, "end": 12.040000000000001, "text": " in, the big question being is 2 plus 2 equal to 4, or is 2 plus 2 equal to 5?" }, { "start": 12.040000000000001, "end": 19.44, "text": " And for some reason, the entirety of Western civilization hangs in the balance right here." }, { "start": 19.44, "end": 21.68, "text": " But everyone's missing the point." }, { "start": 21.68, "end": 24.04, "text": " Everyone's just kind of arguing about this." }, { "start": 24.04, "end": 26.46, "text": " But I want to point something out right here." }, { "start": 26.46, "end": 29.92, "text": " Let's have a look at the accounts arguing right here." }, { "start": 29.92, "end": 34.92, "text": " You know, James, Eric, you know what all of these have in common?" }, { "start": 34.92, "end": 36.92, "text": " They're humans." }, { "start": 36.92, "end": 41.8, "text": " Humans arguing about fundamental questions of the universe and culture." }, { "start": 41.8, "end": 43.040000000000006, "text": " What could possibly go wrong?" }, { "start": 43.040000000000006, "end": 49.28, "text": " So today, we're going to replace fallible, weak minded humans by AI." }, { "start": 49.28, "end": 56.08, "text": " We're going to build an AI that's going to answer the question, what is 2 plus 2?" }, { "start": 56.08, "end": 59.08, "text": " Now first thing we're going to do is to import PyTorch." }, { "start": 59.08, "end": 62.239999999999995, "text": " If you're using TensorFlow, what's wrong with you?" }, { "start": 62.239999999999995, "end": 65.84, "text": " Come on, just checking whether CUDA is available." }, { "start": 65.84, "end": 69.1, "text": " CUDA is basically shorthanded AI for magic." }, { "start": 69.1, "end": 71.08, "text": " So don't worry about that part." }, { "start": 71.08, "end": 76.02, "text": " Now we're going to borrow quite a bit of code from the PyTorch example, because they've" }, { "start": 76.02, "end": 78.68, "text": " already implemented sort of the same thing." }, { "start": 78.68, "end": 84.08, "text": " So the model we're going to use right here is going to be a generative adversarial network." }, { "start": 84.08, "end": 88.88, "text": " Now you might be wondering, hey, is it really smart to build AI on something that's called" }, { "start": 88.88, "end": 89.88, "text": " adversarial?" }, { "start": 89.88, "end": 92.28, "text": " Isn't that a little bit dangerous?" }, { "start": 92.28, "end": 97.34, "text": " To that I say, all right now, so we're going to grab the code from over here." }, { "start": 97.34, "end": 99.75999999999999, "text": " First thing we need is the model itself." }, { "start": 99.75999999999999, "end": 103.38, "text": " Now the model is composed of a generator and a discriminator." }, { "start": 103.38, "end": 105.44, "text": " The generator is right here." }, { "start": 105.44, "end": 106.44, "text": " Plink plonk." }, { "start": 106.44, "end": 108.48, "text": " Let's plop that in here." }, { "start": 108.48, "end": 109.88, "text": " That looks good." }, { "start": 109.88, "end": 112, "text": " Look at that generator." }, { "start": 112, "end": 115.8, "text": " Those convolutions, batch norms, relu's." }, { "start": 115.8, "end": 120.52, "text": " This is going to be so artificial and so intelligent, you won't believe it." }, { "start": 120.52, "end": 125.42, "text": " So the generator is responsible for basically outputting things." }, { "start": 125.42, "end": 131.34, "text": " In our case, what we're going to input a two and a plus and a two, and then the output" }, { "start": 131.34, "end": 135, "text": " should be, you know, whatever the result of that is." }, { "start": 135, "end": 139.18, "text": " Now as a data set, we're going to use the famous MNIST data set." }, { "start": 139.18, "end": 142.36, "text": " This data set is a very challenging data set." }, { "start": 142.36, "end": 143.70000000000002, "text": " It's very large data set." }, { "start": 143.70000000000002, "end": 148.56, "text": " But I think in order to tackle an important question like this, we need to go for the" }, { "start": 148.56, "end": 150.96, "text": " cram de la cram of data sets." }, { "start": 150.96, "end": 156.26000000000002, "text": " So MNIST is a data set that contains a lot of these handwritten digits." }, { "start": 156.26000000000002, "end": 159.64000000000001, "text": " You might think these are just numbers, but these are more than numbers." }, { "start": 159.64000000000001, "end": 161.28, "text": " These numbers have a meaning." }, { "start": 161.28, "end": 164.16, "text": " So the computer just sees this in numbers." }, { "start": 164.16, "end": 167.5, "text": " But as a human, you would see this right here." }, { "start": 167.5, "end": 169.72, "text": " Be the zero." }, { "start": 169.72, "end": 172.88, "text": " This data set is filled with digits." }, { "start": 172.88, "end": 173.88, "text": " Four." }, { "start": 173.88, "end": 174.88, "text": " Wow." }, { "start": 174.88, "end": 176.36, "text": " That's one of the things we need." }, { "start": 176.36, "end": 177.36, "text": " Look at that." }, { "start": 177.36, "end": 178.36, "text": " A nine." }, { "start": 178.36, "end": 179.36, "text": " Beautiful." }, { "start": 179.36, "end": 180.36, "text": " Beautiful." }, { "start": 180.36, "end": 185.6, "text": " So our goal is going to be to try to make the network learn what two plus two is." }, { "start": 185.6, "end": 189.02, "text": " Now if you know machine learning, you know that you need training data." }, { "start": 189.02, "end": 196.08, "text": " So we need a labeled data set of two plus two equals and then whatever two plus two" }, { "start": 196.08, "end": 197.08, "text": " equals." }, { "start": 197.08, "end": 201.72, "text": " So first, we're going to filter out all of the examples where that show a two." }, { "start": 201.72, "end": 204.36, "text": " So we need to train this network, right?" }, { "start": 204.36, "end": 209, "text": " So we need a number of training steps, you know, in AI, we like to train for a lot of" }, { "start": 209, "end": 210, "text": " steps." }, { "start": 210, "end": 213.20000000000002, "text": " Let's just go for 9000." }, { "start": 213.20000000000002, "end": 218.9, "text": " What we'll do is we'll train 9000 times 64 images and the AI is going to learn what two" }, { "start": 218.9, "end": 219.9, "text": " plus two is." }, { "start": 219.9, "end": 224.70000000000002, "text": " Alright, so in each step, we need to create a batch of training samples." }, { "start": 224.7, "end": 227.83999999999997, "text": " What we need is a two plus and two." }, { "start": 227.83999999999997, "end": 233.38, "text": " So for the two is we can just select two of the two's that we had before." }, { "start": 233.38, "end": 236.2, "text": " Now the plus is a little bit more tricky." }, { "start": 236.2, "end": 241.01999999999998, "text": " So in order to make a plus, there's none in the MNIST data set." }, { "start": 241.01999999999998, "end": 244, "text": " You have to understand the MNIST data set is also quite old." }, { "start": 244, "end": 248.12, "text": " I think it was invented before the plus sign was invented." }, { "start": 248.12, "end": 249.66, "text": " So that's not in the data set." }, { "start": 249.66, "end": 252.12, "text": " So we have to create a plus by ourselves." }, { "start": 252.12, "end": 255.16, "text": " It's going to be hard, but we'll give it a try." }, { "start": 255.16, "end": 259.08, "text": " Now I'm usually way too dumb to use mesh grid, but I'm just gonna try." }, { "start": 259.08, "end": 261.16, "text": " I mean, you know, what can go wrong?" }, { "start": 261.16, "end": 268.88, "text": " Okay, so as you can see, we're absolutely on the wrong track right here." }, { "start": 268.88, "end": 274.4, "text": " Ladies and gentlemen, the most beautiful plus in the history of AI." }, { "start": 274.4, "end": 280.4, "text": " Alright, so we got a plus and we got all of our two's." }, { "start": 280.4, "end": 281.98, "text": " So now let's put them together." }, { "start": 281.98, "end": 282.98, "text": " Look at that." }, { "start": 282.98, "end": 292.70000000000005, "text": " Two plus two, next sample, two plus two, next sample, two plus two." }, { "start": 292.70000000000005, "end": 297.02000000000004, "text": " So our AI is going to be trained on data samples just like this." }, { "start": 297.02000000000004, "end": 301.70000000000005, "text": " Now in order to make the generator accept samples like this, we sort of need to change" }, { "start": 301.70000000000005, "end": 307.26, "text": " a little bit because if we try to just put this into the generator, probably it won't" }, { "start": 307.26, "end": 308.26, "text": " work." }, { "start": 308.26, "end": 309.26, "text": " You see, there's an error." }, { "start": 309.26, "end": 312.5, "text": " The generator is not artificially intelligent enough yet." }, { "start": 312.5, "end": 315, "text": " So we need to make it take samples." }, { "start": 315, "end": 318.42, "text": " So our samples are of size 28 by 84." }, { "start": 318.42, "end": 326.42, "text": " And what the generator right now expects is a sample of size 100 by 512 by four by four." }, { "start": 326.42, "end": 329.7, "text": " So you may notice we have never made use of our batch size." }, { "start": 329.7, "end": 331.21999999999997, "text": " So let's fix that right now." }, { "start": 331.21999999999997, "end": 336.02, "text": " So now we're training in batches of images, but it's still not cool for the generator." }, { "start": 336.02, "end": 338.14, "text": " So we need to change the generator right here." }, { "start": 338.14, "end": 340.09999999999997, "text": " What's this good for?" }, { "start": 340.09999999999997, "end": 341.09999999999997, "text": " Nothing, nothing." }, { "start": 341.09999999999997, "end": 345.34, "text": " All right, so it expects the input to be of a certain size." }, { "start": 345.34, "end": 348.3, "text": " And we are going to change that right here." }, { "start": 348.3, "end": 351.9, "text": " We also don't want any strides." }, { "start": 351.9, "end": 353.97999999999996, "text": " Strides are for losers." }, { "start": 353.97999999999996, "end": 355.5, "text": " And let's see where that gets us." }, { "start": 355.5, "end": 362.06, "text": " Okay, so we made our generator accept images that we want and produce images of the size" }, { "start": 362.06, "end": 363.18, "text": " that we want." }, { "start": 363.18, "end": 368.5, "text": " Now the entire question here is we need labels for our training data set because who's to" }, { "start": 368.5, "end": 370.66, "text": " say what two plus two is." }, { "start": 370.66, "end": 376.34000000000003, "text": " And as I said, usually I would outsource this to grad students, but these are humans as" }, { "start": 376.34000000000003, "end": 377.34000000000003, "text": " well." }, { "start": 377.34000000000003, "end": 379.96000000000004, "text": " So we're kind of in a pinch right here." }, { "start": 379.96000000000004, "end": 382.38, "text": " So what we're going to do is employ a heuristic." }, { "start": 382.38, "end": 389.3, "text": " We're going to ask our machine right here what two plus two for the training examples" }, { "start": 389.3, "end": 390.3, "text": " is." }, { "start": 390.3, "end": 391.3, "text": " Okay." }, { "start": 391.3, "end": 396.74, "text": " So in Python, you can do this by typing two plus two." }, { "start": 396.74, "end": 401.5, "text": " And you know, in this case, that happens to be four, but who knows?" }, { "start": 401.5, "end": 407.82, "text": " So for each of these training examples, we're going to take the class label, which is provided" }, { "start": 407.82, "end": 412.14, "text": " in the data set, and we're going to take these class labels and add them together." }, { "start": 412.14, "end": 415.62, "text": " And whatever comes out is going to be the label for this." }, { "start": 415.62, "end": 419.26, "text": " In this case, it's four, you know, but it could be anything." }, { "start": 419.26, "end": 423.3, "text": " And we're just going to use these as training data for our model." }, { "start": 423.3, "end": 427.62, "text": " So for that, we're going to need the label of the first sample and the label of the second" }, { "start": 427.62, "end": 428.62, "text": " sample." }, { "start": 428.62, "end": 433.26, "text": " And our final label is simply going to be label one plus the label two." }, { "start": 433.26, "end": 436.65999999999997, "text": " As I said, this is a heuristic for training the AI." }, { "start": 436.65999999999997, "end": 442.86, "text": " Now, usually in a generative adversarial network or a GAN for short, you'd have something that's" }, { "start": 442.86, "end": 445.21999999999997, "text": " called a generator, which we do." }, { "start": 445.21999999999997, "end": 447.76, "text": " And you'd have something that's called a discriminator." }, { "start": 447.76, "end": 451.38, "text": " Now, I have my problems with this discrimination." }, { "start": 451.38, "end": 455.4, "text": " There is no space for discrimination in the AI field." }, { "start": 455.4, "end": 458.06, "text": " So we're going to leave away the discriminator right here." }, { "start": 458.06, "end": 459.06, "text": " I'm sorry." }, { "start": 459.06, "end": 460.06, "text": " I'm sorry." }, { "start": 460.06, "end": 463.34, "text": " We're going to directly go to the loss from the generator." }, { "start": 463.34, "end": 467.7, "text": " In order to calculate the loss, we need a reference." }, { "start": 467.7, "end": 473.38, "text": " And for that, we're simply going to go to our data set with our label and find any of" }, { "start": 473.38, "end": 475.94, "text": " the images that correspond to that label." }, { "start": 475.94, "end": 481.8, "text": " So if our heuristic, if our oracle says two plus two is equal to nine, we're just going" }, { "start": 481.8, "end": 486.66, "text": " to go to our data set, get a nine and put that as a training output." }, { "start": 486.66, "end": 487.66, "text": " Okay." }, { "start": 487.66, "end": 488.66, "text": " Okay." }, { "start": 488.66, "end": 494.14, "text": " So if we look at one of the labels that just happens to be a four in this case, but we're" }, { "start": 494.14, "end": 498.82, "text": " going to go through the entire number of 9000 steps." }, { "start": 498.82, "end": 504.24, "text": " And in each steps, we'll train 64 of these different combinations of two plus two." }, { "start": 504.24, "end": 509.44, "text": " And we'll give one of the labels each time and we'll see what the AI comes up with." }, { "start": 509.44, "end": 510.62, "text": " For that, we need a loss." }, { "start": 510.62, "end": 513.74, "text": " Now the loss we're going to use here is going to be the L2 loss." }, { "start": 513.74, "end": 520.98, "text": " Now there's some controversy, but you know, it is the most powerful loss proven and we" }, { "start": 520.98, "end": 523.6, "text": " have to employ the most powerful tools." }, { "start": 523.6, "end": 524.8, "text": " So let's do that." }, { "start": 524.8, "end": 527.7, "text": " So our loss here at the beginning is 509." }, { "start": 527.7, "end": 530.58, "text": " Now that's a lot of loss." }, { "start": 530.58, "end": 531.82, "text": " That's a big loss." }, { "start": 531.82, "end": 533.72, "text": " We need to get that loss down." }, { "start": 533.72, "end": 536.5400000000001, "text": " And to do that, we need one of these optimizers." }, { "start": 536.5400000000001, "end": 542.82, "text": " Now optimizers are kind of the secret workhorses of AI and people don't talk about them enough." }, { "start": 542.82, "end": 548.0600000000001, "text": " I wish there was like a field of research that deals with optimizers, like could be" }, { "start": 548.0600000000001, "end": 551.1, "text": " called optimization or something like this." }, { "start": 551.1, "end": 552.1, "text": " I'm not sure." }, { "start": 552.1, "end": 555.28, "text": " I just, I just think it would make a lot of sense." }, { "start": 555.28, "end": 561.58, "text": " So my favorite learning rate is three E minus four just because it contains all of the different" }, { "start": 561.58, "end": 565.5, "text": " things, like a letter and a dash." }, { "start": 565.5, "end": 568.7800000000001, "text": " And that seems like a pretty good thing to do." }, { "start": 568.7800000000001, "end": 571.1800000000001, "text": " So we're going to use Adam here as an optimizer." }, { "start": 571.1800000000001, "end": 577.5200000000001, "text": " Adam, I know, I don't know Adam personally, but I know a couple of his friends and they" }, { "start": 577.5200000000001, "end": 579.5, "text": " tell me he's pretty good." }, { "start": 579.5, "end": 583.94, "text": " So you know, it's going to go zero grad and I'm dumb." }, { "start": 583.94, "end": 587.58, "text": " So I need to look up how to use an optimizer and boom." }, { "start": 587.58, "end": 588.58, "text": " Okay." }, { "start": 588.58, "end": 589.58, "text": " Okay." }, { "start": 589.58, "end": 590.58, "text": " So it's again a four." }, { "start": 590.58, "end": 591.58, "text": " I'm sorry about this." }, { "start": 591.58, "end": 592.58, "text": " I think this is it." }, { "start": 592.58, "end": 593.58, "text": " This is it." }, { "start": 593.58, "end": 601.14, "text": " This is AI history right here, right now for five steps, 10 steps." }, { "start": 601.14, "end": 602.14, "text": " All right." }, { "start": 602.14, "end": 606.9000000000001, "text": " I have waited and waited and waited and it's finally done." }, { "start": 606.9000000000001, "end": 613.26, "text": " We have now trained the generator to calculate what two plus two equals from the training" }, { "start": 613.26, "end": 614.26, "text": " data set." }, { "start": 614.26, "end": 617.1400000000001, "text": " So now we actually need to ask it what is two plus two." }, { "start": 617.1400000000001, "end": 619.7, "text": " And of course we can't ask it a sample that it has already seen." }, { "start": 619.7, "end": 626.44, "text": " We need to take a new sample from the test set as is customary in machine learning." }, { "start": 626.44, "end": 628.26, "text": " So let's get the MNIST test set." }, { "start": 628.26, "end": 634.46, "text": " Now the test data set consists of images as does the train data set, but the model has" }, { "start": 634.46, "end": 637.38, "text": " never seen the test data set before." }, { "start": 637.38, "end": 639.86, "text": " This is a property we call generalization." }, { "start": 639.86, "end": 642.38, "text": " So let's find two nice twos." }, { "start": 642.38, "end": 643.58, "text": " All right." }, { "start": 643.58, "end": 644.58, "text": " That's the first one." }, { "start": 644.58, "end": 645.58, "text": " Okay." }, { "start": 645.58, "end": 647.0200000000001, "text": " These are two nice twos." }, { "start": 647.0200000000001, "end": 648.0200000000001, "text": " Let's put them together." }, { "start": 648.0200000000001, "end": 649.0200000000001, "text": " Okay." }, { "start": 649.02, "end": 651.62, "text": " So this is going to be our input to the generator." }, { "start": 651.62, "end": 652.62, "text": " Okay." }, { "start": 652.62, "end": 659.14, "text": " So I'm putting the test sample here into the generator that is trained and I've labeled" }, { "start": 659.14, "end": 664.54, "text": " the output in all caps just to tell the model that this is really important computation." }, { "start": 664.54, "end": 671.02, "text": " I'm just going to run this cell for a couple of times just to make sure that generator" }, { "start": 671.02, "end": 675.86, "text": " is in fact very sure about how important that is." }, { "start": 675.86, "end": 676.86, "text": " All right." }, { "start": 676.86, "end": 677.86, "text": " I think that's enough." }, { "start": 677.86, "end": 684.58, "text": " Let's have a look at that final output." }, { "start": 684.58, "end": 685.58, "text": " I'm shaking." }, { "start": 685.58, "end": 708.82, "text": " Are you ready for AI history?" } ]
ml3Y1ljVSQ8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
PCGRL: Procedural Content Generation via Reinforcement Learning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "reinforcement learning", "level design", "game design", "video game", "sobokan", "sokoban", "zelda", "maze", "agent", "turtle", "observation", "reward", "action", "space", "deep rl", "deep reinforcement learning", "content", "minecraft" ]
#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, Philippe Bontrager, Sam Early and Julian Togelius. Now this paper is basically just a fun paper 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 the code is 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. So 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. Let's 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. So this is the outset 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. The first thing is you actually have to frame the problem in terms of reinforcement learning. So what is reinforcement learning? It's pretty simple. In reinforcement learning you have this agent-environment split. 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 worry about that. The environment is going to send the next observation 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 a reward for the last action it 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? 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, 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. 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 framework of this grid world game. 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 1 is going to be a wall while the 0 is going to be empty space. 3 here is one of these crates and 2 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 agent can do? At each step they say the agent can change one of these tiles. So you can change one of these tiles, let's say this one right here. You can change it to a different one or you can just leave it. So this is a wall right now and it makes the problem fairly interesting to have a wall right here in the middle. So since we're looking at this tile, we might just wanna leave this right there. We could also change it. We could actually change it such that to a 2, such that there is another player right here. Can I even draw this? This yellow isn't. Such that there is now two player tiles in the game. This would of course be an invalid level and the reinforcement learning agent ultimately should learn to produce valid and good levels. 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 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 tile to change. So the environment will say now you can change this tile if you want. And in 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 how the environment chooses. Actually it doesn't have to be, but the environment chooses and that is problematic for the agent because the agent cannot kind of predict which tile it can change next and therefore it cannot really plan ahead how it wants to change the level. It can only make very very local very greedy choices. It can be like oh I'm right here I might actually build a wall right here. Yes that seems good. An example is maybe you want to make the level more interesting. Maybe you think that the crate up here is a bit close to this field here. You have to push it onto this field and that's fairly easy right? So you just push it like up and then to the left. Actually it's not that easy because there's the wall right here and you have to go around. Actually you probably have to push this down. But let's say the level is too easy and you want to move the move the crate to a bit like let's say here. In this framework where the environment tells you which tiles to change. Once you come across this tile you can delete it. But then you have to wait and wait and wait and wait until at random this tile where you want to put it is selected. This might actually never happen because the episode might be over and if it never happens you are in an invalid level. So 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 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. So it can choose. So you can go along and say okay now I'm here I want to change it to a 2, now I'm here, I want to change it to a 2, now I'm here and so on. So it can basically do things like build long walls and things like this so it can plan ahead more considerably. But still if you regard the problem from before if it wants to place the crate to a different location it can, like if maybe it's here okay the agent is here and then it can say okay I wanna not change but move, not change and move, not change move and then it can delete and then it has to move over here step by step until it can place it again. So it can plan ahead considerably longer actually it can just move straight over because the agent itself is not constrained by walls. So it can move ahead quite a bit but it's still kind of localized changes because it can move one tile at a time right and if in between the episode ends it's again an invalid level. So the third formulation is the most powerful formulation. It's called the wide formulation and this is where the agent at each time step cannot only choose how to change the tile but can freely choose the next tile to change. So it 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. So this is, so it can plan ahead considerably. So how you design the action space is very important for how your agent, 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. Alright so this is the action space. Now how the observation 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 situation right here and the agent deletes the crate then the crate is no longer there. So if it changes this to a zero then it's just empty space now. So that's fairly obvious here. Now the last thing we need to do is the reward calculation. What reward do you give the agent? 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. 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 authors of this paper simply employ a Sobocon solver. They have a Sobocon solver that is like a tree search algorithm that tries to solve the level. If it can't solve the level then the level is invalid and the agent gets a worse reward than whenever the level is solvable. So how you design the reward is also very important. If you only give 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 so 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 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. Or all the rules are fulfilled and there is a crate here. 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. That means 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 a limitation here. But all of their rewards are hard-coded so to say. So 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. This is sort of a random initial state and you allow the agent now to change it in this stepwise fashion and you always update the agent. By the way, the agent, as you might imagine, the agent takes this matrix right here and puts it, shoves it through like a few convolutional layers and then decides on an action. I'm almost forgetting that this is so obvious by now that the agent is like a standard deep learning taking in a 2D, doing some convolutions and then having like a policy output. 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 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. It would just try to change the, to always reach that best possible state and forget the start state. So they say, okay, the last constraint is the agent can only change like 20 percent of the tiles at most and after that we end the episode or we just don't allow the agent to change anything anymore. It needs to first, so if it changed this here to empty space and wants to change something else, first needs to change this back and then it can change something else. So you can do that. So this constrains the agent and kind of teaches it that in order to get a 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 sometimes, like most of the time, you just want to find the highest reward, whatever. But here you also want to maximize diversity of the levels you generate and therefore you could say that's a pretty good, you know, that's a pretty good constraint to put into that. So that's a thing I like here about this paper. This change percentage constraint. Now at inference time you can change that. So at training time you only change, whatever, 20 percent. But at inference time you can technically let the agent run for longer. As you can see, I think here they just let it run until it, you know, finds something good, like this one right here. Fairly good from the starting state. And you can see it sort of still adjusts to the starting state right here. So you can see that this it connects the the two dots on the top. So the goal is to make the longest possible maze or a long maze. So it connects these two. You can see here also this one connects them. And then it goes out here and connects to this one. So it's fairly good at relying on this starting state. You can see that these turtle and wide representations that can actually choose where to go and where to change something are considerably or, you know, more 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, it is going to directly affect the outcome that you're going to have. Alright, 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 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 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... Here they have two players and they they're deleting one of them. Here they have three crates and they actually make it such that the number of crates and the number of green tiles agree. So, you know, that's 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 Sobhakan 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 level, like succeeds in building a valid level, goes up and up. And now this, as I already said, this narrow representation here appears to be a bit less powerful than the others. Interestingly, in Sobhakan, 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 isn't, you know, powerful enough or their representation, like the CNN is maybe mis-architectured a bit. You know, technically this representation should be able to achieve higher scores, but not as easily because, as I said, the action space is so much higher. So it's more difficult to learn, but ultimately, it should learn it better. Alright, so this is, this was this paper. It's, I think it's fairly cool and fairly fun to view it from this particular perspective. And they 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 you'd 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 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 super, like that's not going to be the case that much. And also they remark that most of the levels generated are fairly easy, because their reward only depends on whether or not the level is solvable by an easy solver, right? So you could give some reward for how difficult the level is, but then again, that depends on your solver. So an interesting next step would be to evolve these or to train these as you train reinforcement learning agents to solve these kinds of games. So kind of do a curriculum learning, sort of a GAN setting between level generator and reinforcement learning algorithm, like reinforcement learning game player to sort of evolve levels and agents at the same time. I think it's sort of like these poet approaches, except you would directly learn. I think that would be a 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, "end": 4.84, "text": " Hi there! Have you ever wondered how video game levels are made?" }, { "start": 4.84, "end": 7.96, "text": " Yeah, me neither, but this paper has." }, { "start": 7.96, "end": 12.68, "text": " And in this paper you can see a reinforcement learning agent that has" }, { "start": 12.68, "end": 13.280000000000001, "text": " learned" }, { "start": 13.280000000000001, "end": 16.6, "text": " how to make video game levels" }, { "start": 16.6, "end": 20.080000000000002, "text": " in various ways. So this is implemented for" }, { "start": 20.080000000000002, "end": 24.12, "text": " this game here where the goal is simply to make the longest maze." }, { "start": 24.12, "end": 28.080000000000002, "text": " This game here is an adaptation to The Legend of Zelda" }, { "start": 28.08, "end": 32.199999999999996, "text": " where you have to get a key to the door. And this game here is called" }, { "start": 32.199999999999996, "end": 35.9, "text": " Sobocon where you have to put all of the crates" }, { "start": 35.9, "end": 40.64, "text": " onto the green squares in order to solve it. So it's a puzzle game." }, { "start": 40.64, "end": 43.839999999999996, "text": " Alright, and this is done via" }, { "start": 43.839999999999996, "end": 48.76, "text": " reinforcement learning. So the paper we're going to look at is called" }, { "start": 48.76, "end": 52.12, "text": " PCGRL Procedural Content Generation Via" }, { "start": 52.12, "end": 56.06, "text": " Reinforcement Learning by Ahmed Khalifa, Philippe Bontrager," }, { "start": 56.06, "end": 60, "text": " Sam Early and Julian Togelius. Now this paper" }, { "start": 60, "end": 63.84, "text": " is basically just a fun paper" }, { "start": 63.84, "end": 69.48, "text": " I feel, and it shows how to frame a problem in terms of reinforcement learning" }, { "start": 69.48, "end": 73.36, "text": " and then how to solve it. It's pretty straightforward, it's fairly short" }, { "start": 73.36, "end": 76.5, "text": " and the code is available and all" }, { "start": 76.5, "end": 80.04, "text": " so you can go check it out yourself." }, { "start": 80.04, "end": 83.04, "text": " They say" }, { "start": 83.04, "end": 86.12, "text": " we investigate how reinforcement learning" }, { "start": 86.12, "end": 89.48, "text": " can be used to train level designing agents." }, { "start": 89.48, "end": 93.52000000000001, "text": " So usually" }, { "start": 93.52000000000001, "end": 96.80000000000001, "text": " we do reinforcement learning for playing games" }, { "start": 96.80000000000001, "end": 100.4, "text": " themselves and now we use reinforcement learning" }, { "start": 100.4, "end": 104.16000000000001, "text": " to train an agent that can design a level." }, { "start": 104.16000000000001, "end": 107.72, "text": " So we don't design the level itself" }, { "start": 107.72, "end": 111.96000000000001, "text": " straightforward, we design the agent that designs the level." }, { "start": 111.96, "end": 115.36, "text": " And what's the advantage here? The advantage is of course" }, { "start": 115.36, "end": 118.36, "text": " the agent could then potentially" }, { "start": 118.36, "end": 122.16, "text": " generate multiple different levels once we have trained it." }, { "start": 122.16, "end": 127.24, "text": " Let's say this represents a new approach to procedural content generation in" }, { "start": 127.24, "end": 127.88, "text": " games" }, { "start": 127.88, "end": 131.51999999999998, "text": " where level design is framed as a game itself." }, { "start": 131.51999999999998, "end": 136.78, "text": " So the design of the level is now the game. And the content generator" }, { "start": 136.78, "end": 141.48, "text": " itself is learned. By seeing the design problem as a sequential task we can use" }, { "start": 141.48, "end": 145.28, "text": " reinforcement learning to learn how to take the next action" }, { "start": 145.28, "end": 150, "text": " so that the expected final level quality is maximized." }, { "start": 150, "end": 154.51999999999998, "text": " This approach can be used when few or no examples exist to train from" }, { "start": 154.51999999999998, "end": 157.67999999999998, "text": " and the train generator is very very fast." }, { "start": 157.67999999999998, "end": 160.72, "text": " So this is the outset of the" }, { "start": 160.72, "end": 165.79999999999998, "text": " problem formulation. Now we're going to go through the steps you have to do" }, { "start": 165.79999999999998, "end": 168.83999999999997, "text": " in order to make this work. There are a few things" }, { "start": 168.84, "end": 172.88, "text": " that I think this paper does quite well." }, { "start": 172.88, "end": 176.56, "text": " The first thing is you actually have to frame the problem in terms of" }, { "start": 176.56, "end": 177.88, "text": " reinforcement learning." }, { "start": 177.88, "end": 181.92000000000002, "text": " So what is reinforcement learning? It's pretty simple. In reinforcement learning" }, { "start": 181.92000000000002, "end": 185.2, "text": " you have this agent-environment split." }, { "start": 185.2, "end": 189.16, "text": " So at each step the environment is going to send the agent an" }, { "start": 189.16, "end": 192.64000000000001, "text": " observation. So the environment is going to send an observation" }, { "start": 192.64000000000001, "end": 195.84, "text": " to the agent and the agent needs to take an" }, { "start": 195.84, "end": 200.20000000000002, "text": " action in response to that. Now" }, { "start": 200.20000000000002, "end": 203.92000000000002, "text": " something happens in here. We don't worry about that." }, { "start": 203.92000000000002, "end": 207.36, "text": " The environment is going to send the next observation" }, { "start": 207.36, "end": 211.4, "text": " that is a result from taking this action" }, { "start": 211.4, "end": 214.76, "text": " and it is also going to send the reward" }, { "start": 214.76, "end": 217.92000000000002, "text": " for this action. So at each step the agent gets" }, { "start": 217.92000000000002, "end": 223.12, "text": " an observation and a reward for the last action it took and it has to output" }, { "start": 223.12, "end": 226.72, "text": " the next action. Now the environment of course has to" }, { "start": 226.72, "end": 231.24, "text": " somehow decide how do I represent the observation." }, { "start": 231.24, "end": 234.72, "text": " This is the representation. How do I transform" }, { "start": 234.72, "end": 238.36, "text": " one observation to the next observation given an action?" }, { "start": 238.36, "end": 243.36, "text": " The action comes in and transforms the last state to the next state" }, { "start": 243.36, "end": 247.48000000000002, "text": " and then how do I give the reward? How do I calculate the reward?" }, { "start": 247.48000000000002, "end": 252.8, "text": " So these things are the things you have to decide on. The observation space," }, { "start": 252.8, "end": 256.44, "text": " how the reward is calculated, the action space" }, { "start": 256.44, "end": 259.64, "text": " and how an action transforms one" }, { "start": 259.64, "end": 263.04, "text": " representation into the next representation." }, { "start": 263.04, "end": 266.92, "text": " So this is what we're going to look at, the different variants." }, { "start": 266.92, "end": 270.68, "text": " We're not going to look at specifically how reinforcement learning is done" }, { "start": 270.68, "end": 274.76, "text": " because once you have an environment like this you can just plug it into a" }, { "start": 274.76, "end": 277.12, "text": " standard reinforcement learning algorithm" }, { "start": 277.12, "end": 280.52, "text": " and it will solve it for you. So" }, { "start": 280.52, "end": 284.56, "text": " that's the power of basically having standardized or" }, { "start": 284.56, "end": 289.28, "text": " representations. So the observation space" }, { "start": 289.28, "end": 292.56, "text": " of this problem is going to be pretty simple. All the games we're dealing with" }, { "start": 292.56, "end": 293.08, "text": " here" }, { "start": 293.08, "end": 296.4, "text": " are in this... Oh, I already did some drawings..." }, { "start": 296.4, "end": 299.88, "text": " are in this framework" }, { "start": 299.88, "end": 303.2, "text": " of this grid world game." }, { "start": 303.2, "end": 307.91999999999996, "text": " So you have this grid, this level is subdivided into this grid" }, { "start": 307.92, "end": 311.04, "text": " and that naturally corresponds of course to a 2D" }, { "start": 311.04, "end": 314.68, "text": " matrix. Now each point in this matrix has a number" }, { "start": 314.68, "end": 318.84000000000003, "text": " and the number describes what type of tile this tile is." }, { "start": 318.84000000000003, "end": 321.84000000000003, "text": " So as you can see right here, the 1 is going to be" }, { "start": 321.84000000000003, "end": 325.76, "text": " a wall while the 0 is going to be empty space." }, { "start": 325.76, "end": 329, "text": " 3 here is one of these crates" }, { "start": 329, "end": 334.08000000000004, "text": " and 2 is the player. So you get the point, right? Each number corresponds to a type" }, { "start": 334.08000000000004, "end": 337.84000000000003, "text": " of tile. So far so good." }, { "start": 337.84, "end": 340.91999999999996, "text": " That's the observation space. Now what is the" }, { "start": 340.91999999999996, "end": 344.4, "text": " action space? What is the agent can do?" }, { "start": 344.4, "end": 347.28, "text": " At each step they say the agent can change" }, { "start": 347.28, "end": 351.47999999999996, "text": " one of these tiles. So you can change one of these tiles," }, { "start": 351.47999999999996, "end": 355.79999999999995, "text": " let's say this one right here. You can change it to a different one or you can" }, { "start": 355.79999999999995, "end": 358.76, "text": " just leave it. So this is a wall right now and it makes the problem fairly" }, { "start": 358.76, "end": 360.79999999999995, "text": " interesting to have a wall right here" }, { "start": 360.79999999999995, "end": 365, "text": " in the middle. So since we're looking at this tile, we might just wanna" }, { "start": 365, "end": 368.92, "text": " leave this right there. We could also change it. We could actually change it" }, { "start": 368.92, "end": 369.76, "text": " such that" }, { "start": 369.76, "end": 372.72, "text": " to a 2, such that there is another player" }, { "start": 372.72, "end": 376.44, "text": " right here. Can I even draw this?" }, { "start": 376.44, "end": 380.52, "text": " This yellow isn't. Such that there is now two player" }, { "start": 380.52, "end": 384.04, "text": " tiles in the game. This would of course be an invalid level and" }, { "start": 384.04, "end": 387.28, "text": " the reinforcement learning agent ultimately should learn to produce" }, { "start": 387.28, "end": 390.88, "text": " valid and good levels." }, { "start": 390.88, "end": 395.04, "text": " So at each step you can change one tile and of course the goal is to make a" }, { "start": 395.04, "end": 396.92, "text": " better and better and better level" }, { "start": 396.92, "end": 401.08, "text": " over time. Now how do you choose which tile" }, { "start": 401.08, "end": 404.36, "text": " to change? That's a thing you have to define" }, { "start": 404.36, "end": 409.28, "text": " and they define three different ways in which the agent can choose" }, { "start": 409.28, "end": 413, "text": " which tile to change. In the narrow" }, { "start": 413, "end": 416.6, "text": " formulation they themselves, so the environment," }, { "start": 416.6, "end": 421.20000000000005, "text": " chooses the frame, the tile to change. So the environment will say" }, { "start": 421.20000000000005, "end": 425.8, "text": " now you can change this tile if you want. And in the next step it will say" }, { "start": 425.8, "end": 429.8, "text": " now you can change this one if you want. Now you can change this one if you want." }, { "start": 429.8, "end": 432.96000000000004, "text": " Now this is completely random" }, { "start": 432.96000000000004, "end": 436.32000000000005, "text": " how the environment chooses. Actually it doesn't have to be, but the environment chooses" }, { "start": 436.32000000000005, "end": 439.72, "text": " and that is problematic for the agent because" }, { "start": 439.72, "end": 444.20000000000005, "text": " the agent cannot kind of predict which tile it can change next" }, { "start": 444.2, "end": 447.32, "text": " and therefore it cannot really plan ahead" }, { "start": 447.32, "end": 451.88, "text": " how it wants to change the level. It can only make very very local very greedy" }, { "start": 451.88, "end": 452.64, "text": " choices." }, { "start": 452.64, "end": 456.84, "text": " It can be like oh I'm right here" }, { "start": 456.84, "end": 460.2, "text": " I might actually build a wall right here." }, { "start": 460.2, "end": 463.59999999999997, "text": " Yes that seems good." }, { "start": 463.59999999999997, "end": 468.56, "text": " An example is maybe you want to make the level more interesting." }, { "start": 468.56, "end": 471.84, "text": " Maybe you think that the crate up here" }, { "start": 471.84, "end": 475.56, "text": " is a bit close to this field here. You have to push it onto this field and" }, { "start": 475.56, "end": 477.2, "text": " that's fairly easy right?" }, { "start": 477.2, "end": 480.56, "text": " So you just push it like up and then to the left." }, { "start": 480.56, "end": 483.59999999999997, "text": " Actually it's not that easy because there's the wall right here and you have to go" }, { "start": 483.59999999999997, "end": 484.44, "text": " around." }, { "start": 484.44, "end": 488.71999999999997, "text": " Actually you probably have to push this down." }, { "start": 488.71999999999997, "end": 491.96, "text": " But let's say the level is too easy and you want to move the" }, { "start": 491.96, "end": 495.79999999999995, "text": " move the crate to a bit like let's say here." }, { "start": 495.79999999999995, "end": 499.79999999999995, "text": " In this framework where the environment tells you which" }, { "start": 499.8, "end": 503, "text": " tiles to change." }, { "start": 503, "end": 506.96000000000004, "text": " Once you come across this tile" }, { "start": 506.96000000000004, "end": 510.64, "text": " you can delete it. But then you have to wait" }, { "start": 510.64, "end": 514.52, "text": " and wait and wait and wait until" }, { "start": 514.52, "end": 518.24, "text": " at random this tile where you want to put it is selected." }, { "start": 518.24, "end": 522.04, "text": " This might actually never happen because the episode might be over" }, { "start": 522.04, "end": 525.12, "text": " and if it never happens you are in an invalid level." }, { "start": 525.12, "end": 532.12, "text": " So the agent here is basically forced to greedily make the level" }, { "start": 532.12, "end": 536.28, "text": " valid before it can make it interesting and then it can only make it interesting" }, { "start": 536.28, "end": 537.8, "text": " in sort of local ways." }, { "start": 537.8, "end": 540.96, "text": " So the second way that the" }, { "start": 540.96, "end": 545, "text": " second formulation here is the turtle formulation." }, { "start": 545, "end": 548.6, "text": " Now you might know this from the turtle graphics" }, { "start": 548.6, "end": 552.2, "text": " where basically you have this little" }, { "start": 552.2, "end": 555.84, "text": " turtle thing and you can always move it" }, { "start": 555.84, "end": 559.1600000000001, "text": " either like you know down, up, left or right" }, { "start": 559.1600000000001, "end": 563.6, "text": " and then you can always put a dot or not put a dot and thereby you can like" }, { "start": 563.6, "end": 566.88, "text": " trace out things." }, { "start": 566.88, "end": 570.4000000000001, "text": " This is like intro to programming. Same here." }, { "start": 570.4000000000001, "end": 573.9200000000001, "text": " So now the agent is given a starting square" }, { "start": 573.9200000000001, "end": 577, "text": " and it can choose to change it or not but it can also choose" }, { "start": 577, "end": 580, "text": " how to move to the next square. So to the right," }, { "start": 580, "end": 585.6, "text": " up, left or down. So it can choose. So you can go along and say okay now I'm here" }, { "start": 585.6, "end": 590, "text": " I want to change it to a 2, now I'm here, I want to change it to a 2," }, { "start": 590, "end": 594.4, "text": " now I'm here and so on. So it can basically" }, { "start": 594.4, "end": 598.04, "text": " do things like build long walls and things like this" }, { "start": 598.04, "end": 601.48, "text": " so it can plan ahead more considerably." }, { "start": 601.48, "end": 604.56, "text": " But still if you regard the problem from before" }, { "start": 604.56, "end": 608.12, "text": " if it wants to place the crate to a different" }, { "start": 608.12, "end": 611.84, "text": " location it can, like if maybe it's here" }, { "start": 611.84, "end": 615.96, "text": " okay the agent is here and then it can say okay I wanna" }, { "start": 615.96, "end": 619.8, "text": " not change but move, not change and move, not change move and then it can delete" }, { "start": 619.8, "end": 622.84, "text": " and then it has to move over here step by step" }, { "start": 622.84, "end": 627.92, "text": " until it can place it again. So it can plan ahead considerably" }, { "start": 627.92, "end": 632.04, "text": " longer actually it can just move straight over because the agent itself is not" }, { "start": 632.04, "end": 633.44, "text": " constrained by walls." }, { "start": 633.44, "end": 636.84, "text": " So it can move ahead quite a bit" }, { "start": 636.84, "end": 641.4, "text": " but it's still kind of localized changes because it can move one tile at a time" }, { "start": 641.4, "end": 644.52, "text": " right and if in between the episode ends" }, { "start": 644.52, "end": 650.08, "text": " it's again an invalid level. So the third formulation is the most powerful" }, { "start": 650.08, "end": 650.9200000000001, "text": " formulation." }, { "start": 650.9200000000001, "end": 654.9200000000001, "text": " It's called the wide formulation and this is where the agent at each" }, { "start": 654.9200000000001, "end": 659.4, "text": " time step cannot only choose how to change the tile but can freely choose the" }, { "start": 659.4, "end": 660.76, "text": " next tile to change." }, { "start": 660.76, "end": 664.4000000000001, "text": " So it could say in one step" }, { "start": 664.4, "end": 667.92, "text": " it could say I want to delete this tile" }, { "start": 667.92, "end": 671.84, "text": " and then in the next step it could say I want to place it right here." }, { "start": 671.84, "end": 676.24, "text": " So this is, so it can plan ahead considerably." }, { "start": 676.24, "end": 679.92, "text": " So how you design the action space is very important" }, { "start": 679.92, "end": 685.12, "text": " for how your agent, for what your agent can possibly learn" }, { "start": 685.12, "end": 688.84, "text": " and how easy it is for the agent to learn because it's gonna be pretty easy" }, { "start": 688.84, "end": 691.96, "text": " for this agent to learn to move crates like this" }, { "start": 691.96, "end": 697.08, "text": " where even though the other agent that moves one tile at a time can also do it" }, { "start": 697.08, "end": 700.96, "text": " it has to plan ahead for longer so it has to sort of invest more" }, { "start": 700.96, "end": 706.76, "text": " of the reinforcement learning power into doing these sorts of things." }, { "start": 706.76, "end": 709.88, "text": " But of course it's being more constrained also means" }, { "start": 709.88, "end": 713.12, "text": " you have less actions at your disposal." }, { "start": 713.12, "end": 716.5600000000001, "text": " Like this last agent it has a lot of actions it can do. It can choose" }, { "start": 716.5600000000001, "end": 720.48, "text": " any tile at once right so that can also introduce considerable" }, { "start": 720.48, "end": 723.64, "text": " exploration dilemma and" }, { "start": 723.64, "end": 728.04, "text": " you have to trade these things off when you design things like that." }, { "start": 728.04, "end": 731.16, "text": " Alright so this is the action space. Now how" }, { "start": 731.16, "end": 735.5600000000001, "text": " the observation evolves into the next observation should be" }, { "start": 735.5600000000001, "end": 739.48, "text": " fairly clear. I mean that's already given by the action space. If you ask yourself" }, { "start": 739.48, "end": 742.72, "text": " if you're in this situation right here" }, { "start": 742.72, "end": 746.6, "text": " and the agent deletes the crate" }, { "start": 746.6, "end": 751.48, "text": " then the crate is no longer there. So if it changes this to a zero" }, { "start": 751.48, "end": 754.8000000000001, "text": " then it's just empty space now." }, { "start": 754.8000000000001, "end": 758.5600000000001, "text": " So that's fairly obvious here. Now the last thing we need to do is the" }, { "start": 758.5600000000001, "end": 760.8000000000001, "text": " reward calculation." }, { "start": 760.8000000000001, "end": 763.76, "text": " What reward do you give the agent?" }, { "start": 763.76, "end": 766.76, "text": " Here you can give the agent the reward either" }, { "start": 766.76, "end": 769.88, "text": " let's say at the very end. You cannot give it a reward" }, { "start": 769.88, "end": 772.96, "text": " for the entire episode and give it a reward at the very end." }, { "start": 772.96, "end": 777.4000000000001, "text": " Reinforcement learning algorithms are able to deal with this to a certain" }, { "start": 777.4000000000001, "end": 778.2, "text": " degree." }, { "start": 778.2, "end": 782.36, "text": " You can also decide to give it at each step." }, { "start": 782.36, "end": 786.24, "text": " Now the way they do it here I believe is they give it at the end" }, { "start": 786.24, "end": 790.72, "text": " and they have multiple components to the reward." }, { "start": 790.72, "end": 794.2, "text": " So the reward in this case is how well" }, { "start": 794.2, "end": 798.84, "text": " the level fulfills certain goals that the programmer sets." }, { "start": 798.84, "end": 803.72, "text": " So the goals in Sobocon are basically the rules of the game" }, { "start": 803.72, "end": 807.2, "text": " and that means there is only one player." }, { "start": 807.2, "end": 811.96, "text": " If there are two or none then the reward is less." }, { "start": 811.96, "end": 817.52, "text": " There are at least one crate and there are as many crates as green fields." }, { "start": 817.52, "end": 821.64, "text": " So here you can see there are only two crates but three green fields so the" }, { "start": 821.64, "end": 823.1600000000001, "text": " agent will get a penalty" }, { "start": 823.1600000000001, "end": 826.88, "text": " for producing a level like this. And then the last thing is" }, { "start": 826.88, "end": 830.2, "text": " the level has to be solvable. And for" }, { "start": 830.2, "end": 834.4399999999999, "text": " checking solvability the" }, { "start": 834.4399999999999, "end": 837.72, "text": " authors of this paper simply employ a Sobocon solver." }, { "start": 837.72, "end": 842.2, "text": " They have a Sobocon solver that is like a tree search algorithm" }, { "start": 842.2, "end": 845.4399999999999, "text": " that tries to solve the level. If it can't solve the level" }, { "start": 845.4399999999999, "end": 848.72, "text": " then the level is invalid and the agent gets a" }, { "start": 848.72, "end": 851.96, "text": " worse reward than whenever the level" }, { "start": 851.96, "end": 856, "text": " is solvable. So how you design the reward" }, { "start": 856, "end": 859.2, "text": " is also very important. If you only give" }, { "start": 859.2, "end": 863.76, "text": " a one reward when all the goals are fulfilled and give a zero reward as soon" }, { "start": 863.76, "end": 868.08, "text": " as one of the goals is not fulfilled, a reinforcement learning agent is going to" }, { "start": 868.08, "end": 869.32, "text": " have a very very much" }, { "start": 869.32, "end": 873.32, "text": " difficult time to learn that. So you have to kind of design the reward" }, { "start": 873.32, "end": 877.04, "text": " so you help the agent realize what's important. So maybe" }, { "start": 877.04, "end": 880.68, "text": " if there's only one crate missing but you know in fact the level is" }, { "start": 880.68, "end": 883.72, "text": " solvable, except for that" }, { "start": 883.72, "end": 886.76, "text": " maybe one green field is going to be empty," }, { "start": 886.76, "end": 890.6, "text": " then you could still give a fairly high reward but you could just give a higher" }, { "start": 890.6, "end": 891.24, "text": " reward" }, { "start": 891.24, "end": 895.84, "text": " when the level is actually solvable. Or all the rules are fulfilled" }, { "start": 895.84, "end": 899.6, "text": " and there is a crate here. The other thing" }, { "start": 899.6, "end": 902.9200000000001, "text": " to notice here is that in this case you actually do need" }, { "start": 902.9200000000001, "end": 906.24, "text": " a solver for the level since it's a puzzle game." }, { "start": 906.24, "end": 911.0400000000001, "text": " That means your agent is only going to produce levels that are" }, { "start": 911.04, "end": 914.76, "text": " as difficult as your solver can solve. So that's going to be" }, { "start": 914.76, "end": 918.56, "text": " a considerable problem. But that's a limitation" }, { "start": 918.56, "end": 921.8, "text": " here. But all of their rewards are hard-coded" }, { "start": 921.8, "end": 925.4399999999999, "text": " so to say. So the reward is given by the environment." }, { "start": 925.4399999999999, "end": 929.0799999999999, "text": " So now that we have observations" }, { "start": 929.0799999999999, "end": 932.8, "text": " which are these matrices right here, we have actions which" }, { "start": 932.8, "end": 936.4399999999999, "text": " and we actually have three different ways of formulating actions and we have" }, { "start": 936.4399999999999, "end": 937.12, "text": " reward," }, { "start": 937.12, "end": 942, "text": " they can simply plug this into a standard reinforcement learning algorithm." }, { "start": 942, "end": 945.48, "text": " Now they have one last thing that they have which is this" }, { "start": 945.48, "end": 949.52, "text": " change percentage parameter. So what they say is they give" }, { "start": 949.52, "end": 955.2, "text": " the agent an initial state and then the agent is allowed to change it around" }, { "start": 955.2, "end": 958.16, "text": " like here. So on the left you have this initial" }, { "start": 958.16, "end": 962.76, "text": " state. This is sort of a random initial state and you allow the agent now to" }, { "start": 962.76, "end": 966.32, "text": " change it in this stepwise fashion and you always update the agent." }, { "start": 966.32, "end": 970.84, "text": " By the way, the agent, as you might imagine, the agent takes this matrix" }, { "start": 970.84, "end": 975.72, "text": " right here and puts it, shoves it through like a few convolutional layers and then" }, { "start": 975.72, "end": 977.1600000000001, "text": " decides on an action." }, { "start": 977.1600000000001, "end": 982.6, "text": " I'm almost forgetting that this is so obvious by now that" }, { "start": 982.6, "end": 987, "text": " the agent is like a standard deep learning" }, { "start": 987, "end": 991.12, "text": " taking in a 2D, doing some convolutions and then having" }, { "start": 991.12, "end": 994.84, "text": " like a policy output." }, { "start": 994.84, "end": 999, "text": " So you shove this into a proximal policy optimization algorithm" }, { "start": 999, "end": 1001.76, "text": " which is a standard reinforcement learning algorithm and you allow to" }, { "start": 1001.76, "end": 1004.88, "text": " change these things. Now what they do is they" }, { "start": 1004.88, "end": 1009.9200000000001, "text": " only allow the agent to change the levels by so much because what they say is" }, { "start": 1009.9200000000001, "end": 1013.32, "text": " if we start out from these different states" }, { "start": 1013.32, "end": 1016.32, "text": " we would, you can decide on two things." }, { "start": 1016.32, "end": 1019.96, "text": " Either you can train the agent to find you the best" }, { "start": 1019.96, "end": 1023.0400000000001, "text": " possible level ever, right? But then" }, { "start": 1023.04, "end": 1026.3999999999999, "text": " it would sort of ignore the starting state. It would just learn which level" }, { "start": 1026.3999999999999, "end": 1028.44, "text": " gives me the highest reward" }, { "start": 1028.44, "end": 1031.72, "text": " and it would just change all the tiles always to that." }, { "start": 1031.72, "end": 1037.48, "text": " It would just try to change the, to always reach that best possible state" }, { "start": 1037.48, "end": 1040.68, "text": " and forget the start state. So they say, okay," }, { "start": 1040.68, "end": 1044.12, "text": " the last constraint is the agent can only change" }, { "start": 1044.12, "end": 1047.24, "text": " like 20 percent of the tiles at most" }, { "start": 1047.24, "end": 1051.1599999999999, "text": " and after that we end the episode or we just don't allow the agent to" }, { "start": 1051.16, "end": 1053.24, "text": " change anything anymore." }, { "start": 1053.24, "end": 1057.76, "text": " It needs to first, so if it changed this here to empty space and" }, { "start": 1057.76, "end": 1061.28, "text": " wants to change something else, first needs to change this back and then it can" }, { "start": 1061.28, "end": 1062.68, "text": " change something else." }, { "start": 1062.68, "end": 1066.48, "text": " So you can do that. So this constrains the agent and kind of teaches it" }, { "start": 1066.48, "end": 1071.3600000000001, "text": " that in order to get a higher reward it must sort of adjust the starting state" }, { "start": 1071.3600000000001, "end": 1074.4, "text": " to something that gets higher reward." }, { "start": 1074.4, "end": 1077.92, "text": " And that's one way of making the" }, { "start": 1077.92, "end": 1082.3200000000002, "text": " the levels that you generate more diverse. It's sort of a unique problem" }, { "start": 1082.3200000000002, "end": 1086.72, "text": " to this particular kind of reinforcement learning problem because" }, { "start": 1086.72, "end": 1092.44, "text": " sometimes, like most of the time, you just want to find the highest reward, whatever." }, { "start": 1092.44, "end": 1096.72, "text": " But here you also want to maximize diversity of the levels you" }, { "start": 1096.72, "end": 1098.48, "text": " generate and therefore you could" }, { "start": 1098.48, "end": 1102.1200000000001, "text": " say that's a pretty good, you know, that's a pretty good constraint" }, { "start": 1102.1200000000001, "end": 1107.48, "text": " to put into that. So that's a thing I like here about this paper." }, { "start": 1107.48, "end": 1113.28, "text": " This change percentage constraint. Now at inference time you can change that." }, { "start": 1113.28, "end": 1117.52, "text": " So at training time you only change, whatever, 20 percent. But at inference time" }, { "start": 1117.52, "end": 1121.16, "text": " you can technically let the agent run for longer. As you can see, I think here" }, { "start": 1121.16, "end": 1125.68, "text": " they just let it run until it, you know, finds something good, like this one right" }, { "start": 1125.68, "end": 1129.88, "text": " here. Fairly good from the starting state. And you can see it sort of still" }, { "start": 1129.88, "end": 1135.52, "text": " adjusts to the starting state right here. So you can see that this it connects the" }, { "start": 1135.52, "end": 1142.04, "text": " the two dots on the top. So the goal is to make the longest possible maze or a" }, { "start": 1142.04, "end": 1147.08, "text": " long maze. So it connects these two. You can see here also this one connects them." }, { "start": 1147.08, "end": 1155.08, "text": " And then it goes out here and connects to this one. So it's fairly good at" }, { "start": 1155.08, "end": 1159.6399999999999, "text": " relying on this starting state. You can see that these turtle and wide" }, { "start": 1159.6399999999999, "end": 1163.08, "text": " representations that can actually choose where to go and where to change" }, { "start": 1163.08, "end": 1169.1599999999999, "text": " something are considerably or, you know, more powerful than this narrow thing." }, { "start": 1169.1599999999999, "end": 1175.3999999999999, "text": " Especially if you look at this level right here. Which again is the importance" }, { "start": 1175.3999999999999, "end": 1181.96, "text": " of designing the action space. Well, it is going to directly affect the outcome" }, { "start": 1181.96, "end": 1188.1599999999999, "text": " that you're going to have. Alright, and you see the same thing here for this" }, { "start": 1188.16, "end": 1193.8400000000001, "text": " Zelda game. Now here you can see the starting state often involves, let's say," }, { "start": 1193.8400000000001, "end": 1198.48, "text": " here you have two players and you have three keys and that's an invalid" }, { "start": 1198.48, "end": 1203.3600000000001, "text": " starting state. And sometimes the door cannot be reached. Sometimes the" }, { "start": 1203.3600000000001, "end": 1207.1200000000001, "text": " door is actually not even there, like here. And you can see that the agent, all" }, { "start": 1207.1200000000001, "end": 1212.16, "text": " of the agents, sort of learn to make at least valid levels where you have the" }, { "start": 1212.16, "end": 1219.96, "text": " player and the door and the key right here being able to reach everything." }, { "start": 1219.96, "end": 1224.92, "text": " So that's, you know, fairly cool because counting is one of these things" }, { "start": 1224.92, "end": 1229.44, "text": " that the neural networks aren't necessarily super good at. So it's nice" }, { "start": 1229.44, "end": 1236.6000000000001, "text": " to see that, you know, they can... Here they have two players and they" }, { "start": 1236.6000000000001, "end": 1241.52, "text": " they're deleting one of them. Here they have three crates and they actually make" }, { "start": 1241.52, "end": 1249.8799999999999, "text": " it such that the number of crates and the number of green tiles agree. So, you" }, { "start": 1249.8799999999999, "end": 1254.24, "text": " know, that's fairly cool that this comes out. And here you can see the" }, { "start": 1254.24, "end": 1260.04, "text": " different power of the algorithms. So in this binary problem, and this is the" }, { "start": 1260.04, "end": 1265, "text": " Zelda problem, this is Sobhakan problem, you can see that as you allow the agent" }, { "start": 1265, "end": 1270.24, "text": " at inference time to change more and more of the level, the percentage of" }, { "start": 1270.24, "end": 1277.24, "text": " levels where the agent gets a good level, like succeeds in building a" }, { "start": 1277.24, "end": 1282.52, "text": " valid level, goes up and up. And now this, as I already said, this narrow" }, { "start": 1282.52, "end": 1286.88, "text": " representation here appears to be a bit less powerful than the others." }, { "start": 1286.88, "end": 1293.04, "text": " Interestingly, in Sobhakan, the best one is this turtle representation where you" }, { "start": 1293.04, "end": 1297.08, "text": " can only change one tile at a time and not the more powerful wide" }, { "start": 1297.08, "end": 1302.12, "text": " representation. That's probably because, I'm going to guess that's because the" }, { "start": 1302.12, "end": 1306.4399999999998, "text": " either the reinforcement learning algorithm isn't, you know, powerful" }, { "start": 1306.4399999999998, "end": 1313.76, "text": " enough or their representation, like the CNN is maybe mis-architectured a bit." }, { "start": 1313.76, "end": 1318.84, "text": " You know, technically this representation should be able to achieve higher" }, { "start": 1318.84, "end": 1325.72, "text": " scores, but not as easily because, as I said, the action space is so much higher." }, { "start": 1325.72, "end": 1332.32, "text": " So it's more difficult to learn, but ultimately, it should learn it better." }, { "start": 1332.32, "end": 1340.3600000000001, "text": " Alright, so this is, this was this paper. It's, I think it's fairly cool and fairly" }, { "start": 1340.3600000000001, "end": 1344.8, "text": " fun to view it from this particular perspective. And they discuss that the" }, { "start": 1344.8, "end": 1350.3600000000001, "text": " future could be that humans solve this together, because usually when you have" }, { "start": 1350.3600000000001, "end": 1354.48, "text": " assisted level design, you would have something, some sort of like an optimizer" }, { "start": 1354.48, "end": 1358.72, "text": " running to optimize the level you're working on directly. Like you'd say, okay," }, { "start": 1358.72, "end": 1363.24, "text": " make something here and it would sort of run for a while and that takes, you know," }, { "start": 1363.24, "end": 1368.96, "text": " takes time. Now this here, this agent at inference time is very, very fast. So it" }, { "start": 1368.96, "end": 1374.16, "text": " can, you know, work together with humans. So the human would say, for example, oh" }, { "start": 1374.16, "end": 1377.96, "text": " here, please make a wall right here, because that's gonna make the level more" }, { "start": 1377.96, "end": 1381.04, "text": " interesting, but make it such that the level is still, you know, interesting and" }, { "start": 1381.04, "end": 1385.6399999999999, "text": " solvable. And then the agent can, you know, go across, do some things that's" }, { "start": 1385.6399999999999, "end": 1391.2, "text": " gonna be super fast. And agents and humans could work together at this. Now" }, { "start": 1391.2, "end": 1398.1599999999999, "text": " one drawback, of course, is that in a puzzle game like SoboCon, you know, you" }, { "start": 1398.1599999999999, "end": 1402.3999999999999, "text": " have to make sure the level is solvable. And here, luckily, you can employ a" }, { "start": 1402.3999999999999, "end": 1409.52, "text": " solver, but as the puzzles get more difficult, that's not super, like" }, { "start": 1409.52, "end": 1413.08, "text": " that's not going to be the case that much. And also they remark that most of" }, { "start": 1413.08, "end": 1417.12, "text": " the levels generated are fairly easy, because their reward only depends on" }, { "start": 1417.12, "end": 1423.24, "text": " whether or not the level is solvable by an easy solver, right? So you could give" }, { "start": 1423.24, "end": 1427.7, "text": " some reward for how difficult the level is, but then again, that depends on your" }, { "start": 1427.7, "end": 1433.84, "text": " solver. So an interesting next step would be to evolve these or to train these as" }, { "start": 1433.84, "end": 1439.36, "text": " you train reinforcement learning agents to solve these kinds of games. So kind" }, { "start": 1439.36, "end": 1444.76, "text": " of do a curriculum learning, sort of a GAN setting between level generator and" }, { "start": 1444.76, "end": 1450.3999999999999, "text": " reinforcement learning algorithm, like reinforcement learning game player to" }, { "start": 1450.3999999999999, "end": 1456.6, "text": " sort of evolve levels and agents at the same time. I think it's sort of like" }, { "start": 1456.6, "end": 1461.8, "text": " these poet approaches, except you would directly learn. I think that would be a" }, { "start": 1461.8, "end": 1467.9199999999998, "text": " nice direction for this work. In any case, the code is available. You can even" }, { "start": 1467.92, "end": 1473.8000000000002, "text": " plug in your own games and make your own levels, so check this out. And with that," }, { "start": 1473.8, "end": 1502.28, "text": " I'll see you next time. Bye bye." } ]
WVPE62Gk3EM
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Big Bird: Transformers for Longer Sequences (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "google", "google research", "bigbird", "big bird", "bert", "attention", "attention is all you need", "longformer", "random attention", "quadratic attention", "attention mechanism", "qa", "natural questions", "hotpot qa", "genomics", "nlp", "natural language processing", "transformer", "transformers", "fully connected", "sparse attention", "graph", "star graph", "turing complete", "universal approximation", "window attention", "convolution" ]
#ai #nlp #attention The quadratic resource requirements of the attention mechanism are the main roadblock in scaling up transformers to long sequences. This paper replaces the full quadratic attention mechanism by a combination of random attention, window attention, and global attention. Not only does this allow the processing of longer sequences, translating to state-of-the-art experimental results, but also the paper shows that BigBird comes with theoretical guarantees of universal approximation and turing completeness. OUTLINE: 0:00 - Intro & Overview 1:50 - Quadratic Memory in Full Attention 4:55 - Architecture Overview 6:35 - Random Attention 10:10 - Window Attention 13:45 - Global Attention 15:40 - Architecture Summary 17:10 - Theoretical Result 22:00 - Experimental Parameters 25:35 - Structured Block Computations 29:30 - Recap 31:50 - Experimental Results 34:05 - Conclusion Paper: https://arxiv.org/abs/2007.14062 My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM My Video on Longformer: https://youtu.be/_8KNb5iqblE ... and its memory requirements: https://youtu.be/gJR28onlqzs Abstract: Transformers-based models, such as BERT, have been one of the most successful deep learning models for NLP. Unfortunately, one of their core limitations is the quadratic dependency (mainly in terms of memory) on the sequence length due to their full attention mechanism. To remedy this, we propose, BigBird, a sparse attention mechanism that reduces this quadratic dependency to linear. We show that BigBird is a universal approximator of sequence functions and is Turing complete, thereby preserving these properties of the quadratic, full attention model. Along the way, our theoretical analysis reveals some of the benefits of having O(1) global tokens (such as CLS), that attend to the entire sequence as part of the sparse attention mechanism. The proposed sparse attention can handle sequences of length up to 8x of what was previously possible using similar hardware. As a consequence of the capability to handle longer context, BigBird drastically improves performance on various NLP tasks such as question answering and summarization. We also propose novel applications to genomics data. Authors: Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at Big Bird Transformers for Longer Sequences by Manil Zahir and Gurugar Uganesh et al. of Google Research. So this paper on a high level proposes to replace the quadratic attention mechanism in transformers by a mix of random attention, windowed attention, and selective global attention, therefore achieving a complexity of linear memory requirement instead of quadratic memory requirement. And as a result of that, they can process longer sequences than traditional transformers like BERT and achieve better results in some NLP tasks, and they also evaluate on genomics tasks. So we'll go through this paper a bit, look a bit at the proof because they give a theoretical kind of guarantee that their random attention mechanism can still be Turing complete and 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 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 premise right here is that the transformers, they've been pretty impactful, especially in NLP. So they say transformer based models such as BERT have been one of the most successful deep learning models for NLP. Unfortunately, one of their core limitations is the quadratic dependency, mainly in terms of memory, on the sequence length due to their full attention mechanism. So really briefly, the full attention mechanism, and I've done numerous videos about attention mechanism BERT, attention is all you need, and so on. So if you want a detailed explanation of what that is, just go look up the corresponding videos. But briefly, what you'll have in NLP is a set of tokens, a sequence of tokens as an input, and you want to transform them layer after layer into sort of a higher order representation of that same sequence. And for that, you build these layers out of nodes and you have as many nodes usually as you have tokens in the sequence. And the next set of, so each token is represented by a vector at the beginning, and each layer transforms the sequence, as I said, into sort of a higher level representation. So you want the vector of this token right here to be a better representation than the vector was right here. And you do that by incorporating information from all the other tokens into that particular vector. Now, as I said, this is called an attention mechanism, and we don't actually have to go into how it works right here, but you can see pretty clearly that if you want to do this for every token, you need to have information routed from every token to every token, like from here to here, from here to here, and so on. And this is just one token, and then you need to do it for this token and for this token and for this token. So what you'll ultimately get, if n is your sequence length, you'll get some n squared amount of computation and memory requirements for this. So this is a problem. And usually, this means that, you know, this sequence length in BERT, this is limited to something like 512 tokens, which is okay for some applications. But if you want to summarize, you know, entire articles, entire books, even, or do question answering with lots of context, it's not really enough. So people have been thinking about how to scale this input, how to scale this. And of course, the main culprit is this quadratic attention mechanism, because if you, you know, scale 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 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, will continue the naming here after Elmo and BERT. You know, I'm waiting for the model that's the count. Yeah, that's going to be a fun model. So Big Bird basically has three different types of attention. And here, these are adjacency matrices in this attention mechanism. So here is the input layer, and the output layer is right here. So that basically means that node i right here would be connected. Sorry, that's not a straight line, would be connected to this particular node and also to this particular node. So we're now trying, if we have node i right here, we're now trying to not connect it to all of these nodes, but we'll say, we'll just select some at random and then connect it to that. Okay, this is what we call random attention. And you can pretty clearly see if you connect each of the i nodes to r equals 2, to two random nodes, then you don't have an n squared anymore. But you'll have 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 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 you would have to do that in the next layer. So this formulation as a random graph leads me to believe that layer after layer, the random attention pattern is going to be the same. But also the formulation of the paper leads me to believe that the this random attention differs from sequence to sequence. So I believe what's happening is that they get a new sequence, then they decide on this pattern right here once and then they use this layer after layer, the same pattern again. So you can see that in the traditional attention, information can basically flow from each of the nodes to each other node in one single step, right? Because each node is connected to each other node. You see this in the graph right here. However, if we only select a subset, then you know, it needs to if I want to go from, as I said, from here to here, then I need to do it in two steps. And therefore I need two layers. And that's going to be the culprit of this method here. And 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, 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 i of position is going to attend to itself, of course. So here is i, but it is also going to attend to its neighbors. So here is i minus one and here is i plus one. And this is a you know, this is a window size w that you can that is a parameter, but also it is a constant and therefore you again go from n squared to w times n, which you know is o of n if w is a constant. And this might be familiar to you, because we've already seen this in the long former paper. We 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 also might recognize this from a convolution operation. This basically because it is a convolution operation, right in a convolution, each node 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, 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 fixed by the developers that are so important that they are connected to everything else. So for example, in these transformers, you often have what's 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 right here to this node and receive information from this node. So now, as a result of this, as you may be able to see, 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 send information to this global node and then the global node in the next step can send information to whatever other node. And that is a property that they use in their proof that this attention mechanism is as sort of as powerful as the classic 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. 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 as an engineer, as an NLP engineer, that makes kind of total sense. 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 more attention, better. And I also am completely willing to believe that 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 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, OK, 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 than with a full graph. A full graph is where every node is connected to every other node. But as I already said, what they need for this is multiple layers of this star graph. So and that has to do with the fact that if I want to route information, I basically have to go via this middle node right here. And there is an additional complication because this middle node in our case right here is only one node. I can't route information at the same like I can't have this routing right here at the same time that I have this routing right here, like going from here to here, because I only have one middle node. And I kind of this is not how that like this is very dumb math. But maybe you have to imagine that there is one memory slot. And you can only use that one memory slot at the same time for one of these things. So essentially, what you'll have to do is you'll have to do the green thing first. And then in the next step, you'll have to do the blue thing second. And then so these are now pairwise routing between nodes. But ultimately, what an attention mechanism does is it does everything to everything right in a single layer, it routes information from all the nodes to all the other nodes. And to achieve that, so you need multiple rounds of this. And it turns out that in the worst case, you actually need n rounds of this. So you know, you trade off your you go from n squared to n memory and compute requirements in a single layer. But in the worst case, you need n layers to recover the power of the full of the full transformer. And that is the last one of their theoretical results right here. So first, they prove universal approximations. And second, they prove Turing completeness. These two properties have been proven for full attention mechanisms. And third, they prove that there are tasks where 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 I have like a cool sorting algorithm, right? So if this is my sequence that I want to sort, what I can do is I can simply, you know, take a random subset of them, like this, this and this and then kind of go and sort them and then put them like I 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 the single step is just O of n. So I have now an O of n sorting algorithm. I you know, I have my sort of a bit of worry 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 said this in the long former video. So in the long form of video, it turned out that if you look at how big these window attention is, it turns out that it you're still well, you know, the original BERT attended to 512 tokens. And then you look at the window and the window was still 512 tokens. It's just that the global attention was even more so ultimately they ended up using more memory than the original BERT. And here, if I look at the parameters of their thing, and they have multiple experiments right here, and I believe this is the 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, actually calculated this before. So this is 512 tokens. So you know, you you go from from BERT that has 512 tokens and attends to 512 tokens to also attending to 512 tokens. Of course, the advantage here is that they now have 4096 sequence length. So they have the freedom to not attend to as many tokens as they have in the input length. But you know, to put it in perspective, this here uses more memory and more compute on on its face than BERT, because BERT attends to as many tokens but has a smaller input sequence. And you know, I, there's sort of a thing where in order to make these sparse attention things work, you have to go pretty, pretty, you know, high in the number of things you attend to, you can leave away some but it's not like you can scale up orders of magnitude of your input sequence length. So that's the this promise of linear attention is sort of it's kind of fulfilled but not there yet. The second thing I would like to point out is that in a lot of cases, the number of random tokens is actually set to zero. So really making use, I believe, of these of the of the global of the number of global tokens. So it that seems a bit strange in that they continuously refer to their random attention mechanism. But then in a lot of experiments, they don't actually have a random attention mechanism. I believe they have to do that because that's kind of what makes them different from the long former in principle, but still, yeah. So the last novelty, let's say is an engineering novelty in that they now always consider not single, for example, they don't consider single random attention, they always consider these in blocks. And that's because our current hardware is really bad at sparse stuff. Really bad at single indexing, gathering single things. So if you can do everything in blocks, you basically get you get these blocks almost for free. So it takes only marginally longer to retrieve this full two by two block right here than it would to retrieve the single instance right here. Of course, that means you have, you know, four times you still use four times more memory, but it is not four times slower than the original thing. So you can use these blocks right here. You can do it for the random attention, you can do it for the window attention, as you can see here. So you break this window pattern a little bit into blocks. And that makes it a lot faster. So that speeds up, get the speed up almost for free. And then they make another approximation in that the way they do this windowing is, and I just go really briefly. So you can see right here that it would be very cumbersome to gather. So what we need, we're just going to focus this this dotted thing right here is a bit confusing. So you want to attend to these things. And these you can just get out with a matrix slice really easy. But then you want to attend to this kind of blocky thing right here from the window attention, right, like this thing. And this is hard to get out because you'd have to kind of index each row individually. And that's very slow. So what they do, there is this matrix 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, it's up and down. But in essence, that's what you do. And you can you can fold all of this blue stuff into a rectangular matrix. If you know if you can see right here. So you kind of roll this back, roll this back, roll this forward, and you replace whatever is missing by these. Now this again gives you some inaccuracies because this block right here was never intended to be attended to. And all of a sudden you see you have the K6 in here. So it gives you a bit of inaccuracies at the edges of the sequence. But you can take that, you know, you can take that hit for the increased performance that you gain by now having a rectangular matrix. TPUs are really efficient at this, not as efficient at this. And then the only thing that's really slow is gathering these random blocks right here. But also by having the same amount of random blocks per input token, what you'll do is you'll end up with just one of these columns right here, or you know, 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 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, you know, considering the attention mechanism goes over multiple layers. So we don't need a routing from each token to each token, we can make up for not having a fully connected graph by simply running multiple layers. So their sparsity is first of all, you have this random attention, which I believe changes from sequence to sequence, but stays within or among the layers of the same sequence. Then you have the window attention with the reasoning. So the reasoning behind the random attention is that if you have a randomly connected graph, the path lengths are on average logarithmic. So you can route information efficiently. The reasoning behind the window attention is that probably neighbor information is very important and that has been shown empirically. And then the global attention, the reasoning behind this is that some of the tokens that are fixed by the developers are so important that it's very beneficial that each other node is connected to them and that they are connected to each other node. The result of that is the Big Bird attention mechanism, which is basically long former, which already had these two plus the random attention. This achieves a linear complexity in terms of memory and compute, though linear has to be qualified a bit because it's modified by the window size, by the number of random attention tokens, by the number of global tokens, and in practice often ends up being 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 in the worst case would result right back into a quadratic requirement for memory and compute. They do some engineering, some engineering tricks right here, and their results are pretty good. So the results in various tasks and we'll, we'll look at some of the tasks right here. So these are def set results using base size models. For example, where you can see they do outperform basic Roberta models, they outperform long former, which may mean that the random attention is useful, but you know, in these things, it's also always may just mean that you've thrown more compute at it. At least I'm not really looking that they outperform the models because as you can see right here, if they compare to state of the art and you know, granted, these are models that have been trained specifically for these tasks and are crafted and engineered and Big Bird manages to Big Bird manages to hold itself against them in a lot of tasks and even get state of the art on some. What I'm more interested in is that it, you know, it can reach good numbers. It doesn't necessarily have to be state of the art, but it can reach good numbers, which tells me that, okay, probably the, the empirical hit that I take by not having the full attention is, you know, is justifiable by the speed up and memory savings I do get. Yeah, especially when result, when you see results mixed like this, you know, sometimes the other model is good and sometimes the Big Bird is good on different variations and so on. I would not, you know, I would not make a big deal out of the fact that it is state of the art. I get that the authors have to do that. I would do so as well, but you know, you don't, don't think that this is the, like the best thing now. It's very probable. They just thrown also a lot of compute at it. What is cool is they do some genomics experiments. So not only do they have NLP state of the art, but also they go into genomics and experiment with data there. I don't want to go into that because ultimately it's another task and I believe the paper is 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, "end": 6.88, "text": " Hi there, today we'll look at Big Bird Transformers for Longer Sequences by Manil Zahir and Gurugar" }, { "start": 6.88, "end": 9.84, "text": " Uganesh et al. of Google Research." }, { "start": 9.84, "end": 14.5, "text": " So this paper on a high level proposes to replace the quadratic attention mechanism" }, { "start": 14.5, "end": 23.32, "text": " in transformers by a mix of random attention, windowed attention, and selective global attention," }, { "start": 23.32, "end": 29.54, "text": " therefore achieving a complexity of linear memory requirement instead of quadratic memory" }, { "start": 29.54, "end": 31.2, "text": " requirement." }, { "start": 31.2, "end": 36.2, "text": " And as a result of that, they can process longer sequences than traditional transformers" }, { "start": 36.2, "end": 43.04, "text": " like BERT and achieve better results in some NLP tasks, and they also evaluate on genomics" }, { "start": 43.04, "end": 44.04, "text": " tasks." }, { "start": 44.04, "end": 49.46, "text": " So we'll go through this paper a bit, look a bit at the proof because they give a theoretical" }, { "start": 49.46, "end": 57.24, "text": " kind of guarantee that their random attention mechanism can still be Turing complete and" }, { "start": 57.24, "end": 63.28, "text": " can still achieve the same things as a full attention mechanism, but we'll also look at" }, { "start": 63.28, "end": 64.28, "text": " the drawbacks." }, { "start": 64.28, "end": 70.24000000000001, "text": " I sort of have mixed feelings about this paper, and I think I'll voice my concerns as we go" }, { "start": 70.24000000000001, "end": 71.24000000000001, "text": " through here." }, { "start": 71.24000000000001, "end": 75.6, "text": " But first, let's look at the paper, let's look at the architecture, and I think this" }, { "start": 75.6, "end": 82.28, "text": " is actually a pretty cool paper for the empirical progression of the field to process longer" }, { "start": 82.28, "end": 85.08, "text": " sequences with transformers." }, { "start": 85.08, "end": 90, "text": " As always, if you like content like this, feel free to share it around, leave a like" }, { "start": 90, "end": 96.44, "text": " and tell me in the comments what you think about the paper and about what I think, whatever," }, { "start": 96.44, "end": 100.28, "text": " you just, just go nuts." }, { "start": 100.28, "end": 108.6, "text": " Alright, so the basic premise right here is that the transformers, they've been pretty" }, { "start": 108.6, "end": 111.04, "text": " impactful, especially in NLP." }, { "start": 111.04, "end": 115.2, "text": " So they say transformer based models such as BERT have been one of the most successful" }, { "start": 115.2, "end": 117.76, "text": " deep learning models for NLP." }, { "start": 117.76, "end": 123.28, "text": " Unfortunately, one of their core limitations is the quadratic dependency, mainly in terms" }, { "start": 123.28, "end": 127.92, "text": " of memory, on the sequence length due to their full attention mechanism." }, { "start": 127.92, "end": 133.44, "text": " So really briefly, the full attention mechanism, and I've done numerous videos about attention" }, { "start": 133.44, "end": 136.28, "text": " mechanism BERT, attention is all you need, and so on." }, { "start": 136.28, "end": 141.96, "text": " So if you want a detailed explanation of what that is, just go look up the corresponding" }, { "start": 141.96, "end": 142.96, "text": " videos." }, { "start": 142.96, "end": 149.6, "text": " But briefly, what you'll have in NLP is a set of tokens, a sequence of tokens as an input," }, { "start": 149.6, "end": 157.62, "text": " and you want to transform them layer after layer into sort of a higher order representation" }, { "start": 157.62, "end": 159.6, "text": " of that same sequence." }, { "start": 159.6, "end": 164.88, "text": " And for that, you build these layers out of nodes and you have as many nodes usually as" }, { "start": 164.88, "end": 166.96, "text": " you have tokens in the sequence." }, { "start": 166.96, "end": 174.74, "text": " And the next set of, so each token is represented by a vector at the beginning, and each layer" }, { "start": 174.74, "end": 179.04000000000002, "text": " transforms the sequence, as I said, into sort of a higher level representation." }, { "start": 179.04000000000002, "end": 186.32, "text": " So you want the vector of this token right here to be a better representation than the" }, { "start": 186.32, "end": 188.56, "text": " vector was right here." }, { "start": 188.56, "end": 195.12, "text": " And you do that by incorporating information from all the other tokens into that particular" }, { "start": 195.12, "end": 196.12, "text": " vector." }, { "start": 196.12, "end": 200.72, "text": " Now, as I said, this is called an attention mechanism, and we don't actually have to go" }, { "start": 200.72, "end": 205.92, "text": " into how it works right here, but you can see pretty clearly that if you want to do" }, { "start": 205.92, "end": 212.92, "text": " this for every token, you need to have information routed from every token to every token, like" }, { "start": 212.92, "end": 216.64, "text": " from here to here, from here to here, and so on." }, { "start": 216.64, "end": 220.6, "text": " And this is just one token, and then you need to do it for this token and for this token" }, { "start": 220.6, "end": 222.06, "text": " and for this token." }, { "start": 222.06, "end": 226.66, "text": " So what you'll ultimately get, if n is your sequence length, you'll get some n squared" }, { "start": 226.66, "end": 231.16, "text": " amount of computation and memory requirements for this." }, { "start": 231.16, "end": 232.45999999999998, "text": " So this is a problem." }, { "start": 232.45999999999998, "end": 237.35999999999999, "text": " And usually, this means that, you know, this sequence length in BERT, this is limited to" }, { "start": 237.36, "end": 243.72000000000003, "text": " something like 512 tokens, which is okay for some applications." }, { "start": 243.72000000000003, "end": 249.36, "text": " But if you want to summarize, you know, entire articles, entire books, even, or do question" }, { "start": 249.36, "end": 253.28, "text": " answering with lots of context, it's not really enough." }, { "start": 253.28, "end": 259.5, "text": " So people have been thinking about how to scale this input, how to scale this." }, { "start": 259.5, "end": 264.88, "text": " And of course, the main culprit is this quadratic attention mechanism, because if you, you know," }, { "start": 264.88, "end": 270.76, "text": " scale the 512, you need, you know, four times the amount of compute and memory." }, { "start": 270.76, "end": 275.71999999999997, "text": " So how does this paper go about reducing that quadratic dependency?" }, { "start": 275.71999999999997, "end": 281.12, "text": " The goal right here is, of course, to get this to some O of n, right?" }, { "start": 281.12, "end": 287.28, "text": " Because then, as we double the input length, we simply need to double the compute requirements," }, { "start": 287.28, "end": 288.71999999999997, "text": " and that would be fantastic." }, { "start": 288.71999999999997, "end": 290.74, "text": " And that's what this paper does." }, { "start": 290.74, "end": 296.2, "text": " And it does so without sacrificing the properties of the transformer." }, { "start": 296.2, "end": 300.84000000000003, "text": " So here's the architecture that Big Bird proposes." }, { "start": 300.84000000000003, "end": 306.86, "text": " By the way, Big Bird, another character from Sesame Street, I guess, will continue the" }, { "start": 306.86, "end": 309.84000000000003, "text": " naming here after Elmo and BERT." }, { "start": 309.84000000000003, "end": 315.8, "text": " You know, I'm waiting for the model that's the count." }, { "start": 315.8, "end": 319.40000000000003, "text": " Yeah, that's going to be a fun model." }, { "start": 319.4, "end": 323.96, "text": " So Big Bird basically has three different types of attention." }, { "start": 323.96, "end": 327.76, "text": " And here, these are adjacency matrices in this attention mechanism." }, { "start": 327.76, "end": 333.53999999999996, "text": " So here is the input layer, and the output layer is right here." }, { "start": 333.53999999999996, "end": 337.84, "text": " So that basically means that node i right here would be connected." }, { "start": 337.84, "end": 343.52, "text": " Sorry, that's not a straight line, would be connected to this particular node and also" }, { "start": 343.52, "end": 345.34, "text": " to this particular node." }, { "start": 345.34, "end": 353.44, "text": " So we're now trying, if we have node i right here, we're now trying to not connect it to" }, { "start": 353.44, "end": 359.84, "text": " all of these nodes, but we'll say, we'll just select some at random and then connect it" }, { "start": 359.84, "end": 360.84, "text": " to that." }, { "start": 360.84, "end": 363.64, "text": " Okay, this is what we call random attention." }, { "start": 363.64, "end": 371.15999999999997, "text": " And you can pretty clearly see if you connect each of the i nodes to r equals 2, to two" }, { "start": 371.16, "end": 376.40000000000003, "text": " random nodes, then you don't have an n squared anymore." }, { "start": 376.40000000000003, "end": 383.56, "text": " But you'll have a like an O of r times n, which you know, if r is a constant is an O" }, { "start": 383.56, "end": 386.32000000000005, "text": " of n attention mechanism." }, { "start": 386.32000000000005, "end": 394, "text": " Okay, so the main goal between the random attention mechanism is that for each query," }, { "start": 394, "end": 401.44, "text": " basically, you select random tokens that you attend to, and that random number is a fixed" }, { "start": 401.44, "end": 405.2, "text": " number that's not dependent on the sequence length." }, { "start": 405.2, "end": 412.32, "text": " And the paper is a little bit unclear about whether or not those random ones are the same" }, { "start": 412.32, "end": 418.28, "text": " for every sequence or are switched up, or the same for every layer or are switched up." }, { "start": 418.28, "end": 423.82, "text": " But they formulate all of this as sort of in sort of a graph in sort of a random graph." }, { "start": 423.82, "end": 428.96, "text": " So they're, they formulate the attention mechanism in form of a graph." }, { "start": 428.96, "end": 435, "text": " So if we transform all of these nodes into a graph, a full attention mechanism would" }, { "start": 435, "end": 441.36, "text": " mean that each graph, each node is connected to each of the other nodes, right, fully connected" }, { "start": 441.36, "end": 447.02, "text": " graph, I don't, maybe that's it." }, { "start": 447.02, "end": 448.88, "text": " So that would be a full attention mechanism." }, { "start": 448.88, "end": 456.32, "text": " And then they say, well, if we just have random connections between these things, then there" }, { "start": 456.32, "end": 462.64, "text": " are some theorems from graph theory that say that each random walk in this graph is going" }, { "start": 462.64, "end": 466.15999999999997, "text": " to, so this graph is going to mix pretty quickly." }, { "start": 466.15999999999997, "end": 473.56, "text": " So I can get from each node to each other node by a random walk in a logarithmic time." }, { "start": 473.56, "end": 478.28, "text": " And this random walk, which basically means that you go from here to here, this would" }, { "start": 478.28, "end": 481.65999999999997, "text": " be one layer of the transformer." }, { "start": 481.65999999999997, "end": 485.91999999999996, "text": " And then if you want to go from here to here, that you would have to do that in the next" }, { "start": 485.91999999999996, "end": 486.91999999999996, "text": " layer." }, { "start": 486.91999999999996, "end": 493.03999999999996, "text": " So this formulation as a random graph leads me to believe that layer after layer, the" }, { "start": 493.03999999999996, "end": 497.03999999999996, "text": " random attention pattern is going to be the same." }, { "start": 497.03999999999996, "end": 503.76, "text": " But also the formulation of the paper leads me to believe that the this random attention" }, { "start": 503.76, "end": 505.91999999999996, "text": " differs from sequence to sequence." }, { "start": 505.92, "end": 512.96, "text": " So I believe what's happening is that they get a new sequence, then they decide on this" }, { "start": 512.96, "end": 519.28, "text": " pattern right here once and then they use this layer after layer, the same pattern again." }, { "start": 519.28, "end": 527.84, "text": " So you can see that in the traditional attention, information can basically flow from each of" }, { "start": 527.84, "end": 532.08, "text": " the nodes to each other node in one single step, right?" }, { "start": 532.08, "end": 534.48, "text": " Because each node is connected to each other node." }, { "start": 534.48, "end": 536.9200000000001, "text": " You see this in the graph right here." }, { "start": 536.9200000000001, "end": 545.5600000000001, "text": " However, if we only select a subset, then you know, it needs to if I want to go from," }, { "start": 545.5600000000001, "end": 550.12, "text": " as I said, from here to here, then I need to do it in two steps." }, { "start": 550.12, "end": 552.4, "text": " And therefore I need two layers." }, { "start": 552.4, "end": 555.28, "text": " And that's going to be the culprit of this method here." }, { "start": 555.28, "end": 562.04, "text": " And while it is mentioned in the paper, it's sort of I feel at least that's my my assessment" }, { "start": 562.04, "end": 566.12, "text": " of this paper, it's kind of swept under the rug a little bit." }, { "start": 566.12, "end": 573.24, "text": " I mean, they do have a theorem that clearly says we can construct an example of a task" }, { "start": 573.24, "end": 577.2199999999999, "text": " that in the full attention setting can be solved with a single step." }, { "start": 577.2199999999999, "end": 585.8399999999999, "text": " So a single layer that in our random attention setting needs a lot of layers, a lot of steps." }, { "start": 585.84, "end": 592.08, "text": " But you know, the rest of the paper is sort of shaky on on this thing." }, { "start": 592.08, "end": 598.64, "text": " But nevertheless, you can see how the random attention can, if you have enough layers," }, { "start": 598.64, "end": 602.24, "text": " do the same information routing as the full attention." }, { "start": 602.24, "end": 603.24, "text": " Okay." }, { "start": 603.24, "end": 607.52, "text": " However, this is not a property of the random attention." }, { "start": 607.52, "end": 609.82, "text": " And we'll see this in the next thing right here." }, { "start": 609.82, "end": 614.4200000000001, "text": " So the next ingredient that this paper uses is window attention." }, { "start": 614.42, "end": 618.92, "text": " And you can see over here that Big Bird is ultimately going to be a combination of the" }, { "start": 618.92, "end": 623.28, "text": " three types of attention, which will, which we are looking at here." }, { "start": 623.28, "end": 630.4, "text": " So window attention basically means that each each i each token at the i of position is" }, { "start": 630.4, "end": 633.5799999999999, "text": " going to attend to itself, of course." }, { "start": 633.5799999999999, "end": 639.02, "text": " So here is i, but it is also going to attend to its neighbors." }, { "start": 639.02, "end": 642.68, "text": " So here is i minus one and here is i plus one." }, { "start": 642.68, "end": 649.5, "text": " And this is a you know, this is a window size w that you can that is a parameter, but also" }, { "start": 649.5, "end": 657.06, "text": " it is a constant and therefore you again go from n squared to w times n, which you know" }, { "start": 657.06, "end": 661.2199999999999, "text": " is o of n if w is a constant." }, { "start": 661.2199999999999, "end": 665.8, "text": " And this might be familiar to you, because we've already seen this in the long former" }, { "start": 665.8, "end": 666.8, "text": " paper." }, { "start": 666.8, "end": 674.4399999999999, "text": " We made a video or I think even two videos on the long former, which used exactly the" }, { "start": 674.4399999999999, "end": 678.54, "text": " window attention in combination with the global attention." }, { "start": 678.54, "end": 682.0999999999999, "text": " And if you want to know more about that, go watch these videos." }, { "start": 682.0999999999999, "end": 688.92, "text": " But the new thing in Big Bird right here is this addition of the random attention." }, { "start": 688.92, "end": 698.54, "text": " Again, the the window here is is has exactly the same properties as the random attention." }, { "start": 698.54, "end": 704.3, "text": " So you have instead of a fully connected graph, you have a sparsely connected graph." }, { "start": 704.3, "end": 710.42, "text": " Now if you have random attention, the sparsely connected graph is like like the one on the" }, { "start": 710.42, "end": 711.42, "text": " right." }, { "start": 711.42, "end": 717.38, "text": " But if you have a windowed attention, you can it is kind of not randomly connected," }, { "start": 717.38, "end": 721.12, "text": " but each node is connected to its neighbors like this." }, { "start": 721.12, "end": 726.58, "text": " And you can also see that if I want to go from this node to this node right here, I" }, { "start": 726.58, "end": 729.98, "text": " can't do it in one step, but I can do it in two steps." }, { "start": 729.98, "end": 732.5, "text": " I go here and I go here." }, { "start": 732.5, "end": 741.42, "text": " So in the terms of the attention layers, if I want to go from node one to node three," }, { "start": 741.42, "end": 745.58, "text": " I have to do it in two steps because each node is only connected to its neighbors." }, { "start": 745.58, "end": 750.98, "text": " So the connection patterns would sort of look like this." }, { "start": 750.98, "end": 757.3000000000001, "text": " So I have to go from one to two and then in the next layer from two to three." }, { "start": 757.3000000000001, "end": 764.82, "text": " So the paper basically makes up for the lack of full attention by adding layers." }, { "start": 764.82, "end": 769.22, "text": " And you also might recognize this from a convolution operation." }, { "start": 769.22, "end": 775.5400000000001, "text": " This basically because it is a convolution operation, right in a convolution, each node" }, { "start": 775.54, "end": 780.54, "text": " only aggregates input from its neighbors for the next layer." }, { "start": 780.54, "end": 786.3399999999999, "text": " And then we know that as we go up the layers, the de facto window that each node looks at" }, { "start": 786.3399999999999, "end": 790.0999999999999, "text": " is going to be like a cone kind of like this." }, { "start": 790.0999999999999, "end": 794.38, "text": " So this is very similar to how a convolutional neural network works." }, { "start": 794.38, "end": 799.38, "text": " And the reasoning is very similar because the reasoning is, well, in a sentence, the" }, { "start": 799.38, "end": 804.74, "text": " most important words for any given word are probably going to be its neighbors, like the" }, { "start": 804.74, "end": 806.42, "text": " words around it." }, { "start": 806.42, "end": 809.98, "text": " And as you go up the layers, you branch out more and more." }, { "start": 809.98, "end": 815.9, "text": " But ultimately, this neighborhood principle holds in NLP as well." }, { "start": 815.9, "end": 821.54, "text": " So again, we already saw this in the long former, but that's the reason behind the window" }, { "start": 821.54, "end": 823.82, "text": " attention and that's the second ingredient." }, { "start": 823.82, "end": 827.46, "text": " And then the third ingredient is this global attention." }, { "start": 827.46, "end": 836.0600000000001, "text": " Now the global attention is selected tokens that are so important and that's fixed by" }, { "start": 836.0600000000001, "end": 843.14, "text": " the developers that are so important that they are connected to everything else." }, { "start": 843.14, "end": 851.1, "text": " So for example, in these transformers, you often have what's this kind of CLS token." }, { "start": 851.1, "end": 857.78, "text": " So this is a special token that you prepend to some piece of text and the output of this" }, { "start": 857.78, "end": 863.74, "text": " token is going to be your classification output because you don't want to bind your classification" }, { "start": 863.74, "end": 866.3000000000001, "text": " if you need to classify the entire sequence." }, { "start": 866.3000000000001, "end": 870.6, "text": " You don't want to bind that decision to one particular word." }, { "start": 870.6, "end": 875.4200000000001, "text": " What you want to do is you want to have an extra token and that's this CLS token that" }, { "start": 875.4200000000001, "end": 879.0600000000001, "text": " kind of aggregates information from all of this." }, { "start": 879.06, "end": 885.3, "text": " So layer after layer, layer after layer, you'll have, so if we go here, layer after layer," }, { "start": 885.3, "end": 887.8599999999999, "text": " we have this one special node." }, { "start": 887.8599999999999, "end": 895.14, "text": " And in each step, every single other node is able to send information right here to" }, { "start": 895.14, "end": 900.7399999999999, "text": " this node and receive information from this node." }, { "start": 900.74, "end": 911.78, "text": " So now, as a result of this, as you may be able to see, every single path is kind of" }, { "start": 911.78, "end": 916.5, "text": " a maximum length of two because if I want to go from any node to any other node, I can" }, { "start": 916.5, "end": 922.54, "text": " simply send information to this global node and then the global node in the next step" }, { "start": 922.54, "end": 926.5600000000001, "text": " can send information to whatever other node." }, { "start": 926.56, "end": 933.5799999999999, "text": " And that is a property that they use in their proof that this attention mechanism is as" }, { "start": 933.5799999999999, "end": 937.2199999999999, "text": " sort of as powerful as the classic full attention mechanism." }, { "start": 937.2199999999999, "end": 940.3399999999999, "text": " And we'll go through that in one second." }, { "start": 940.3399999999999, "end": 944.9, "text": " But first, I hope this was clear that this combination of random attention, window attention" }, { "start": 944.9, "end": 952.8199999999999, "text": " and global attention is what is called Big Bird." }, { "start": 952.82, "end": 957.38, "text": " They have some engineering tricks that go along with this, but in concept, you can imagine" }, { "start": 957.38, "end": 963.1400000000001, "text": " Big Bird being long former plus these random attention right here." }, { "start": 963.1400000000001, "end": 968.46, "text": " And as an engineer, as an NLP engineer, that makes kind of total sense." }, { "start": 968.46, "end": 976.36, "text": " I totally believe that the introduction, the addition of these random attention of these" }, { "start": 976.36, "end": 983.82, "text": " random attention patterns can absolutely help your classification or whatever your NLP tasks" }, { "start": 983.82, "end": 986.9, "text": " because more attention, better." }, { "start": 986.9, "end": 993.38, "text": " And I also am completely willing to believe that using the full attention matrix, while" }, { "start": 993.38, "end": 999.54, "text": " it is, of course, more accurate, it won't hurt too much to leave some of that attention" }, { "start": 999.54, "end": 1005.46, "text": " away because essentially all the path lengths are just becoming two or even with the random" }, { "start": 1005.46, "end": 1011.58, "text": " attention are really short or logarithmic to route information from a node to some other" }, { "start": 1011.58, "end": 1012.58, "text": " node." }, { "start": 1012.58, "end": 1019.7800000000001, "text": " So the loss that you incur is kind of in a logarithmic scale in terms of performance," }, { "start": 1019.7800000000001, "end": 1025.02, "text": " while the gain that you make is sort of in a in a quadratic or like a linear scale, you" }, { "start": 1025.02, "end": 1027.76, "text": " go from quadratic to linear." }, { "start": 1027.76, "end": 1031.3400000000001, "text": " And that seems to me like a good empirical trade off." }, { "start": 1031.34, "end": 1042.98, "text": " All right, however, the the proofs here, the proof of of how how these how these things" }, { "start": 1042.98, "end": 1046.3799999999999, "text": " are constructed are a little bit." }, { "start": 1046.3799999999999, "end": 1047.3799999999999, "text": " I don't know." }, { "start": 1047.3799999999999, "end": 1054.8999999999999, "text": " So what they do in the proof that this function can sort of is a universal approximator." }, { "start": 1054.8999999999999, "end": 1060.8, "text": " People have already shown that full attention mechanisms are universal approximators." }, { "start": 1060.8, "end": 1066.1399999999999, "text": " So they show here that this sparse attention mechanism is also a universal approximator." }, { "start": 1066.1399999999999, "end": 1068.5, "text": " They make big use of star graphs." }, { "start": 1068.5, "end": 1073.8999999999999, "text": " What they say is, OK, if we have a star graph, which is one node connected right here to" }, { "start": 1073.8999999999999, "end": 1077.48, "text": " every other node, this is a star graph." }, { "start": 1077.48, "end": 1084.22, "text": " If we have a star graph, we can achieve the same thing than with a full graph." }, { "start": 1084.22, "end": 1087.94, "text": " A full graph is where every node is connected to every other node." }, { "start": 1087.94, "end": 1093.98, "text": " But as I already said, what they need for this is multiple layers of this star graph." }, { "start": 1093.98, "end": 1099.7, "text": " So and that has to do with the fact that if I want to route information, I basically have" }, { "start": 1099.7, "end": 1103.4, "text": " to go via this middle node right here." }, { "start": 1103.4, "end": 1107.74, "text": " And there is an additional complication because this middle node in our case right here is" }, { "start": 1107.74, "end": 1110.18, "text": " only one node." }, { "start": 1110.18, "end": 1116.74, "text": " I can't route information at the same like I can't have this routing right here at the" }, { "start": 1116.74, "end": 1123.34, "text": " same time that I have this routing right here, like going from here to here, because I only" }, { "start": 1123.34, "end": 1125.04, "text": " have one middle node." }, { "start": 1125.04, "end": 1129.42, "text": " And I kind of this is not how that like this is very dumb math." }, { "start": 1129.42, "end": 1135.54, "text": " But maybe you have to imagine that there is one memory slot." }, { "start": 1135.54, "end": 1141.02, "text": " And you can only use that one memory slot at the same time for one of these things." }, { "start": 1141.02, "end": 1145.8, "text": " So essentially, what you'll have to do is you'll have to do the green thing first." }, { "start": 1145.8, "end": 1150.26, "text": " And then in the next step, you'll have to do the blue thing second." }, { "start": 1150.26, "end": 1154.58, "text": " And then so these are now pairwise routing between nodes." }, { "start": 1154.58, "end": 1159.56, "text": " But ultimately, what an attention mechanism does is it does everything to everything right" }, { "start": 1159.56, "end": 1164.3799999999999, "text": " in a single layer, it routes information from all the nodes to all the other nodes." }, { "start": 1164.3799999999999, "end": 1168.6599999999999, "text": " And to achieve that, so you need multiple rounds of this." }, { "start": 1168.6599999999999, "end": 1173.9199999999998, "text": " And it turns out that in the worst case, you actually need n rounds of this." }, { "start": 1173.92, "end": 1181.94, "text": " So you know, you trade off your you go from n squared to n memory and compute requirements" }, { "start": 1181.94, "end": 1183.5800000000002, "text": " in a single layer." }, { "start": 1183.5800000000002, "end": 1190.48, "text": " But in the worst case, you need n layers to recover the power of the full of the full" }, { "start": 1190.48, "end": 1192.02, "text": " transformer." }, { "start": 1192.02, "end": 1196.46, "text": " And that is the last one of their theoretical results right here." }, { "start": 1196.46, "end": 1200.22, "text": " So first, they prove universal approximations." }, { "start": 1200.22, "end": 1203.0600000000002, "text": " And second, they prove Turing completeness." }, { "start": 1203.06, "end": 1207.3799999999999, "text": " These two properties have been proven for full attention mechanisms." }, { "start": 1207.3799999999999, "end": 1213.4199999999998, "text": " And third, they prove that there are tasks where you actually do need n layers to solve" }, { "start": 1213.4199999999998, "end": 1217.54, "text": " them with their limited attention." }, { "start": 1217.54, "end": 1227.94, "text": " So you know, I'm not sure but I feel you can make any sort of polynomial algorithm into" }, { "start": 1227.94, "end": 1229.6, "text": " a linear algorithm like this." }, { "start": 1229.6, "end": 1232.84, "text": " Like I have a I have like a cool sorting algorithm, right?" }, { "start": 1232.84, "end": 1238.78, "text": " So if this is my sequence that I want to sort, what I can do is I can simply, you know, take" }, { "start": 1238.78, "end": 1245.78, "text": " a random subset of them, like this, this and this and then kind of go and sort them and" }, { "start": 1245.78, "end": 1252.06, "text": " then put them like I send them to the to the global memory like this, I sort them, and" }, { "start": 1252.06, "end": 1255.78, "text": " then I put them back, right?" }, { "start": 1255.78, "end": 1262.4199999999998, "text": " And if I do this for enough, if I do this for enough rounds, okay, you know, if I do" }, { "start": 1262.42, "end": 1267.66, "text": " this for enough rounds, you know, at the worst case, I need n rounds to sort my or log n" }, { "start": 1267.66, "end": 1269.54, "text": " rounds if I do it smartly." }, { "start": 1269.54, "end": 1276.42, "text": " But you know, in, you know, the single step here is the single step is just O of n." }, { "start": 1276.42, "end": 1280.14, "text": " So I have now an O of n sorting algorithm." }, { "start": 1280.14, "end": 1287.26, "text": " I you know, I have my sort of a bit of worry to express things like that." }, { "start": 1287.26, "end": 1296.42, "text": " And yeah, but you know, it is from an empirical standpoint, I absolutely believe that this" }, { "start": 1296.42, "end": 1298.82, "text": " this is enough." }, { "start": 1298.82, "end": 1304.74, "text": " Now my second coral right here is that if you look at the proof, first of all, what" }, { "start": 1304.74, "end": 1310.3799999999999, "text": " it makes use is this star graph, and the star graph corresponds to the global attention." }, { "start": 1310.3799999999999, "end": 1314.46, "text": " So that's not much to do with the random attention, though they use the random attention in their" }, { "start": 1314.46, "end": 1323.74, "text": " proof, but I at least believe that it would be possible with the global attention only." }, { "start": 1323.74, "end": 1330.74, "text": " And then the second thing is if you look at the parameters that they use for the for the" }, { "start": 1330.74, "end": 1334.8600000000001, "text": " experiments, and I've already said this in the long former video." }, { "start": 1334.8600000000001, "end": 1340.14, "text": " So in the long form of video, it turned out that if you look at how big these window attention" }, { "start": 1340.14, "end": 1347.9, "text": " is, it turns out that it you're still well, you know, the original BERT attended to 512" }, { "start": 1347.9, "end": 1348.9, "text": " tokens." }, { "start": 1348.9, "end": 1353.3400000000001, "text": " And then you look at the window and the window was still 512 tokens." }, { "start": 1353.3400000000001, "end": 1357.5400000000002, "text": " It's just that the global attention was even more so ultimately they ended up using more" }, { "start": 1357.5400000000002, "end": 1360.14, "text": " memory than the original BERT." }, { "start": 1360.14, "end": 1367.6200000000001, "text": " And here, if I look at the parameters of their thing, and they have multiple experiments" }, { "start": 1367.62, "end": 1371.26, "text": " right here, and I believe this is the the base version." }, { "start": 1371.26, "end": 1376.1, "text": " So this is the base version, they also have this large version." }, { "start": 1376.1, "end": 1380.86, "text": " But here, this is the 12 layer version." }, { "start": 1380.86, "end": 1383.86, "text": " And you can see they have this block length." }, { "start": 1383.86, "end": 1388.1999999999998, "text": " And we'll get into the block length in one second." }, { "start": 1388.1999999999998, "end": 1393.6799999999998, "text": " But then you can see that their window size is three times the block length, the number" }, { "start": 1393.68, "end": 1397.98, "text": " of random tokens is three times the block length, and the number of global tokens is" }, { "start": 1397.98, "end": 1399.5800000000002, "text": " two times the block length." }, { "start": 1399.5800000000002, "end": 1411.5800000000002, "text": " So that results in eight times B. So eight times 64 is, you know," }, { "start": 1411.5800000000002, "end": 1413.46, "text": " Can I calculate this?" }, { "start": 1413.46, "end": 1415.66, "text": " Or am I stupid?" }, { "start": 1415.66, "end": 1416.66, "text": " It's 512." }, { "start": 1416.66, "end": 1420.42, "text": " Yes, actually calculated this before." }, { "start": 1420.42, "end": 1423.3400000000001, "text": " So this is 512 tokens." }, { "start": 1423.34, "end": 1432.1799999999998, "text": " So you know, you you go from from BERT that has 512 tokens and attends to 512 tokens to" }, { "start": 1432.1799999999998, "end": 1435.1, "text": " also attending to 512 tokens." }, { "start": 1435.1, "end": 1442.4199999999998, "text": " Of course, the advantage here is that they now have 4096 sequence length." }, { "start": 1442.4199999999998, "end": 1450.58, "text": " So they have the freedom to not attend to as many tokens as they have in the input length." }, { "start": 1450.58, "end": 1458.54, "text": " But you know, to put it in perspective, this here uses more memory and more compute on" }, { "start": 1458.54, "end": 1466.26, "text": " on its face than BERT, because BERT attends to as many tokens but has a smaller input" }, { "start": 1466.26, "end": 1469.4199999999998, "text": " sequence." }, { "start": 1469.4199999999998, "end": 1475.8799999999999, "text": " And you know, I, there's sort of a thing where in order to make these sparse attention things" }, { "start": 1475.88, "end": 1482.0200000000002, "text": " work, you have to go pretty, pretty, you know, high in the number of things you attend to," }, { "start": 1482.0200000000002, "end": 1487.7, "text": " you can leave away some but it's not like you can scale up orders of magnitude of your" }, { "start": 1487.7, "end": 1489.88, "text": " input sequence length." }, { "start": 1489.88, "end": 1495.3000000000002, "text": " So that's the this promise of linear attention is sort of it's kind of fulfilled but not" }, { "start": 1495.3000000000002, "end": 1496.3000000000002, "text": " there yet." }, { "start": 1496.3000000000002, "end": 1501.8600000000001, "text": " The second thing I would like to point out is that in a lot of cases, the number of random" }, { "start": 1501.8600000000001, "end": 1504.7, "text": " tokens is actually set to zero." }, { "start": 1504.7, "end": 1511.18, "text": " So really making use, I believe, of these of the of the global of the number of global" }, { "start": 1511.18, "end": 1512.76, "text": " tokens." }, { "start": 1512.76, "end": 1520.02, "text": " So it that seems a bit strange in that they continuously refer to their random attention" }, { "start": 1520.02, "end": 1521.6200000000001, "text": " mechanism." }, { "start": 1521.6200000000001, "end": 1527.22, "text": " But then in a lot of experiments, they don't actually have a random attention mechanism." }, { "start": 1527.22, "end": 1530.98, "text": " I believe they have to do that because that's kind of what makes them different from the" }, { "start": 1530.98, "end": 1537.06, "text": " long former in principle, but still, yeah." }, { "start": 1537.06, "end": 1544.76, "text": " So the last novelty, let's say is an engineering novelty in that they now always consider not" }, { "start": 1544.76, "end": 1549.66, "text": " single, for example, they don't consider single random attention, they always consider these" }, { "start": 1549.66, "end": 1550.66, "text": " in blocks." }, { "start": 1550.66, "end": 1556.14, "text": " And that's because our current hardware is really bad at sparse stuff." }, { "start": 1556.14, "end": 1559.88, "text": " Really bad at single indexing, gathering single things." }, { "start": 1559.88, "end": 1566.0200000000002, "text": " So if you can do everything in blocks, you basically get you get these blocks almost" }, { "start": 1566.0200000000002, "end": 1567.0200000000002, "text": " for free." }, { "start": 1567.0200000000002, "end": 1572.48, "text": " So it takes only marginally longer to retrieve this full two by two block right here than" }, { "start": 1572.48, "end": 1576.46, "text": " it would to retrieve the single instance right here." }, { "start": 1576.46, "end": 1582.38, "text": " Of course, that means you have, you know, four times you still use four times more memory," }, { "start": 1582.38, "end": 1585.9, "text": " but it is not four times slower than the original thing." }, { "start": 1585.9, "end": 1589.94, "text": " So you can use these blocks right here." }, { "start": 1589.94, "end": 1593.26, "text": " You can do it for the random attention, you can do it for the window attention, as you" }, { "start": 1593.26, "end": 1594.26, "text": " can see here." }, { "start": 1594.26, "end": 1598.22, "text": " So you break this window pattern a little bit into blocks." }, { "start": 1598.22, "end": 1601.02, "text": " And that makes it a lot faster." }, { "start": 1601.02, "end": 1605.64, "text": " So that speeds up, get the speed up almost for free." }, { "start": 1605.64, "end": 1613.02, "text": " And then they make another approximation in that the way they do this windowing is, and" }, { "start": 1613.02, "end": 1615.98, "text": " I just go really briefly." }, { "start": 1615.98, "end": 1624.06, "text": " So you can see right here that it would be very cumbersome to gather." }, { "start": 1624.06, "end": 1629.5, "text": " So what we need, we're just going to focus this this dotted thing right here is a bit" }, { "start": 1629.5, "end": 1630.5, "text": " confusing." }, { "start": 1630.5, "end": 1634.86, "text": " So you want to attend to these things." }, { "start": 1634.86, "end": 1639.16, "text": " And these you can just get out with a matrix slice really easy." }, { "start": 1639.16, "end": 1644.9, "text": " But then you want to attend to this kind of blocky thing right here from the window attention," }, { "start": 1644.9, "end": 1646.92, "text": " right, like this thing." }, { "start": 1646.92, "end": 1653.3400000000001, "text": " And this is hard to get out because you'd have to kind of index each row individually." }, { "start": 1653.3400000000001, "end": 1654.8000000000002, "text": " And that's very slow." }, { "start": 1654.8000000000002, "end": 1659.5600000000002, "text": " So what they do, there is this matrix roll operation, where you can sort of roll the" }, { "start": 1659.5600000000002, "end": 1661.1000000000001, "text": " axis around." }, { "start": 1661.1000000000001, "end": 1665.8000000000002, "text": " So what you'll do is you'll take this thing right here, and you put it to the left right" }, { "start": 1665.8, "end": 1670.98, "text": " here, and you'll take, for example, this thing right here, and you'll put it to the right" }, { "start": 1670.98, "end": 1674.78, "text": " or no, like it's, it's up and down." }, { "start": 1674.78, "end": 1677.12, "text": " But in essence, that's what you do." }, { "start": 1677.12, "end": 1683.6599999999999, "text": " And you can you can fold all of this blue stuff into a rectangular matrix." }, { "start": 1683.6599999999999, "end": 1687.26, "text": " If you know if you can see right here." }, { "start": 1687.26, "end": 1693.1, "text": " So you kind of roll this back, roll this back, roll this forward, and you replace whatever" }, { "start": 1693.1, "end": 1695.62, "text": " is missing by these." }, { "start": 1695.62, "end": 1702.4199999999998, "text": " Now this again gives you some inaccuracies because this block right here was never intended" }, { "start": 1702.4199999999998, "end": 1704.76, "text": " to be attended to." }, { "start": 1704.76, "end": 1708.82, "text": " And all of a sudden you see you have the K6 in here." }, { "start": 1708.82, "end": 1713.6599999999999, "text": " So it gives you a bit of inaccuracies at the edges of the sequence." }, { "start": 1713.6599999999999, "end": 1718.6399999999999, "text": " But you can take that, you know, you can take that hit for the increased performance that" }, { "start": 1718.6399999999999, "end": 1721.62, "text": " you gain by now having a rectangular matrix." }, { "start": 1721.62, "end": 1727.1399999999999, "text": " TPUs are really efficient at this, not as efficient at this." }, { "start": 1727.1399999999999, "end": 1733.06, "text": " And then the only thing that's really slow is gathering these random blocks right here." }, { "start": 1733.06, "end": 1738.78, "text": " But also by having the same amount of random blocks per input token, what you'll do is" }, { "start": 1738.78, "end": 1745.3, "text": " you'll end up with just one of these columns right here, or you know, R of these columns." }, { "start": 1745.3, "end": 1747.6599999999999, "text": " And that again gives you a rectangular matrix." }, { "start": 1747.66, "end": 1753.3400000000001, "text": " So this thing right here you can process very, very efficiently using a TPU." }, { "start": 1753.3400000000001, "end": 1759.3000000000002, "text": " And you know, the mistakes you make are basically this thing right here and this thing right" }, { "start": 1759.3000000000002, "end": 1764.88, "text": " here, because those weren't intended and are at the edges of the sequence." }, { "start": 1764.88, "end": 1771.3400000000001, "text": " So these were the tricks of Big Bird to quickly summarize." }, { "start": 1771.34, "end": 1779.6599999999999, "text": " Big Bird is basically taking a transformer saying, well, why do we need all of this attention," }, { "start": 1779.6599999999999, "end": 1784.78, "text": " all of this full attention, maybe we only need some of that and can already do a big" }, { "start": 1784.78, "end": 1789.98, "text": " job, a good job, especially, you know, considering the attention mechanism goes over multiple" }, { "start": 1789.98, "end": 1791.6599999999999, "text": " layers." }, { "start": 1791.6599999999999, "end": 1797.86, "text": " So we don't need a routing from each token to each token, we can make up for not having" }, { "start": 1797.86, "end": 1801.8799999999999, "text": " a fully connected graph by simply running multiple layers." }, { "start": 1801.8799999999999, "end": 1809.1, "text": " So their sparsity is first of all, you have this random attention, which I believe changes" }, { "start": 1809.1, "end": 1815.28, "text": " from sequence to sequence, but stays within or among the layers of the same sequence." }, { "start": 1815.28, "end": 1818.82, "text": " Then you have the window attention with the reasoning." }, { "start": 1818.82, "end": 1822.74, "text": " So the reasoning behind the random attention is that if you have a randomly connected graph," }, { "start": 1822.74, "end": 1826, "text": " the path lengths are on average logarithmic." }, { "start": 1826, "end": 1828.52, "text": " So you can route information efficiently." }, { "start": 1828.52, "end": 1834.14, "text": " The reasoning behind the window attention is that probably neighbor information is very" }, { "start": 1834.14, "end": 1837.5, "text": " important and that has been shown empirically." }, { "start": 1837.5, "end": 1841.66, "text": " And then the global attention, the reasoning behind this is that some of the tokens that" }, { "start": 1841.66, "end": 1848.42, "text": " are fixed by the developers are so important that it's very beneficial that each other" }, { "start": 1848.42, "end": 1853.46, "text": " node is connected to them and that they are connected to each other node." }, { "start": 1853.46, "end": 1859.54, "text": " The result of that is the Big Bird attention mechanism, which is basically long former," }, { "start": 1859.54, "end": 1864.4, "text": " which already had these two plus the random attention." }, { "start": 1864.4, "end": 1872.46, "text": " This achieves a linear complexity in terms of memory and compute, though linear has to" }, { "start": 1872.46, "end": 1878.78, "text": " be qualified a bit because it's modified by the window size, by the number of random attention" }, { "start": 1878.78, "end": 1885.86, "text": " tokens, by the number of global tokens, and in practice often ends up being fairly large" }, { "start": 1885.86, "end": 1888.66, "text": " ish." }, { "start": 1888.66, "end": 1896.8999999999999, "text": " And also the theoretical guarantees now come with the fact that you need multiple layers." }, { "start": 1896.8999999999999, "end": 1902.02, "text": " In the worst case, you need sequence length amount of layers, which in the worst case" }, { "start": 1902.02, "end": 1907.8999999999999, "text": " would result right back into a quadratic requirement for memory and compute." }, { "start": 1907.9, "end": 1916.8600000000001, "text": " They do some engineering, some engineering tricks right here, and their results are pretty" }, { "start": 1916.8600000000001, "end": 1917.8600000000001, "text": " good." }, { "start": 1917.8600000000001, "end": 1923.0600000000002, "text": " So the results in various tasks and we'll, we'll look at some of the tasks right here." }, { "start": 1923.0600000000002, "end": 1928.7, "text": " So these are def set results using base size models." }, { "start": 1928.7, "end": 1935.18, "text": " For example, where you can see they do outperform basic Roberta models, they outperform long" }, { "start": 1935.18, "end": 1940.6200000000001, "text": " former, which may mean that the random attention is useful, but you know, in these things," }, { "start": 1940.6200000000001, "end": 1947.46, "text": " it's also always may just mean that you've thrown more compute at it." }, { "start": 1947.46, "end": 1951.5800000000002, "text": " At least I'm not really looking that they outperform the models because as you can see" }, { "start": 1951.5800000000002, "end": 1955.7, "text": " right here, if they compare to state of the art and you know, granted, these are models" }, { "start": 1955.7, "end": 1962.38, "text": " that have been trained specifically for these tasks and are crafted and engineered and Big" }, { "start": 1962.38, "end": 1969.2600000000002, "text": " Bird manages to Big Bird manages to hold itself against them in a lot of tasks and even get" }, { "start": 1969.2600000000002, "end": 1971.6200000000001, "text": " state of the art on some." }, { "start": 1971.6200000000001, "end": 1976.7, "text": " What I'm more interested in is that it, you know, it can reach good numbers." }, { "start": 1976.7, "end": 1981.38, "text": " It doesn't necessarily have to be state of the art, but it can reach good numbers, which" }, { "start": 1981.38, "end": 1989.0200000000002, "text": " tells me that, okay, probably the, the empirical hit that I take by not having the full attention" }, { "start": 1989.02, "end": 1996.58, "text": " is, you know, is justifiable by the speed up and memory savings I do get." }, { "start": 1996.58, "end": 2001.58, "text": " Yeah, especially when result, when you see results mixed like this, you know, sometimes" }, { "start": 2001.58, "end": 2007.62, "text": " the other model is good and sometimes the Big Bird is good on different variations and" }, { "start": 2007.62, "end": 2008.62, "text": " so on." }, { "start": 2008.62, "end": 2012.48, "text": " I would not, you know, I would not make a big deal out of the fact that it is state" }, { "start": 2012.48, "end": 2013.48, "text": " of the art." }, { "start": 2013.48, "end": 2014.9, "text": " I get that the authors have to do that." }, { "start": 2014.9, "end": 2022.9, "text": " I would do so as well, but you know, you don't, don't think that this is the, like the best" }, { "start": 2022.9, "end": 2023.9, "text": " thing now." }, { "start": 2023.9, "end": 2025.22, "text": " It's very probable." }, { "start": 2025.22, "end": 2028.76, "text": " They just thrown also a lot of compute at it." }, { "start": 2028.76, "end": 2032.5400000000002, "text": " What is cool is they do some genomics experiments." }, { "start": 2032.5400000000002, "end": 2039.3400000000001, "text": " So not only do they have NLP state of the art, but also they go into genomics and experiment" }, { "start": 2039.3400000000001, "end": 2040.3400000000001, "text": " with data there." }, { "start": 2040.34, "end": 2045.3799999999999, "text": " I don't want to go into that because ultimately it's another task and I believe the paper" }, { "start": 2045.3799999999999, "end": 2046.86, "text": " is about the architecture." }, { "start": 2046.86, "end": 2047.9399999999998, "text": " All right." }, { "start": 2047.9399999999998, "end": 2050.98, "text": " So that was Big Bird." }, { "start": 2050.98, "end": 2054.74, "text": " I hope you enjoyed this video and learned." }, { "start": 2054.74, "end": 2056.62, "text": " I learned something." }, { "start": 2056.62, "end": 2058.34, "text": " Certainly." }, { "start": 2058.34, "end": 2065.2999999999997, "text": " If you want to check out the proofs, they're actually pretty entertaining to read and yeah," }, { "start": 2065.2999999999997, "end": 2067.2999999999997, "text": " I'll see you next time." }, { "start": 2067.3, "end": 2071.02, "text": " Bye bye." } ]
q7PjrmGNx5A
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Self-training with Noisy Student improves ImageNet classification (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ssl", "semi-supervised", "transfer learning", "cnn", "resnet", "efficientnet", "noise", "augmentation", "data augmentation", "randaugment", "dropout", "stochastic depth", "google", "distillation", "self-training", "knowledge distillation", "imagenet", "unsupervised", "unlabeled", "unlabelled", "jft" ]
The abundance of data on the internet is vast. Especially unlabeled images are plentiful and can be collected with ease. This model investigates a new method for incorporating unlabeled data into a supervised learning pipeline. First, a teacher model is trained in a supervised fashion. Then, that teacher is used to label the unlabeled data. Next, a larger student model is trained on the combination of all data and achieves better performance than the teacher by itself. OUTLINE: 0:00 - Intro & Overview 1:05 - Semi-Supervised & Transfer Learning 5:45 - Self-Training & Knowledge Distillation 10:00 - Noisy Student Algorithm Overview 20:20 - Noise Methods 22:30 - Dataset Balancing 25:20 - Results 30:15 - Perturbation Robustness 34:35 - Ablation Studies 39:30 - Conclusion & Comments Paper: https://arxiv.org/abs/1911.04252 Code: https://github.com/google-research/noisystudent Models: https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet Abstract: We present Noisy Student Training, a semi-supervised learning approach that works well even when labeled data is abundant. Noisy Student Training achieves 88.4% top-1 accuracy on ImageNet, which is 2.0% better than the state-of-the-art model that requires 3.5B weakly labeled Instagram images. On robustness test sets, it improves ImageNet-A top-1 accuracy from 61.0% to 83.7%, reduces ImageNet-C mean corruption error from 45.7 to 28.3, and reduces ImageNet-P mean flip rate from 27.8 to 12.2. Noisy Student Training extends the idea of self-training and distillation with the use of equal-or-larger student models and noise added to the student during learning. On ImageNet, we first train an EfficientNet model on labeled images and use it as a teacher to generate pseudo labels for 300M unlabeled images. We then train a larger EfficientNet as a student model on the combination of labeled and pseudo labeled images. We iterate this process by putting back the student as the teacher. During the learning of the student, we inject noise such as dropout, stochastic depth, and data augmentation via RandAugment to the student so that the student generalizes better than the teacher. Models are available at this https URL. Code is available at this https URL. Authors: Qizhe Xie, Minh-Thang Luong, Eduard Hovy, Quoc V. Le Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at self-training with noisy student improves ImageNet classification by Qi Zi Sie, Min Tan Luong, Edward Hovey and Quoc Vy Lue. So this paper takes an ImageNet classifier that's been trained on the ImageNet data set and uses that classifier as a teacher model to label a whole bunch of unlabeled images and then it trains a student model that is larger than the original teacher model on those teacher labeled images and that turns out to improve the classification on the ImageNet validation set. Now that there is a couple of things that make this all work and today we're going to explore how this paper does it and what they say is important. If you enjoy content like this as always don't hesitate to share it out 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 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 data set and the data set will contain, let's say it's an ImageNet, it's image data set. So the data set will contain images. This is an image with like some sort of cat on it and it will contain the labels according to that. So cat. Now in semi-supervised learning you assume that, so this is supervised learning, in semi-supervised learning you assume that only part of your data set has the labels. So like only this part down here has the labels and the upper part does not have the labels. So that's semi-supervised learning. It's often the case when it's very expensive to get labels so you can only get labels for a couple of images in your data set. But very often in semi-supervised learning you still assume it's the same data set. There is a slightly different setup here that's called transfer learning. So in transfer learning what you'll have is you'll have your data set that has the labels but it's very small. So you'll notice I've drawn it smaller. That means you have very little. That is also the case when it's very expensive to get labels but also it's expensive to get the data itself. This is often the case like 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 have only this small data set but I do have this giant other data set over here. Now can't I... it's not the same. 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-train my model on X-ray data and then fine-tune it on the CT data? So that's called transfer learning usually. Now this can be done with or without labels. So it can be that for the X-ray data set you do have the labels or you don't have the labels. There are techniques for all of those. Now what we're going to look at today is kind of the situation right here. It's the transfer learning situation where you do not have the labels for this X-ray data set. But other than in this X-ray example what we're going to look at is the small data set is going to be our 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 data set 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 data set. Now what we'll try to do is somehow incorporate this unlabeled data set here into the training process to get better on the ImageNet data set. So this is the problem statement is you have the ImageNet data set and you have a second much larger data set of unlabeled images and you somehow want to make use of them. So I hope you see how this is sort of connected to the others. 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 data set is like super small. Which is not the case here and that's going to result in us being able to apply a different technique. So this different technique is called the noisy student. Now usually what you might do in a transfer learning setting is you might want to start with that big data set because that's the data set that's sizable enough to allow you to train a really big model on it and then you fine-tune and you sort of hope that the information transfers over. Here on the other hand what we want to do is we start with the ImageNet data set. So first we train this in a supervised learning fashion into our model. Now this model is going to be called the teacher model. We know how to do this, we know how to train ImageNet models. So we can train this into a teacher model that has a reasonable accuracy on the ImageNet data set. Step two we're going to take that big data set over here and use the teacher model to label the unlabeled images. So for each image coming in here the teacher will say that's a cat. So that gives you the big data set where now you have images along with labels. Just the labels aren't true labels, they're generated by the teacher. And then in the third step you train this big data set, you train on this big data set and that's what you call your student model. And then the student model in this paper 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. All the labels here come from the teacher, therefore the student shouldn't be able to outperform the teacher. But in this case the student will be able to outperform the teacher and their argument here is that this is mainly due to the fact that you use noise in this training procedure. So when you train the student what you'll do is you'll use noise and one of the types of noise is that you severely augment this data right here in order to train the student. Now we've known for a long time that data augmentation, for example in the frameworks of self-supervised learning and so on, can have a very large benefit to training. And here the fact that we incorporate this extra data and we use noise and augmentations on it is going to result in a student that can sort of learn more about the data than 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 a more robust and that's what makes it generalize better and we'll also see as we see here it's more robust to these transformations and it's also going to be more robust to adversarial perturbations. So the technique again is illustrated here as as we said it's pretty simple. First so step one step one train the teacher model with labeled data as you would. Step two you infer the pseudo labels on unlabeled data. Step three you make a student you make sorry we'll step three over here train an equal or 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 this 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 rand augment here which is a specific technique to apply these augmentations they use dropout which is a fairly old technique where you in the student model that you train you randomly drop out connections which makes it more robust and more generalizing and then you also use stochastic depth. Now stochastic depth is a technique when you train a model what you'll do during training instead of always passing your data forward through the layers like this you use some sort of a dropout but with entire layers so what you'll do is you'll pass your data forward and then randomly you'll skip a layer and then pass it forward again. Now these these might seem weird first because yeah it might seem weird but in if you know that most models especially computer vision models nowadays are residual networks which means that their layers look like so you have the input and you have some computation and then you have the output and then there is already a residual connection that basically adds the original signal together to the result of the computation. So all you do in this stochastic layer dropout or this stochastic depth right here is you basically disable you you disable this connection right here and all the signal has to flow through here. If you read the residual the ResNet original ResNet 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 noised so already in the teacher training process you want to introduce this noise you want to introduce these data augmentations these are as I said these are standard techniques to make models more robust and therefore more generalizable yeah we know from these from 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 and 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 methods and this is used the same here so already in the teacher model we train with this noise and then step two use a normal 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 will 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 0 or 1 or 2 or 3 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 datasets come right so this is what you will think first when you see that however soft pseudo labels means that the y will be a distribution so instead of being of class 0 it will be sort of let's say 90% of class 0 but also 5% class 1 and 5% class 2 right so you'll output the distribution instead of the just the label and they have found that the soft pseudo labels work slightly slightly better than the hard pseudo labels okay thanks so that they use the soft pseudo labels here because they work slightly better but you can do it with hard or soft labels the important thing is that you use the teacher to generate as accurate as possible labels for your unlabeled data then third we've already seen this learn an equal or larger student model which minimizes the cross entropy loss on labeled images and unlabeled images with noise added to the student model so as you can see labeled images and unlabeled images so we're in this semi semi supervised learning setting right now you take in both together with noise and noise here is in bold which means they stress it again this is important so you can see that the loss is composed of two different things these are the true images of your original model and you use that and this means you noise the student model and that 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 you want to sort of inject as much invariance as you can and that will make the student learn more so they say here noising student when the student is deliberately noised in its it is trained to be consistent to the teacher that is not noised when it generates the pseudo labels in our experiments we use two types of noise input noise and model noise all right first data augmentation is an important noising method in 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 so this it's a bit weird what they say here don't be confused you use the dropout and the stochastic depth on the student model and they they say here if you do this the teacher behaves like an ensemble at inference time whereas the student behaves like a single model and yeah it's it's a bit of a weird formulation but it's it's true like the teacher the teacher will produce these same the label for different pathways through the students if you use dropout and kind of stochastic depth and therefore the student is kind of required to approximate each time each forward pass has a different forward pass through the layers through the connections with dropout and it's forced to approximate that teacher label with all of these different things so you see that you you put in a lot of a lot of techniques so they have even other techniques there is one additional trick and it's not and it's not one actually they have so many tricks and if you look at their experimental setup that it's crazy like they describe exactly we reduce the learning rate like this and the batch size like this and so on so to get state-of-the-art on image net it's not enough to just have a good idea of a new thing to do what you you you have to have the good idea and then execute it almost like really well because you have to regard all of these additional tricks that people have figured out over the years in any case they say it works better with an additional trick data filtering and balancing specifically we filter images that the teacher model has low confidence on since they are usually out of domain images so that goes to a point where if you see we have this image net label data set right and we have the larger data set now the larger data set simply contains images and there is no guarantee that the images are actually of the classes that we have in the image net data set right here we have a thousand classes here there's no guarantee that these images fit into any of those classes yet we still ask the teacher model to put them in some of these classes now you can filter out part of those images if you can look at the teacher model and you look at its confidence so when it outputs a distribution if 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 image net 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 there so what they do I think where is the graphic what they do is they take an image net sorry they take an efficient net right here and they trade 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 image net 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 image net 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 image net 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 what the same model just with this different training procedure and inputting these 300 million unlabeled images that you have laying around but the all the information about all the label information comes from the image net 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 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 stressed that it's important that you up the batch size that's another thing that makes the student learn more than the teacher then we trained a new efficient net so by the way these 14 times it's also it can be done because now you have more data right so you can also up the batch size then we trained a new efficient net 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 okay so you can see that it's a fairly complicated procedure but you can gain and gain and gain by simply up upping the by simply upping the or iterating on this procedure and I think they have it somewhere here yes so as you can see if iteration one you train the efficient net L2 you started 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 point three percent improvement so there is 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 data set for example image net see you can see that there are quite a bit of distortions right here I don't even see if you can see it on this video but this is a swing so the swing right here is like something like this but you almost can't see it and you see that the bold on the left is always the prediction of their model while the thing on the right is the prediction of the original model so this model they claim is significantly more robust to these kinds of perturbations and they do an analysis of this where they show yes in fact it is so I think we've already seen this at the beginning that the noisy student is significantly more robust to these perturbations and they also test this to adversarial perturbations so right here you can see that the original model drops pretty quickly as you increase the epsilon the epsilon is kind of the strength of the adversarial perturbation and the noisy the original model drops very quickly to you know fairly low accuracy while as the noisy student training drops much much less quickly now this is another testament to the fact that what you do I think what's happening is you have your data space right and you have your data points in it now when you do the like normal data augmentation what you'll do is you not only force the model to predict those points correctly but you'll sort of make a bit of a cloud around them and you force the model to predict that cloud correctly now if you introduce more data and you do even more noise what you do is you'll make these clouds kind of larger and that means the model is more robust to any sort of perturbations in these clouds right and and that means it's probably also going to be more robust to adversarial perturbations so that's sort of how you can think of this this introduction of noise to make it more generalizable how does this generalize better so if you think of this data point right here if I'm looking to generalize that means you know I have this IID data set so probably my test data is going to be related to the training data so I might get a data point that's fairly close to that data point and generalizing means I classify it correctly now if this cloud is very small like it is here my decision boundary could be like here right and even though the terrestres data set is fairly close to the original training data point it's 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 netl2 accuracy from 1.1% to 4.4% now this I'm like you know 1.1% really means the model is almost like dead this is lower this is like random performance and 4.4% is still a bit above random performance but yeah you could probably you could probably get there by simply using any sort of noise in that 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 at ablation studies to figure out where exactly the performance comes from and the answer is it pretty much comes from all the things that they've described so here you can see the effect of that extra data set and you can see pretty much with that extra data set all the all the situations improve here you can see what do you what is happening when you do not augment the student when you do not data augment you can immediately see that the accuracy drops and then when you do not augment and also don't use these model noises then the performance drops again and lastly when you use the teacher but you noise the teacher you can see also here the performance is dropping from the original quite a bit so all of these things kind of contribute and they do much more ablations and they have listed their findings here so using a large teacher model with better performance leads to better result so you know as the original teacher you should use as good as possible a teacher model you can find second a large amount of unlabeled data is necessary for better performance okay so if you want to do this you better get a large large amount of extra data because that's one thing that makes the student perform better soft pseudo labels work better than hard pseudo labels for out of the main data in certain cases fourth a large student model is important to enable the student to learn a more powerful model okay so because usually this knowledge distillation is what it this is usually called knowledge distillation if you use a teacher model to train a student model and it is often used when the student model is smaller than the teacher because you want to kind of become more efficient to you from so the teacher is large or make the student small and you usually sacrifice some accuracy and here they say if you want to gain some accuracy you need a large student model it can't be like a small one number five data balancing is useful for small models number six joint training on labeled data and unlabeled data out performs the pipeline that first pre trains with unlabeled data and then fine-tunes on labeled data so this is in contrast to like what people have done before in the self supervised learning and so on where it's always kind of pre training then fine-tuning or in the in the transfer learning setting seven using a large ratio between unlabeled batch size and label batch size enables models to train longer on unlabeled data to it to achieve a higher accuracy okay we've already seen that they have used that and number eight training the student from scratch is sometimes better than initializing the student with the teacher and the student initialized with the teacher still requires a large number of training epochs to perform well this is fairly interesting because it kind of alludes to the fact that the minima in weight space if so if this is of course the case if the student model is the same as the teacher model so in like iteration two or three or whatnot it means that you know in weight space if we look at you know you might want to start the student here and the minimum is right here and you might want to think that if I learn the same thing then the minima are fairly close together right so the the teachers 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 teachers 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 teachers optimum okay so this was the paper and you know this is this is the type of research where I do appreciate kind of the these large labs taking it on because they have the resources to do all of these ablations all of these different models cross them with these giant data sets and so on which I guess university labs just would not have and this is a fairly thorough paper really investigating which parts of the pipeline you know do something and which ones don't and usually I I'm fairly critical of pipelines that have like 50 billion tricks because you never know where the improvement exactly is coming from but you can sort of mitigate that criticism by doing all of these kind of ablations on the different parts and really showing look this is important but this is also important but this is also important but this is also important so yeah that was my two cents to this paper I hope you enjoyed this and I'll see you next time bye bye
[ { "start": 0, "end": 4.08, "text": " Hi there, today we'll look at self-training with noisy student improves" }, { "start": 4.08, "end": 10.84, "text": " ImageNet classification by Qi Zi Sie, Min Tan Luong, Edward Hovey and Quoc Vy Lue." }, { "start": 10.84, "end": 16.14, "text": " So this paper takes an ImageNet classifier that's been trained on the" }, { "start": 16.14, "end": 21.68, "text": " ImageNet data set and uses that classifier as a teacher model to label" }, { "start": 21.68, "end": 27.240000000000002, "text": " a whole bunch of unlabeled images and then it trains a student model that is" }, { "start": 27.24, "end": 32.04, "text": " larger than the original teacher model on those teacher labeled images and that" }, { "start": 32.04, "end": 38.239999999999995, "text": " turns out to improve the classification on the ImageNet validation set. Now that" }, { "start": 38.239999999999995, "end": 44.879999999999995, "text": " there is a couple of things that make this all work and today we're going to" }, { "start": 44.879999999999995, "end": 52.08, "text": " explore how this paper does it and what they say is important. If you enjoy" }, { "start": 52.08, "end": 56.519999999999996, "text": " content like this as always don't hesitate to share it out there tell your" }, { "start": 56.52, "end": 61.720000000000006, "text": " friends about it and if you're not subscribed yet then do so. I would" }, { "start": 61.720000000000006, "end": 68.68, "text": " appreciate that and you'll get more content so win-win. So this this paper is" }, { "start": 68.68, "end": 74.92, "text": " about semi-supervised learning in effect. So it's at the intersection" }, { "start": 74.92, "end": 79.08, "text": " actually of semi-supervised learning, knowledge distillation and transfer" }, { "start": 79.08, "end": 83.08000000000001, "text": " learning. So what do we mean by semi-supervised learning? Usually in" }, { "start": 83.08, "end": 87.48, "text": " supervised learning you'll have some sort of data set and the data set will" }, { "start": 87.48, "end": 91.96, "text": " contain, let's say it's an ImageNet, it's image data set. So the data set will" }, { "start": 91.96, "end": 99.52, "text": " contain images. This is an image with like some sort of cat on it and it will" }, { "start": 99.52, "end": 106.88, "text": " contain the labels according to that. So cat. Now in semi-supervised learning you" }, { "start": 106.88, "end": 112.02, "text": " assume that, so this is supervised learning, in semi-supervised learning you" }, { "start": 112.02, "end": 117.64, "text": " assume that only part of your data set has the labels. So like only this part" }, { "start": 117.64, "end": 123.52, "text": " down here has the labels and the upper part does not have the labels. So that's" }, { "start": 123.52, "end": 127.92, "text": " semi-supervised learning. It's often the case when it's very expensive to get" }, { "start": 127.92, "end": 132.6, "text": " labels so you can only get labels for a couple of images in your data set. But" }, { "start": 132.6, "end": 136.76, "text": " very often in semi-supervised learning you still assume it's the same data set." }, { "start": 136.76, "end": 141.2, "text": " There is a slightly different setup here that's called transfer learning." }, { "start": 141.2, "end": 146.67999999999998, "text": " So in transfer learning what you'll have is you'll have your data set that has" }, { "start": 146.67999999999998, "end": 151.67999999999998, "text": " the labels but it's very small. So you'll notice I've drawn it smaller. That means" }, { "start": 151.67999999999998, "end": 156.56, "text": " you have very little. That is also the case when it's very expensive to get" }, { "start": 156.56, "end": 161.6, "text": " labels but also it's expensive to get the data itself. This is often the case" }, { "start": 161.6, "end": 167.12, "text": " like say in medical data where not only is it expensive to get labels for like a" }, { "start": 167.12, "end": 174.24, "text": " CT scan it's actually expensive to get the CT scan. So what the goal in transfer" }, { "start": 174.24, "end": 180.20000000000002, "text": " learning is is to say well I do have only this small data set but I do have" }, { "start": 180.20000000000002, "end": 186.24, "text": " this giant other data set over here. Now can't I... it's not the same." }, { "start": 186.24, "end": 191.4, "text": " Maybe they're not CT so these are CT scans. Maybe these are X-rays right?" }, { "start": 191.4, "end": 197.92000000000002, "text": " They're fairly similar. Similar technology. If you slice the CT it'll" }, { "start": 197.92000000000002, "end": 203, "text": " give you sort of an X-ray. Can I you know train my model, pre-train my model on" }, { "start": 203, "end": 211, "text": " X-ray data and then fine-tune it on the CT data? So that's called transfer" }, { "start": 211, "end": 216.12, "text": " learning usually. Now this can be done with or without labels. So it can be that" }, { "start": 216.12, "end": 220.52, "text": " for the X-ray data set you do have the labels or you don't have the labels." }, { "start": 220.52, "end": 227.52, "text": " There are techniques for all of those. Now what we're going to look at today is" }, { "start": 227.52, "end": 232.36, "text": " kind of the situation right here. It's the transfer learning situation where" }, { "start": 232.36, "end": 239.68, "text": " you do not have the labels for this X-ray data set. But other than in this" }, { "start": 239.68, "end": 244.12, "text": " X-ray example what we're going to look at is the small data set is going to be" }, { "start": 244.12, "end": 251.76, "text": " our ImageNet database. So our original picture with label database. So you'll" }, { "start": 251.76, "end": 255.64000000000001, "text": " see immediately the difference here is that in the transfer learning setting we" }, { "start": 255.64000000000001, "end": 261.48, "text": " usually assume that the data set we want to train on is fairly small. Here you" }, { "start": 261.48, "end": 269.32, "text": " know ImageNet is already sizable. But what we have is we have a much larger" }, { "start": 269.32, "end": 274.36, "text": " database of unlabeled images that we can just get from the internet. So we can" }, { "start": 274.36, "end": 279.15999999999997, "text": " scrape the internet for any kind of pictures and that will be our unlabeled" }, { "start": 279.15999999999997, "end": 283.96, "text": " data set. Now what we'll try to do is somehow incorporate this unlabeled data" }, { "start": 283.96, "end": 289.71999999999997, "text": " set here into the training process to get better on the ImageNet data set." }, { "start": 289.71999999999997, "end": 293.56, "text": " So this is the problem statement is you have the ImageNet data set and you" }, { "start": 293.56, "end": 298.48, "text": " have a second much larger data set of unlabeled images and you somehow want to" }, { "start": 298.48, "end": 302.84000000000003, "text": " make use of them. So I hope you see how this is sort of connected to the others." }, { "start": 302.84000000000003, "end": 309.32, "text": " It's essentially sort of a transfer semi-supervised learning setting but with" }, { "start": 309.32, "end": 313.76, "text": " the exception that usually in transfer learning you assume that the" }, { "start": 313.76, "end": 319.04, "text": " label data set is like super small. Which is not the case here and that's going to" }, { "start": 319.04, "end": 323.36, "text": " result in us being able to apply a different technique. So this different" }, { "start": 323.36, "end": 328.72, "text": " technique is called the noisy student. Now usually what you might do in a" }, { "start": 328.72, "end": 332.8, "text": " transfer learning setting is you might want to start with that big data set" }, { "start": 332.8, "end": 337.84000000000003, "text": " because that's the data set that's sizable enough to allow you to train a" }, { "start": 337.84000000000003, "end": 341.64, "text": " really big model on it and then you fine-tune and you sort of hope that the" }, { "start": 341.64, "end": 346.36, "text": " information transfers over. Here on the other hand what we want to do is we" }, { "start": 346.36, "end": 352.28000000000003, "text": " start with the ImageNet data set. So first we train this in a supervised" }, { "start": 352.28, "end": 356.91999999999996, "text": " learning fashion into our model. Now this model is going to be called the teacher" }, { "start": 356.91999999999996, "end": 362.23999999999995, "text": " model. We know how to do this, we know how to train ImageNet models. So we can" }, { "start": 362.23999999999995, "end": 367.84, "text": " train this into a teacher model that has a reasonable accuracy on the ImageNet" }, { "start": 367.84, "end": 374.71999999999997, "text": " data set. Step two we're going to take that big data set over here and use the" }, { "start": 374.72, "end": 383.36, "text": " teacher model to label the unlabeled images. So for each image coming" }, { "start": 383.36, "end": 394.52000000000004, "text": " in here the teacher will say that's a cat. So that gives you the big data" }, { "start": 394.52000000000004, "end": 401.12, "text": " set where now you have images along with labels. Just the labels aren't true" }, { "start": 401.12, "end": 407.56, "text": " labels, they're generated by the teacher. And then in the third step you train" }, { "start": 407.56, "end": 416, "text": " this big data set, you train on this big data set and that's what you call your" }, { "start": 416, "end": 421.76, "text": " student model. And then the student model in this paper will see how can we make" }, { "start": 421.76, "end": 426.7, "text": " it such that the student is then better at the original ImageNet task than the" }, { "start": 426.7, "end": 430.92, "text": " teacher ever was. Which seems counterintuitive at first because all of" }, { "start": 430.92, "end": 434.16, "text": " the information that the student is trained from is basically what the" }, { "start": 434.16, "end": 439.52000000000004, "text": " teacher already knows. All the labels here come from the teacher, therefore the" }, { "start": 439.52000000000004, "end": 446.96000000000004, "text": " student shouldn't be able to outperform the teacher. But in this case the student" }, { "start": 446.96000000000004, "end": 451.20000000000005, "text": " will be able to outperform the teacher and their argument here is that this is" }, { "start": 451.20000000000005, "end": 457.08000000000004, "text": " mainly due to the fact that you use noise in this training procedure. So when" }, { "start": 457.08, "end": 462.15999999999997, "text": " you train the student what you'll do is you'll use noise and one of the types of" }, { "start": 462.15999999999997, "end": 468.68, "text": " noise is that you severely augment this data right here in order to train the" }, { "start": 468.68, "end": 473.56, "text": " student. Now we've known for a long time that data augmentation, for example in" }, { "start": 473.56, "end": 478.2, "text": " the frameworks of self-supervised learning and so on, can have a very large" }, { "start": 478.2, "end": 483.84, "text": " benefit to training. And here the fact that we incorporate this extra data" }, { "start": 483.84, "end": 489.91999999999996, "text": " and we use noise and augmentations on it is going to result in a student that can" }, { "start": 489.91999999999996, "end": 499.91999999999996, "text": " sort of learn more about the data than the teacher did know. Okay this is" }, { "start": 499.91999999999996, "end": 505.28, "text": " basically it and as you can see this is kind of their main final results where" }, { "start": 505.28, "end": 510.52, "text": " they say on ImageNet our top one accuracy sort of increases right here" }, { "start": 510.52, "end": 516.92, "text": " and even on these kind of subsets of ImageNet or these are sort of corrupted" }, { "start": 516.92, "end": 522.12, "text": " sets of ImageNet they make even more substantial improvements as you can see" }, { "start": 522.12, "end": 527.1999999999999, "text": " here. Now we'll go into what these corrupted subsets are but you know just" }, { "start": 527.1999999999999, "end": 533.48, "text": " for now these here are very difficult variants of ImageNet. They can be" }, { "start": 533.48, "end": 539.36, "text": " severely corrupted or distorted and so on and you can see that the model" }, { "start": 539.36, "end": 543.6800000000001, "text": " improves severely over the previous state of the art which basically means" }, { "start": 543.6800000000001, "end": 548.44, "text": " that this model is more robust and that's a direct consequence of the noise." }, { "start": 548.44, "end": 554, "text": " Now one last thing I should say is that the student here is also larger than the" }, { "start": 554, "end": 558.48, "text": " teacher so that's also one thing that makes the student better. So what you" }, { "start": 558.48, "end": 564.1800000000001, "text": " will make is the student model is larger than the teacher model as a model as the" }, { "start": 564.18, "end": 571.92, "text": " architecture. So in combination with the noise right here with the noise in" }, { "start": 571.92, "end": 576.8, "text": " combination that means the student model is probably able to capture more of the" }, { "start": 576.8, "end": 580.56, "text": " variance of the data. It's larger it has more parameters it can learn more about" }, { "start": 580.56, "end": 587.4799999999999, "text": " the data together with the noise it can probably be a more robust and that's" }, { "start": 587.4799999999999, "end": 591.8399999999999, "text": " what makes it generalize better and we'll also see as we see here it's more" }, { "start": 591.84, "end": 595.84, "text": " robust to these transformations and it's also going to be more robust to" }, { "start": 595.84, "end": 602.84, "text": " adversarial perturbations. So the technique again is illustrated here as" }, { "start": 602.84, "end": 609.32, "text": " as we said it's pretty simple. First so step one step one train the teacher" }, { "start": 609.32, "end": 616.8000000000001, "text": " model with labeled data as you would. Step two you infer the pseudo labels on" }, { "start": 616.8, "end": 624.3599999999999, "text": " unlabeled data. Step three you make a student you make sorry we'll step three" }, { "start": 624.3599999999999, "end": 631.7199999999999, "text": " over here train an equal or a larger student model with combined data and" }, { "start": 631.7199999999999, "end": 636.9399999999999, "text": " noise injected. So they don't they use the original labeled data here and the" }, { "start": 636.9399999999999, "end": 642.12, "text": " pseudo labeled data right here in order to train the student but still this the" }, { "start": 642.12, "end": 645.8399999999999, "text": " student doesn't have more information more label information than the teacher" }, { "start": 645.84, "end": 653.6, "text": " had it simply has this teacher labeled teacher labeled unlabeled data also to" }, { "start": 653.6, "end": 659.44, "text": " train on. Now the crucial part here is well first of all that the student can" }, { "start": 659.44, "end": 663.72, "text": " be larger and second of all that there can be noise and the noise comes in" }, { "start": 663.72, "end": 668.9200000000001, "text": " three different forms. So first of all you use data augmentation which we've" }, { "start": 668.9200000000001, "end": 674.2, "text": " already seen this is sort of like random cropping or mild rotations color jitter" }, { "start": 674.2, "end": 678.6, "text": " whatever they use a rand augment here which is a specific technique to apply" }, { "start": 678.6, "end": 683.6800000000001, "text": " these augmentations they use dropout which is a fairly old technique where" }, { "start": 683.6800000000001, "end": 688.48, "text": " you in the student model that you train you randomly drop out connections which" }, { "start": 688.48, "end": 693.2800000000001, "text": " makes it more robust and more generalizing and then you also use" }, { "start": 693.2800000000001, "end": 698.44, "text": " stochastic depth. Now stochastic depth is a technique when you train a model what" }, { "start": 698.44, "end": 703.1600000000001, "text": " you'll do during training instead of always passing your data forward through" }, { "start": 703.16, "end": 709.04, "text": " the layers like this you use some sort of a dropout but with entire layers so" }, { "start": 709.04, "end": 714.64, "text": " what you'll do is you'll pass your data forward and then randomly you'll skip a" }, { "start": 714.64, "end": 719.92, "text": " layer and then pass it forward again. Now these these might seem weird first" }, { "start": 719.92, "end": 727.1999999999999, "text": " because yeah it might seem weird but in if you know that most models especially" }, { "start": 727.1999999999999, "end": 732.36, "text": " computer vision models nowadays are residual networks which means that their" }, { "start": 732.36, "end": 737.2, "text": " layers look like so you have the input and you have some computation and then" }, { "start": 737.2, "end": 742.36, "text": " you have the output and then there is already a residual connection that" }, { "start": 742.36, "end": 746.48, "text": " basically adds the original signal together to the result of the" }, { "start": 746.48, "end": 752.16, "text": " computation. So all you do in this stochastic layer dropout or this" }, { "start": 752.16, "end": 757.88, "text": " stochastic depth right here is you basically disable you you disable this" }, { "start": 757.88, "end": 763.12, "text": " connection right here and all the signal has to flow through here. If you read the" }, { "start": 763.12, "end": 767.48, "text": " residual the ResNet original ResNet paper they make it pretty clear why the" }, { "start": 767.48, "end": 772.4399999999999, "text": " residual connection is a good idea basically they say these computations" }, { "start": 772.4399999999999, "end": 777.36, "text": " here they if you have a very deep network each layer only has to basically" }, { "start": 777.36, "end": 785.56, "text": " do very a little bit of computation that that can be bypassed fairly efficiently" }, { "start": 785.56, "end": 790.5999999999999, "text": " for a lot of data points so it's not that hurtful to bypass a layer and in" }, { "start": 790.5999999999999, "end": 795.7199999999999, "text": " this case they actually use it to just bypass some of these small computations" }, { "start": 795.7199999999999, "end": 801.28, "text": " and inject some more robustness into the student model. So with these three" }, { "start": 801.28, "end": 805.9599999999999, "text": " strategies to bring noise into the training process one is on the data and" }, { "start": 805.9599999999999, "end": 812.52, "text": " two is on the student model itself they train the student model and then fourth" }, { "start": 812.52, "end": 819.6, "text": " and this is what we didn't have before four or maybe we put four here make the" }, { "start": 819.6, "end": 824.28, "text": " student a new teacher so now you can iterate you can use the student model" }, { "start": 824.28, "end": 829.4399999999999, "text": " that you just trained to again label the unlabeled data and then you can use" }, { "start": 829.4399999999999, "end": 834.88, "text": " another student model again under the influence of noise to train from that" }, { "start": 834.88, "end": 838.88, "text": " student model and so on and you can go on and they do up to like three" }, { "start": 838.88, "end": 843.36, "text": " iterations of this where they always take the new the student as the new" }, { "start": 843.36, "end": 852, "text": " teacher and then use a new student model to train from that teacher and they get" }, { "start": 852, "end": 855.58, "text": " better and better as they do this of course there's like a diminishing" }, { "start": 855.58, "end": 861.2, "text": " returns but it's pretty impressive that this even works right the new students" }, { "start": 861.2, "end": 866.2, "text": " in fact aren't even larger than the old students it's just that the students are" }, { "start": 866.2, "end": 871.08, "text": " larger than the original teacher model in most of these cases so here's the" }, { "start": 871.08, "end": 877.2, "text": " algorithm written down you'll require labeled images right here and unlabeled" }, { "start": 877.2, "end": 882.6, "text": " images which are the ones with the tilde so first you learn the teacher model" }, { "start": 882.6, "end": 886.5200000000001, "text": " which minimizes the cross entropy on labeled images this we already know this" }, { "start": 886.5200000000001, "end": 892.96, "text": " right this is the label this is the image according to the label and you" }, { "start": 892.96, "end": 898.24, "text": " train the teacher model which is this thing here and you can see here noised so" }, { "start": 898.24, "end": 902.2800000000001, "text": " already in the teacher training process you want to introduce this noise you" }, { "start": 902.2800000000001, "end": 905.44, "text": " want to introduce these data augmentations these are as I said these" }, { "start": 905.44, "end": 909.2800000000001, "text": " are standard techniques to make models more robust and therefore more" }, { "start": 909.2800000000001, "end": 916.24, "text": " generalizable yeah we know from these from these self-supervised papers that" }, { "start": 916.24, "end": 922.2800000000001, "text": " these augmentations are very powerful and the way you design them basically if" }, { "start": 922.28, "end": 926, "text": " you one of these augmentations is a random crop which means if you have an" }, { "start": 926, "end": 931.12, "text": " image you randomly crop out like part of that image and then that's your training" }, { "start": 931.12, "end": 938.36, "text": " sample and not the entire thing so by doing this you basically teaching the" }, { "start": 938.36, "end": 943.8, "text": " model to ignore the exact location and scale of things on an image and you can" }, { "start": 943.8, "end": 947.4399999999999, "text": " do this because you as a human know that you know I can zoom in I can zoom out" }, { "start": 947.44, "end": 953.6800000000001, "text": " into something and it won't change what's on the picture and so that's you" }, { "start": 953.6800000000001, "end": 957.32, "text": " use these augmentations to kind of heuristically tell the model what it" }, { "start": 957.32, "end": 962.9200000000001, "text": " should be invariant to and that is that is a very powerful technique to" }, { "start": 962.9200000000001, "end": 969.24, "text": " regularize basically to to robustify these deep methods and this is used" }, { "start": 969.24, "end": 975.6, "text": " the same here so already in the teacher model we train with this noise and then" }, { "start": 975.6, "end": 981.16, "text": " step two use a normal ie not noise teacher model to generate soft or hard" }, { "start": 981.16, "end": 985.88, "text": " pseudo labels for the clean ie not distorted unlabeled images and this is" }, { "start": 985.88, "end": 991.48, "text": " important they stress this here that when you when you label the unlabeled" }, { "start": 991.48, "end": 997.6, "text": " images you want to use the model that is without the noise and you do it on the" }, { "start": 997.6, "end": 1002.8000000000001, "text": " not distorted unlabeled images so when you infer the labels it's very important" }, { "start": 1002.8, "end": 1008.5999999999999, "text": " that you have clean accurate labels without any sort of noise in them so" }, { "start": 1008.5999999999999, "end": 1013.7199999999999, "text": " label noise is not something that they have found to help in this case so not" }, { "start": 1013.7199999999999, "end": 1019, "text": " label noise on the teacher that is so you can see right here on the unlabeled" }, { "start": 1019, "end": 1024.72, "text": " images will use that teacher model without the noise to infer the labels" }, { "start": 1024.72, "end": 1030.3999999999999, "text": " now they say these can be hard model hard labels or soft labels so what does" }, { "start": 1030.4, "end": 1036.2, "text": " that mean if we generate hard pseudo labels that means that the y here is" }, { "start": 1036.2, "end": 1041.72, "text": " simply going to be either 0 or 1 or 2 or 3 and so on so just the index of the" }, { "start": 1041.72, "end": 1045.7, "text": " class whichever class is most likely that's going to be our label this is" }, { "start": 1045.7, "end": 1051.2800000000002, "text": " exactly how the supervised datasets come right so this is what you will think" }, { "start": 1051.2800000000002, "end": 1056.96, "text": " first when you see that however soft pseudo labels means that the y will be a" }, { "start": 1056.96, "end": 1065.04, "text": " distribution so instead of being of class 0 it will be sort of let's say 90%" }, { "start": 1065.04, "end": 1073.8, "text": " of class 0 but also 5% class 1 and 5% class 2 right so you'll output the" }, { "start": 1073.8, "end": 1079.92, "text": " distribution instead of the just the label and they have found that the soft" }, { "start": 1079.92, "end": 1087.04, "text": " pseudo labels work slightly slightly better than the hard pseudo labels okay" }, { "start": 1087.04, "end": 1095.28, "text": " thanks so that they use the soft pseudo labels here because they work slightly" }, { "start": 1095.28, "end": 1099.3200000000002, "text": " better but you can do it with hard or soft labels the important thing is that" }, { "start": 1099.3200000000002, "end": 1105.1200000000001, "text": " you use the teacher to generate as accurate as possible labels for your" }, { "start": 1105.12, "end": 1111.2399999999998, "text": " unlabeled data then third we've already seen this learn an equal or larger" }, { "start": 1111.2399999999998, "end": 1115.6799999999998, "text": " student model which minimizes the cross entropy loss on labeled images and" }, { "start": 1115.6799999999998, "end": 1121.9599999999998, "text": " unlabeled images with noise added to the student model so as you can see labeled" }, { "start": 1121.9599999999998, "end": 1127.3, "text": " images and unlabeled images so we're in this semi semi supervised learning" }, { "start": 1127.3, "end": 1133, "text": " setting right now you take in both together with noise and noise here is in" }, { "start": 1133, "end": 1137.88, "text": " bold which means they stress it again this is important so you can see that" }, { "start": 1137.88, "end": 1143.68, "text": " the loss is composed of two different things these are the true images of your" }, { "start": 1143.68, "end": 1151, "text": " original model and you use that and this means you noise the student model and" }, { "start": 1151, "end": 1157.08, "text": " that that noise can be on the data or in the model itself and here also the" }, { "start": 1157.08, "end": 1161.6, "text": " unlabeled images that you have labeled with the teacher you do the exact same" }, { "start": 1161.6, "end": 1167.12, "text": " thing so you train on both of these data sets and step four is if you want to do" }, { "start": 1167.12, "end": 1173.8799999999999, "text": " iterative training use the student as a teacher and go back to step two now they" }, { "start": 1173.8799999999999, "end": 1179.1, "text": " have some more tricks when they do this iterative training they also up the" }, { "start": 1179.1, "end": 1183.8799999999999, "text": " batch size during the iterative training and so on so they do a lot of things to" }, { "start": 1183.8799999999999, "end": 1189.48, "text": " make the student learn something more something better than the teacher and I" }, { "start": 1189.48, "end": 1194.4, "text": " think this the whole paper it doesn't it doesn't state it explicitly but I think" }, { "start": 1194.4, "end": 1200.08, "text": " the whole paper everything they do here is to kind of force or allow the student" }, { "start": 1200.08, "end": 1205.1200000000001, "text": " to become better than the teacher by by giving more noise by making the student" }, { "start": 1205.1200000000001, "end": 1210.96, "text": " larger by making the batch size for the student larger and so on so you you want" }, { "start": 1210.96, "end": 1217.84, "text": " to sort of inject as much invariance as you can and that will make the student" }, { "start": 1217.84, "end": 1226.6399999999999, "text": " learn more so they say here noising student when the student is deliberately" }, { "start": 1226.6399999999999, "end": 1232.52, "text": " noised in its it is trained to be consistent to the teacher that is not" }, { "start": 1232.52, "end": 1237.6, "text": " noised when it generates the pseudo labels in our experiments we use two" }, { "start": 1237.6, "end": 1247.12, "text": " types of noise input noise and model noise all right first data augmentation" }, { "start": 1247.12, "end": 1251.1599999999999, "text": " is an important noising method in noisy student training because it forces the" }, { "start": 1251.1599999999999, "end": 1256.56, "text": " student to ensure prediction consistency across augmented versions of an image" }, { "start": 1256.56, "end": 1260.6399999999999, "text": " specifically in our method the teacher produces high quality pseudo labels by" }, { "start": 1260.6399999999999, "end": 1264.76, "text": " reading in clean images while the student is required to produce to" }, { "start": 1264.76, "end": 1272.04, "text": " reproduce those labels with augmented images as an input second when dropout" }, { "start": 1272.04, "end": 1278.04, "text": " and stochastic depth function are used as noise the teacher behaves like an" }, { "start": 1278.04, "end": 1282.12, "text": " ensemble at inference time when it generates pseudo labels whereas the" }, { "start": 1282.12, "end": 1286.72, "text": " student behaves like a single model in other words the student is forced to" }, { "start": 1286.72, "end": 1292.1599999999999, "text": " mimic a more powerful ensemble model we present an ablation study so this it's a" }, { "start": 1292.1599999999999, "end": 1297.52, "text": " bit weird what they say here don't be confused you use the dropout and the" }, { "start": 1297.52, "end": 1303.6399999999999, "text": " stochastic depth on the student model and they they say here if you do this" }, { "start": 1303.6399999999999, "end": 1309.36, "text": " the teacher behaves like an ensemble at inference time whereas the student" }, { "start": 1309.36, "end": 1314.32, "text": " behaves like a single model and yeah it's it's a bit of a weird formulation" }, { "start": 1314.32, "end": 1320.04, "text": " but it's it's true like the teacher the teacher will produce these same the" }, { "start": 1320.04, "end": 1325.72, "text": " label for different pathways through the students if you use dropout and kind of" }, { "start": 1325.72, "end": 1330.16, "text": " stochastic depth and therefore the student is kind of required to" }, { "start": 1330.16, "end": 1335.1200000000001, "text": " approximate each time each forward pass has a different forward pass through the" }, { "start": 1335.1200000000001, "end": 1338.76, "text": " layers through the connections with dropout and it's forced to approximate" }, { "start": 1338.76, "end": 1345.08, "text": " that teacher label with all of these different things so you see that you you" }, { "start": 1345.08, "end": 1351.52, "text": " put in a lot of a lot of techniques so they have even other techniques there is" }, { "start": 1351.52, "end": 1356.48, "text": " one additional trick and it's not and it's not one actually they have so many" }, { "start": 1356.48, "end": 1360.16, "text": " tricks and if you look at their experimental setup that it's crazy like" }, { "start": 1360.16, "end": 1363.96, "text": " they describe exactly we reduce the learning rate like this and the batch" }, { "start": 1363.96, "end": 1368.4, "text": " size like this and so on so to get state-of-the-art on image net it's not" }, { "start": 1368.4, "end": 1374.24, "text": " enough to just have a good idea of a new thing to do what you you you have to" }, { "start": 1374.24, "end": 1380.2, "text": " have the good idea and then execute it almost like really well because you have" }, { "start": 1380.2, "end": 1385.04, "text": " to regard all of these additional tricks that people have figured out over the" }, { "start": 1385.04, "end": 1389.88, "text": " years in any case they say it works better with an additional trick data" }, { "start": 1389.88, "end": 1395.2, "text": " filtering and balancing specifically we filter images that the teacher model has" }, { "start": 1395.2, "end": 1400.04, "text": " low confidence on since they are usually out of domain images so that goes to a" }, { "start": 1400.04, "end": 1405.44, "text": " point where if you see we have this image net label data set right and we" }, { "start": 1405.44, "end": 1411.04, "text": " have the larger data set now the larger data set simply contains images and" }, { "start": 1411.04, "end": 1415.72, "text": " there is no guarantee that the images are actually of the classes that we have" }, { "start": 1415.72, "end": 1420.48, "text": " in the image net data set right here we have a thousand classes here there's no" }, { "start": 1420.48, "end": 1426.1200000000001, "text": " guarantee that these images fit into any of those classes yet we still ask the" }, { "start": 1426.1200000000001, "end": 1432.3200000000002, "text": " teacher model to put them in some of these classes now you can filter out" }, { "start": 1432.32, "end": 1438.9199999999998, "text": " part of those images if you can look at the teacher model and you look at its" }, { "start": 1438.9199999999998, "end": 1442.8799999999999, "text": " confidence so when it outputs a distribution if if there's just two" }, { "start": 1442.8799999999999, "end": 1446.72, "text": " labels let's say if it outputs a distribution like this that's wildly" }, { "start": 1446.72, "end": 1451.72, "text": " different than if it outputs a distribution like this both are class" }, { "start": 1451.72, "end": 1456.3999999999999, "text": " one labels but one is much more confident than the other so what you" }, { "start": 1456.3999999999999, "end": 1461.36, "text": " want to do is you want to filter out these low confidence labels because you" }, { "start": 1461.36, "end": 1465.8, "text": " know the model isn't really sure but it has to assign a class but that's usually" }, { "start": 1465.8, "end": 1471.4399999999998, "text": " an indication that it is an out of domain image so if they filter this it" }, { "start": 1471.4399999999998, "end": 1476.6399999999999, "text": " works better and then also to ensure that the distribution of the unlabeled" }, { "start": 1476.6399999999999, "end": 1481.4799999999998, "text": " images match that of the training set we also need to balance the number of" }, { "start": 1481.4799999999998, "end": 1485.6799999999998, "text": " unlabeled images for each class as all classes in image net have a similar" }, { "start": 1485.6799999999998, "end": 1489.8, "text": " number of labeled images for this purpose we duplicate images in classes" }, { "start": 1489.8, "end": 1494.28, "text": " where there are not enough images for classes where we have too many images we" }, { "start": 1494.28, "end": 1501, "text": " take the images with the highest confidence okay so this is just another" }, { "start": 1501, "end": 1505.3999999999999, "text": " technique this has basically nothing to do with their core idea but this is just" }, { "start": 1505.3999999999999, "end": 1512.32, "text": " another thing where they say okay we can treat this big thing that we scrape from" }, { "start": 1512.32, "end": 1516.48, "text": " the internet you know we can somehow filter and balance it smartly and that" }, { "start": 1516.48, "end": 1528.3600000000001, "text": " will work even better alright so let's go into the experiments of course there" }, { "start": 1528.3600000000001, "end": 1534.84, "text": " so what they do I think where is the graphic what they do is they take an" }, { "start": 1534.84, "end": 1543.3600000000001, "text": " image net sorry they take an efficient net right here and they trade they first" }, { "start": 1543.36, "end": 1549.6399999999999, "text": " train an efficient net a smaller efficient net as we said for to be the" }, { "start": 1549.6399999999999, "end": 1559.6799999999998, "text": " teacher and then they train a larger efficient net for the student the best" }, { "start": 1559.6799999999998, "end": 1564.32, "text": " model in our experiments is a result of three iterations of putting back the" }, { "start": 1564.32, "end": 1569.28, "text": " student as a new teacher we first train an efficient net B7 on image net as the" }, { "start": 1569.28, "end": 1575.36, "text": " teacher model so you can see in the table right here what the B7 achieves the" }, { "start": 1575.36, "end": 1579.92, "text": " efficient net B7 here you can see it has 66 million parameters which is fairly" }, { "start": 1579.92, "end": 1584.04, "text": " small compared to these other kind of previous state-of-the-art methods on" }, { "start": 1584.04, "end": 1589.24, "text": " image net right so they first train this and that will achieve something like an" }, { "start": 1589.24, "end": 1596.04, "text": " 85% accuracy now if you just train a larger model this efficient net L2 right" }, { "start": 1596.04, "end": 1600.36, "text": " here that has you can see 480 million parameters so a lot of more million" }, { "start": 1600.36, "end": 1605.04, "text": " parameters but you just train it on the same data set on image net you will get" }, { "start": 1605.04, "end": 1612.52, "text": " a 0.5% improvement and you can see that here with noisy student training with" }, { "start": 1612.52, "end": 1616.84, "text": " the exact same model so it has the same amount of parameters you'll actually get" }, { "start": 1616.84, "end": 1623.84, "text": " an 88.4 so I like a more than a 3% improvement and that's what the same" }, { "start": 1623.84, "end": 1628.8799999999999, "text": " model just with this different training procedure and inputting these 300" }, { "start": 1628.8799999999999, "end": 1634.04, "text": " million unlabeled images that you have laying around but the all the" }, { "start": 1634.04, "end": 1639.48, "text": " information about all the label information comes from the image net" }, { "start": 1639.48, "end": 1645.1999999999998, "text": " data set and comes from this efficient net B7 teacher model so that's" }, { "start": 1645.1999999999998, "end": 1651.32, "text": " basically you can it's a testament that out of this out of this 85 you can make" }, { "start": 1651.32, "end": 1657.12, "text": " this 88 just by smartly using the information that the model that this" }, { "start": 1657.12, "end": 1663.1599999999999, "text": " model has learned about the data and transferring it to new data so they" }, { "start": 1663.1599999999999, "end": 1668.46, "text": " train an efficient net B7 that's the small model as a teacher model then by" }, { "start": 1668.46, "end": 1673.76, "text": " using the B7 model as the teacher we trained an efficient net L2 model with" }, { "start": 1673.76, "end": 1679.6399999999999, "text": " the unlabeled batch size set to 14 times the labeled batch size and they stressed" }, { "start": 1679.64, "end": 1683.5200000000002, "text": " that it's important that you up the batch size that's another thing that" }, { "start": 1683.5200000000002, "end": 1689.5400000000002, "text": " makes the student learn more than the teacher then we trained a new efficient" }, { "start": 1689.5400000000002, "end": 1694.48, "text": " net so by the way these 14 times it's also it can be done because now you" }, { "start": 1694.48, "end": 1700.64, "text": " have more data right so you can also up the batch size then we trained a new" }, { "start": 1700.64, "end": 1705.64, "text": " efficient net L2 model with the efficient net L2 model as the teacher" }, { "start": 1705.64, "end": 1710.6000000000001, "text": " lastly we iterated again and used an unlabeled batch size of 28 times the" }, { "start": 1710.6000000000001, "end": 1714.88, "text": " labeled batch size the detailed result of the three iterations and so okay so" }, { "start": 1714.88, "end": 1718.72, "text": " you can see that it's a fairly complicated procedure but you can gain" }, { "start": 1718.72, "end": 1727.6000000000001, "text": " and gain and gain by simply up upping the by simply upping the or iterating on" }, { "start": 1727.6000000000001, "end": 1733.48, "text": " this procedure and I think they have it somewhere here yes so as you can see if" }, { "start": 1733.48, "end": 1740.08, "text": " iteration one you train the efficient net L2 you started with the B7 you" }, { "start": 1740.08, "end": 1745.16, "text": " train the efficient at a two with a batch size 14 times larger and you gain" }, { "start": 1745.16, "end": 1750.46, "text": " significantly right this gains about 2% over the original efficient net then you" }, { "start": 1750.46, "end": 1758.32, "text": " iterate again with the same batch size and you get like a 5.5% improvement and" }, { "start": 1758.32, "end": 1761.56, "text": " you iterate again with an even larger batch size and you get a point three" }, { "start": 1761.56, "end": 1765.34, "text": " percent improvement so there is diminishing returns but still you can" }, { "start": 1765.34, "end": 1768.9199999999998, "text": " see that you know the more with the introduction of noise with the" }, { "start": 1768.9199999999998, "end": 1772.08, "text": " introduction of the larger model with the introduction of the larger batch" }, { "start": 1772.08, "end": 1777.12, "text": " size these are all things that help the student basically become better than the" }, { "start": 1777.12, "end": 1782.9199999999998, "text": " teacher all right so they do a bunch of other experiments so their main" }, { "start": 1782.9199999999998, "end": 1791.32, "text": " comparison is right here where they say look if we if even if we train the" }, { "start": 1791.32, "end": 1796.52, "text": " same model with this noisy student training we can make you know pretty" }, { "start": 1796.52, "end": 1802.6799999999998, "text": " large gains over the model over the same model where we do not train it with this" }, { "start": 1802.6799999999998, "end": 1808.3999999999999, "text": " noisy student training so this really seems to help you know due to the noise" }, { "start": 1808.3999999999999, "end": 1815.2, "text": " due to the additional data they do a lot of ablation studies so that's pretty" }, { "start": 1815.2, "end": 1820.6399999999999, "text": " interesting and they also do these studies on this special image net data" }, { "start": 1820.64, "end": 1824, "text": " set for example image net see you can see that there are quite a bit of" }, { "start": 1824, "end": 1827.92, "text": " distortions right here I don't even see if you can see it on this video but this" }, { "start": 1827.92, "end": 1835.5600000000002, "text": " is a swing so the swing right here is like something like this but you almost" }, { "start": 1835.5600000000002, "end": 1840.3200000000002, "text": " can't see it and you see that the bold on the left is always the prediction of" }, { "start": 1840.3200000000002, "end": 1844.96, "text": " their model while the thing on the right is the prediction of the original model" }, { "start": 1844.96, "end": 1850.24, "text": " so this model they claim is significantly more robust to these kinds" }, { "start": 1850.24, "end": 1857.24, "text": " of perturbations and they do an analysis of this where they show yes in fact it" }, { "start": 1857.24, "end": 1864.84, "text": " is so I think we've already seen this at the beginning that the noisy student is" }, { "start": 1864.84, "end": 1869.52, "text": " significantly more robust to these perturbations and they also test this to" }, { "start": 1869.52, "end": 1874.36, "text": " adversarial perturbations so right here you can see that the original model" }, { "start": 1874.36, "end": 1878.8, "text": " drops pretty quickly as you increase the epsilon the epsilon is kind of the" }, { "start": 1878.8, "end": 1884.44, "text": " strength of the adversarial perturbation and the noisy the original model drops" }, { "start": 1884.44, "end": 1891.04, "text": " very quickly to you know fairly low accuracy while as the noisy student" }, { "start": 1891.04, "end": 1899.1399999999999, "text": " training drops much much less quickly now this is another testament to the" }, { "start": 1899.1399999999999, "end": 1904.12, "text": " fact that what you do I think what's happening is you have your data space" }, { "start": 1904.12, "end": 1911.08, "text": " right and you have your data points in it now when you do the like normal data" }, { "start": 1911.08, "end": 1915.3999999999999, "text": " augmentation what you'll do is you not only force the model to predict those" }, { "start": 1915.3999999999999, "end": 1920.04, "text": " points correctly but you'll sort of make a bit of a cloud around them and you" }, { "start": 1920.04, "end": 1927.32, "text": " force the model to predict that cloud correctly now if you introduce more data" }, { "start": 1927.32, "end": 1934, "text": " and you do even more noise what you do is you'll make these clouds kind of" }, { "start": 1934, "end": 1939.52, "text": " larger and that means the model is more robust to any sort of perturbations in" }, { "start": 1939.52, "end": 1943.8, "text": " these clouds right and and that means it's probably also going to be more" }, { "start": 1943.8, "end": 1949, "text": " robust to adversarial perturbations so that's sort of how you can think of this" }, { "start": 1949, "end": 1953.6, "text": " this introduction of noise to make it more generalizable how does this" }, { "start": 1953.6, "end": 1957.84, "text": " generalize better so if you think of this data point right here if I'm" }, { "start": 1957.84, "end": 1962.84, "text": " looking to generalize that means you know I have this IID data set so" }, { "start": 1962.84, "end": 1968.04, "text": " probably my test data is going to be related to the training data so I might" }, { "start": 1968.04, "end": 1974.56, "text": " get a data point that's fairly close to that data point and generalizing means I" }, { "start": 1974.56, "end": 1979.8, "text": " classify it correctly now if this cloud is very small like it is here my decision" }, { "start": 1979.8, "end": 1985.96, "text": " boundary could be like here right and even though the terrestres data set is" }, { "start": 1985.96, "end": 1991.56, "text": " fairly close to the original training data point it's it won't be classified" }, { "start": 1991.56, "end": 1997.44, "text": " incorrectly however if my original cloud during training is larger you can see if" }, { "start": 1997.44, "end": 2002.52, "text": " I train a model it can maybe put the decision boundary here and then my test" }, { "start": 2002.52, "end": 2008.12, "text": " data point will be included in on that same side so that's kind of the idea" }, { "start": 2008.12, "end": 2012.84, "text": " behind generalizing better of course that's a vast simplification and also" }, { "start": 2012.84, "end": 2018.6, "text": " to say that this here is an FGSM attack so this is kind of the weakest attack in" }, { "start": 2018.6, "end": 2025.7199999999998, "text": " the adversarial perturbation spectrum they do say under a stronger attack" }, { "start": 2025.7199999999998, "end": 2031, "text": " PGD which is a fairly strong attack with 10 iterations at epsilon equals 16" }, { "start": 2031, "end": 2037.2399999999998, "text": " noisy student training improves efficient netl2 accuracy from 1.1% to 4.4%" }, { "start": 2037.24, "end": 2046.36, "text": " now this I'm like you know 1.1% really means the model is almost like dead" }, { "start": 2046.36, "end": 2053.32, "text": " this is lower this is like random performance and 4.4% is still a bit above" }, { "start": 2053.32, "end": 2059.76, "text": " random performance but yeah you could probably you could probably get there by" }, { "start": 2059.76, "end": 2066, "text": " simply using any sort of noise in that case but still you can see that it is" }, { "start": 2066, "end": 2072.6, "text": " more robust to especially to natural distortions and therefore it generalizes" }, { "start": 2072.6, "end": 2079.52, "text": " better as I said they do quite a bit of drop sorry not drop out at ablation" }, { "start": 2079.52, "end": 2086.04, "text": " studies to figure out where exactly the performance comes from and the answer is" }, { "start": 2086.04, "end": 2090.84, "text": " it pretty much comes from all the things that they've described so here you can" }, { "start": 2090.84, "end": 2096.76, "text": " see the effect of that extra data set and you can see pretty much with that" }, { "start": 2096.76, "end": 2102.36, "text": " extra data set all the all the situations improve here you can see what" }, { "start": 2102.36, "end": 2108.52, "text": " do you what is happening when you do not augment the student when you do not data" }, { "start": 2108.52, "end": 2113.44, "text": " augment you can immediately see that the accuracy drops and then when you do not" }, { "start": 2113.44, "end": 2118.6400000000003, "text": " augment and also don't use these model noises then the performance drops again" }, { "start": 2118.64, "end": 2124.16, "text": " and lastly when you use the teacher but you noise the teacher you can see also" }, { "start": 2124.16, "end": 2130.4, "text": " here the performance is dropping from the original quite a bit so all of these" }, { "start": 2130.4, "end": 2135.2599999999998, "text": " things kind of contribute and they do much more ablations and they have listed" }, { "start": 2135.2599999999998, "end": 2141.12, "text": " their findings here so using a large teacher model with better performance" }, { "start": 2141.12, "end": 2146.4, "text": " leads to better result so you know as the original teacher you should use as" }, { "start": 2146.4, "end": 2153.48, "text": " good as possible a teacher model you can find second a large amount of unlabeled" }, { "start": 2153.48, "end": 2161.44, "text": " data is necessary for better performance okay so if you want to do this you better" }, { "start": 2161.44, "end": 2167.28, "text": " get a large large amount of extra data because that's one thing that makes the" }, { "start": 2167.28, "end": 2172.1600000000003, "text": " student perform better soft pseudo labels work better than hard pseudo" }, { "start": 2172.16, "end": 2178.08, "text": " labels for out of the main data in certain cases fourth a large student" }, { "start": 2178.08, "end": 2183.72, "text": " model is important to enable the student to learn a more powerful model okay so" }, { "start": 2183.72, "end": 2189.44, "text": " because usually this knowledge distillation is what it this is usually" }, { "start": 2189.44, "end": 2193.96, "text": " called knowledge distillation if you use a teacher model to train a student model" }, { "start": 2193.96, "end": 2198.08, "text": " and it is often used when the student model is smaller than the teacher" }, { "start": 2198.08, "end": 2201.7599999999998, "text": " because you want to kind of become more efficient to you from so the teacher is" }, { "start": 2201.76, "end": 2207.92, "text": " large or make the student small and you usually sacrifice some accuracy and here" }, { "start": 2207.92, "end": 2212, "text": " they say if you want to gain some accuracy you need a large student model" }, { "start": 2212, "end": 2219.48, "text": " it can't be like a small one number five data balancing is useful for small" }, { "start": 2219.48, "end": 2224.76, "text": " models number six joint training on labeled data and unlabeled data out" }, { "start": 2224.76, "end": 2229.1200000000003, "text": " performs the pipeline that first pre trains with unlabeled data and then" }, { "start": 2229.12, "end": 2234.24, "text": " fine-tunes on labeled data so this is in contrast to like what people have done" }, { "start": 2234.24, "end": 2239.3599999999997, "text": " before in the self supervised learning and so on where it's always kind of" }, { "start": 2239.3599999999997, "end": 2244.56, "text": " pre training then fine-tuning or in the in the transfer learning setting seven" }, { "start": 2244.56, "end": 2249.2, "text": " using a large ratio between unlabeled batch size and label batch size enables" }, { "start": 2249.2, "end": 2256.24, "text": " models to train longer on unlabeled data to it to achieve a higher accuracy okay" }, { "start": 2256.24, "end": 2260.56, "text": " we've already seen that they have used that and number eight training the" }, { "start": 2260.56, "end": 2265, "text": " student from scratch is sometimes better than initializing the student with the" }, { "start": 2265, "end": 2269.4399999999996, "text": " teacher and the student initialized with the teacher still requires a large" }, { "start": 2269.4399999999996, "end": 2274.4799999999996, "text": " number of training epochs to perform well this is fairly interesting because" }, { "start": 2274.4799999999996, "end": 2281.04, "text": " it kind of alludes to the fact that the minima in weight space if so if this is" }, { "start": 2281.04, "end": 2285.56, "text": " of course the case if the student model is the same as the teacher model so in" }, { "start": 2285.56, "end": 2292.2799999999997, "text": " like iteration two or three or whatnot it means that you know in weight space" }, { "start": 2292.2799999999997, "end": 2297.52, "text": " if we look at you know you might want to start the student here and the minimum" }, { "start": 2297.52, "end": 2304.2, "text": " is right here and you might want to think that if I learn the same thing then" }, { "start": 2304.2, "end": 2308.9, "text": " the minima are fairly close together right so the the teachers minima might" }, { "start": 2308.9, "end": 2313.32, "text": " be here and the student minima might be fairly close so it might be beneficial" }, { "start": 2313.32, "end": 2318.52, "text": " if I if I start not over here but actually start at the teachers minimum" }, { "start": 2318.52, "end": 2322.6000000000004, "text": " but this doesn't always seem to be the case and that is a fairly interesting" }, { "start": 2322.6000000000004, "end": 2326.52, "text": " observation because it kind of means that we're talking about different" }, { "start": 2326.52, "end": 2331.28, "text": " minima here we're talking about the student model learning different things" }, { "start": 2331.28, "end": 2335.6800000000003, "text": " and that's what we've discussed already the student model kind of learns to be" }, { "start": 2335.6800000000003, "end": 2341.6800000000003, "text": " robust and that's probably a minimum that's fairly far away in weight space" }, { "start": 2341.68, "end": 2346.68, "text": " at least in in a sort of energy landscape weight space might be the case" }, { "start": 2346.68, "end": 2351.96, "text": " that it needs to actually overcome kind of a hill here even though the minimum" }, { "start": 2351.96, "end": 2356.44, "text": " might be close there's lots of research in like how minima are distributed in" }, { "start": 2356.44, "end": 2361.7999999999997, "text": " these weight spaces which I don't want to go into right here but it is a fairly" }, { "start": 2361.7999999999997, "end": 2365.7599999999998, "text": " interesting observation that it's not always helpful to initialize the" }, { "start": 2365.76, "end": 2374.28, "text": " teacher sorry the student at the teachers optimum okay so this was the" }, { "start": 2374.28, "end": 2379.6400000000003, "text": " paper and you know this is this is the type of research where I do appreciate" }, { "start": 2379.6400000000003, "end": 2384.28, "text": " kind of the these large labs taking it on because they have the resources to do" }, { "start": 2384.28, "end": 2388.36, "text": " all of these ablations all of these different models cross them with these" }, { "start": 2388.36, "end": 2394.5600000000004, "text": " giant data sets and so on which I guess university labs just would not have and" }, { "start": 2394.56, "end": 2400.04, "text": " this is a fairly thorough paper really investigating which parts of the" }, { "start": 2400.04, "end": 2406.48, "text": " pipeline you know do something and which ones don't and usually I I'm fairly" }, { "start": 2406.48, "end": 2411.72, "text": " critical of pipelines that have like 50 billion tricks because you never know" }, { "start": 2411.72, "end": 2416.68, "text": " where the improvement exactly is coming from but you can sort of mitigate that" }, { "start": 2416.68, "end": 2421.7599999999998, "text": " criticism by doing all of these kind of ablations on the different parts and" }, { "start": 2421.76, "end": 2425.1600000000003, "text": " really showing look this is important but this is also important but this is" }, { "start": 2425.1600000000003, "end": 2430.28, "text": " also important but this is also important so yeah that was my two cents" }, { "start": 2430.28, "end": 2452.6400000000003, "text": " to this paper I hope you enjoyed this and I'll see you next time bye bye" } ]
rFwQDDbYTm4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Classic] Playing Atari with Deep Reinforcement Learning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "dqn", "deep q learning", "deep q networks", "q learning", "qlearning", "rl", "drl", "deep rl", "deep reinforcement learning", "deepmind", "david silver", "atari", "pong", "breakout", "space invaders", "agent", "cnn", "convolutional neural network", "bellman" ]
#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 Mn. et al. of DeepMind. So this is another one of our series of impactful past papers. This paper right here kicked off an entire revolution in reinforcement learning. Specifically, it sort of started the deep reinforcement learning hype. Before that, reinforcement learning was kind of this weird field of Markov decision processes and so on. Now, I know there were successes and all and stuff was happening. But this really made a lot of waves because it brought the power of deep neural networks to reinforcement learning. And with a pretty simple application of convolutional networks, managed to solve these reinforcement learning games where previous algorithms really couldn't either or were heavily reliant on hand engineered features. So we'll take a look here and what people did back then, what was the state of the art and what they are telling us about that. Kind of set it in relation to today. Alright, if you do like papers like this, commentary like this, share it out, leave a like and tell me in the comments what you think. So let's dive in. They say we present the first deep learning model to successfully learn control policies directly from high dimensional sensory input using reinforcement learning. The model is a convolutional neural network trained with a variant of Q learning whose input is raw pixels and whose output is a value value function estimating future rewards. We apply our method to seven Atari 2600 games from the arcade learning environment with no adjustment of the architecture or learning algorithm. We find that it outperforms all approaches on six of the games and surpasses a human expert on three of them. So there's a lot packed into this. First of all, I wanted to recognize the absolute LaTeX savagery right here. Yeah, you know, it's just just something. I'm not OCD about that kind of stuff. I think we should ditch LaTeX honestly. But so there's a lot of information packed in this abstract right here. So they say this is the first deep learning model to learn control policies. So that's the task of these reinforcement learning algorithms directly from high dimensional sensory input using using reinforcement learning. So what do they mean this are called learning environment if you don't know what it is, it's basically these old games right here, you can kind of emulate them and run them. And the inputs are always sort of the same. So you have one joystick, I believe. So you have kind of this joystick and it can go into various directions like left, right, up, down, and then also the intermediate directions. And then you have a I think also a button that you can push. And that gives you a total of some somewhere around 16 or 20 actions in each of the games. So the good thing about this environment is that the actions are always the same. But of course, they mean different things in different games. So the games here, you know, for example, pong, or this breakout, 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 is could be, you know, it could be this, you scored a goal. So that's zero most of the time. And sometimes it's one or, or nine. Or it could be like how long you're alive and so on. This is very, very, very variable. So the difficulty of reinforcement learning very often is that these episodes can go for a while. So this whole process here will repeat over time. And the this can go on for hundreds of steps or 1000s of steps until you're done, you know, playing a game like this, like this right here. And the reward can be very sparse. So you might only get a reward at the very end of the game. Sometimes, most often in these games, you get one in between, but still there can be multiple time steps where you don't have a reward. And your task is to figure out 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 why they say we are the first deep learning model to successfully learn the directly from high dimensional sensory inputs. Okay, so the power of deep learning, they argue is that a deep neural network, a convolutional neural network can extract these high level features by itself. However, at this time, people only knew that it could do so for supervised learning, basically for every input of an image, you had a label. And that's how you train these convolutional neural network. Here, it's very different. Here, you will get maybe 1000 of those images. And you'll simply say, well, you got a score of 1100. And somehow you need to figure out which ones of these were the ones that gave you the good score. And how to generalize that. So there are various difficulties here to apply convolutional neural networks to this problem. And they have detail right here, how they did it. So they say the model is a convolutional neural network, which you know, have been demonstrated. So this is after things like Alex net, though before 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, you know, for a long time, but just not combined with deep neural networks. And yeah, then they say, the last cool thing here is that they apply them to seven games with no adjustment of the architecture or learning algorithm. So that they apply the same algorithm, the same hyper parameters to all of the seven games. And the model learns all of the seven games, not as a single model, but as seven different models. However, they all have the same hyper parameters. So they don't need to, to tune them, which is an additional benefit, like this would have been a cool paper, even if they had to sort of tune the algorithm to each of the seven games. But you know, they didn't, which makes it even more impressive is kind of their point here that these that this reinforcement, deep reinforcement learning can be some sort of a general learning mechanism. Of course, you know, later, there has been like giant amount of development since this, and people have come up with all kinds of giant architectures and whatever corrections of policy corrections seem to real continuous control. This is, this is most of it is a derivation of this work right here. And this work, it reads surprisingly simple, I have to say, and it's almost like they had little idea what problems were to be tackled later in RL, because it kind of reads like, you know, we have this thing and you can learn general things. So yeah, that was, we're still not done with reinforcement learning. I guess we we've just started. Okay, so in a bit of more formal setting, what you will have in reinforcement learning are these rewards, right? So at each time step, you perform an action, you're in a state. So the we said you get back an observation, and we call the observation the state. Now, these two things aren't a sorry, these two things aren't entirely the same thing. So the observation is what you get back directly from the environment. And then the state, it can be something more like if you remember something from the last observation, that can be part of your state, the state is basically what you base your decision on. And the observation is the pure thing you get from the environment. Now, in this case, they do some processing, but essentially, 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 lowercase r. Now, what you want to do formally is you want to maximize the the reward that you get in time t. Sorry, you want to, that's the reward you get at time t prime, you what you want to do, if you play an episode, you're here, and you perform an action, you go here, you perform an action, you go here, you perform an action, you go here, and then your episode is done. For each action, you'll get a reward reward one reward, two reward three, what you want to do is you want to maximize the total the sum of all of these rewards. So over the course of your episode, you want to collect as much reward as you can. There is a discount factor right here, which is sort of saying that rewards that are very far in the future, they're not as important as rewards right now. However, you can set this to one if you want. So you see you want to maximize the future, the sum of future rewards, which is this thing right here. Okay. So how do you how do you do this? There are two main methods in reinforcement learning. The the first one is called a policy gradient method. And very briefly, a policy, we'll call it pi takes in a state s, and it gives you back an action. Okay. And I mean, this is the same for for Q learning, but in a policy gradient method, which is not this paper, but it's like a little bit easier to understand, I believe, we'll simply say, well, we'll simply train a neural network to do that, right. And there is this, there's this policy gradient trick where you can back propagate even though the reward isn't back propagatable, and so on. You can 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, 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. So you are in a given state, right, and you have three actions at your proposal, okay. You have action one, action two, and action three, and you are in state S. 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 A1, say what's Q of S and A1, and the Q function would maybe say that's seven, and here you say what's the Q function of S and A2, and it would maybe say that's four, and here the same thing for A3, 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's what it basically says if I take action A1 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. Then you're guaranteed, because there could be a situation where your reward in a single step is going to be very high here, like a hundred, and here is zero, zero. 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. But here, even though it's zero now, it could be that after that it's 50, and then 40, and then 2000, and so on. So your total reward is going to be much, much more. If you were simply to train a function that tells 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. 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 out comes 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 the this here is called a deep Q network. Okay, it's a network that takes in a state and gives you back the Q value. Now the problem right here is we, you know, here we said if we had a perfect Q function, a Q function that was always right, then the problem would be solved because we could just ask the Q function what to do. Of course, we don't have a perfect Q function, we need to train it. So how do we train a Q function? And the answer is surprisingly simple. So what you want to do is you want you are in this you're in this state. And you want to estimate right what your Q value is you want to train your Q network, what you can do is you can simply play an episode according to the Q function you have, and you'll maybe play this episode right here, right? Like you go here and you collect all of this reward. So this entire thing now goes into your data set. And then you have a sample, you know, I was here in this state s I took action one, and I got in total 2090 as a reward. So that is going to be your labeled sample, right? Your labeled sample is going to be s, I was in s, I did a one. And now I have I then got 2090 reward. Cool. And into the next episode, so 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 there are theorems around Q learning that say if you do that iteratively, then your Q function will converge to the optimal Q functions under some assumptions, which of course not given if this is a deep neural network, but you know, who cares? Yeah, so formally, your Q function, as you can see right here, is going to be there is this Bellman recurrence kind of recurrence property of the Q function. So if I am if I am in a state s, and I'm wondering, what is my Q of my state s and my 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 conditioned on the policy where after we perform the first action, which is a will take always the best one according to the Q function. Right, that's right here. So we're in state s, we perform a, and s prime is going to be the state that we are going to. So we're in s, we perform a, we get to s prime. So in s prime, which is a function of your environment, we're always going to take the maximum action, and r is going to be the reward of the next step. So you can see this recurrence equation right here that Q star can be framed in terms of Q star. So the Q star of this state is going to depend on the Q star of the next state. And you can use that fact and you can, you know, prove that pretty, we've already done it, basically, you can use that fact to now train your neural network. So your neural network loss function is going to be the following. It's going to say, look, this here is the Q function for state s and action a, that's my, and this is my neural network telling me how much that's worth. And this is the label, right? So here you have to think in terms of back classic supervised learning, this here is going to be your F of X, and this here is going to be your Y, and we'll take the squared loss between the two, except your input X is going to be which state am I in and which action am I taking, and your label is going to be bootstrapped by your own Q function. So your label is going to be the reward you got. Remember, this comes from a replay buffer, we already played that game. And we already know what happened after we 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. So I'm going to assume some of you are confused as well. So your Q function is supposed to tell you what's going to be the reward from here until the end of the episode, okay? That you can decompose in the reward that you get from this very next action plus the sum from then, 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 reward we get later. And yes, you might be astounded by the fact that we are using our own neural 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 TensorFlow and go. Yeah, so they make some remarks here, namely that this algorithm is model free, right? There's no model of the environment, you simply learn a function that for each state tells you the Q value for each action. That's, that's all everything, everything that all the logic needs to be within the neural network itself. So that's pretty cool. And they say it's also off policy, it learns about the greedy strategy while following a behavior distribution that ensures adequate exploration of the state space. So while while training, they do this epsilon greedy strategy that follows the greedy strategy, which is where you always take the maximum with one minus epsilon selects a random action with probability epsilon. So while you do your experience, you follow your Q function, you always ask the Q function, what's the best thing to do right here. But you know, that's, that gets you into too much of exploitation. So in epsilon amount of time, you want to do a bit of exploration and just take a random action. Alright, so that's basically the algorithm. So the algorithm is right here. And they have some tricks to get it to work. And the biggest trick they got it to work is the so called replay buffer, this experience replay, because what happens if you play a game of Atari, right, of pong, specifically, then, you know, you have this and you're here and your opponent is here and the ball is here. And then the next frame, you are here again, your opponent might be a bit up, and the ball is here. Okay, and so on. So these samples here, they are all very, very correlated, right, the ones after another, especially if you now build mini batch, let's say, or mini batch sizes to this mini batch has almost no variability in it. So if you've 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 big, pretty big deal out of, you know, shuffling our data set and all of the data points being ID and so on. So what they say is, rather than using the data samples, as we collect them, we put them into a big, big buffer, a big replay buffer. And from that replay buffer, we basically sample at random. Okay, so that means that, you know, some samples can be used multiple times, other samples can be never sampled, because there is a fixed size, and the new ones will always kick out the oldest ones. So some samples might not be used, some samples might be used twice or three times, we can also learn, you know, four times as fast as we sample, and then every sample on average will be used four times. So this, this experience replay proved very, very important for this algorithm to work. That's why they say deep Q learning with experience replay. So they have this replay memory D right here to capacity n. And you initialize your Q function with random weights as you do with a neural network. And then you play these episodes for each episode, you start out with s one, the state one, and you do pre processing. So in pre process, they have some more tricks where they downscale the image, they concatenate four images in a row, because sometimes in Atari get these flicker things. And also, if you concatenate four things in a row, you, for example, can tell it in which direction the ball is moving, and so on. So give a little bit of history. So one sample technically would be four frames, they also do sticky actions, and so on all of these things that you can find today in these emulators that are almost default now, like sticky actions, they invented right here. So for the time steps within the episode, we want to we've probability epsilon select a random action. Otherwise, just ask your Q function, what should I do right here? Give me the best action in this particular state, then you would execute that action and observe a reward and the next state. So the next image right here, you would set the next state to this transition. Okay, so in the state, there can be more, as I said, there can be more than the image like the previous state, and the action you took, but right here, I believe it's like purely the current last four frames. And then you store that transition in the replay buffer. After that, you sample a random mini batch of transitions from the replay buffer. So here, you can see this here is where we de correlate the inputs, because if we simply were to use our last transition for learning, then we would run into a problem. But right here, we sample from that replay buffer. So this is going to be your input, this is going to be your X for your supervised learning of the deep neural network, what's going to be your sorry, without the reward, of course, what's going to be your y, your y, if you're at the end of the episode, it's simply the reward that you got, because there's no more reward coming. However, if you're not at the end, it's the reward that you got from this last step, plus all of the reward that you're going to get in the future. Now, you aren't in the future yet, but you can ask yourself, you can ask your Q function, what that reward is most likely going to be. If your Q function gets better, and this estimate gets better, and your labels get better, then your Q function gets better, and so on in a big circle. And then you perform a gradient descent step on this L2 loss between the label and your prediction. Note that there, if you are in a deep learning framework, there is like a stop gradient on this label right here. So the back propagation only happens with respect to this right here, which makes sense, right? So this is your X, this is your input, and f of X is usually what we back propagate into. Okay, there's no notion yet of like a second Q network and so on, which proved very valuable in the future of this paper. This paper simply applied kind of the most basic version of this, and they simply got it to work. They just got deep neural networks to work with reinforcement learning. And yeah, there's a big 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 vary between 4 and 18 on the games we considered. Okay, as you can see that neural network is pretty small, it's two conv layers. And as was in fashion back then, you had like big filters. So you know big filters from like Alex net. Big filters, but fewer than today. So today, the trend is more like deeper layers, more filters, but they are not as big. They're like three by three filters today only. Yeah, pretty interesting how they did it back then. Interesting also no max pooling and so on. So pretty cool. And here they go into experiments. So they show that their average reward in these games is kind of noisy, but it improves over time, especially also if you look at the average 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. The A 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, right, then the the agent shoots. And you can see here the shot is about to land at the enemy. And that's when we're here. So this now the queue function is very sure that in the future, there's going to be a high reward. But then once the once the enemy is shot, then there is no more enemy to be shot. And the 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, you know, pretty interesting. And you can see pretty directly that there is a correlation between what's happening in the game and this learned 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, like, so their method just takes RGB, but the other methods recognize that, oh, in these Atari games, most of the time, you know, there are unique colors for the things. So you know, the enemies are all like green, like, and they make unique channels for those green enemies, or they even have handcrafted object detectors, and tell the algorithm where these objects are. So the comparison really isn't fair. Yet, the DQN outperform these others like almost everywhere. And they also evaluated against a against a human. And I don't actually know they just say an expert human. I have no idea. Maybe just put David Silver in front of computers like, okay, David, here you go. And you can you can, like what happened in Pong? Like, come on, David. But you can see there, there were still problems where the humans were vastly superior. And they mainly attribute this to the difficulty of the problem. And it could also be because for example, in breakout, there's this 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 Q networks figured out that strategy, and you need to pull it off very precisely, which of course, the the computer can do very well. So it sometimes achieves these super high scores by pulling something off precisely. But in games where they say where you have to plan ahead for longer, it it kind of fails. And we know that this long planning was about to be a problem for years to come. And it's still not solved. So still, go explore is highly controversial that can solve these kind of long exploration games. And those are still games, right? So we are basically not we are very much further than they were in this paper. But also, we are basically no nowhere yet. Yeah, if I'm if I'm allowed to say that. So I enjoyed reading this paper, I this is it's very it's very well written. If you somehow know how to think about reinforcement learning, like this, this Q function, what the Q function means, and why you would learn it in this way. I find this is not super well described, this kind of requires a bit of a knowledge of not of RL, but just of how to think of RL. But apart from this, everything else is written incredibly well, easy, straightforward. And you know, this was just a nice work of its time. And I appreciate it for that. Alright, I'll see you next time. And I appreciate your time too. Bye.
[ { "start": 0, "end": 5.36, "text": " Hi there. Today we'll look at playing Atari with deep reinforcement learning by Vladimir" }, { "start": 5.36, "end": 13.44, "text": " Mn. et al. of DeepMind. So this is another one of our series of impactful past papers." }, { "start": 13.44, "end": 19.92, "text": " This paper right here kicked off an entire revolution in reinforcement learning. Specifically," }, { "start": 19.92, "end": 25.96, "text": " it sort of started the deep reinforcement learning hype. Before that, reinforcement" }, { "start": 25.96, "end": 31.520000000000003, "text": " learning was kind of this weird field of Markov decision processes and so on. Now, I know there" }, { "start": 31.520000000000003, "end": 39.6, "text": " were successes and all and stuff was happening. But this really made a lot of waves because it" }, { "start": 39.6, "end": 46.400000000000006, "text": " brought the power of deep neural networks to reinforcement learning. And with a pretty simple" }, { "start": 46.400000000000006, "end": 54.040000000000006, "text": " application of convolutional networks, managed to solve these reinforcement learning games where" }, { "start": 54.04, "end": 61.08, "text": " previous algorithms really couldn't either or were heavily reliant on hand engineered features." }, { "start": 61.08, "end": 68.56, "text": " So we'll take a look here and what people did back then, what was the state of the art and" }, { "start": 68.56, "end": 76, "text": " what they are telling us about that. Kind of set it in relation to today. Alright, if you do like" }, { "start": 76, "end": 82.12, "text": " papers like this, commentary like this, share it out, leave a like and tell me in the comments what" }, { "start": 82.12, "end": 89.88000000000001, "text": " you think. So let's dive in. They say we present the first deep learning model to successfully learn" }, { "start": 89.88000000000001, "end": 97.16000000000001, "text": " control policies directly from high dimensional sensory input using reinforcement learning. The" }, { "start": 97.16000000000001, "end": 103.36000000000001, "text": " model is a convolutional neural network trained with a variant of Q learning whose input is raw" }, { "start": 103.36000000000001, "end": 110.02000000000001, "text": " pixels and whose output is a value value function estimating future rewards. We apply our method to" }, { "start": 110.02, "end": 116.8, "text": " seven Atari 2600 games from the arcade learning environment with no adjustment of the architecture" }, { "start": 116.8, "end": 123.44, "text": " or learning algorithm. We find that it outperforms all approaches on six of the games and surpasses a" }, { "start": 123.44, "end": 129.44, "text": " human expert on three of them. So there's a lot packed into this. First of all, I wanted to" }, { "start": 129.44, "end": 141.96, "text": " recognize the absolute LaTeX savagery right here. Yeah, you know, it's just just something. I'm not" }, { "start": 141.96, "end": 148.64, "text": " OCD about that kind of stuff. I think we should ditch LaTeX honestly. But so there's a lot of" }, { "start": 148.64, "end": 155.78, "text": " information packed in this abstract right here. So they say this is the first deep learning model" }, { "start": 155.78, "end": 163, "text": " to learn control policies. So that's the task of these reinforcement learning algorithms directly" }, { "start": 163, "end": 169.84, "text": " from high dimensional sensory input using using reinforcement learning. So what do they mean this" }, { "start": 169.84, "end": 174.32, "text": " are called learning environment if you don't know what it is, it's basically these old games right" }, { "start": 174.32, "end": 181.32, "text": " here, you can kind of emulate them and run them. And the inputs are always sort of the same. So you" }, { "start": 181.32, "end": 186.72, "text": " have one joystick, I believe. So you have kind of this joystick and it can go into various directions" }, { "start": 186.72, "end": 192.68, "text": " like left, right, up, down, and then also the intermediate directions. And then you have a I" }, { "start": 192.68, "end": 200.32, "text": " think also a button that you can push. And that gives you a total of some somewhere around 16 or" }, { "start": 200.32, "end": 205.92, "text": " 20 actions in each of the games. So the good thing about this environment is that the actions are" }, { "start": 205.92, "end": 210.95999999999998, "text": " always the same. But of course, they mean different things in different games. So the games here," }, { "start": 210.96, "end": 220.36, "text": " you know, for example, pong, or this breakout, these games are kind of really low pixel games," }, { "start": 220.36, "end": 226.08, "text": " as you can see, and they come in form of an image, right. So this is an image, this is like 180" }, { "start": 226.08, "end": 233.72, "text": " pixels, and this is like 150 pixels. And the task here is to learn a policy, which means which" }, { "start": 233.72, "end": 240.84, "text": " buttons and directions you need to push, depending on the observation right here, these pixels," }, { "start": 240.84, "end": 247.28, "text": " and achieve the maximum amount of reward. So reward is given in each game differently as well. For" }, { "start": 247.28, "end": 254.72, "text": " example, in this pong game, the reward is every time you score kind of a goal against your opponent," }, { "start": 254.72, "end": 261.56, "text": " in breakout, you get a reward every time you manage to hit or kill a one of these blocks and" }, { "start": 261.56, "end": 268.76, "text": " so on. So reward is different, but your objective is always to maximize the reward. In a formal" }, { "start": 268.76, "end": 275.68, "text": " framework, you have an agent and an environment. And the environment would always give you an" }, { "start": 275.68, "end": 283.96, "text": " observation, which in this case, the observation is one of these images. And the agent will give" }, { "start": 283.96, "end": 293.2, "text": " back an action. So the action in this case, would be the which button to press or which direction to" }, { "start": 293.2, "end": 300.4, "text": " move the joystick into. And then the environment would get back give back a reward. So the reward" }, { "start": 300.4, "end": 307.84, "text": " is could be, you know, it could be this, you scored a goal. So that's zero most of the time. And" }, { "start": 307.84, "end": 314.24, "text": " sometimes it's one or, or nine. Or it could be like how long you're alive and so on. This is very," }, { "start": 314.24, "end": 322.8, "text": " very, very variable. So the difficulty of reinforcement learning very often is that these" }, { "start": 322.8, "end": 330.6, "text": " episodes can go for a while. So this whole process here will repeat over time. And the this can go" }, { "start": 330.6, "end": 336.52000000000004, "text": " on for hundreds of steps or 1000s of steps until you're done, you know, playing a game like this," }, { "start": 336.52000000000004, "end": 344.40000000000003, "text": " like this right here. And the reward can be very sparse. So you might only get a reward at the very" }, { "start": 344.40000000000003, "end": 349.76, "text": " end of the game. Sometimes, most often in these games, you get one in between, but still there" }, { "start": 349.76, "end": 355, "text": " can be multiple time steps where you don't have a reward. And your task is to figure out which of" }, { "start": 355, "end": 362.08, "text": " the actions were the good ones. This is known as the credit assignment problem. And to do the credit" }, { "start": 362.08, "end": 368.48, "text": " assignment problem just from pixels alone, that was unheard of at the time this paper came out." }, { "start": 368.48, "end": 376.03999999999996, "text": " That's why they say we are the first deep learning model to successfully learn the directly from high" }, { "start": 376.04, "end": 382.44, "text": " dimensional sensory inputs. Okay, so the power of deep learning, they argue is that a deep neural" }, { "start": 382.44, "end": 388.84000000000003, "text": " network, a convolutional neural network can extract these high level features by itself. However," }, { "start": 388.84000000000003, "end": 396, "text": " at this time, people only knew that it could do so for supervised learning, basically for every" }, { "start": 396, "end": 401.84000000000003, "text": " input of an image, you had a label. And that's how you train these convolutional neural network." }, { "start": 401.84, "end": 408.52, "text": " Here, it's very different. Here, you will get maybe 1000 of those images. And you'll simply say," }, { "start": 408.52, "end": 416.2, "text": " well, you got a score of 1100. And somehow you need to figure out which ones of these were the" }, { "start": 416.2, "end": 422.52, "text": " ones that gave you the good score. And how to generalize that. So there are various difficulties" }, { "start": 422.52, "end": 428.84, "text": " here to apply convolutional neural networks to this problem. And they have detail right here," }, { "start": 428.84, "end": 435.28, "text": " how they did it. So they say the model is a convolutional neural network, which you know," }, { "start": 435.28, "end": 442.67999999999995, "text": " have been demonstrated. So this is after things like Alex net, though before resnet trained with" }, { "start": 442.67999999999995, "end": 448.52, "text": " a variant of Q learning, whose input is raw pixels, and whose output is a value function" }, { "start": 448.52, "end": 453.2, "text": " estimating the future. So we'll get into Q learning, Q learning is a reinforcement learning" }, { "start": 453.2, "end": 460.36, "text": " algorithm that has been around, you know, for a long time, but just not combined with deep neural" }, { "start": 460.36, "end": 468.56, "text": " networks. And yeah, then they say, the last cool thing here is that they apply them to seven games" }, { "start": 468.56, "end": 476.15999999999997, "text": " with no adjustment of the architecture or learning algorithm. So that they apply the same algorithm," }, { "start": 476.15999999999997, "end": 481.96, "text": " the same hyper parameters to all of the seven games. And the model learns all of the seven" }, { "start": 481.96, "end": 486.68, "text": " games, not as a single model, but as seven different models. However, they all have the" }, { "start": 486.68, "end": 491.2, "text": " same hyper parameters. So they don't need to, to tune them, which is an additional benefit," }, { "start": 491.2, "end": 497.12, "text": " like this would have been a cool paper, even if they had to sort of tune the algorithm to each" }, { "start": 497.12, "end": 503, "text": " of the seven games. But you know, they didn't, which makes it even more impressive is kind of" }, { "start": 503, "end": 509.91999999999996, "text": " their point here that these that this reinforcement, deep reinforcement learning can be some sort of a" }, { "start": 509.92, "end": 516.88, "text": " general learning mechanism. Of course, you know, later, there has been like giant amount of" }, { "start": 516.88, "end": 523.8000000000001, "text": " development since this, and people have come up with all kinds of giant architectures and whatever" }, { "start": 523.8000000000001, "end": 531.96, "text": " corrections of policy corrections seem to real continuous control. This is, this is most of it" }, { "start": 531.96, "end": 540.36, "text": " is a derivation of this work right here. And this work, it reads surprisingly simple, I have to say," }, { "start": 540.36, "end": 548.8000000000001, "text": " and it's almost like they had little idea what problems were to be tackled later in RL, because" }, { "start": 548.8000000000001, "end": 553.5600000000001, "text": " it kind of reads like, you know, we have this thing and you can learn general things. So yeah," }, { "start": 553.5600000000001, "end": 560.1600000000001, "text": " that was, we're still not done with reinforcement learning. I guess we we've just started. Okay," }, { "start": 560.16, "end": 567.68, "text": " so in a bit of more formal setting, what you will have in reinforcement learning are these rewards," }, { "start": 567.68, "end": 573.7199999999999, "text": " right? So at each time step, you perform an action, you're in a state. So the we said you" }, { "start": 573.7199999999999, "end": 581.0799999999999, "text": " get back an observation, and we call the observation the state. Now, these two things aren't a sorry," }, { "start": 581.0799999999999, "end": 586.6, "text": " these two things aren't entirely the same thing. So the observation is what you get back directly" }, { "start": 586.6, "end": 593.48, "text": " from the environment. And then the state, it can be something more like if you remember something" }, { "start": 593.48, "end": 598.5600000000001, "text": " from the last observation, that can be part of your state, the state is basically what you base" }, { "start": 598.5600000000001, "end": 603.28, "text": " your decision on. And the observation is the pure thing you get from the environment. Now," }, { "start": 603.28, "end": 610.48, "text": " in this case, they do some processing, but essentially, we'll, we'll regard them as the" }, { "start": 610.48, "end": 616.76, "text": " same thing. So the state is what you see of the environment. Then in each of these steps," }, { "start": 616.76, "end": 622.36, "text": " you perform an action, we'll call that this a thing right here. And in each step, you also" }, { "start": 622.36, "end": 629.64, "text": " get a reward for the last action that you took. And the reward is going to be lowercase r. Now," }, { "start": 629.64, "end": 638.8000000000001, "text": " what you want to do formally is you want to maximize the the reward that you get in time t." }, { "start": 638.8, "end": 649.12, "text": " Sorry, you want to, that's the reward you get at time t prime, you what you want to do, if you play" }, { "start": 649.12, "end": 653.4799999999999, "text": " an episode, you're here, and you perform an action, you go here, you perform an action," }, { "start": 653.4799999999999, "end": 658.68, "text": " you go here, you perform an action, you go here, and then your episode is done. For each action," }, { "start": 658.68, "end": 664.3199999999999, "text": " you'll get a reward reward one reward, two reward three, what you want to do is you want to maximize" }, { "start": 664.32, "end": 670.2800000000001, "text": " the total the sum of all of these rewards. So over the course of your episode, you want to collect" }, { "start": 670.2800000000001, "end": 676.9200000000001, "text": " as much reward as you can. There is a discount factor right here, which is sort of saying that" }, { "start": 676.9200000000001, "end": 682.36, "text": " rewards that are very far in the future, they're not as important as rewards right now. However," }, { "start": 682.36, "end": 690.7600000000001, "text": " you can set this to one if you want. So you see you want to maximize the future, the sum of future" }, { "start": 690.76, "end": 697.4, "text": " rewards, which is this thing right here. Okay. So how do you how do you do this? There are two main" }, { "start": 697.4, "end": 705.56, "text": " methods in reinforcement learning. The the first one is called a policy gradient method. And very" }, { "start": 705.56, "end": 715.28, "text": " briefly, a policy, we'll call it pi takes in a state s, and it gives you back an action. Okay." }, { "start": 715.28, "end": 721.9599999999999, "text": " And I mean, this is the same for for Q learning, but in a policy gradient method, which is not" }, { "start": 721.9599999999999, "end": 727.0799999999999, "text": " this paper, but it's like a little bit easier to understand, I believe, we'll simply say, well," }, { "start": 727.0799999999999, "end": 734.04, "text": " we'll simply train a neural network to do that, right. And there is this, there's this policy" }, { "start": 734.04, "end": 740.64, "text": " gradient trick where you can back propagate even though the reward isn't back propagatable, and so" }, { "start": 740.64, "end": 745.72, "text": " on. You can simply say we'll learn a neural network to give us the action that's best, right. So we'll" }, { "start": 745.72, "end": 751.68, "text": " have a neural network, the state goes in neural network, and then we'll just have as many outputs" }, { "start": 751.68, "end": 758.48, "text": " as there are actions like action one, action two, action three, action four, and we'll treat it as a" }, { "start": 758.48, "end": 765.48, "text": " classification problem, right. So you simply train the network to pick the action that is best in" }, { "start": 765.48, "end": 771.84, "text": " this case, and you are, regardless of how you know which action is best right now. In Q learning," }, { "start": 771.84, "end": 779.32, "text": " you do something else, namely, you train this thing called the Q function. The Q function is" }, { "start": 779.32, "end": 789.48, "text": " a function that takes in a state and an action, and it gives you what the reward is going to be in" }, { "start": 789.48, "end": 796.24, "text": " the future if you are in this state and perform this action, okay. So you are in a given state," }, { "start": 796.24, "end": 803.5600000000001, "text": " right, and you have three actions at your proposal, okay. You have action one, action two," }, { "start": 803.5600000000001, "end": 811.16, "text": " and action three, and you are in state S. What you would do is you would call the Q function," }, { "start": 811.16, "end": 816.8000000000001, "text": " if you had a perfect Q function, it could give you the reward. You would call the Q function three" }, { "start": 816.8, "end": 824.7199999999999, "text": " times. You would call the Q function first with A1, say what's Q of S and A1, and the Q function" }, { "start": 824.7199999999999, "end": 831.68, "text": " would maybe say that's seven, and here you say what's the Q function of S and A2, and it would" }, { "start": 831.68, "end": 838.04, "text": " maybe say that's four, and here the same thing for A3, and it maybe say that's one. Then you would" }, { "start": 838.04, "end": 846.28, "text": " know, aha, if I take action one, my reward from not only the reward for this step, but my reward" }, { "start": 846.28, "end": 854.6, "text": " from here on until the end of the episode is going to be seven. That is if you had a perfect Q function." }, { "start": 854.6, "end": 861.48, "text": " Now the Q function is always of course conditioned on a policy right here, so there's what it basically" }, { "start": 861.48, "end": 870.9599999999999, "text": " says if I take action A1 right now, and after that I follow policy pi, then I'm going to get the reward" }, { "start": 870.96, "end": 878.44, "text": " of seven. It's a bit of a multi-layered reasoning approach, but ultimately you don't have to" }, { "start": 878.44, "end": 887.0400000000001, "text": " worry much about this being conditioned on a policy. Ultimately the Q function says if you take" }, { "start": 887.0400000000001, "end": 894.32, "text": " this action right now, what will the reward be for the entire rest of the episode? So if you had a" }, { "start": 894.32, "end": 900.2800000000001, "text": " perfect Q function, you could simply ask it about all the actions as we did here, and then pick the" }, { "start": 900.28, "end": 906.04, "text": " action with the highest number. Then you're guaranteed, because there could be a situation" }, { "start": 906.04, "end": 915.24, "text": " where your reward in a single step is going to be very high here, like a hundred, and here is zero," }, { "start": 915.24, "end": 922.36, "text": " zero. You would be tempted to take that action right here, but after that it's just going to be" }, { "start": 922.36, "end": 929.92, "text": " zero, zero, zero, so your total reward is going to be 100. But here, even though it's zero now, it" }, { "start": 929.92, "end": 938.52, "text": " could be that after that it's 50, and then 40, and then 2000, and so on. So your total reward is going" }, { "start": 938.52, "end": 943.76, "text": " to be much, much more. If you were simply to train a function that tells you what's the reward in the" }, { "start": 943.76, "end": 949.92, "text": " next step, then you would lose, because that function would not be able to look ahead sufficiently." }, { "start": 949.92, "end": 954.8199999999999, "text": " What we're trying to do with the Q function is we're trying to predict to train a function that" }, { "start": 954.8199999999999, "end": 959.88, "text": " will tell us not only what's the reward in the next step, but what is the reward in all the steps" }, { "start": 959.88, "end": 966.56, "text": " to come from here. Of course, conditioned on all the decisions we make in the future, but that's" }, { "start": 966.56, "end": 973.32, "text": " this policy pi right here. I hope it's somewhat clear what a Q function is. Interestingly, we can" }, { "start": 973.32, "end": 979.6, "text": " take the same network architecture for this. So what you would do naively is you would build a" }, { "start": 979.6, "end": 984.32, "text": " neural network where you say, okay, a Q function takes a state and an action, so I'll put those" }, { "start": 984.32, "end": 990.9200000000001, "text": " into a neural network, and then out comes this estimation of the reward, which we usually call" }, { "start": 990.9200000000001, "end": 999.08, "text": " Q. So the value Q is this estimation of the future reward if you take this action in this state. Now," }, { "start": 999.08, "end": 1005.5200000000001, "text": " the disadvantage here is that we have to call this neural network once for each action in every state" }, { "start": 1005.5200000000001, "end": 1010, "text": " that we're in. So that's like, if there's 10 actions, that's like 10 forward passes. What we" }, { "start": 1010, "end": 1016.28, "text": " could do is we could simply take the same neural network we had for our initial or very initial" }, { "start": 1016.28, "end": 1024.52, "text": " policy method, and we use that and we simply input state and we'll train it to output the Q for" }, { "start": 1024.52, "end": 1033.64, "text": " action one and the Q sorry for the state s and action one, the Q for the state s and action two," }, { "start": 1033.64, "end": 1042.8000000000002, "text": " and so on. So there is going to be this kind of shared encoder. And then that's, it's basically" }, { "start": 1042.8000000000002, "end": 1048.5600000000002, "text": " going to encode the state into a latent space and then classify for each of the actions how" }, { "start": 1048.5600000000002, "end": 1057.96, "text": " valuable this particular action would be in that state. So the this here is called a deep Q network." }, { "start": 1057.96, "end": 1066.56, "text": " Okay, it's a network that takes in a state and gives you back the Q value. Now the problem right" }, { "start": 1066.56, "end": 1073.3600000000001, "text": " here is we, you know, here we said if we had a perfect Q function, a Q function that was always" }, { "start": 1073.3600000000001, "end": 1078.8, "text": " right, then the problem would be solved because we could just ask the Q function what to do. Of" }, { "start": 1078.8, "end": 1084, "text": " course, we don't have a perfect Q function, we need to train it. So how do we train a Q function?" }, { "start": 1084, "end": 1091.2, "text": " And the answer is surprisingly simple. So what you want to do is you want you are in this you're in" }, { "start": 1091.2, "end": 1098.32, "text": " this state. And you want to estimate right what your Q value is you want to train your Q network," }, { "start": 1098.32, "end": 1104.2, "text": " what you can do is you can simply play an episode according to the Q function you have, and you'll" }, { "start": 1104.2, "end": 1110.64, "text": " maybe play this episode right here, right? Like you go here and you collect all of this reward. So" }, { "start": 1110.64, "end": 1119.88, "text": " this entire thing now goes into your data set. And then you have a sample, you know, I was here in" }, { "start": 1119.88, "end": 1129.68, "text": " this state s I took action one, and I got in total 2090 as a reward. So that is going to be your" }, { "start": 1129.68, "end": 1136.2, "text": " labeled sample, right? Your labeled sample is going to be s, I was in s, I did a one. And now I" }, { "start": 1136.2, "end": 1145.0800000000002, "text": " have I then got 2090 reward. Cool. And into the next episode, so you're going on playing, and you" }, { "start": 1145.0800000000002, "end": 1151.48, "text": " maybe go down here, and then you get a next training example, I was in state s, I so you keep" }, { "start": 1151.48, "end": 1156.76, "text": " restarting the episode, so you can get into the same state multiple times, I performed a three," }, { "start": 1156.76, "end": 1163.68, "text": " and I got only 100 reward. So that's another training sample. So these training samples right" }, { "start": 1163.68, "end": 1169.2, "text": " here, you can use to train your Q function. This is called online reinforcement learning, you play" }, { "start": 1169.2, "end": 1175.92, "text": " the game at the same time as you train your neural network. And you use that improved neural network" }, { "start": 1175.92, "end": 1184.64, "text": " to play more games. And with time, there is this well known, there is a there are theorems around" }, { "start": 1184.64, "end": 1191.76, "text": " Q learning that say if you do that iteratively, then your Q function will converge to the optimal" }, { "start": 1191.76, "end": 1195.96, "text": " Q functions under some assumptions, which of course not given if this is a deep neural network," }, { "start": 1195.96, "end": 1204.4, "text": " but you know, who cares? Yeah, so formally, your Q function, as you can see right here, is going to" }, { "start": 1204.4, "end": 1214.32, "text": " be there is this Bellman recurrence kind of recurrence property of the Q function. So if I am if I" }, { "start": 1214.32, "end": 1226.4399999999998, "text": " am in a state s, and I'm wondering, what is my Q of my state s and my and an action a. And I said" }, { "start": 1226.4399999999998, "end": 1231.76, "text": " with respect to a policy, which the star policy is going to be the policy where we always select" }, { "start": 1231.76, "end": 1239.04, "text": " the highest Q function. So we'll basically say, we're in state s, we select action a, and after" }, { "start": 1239.04, "end": 1244.8799999999999, "text": " that, we'll just always select whatever the highest scoring action is right like right now, action a" }, { "start": 1244.8799999999999, "end": 1250.04, "text": " might not be the highest scoring, but we'll take a right now. And after that, the highest scoring," }, { "start": 1250.04, "end": 1256.44, "text": " that's Q star, it's a Q function conditioned on the policy where after we perform the first action," }, { "start": 1256.44, "end": 1263.04, "text": " which is a will take always the best one according to the Q function. Right, that's right here. So" }, { "start": 1263.04, "end": 1270.1599999999999, "text": " we're in state s, we perform a, and s prime is going to be the state that we are going to. So" }, { "start": 1270.1599999999999, "end": 1276.8, "text": " we're in s, we perform a, we get to s prime. So in s prime, which is a function of your environment," }, { "start": 1276.8, "end": 1282.52, "text": " we're always going to take the maximum action, and r is going to be the reward of the next step. So" }, { "start": 1282.52, "end": 1289.3999999999999, "text": " you can see this recurrence equation right here that Q star can be framed in terms of Q star. So" }, { "start": 1289.4, "end": 1295.8000000000002, "text": " the Q star of this state is going to depend on the Q star of the next state. And you can use that" }, { "start": 1295.8000000000002, "end": 1300.92, "text": " fact and you can, you know, prove that pretty, we've already done it, basically, you can use" }, { "start": 1300.92, "end": 1309.88, "text": " that fact to now train your neural network. So your neural network loss function is going to be the" }, { "start": 1309.88, "end": 1321.2, "text": " following. It's going to say, look, this here is the Q function for state s and action a, that's my," }, { "start": 1321.2, "end": 1327.72, "text": " and this is my neural network telling me how much that's worth. And this is the label, right? So here" }, { "start": 1327.72, "end": 1333.8000000000002, "text": " you have to think in terms of back classic supervised learning, this here is going to be your F of X," }, { "start": 1333.8, "end": 1341.84, "text": " and this here is going to be your Y, and we'll take the squared loss between the two, except your" }, { "start": 1341.84, "end": 1348.6399999999999, "text": " input X is going to be which state am I in and which action am I taking, and your label is going" }, { "start": 1348.6399999999999, "end": 1357.3999999999999, "text": " to be bootstrapped by your own Q function. So your label is going to be the reward you got. Remember," }, { "start": 1357.4, "end": 1364.92, "text": " this comes from a replay buffer, we already played that game. And we already know what happened after" }, { "start": 1364.92, "end": 1371.92, "text": " we performed this action, right? And what happened is we got this reward, and we got into this state." }, { "start": 1371.92, "end": 1379.4, "text": " So we can simply ask our own Q function again, what's the best action to take in this state? And" }, { "start": 1379.4, "end": 1389.76, "text": " what reward would we get? And then we have our label, right? So our label Y is going to be, yeah," }, { "start": 1389.76, "end": 1395.1200000000001, "text": " I was I was I was pretty confused when I learned this the first time. So I'm going to assume some" }, { "start": 1395.1200000000001, "end": 1401.3600000000001, "text": " of you are confused as well. So your Q function is supposed to tell you what's going to be the" }, { "start": 1401.36, "end": 1412.04, "text": " reward from here until the end of the episode, okay? That you can decompose in the reward that" }, { "start": 1412.04, "end": 1419.6399999999999, "text": " you get from this very next action plus the sum from then, so t plus one, until the end of the" }, { "start": 1419.6399999999999, "end": 1427.52, "text": " episode, okay? So t prime, so that's t prime equals t plus one. All right, so pretty simple. The total" }, { "start": 1427.52, "end": 1434.12, "text": " reward from now until the end, you can decompose in the reward now plus the reward after that until" }, { "start": 1434.12, "end": 1442.68, "text": " the end. Now, this here, we know we've played the episode, we know what happened. This here, we can" }, { "start": 1442.68, "end": 1449.68, "text": " simply ask our Q function again, because we also know what state we got into. And this, as you can" }, { "start": 1449.68, "end": 1456.6399999999999, "text": " see, is very much this, but just one step later. So we can simply ask our own Q function, which might" }, { "start": 1456.64, "end": 1466.24, "text": " be imperfect, right? But it's certainly a good guess. We say, okay, this reward from now should" }, { "start": 1466.24, "end": 1475.24, "text": " be equal to the reward we got plus whatever reward we get later. And yes, you might be astounded by" }, { "start": 1475.24, "end": 1482.44, "text": " the fact that we are using our own neural network, though be with the parameters one time step ago," }, { "start": 1482.44, "end": 1488.56, "text": " in order to produce our label. But that is exactly what these Q learning theorems are about. They" }, { "start": 1488.56, "end": 1495.56, "text": " basically say under some assumptions, if you do this, and you iterate, then this will converge to" }, { "start": 1495.56, "end": 1503.44, "text": " the optimal Q function. So as you can see right here, this is the this is the gradient of the loss." }, { "start": 1503.44, "end": 1508.3200000000002, "text": " It's astounding that back then, they still wrote down the gradient of the loss, like almost no one" }, { "start": 1508.32, "end": 1516.24, "text": " does this. Now, you just say, put this into TensorFlow and go. Yeah, so they make some remarks" }, { "start": 1516.24, "end": 1523.12, "text": " here, namely that this algorithm is model free, right? There's no model of the environment, you" }, { "start": 1523.12, "end": 1530.6399999999999, "text": " simply learn a function that for each state tells you the Q value for each action. That's, that's" }, { "start": 1530.6399999999999, "end": 1537.8, "text": " all everything, everything that all the logic needs to be within the neural network itself. So that's" }, { "start": 1537.8, "end": 1546.08, "text": " pretty cool. And they say it's also off policy, it learns about the greedy strategy while following" }, { "start": 1546.08, "end": 1551.44, "text": " a behavior distribution that ensures adequate exploration of the state space. So while while" }, { "start": 1551.44, "end": 1557.32, "text": " training, they do this epsilon greedy strategy that follows the greedy strategy, which is where" }, { "start": 1557.32, "end": 1563.2, "text": " you always take the maximum with one minus epsilon selects a random action with probability epsilon." }, { "start": 1563.2, "end": 1569.72, "text": " So while you do your experience, you follow your Q function, you always ask the Q function, what's" }, { "start": 1569.72, "end": 1576.72, "text": " the best thing to do right here. But you know, that's, that gets you into too much of exploitation." }, { "start": 1576.72, "end": 1582.68, "text": " So in epsilon amount of time, you want to do a bit of exploration and just take a random action." }, { "start": 1582.68, "end": 1590.68, "text": " Alright, so that's basically the algorithm. So the algorithm is right here. And they have some tricks" }, { "start": 1590.68, "end": 1597.76, "text": " to get it to work. And the biggest trick they got it to work is the so called replay buffer, this" }, { "start": 1597.76, "end": 1604.72, "text": " experience replay, because what happens if you play a game of Atari, right, of pong, specifically," }, { "start": 1604.72, "end": 1610, "text": " then, you know, you have this and you're here and your opponent is here and the ball is here. And" }, { "start": 1610, "end": 1618.1200000000001, "text": " then the next frame, you are here again, your opponent might be a bit up, and the ball is here." }, { "start": 1618.12, "end": 1625.84, "text": " Okay, and so on. So these samples here, they are all very, very correlated, right, the ones after" }, { "start": 1625.84, "end": 1630.76, "text": " another, especially if you now build mini batch, let's say, or mini batch sizes to this mini batch" }, { "start": 1630.76, "end": 1636.52, "text": " has almost no variability in it. So if you've had something like batch norm or whatnot, this, this" }, { "start": 1636.52, "end": 1642.4799999999998, "text": " will be like terrible, because these data samples are correlated. And we in supervised learning," }, { "start": 1642.4799999999998, "end": 1647.6, "text": " we make a big, pretty big deal out of, you know, shuffling our data set and all of the data points" }, { "start": 1647.6, "end": 1655.1999999999998, "text": " being ID and so on. So what they say is, rather than using the data samples, as we collect them," }, { "start": 1655.1999999999998, "end": 1662.08, "text": " we put them into a big, big buffer, a big replay buffer. And from that replay buffer, we basically" }, { "start": 1662.08, "end": 1670.1599999999999, "text": " sample at random. Okay, so that means that, you know, some samples can be used multiple times," }, { "start": 1670.1599999999999, "end": 1676.4399999999998, "text": " other samples can be never sampled, because there is a fixed size, and the new ones will always kick" }, { "start": 1676.44, "end": 1680.96, "text": " out the oldest ones. So some samples might not be used, some samples might be used twice or three" }, { "start": 1680.96, "end": 1687.16, "text": " times, we can also learn, you know, four times as fast as we sample, and then every sample on" }, { "start": 1687.16, "end": 1693.88, "text": " average will be used four times. So this, this experience replay proved very, very important for" }, { "start": 1693.88, "end": 1699.56, "text": " this algorithm to work. That's why they say deep Q learning with experience replay. So they have" }, { "start": 1699.56, "end": 1707.04, "text": " this replay memory D right here to capacity n. And you initialize your Q function with random" }, { "start": 1707.04, "end": 1715.56, "text": " weights as you do with a neural network. And then you play these episodes for each episode," }, { "start": 1715.56, "end": 1722.24, "text": " you start out with s one, the state one, and you do pre processing. So in pre process, they have" }, { "start": 1722.24, "end": 1730.64, "text": " some more tricks where they downscale the image, they concatenate four images in a row, because" }, { "start": 1730.64, "end": 1735.44, "text": " sometimes in Atari get these flicker things. And also, if you concatenate four things in a row," }, { "start": 1735.44, "end": 1741.56, "text": " you, for example, can tell it in which direction the ball is moving, and so on. So give a little" }, { "start": 1741.56, "end": 1747.8, "text": " bit of history. So one sample technically would be four frames, they also do sticky actions, and so" }, { "start": 1747.8, "end": 1753.72, "text": " on all of these things that you can find today in these emulators that are almost default now," }, { "start": 1753.72, "end": 1761.72, "text": " like sticky actions, they invented right here. So for the time steps within the episode, we want to" }, { "start": 1761.72, "end": 1768.56, "text": " we've probability epsilon select a random action. Otherwise, just ask your Q function, what should I" }, { "start": 1768.56, "end": 1774.52, "text": " do right here? Give me the best action in this particular state, then you would execute that" }, { "start": 1774.52, "end": 1783.8799999999999, "text": " action and observe a reward and the next state. So the next image right here, you would set the" }, { "start": 1783.8799999999999, "end": 1790.48, "text": " next state to this transition. Okay, so in the state, there can be more, as I said, there can be" }, { "start": 1790.48, "end": 1795.6399999999999, "text": " more than the image like the previous state, and the action you took, but right here, I believe it's" }, { "start": 1795.64, "end": 1805.6000000000001, "text": " like purely the current last four frames. And then you store that transition in the replay buffer." }, { "start": 1805.6000000000001, "end": 1811.3200000000002, "text": " After that, you sample a random mini batch of transitions from the replay buffer. So here," }, { "start": 1811.3200000000002, "end": 1818.5600000000002, "text": " you can see this here is where we de correlate the inputs, because if we simply were to use our last" }, { "start": 1818.56, "end": 1826.72, "text": " transition for learning, then we would run into a problem. But right here, we sample from that" }, { "start": 1826.72, "end": 1833.84, "text": " replay buffer. So this is going to be your input, this is going to be your X for your supervised" }, { "start": 1833.84, "end": 1839.72, "text": " learning of the deep neural network, what's going to be your sorry, without the reward, of course," }, { "start": 1839.72, "end": 1846.24, "text": " what's going to be your y, your y, if you're at the end of the episode, it's simply the reward" }, { "start": 1846.24, "end": 1850.56, "text": " that you got, because there's no more reward coming. However, if you're not at the end," }, { "start": 1850.56, "end": 1857.08, "text": " it's the reward that you got from this last step, plus all of the reward that you're going to get" }, { "start": 1857.08, "end": 1863.72, "text": " in the future. Now, you aren't in the future yet, but you can ask yourself, you can ask your Q" }, { "start": 1863.72, "end": 1869.92, "text": " function, what that reward is most likely going to be. If your Q function gets better, and this" }, { "start": 1869.92, "end": 1874.92, "text": " estimate gets better, and your labels get better, then your Q function gets better, and so on in a" }, { "start": 1874.92, "end": 1882.96, "text": " big circle. And then you perform a gradient descent step on this L2 loss between the label and your" }, { "start": 1882.96, "end": 1891.3600000000001, "text": " prediction. Note that there, if you are in a deep learning framework, there is like a stop gradient" }, { "start": 1891.3600000000001, "end": 1897.5600000000002, "text": " on this label right here. So the back propagation only happens with respect to this right here," }, { "start": 1897.5600000000002, "end": 1903.8000000000002, "text": " which makes sense, right? So this is your X, this is your input, and f of X is usually what we back" }, { "start": 1903.8, "end": 1912.04, "text": " propagate into. Okay, there's no notion yet of like a second Q network and so on, which proved very" }, { "start": 1912.04, "end": 1918.6, "text": " valuable in the future of this paper. This paper simply applied kind of the most basic version of" }, { "start": 1918.6, "end": 1926.24, "text": " this, and they simply got it to work. They just got deep neural networks to work with reinforcement" }, { "start": 1926.24, "end": 1934.56, "text": " learning. And yeah, there's a big chance that this was due to this experience replay, which I believe" }, { "start": 1934.56, "end": 1943.8, "text": " they did not invent. I mean, this has, of course, been around before, but they were the ones to" }, { "start": 1943.8, "end": 1950.52, "text": " realize and combine and do that. It's also pretty interesting, the neural network that they actually" }, { "start": 1950.52, "end": 1960.44, "text": " used was like super duper small. The input to the neural network consists of 84 by 84 by 4 image" }, { "start": 1960.44, "end": 1967.62, "text": " produced by this. So this is the pre-processing. The first hidden layer convolves 16 8 by 8 filters" }, { "start": 1967.62, "end": 1974.8799999999999, "text": " with stride 4 with the input image and applies the rectifier non-linearity. So the ReLU. The" }, { "start": 1974.8799999999999, "end": 1979.92, "text": " second hidden layer convolves 32 4 by 4 filters with stride 2, again followed by rectifier" }, { "start": 1979.92, "end": 1986.3200000000002, "text": " non-linearity. The final layer hidden layer is fully connected and consists of 256 rectifier" }, { "start": 1986.3200000000002, "end": 1991.4, "text": " units. The output layer is a fully connected linear layer with single output for each valid" }, { "start": 1991.4, "end": 1999.6000000000001, "text": " action. Number of valid actions is vary between 4 and 18 on the games we considered. Okay, as you" }, { "start": 1999.6000000000001, "end": 2005.76, "text": " can see that neural network is pretty small, it's two conv layers. And as was in fashion back then," }, { "start": 2005.76, "end": 2012.72, "text": " you had like big filters. So you know big filters from like Alex net. Big filters," }, { "start": 2012.72, "end": 2018.72, "text": " but fewer than today. So today, the trend is more like deeper layers, more filters," }, { "start": 2018.72, "end": 2024.96, "text": " but they are not as big. They're like three by three filters today only. Yeah, pretty interesting" }, { "start": 2024.96, "end": 2033.84, "text": " how they did it back then. Interesting also no max pooling and so on. So pretty cool. And here" }, { "start": 2033.84, "end": 2040.48, "text": " they go into experiments. So they show that their average reward in these games is kind of noisy," }, { "start": 2040.48, "end": 2046.9599999999998, "text": " but it improves over time, especially also if you look at the average queue of the max action," }, { "start": 2046.9599999999998, "end": 2055.2799999999997, "text": " it continuously goes up during training. So this is really a successful training, especially this" }, { "start": 2055.2799999999997, "end": 2061, "text": " investigative experiment they did right here, where you can see one example of how the queue" }, { "start": 2061, "end": 2068.96, "text": " function, what the queue function says. Remember, the queue function gives us the whatever the future" }, { "start": 2068.96, "end": 2074.96, "text": " reward is going to be. Okay. And here we always look at the max action. So in this first frame," }, { "start": 2076, "end": 2083.68, "text": " you can see this enemy had just appeared. And you can see that from here to here, there's a spike in" }, { "start": 2083.68, "end": 2090.72, "text": " the queue value because you can shoot enemies. And that gives you reward. The A this is already so" }, { "start": 2090.72, "end": 2096.7999999999997, "text": " the enemy isn't shot yet by the simple appearance of the enemy, the queue function also like already" }, { "start": 2096.7999999999997, "end": 2105.68, "text": " jumps in value, because it anticipates a future reward, right, then the the agent shoots. And" }, { "start": 2106.3999999999996, "end": 2112.3999999999996, "text": " you can see here the shot is about to land at the enemy. And that's when we're here. So this now the" }, { "start": 2112.3999999999996, "end": 2118.3199999999997, "text": " queue function is very sure that in the future, there's going to be a high reward. But then once" }, { "start": 2118.32, "end": 2128, "text": " the once the enemy is shot, then there is no more enemy to be shot. And the queue function drops" }, { "start": 2128, "end": 2135.36, "text": " drastically, because it doesn't see a future reward as being as likely as at the beginning when there" }, { "start": 2135.36, "end": 2140.88, "text": " was this new enemy to be shot. So that's, you know, pretty interesting. And you can see pretty" }, { "start": 2140.88, "end": 2147.04, "text": " directly that there is a correlation between what's happening in the game and this learned queue" }, { "start": 2147.04, "end": 2156.16, "text": " function. If you compare this to other methods, and they really say that these other methods," }, { "start": 2156.16, "end": 2163.84, "text": " most of them have some kind of very special feature engineered, like, so their method just takes RGB," }, { "start": 2163.84, "end": 2168.08, "text": " but the other methods recognize that, oh, in these Atari games, most of the time, you know," }, { "start": 2168.08, "end": 2173.52, "text": " there are unique colors for the things. So you know, the enemies are all like green, like, and they" }, { "start": 2173.52, "end": 2180.08, "text": " make unique channels for those green enemies, or they even have handcrafted object detectors," }, { "start": 2180.08, "end": 2186.56, "text": " and tell the algorithm where these objects are. So the comparison really isn't fair. Yet," }, { "start": 2187.6, "end": 2195.52, "text": " the DQN outperform these others like almost everywhere. And they also evaluated against a" }, { "start": 2195.52, "end": 2203.44, "text": " against a human. And I don't actually know they just say an expert human. I have no idea. Maybe" }, { "start": 2203.44, "end": 2210.8, "text": " just put David Silver in front of computers like, okay, David, here you go. And you can you can," }, { "start": 2211.36, "end": 2219.36, "text": " like what happened in Pong? Like, come on, David. But you can see there, there were still problems" }, { "start": 2219.36, "end": 2225.84, "text": " where the humans were vastly superior. And they mainly attribute this to the difficulty of the" }, { "start": 2225.84, "end": 2232.8, "text": " problem. And it could also be because for example, in breakout, there's this this kind of the most" }, { "start": 2232.8, "end": 2240.96, "text": " famous example, where the agent kind of figured out this strategy of shooting the ball, shooting" }, { "start": 2240.96, "end": 2246.96, "text": " like a hole into this wall that you have to break, and then shooting the ball up here. So the ball" }, { "start": 2246.96, "end": 2252.8, "text": " bounces up and down. And basically, you win. From then on, you just watch the ball go. And the agent" }, { "start": 2252.8, "end": 2258, "text": " does nothing anymore. So this deep Q networks figured out that strategy, and you need to pull" }, { "start": 2258, "end": 2265.04, "text": " it off very precisely, which of course, the the computer can do very well. So it sometimes achieves" }, { "start": 2265.04, "end": 2271.04, "text": " these super high scores by pulling something off precisely. But in games where they say where you" }, { "start": 2271.04, "end": 2278.96, "text": " have to plan ahead for longer, it it kind of fails. And we know that this long planning was about to" }, { "start": 2278.96, "end": 2287.44, "text": " be a problem for years to come. And it's still not solved. So still, go explore is highly controversial" }, { "start": 2287.44, "end": 2293.92, "text": " that can solve these kind of long exploration games. And those are still games, right? So we are" }, { "start": 2293.92, "end": 2301.84, "text": " basically not we are very much further than they were in this paper. But also, we are basically no" }, { "start": 2302.4, "end": 2310.08, "text": " nowhere yet. Yeah, if I'm if I'm allowed to say that. So I enjoyed reading this paper, I" }, { "start": 2310.08, "end": 2317.2, "text": " this is it's very it's very well written. If you somehow know how to think about reinforcement" }, { "start": 2317.2, "end": 2323.84, "text": " learning, like this, this Q function, what the Q function means, and why you would learn it in this" }, { "start": 2323.84, "end": 2330.56, "text": " way. I find this is not super well described, this kind of requires a bit of a knowledge of not of" }, { "start": 2330.56, "end": 2338, "text": " RL, but just of how to think of RL. But apart from this, everything else is written incredibly" }, { "start": 2338, "end": 2344.72, "text": " well, easy, straightforward. And you know, this was just a nice work of its time. And I appreciate" }, { "start": 2344.72, "end": 2371.52, "text": " it for that. Alright, I'll see you next time. And I appreciate your time too. Bye." } ]
Nq3auVtvd9Q
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Classic] ImageNet Classification with Deep Convolutional Neural Networks (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "classic", "alexnet", "hinton", "geoff hinton", "imagenet", "convolution", "convolutional neural network", "architecture", "dropout", "data augmentation", "cnns", "computer vision", "image classification", "object recognition", "classifier", "max pool", "pretraining", "deep neural networks" ]
#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 Kruschevsky, Ilya Sutskever and Jeffrey E. Hinton. 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 it kind of shook the world, because previously computer vision was still doing like hand engineered features and then using some kind of classifiers on top of those. This paper basically changed everything. So we'll go through the paper and we'll see what was already known, and especially I always enjoy with these papers how did the choices that people make back then, how did they pull through to today, sort of what arbitrary choices that Alex Kruschevsky 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. So they start off by saying that that current approaches to object recognition make essential use of machine learning methods. This was also new, right? Object recognition wasn't always learned. The 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 we can collect larger datasets, learn more powerful models, and use better techniques for preventing overfitting. Until recently datasets of labeled images were relatively small, on the orders of tens of thousands of images. So this especially at NORP, or here the C410, or C4100, these are relatively small datasets with relatively small images as well, like C410 is 32 by 32 pixels. So they're saying that in these small datasets you can solve it with classical computer vision models, but if you have larger datasets, and especially more realistic datasets 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. So they say that this ImageNet dataset is one of those larger datasets, consists of 15 million labeled high resolution images in over 22,000 categories. People keep forgetting this, and I am included in that group of people, that the ImageNet dataset is actually much larger than we know, than we when we talk of ImageNet. When we speak of ImageNet we think of the ImageNet that has a thousand classes and about one or one and a half million images. However that's only a subset of the much much larger ImageNet dataset within many many more categories. It's just that the ImageNet 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 problem cannot be specified even by a dataset as large as ImageNet. So our model should also have lots of prior knowledge to compensate for all the data we don't have. So their main argument for using neural networks is that the size of the dataset is so large, therefore we need a large model. Granted they already recognize the inherent connection between large models and a lot of complex data, but in the opposite they say well even if we have that much data the task we are trying to solve, object recognition, is way more complicated than the amount of data we have. So our model should also have lots of prior knowledge to compensate for all the data we don't have. Remember at this time convolutional neural networks weren't really known to do anything. 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 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, feed-forward neural networks, are already too powerful. They don't know anything about the data. Everything's connected to everything and they argue right here our model should have lots of prior knowledge to compensate for all the data we don't have. So they allude to the convolutional neural networks constitute one such class of models. Their capacity can be controlled by varying the depth and breadth and they also make strong and mostly correct assumptions about the nature of images, namely stationarity of statistics and locality of pixel dependencies. So their argument here is that the convolutional operation is such a strong prior that is mostly consistent with what we know about images that they are very well suited to computer vision. Again something that was not abundantly clear at the time as it is right now. It's interesting to see how they get to this point where they say we need lots of capacity but we also need a model with lots of prior knowledge and of course CNNs fit that very well. So they go into the problems of CNN despite the attractive qualities and despite the relative efficiency of their local architecture they are prohibitively expensive to apply in large-scale high-resolution images. Luckily current GPUs paired with a highly optimized implementation of 2D convolution are powerful enough to facilitate the training of interestingly large CNNs and recent data sets such as ImageNet contain enough labeled example to train such model without severe overfitting. So overfitting was also still like very much at the forefront of people's minds back then. Right now we don't really care about overfitting that much anymore. Basically we figured out that if we just build large enough models we don't overfit which is strange in itself like this double descent phenomenon and so on but overfitting was still 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 by data augmentation. It might actually have something to do with regularizing your function making it more smooth and so on. So you just see 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 in SVMs and things like this. So it's safe to say that they thought if we built these large models we're gonna have a huge overfitting problem and yeah so that's why this pulls through right here. Also I guess one of the main contributions of this paper is to show to combine this CNN training with GPUs. Also not very non-clear at the time like it was known that you could do computation on GPUs but the fact that these are you know very capable for training these CNNs or generally neural networks wasn't something that was you know known at the time. So this paper basically showed that if you use a GPU you can 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 network's size is limited mainly by the amount of memory available on current GPUs and by the amount of training time that we are willing to tolerate. Our network takes between five and six days to train on two GTX 580 GPUs. All of our experiments suggest that our results can be improved by simply waiting for faster GPUs and bigger data sets to become available. And I mean that proved to be absolutely true. We don't necessarily have bigger data sets right now though we do but certainly with faster GPUs and bigger GPUs this became a this became these networks became better simply by increasing their depth and as you know then ResNets came along increasing the depth by an order of magnitude and that gave another boost to computer vision. Alright so they talk about the ImageNet data set here and the main point in the ImageNet data set right here is the fact that the images are plenty so there are over a million training images in this subset with a thousand classes which was you know a very big that was that was on like CIFAR 10 had 10 classes, CIFAR 100 had a hundred classes that was already a lot. A thousand classes that is like unheard of before this data set. I guess not unheard of but yeah and a million training images. Completely crazy and also not only was it a lot of images they were resolution was really big so in the order of 256 by 256 whereas previous methods all were like 32 by 32 so definitely challenging data set even today it's a challenging data set. Alright so the architecture. The architecture and there's this famous graphic right here of the AlexNet architecture so briefly they described 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 AlexNet is you can see there are these two different pipelines and Alex for cutting off this part right here I mean you just know like this 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 submissions ruining yet another paper alright but you can see there is this two this this two column architecture right here so this network was so large that it didn't fit on one GPU so they had to split it onto two GPUs with the occasional intercommunication right you can see here there is intercommunication between the two GPUs and there is also no intercommunication right here on this layer this was very intricate that was one thing that really didn't hold until today I guess until now with things like I don't know G shard or so where you have different weights on different GPUs again I guess the the invention of bigger GPUs made that sort of super fluid but just imagine the amount of code they had to write there was no tensor flow at this point there I don't think there was even cafe around there was just CUDA and yeah just this cross GPU memory writing I just imagined this to be so so ugly and big respect for writing all of this all of this code alright so they 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 non-linearity now of course relu is nowadays all like abundant everyone uses relu's non-linearities but at that time it was still very much in fashion to use something like the sigmoid right here or the hyperbolic tangent and why is that because the neural networks were still kind of inspired by the neurons where you had the soma of the neuron and then the input dendrites sorry the dendrites with the input axons and then you would sum up all the incoming signals and then that would go over so in the true neuron you have this 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 the English term is then if it rise above that then the neuron would start to spike right and if it's below that it wouldn't so people wanted to approximate this using some sort of a a kind of differentiable but something that's very similar to this step function and that ultimately led to something like a sigmoid or an hyperbolic tangent so people trying to stay close to biological neurons did this but that gives you the problem that in this region and in this region right here you have almost no gradient to learn from so you can see that they argue that in terms of training time with gradient descent the saturating non-linearity so the hyperbolic tangent and the sigmoid are much slower than the non saturating lean non-linearity this one following Narendt Hinton we refer to neurons with this non-linearity as rectified linear units so taken from this this other paper they say okay we use these relu's these rectified linear units which are not exactly like real biological neurons but they train much faster right and of course relu's are used until this day so you can see right here that a this is on a C for 10 and they measure the time to reach 25% of the training error and this here is with the relu's and this here is with the hyperbolic tangent and it takes much longer to reach the hyperbolic tangent especially it takes six times faster to with the relu's and they say that's one of the main components that allows them to learn this fast to even experiment with these big networks because their entire training time is six days right but they probably didn't train it only once they experimented with it and saw what works so if you have a couple of months of time and he takes you a week to train one of these things you know you don't you can't afford a six times slowdown because that would mean you can only train like two models in the entire course of research and that would severely hinder your progress now we are at the point where that becomes true again with these giant giant transformer language models where people can train it once and then you know like GPT-3 they say oh we made we discovered a bug halfway through and we've kind of fixed it but we're not sure we couldn't restart because it was too expensive yeah maybe we're waiting for a moment I'm still saying we're waiting for the resonant moment in the transformers but yeah relu's in you know here in not introduced here but used here and have been prevailing until today training on multiple GPUs something as I said that didn't didn't really get forward from here especially the kind of GPU training 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 train million training samples are enough to train networks which are too big to fit on one GPU therefore we spread the net across two GPUs current GPUs are particularly well suited to cross GPU parallelization as they're able to read from and write to one another's memory directly without going through the host machine okay so this means that for so sorry here they say the parallelization scheme that we employ essentially puts half the kernels or neurons on each GPU with one additional trick the GPUs communicate only in certain layers that means that for example the kernels of layer 3 take input from all kernel maps in layer 2 however the kernels in layer 4 take input only from the kernel maps in layer 3 which reside on the same GPU so very very interesting choice right here and they they justify this here or they say the results this scheme reduces our top one top five error rates by 1.7 and 1.2 percent respectively as compared with a net with half as many kernels in each computational layer in each convolutional layer on one GPU the two GPU net takes slightly less time to train than the one a GPU net so first of all I have to say big respect right here like like I can imagine they did this you know with the relu's and stuff and they were already better than previous because they're so just to go to the results the pre they beat the error rates of previous models by ginormous 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 percent and here their best one is at 17 percent top five error rate I'm gonna imagine that they trained it first and we're already better than the 25 percent and I guess lots of people would just call it a day would be like oh cool we have this entirely new method not only did we show that we can train it we actually showed that it's better and bad a boom I have point one percent 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 error rate by 1% this reduces the error rate by 2% and you know really they they went about it how far can we push this with everything I mean just imagine you come and you train a network I'm pretty sure they first trained on one GPU right and and then they thought oh you know maybe we can train an even bigger network by using two GPUs and then they realized what it's gonna take like a crap ton amount of dumb code to cross synchronize and keep them in lockstep and blah blah blah like it's not even easy to write multi GPU code today with all the frameworks just imagine that and for them to having already observed that their network does better than everything that was previously to sit down and do the cross GPU thing experiment with okay when do we cross communicate and whatnot that is very very respectable right here so maybe a lesson to be learned or or just the mentality of the people maybe they just had more time they were like okay it's still like two months out 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 one percent improvement and this one already had the improvement and did it anyway okay but multi GPU training didn't really it's 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 with G-shard this is coming back so worth another shot I guess next one local response normalization this also didn't really stick around I cut kind of dumped in favor of things like batch normalization but with the resurfacing of things like layer normalization this it comes back to this thing here again a little bit so what they say is that what they want to do is they want to kind of normalize the response of these of these relu's so what they do is each response which is this alpha they are these a here is normalized by the following quantity and it's the all the responses of the other neurons around them or of the other kernels around them and you can see the sum is over this weird quantity right here so what does it mean if they have a bunch of convolutional filters and these are the activation so these are the feature maps after the convolution and yeah so if I have like 10 convolutional filters in my layer this is going to be the output the way they normalizes they normalize each filter sorry each output channel by averaging by you 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 pre defines these groups like here is there's two groups and we only normalize within this group and within this group also always the same this kind of dynamic normalization on across neighboring filters as I said didn't really stick around not really sure why but I guess it was just easier to implement it otherwise or it just worked better again here they say this this it was motivated well right this scheme bears some resemblance to the local contrast normalization scheme of that but ours would be more correctly termed brightness normalization since we do not subtract the mean activity 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 percent 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 2x2 in the stride of 2 like we do today and you know pull it down to a smaller image what we can do instead is we can pool with overlapping windows so in that case they pool with a 3x3 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 percent and 0.3 percent maybe this this didn't stick around because I'm not sure maybe because people found it doesn't work in other problems who knows so the overall architecture as we said is described in this picture right here so you have the input image which you can see has three channels and they use convolutional filters with a here with a stride of four at the beginning to reduce the size so at the beginning it's 224 by 224 and then it's 48 by sorry it's 55 by 55 that thing here 55 by 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 four 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 three by three kernels from the very start and don't really care about you know also downsizing their their filters I don't really know why whether it's just more convenient or less parameters or whether there's really something to having small filters but I just know you know this is something the large filters at the beginning is something that didn't didn't hold over time also you can see right here they have multiple dense layers at the end I believe most architectures today simply go with two of those instead of three so one like hidden layer and then one classification layer but it's you know it's it's very close to the architectures today right there hasn't changed that much like the difference between this and the VGG 16 VGG 19 network is just depth and then the difference between those and the ResNet is just the whatever these 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 convolution 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 it was I think maybe they did and maybe it was actually overfitting but we now we we don't care about overfitting too much anymore maybe because we already use these augmentations naturally but also because we built these deep models so we somehow have an idea that they generalize naturally I'm not sure whether they actually were only worried about it that much because of the history of machine learning or whether they actually did see that everything was overfitting constantly okay they say our neural network architecture has 60 million parameters although the thousand classes make each training example impose 10 bits of constraints on the mapping from image to label this turns out to be insufficient to learn many parameters without considerable overfitting below we describe two primary ways in which we combat overfitting again there's no one today no one today makes this argument anymore this oh we have this many parameters and there are that many images right we have 60 million parameters we have 1.2 million images a thousand classes how you know when how many parameters per sample is that and so on how many bits of constraint we don't care about we're fine with having like a billion times more parameters than training samples we we don't worry about it anymore so the first thing they do is data augmentation already I mean this was already known again like lots of these things here were already known but the combination is just so cool in this paper where so first of all again they say the transformed images are generating Python code on the CPU while the GPU is training on the previous batch of images so these data augmentation schemes are in effect computationally free again this code must have been ugly the first form of data augmentation consists of generating image translations and horizontal reflections we do this by extracting random 224 by 224 patches and their horizontal reflections from the 256 by 256 images okay so random so this was already this these are the most valuable data augmentations that still we have today random horizontal flipping is still used in every pipeline of computer vision except if you want to read text I guess and random cropping is still the most powerful data augmentation technique for images today and the it's crazy that this was already discovered and I I don't know whether they say right here how much this particular thing improves I don't think they have a stat on how much this improves they just say how much this this next thing improves but I'm going to guess this was one of the vital things for pushing the performance because now we know cropping is very important I guess they thought that they they would you know translation was the important part and so they focused on generating image translations and to generate an image translation from a single image naturally you have to crop it however we we we now focus much more on the fact that we crop it and kind of have different sub images of the same image especially in you know self-supervised learning and things like this we know that cropping is what is like the the power horse of these methods so the fact that they extract random patches right here means that their network only operates on these sub patches and then they compensate by a test time the networks makes a prediction by extracting five patches the four corner patches and the center patch as well as their horizontal reflections and averaging the prediction made by the networks softmax layer on the ten 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 a 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 in training images specifically we perform PCA on the set of RGB pixel values throughout the image in a training set to each training image we add multiples of the found principal components with magnitudes proportional to the corresponding eigenvalues times a random variable drawn from a gauss 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 or maybe because you need these stats over the entire data set and the other things may be working equivalently well but you you can simply apply them without knowing kind of your your principal components okay next thing dropout dropout has been you know one of the things that was very important throughout the early stages of deep learning isn't that important anymore now dropout some people still use it but most people I think don't use dropout anymore and it's very interesting to see but it definitely was a technique that was used a lot during like from Alex net to basically like now or 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 for big neural networks that already take several days to train there is however a very efficient version of model combination that only costs about a factor of two during training so there's this take this technique called dropout then they explain it to set to zero the output of each hidden neuron with probability 0.5 again people didn't know about dropout as they do now but they introduced this right here and they say it reduces their not sure that they also don't say how they how much they by how much this reduces the training error but they say we use drop out in the first two fully connected layers without dropout our network exhibits substantial overfitting dropout roughly doubles the number of iterations required to converge so okay so they did actually make sure or they did find the actual evidence of overfitting and saw that dropout reduces that and I wonder why this doesn't happen nowadays maybe because we have the we have less of these fully connected layers but I can't really imagine maybe because we do more augmentation I don't I don't know or maybe dropout is still used and I'm just I just don't know it and don't see it yeah so here they use momentum to train this and they do some qualitative analysis they do some qualitative analysis so first of all they say okay they shatter all of the previous approaches especially also then they build kind of ensemble methods and they pre-trained they already do transfer learning they already pre-trained 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 it's cool to see that this one also does so this one here is also a very cool investigation where they look at examples and the red bar the red one is always the correct label and the bars are basically what their model says are the top five things and it's cool to look at so for example here you have might as the top one but then also black widow cockroach tick starfish but the top labels are usually also very very good labels you can see here grill and it assigns convertible which you know by all means is correct it's just not the class that the annotators assigned to this particular image as well as here Dalmatian was the highest prediction of the network where the label was actually cherry and this is this is quite debatable right so you can see that a lot of the mistakes the network does is are are you know forgivable let's say and you can see that for when the network doesn't do mistakes the not only the top label is good but a lot of the top five labels are also very very adequate lastly they look at a given training set image which these are the training set images right here and they look at the last layers feature vector and the five nearest or the nearest neighbors in Euclidean space of the entire training data set and here's what you come up with so you can see for the elephant the nearest neighbors are all other elephants and regard that they are in different poses right they don't always look the same way these elephants also these dogs right here so it's pretty cool to see that the network actually learns some invariances across the class and puts images with the same label into the same area in the embedding space yeah so that's their that's their paper that 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 infrared temporal pathway of the human visual system ultimately with ultimately we would like to use very large and deep convolutional nets on video sequences where the temporal structure provides very helpful information that is missing of our far less obvious in static images so already the previewing of future research here with the self supervised with the many more layers and so on astounding that this kind of foresight and 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, "end": 5.1000000000000005, "text": " Hi there! Today we'll look at ImageNet classification with deep convolutional" }, { "start": 5.1000000000000005, "end": 10.9, "text": " neural networks by Alex Kruschevsky, Ilya Sutskever and Jeffrey E. Hinton." }, { "start": 10.9, "end": 15.24, "text": " This paper is another one in the installment of our historical paper" }, { "start": 15.24, "end": 20.28, "text": " overview, where we go through kind of old papers that were or weren't very" }, { "start": 20.28, "end": 26.6, "text": " impactful and see what people knew at the time already, how this developed and" }, { "start": 26.6, "end": 31.76, "text": " so on. Of course this paper here, also known as AlexNet, was the one that" }, { "start": 31.76, "end": 37.64, "text": " started the deep learning revolution, so to say, or at least contributed in large" }, { "start": 37.64, "end": 42.56, "text": " part to it. It was the first paper that showed that you could train these very" }, { "start": 42.56, "end": 49.44, "text": " deep neural networks, and very deep in here is a relative term, but the first" }, { "start": 49.44, "end": 55.68000000000001, "text": " one that showed that you could actually use CUDA, GPUs, to train those large" }, { "start": 55.68, "end": 60.76, "text": " networks efficiently, and it won the ImageNet competition that year, and it" }, { "start": 60.76, "end": 67.92, "text": " did so by a very very large margin. So it kind of shook the world, because" }, { "start": 67.92, "end": 72.6, "text": " previously computer vision was still doing like hand engineered features and" }, { "start": 72.6, "end": 78.44, "text": " then using some kind of classifiers on top of those. This paper basically" }, { "start": 78.44, "end": 83.88, "text": " changed everything. So we'll go through the paper and we'll see what was already" }, { "start": 83.88, "end": 90.16, "text": " known, and especially I always enjoy with these papers how did the choices that" }, { "start": 90.16, "end": 95.8, "text": " people make back then, how did they pull through to today, sort of what arbitrary" }, { "start": 95.8, "end": 100.75999999999999, "text": " choices that Alex Kruschevsky made right here are we still doing today and what" }, { "start": 100.75999999999999, "end": 105.32, "text": " have we learned since then. So the paper is written relatively" }, { "start": 105.32, "end": 110.3, "text": " straightforward, I have to say. It's a good read if you want to read it, and you" }, { "start": 110.3, "end": 114.52, "text": " know straightforward, and sort of gives you a little bit of an intuition of how" }, { "start": 114.52, "end": 122.12, "text": " much work must have gone into this, which is I guess a lot. So they start off" }, { "start": 122.12, "end": 127.96, "text": " by saying that that current approaches to object recognition make essential use" }, { "start": 127.96, "end": 132, "text": " of machine learning methods. This was also new, right? Object recognition" }, { "start": 132, "end": 138.64, "text": " wasn't always learned. The object recognizers, you could even do it in" }, { "start": 138.64, "end": 143.44, "text": " the indifferent way, like matching templates and so on. Machine learning" }, { "start": 143.44, "end": 150.04, "text": " was still one of the methods used, and of course today it's the method used. To" }, { "start": 150.04, "end": 154.48, "text": " improve their performance we can collect larger datasets, learn more powerful" }, { "start": 154.48, "end": 159.44, "text": " models, and use better techniques for preventing overfitting. Until recently" }, { "start": 159.44, "end": 163.27999999999997, "text": " datasets of labeled images were relatively small, on the orders of tens" }, { "start": 163.28, "end": 169.32, "text": " of thousands of images. So this especially at NORP, or here the C410," }, { "start": 169.32, "end": 174.32, "text": " or C4100, these are relatively small datasets with relatively small" }, { "start": 174.32, "end": 181.64, "text": " images as well, like C410 is 32 by 32 pixels. So they're saying that" }, { "start": 181.64, "end": 186.88, "text": " in these small datasets you can solve it with classical computer" }, { "start": 186.88, "end": 191.92000000000002, "text": " vision models, but if you have larger datasets, and especially more realistic" }, { "start": 191.92, "end": 196.6, "text": " datasets like bigger resolution and so on, you need bigger models. So they say" }, { "start": 196.6, "end": 201.27999999999997, "text": " but objects in realistic settings exhibit considerable variability to" }, { "start": 201.27999999999997, "end": 208.32, "text": " learn to recognize them, it is necessary to use much larger training sets. So" }, { "start": 208.32, "end": 214.64, "text": " they say that this ImageNet dataset is one of those larger datasets, consists of" }, { "start": 214.64, "end": 219.64, "text": " 15 million labeled high resolution images in over 22,000 categories." }, { "start": 219.64, "end": 225.51999999999998, "text": " People keep forgetting this, and I am included in that group of people, that" }, { "start": 225.51999999999998, "end": 230.64, "text": " the ImageNet dataset is actually much larger than we know, than we when we" }, { "start": 230.64, "end": 235.67999999999998, "text": " talk of ImageNet. When we speak of ImageNet we think of the ImageNet that" }, { "start": 235.67999999999998, "end": 240.56, "text": " has a thousand classes and about one or one and a half million images. However" }, { "start": 240.56, "end": 246.92, "text": " that's only a subset of the much much larger ImageNet dataset within many" }, { "start": 246.92, "end": 252.72, "text": " many more categories. It's just that the ImageNet competitions were performed on" }, { "start": 252.72, "end": 256.47999999999996, "text": " this subset, because I guess people thought well a thousand classes and" }, { "start": 256.47999999999996, "end": 262.36, "text": " a million images is already plenty, so we'll do that. So that's I guess how that" }, { "start": 262.36, "end": 268.96, "text": " came to be. So their argument is right here, to learn about thousands of objects" }, { "start": 268.96, "end": 274, "text": " from millions of images we need a model with a large learning capacity. However" }, { "start": 274, "end": 277.04, "text": " the immense complexity of object recognition task means that this" }, { "start": 277.04, "end": 282.12, "text": " problem cannot be specified even by a dataset as large as ImageNet. So" }, { "start": 282.12, "end": 286.12, "text": " our model should also have lots of prior knowledge to compensate for all the" }, { "start": 286.12, "end": 291.32, "text": " data we don't have. So their main argument for using neural" }, { "start": 291.32, "end": 297.08, "text": " networks is that the size of the dataset is so large, therefore we need a large" }, { "start": 297.08, "end": 304.76, "text": " model. Granted they already recognize the inherent connection" }, { "start": 304.76, "end": 310.82, "text": " between large models and a lot of complex data, but in the opposite they" }, { "start": 310.82, "end": 316.46, "text": " say well even if we have that much data the task we are trying to solve, object" }, { "start": 316.46, "end": 322.82, "text": " recognition, is way more complicated than the amount of data we have. So our model" }, { "start": 322.82, "end": 328.28, "text": " should also have lots of prior knowledge to compensate for all the data we don't" }, { "start": 328.28, "end": 334.48, "text": " have. Remember at this time convolutional neural networks weren't really" }, { "start": 334.48, "end": 338.32, "text": " known to do anything. I guess they were used for handwritten" }, { "start": 338.32, "end": 342.03999999999996, "text": " digit recognition and so on and were kind of on par with other methods." }, { "start": 342.03999999999996, "end": 346.8, "text": " However it wasn't like obviously clear that you would use them for image" }, { "start": 346.8, "end": 352.03999999999996, "text": " recognition. So here they have to make like a argument to convince" }, { "start": 352.04, "end": 357.48, "text": " people that okay we can use neural networks for this task because they have" }, { "start": 357.48, "end": 363.72, "text": " such a high capacity. However neural networks, feed-forward neural" }, { "start": 363.72, "end": 367.76000000000005, "text": " networks, are already too powerful. They don't know anything about the data." }, { "start": 367.76000000000005, "end": 372.8, "text": " Everything's connected to everything and they argue right here our model should" }, { "start": 372.8, "end": 377.16, "text": " have lots of prior knowledge to compensate for all the data we don't have." }, { "start": 377.16, "end": 382.8, "text": " So they allude to the convolutional neural networks constitute one such class" }, { "start": 382.8, "end": 386.68, "text": " of models. Their capacity can be controlled by varying the depth and" }, { "start": 386.68, "end": 391.28000000000003, "text": " breadth and they also make strong and mostly correct assumptions about the" }, { "start": 391.28000000000003, "end": 396.40000000000003, "text": " nature of images, namely stationarity of statistics and locality of pixel" }, { "start": 396.40000000000003, "end": 401.72, "text": " dependencies. So their argument here is that the convolutional operation is such" }, { "start": 401.72, "end": 407.12, "text": " a strong prior that is mostly consistent with what we know about images that" }, { "start": 407.12, "end": 411.44, "text": " they are very well suited to computer vision. Again something that was not" }, { "start": 411.44, "end": 417.2, "text": " abundantly clear at the time as it is right now. It's interesting to see how" }, { "start": 417.2, "end": 420.92, "text": " they get to this point where they say we need lots of capacity but we also need" }, { "start": 420.92, "end": 429.36, "text": " a model with lots of prior knowledge and of course CNNs fit that very well." }, { "start": 429.36, "end": 435.6, "text": " So they go into the problems of CNN despite the attractive qualities" }, { "start": 435.6, "end": 439.68, "text": " and despite the relative efficiency of their local architecture they are" }, { "start": 439.68, "end": 444.44, "text": " prohibitively expensive to apply in large-scale high-resolution images." }, { "start": 444.44, "end": 448.64000000000004, "text": " Luckily current GPUs paired with a highly optimized implementation of 2D" }, { "start": 448.64000000000004, "end": 453.08000000000004, "text": " convolution are powerful enough to facilitate the training of interestingly" }, { "start": 453.08000000000004, "end": 457.92, "text": " large CNNs and recent data sets such as ImageNet contain enough labeled example" }, { "start": 457.92, "end": 462.64000000000004, "text": " to train such model without severe overfitting. So overfitting was also" }, { "start": 462.64, "end": 467.36, "text": " still like very much at the forefront of people's minds back then. Right now we" }, { "start": 467.36, "end": 471.52, "text": " don't really care about overfitting that much anymore. Basically we figured out" }, { "start": 471.52, "end": 477.76, "text": " that if we just build large enough models we don't overfit which is strange" }, { "start": 477.76, "end": 482.8, "text": " in itself like this double descent phenomenon and so on but overfitting was" }, { "start": 482.8, "end": 489.88, "text": " still very much at the forefront of people's minds and they do a lot of" }, { "start": 489.88, "end": 496.52, "text": " things here to prevent overfitting which gives them kind of a boost in the test" }, { "start": 496.52, "end": 501.44, "text": " accuracy which might actually not have been the overfitting that they're" }, { "start": 501.44, "end": 505.71999999999997, "text": " combating. So they do for example in data augmentation already in this paper" }, { "start": 505.71999999999997, "end": 511, "text": " and they always allude to how this is to prevent overfitting. However we know" }, { "start": 511, "end": 517.68, "text": " nowadays that it might not be the overfitting that's combated by data" }, { "start": 517.68, "end": 522.28, "text": " augmentation. It might actually have something to do with regularizing" }, { "start": 522.28, "end": 528.68, "text": " your function making it more smooth and so on. So you just see how" }, { "start": 528.68, "end": 533.8, "text": " coming from a classical machine learning perspective overfitting was like the" }, { "start": 533.8, "end": 537.3599999999999, "text": " number one or one of the number one problems in classical machine learning" }, { "start": 537.3599999999999, "end": 545.16, "text": " in SVMs and things like this. So it's safe to say that they thought" }, { "start": 545.16, "end": 549.24, "text": " if we built these large models we're gonna have a huge overfitting problem" }, { "start": 549.24, "end": 556.04, "text": " and yeah so that's why this pulls through right here. Also I guess" }, { "start": 556.04, "end": 561.4, "text": " one of the main contributions of this paper is to show to combine this CNN" }, { "start": 561.4, "end": 566.56, "text": " training with GPUs. Also not very non-clear at the time like it was known" }, { "start": 566.56, "end": 573.04, "text": " that you could do computation on GPUs but the fact that these are you know very" }, { "start": 573.04, "end": 578.24, "text": " capable for training these CNNs or generally neural networks wasn't" }, { "start": 578.24, "end": 584.48, "text": " something that was you know known at the time. So this paper basically showed that" }, { "start": 584.48, "end": 591.48, "text": " if you use a GPU you can get that much faster and that makes it" }, { "start": 591.48, "end": 597.92, "text": " possible to train these big neural networks. Again right here the size of" }, { "start": 597.92, "end": 602.28, "text": " our network made overfitting a significant problem even with 1.2" }, { "start": 602.28, "end": 606.56, "text": " million labeled training examples so we use several effective techniques for" }, { "start": 606.56, "end": 613.48, "text": " preventing overfitting and we'll look at those. And the end they say the" }, { "start": 613.48, "end": 618.36, "text": " network's size is limited mainly by the amount of memory available on current" }, { "start": 618.36, "end": 622.48, "text": " GPUs and by the amount of training time that we are willing to tolerate. Our" }, { "start": 622.48, "end": 629.52, "text": " network takes between five and six days to train on two GTX 580 GPUs. All of our" }, { "start": 629.52, "end": 633.6, "text": " experiments suggest that our results can be improved by simply waiting for faster" }, { "start": 633.6, "end": 638.24, "text": " GPUs and bigger data sets to become available. And I mean that proved to be" }, { "start": 638.24, "end": 642.56, "text": " absolutely true. We don't necessarily have bigger data sets right now though" }, { "start": 642.56, "end": 651.88, "text": " we do but certainly with faster GPUs and bigger GPUs this became a this became" }, { "start": 651.88, "end": 657.18, "text": " these networks became better simply by increasing their depth and as you know" }, { "start": 657.18, "end": 662.5999999999999, "text": " then ResNets came along increasing the depth by an order of magnitude and that" }, { "start": 662.5999999999999, "end": 668.8399999999999, "text": " gave another boost to computer vision. Alright so they talk about the ImageNet" }, { "start": 668.8399999999999, "end": 675.28, "text": " data set here and the main point in the ImageNet data set right here is the fact" }, { "start": 675.28, "end": 681.56, "text": " that the images are plenty so there are over a million training images in this" }, { "start": 681.56, "end": 688.28, "text": " subset with a thousand classes which was you know a very big that was that was on" }, { "start": 688.28, "end": 692.4399999999999, "text": " like CIFAR 10 had 10 classes, CIFAR 100 had a hundred classes that was already a" }, { "start": 692.4399999999999, "end": 700.16, "text": " lot. A thousand classes that is like unheard of before this data set. I guess" }, { "start": 700.16, "end": 706.28, "text": " not unheard of but yeah and a million training images. Completely crazy and" }, { "start": 706.28, "end": 713.24, "text": " also not only was it a lot of images they were resolution was really big so" }, { "start": 713.24, "end": 721.04, "text": " in the order of 256 by 256 whereas previous methods all were like 32 by 32" }, { "start": 721.04, "end": 728.24, "text": " so definitely challenging data set even today it's a challenging data set. Alright" }, { "start": 728.24, "end": 733.04, "text": " so the architecture. The architecture and there's this famous graphic right" }, { "start": 733.04, "end": 739.64, "text": " here of the AlexNet architecture so briefly they described these" }, { "start": 739.64, "end": 744.52, "text": " convolutional layers right here as you can see there's max pooling already" }, { "start": 744.52, "end": 750.68, "text": " here they have dense layers at the end they do generally increase the number" }, { "start": 750.68, "end": 755.9599999999999, "text": " of feature maps right here while decreasing the resolution with max" }, { "start": 755.9599999999999, "end": 761.78, "text": " pooling so all of this has sort of you know kept until today I guess they also" }, { "start": 761.78, "end": 765.56, "text": " took it from earlier work on convolutional neural networks that" }, { "start": 765.56, "end": 772.72, "text": " generally found this to be a good idea and the important part here that is kind" }, { "start": 772.72, "end": 776.3199999999999, "text": " of special to AlexNet is you can see there are these two different pipelines" }, { "start": 776.3199999999999, "end": 784, "text": " and Alex for cutting off this part right here I mean you just know like this has" }, { "start": 784, "end": 788.88, "text": " the eight pages we need to like we have like three lines too much how can we fit" }, { "start": 788.88, "end": 793.16, "text": " the three lines we've already cropped everything let's just cut off the top" }, { "start": 793.16, "end": 799.4399999999999, "text": " half here it's essentially the same as the bottom yeah so space constraints and" }, { "start": 799.4399999999999, "end": 806.24, "text": " PDFs for conference submissions ruining yet another paper alright but you can" }, { "start": 806.24, "end": 811.32, "text": " see there is this two this this two column architecture right here so this" }, { "start": 811.32, "end": 817.8, "text": " network was so large that it didn't fit on one GPU so they had to split it onto" }, { "start": 817.8, "end": 823.8, "text": " two GPUs with the occasional intercommunication right you can see" }, { "start": 823.8, "end": 828.7199999999999, "text": " here there is intercommunication between the two GPUs and there is also no" }, { "start": 828.7199999999999, "end": 833.8599999999999, "text": " intercommunication right here on this layer this was very intricate that was" }, { "start": 833.8599999999999, "end": 838.4799999999999, "text": " one thing that really didn't hold until today I guess until now with things like" }, { "start": 838.4799999999999, "end": 843.7199999999999, "text": " I don't know G shard or so where you have different weights on different GPUs" }, { "start": 843.72, "end": 849.5600000000001, "text": " again I guess the the invention of bigger GPUs made that sort of super" }, { "start": 849.5600000000001, "end": 854.1600000000001, "text": " fluid but just imagine the amount of code they had to write there was no" }, { "start": 854.1600000000001, "end": 858.72, "text": " tensor flow at this point there I don't think there was even cafe around there" }, { "start": 858.72, "end": 867.32, "text": " was just CUDA and yeah just this cross GPU memory writing I just imagined this" }, { "start": 867.32, "end": 873.8000000000001, "text": " to be so so ugly and big respect for writing all of this all of this code" }, { "start": 873.8000000000001, "end": 879.84, "text": " alright so they they go through a number of important things and most of the" }, { "start": 879.84, "end": 886.72, "text": " things here aren't their invention let's say but they cleverly combine things" }, { "start": 886.72, "end": 890.3000000000001, "text": " that were already known about neural networks and things that were maybe" }, { "start": 890.3000000000001, "end": 894.44, "text": " developed somewhere that they have found to work really well so the first one is" }, { "start": 894.44, "end": 899.48, "text": " the relu non-linearity now of course relu is nowadays all like abundant" }, { "start": 899.48, "end": 904.72, "text": " everyone uses relu's non-linearities but at that time it was still very much in" }, { "start": 904.72, "end": 908.96, "text": " fashion to use something like the sigmoid right here or the hyperbolic" }, { "start": 908.96, "end": 912.7600000000001, "text": " tangent and why is that because the neural networks were still kind of" }, { "start": 912.7600000000001, "end": 917.6400000000001, "text": " inspired by the neurons where you had the soma of the neuron and then the" }, { "start": 917.6400000000001, "end": 924.08, "text": " input dendrites sorry the dendrites with the input axons and then you would sum" }, { "start": 924.08, "end": 930.2, "text": " up all the incoming signals and then that would go over so in the true neuron" }, { "start": 930.2, "end": 937.32, "text": " you have this this this kind of curve where if the input rises above this" }, { "start": 937.32, "end": 943.96, "text": " border right here the action potential maybe I don't know what the the English" }, { "start": 943.96, "end": 950, "text": " term is then if it rise above that then the neuron would start to spike right" }, { "start": 950, "end": 955.88, "text": " and if it's below that it wouldn't so people wanted to approximate this using" }, { "start": 955.88, "end": 961.52, "text": " some sort of a a kind of differentiable but something that's very similar to" }, { "start": 961.52, "end": 967.32, "text": " this step function and that ultimately led to something like a sigmoid or an" }, { "start": 967.32, "end": 974.68, "text": " hyperbolic tangent so people trying to stay close to biological neurons did" }, { "start": 974.68, "end": 979.84, "text": " this but that gives you the problem that in this region and in this region right" }, { "start": 979.84, "end": 985.76, "text": " here you have almost no gradient to learn from so you can see that they" }, { "start": 985.76, "end": 993.9200000000001, "text": " argue that in terms of training time with gradient descent the saturating" }, { "start": 993.9200000000001, "end": 998.48, "text": " non-linearity so the hyperbolic tangent and the sigmoid are much slower than the" }, { "start": 998.48, "end": 1003.76, "text": " non saturating lean non-linearity this one following Narendt Hinton we refer to" }, { "start": 1003.76, "end": 1009.1600000000001, "text": " neurons with this non-linearity as rectified linear units so taken from" }, { "start": 1009.16, "end": 1015.52, "text": " this this other paper they say okay we use these relu's these rectified linear" }, { "start": 1015.52, "end": 1021.36, "text": " units which are not exactly like real biological neurons but they train much" }, { "start": 1021.36, "end": 1029.36, "text": " faster right and of course relu's are used until this day so you can see right" }, { "start": 1029.36, "end": 1035.56, "text": " here that a this is on a C for 10 and they measure the time to reach 25% of" }, { "start": 1035.56, "end": 1041.36, "text": " the training error and this here is with the relu's and this here is with the" }, { "start": 1041.36, "end": 1046.48, "text": " hyperbolic tangent and it takes much longer to reach the hyperbolic tangent" }, { "start": 1046.48, "end": 1054.72, "text": " especially it takes six times faster to with the relu's and they say that's one" }, { "start": 1054.72, "end": 1060, "text": " of the main components that allows them to learn this fast to even experiment" }, { "start": 1060, "end": 1064.8799999999999, "text": " with these big networks because their entire training time is six days right" }, { "start": 1064.88, "end": 1069.48, "text": " but they probably didn't train it only once they experimented with it and saw" }, { "start": 1069.48, "end": 1074.72, "text": " what works so if you have a couple of months of time and he takes you a week" }, { "start": 1074.72, "end": 1080.0800000000002, "text": " to train one of these things you know you don't you can't afford a six times" }, { "start": 1080.0800000000002, "end": 1085.8000000000002, "text": " slowdown because that would mean you can only train like two models in the entire" }, { "start": 1085.8000000000002, "end": 1092.0800000000002, "text": " course of research and that would severely hinder your progress now we are" }, { "start": 1092.08, "end": 1097.12, "text": " at the point where that becomes true again with these giant giant transformer" }, { "start": 1097.12, "end": 1103.1999999999998, "text": " language models where people can train it once and then you know like GPT-3" }, { "start": 1103.1999999999998, "end": 1107.36, "text": " they say oh we made we discovered a bug halfway through and we've kind of fixed" }, { "start": 1107.36, "end": 1111.96, "text": " it but we're not sure we couldn't restart because it was too expensive" }, { "start": 1111.96, "end": 1115.8999999999999, "text": " yeah maybe we're waiting for a moment I'm still saying we're waiting for the" }, { "start": 1115.9, "end": 1123.1200000000001, "text": " resonant moment in the transformers but yeah relu's in you know here in not" }, { "start": 1123.1200000000001, "end": 1129.5600000000002, "text": " introduced here but used here and have been prevailing until today training on" }, { "start": 1129.5600000000002, "end": 1135.3600000000001, "text": " multiple GPUs something as I said that didn't didn't really get forward from" }, { "start": 1135.3600000000001, "end": 1140.76, "text": " here especially the kind of GPU training so if we train on multiple GPUs today" }, { "start": 1140.76, "end": 1147.08, "text": " what we mean is that we have our model right and then we distribute that to" }, { "start": 1147.08, "end": 1153.44, "text": " multiple GPUs like this and then we take a mini batch from the training data and" }, { "start": 1153.44, "end": 1159.16, "text": " we simply split it up let each GPU do its thing on its subset of the mini batch" }, { "start": 1159.16, "end": 1164.32, "text": " and then at the end kind of calculate the loss and then back propagate the" }, { "start": 1164.32, "end": 1169.12, "text": " gradients and synchronize the gradients between that so we have one model that" }, { "start": 1169.12, "end": 1175.9599999999998, "text": " is on both GPUs here they distribute a model to two GPUs and I'm also thinking" }, { "start": 1175.9599999999998, "end": 1182.56, "text": " that with frameworks like G shard this could potentially have a revival right" }, { "start": 1182.56, "end": 1187.6799999999998, "text": " here this kind of distributing your models especially within the same layer" }, { "start": 1187.6799999999998, "end": 1194.32, "text": " across many GPUs and then having cross communication only at some points so" }, { "start": 1194.32, "end": 1199.3999999999999, "text": " their argument is this only has three gigabytes of memory which limits the" }, { "start": 1199.3999999999999, "end": 1204.48, "text": " maximum size of networks can be trained on it turns out that 1.2 train million" }, { "start": 1204.48, "end": 1208.04, "text": " training samples are enough to train networks which are too big to fit on one" }, { "start": 1208.04, "end": 1213.72, "text": " GPU therefore we spread the net across two GPUs current GPUs are particularly" }, { "start": 1213.72, "end": 1218.48, "text": " well suited to cross GPU parallelization as they're able to read from and write" }, { "start": 1218.48, "end": 1223.84, "text": " to one another's memory directly without going through the host machine okay so" }, { "start": 1223.84, "end": 1232.12, "text": " this means that for so sorry here they say the parallelization scheme that we" }, { "start": 1232.12, "end": 1237.48, "text": " employ essentially puts half the kernels or neurons on each GPU with one" }, { "start": 1237.48, "end": 1242.6799999999998, "text": " additional trick the GPUs communicate only in certain layers that means that" }, { "start": 1242.6799999999998, "end": 1246.8, "text": " for example the kernels of layer 3 take input from all kernel maps in layer 2" }, { "start": 1246.8, "end": 1250.84, "text": " however the kernels in layer 4 take input only from the kernel maps in layer" }, { "start": 1250.84, "end": 1256.72, "text": " 3 which reside on the same GPU so very very interesting choice right here and" }, { "start": 1256.72, "end": 1264.6, "text": " they they justify this here or they say the results this scheme reduces our top" }, { "start": 1264.6, "end": 1269.56, "text": " one top five error rates by 1.7 and 1.2 percent respectively as compared with a" }, { "start": 1269.56, "end": 1273.84, "text": " net with half as many kernels in each computational layer in each" }, { "start": 1273.84, "end": 1279.06, "text": " convolutional layer on one GPU the two GPU net takes slightly less time to" }, { "start": 1279.06, "end": 1284.52, "text": " train than the one a GPU net so first of all I have to say big respect right here" }, { "start": 1284.52, "end": 1289.96, "text": " like like I can imagine they did this you know with the relu's and stuff and" }, { "start": 1289.96, "end": 1293.8799999999999, "text": " they were already better than previous because they're so just to go to the" }, { "start": 1293.8799999999999, "end": 1301.52, "text": " results the pre they beat the error rates of previous models by ginormous" }, { "start": 1301.52, "end": 1307.52, "text": " amount so this is what they knew right here this is on the 2010 image net split" }, { "start": 1307.52, "end": 1314.24, "text": " so the previous best ones were like at around 28 25 percent and here their best" }, { "start": 1314.24, "end": 1320.12, "text": " one is at 17 percent top five error rate I'm gonna imagine that they trained it" }, { "start": 1320.12, "end": 1324.8, "text": " first and we're already better than the 25 percent and I guess lots of people" }, { "start": 1324.8, "end": 1328.6399999999999, "text": " would just call it a day would be like oh cool we have this entirely new method" }, { "start": 1328.6399999999999, "end": 1332.6, "text": " not only did we show that we can train it we actually showed that it's better" }, { "start": 1332.6, "end": 1338.1599999999999, "text": " and bad a boom I have point one percent better error rate and everything else" }, { "start": 1338.1599999999999, "end": 1342.9599999999998, "text": " can be a separate paper no they stuck with it and they pushed it each so each" }, { "start": 1342.9599999999998, "end": 1347.48, "text": " of these things right here they say oh this reduces the error rate by 1% this" }, { "start": 1347.48, "end": 1354.04, "text": " reduces the error rate by 2% and you know really they they went about it how" }, { "start": 1354.04, "end": 1359.1599999999999, "text": " far can we push this with everything I mean just imagine you come and you train" }, { "start": 1359.16, "end": 1365.28, "text": " a network I'm pretty sure they first trained on one GPU right and and then" }, { "start": 1365.28, "end": 1370.2, "text": " they thought oh you know maybe we can train an even bigger network by using" }, { "start": 1370.2, "end": 1375.6000000000001, "text": " two GPUs and then they realized what it's gonna take like a crap ton amount" }, { "start": 1375.6000000000001, "end": 1380.8000000000002, "text": " of dumb code to cross synchronize and keep them in lockstep and blah blah blah" }, { "start": 1380.8000000000002, "end": 1385.2, "text": " like it's not even easy to write multi GPU code today with all the frameworks" }, { "start": 1385.2, "end": 1391.1200000000001, "text": " just imagine that and for them to having already observed that their network does" }, { "start": 1391.1200000000001, "end": 1396.4, "text": " better than everything that was previously to sit down and do the cross" }, { "start": 1396.4, "end": 1402.64, "text": " GPU thing experiment with okay when do we cross communicate and whatnot that is" }, { "start": 1402.64, "end": 1411.48, "text": " very very respectable right here so maybe a lesson to be learned or or just" }, { "start": 1411.48, "end": 1415.6, "text": " the mentality of the people maybe they just had more time they were like okay" }, { "start": 1415.6, "end": 1420.32, "text": " it's still like two months out this competition deadline I don't know but" }, { "start": 1420.32, "end": 1426.88, "text": " you know I'm this this is not something that I see today very often this this" }, { "start": 1426.88, "end": 1432.2, "text": " kind of persistence and additional pushing and reporting of what works in" }, { "start": 1432.2, "end": 1436.46, "text": " these kinds of things I mean some some papers do it but most papers do it" }, { "start": 1436.46, "end": 1441.1200000000001, "text": " because only with all the tricks they can get that point one percent improvement" }, { "start": 1441.1200000000001, "end": 1446.72, "text": " and this one already had the improvement and did it anyway okay but multi GPU" }, { "start": 1446.72, "end": 1451.2, "text": " training didn't really it's like splitting the models across GPUs didn't" }, { "start": 1451.2, "end": 1457.68, "text": " really didn't really stick around mainly because I guess the GPUs got larger in" }, { "start": 1457.68, "end": 1463.08, "text": " memory pretty quickly so it wasn't that necessary but also I guess because the" }, { "start": 1463.08, "end": 1467.48, "text": " frameworks were just too clunky and now maybe with G-shard this is coming back" }, { "start": 1467.48, "end": 1473.76, "text": " so worth another shot I guess next one local response normalization this also" }, { "start": 1473.76, "end": 1479.1599999999999, "text": " didn't really stick around I cut kind of dumped in favor of things like batch" }, { "start": 1479.1599999999999, "end": 1484.96, "text": " normalization but with the resurfacing of things like layer normalization this" }, { "start": 1484.96, "end": 1493.4, "text": " it comes back to this thing here again a little bit so what they say is that what" }, { "start": 1493.4, "end": 1498.56, "text": " they want to do is they want to kind of normalize the response of these of these" }, { "start": 1498.56, "end": 1504.16, "text": " relu's so what they do is each response which is this alpha they are these a" }, { "start": 1504.16, "end": 1511.92, "text": " here is normalized by the following quantity and it's the all the responses" }, { "start": 1511.92, "end": 1517.24, "text": " of the other neurons around them or of the other kernels around them and you can" }, { "start": 1517.24, "end": 1523.3600000000001, "text": " see the sum is over this weird quantity right here so what does it mean if they" }, { "start": 1523.3600000000001, "end": 1528.44, "text": " have a bunch of convolutional filters and these are the activation so these are" }, { "start": 1528.44, "end": 1534.3600000000001, "text": " the feature maps after the convolution and yeah so if I have like 10" }, { "start": 1534.3600000000001, "end": 1539.16, "text": " convolutional filters in my layer this is going to be the output the way they" }, { "start": 1539.16, "end": 1547.92, "text": " normalizes they normalize each filter sorry each output channel by averaging" }, { "start": 1547.92, "end": 1556.88, "text": " by you see here dividing by the average response of the channels around them" }, { "start": 1556.88, "end": 1561.1200000000001, "text": " right so let's maybe say the five channels though two channels in front of" }, { "start": 1561.1200000000001, "end": 1565.2, "text": " them and two channels behind them this is going to be they take the average" }, { "start": 1565.2, "end": 1570.6000000000001, "text": " across this one and then for another channel right here for this one you" }, { "start": 1570.6000000000001, "end": 1575.04, "text": " would take the average of the five around that this isn't really something" }, { "start": 1575.04, "end": 1580.8, "text": " that stuck around I guess mainly because of the really dynamic situation right" }, { "start": 1580.8, "end": 1587.48, "text": " here what people do today is they have things like layer normalization that" }, { "start": 1587.48, "end": 1592.24, "text": " simply averages across all of the channels or they have group normalization" }, { "start": 1592.24, "end": 1598.8, "text": " that pre defines these groups like here is there's two groups and we only" }, { "start": 1598.8, "end": 1603.84, "text": " normalize within this group and within this group also always the same this" }, { "start": 1603.84, "end": 1610.36, "text": " kind of dynamic normalization on across neighboring filters as I said didn't" }, { "start": 1610.36, "end": 1617.72, "text": " really stick around not really sure why but I guess it was just easier to" }, { "start": 1617.72, "end": 1624.84, "text": " implement it otherwise or it just worked better again here they say this this it" }, { "start": 1624.84, "end": 1629, "text": " was motivated well right this scheme bears some resemblance to the local" }, { "start": 1629, "end": 1632.92, "text": " contrast normalization scheme of that but ours would be more correctly termed" }, { "start": 1632.92, "end": 1638.52, "text": " brightness normalization since we do not subtract the mean activity and oh they" }, { "start": 1638.52, "end": 1646.16, "text": " make it connection to biological neurons where is it this sort of response" }, { "start": 1646.16, "end": 1650.64, "text": " normalization implements a form of lateral inhibition inspired by type" }, { "start": 1650.64, "end": 1655, "text": " found in real neurons creating competition for big activities amongst" }, { "start": 1655, "end": 1661.52, "text": " neuron outputs computed using different kernels okay so kind of inspired by real" }, { "start": 1661.52, "end": 1666.72, "text": " neurons but also kind of inspired by other people doing also some kind of" }, { "start": 1666.72, "end": 1670.76, "text": " normalization so people already knew that normalization was helpful at some" }, { "start": 1670.76, "end": 1676.16, "text": " times and this is what they employed right here again reducing the top error" }, { "start": 1676.16, "end": 1683.44, "text": " rates by 1.4 and 1.2 percent respectively so not a big improvement but still an" }, { "start": 1683.44, "end": 1688, "text": " improvement the last thing overlapping pooling again a thing that didn't really" }, { "start": 1688, "end": 1694.32, "text": " stick around that much where they say okay instead of having a pooling layer" }, { "start": 1694.32, "end": 1701.6799999999998, "text": " so if this is your image and instead of pooling 2x2 in the stride of 2 like" }, { "start": 1701.6799999999998, "end": 1706.84, "text": " we do today and you know pull it down to a smaller image what we can do instead" }, { "start": 1706.84, "end": 1713.76, "text": " is we can pool with overlapping windows so in that case they pool with a 3x3" }, { "start": 1713.76, "end": 1719.48, "text": " window but they do always do stride of 2 so they have like these overlaps right" }, { "start": 1719.48, "end": 1725.56, "text": " here resulting in the same size but then each pixel right here has some sort of" }, { "start": 1725.56, "end": 1731.8, "text": " overlapping information from the pixels around it again they say it reduces the" }, { "start": 1731.8, "end": 1737.96, "text": " top one and top five error rates by 0.4 percent and 0.3 percent maybe this this" }, { "start": 1737.96, "end": 1743.92, "text": " didn't stick around because I'm not sure maybe because people found it doesn't" }, { "start": 1743.92, "end": 1750.24, "text": " work in other problems who knows so the overall architecture as we said is" }, { "start": 1750.24, "end": 1755.64, "text": " described in this picture right here so you have the input image which you can" }, { "start": 1755.64, "end": 1761.96, "text": " see has three channels and they use convolutional filters with a here with a" }, { "start": 1761.96, "end": 1766.1200000000001, "text": " stride of four at the beginning to reduce the size so at the beginning it's" }, { "start": 1766.12, "end": 1776.1599999999999, "text": " 224 by 224 and then it's 48 by sorry it's 55 by 55 that thing here 55 by 55" }, { "start": 1776.1599999999999, "end": 1781.2399999999998, "text": " 48 feature maps you can already see as we said before the feature maps keep" }, { "start": 1781.2399999999998, "end": 1787.6, "text": " increasing while the number of the dimension the resolution of the image" }, { "start": 1787.6, "end": 1794.6799999999998, "text": " keeps decreasing the stride of four convolution here already employed in" }, { "start": 1794.68, "end": 1799.8, "text": " order to down sample the image at the same time as convolving it nowadays a" }, { "start": 1799.8, "end": 1805.3200000000002, "text": " lot of architectures will simply not do max pooling at all but always use the" }, { "start": 1805.3200000000002, "end": 1811.2, "text": " kind of strided convolution to down sample image while convolving it what" }, { "start": 1811.2, "end": 1818.76, "text": " you also see here is that they thought that the feature map size should be" }, { "start": 1818.76, "end": 1823.5600000000002, "text": " should also be large at the beginning and then decrease which is a reasonable" }, { "start": 1823.56, "end": 1827.56, "text": " assumption right because if you have higher resolution images you're" }, { "start": 1827.56, "end": 1832.44, "text": " probably going to need higher resolution feature maps this didn't really come" }, { "start": 1832.44, "end": 1838.2, "text": " through until today as you know most architectures today they just go with" }, { "start": 1838.2, "end": 1844.36, "text": " like three by three kernels from the very start and don't really care about" }, { "start": 1844.36, "end": 1851.6399999999999, "text": " you know also downsizing their their filters I don't really know why whether" }, { "start": 1851.64, "end": 1857.2800000000002, "text": " it's just more convenient or less parameters or whether there's really" }, { "start": 1857.2800000000002, "end": 1862.68, "text": " something to having small filters but I just know you know this is something the" }, { "start": 1862.68, "end": 1867.44, "text": " large filters at the beginning is something that didn't didn't hold over" }, { "start": 1867.44, "end": 1875.5600000000002, "text": " time also you can see right here they have multiple dense layers at the end I" }, { "start": 1875.5600000000002, "end": 1880.88, "text": " believe most architectures today simply go with two of those instead of three" }, { "start": 1880.88, "end": 1886.2800000000002, "text": " so one like hidden layer and then one classification layer but it's you know" }, { "start": 1886.2800000000002, "end": 1891.2, "text": " it's it's very close to the architectures today right there hasn't" }, { "start": 1891.2, "end": 1896.6000000000001, "text": " changed that much like the difference between this and the VGG 16 VGG 19" }, { "start": 1896.6000000000001, "end": 1899.7600000000002, "text": " network is just depth and then the difference between those and the" }, { "start": 1899.7600000000002, "end": 1904.8400000000001, "text": " ResNet is just the whatever these skip connections right here and that's where" }, { "start": 1904.84, "end": 1911.24, "text": " we are today so so there hasn't hasn't changed that much honestly they also" }, { "start": 1911.24, "end": 1914.76, "text": " allude to the fact that actually even though it doesn't look like it most" }, { "start": 1914.76, "end": 1919.36, "text": " parameters are here in these dense layers those are most parameters of the" }, { "start": 1919.36, "end": 1924.32, "text": " network this right here a convolution layer is like 1% of the parameters even" }, { "start": 1924.32, "end": 1929.6799999999998, "text": " though it takes up a lot of space in the in the drawing so maybe the reduction in" }, { "start": 1929.6799999999998, "end": 1933.8799999999999, "text": " the number of classification layers at the end also has something to do with" }, { "start": 1933.88, "end": 1938.68, "text": " the fact that that's where most parameters are so if you get rid of one" }, { "start": 1938.68, "end": 1944.7600000000002, "text": " of those dense layers you can like get many many more convolutional layers" }, { "start": 1944.7600000000002, "end": 1953.88, "text": " all right so the last part here is on reducing overfitting again they didn't" }, { "start": 1953.88, "end": 1959.1200000000001, "text": " really investigate whether or not really their network was overfitting like" }, { "start": 1959.1200000000001, "end": 1963.24, "text": " really establishing the overfitting it was I think maybe they did and maybe it" }, { "start": 1963.24, "end": 1969.16, "text": " was actually overfitting but we now we we don't care about overfitting too much" }, { "start": 1969.16, "end": 1974.24, "text": " anymore maybe because we already use these augmentations naturally but also" }, { "start": 1974.24, "end": 1979.64, "text": " because we built these deep models so we somehow have an idea that they" }, { "start": 1979.64, "end": 1984.36, "text": " generalize naturally I'm not sure whether they actually were only worried" }, { "start": 1984.36, "end": 1988.04, "text": " about it that much because of the history of machine learning or whether" }, { "start": 1988.04, "end": 1995.36, "text": " they actually did see that everything was overfitting constantly okay they say" }, { "start": 1995.36, "end": 1999.56, "text": " our neural network architecture has 60 million parameters although the thousand" }, { "start": 1999.56, "end": 2003.62, "text": " classes make each training example impose 10 bits of constraints on the" }, { "start": 2003.62, "end": 2007.44, "text": " mapping from image to label this turns out to be insufficient to learn many" }, { "start": 2007.44, "end": 2011.2, "text": " parameters without considerable overfitting below we describe two" }, { "start": 2011.2, "end": 2015.24, "text": " primary ways in which we combat overfitting again there's no one today" }, { "start": 2015.24, "end": 2020.76, "text": " no one today makes this argument anymore this oh we have this many parameters and" }, { "start": 2020.76, "end": 2026.52, "text": " there are that many images right we have 60 million parameters we have 1.2 million" }, { "start": 2026.52, "end": 2033.24, "text": " images a thousand classes how you know when how many parameters per sample is" }, { "start": 2033.24, "end": 2040, "text": " that and so on how many bits of constraint we don't care about we're fine" }, { "start": 2040, "end": 2047.68, "text": " with having like a billion times more parameters than training samples we we" }, { "start": 2047.68, "end": 2052.24, "text": " don't worry about it anymore so the first thing they do is data" }, { "start": 2052.24, "end": 2058.48, "text": " augmentation already I mean this was already known again like lots of these" }, { "start": 2058.48, "end": 2063.04, "text": " things here were already known but the combination is just so cool in this" }, { "start": 2063.04, "end": 2071.04, "text": " paper where so first of all again they say the transformed images are generating" }, { "start": 2071.04, "end": 2076.68, "text": " Python code on the CPU while the GPU is training on the previous batch of images" }, { "start": 2076.68, "end": 2080.52, "text": " so these data augmentation schemes are in effect computationally free again" }, { "start": 2080.52, "end": 2086.84, "text": " this code must have been ugly the first form of data augmentation consists of" }, { "start": 2086.84, "end": 2092.2, "text": " generating image translations and horizontal reflections we do this by" }, { "start": 2092.2, "end": 2097.96, "text": " extracting random 224 by 224 patches and their horizontal reflections from the" }, { "start": 2097.96, "end": 2106.2799999999997, "text": " 256 by 256 images okay so random so this was already this these are the most" }, { "start": 2106.2799999999997, "end": 2111.7999999999997, "text": " valuable data augmentations that still we have today random horizontal flipping" }, { "start": 2111.7999999999997, "end": 2116.3199999999997, "text": " is still used in every pipeline of computer vision except if you want to" }, { "start": 2116.32, "end": 2123.76, "text": " read text I guess and random cropping is still the most powerful data" }, { "start": 2123.76, "end": 2131.6800000000003, "text": " augmentation technique for images today and the it's crazy that this was already" }, { "start": 2131.6800000000003, "end": 2137.76, "text": " discovered and I I don't know whether they say right here how much this" }, { "start": 2137.76, "end": 2142.6400000000003, "text": " particular thing improves I don't think they have a stat on how much this" }, { "start": 2142.64, "end": 2147.2, "text": " improves they just say how much this this next thing improves but I'm going" }, { "start": 2147.2, "end": 2151.7599999999998, "text": " to guess this was one of the vital things for pushing the performance" }, { "start": 2151.7599999999998, "end": 2157.44, "text": " because now we know cropping is very important I guess they thought that they" }, { "start": 2157.44, "end": 2163.56, "text": " they would you know translation was the important part and so they focused on" }, { "start": 2163.56, "end": 2168.96, "text": " generating image translations and to generate an image translation from a" }, { "start": 2168.96, "end": 2175.6, "text": " single image naturally you have to crop it however we we we now focus much more" }, { "start": 2175.6, "end": 2180.52, "text": " on the fact that we crop it and kind of have different sub images of the same" }, { "start": 2180.52, "end": 2184.32, "text": " image especially in you know self-supervised learning and things like" }, { "start": 2184.32, "end": 2189.32, "text": " this we know that cropping is what is like the the power horse of these" }, { "start": 2189.32, "end": 2195.7200000000003, "text": " methods so the fact that they extract random patches right here means that" }, { "start": 2195.72, "end": 2200.12, "text": " their network only operates on these sub patches and then they compensate by a" }, { "start": 2200.12, "end": 2203.68, "text": " test time the networks makes a prediction by extracting five patches" }, { "start": 2203.68, "end": 2207.3999999999996, "text": " the four corner patches and the center patch as well as their horizontal" }, { "start": 2207.3999999999996, "end": 2212.04, "text": " reflections and averaging the prediction made by the networks softmax layer on" }, { "start": 2212.04, "end": 2217.08, "text": " the ten patches I also believe that people don't do this too much nowadays" }, { "start": 2217.08, "end": 2224.08, "text": " they most of the time they simply rescale the test images or something" }, { "start": 2224.08, "end": 2228.16, "text": " like this or a fine-tune at the end on the kind of scale training images there" }, { "start": 2228.16, "end": 2234.44, "text": " are various techniques for doing this but random cropping and horizontal" }, { "start": 2234.44, "end": 2240.08, "text": " flipping already employed right here also color kind of color jittering a" }, { "start": 2240.08, "end": 2245.24, "text": " form of color jittering a very special form altering the intensities of RGB" }, { "start": 2245.24, "end": 2250.7599999999998, "text": " channels in training images specifically we perform PCA on the set of RGB pixel" }, { "start": 2250.76, "end": 2254.44, "text": " values throughout the image in a training set to each training image we" }, { "start": 2254.44, "end": 2259.0800000000004, "text": " add multiples of the found principal components with magnitudes proportional" }, { "start": 2259.0800000000004, "end": 2263.92, "text": " to the corresponding eigenvalues times a random variable drawn from a gauss with" }, { "start": 2263.92, "end": 2270.4, "text": " zero mean and standard deviation point one this is I believe this has gone out" }, { "start": 2270.4, "end": 2276.0800000000004, "text": " of fashion so people do color jitter and kind of brightness jitter and so on but" }, { "start": 2276.08, "end": 2283.04, "text": " I don't think they particularly do this kind of PCA based image image" }, { "start": 2283.04, "end": 2288.56, "text": " augmentation right here anymore they say this scheme reduces the top one error" }, { "start": 2288.56, "end": 2298, "text": " rate by over 1% I wonder why why this isn't or maybe because you need these" }, { "start": 2298, "end": 2302.08, "text": " stats over the entire data set and the other things may be working equivalently" }, { "start": 2302.08, "end": 2306.58, "text": " well but you you can simply apply them without knowing kind of your your" }, { "start": 2306.58, "end": 2314.36, "text": " principal components okay next thing dropout dropout has been you know one of" }, { "start": 2314.36, "end": 2319.4, "text": " the things that was very important throughout the early stages of deep" }, { "start": 2319.4, "end": 2324.56, "text": " learning isn't that important anymore now dropout some people still use it but" }, { "start": 2324.56, "end": 2330.7999999999997, "text": " most people I think don't use dropout anymore and it's very interesting to see" }, { "start": 2330.8, "end": 2336.92, "text": " but it definitely was a technique that was used a lot during like from Alex net" }, { "start": 2336.92, "end": 2345.44, "text": " to basically like now or like the last very few years so they say combining the" }, { "start": 2345.44, "end": 2349, "text": " predictions of many different models is a very successful way to reduce test" }, { "start": 2349, "end": 2352.6400000000003, "text": " errors but it appears to be too expensive for big neural networks that" }, { "start": 2352.6400000000003, "end": 2357, "text": " already take several days to train there is however a very efficient version of" }, { "start": 2357, "end": 2361.72, "text": " model combination that only costs about a factor of two during training so" }, { "start": 2361.72, "end": 2365.88, "text": " there's this take this technique called dropout then they explain it to set to" }, { "start": 2365.88, "end": 2371.68, "text": " zero the output of each hidden neuron with probability 0.5 again people" }, { "start": 2371.68, "end": 2379.08, "text": " didn't know about dropout as they do now but they introduced this right here and" }, { "start": 2379.08, "end": 2386.28, "text": " they say it reduces their not sure that they also don't say how they how much" }, { "start": 2386.28, "end": 2390.76, "text": " they by how much this reduces the training error but they say we use drop" }, { "start": 2390.76, "end": 2394.2400000000002, "text": " out in the first two fully connected layers without dropout our network" }, { "start": 2394.2400000000002, "end": 2398.8, "text": " exhibits substantial overfitting dropout roughly doubles the number of iterations" }, { "start": 2398.8, "end": 2404.7200000000003, "text": " required to converge so okay so they did actually make sure or they did find the" }, { "start": 2404.7200000000003, "end": 2411, "text": " actual evidence of overfitting and saw that dropout reduces that and I wonder" }, { "start": 2411, "end": 2416.0800000000004, "text": " why this doesn't happen nowadays maybe because we have the we have less of" }, { "start": 2416.08, "end": 2420.92, "text": " these fully connected layers but I can't really imagine maybe because we do more" }, { "start": 2420.92, "end": 2425.2, "text": " augmentation I don't I don't know or maybe dropout is still used and I'm just" }, { "start": 2425.2, "end": 2431.88, "text": " I just don't know it and don't see it yeah so here they use momentum to train" }, { "start": 2431.88, "end": 2440.44, "text": " this and they do some qualitative analysis they do some qualitative" }, { "start": 2440.44, "end": 2444, "text": " analysis so first of all they say okay they shatter all of the previous" }, { "start": 2444, "end": 2449.56, "text": " approaches especially also then they build kind of ensemble methods and they" }, { "start": 2449.56, "end": 2454.6, "text": " pre-trained they already do transfer learning they already pre-trained on" }, { "start": 2454.6, "end": 2462.08, "text": " image net 2011 and fine-tune then on the image net 2012 right here the image net" }, { "start": 2462.08, "end": 2468.92, "text": " 2011 and then fine-tuning on the image net 2012 to reduce that error even" }, { "start": 2468.92, "end": 2477.2000000000003, "text": " further like pulling all the tricks all these things are around still very cool" }, { "start": 2477.2000000000003, "end": 2482.2400000000002, "text": " and then they look into what their network learned so they find that there" }, { "start": 2482.2400000000002, "end": 2488.84, "text": " are a number of these kind of filters you see these 11 by 11 filters in the" }, { "start": 2488.84, "end": 2493.32, "text": " first layer where they show okay this really and this was kind of already" }, { "start": 2493.32, "end": 2499.56, "text": " known that these neural networks extract filters like this like color gradients" }, { "start": 2499.56, "end": 2504.6000000000004, "text": " or edge detectors in various forms and directions and it's cool to see that" }, { "start": 2504.6000000000004, "end": 2511.7200000000003, "text": " this one also does so this one here is also a very cool investigation where" }, { "start": 2511.7200000000003, "end": 2517.04, "text": " they look at examples and the red bar the red one is always the correct label" }, { "start": 2517.04, "end": 2522.04, "text": " and the bars are basically what their model says are the top five things and" }, { "start": 2522.04, "end": 2527.6, "text": " it's cool to look at so for example here you have might as the top one but then" }, { "start": 2527.6, "end": 2535.72, "text": " also black widow cockroach tick starfish but the top labels are usually also very" }, { "start": 2535.72, "end": 2541.8, "text": " very good labels you can see here grill and it assigns convertible which you" }, { "start": 2541.8, "end": 2545.68, "text": " know by all means is correct it's just not the class that the annotators" }, { "start": 2545.68, "end": 2552.72, "text": " assigned to this particular image as well as here Dalmatian was the highest" }, { "start": 2552.72, "end": 2557.52, "text": " prediction of the network where the label was actually cherry and this is" }, { "start": 2557.52, "end": 2561.9199999999996, "text": " this is quite debatable right so you can see that a lot of the mistakes the" }, { "start": 2561.9199999999996, "end": 2568.44, "text": " network does is are are you know forgivable let's say and you can see" }, { "start": 2568.44, "end": 2573.96, "text": " that for when the network doesn't do mistakes the not only the top label is" }, { "start": 2573.96, "end": 2583, "text": " good but a lot of the top five labels are also very very adequate lastly they" }, { "start": 2583, "end": 2587.84, "text": " look at a given training set image which these are the training set images right" }, { "start": 2587.84, "end": 2594.36, "text": " here and they look at the last layers feature vector and the five nearest or" }, { "start": 2594.36, "end": 2598.92, "text": " the nearest neighbors in Euclidean space of the entire training data set and" }, { "start": 2598.92, "end": 2603.92, "text": " here's what you come up with so you can see for the elephant the nearest" }, { "start": 2603.92, "end": 2608.96, "text": " neighbors are all other elephants and regard that they are in different poses" }, { "start": 2608.96, "end": 2613.96, "text": " right they don't always look the same way these elephants also these dogs" }, { "start": 2613.96, "end": 2619.32, "text": " right here so it's pretty cool to see that the network actually learns some" }, { "start": 2619.32, "end": 2625.16, "text": " invariances across the class and puts images with the same label into the same" }, { "start": 2625.16, "end": 2636.64, "text": " area in the embedding space yeah so that's their that's their paper that they" }, { "start": 2636.64, "end": 2642.16, "text": " they already allude to the fact that depth is very important it is notable" }, { "start": 2642.16, "end": 2646.68, "text": " that our networks performance degrades if a single convolutional layer is" }, { "start": 2646.68, "end": 2651.7599999999998, "text": " removed for example removing any of the middle layers results in a loss of about" }, { "start": 2651.76, "end": 2657.32, "text": " 2% for the top one performance of the network so the depth really is important" }, { "start": 2657.32, "end": 2664.28, "text": " for achieving our results and as you know this spurred an area of this burden" }, { "start": 2664.28, "end": 2671, "text": " area of trying to build deeper and deeper networks until Resnets came along" }, { "start": 2671, "end": 2676.6800000000003, "text": " and built ultra deep networks they also say we did not use any unsupervised" }, { "start": 2676.6800000000003, "end": 2680.76, "text": " pre-training even though we expect that it will help especially if we obtain" }, { "start": 2680.76, "end": 2684.76, "text": " enough computational power to significantly increase the size of the" }, { "start": 2684.76, "end": 2688.6000000000004, "text": " network without obtaining a corresponding increase of the amount of" }, { "start": 2688.6000000000004, "end": 2693.5600000000004, "text": " labeled data thus far our results have improved as we have made our network" }, { "start": 2693.5600000000004, "end": 2697.1600000000003, "text": " larger and trained it longer but we still have many orders of magnitude to" }, { "start": 2697.1600000000003, "end": 2701.2400000000002, "text": " go in order to match the infrared temporal pathway of the human visual" }, { "start": 2701.2400000000002, "end": 2706.1200000000003, "text": " system ultimately with ultimately we would like to use very large and deep" }, { "start": 2706.1200000000003, "end": 2710.36, "text": " convolutional nets on video sequences where the temporal structure provides" }, { "start": 2710.36, "end": 2715.48, "text": " very helpful information that is missing of our far less obvious in static images" }, { "start": 2715.48, "end": 2720.2000000000003, "text": " so already the previewing of future research here with the self supervised" }, { "start": 2720.2000000000003, "end": 2726.04, "text": " with the many more layers and so on astounding that this kind of foresight" }, { "start": 2726.04, "end": 2732.1600000000003, "text": " and of course all of this proved to be you know very very adequate predictions" }, { "start": 2732.1600000000003, "end": 2738.2000000000003, "text": " right here and yeah so this was the paper right here the paper that kicked" }, { "start": 2738.2, "end": 2745.2, "text": " off deep learning I enjoy reading kind of these old papers especially looking" }, { "start": 2745.2, "end": 2750.08, "text": " back at what was already known what still is around which turns out to be a" }, { "start": 2750.08, "end": 2756.9199999999996, "text": " lot a lot is still around and the choices that people made back then some" }, { "start": 2756.9199999999996, "end": 2763, "text": " of them defined our modern field so that was it for Alex net let me know what you" }, { "start": 2763, "end": 2768.2, "text": " think in the comments and I'll see you next time bye" } ]
a6v92P0EbJc
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Neural Architecture Search without Training (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nas", "nas-bench", "architecture search", "initialization", "untrained", "cifar10", "imagenet", "neural architecture search", "controller", "rnn", "correlation", "gradient", "jacobian", "linearization" ]
#ai #research #machinelearning Neural Architecture Search is typically very slow and resource-intensive. A meta-controller has to train many hundreds or thousands of different models to find a suitable building plan. This paper proposes to use statistics of the Jacobian around data points to estimate the performance of proposed architectures at initialization. This method does not require training and speeds up NAS by orders of magnitude. OUTLINE: 0:00 - Intro & Overview 0:50 - Neural Architecture Search 4:15 - Controller-based NAS 7:35 - Architecture Search Without Training 9:30 - Linearization Around Datapoints 14:10 - Linearization Statistics 19:00 - NAS-201 Benchmark 20:15 - Experiments 34:15 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.04647 Code: https://github.com/BayesWatch/nas-without-training Abstract: The time and effort involved in hand-designing deep neural networks is immense. This has prompted the development of Neural Architecture Search (NAS) techniques to automate this design. However, NAS algorithms tend to be extremely slow and expensive; they need to train vast numbers of candidate networks to inform the search process. This could be remedied if we could infer a network's trained accuracy from its initial state. In this work, we examine how the linear maps induced by data points correlate for untrained network architectures in the NAS-Bench-201 search space, and motivate how this can be used to give a measure of modelling flexibility which is highly indicative of a network's trained performance. We incorporate this measure into a simple algorithm that allows us to search for powerful networks without any training in a matter of seconds on a single GPU. Code to reproduce our experiments is available at this https URL. Authors: Joseph Mellor, Jack Turner, Amos Storkey, Elliot J. Crowley Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there! Today we're looking at neural architecture search without training by Joseph Meller, Jack Turner, Alma Storky and Elliot J. Crowley. On a high level, this paper performs neural architecture search by looking at the correlation matrices of the Jacobian of the data when you pass it through the network. And it does so at initialization. So you pass the data, 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. All right, that was a high level and maybe a bit too simplified. But that's sort of what's going on. Okay, let's dive in. So what's neural architecture search? Neural architecture search is the discipline of you are given a data set. Let's say here we have a data set, which could be something like CIFAR-10, which is an image data set. And you are given a sort of training procedure, let's say, ADM or SGD for 100,000 steps or something like this with many batches of size 64. Okay, and you're given a loss function, which the loss function here could be the cross entropy between the outputs of the network, which we'll call L and the label Y. And your task is now to find a neural network architecture that conforms to these specifications, but gives the lowest possible loss or the highest possible validation accuracy in this case. So this here would be like the train and then you'd have the test accuracy or the validation accuracy. Okay, so you could decide, well, I'm going to go with, you know, first, like three convolutional layers, each one having like a ReLU non-linearity. But you could also say, well, I'm going to build like a skip connection from here to here. You could also say that I'm going to 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, discovered that it works well. And we don't really do much exploration, we simply kind of use the same things over and over. And the truth is that there might be much better architectures that we're simply not exploring, right? There might be much better building plans for networks that we don't know of that might perform a lot better with the same data and the same training. So neural architecture search is the process of automatically searching for these better architectures. Of course, that's a combinatorial problem. But the idea is that, you know, you can actually learn to construct good architectures. And by doing so, you can, you can sort of speed up this process that is manual otherwise. And the idea behind it is there's 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, the controller itself, of course, is going to be a neural network. So there'll be this thing that will be the controller, and the controller will emit like a building plan. So the controller will emit like a building plan for this network right here. And then you train the entire thing once through for the entire 100,000 steps. And then you observe the final validation accuracy, which might be something like 80%. And then you know, okay, this is 80%. So you feed the 80% into your controller and the controller outputs the next building plan that it thinks will score higher. And then you train the entire thing again, and you maybe observe 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 real the, the C here, the controller would be the agent, the percentages here, the accuracies would be the real reward. And the environment, the observations would be basically, this thing here, this thing would be the actions, but sometimes it's the observations and you need to score the different things. Okay. So the problem, of course, with this is that the reinforcement learning requires a lot of data, it requires a lot of steps to converge, because the signal from the reward is just so weak, you simply get one number for your action. And you don't know what you can change to make it better, you simply have to try. So you need a lot of steps, but this thing here is mighty slow, because each each single step in your reinforcement learning procedure involves training an entire neural network for like this many steps. Okay, so all of this is ginormously slow, and it's resource intensive. And that of course, blocks a lot of research, because, you know, we started with the plan to automate this part right here, but automating it itself is super expensive. So they go for a different solution. They say this could be remedied if we could infer at net, sorry, if we could infer a network's trained accuracy from its initial state. Okay, it seems a bit out there, but let's let's give them benefit of the doubt. In this work, we examine how the linear maps induced by data points correlate for untrained network architectures in the NAS bench 201 search space, and motivate how this can be used to give a measure of the accuracy of the network. So we use this measure to give a measure of modeling flexibility, which is highly indicative of a network's trained performance. We incorporate this measure into a simple algorithm that allows us to search for powerful networks without any training in a matter of seconds on a single GPU. Okay, and they have the code available right here if you want to go and check that out. So let's go ahead and check that out. The claims are pretty big. And the reasoning behind the claims is the following observation. You can already sort of see in this graphic right here, we'll 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 architectures that you could consider. Actually, so 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 rank them by how well they score on CIFAR-10. So there are very good architectures, which are here, there are good ones, there are mediocre ones, and then the bad ones. Okay, and you can see that the histograms here of whatever they measure, they look quite different. So the histograms with the good ones, they all 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, it's pretty easy. They compute the linear map around each data point. So what is that? If you imagine a neural network as a nonlinear function, which I guess you should, because it is. And so let's imagine it as like a nonlinear function from X to Y. What they'll do is simply they'll look at a given date training data point, which could be here, right? This could be the X and this could be the 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 nonlinearities 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 weight space. Then we look at a different data point. So we look at this data point right here, another data point. What's the linear function around this one is sort of like, whoops, D is like that. And then around this one is like this. Okay, so this is one function. Now let's look at a different function right here. So L, X, and we'll look at this function, the linear function. Okay, so for some reason, this is like this. And if we consider two data points, their linearization is very similar. Now imagine that these two have been produced by the same sort of neural networks. It's just the architecture is a little different. But they have the same number of parameters in the neural network. Which neural network would you prefer? Remember, by training the neural network, you can actually shape this loss function. You can kind of shape that around. So which one would you prefer? I personally would prefer the top one, because the top one already tells me that, hey, you know, I might have 10 parameters here. And this already sort of looks like each of the 10 parameters is doing something. So if I then go into my 10 parameters, and I, you know, turn this knob right here, then I might, you know, up this bump, or down this bump, or do something with it. But the sort of frequency, curvature, the randomness of the function, the way that it fluctuates tells me that all of the different parameters must have some sort of effect, right? Because it's quite an expressive function. Whereas if I have the same number of parameters for a function like this, this sort of tells me, well, maybe only one of the when the only one of the weights is actually doing something, maybe only one of the dimensions is doing something. This seems odd, right? That even though I've initialized it randomly, a super regular function like this comes out. So maybe all of the all of these parameters down here, they don't do anything. Or this, so somehow the signal doesn't get through. So that's, I, they don't explicitly say it in these terms. But this is how I make sense of this. What they're saying is that if you look at the linearizations of the functions, and you look at the the angle right here, so the angle in this case is that and in this case is that and in this case is that. So you look at the slope here. And the slope is basically the gradient of these linearized functions. And what you want to do is you want to look at the correlation between those of the different data points. So here we have three angles. One is very short, one is very bit longer, like this, and or no, even like this, and one is even over 90 degrees like that. They are not correlated at all, right? They're all very different. However, the angles here, they're all quite the same, as you can see. So what they propose is the following. Let's send all the data points, or in that case, all the data points in a particular mini batch, let's send them through the function, and let's calculate their linearizations. So the linearization is nothing else than you send them through the network to obtain the f value for the x value, and then you calculate the gradient with respect to the input. Now you have to get used to this a bit, because usually we calculate the gradient with respect to the weight. So you calculate the gradient, but now we calculate the gradient with respect to the input, which if this is a linear function, so if you have a f of x equals wx, 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 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 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 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 angles, all 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 C410 training data. Each policy is scrammed for a single untrained NASBench 201 architecture. So remember the expressivity is important because we want to train that function, and therefore it's important that every parameter does something. And if it's degenerate, we can't train it well. And that's, I find that's the reasoning. They sort of say this, but I might make the wrong sense out of it here, but it seems to me like that's what's actually going on. So you can see this is simply these matrix values rolled out and then plotted as a histogram. So what does it mean when an histogram is like super spread out like this? It means that there are a lot, and I think down here are axes, yes, there are a lot of data points that correlate highly or anti-correlate highly with each other. Okay, which means that exactly this degeneracy happens. So either too high or too negative high correlation means that they're very much, they're kind of the same thing. So there is, if you have as many parameters as data points, that means that one parameter can potentially serve these two data points or these two that are correlated by one or negative one. You don't need both parameters and therefore you have a lot of parameters doing nothing. Whereas over here with the good networks, you can see that this spikes around zero, meaning that the data points are not correlated or the linearizations around the data points are not correlated. And therefore you can sort of shape the function around each data point however you want. Which we sort of know that neural networks, what they do is they're so over expressive that they're actually able to shape the functions around the data points without necessarily looking at other data points nearby. And that expressivity is what 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 you're basically, your task is to determine what this block should be. So this block has an input node A and an output node D and two intermediate nodes. And what you have to do is basically you have to determine these connections right here. So there are six connections and for each one you have the option of putting different things there. Like you can see you can put a convolution, you can put the identity function, which is a skip connection, zero wise. 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 different convolutions or things like this. So there are these 15,625 possible cells. So the NAS benchmark contains 15,625 possible architectures that you'll have to search. And they take these architectures and they plot now, they plot for each architecture the validation accuracy after training. And the training protocol is standardized, you don't have to care about that. 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 these experiments what you'll get is like this sort of feeling. What they're going to propose is that you should take that score as a measure. And here again also, sort of, sort of. There is a clear trend, as you can see, right here. Though, yeah, though this, as you can see, this sort of spreads out. And the most right one is ImageNet, which is the most difficult one, of course. So, and this is CIFAR 100, which is more difficult than CIFAR 10. So we can see that this sort of relationship at the top, it doesn't really hold anymore if the task gets difficult. And this is, so what I think is happening, this is kind of an interjection of my own opinion. What's happening here is that this score that they discover allows them pretty efficiently to see which networks are just degenerate and cannot be trained. Like if you try to train them, they just perform really poorly, okay? That, it's probably a very good score for weeding those out. And that would mean if you kind of barrier here somewhere, right? You could just discard a whole lot of this crap, or even 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 so, you know, it's not a big deal. 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, 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 than this particular score, which, you know, is a cool thing. Then how important is the specific mini batch and initialization? And they say, look right here, we, for some architectures, we do different mini batch sizes. And you can see each of those groups, they don't vary too much in how they're, it influences their score. This is, I believe this is the same architecture. So it's always an architecture that achieves in this case, for example, wow, that's not a straight line, 77% or so. And you can see if you go for different mini batches, the score varies only minimally. Initialization is a bigger variance inducing thing. But also here, the scores don't vary too much. But it is interesting that the different initialization do 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 the last experiment, they go here and they say, we evaluated the score on initialized networks in the PyTorch CV library. So they go to this library that has a lot of these networks, but these networks are not the same as this benchmark. This benchmark is specifically designed to do architecture search. Now the networks in this library, they are all designed to perform really well. Some are designed to be quite small, some are designed to be quite fast and so on. But in general, they are all of their goal is to perform well, and they have been sort of found by humans to perform well. So they take now these networks on CIFAR 10 and they test them. So as you can see here, here is the test accuracy again, and here is their score that they give it. And they say, now I can't move this anymore. Hello. Well, okay. They say that this linear relationship still sort of holds. It doesn't hold super, super well, but you can still sort of, if you squint, if you squint hard, you can see that it sort of goes upward, though you really have to squint hard. Like what are these things right here? And what, again, what's the case is that if the score is low, it's not going to be a good score. So what you can do is that if the score is low, you will sort of be able to cut off the worst performing ones. But really at the top here, it doesn't seem like there is a particular relation between these networks and this initial score, which sort of strengthens my hypothesis that it's just kind of weed out the bad ones. But it's pretty cool because you can weed out the bad ones without any training, right? You'd simply forward prop backward prop. There you have it. So cool. Now they come, they, here is the experiment where they now really do this NAS benchmark and they compare with other methods. So some of these other methods are designed to do the call weight sharing, which basically is a technique where you can sort of speed up the speed up the algorithm as compared to non weight sharing and the non weight sharing. That's one of these we have discussed initially. That was my initial example with the controller and so on where it takes super long. So here you see the method and how long each method takes. Now the best ones, as you can see already, the best ones here, or these, these methods right here are the best ones. They score somewhat like a 93.9 or so on C for 10, whereas these weight sharing ones, they don't perform too well, except this one seems to perform quite well. And in this hours case, they perform worse than that, but they still perform better than a lot of the weight sharing ones. So what their point is basically is that they get a pretty good score, which is a 91.5 on C for 10, which is, you know, 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, yada, yada. As the setup, the non weight sharing methods are given a time budget of 12,000 seconds for our method and the non weight sharing methods are averaged. Accuracies are averaged over 500 runs for weight sharing methods. Accuracies are reported over three runs with the exception of G Das. Our method is able to outperform all the weight sharing methods while requiring a fraction of the search time. And that you may see at the table. This is the real, I mean, this is the real deal here. They only use here 1.7 seconds compared to the 12,000 seconds of the other methods. And you reach almost the same accuracy. Now to be said, 2% in this particular regime on C410 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 C4100, they achieve a better score than these things, but a worse score than the non-weight sharing method. And in ImageNet, the difference is even larger. So again, what I can see here is that theirs is a good method to maybe get you, 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 show the accuracy of the networks chosen by our method for each n. 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 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. And you can see that already gets you to the 93. And whereas in their case, sometimes when they add more, they get worse. So here they get better, but then they get worse again. So they comment on this right here. We observe that the sample size does not have a large effect on the accuracy of our method. But note that as sample size increases, our method suffers from a small amount of noise, increasing the gap between our score and the optimal result. And of course, the key practical benefit is execution time. So again, they are massively faster than the other methods. But to me, it seems you could just think of combining these methods, right? You combine this with this in that what you want to do is actually actively search for the best ones. But by doing so, you could, if you could pretty quickly weed out the bad ones using this method down here, you might already have like a big speed up. Because again, with comparison to this random ones, what appears to happen is that they get good at finding, you know, your 90% architecture, but then they fail to differentiate the top performance performers from each other, where you'd really have to train the network to find out what's, you know, which one's better. So yeah, here they say they visualize the trade off between search time and accuracy for C410 for different NAS algorithms on the NAS 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 good ones are either way over here or here. And theirs is almost at zero while being quite close to the accuracy of the other ones. All right, yeah, that was that was this paper. Again, I think this is pretty valuable if you are especially if you're in a new domain, where you might not know what kind of network to build, you might just be able to write a little script that generates networks, run it through this algorithm, and at least you get an idea of which ones are certainly not worth considering. And then you can simply select one of the other ones. It doesn't, you know, often it doesn't need to be the best ones. And you can then tweak it a little bit manually, the ones you found, maybe you see some regularity. And yeah, that was my two cents on this paper. I hope you liked it. If you did, consider sharing it out and telling your friends about it and subscribing, liking, and leave a comment if you agree or disagree. That was it. Bye bye.
[ { "start": 0, "end": 6.5600000000000005, "text": " Hi there! Today we're looking at neural architecture search without training by Joseph Meller, Jack" }, { "start": 6.5600000000000005, "end": 12.96, "text": " Turner, Alma Storky and Elliot J. Crowley. On a high level, this paper performs neural" }, { "start": 12.96, "end": 22.56, "text": " architecture search by looking at the correlation matrices of the Jacobian of the data when" }, { "start": 22.56, "end": 28.240000000000002, "text": " you pass it through the network. And it does so at initialization. So you pass the data," }, { "start": 28.24, "end": 35.04, "text": " look at the Jacobian, and if it's very correlated, then the network is bad. And if it's very" }, { "start": 35.04, "end": 41.28, "text": " uncorrelated, then the network is good. And by simply observing that, they can already" }, { "start": 41.28, "end": 47.28, "text": " achieve a very good score on a neural architecture search benchmark. All right, that was a high" }, { "start": 47.28, "end": 53.12, "text": " level and maybe a bit too simplified. But that's sort of what's going on. Okay, let's dive in." }, { "start": 53.12, "end": 58.72, "text": " So what's neural architecture search? Neural architecture search is the discipline of you" }, { "start": 58.72, "end": 65.28, "text": " are given a data set. Let's say here we have a data set, which could be something like CIFAR-10," }, { "start": 65.84, "end": 74.96, "text": " which is an image data set. And you are given a sort of training procedure, let's say, ADM or SGD" }, { "start": 74.96, "end": 83.83999999999999, "text": " for 100,000 steps or something like this with many batches of size 64. Okay, and you're given a loss" }, { "start": 83.83999999999999, "end": 91.44, "text": " function, which the loss function here could be the cross entropy between the outputs of the network," }, { "start": 91.44, "end": 99.83999999999999, "text": " which we'll call L and the label Y. And your task is now to find a neural network architecture" }, { "start": 99.84, "end": 106.72, "text": " that conforms to these specifications, but gives the lowest possible loss or the highest possible" }, { "start": 106.72, "end": 112.96000000000001, "text": " validation accuracy in this case. So this here would be like the train and then you'd have the" }, { "start": 112.96000000000001, "end": 118.88, "text": " test accuracy or the validation accuracy. Okay, so you could decide, well, I'm going to go with," }, { "start": 118.88, "end": 124.96000000000001, "text": " you know, first, like three convolutional layers, each one having like a ReLU non-linearity." }, { "start": 124.96, "end": 129.35999999999999, "text": " But you could also say, well, I'm going to build like a skip connection from here to here." }, { "start": 129.84, "end": 136, "text": " You could also say that I'm going to down sample by two, you could have maybe a bigger stride and" }, { "start": 136, "end": 142.56, "text": " so on. So the kernel size of the convolution, you can vary until now, people have done this by hand," }, { "start": 142.56, "end": 149.84, "text": " right? In effect, we all use like the same 10 to 20 different architectures. So if it's an image" }, { "start": 149.84, "end": 155.92000000000002, "text": " problem, we tend to go for like a ResNet or a wide ResNet, or like a VGG style architecture." }, { "start": 157.20000000000002, "end": 163.2, "text": " Someone has come up with those at some point with each of those, discovered that it works well." }, { "start": 163.2, "end": 169.52, "text": " And we don't really do much exploration, we simply kind of use the same things over and over." }, { "start": 170.48000000000002, "end": 177.36, "text": " And the truth is that there might be much better architectures that we're simply not exploring," }, { "start": 177.36, "end": 182.88000000000002, "text": " right? There might be much better building plans for networks that we don't know of that might" }, { "start": 182.88000000000002, "end": 189.04000000000002, "text": " perform a lot better with the same data and the same training. So neural architecture search is" }, { "start": 189.04000000000002, "end": 193.68, "text": " the process of automatically searching for these better architectures. Of course, that's a" }, { "start": 193.68, "end": 202.72000000000003, "text": " combinatorial problem. But the idea is that, you know, you can actually learn to construct good" }, { "start": 202.72, "end": 208.64, "text": " architectures. And by doing so, you can, you can sort of speed up this process that is manual" }, { "start": 208.64, "end": 214.48, "text": " otherwise. And the idea behind it is there's some regularity of when an architecture is good," }, { "start": 214.48, "end": 219.84, "text": " there's some like high level pattern that you as a human maybe cannot really grasp, but like a" }, { "start": 219.84, "end": 225.68, "text": " machine can figure out which architectures are good and which ones aren't. So there have been a few" }, { "start": 225.68, "end": 233.20000000000002, "text": " inventions in this area, but they are mostly costly. That's what they say here. The time and" }, { "start": 233.20000000000002, "end": 238.08, "text": " effort involved in hand designing deep neural networks is immense. This has prompted the" }, { "start": 238.08, "end": 244.08, "text": " development of neural architecture search techniques to automate this design. However," }, { "start": 244.08, "end": 250.48000000000002, "text": " neural architecture search algorithms tend to be extremely slow and expensive. They need to train" }, { "start": 250.48, "end": 256.96, "text": " vast numbers of candidate networks to inform the search process. So what neural architecture" }, { "start": 256.96, "end": 262, "text": " search methods do is what they'll have is they'll have something like a controller," }, { "start": 262, "end": 267.76, "text": " the controller itself, of course, is going to be a neural network. So there'll be this thing that" }, { "start": 267.76, "end": 274.71999999999997, "text": " will be the controller, and the controller will emit like a building plan. So the controller will" }, { "start": 274.72, "end": 280.96000000000004, "text": " emit like a building plan for this network right here. And then you train the entire thing once" }, { "start": 280.96000000000004, "end": 286.64000000000004, "text": " through for the entire 100,000 steps. And then you observe the final validation accuracy, which" }, { "start": 286.64000000000004, "end": 293.92, "text": " might be something like 80%. And then you know, okay, this is 80%. So you feed the 80% into your" }, { "start": 293.92, "end": 300.08000000000004, "text": " controller and the controller outputs the next building plan that it thinks will score higher." }, { "start": 300.08, "end": 306.71999999999997, "text": " And then you train the entire thing again, and you maybe observe 70% accuracy, you again feed" }, { "start": 306.71999999999997, "end": 311.68, "text": " that in, right, and the controller realizes, oh, I may have done something wrong, let me try" }, { "start": 311.68, "end": 317.2, "text": " something else. And does again, if this looks like reinforcement learning to you, that's because" }, { "start": 317.2, "end": 324.15999999999997, "text": " this is reinforcement learning. So the real the, the C here, the controller would be the agent," }, { "start": 324.15999999999997, "end": 325.44, "text": " the percentages here, the accuracies would be the real" }, { "start": 325.44, "end": 333.2, "text": " reward. And the environment, the observations would be basically, this thing here, this thing" }, { "start": 333.2, "end": 337.6, "text": " would be the actions, but sometimes it's the observations and you need to score the different" }, { "start": 337.6, "end": 345.6, "text": " things. Okay. So the problem, of course, with this is that the reinforcement learning requires a lot" }, { "start": 345.6, "end": 351.6, "text": " of data, it requires a lot of steps to converge, because the signal from the reward is just so" }, { "start": 351.6, "end": 358.40000000000003, "text": " weak, you simply get one number for your action. And you don't know what you can change to make it" }, { "start": 358.40000000000003, "end": 364.48, "text": " better, you simply have to try. So you need a lot of steps, but this thing here is mighty slow," }, { "start": 364.48, "end": 371.28000000000003, "text": " because each each single step in your reinforcement learning procedure involves training an entire" }, { "start": 371.28000000000003, "end": 378.72, "text": " neural network for like this many steps. Okay, so all of this is ginormously slow, and it's" }, { "start": 378.72, "end": 386.40000000000003, "text": " resource intensive. And that of course, blocks a lot of research, because, you know, we started" }, { "start": 386.40000000000003, "end": 391.84000000000003, "text": " with the plan to automate this part right here, but automating it itself is super expensive." }, { "start": 392.8, "end": 401.68, "text": " So they go for a different solution. They say this could be remedied if we could infer at net," }, { "start": 401.68, "end": 409.68, "text": " sorry, if we could infer a network's trained accuracy from its initial state. Okay, it seems" }, { "start": 409.68, "end": 416.88, "text": " a bit out there, but let's let's give them benefit of the doubt. In this work, we examine how the" }, { "start": 416.88, "end": 422.8, "text": " linear maps induced by data points correlate for untrained network architectures in the NAS bench" }, { "start": 422.8, "end": 430.32, "text": " 201 search space, and motivate how this can be used to give a measure of the accuracy of the" }, { "start": 430.32, "end": 436.71999999999997, "text": " network. So we use this measure to give a measure of modeling flexibility, which is highly indicative" }, { "start": 436.71999999999997, "end": 443.84, "text": " of a network's trained performance. We incorporate this measure into a simple algorithm that allows" }, { "start": 443.84, "end": 450.64, "text": " us to search for powerful networks without any training in a matter of seconds on a single GPU." }, { "start": 450.64, "end": 456.56, "text": " Okay, and they have the code available right here if you want to go and check that out. So let's go" }, { "start": 456.56, "end": 463.36, "text": " ahead and check that out. The claims are pretty big. And the reasoning behind the claims is the" }, { "start": 463.36, "end": 470.08, "text": " following observation. You can already sort of see in this graphic right here, we'll go over what it" }, { "start": 470.08, "end": 476.88, "text": " means in one second. But what they do is they take different networks in this search space. And the" }, { "start": 476.88, "end": 483.6, "text": " search space in this case is given by this benchmark. So this benchmark basically has a long" }, { "start": 483.6, "end": 490, "text": " architectures that you could consider. Actually, so it's a constructive list. So they don't actually" }, { "start": 490, "end": 497.12, "text": " give you the list, but they give you like a way to construct architectures. And they took those" }, { "start": 497.12, "end": 502.8, "text": " architectures and they rank them by how well they score on CIFAR-10. So there are very good" }, { "start": 502.8, "end": 508.48, "text": " architectures, which are here, there are good ones, there are mediocre ones, and then the bad ones." }, { "start": 508.48, "end": 514.8000000000001, "text": " Okay, and you can see that the histograms here of whatever they measure, they look quite different." }, { "start": 514.8000000000001, "end": 520.72, "text": " So the histograms with the good ones, they all look kind of spiky around zero. And the histograms" }, { "start": 520.72, "end": 526.5600000000001, "text": " of the bad ones all sort of look spread out. So this is the measure that they're going to propose" }, { "start": 526.5600000000001, "end": 532.64, "text": " is they have some sort of number, some sort of histogram that they produce. And if the histogram" }, { "start": 532.64, "end": 539.76, "text": " is very spiky and close together around zero, then they conclude that this network is good." }, { "start": 539.76, "end": 546.3199999999999, "text": " And if the histogram is very spread out like this, they conclude that the network is bad. Now these" }, { "start": 546.3199999999999, "end": 554.3199999999999, "text": " histograms, as you might expect, they are computed not from the final trained network, but they are" }, { "start": 554.3199999999999, "end": 562, "text": " computed from the initial network. So here they show at least, you know, in this case, it seems" }, { "start": 562, "end": 568.96, "text": " to be that there is a general correlation between the trained accuracy and how this histogram looks." }, { "start": 569.68, "end": 571.68, "text": " And we're going to explore what they do." }, { "start": 574.48, "end": 581.76, "text": " So it's essentially, it's pretty easy. They compute the linear map around each data point." }, { "start": 581.76, "end": 588.64, "text": " So what is that? If you imagine a neural network as a nonlinear function, which I guess you should," }, { "start": 588.64, "end": 597.52, "text": " because it is. And so let's imagine it as like a nonlinear function from X to Y. What they'll do" }, { "start": 597.52, "end": 603.6, "text": " is simply they'll look at a given date training data point, which could be here, right? This could" }, { "start": 603.6, "end": 611.84, "text": " be the X and this could be the Y. And in fact, let's look at it in loss landscape, not even in Y," }, { "start": 611.84, "end": 617.28, "text": " but in L in terms of the loss, because we don't need necessarily a single label. This could be" }, { "start": 617.28, "end": 623.76, "text": " for unsupervised, this could be for anything. Okay, so it maps a data point to a loss. Now," }, { "start": 624.72, "end": 629.68, "text": " what we'll do is we'll simply linearize the function around that point, which means we'll" }, { "start": 629.68, "end": 635.28, "text": " just freeze all the nonlinearities in place. And that will give us this linear function right here." }, { "start": 636.0799999999999, "end": 643.4399999999999, "text": " Okay, we just observe that this linear function can exist. It's the tangent to the loss landscape." }, { "start": 643.44, "end": 649.12, "text": " And it's at a particular data point, right? It's in data space, not in weight space. Then we look" }, { "start": 649.12, "end": 654.32, "text": " at a different data point. So we look at this data point right here, another data point. What's the" }, { "start": 654.32, "end": 662, "text": " linear function around this one is sort of like, whoops, D is like that. And then around this one" }, { "start": 662, "end": 669.44, "text": " is like this. Okay, so this is one function. Now let's look at a different function right here. So" }, { "start": 669.44, "end": 680, "text": " L, X, and we'll look at this function, the linear function. Okay, so for some reason," }, { "start": 681.12, "end": 692.08, "text": " this is like this. And if we consider two data points, their linearization is very similar." }, { "start": 692.6400000000001, "end": 699.2800000000001, "text": " Now imagine that these two have been produced by the same sort of neural networks. It's just" }, { "start": 699.28, "end": 705.36, "text": " the architecture is a little different. But they have the same number of parameters in the neural" }, { "start": 705.36, "end": 712, "text": " network. Which neural network would you prefer? Remember, by training the neural network, you can" }, { "start": 712, "end": 718.0799999999999, "text": " actually shape this loss function. You can kind of shape that around. So which one would you prefer?" }, { "start": 719.04, "end": 725.68, "text": " I personally would prefer the top one, because the top one already tells me that, hey, you know," }, { "start": 725.68, "end": 730.7199999999999, "text": " I might have 10 parameters here. And this already sort of looks like each of the 10 parameters is" }, { "start": 730.7199999999999, "end": 736.2399999999999, "text": " doing something. So if I then go into my 10 parameters, and I, you know, turn this knob" }, { "start": 736.2399999999999, "end": 742.3199999999999, "text": " right here, then I might, you know, up this bump, or down this bump, or do something with it. But" }, { "start": 742.3199999999999, "end": 749.92, "text": " the sort of frequency, curvature, the randomness of the function, the way that it fluctuates tells" }, { "start": 749.92, "end": 756.0799999999999, "text": " me that all of the different parameters must have some sort of effect, right? Because it's quite an" }, { "start": 756.0799999999999, "end": 761.5999999999999, "text": " expressive function. Whereas if I have the same number of parameters for a function like this," }, { "start": 761.5999999999999, "end": 768.3199999999999, "text": " this sort of tells me, well, maybe only one of the when the only one of the weights is actually" }, { "start": 768.3199999999999, "end": 774.16, "text": " doing something, maybe only one of the dimensions is doing something. This seems odd, right? That" }, { "start": 774.16, "end": 780.3199999999999, "text": " even though I've initialized it randomly, a super regular function like this comes out. So maybe all" }, { "start": 780.3199999999999, "end": 787.28, "text": " of the all of these parameters down here, they don't do anything. Or this, so somehow the signal" }, { "start": 787.28, "end": 794.24, "text": " doesn't get through. So that's, I, they don't explicitly say it in these terms. But this is" }, { "start": 794.24, "end": 802, "text": " how I make sense of this. What they're saying is that if you look at the linearizations of the" }, { "start": 802, "end": 809.68, "text": " functions, and you look at the the angle right here, so the angle in this case is that and in" }, { "start": 809.68, "end": 816.8, "text": " this case is that and in this case is that. So you look at the slope here. And the slope is basically" }, { "start": 816.8, "end": 823.28, "text": " the gradient of these linearized functions. And what you want to do is you want to look at the" }, { "start": 823.28, "end": 828.64, "text": " correlation between those of the different data points. So here we have three angles. One is" }, { "start": 828.64, "end": 839.28, "text": " very short, one is very bit longer, like this, and or no, even like this, and one is even over" }, { "start": 839.84, "end": 845.92, "text": " 90 degrees like that. They are not correlated at all, right? They're all very different. However," }, { "start": 845.92, "end": 854.48, "text": " the angles here, they're all quite the same, as you can see. So what they propose is the following." }, { "start": 854.48, "end": 860.64, "text": " Let's send all the data points, or in that case, all the data points in a particular mini batch," }, { "start": 860.64, "end": 867.36, "text": " let's send them through the function, and let's calculate their linearizations. So the linearization" }, { "start": 867.36, "end": 873.12, "text": " is nothing else than you send them through the network to obtain the f value for the x value," }, { "start": 873.12, "end": 878.72, "text": " and then you calculate the gradient with respect to the input. Now you have to get used to this a" }, { "start": 878.72, "end": 884.4, "text": " bit, because usually we calculate the gradient with respect to the weight. So you calculate the" }, { "start": 884.4, "end": 889.92, "text": " gradient, but now we calculate the gradient with respect to the input, which if this is a linear" }, { "start": 889.92, "end": 898.9599999999999, "text": " function, so if you have a f of x equals wx, like a linear function, then this gradient, del f del" }, { "start": 898.9599999999999, "end": 906.24, "text": " x, would just give you the w, will give you the slope of the linear function, and the same in the" }, { "start": 906.24, "end": 912.56, "text": " neural network when you linearize it. All right, so we're going to obtain all these linearizations," }, { "start": 912.56, "end": 920.64, "text": " and that gives us this matrix J right here. And what we can do is we can then observe the" }, { "start": 920.64, "end": 929.8399999999999, "text": " covariance matrix of J, of all these linearizations. The covariance matrix simply tells you how two data" }, { "start": 929.8399999999999, "end": 935.28, "text": " points vary with each other, and in fact they don't look at the covariance matrix, but they look at the" }, { "start": 935.28, "end": 941.5999999999999, "text": " correlation matrix, which is simply the scaled covariance matrix. So one entry in this covariance" }, { "start": 941.6, "end": 949.28, "text": " matrix, so you have n data points, and this gives you a matrix that's n by n, and a particular entry" }, { "start": 949.28, "end": 957.28, "text": " here, like the entry i, j, would simply state how does the angle of data point i correlate with the" }, { "start": 957.28, "end": 970.1600000000001, "text": " angle of data point j. Okay, that's the covariance matrix. And now the hypothesis is, if all of these" }, { "start": 970.16, "end": 976.88, "text": " data points are sort of independent, like in our very expressive function here, then these correlations," }, { "start": 976.88, "end": 983.1999999999999, "text": " they should not be high. In fact most data points should be rather uncorrelated. However, in this" }, { "start": 983.1999999999999, "end": 990.56, "text": " case right here, if the function is sort of kind of degenerative or something, not very expressive," }, { "start": 990.56, "end": 996.48, "text": " then all of these angles, all of these linearizations should be highly correlated." }, { "start": 996.48, "end": 1005.04, "text": " And that's what you see in this graph right here. This right here now is this correlation histogram" }, { "start": 1005.84, "end": 1012.08, "text": " of the correlations between local linear maps across all pairs of items in a mini batch of C410" }, { "start": 1012.08, "end": 1019.36, "text": " training data. Each policy is scrammed for a single untrained NASBench 201 architecture. So remember" }, { "start": 1019.36, "end": 1024.8, "text": " the expressivity is important because we want to train that function, and therefore it's important" }, { "start": 1024.8, "end": 1030.32, "text": " that every parameter does something. And if it's degenerate, we can't train it well. And that's," }, { "start": 1030.32, "end": 1039.68, "text": " I find that's the reasoning. They sort of say this, but I might make the wrong sense out of it here," }, { "start": 1039.68, "end": 1045.04, "text": " but it seems to me like that's what's actually going on. So you can see this is simply these" }, { "start": 1045.04, "end": 1050.3999999999999, "text": " matrix values rolled out and then plotted as a histogram. So what does it mean when an histogram" }, { "start": 1050.4, "end": 1055.92, "text": " is like super spread out like this? It means that there are a lot, and I think down here are axes," }, { "start": 1055.92, "end": 1062.48, "text": " yes, there are a lot of data points that correlate highly or anti-correlate highly with each other." }, { "start": 1063.1200000000001, "end": 1071.0400000000002, "text": " Okay, which means that exactly this degeneracy happens. So either too high or too negative high" }, { "start": 1071.0400000000002, "end": 1077.2, "text": " correlation means that they're very much, they're kind of the same thing. So there is, if you have" }, { "start": 1077.2, "end": 1084.8, "text": " as many parameters as data points, that means that one parameter can potentially serve these two data" }, { "start": 1084.8, "end": 1090.48, "text": " points or these two that are correlated by one or negative one. You don't need both parameters and" }, { "start": 1090.48, "end": 1095.8400000000001, "text": " therefore you have a lot of parameters doing nothing. Whereas over here with the good networks," }, { "start": 1095.8400000000001, "end": 1102.72, "text": " you can see that this spikes around zero, meaning that the data points are not correlated" }, { "start": 1102.72, "end": 1110.8, "text": " or the linearizations around the data points are not correlated. And therefore you can sort of shape" }, { "start": 1110.8, "end": 1117.52, "text": " the function around each data point however you want. Which we sort of know that neural networks," }, { "start": 1117.52, "end": 1122.96, "text": " what they do is they're so over expressive that they're actually able to shape the functions" }, { "start": 1122.96, "end": 1129.68, "text": " around the data points without necessarily looking at other data points nearby. And that" }, { "start": 1129.68, "end": 1138.5600000000002, "text": " expressivity is what you want and that expressivity is what this in part measures. Okay, so they make" }, { "start": 1138.5600000000002, "end": 1144.48, "text": " a, they have some experiments here where they validate this. So for all these architectures" }, { "start": 1144.48, "end": 1148.8, "text": " in this benchmark, and maybe I should tell you what, show you what the benchmark looks like." }, { "start": 1148.8, "end": 1154.96, "text": " So the benchmark has this particular form, this particular form, there's this skeleton," }, { "start": 1154.96, "end": 1159.76, "text": " and in this skeleton there is this block and it's always repeated. And you're basically," }, { "start": 1159.76, "end": 1165.6000000000001, "text": " your task is to determine what this block should be. So this block has an input node A and an output" }, { "start": 1165.6000000000001, "end": 1170.72, "text": " node D and two intermediate nodes. And what you have to do is basically you have to determine" }, { "start": 1170.72, "end": 1177.3600000000001, "text": " these connections right here. So there are six connections and for each one you have the option" }, { "start": 1177.3600000000001, "end": 1182.24, "text": " of putting different things there. Like you can see you can put a convolution, you can put the" }, { "start": 1182.24, "end": 1187.68, "text": " identity function, which is a skip connection, zero wise. I don't, maybe that's the zero function," }, { "start": 1187.68, "end": 1194.56, "text": " so it basically means nothing. I'm not so sure, honestly. But you could technically put a" }, { "start": 1194.56, "end": 1201.76, "text": " convolution here and here, right, or different convolutions or things like this. So there are" }, { "start": 1201.76, "end": 1214.72, "text": " these 15,625 possible cells. So the NAS benchmark contains 15,625 possible architectures that you'll" }, { "start": 1214.72, "end": 1223.12, "text": " have to search. And they take these architectures and they plot now, they plot for each architecture" }, { "start": 1223.12, "end": 1227.76, "text": " the validation accuracy after training. And the training protocol is standardized, you don't have" }, { "start": 1227.76, "end": 1234, "text": " to care about that. And the score that they measure at the beginning of training. And what you can see" }, { "start": 1234, "end": 1242, "text": " is that there is a linear relationship, sort of, like sort of. From these experiments what you'll" }, { "start": 1242, "end": 1249.04, "text": " get is like this sort of feeling. What they're going to propose is that you should take that score" }, { "start": 1249.04, "end": 1259.12, "text": " as a measure. And here again also, sort of, sort of. There is a clear trend, as you can see," }, { "start": 1259.12, "end": 1266.8799999999999, "text": " right here. Though, yeah, though this, as you can see, this sort of spreads out. And the most right" }, { "start": 1266.8799999999999, "end": 1275.68, "text": " one is ImageNet, which is the most difficult one, of course. So, and this is CIFAR 100, which is more" }, { "start": 1275.68, "end": 1283.6000000000001, "text": " difficult than CIFAR 10. So we can see that this sort of relationship at the top, it doesn't really" }, { "start": 1283.6000000000001, "end": 1288.8, "text": " hold anymore if the task gets difficult. And this is, so what I think is happening, this is kind of" }, { "start": 1288.8, "end": 1295.3600000000001, "text": " an interjection of my own opinion. What's happening here is that this score that they discover" }, { "start": 1296.4, "end": 1302.96, "text": " allows them pretty efficiently to see which networks are just degenerate and cannot be trained." }, { "start": 1302.96, "end": 1309.92, "text": " Like if you try to train them, they just perform really poorly, okay? That, it's probably a very" }, { "start": 1309.92, "end": 1316.08, "text": " good score for weeding those out. And that would mean if you kind of barrier here somewhere, right?" }, { "start": 1316.08, "end": 1321.28, "text": " You could just discard a whole lot of this crap, or even here, right? You could just discard a" }, { "start": 1321.28, "end": 1330.24, "text": " whole lot of this crap. And also now here, just, you know, all of this crap. Yeah, whereas here," }, { "start": 1330.24, "end": 1335.92, "text": " as you can see, some, this score, sometimes it's higher than these ones, even though they perform" }, { "start": 1335.92, "end": 1342.4, "text": " better. And again, you could probably discard a lot of the crap, but it's not as distinctive for" }, { "start": 1342.4, "end": 1348, "text": " the well performing networks, because these here are all not the degenerate version, right? They're" }, { "start": 1348, "end": 1353.76, "text": " not degenerate in the sense that they're, they have some fundamental flaw where the function lacks" }, { "start": 1353.76, "end": 1360.08, "text": " now expressivity from the very start, so you can't train it. And so, you know, it's not" }, { "start": 1360.08, "end": 1366.24, "text": " a big deal. And then probably other factors come into play, other factors than you can simply" }, { "start": 1366.24, "end": 1372.6399999999999, "text": " determine with this particular score. But, you know, there is this relationship that's," }, { "start": 1373.6, "end": 1381.36, "text": " you know, you can see that. And they do some ablations on this here. For example, are your" }, { "start": 1381.36, "end": 1387.6799999999998, "text": " scores a proxy for a number of parameters? And they say, no, the number of parameters works way" }, { "start": 1387.68, "end": 1394, "text": " than this particular score, which, you know, is a cool thing. Then how important is the specific" }, { "start": 1394, "end": 1400.24, "text": " mini batch and initialization? And they say, look right here, we, for some architectures," }, { "start": 1400.24, "end": 1406.64, "text": " we do different mini batch sizes. And you can see each of those groups, they don't vary too much" }, { "start": 1406.64, "end": 1412.16, "text": " in how they're, it influences their score. This is, I believe this is the same architecture. So" }, { "start": 1412.16, "end": 1418, "text": " it's always an architecture that achieves in this case, for example, wow, that's not a straight line," }, { "start": 1419.28, "end": 1426.24, "text": " 77% or so. And you can see if you go for different mini batches, the score varies only minimally." }, { "start": 1427.2, "end": 1436.24, "text": " Initialization is a bigger variance inducing thing. But also here, the scores don't vary too much." }, { "start": 1436.24, "end": 1441.3600000000001, "text": " But it is interesting that the different initialization do get you to different score," }, { "start": 1441.36, "end": 1446.24, "text": " because it would directly support kind of my hypothesis that what's going on here is that" }, { "start": 1446.8, "end": 1454.32, "text": " you sort of measure initial degeneracies. And you can sort of make up for these initial degeneracies" }, { "start": 1454.32, "end": 1458.8, "text": " in the architecture sometimes with sort of a different initialization. So the different" }, { "start": 1458.8, "end": 1464.9599999999998, "text": " initializations give you differently performing networks. We already know this from things like," }, { "start": 1464.9599999999998, "end": 1470.8799999999999, "text": " you know, lottery ticket hypothesis and so on, that the initialization can matter to some degree" }, { "start": 1470.88, "end": 1477.1200000000001, "text": " in these types of things. Now, that being said, they always train to the same, it seems, but their" }, { "start": 1477.1200000000001, "end": 1484.88, "text": " their score varies. So I might be backwards correct here, or not correct. But in any case," }, { "start": 1484.88, "end": 1492, "text": " the initialization here matters more, but also you can still see this linear relationship." }, { "start": 1492.96, "end": 1499.6000000000001, "text": " And this is particularly interesting. This is even the case when you just input white noise. So" }, { "start": 1499.6, "end": 1505.6799999999998, "text": " instead of the data, you measure that score by just inputting noise that I guess has some sort" }, { "start": 1505.6799999999998, "end": 1511.28, "text": " of the same magnitude as the data would have, but it's just noise. And you can still sort of see this" }, { "start": 1511.28, "end": 1517.76, "text": " linear relationship, which is very interesting. And that I think also shows some that you what" }, { "start": 1517.76, "end": 1525.04, "text": " you're fine, what you find is a property of the network itself. And the fact that it is," }, { "start": 1525.04, "end": 1531.68, "text": " it is initialized and built in such a way that it allows you to train it in a very," }, { "start": 1532.56, "end": 1542.72, "text": " in a sort of a benign manner, it has no degeneracies. Okay. So in the last experiment," }, { "start": 1542.72, "end": 1552.24, "text": " they go here and they say, we evaluated the score on initialized networks in the PyTorch CV library." }, { "start": 1552.24, "end": 1557.52, "text": " So they go to this library that has a lot of these networks, but these networks are not the same as" }, { "start": 1557.52, "end": 1561.68, "text": " this benchmark. This benchmark is specifically designed to do architecture search. Now the" }, { "start": 1561.68, "end": 1567.76, "text": " networks in this library, they are all designed to perform really well. Some are designed to be" }, { "start": 1567.76, "end": 1572.72, "text": " quite small, some are designed to be quite fast and so on. But in general, they are all of their" }, { "start": 1572.72, "end": 1579.04, "text": " goal is to perform well, and they have been sort of found by humans to perform well. So they take" }, { "start": 1579.04, "end": 1586, "text": " now these networks on CIFAR 10 and they test them. So as you can see here, here is the test" }, { "start": 1586, "end": 1594.96, "text": " accuracy again, and here is their score that they give it. And they say, now I can't move this anymore." }, { "start": 1595.6, "end": 1599.52, "text": " Hello. Well, okay." }, { "start": 1599.52, "end": 1606.48, "text": " They say that this linear relationship still sort of holds. It doesn't hold super, super well," }, { "start": 1606.48, "end": 1614.96, "text": " but you can still sort of, if you squint, if you squint hard, you can see that it sort of goes" }, { "start": 1614.96, "end": 1621.76, "text": " upward, though you really have to squint hard. Like what are these things right here? And what," }, { "start": 1621.76, "end": 1628.16, "text": " again, what's the case is that if the score is low, it's not going to be a good score." }, { "start": 1628.16, "end": 1636.16, "text": " So what you can do is that if the score is low, you will sort of be able to cut off the worst" }, { "start": 1636.16, "end": 1643.92, "text": " performing ones. But really at the top here, it doesn't seem like there is a particular relation" }, { "start": 1643.92, "end": 1652.72, "text": " between these networks and this initial score, which sort of strengthens my hypothesis that" }, { "start": 1652.72, "end": 1659.6000000000001, "text": " it's just kind of weed out the bad ones. But it's pretty cool because you can weed out the bad ones" }, { "start": 1659.6000000000001, "end": 1665.3600000000001, "text": " without any training, right? You'd simply forward prop backward prop. There you have it. So cool." }, { "start": 1666.4, "end": 1672.64, "text": " Now they come, they, here is the experiment where they now really do this NAS benchmark and they" }, { "start": 1672.64, "end": 1679.44, "text": " compare with other methods. So some of these other methods are designed to do the call weight" }, { "start": 1679.44, "end": 1685.44, "text": " sharing, which basically is a technique where you can sort of speed up the speed up the algorithm" }, { "start": 1685.44, "end": 1691.52, "text": " as compared to non weight sharing and the non weight sharing. That's one of these we have discussed" }, { "start": 1691.52, "end": 1697.68, "text": " initially. That was my initial example with the controller and so on where it takes super long." }, { "start": 1697.68, "end": 1706.4, "text": " So here you see the method and how long each method takes. Now the best ones, as you can see" }, { "start": 1706.4, "end": 1715.1200000000001, "text": " already, the best ones here, or these, these methods right here are the best ones. They score" }, { "start": 1715.1200000000001, "end": 1722.64, "text": " somewhat like a 93.9 or so on C for 10, whereas these weight sharing ones, they don't perform too" }, { "start": 1722.64, "end": 1730.88, "text": " well, except this one seems to perform quite well. And in this hours case, they perform worse than" }, { "start": 1730.88, "end": 1736.64, "text": " that, but they still perform better than a lot of the weight sharing ones. So what their point is" }, { "start": 1736.64, "end": 1744.88, "text": " basically is that they get a pretty good score, which is a 91.5 on C for 10, which is, you know," }, { "start": 1744.88, "end": 1753.5200000000002, "text": " it's at least not degenerate. It's a, it's a good accuracy. They score that with simply evaluating" }, { "start": 1753.52, "end": 1762.16, "text": " 10 architectures, right? And as n goes up, as they evaluate more and more architectures, they do," }, { "start": 1763.6, "end": 1769.36, "text": " they do get better, but not much. So they have a discussion here. I'm having trouble moving this." }, { "start": 1771.68, "end": 1776.4, "text": " All right, so we'll sort of go through the discussion. We report results, yada, yada, yada," }, { "start": 1776.4, "end": 1782.32, "text": " yada, yada. As the setup, the non weight sharing methods are given a time budget of 12,000 seconds" }, { "start": 1782.32, "end": 1787.84, "text": " for our method and the non weight sharing methods are averaged. Accuracies are averaged over 500" }, { "start": 1787.84, "end": 1794.8, "text": " runs for weight sharing methods. Accuracies are reported over three runs with the exception of" }, { "start": 1794.8, "end": 1800.8, "text": " G Das. Our method is able to outperform all the weight sharing methods while requiring a fraction" }, { "start": 1800.8, "end": 1805.36, "text": " of the search time. And that you may see at the table. This is the real, I mean, this is the real" }, { "start": 1805.36, "end": 1812.9599999999998, "text": " deal here. They only use here 1.7 seconds compared to the 12,000 seconds of the other methods. And" }, { "start": 1812.9599999999998, "end": 1821.28, "text": " you reach almost the same accuracy. Now to be said, 2% in this particular regime on C410 is still a" }, { "start": 1821.28, "end": 1827.1999999999998, "text": " sizable difference. And that's the same benchmark, right? With the same sort of the same training" }, { "start": 1827.1999999999998, "end": 1832.32, "text": " schedule and so on. So there's not too much room to tune here. You simply have to find a better" }, { "start": 1832.32, "end": 1842.3999999999999, "text": " architecture. So these things are still sizably ahead of this. And what it appears to me that" }, { "start": 1842.3999999999999, "end": 1848.32, "text": " these methods here that don't perform well, they're simply crap. It seems they're simply," }, { "start": 1849.04, "end": 1854, "text": " I don't know, but they might be trying out something or, you know, doing something" }, { "start": 1854, "end": 1862.16, "text": " researchy or whatnot. But it seems like if you're well able to weed out the bad architectures," }, { "start": 1862.16, "end": 1870, "text": " you might be getting to a score like this. And then if you are actually performing a search to" }, { "start": 1870, "end": 1876, "text": " find the best one, then you might be getting to somewhere like this. And you can see this here" }, { "start": 1876, "end": 1884, "text": " throughout. So in C4100, they achieve a better score than these things, but a worse score than" }, { "start": 1884, "end": 1894.8, "text": " the non-weight sharing method. And in ImageNet, the difference is even larger. So again, what I" }, { "start": 1894.8, "end": 1902.4, "text": " can see here is that theirs is a good method to maybe get you, let's say, 90% of the way you want" }, { "start": 1902.4, "end": 1910.24, "text": " to go. And what's interesting is that here they say, we also show the effect of sample size. We" }, { "start": 1910.24, "end": 1914.64, "text": " show the accuracy of the networks chosen by our method for each n. So that's the sample size." }, { "start": 1914.64, "end": 1920.64, "text": " We list the optimal accuracy for sample sizes 10 and 100 and random selection over the whole benchmark." }, { "start": 1921.76, "end": 1927.76, "text": " So in this case, they have the optimal one, which I guess they just draw 10 samples and then take" }, { "start": 1927.76, "end": 1931.76, "text": " the best one. So they train all of them and then take the best one. And you can see that" }, { "start": 1931.76, "end": 1940.8799999999999, "text": " already gets you to the 93. And whereas in their case, sometimes when they add more, they get worse." }, { "start": 1940.8799999999999, "end": 1947.76, "text": " So here they get better, but then they get worse again. So they comment on this right here. We" }, { "start": 1947.76, "end": 1953.36, "text": " observe that the sample size does not have a large effect on the accuracy of our method. But note" }, { "start": 1953.36, "end": 1958.56, "text": " that as sample size increases, our method suffers from a small amount of noise, increasing the gap" }, { "start": 1958.56, "end": 1966.08, "text": " between our score and the optimal result. And of course, the key practical benefit is execution" }, { "start": 1966.08, "end": 1974.08, "text": " time. So again, they are massively faster than the other methods. But to me, it seems you could" }, { "start": 1974.08, "end": 1981.12, "text": " just think of combining these methods, right? You combine this with this in that what you want to do" }, { "start": 1981.12, "end": 1987.04, "text": " is actually actively search for the best ones. But by doing so, you could, if you could pretty" }, { "start": 1987.04, "end": 1993.28, "text": " quickly weed out the bad ones using this method down here, you might already have like a big speed" }, { "start": 1993.28, "end": 2001.28, "text": " up. Because again, with comparison to this random ones, what appears to happen is that they get good" }, { "start": 2001.28, "end": 2008.08, "text": " at finding, you know, your 90% architecture, but then they fail to differentiate the top" }, { "start": 2008.08, "end": 2014.8799999999999, "text": " performance performers from each other, where you'd really have to train the network to find out" }, { "start": 2014.88, "end": 2024.16, "text": " what's, you know, which one's better. So yeah, here they say they visualize the trade off between" }, { "start": 2024.16, "end": 2030.48, "text": " search time and accuracy for C410 for different NAS algorithms on the NAS benchmark. By removing" }, { "start": 2030.48, "end": 2035.2, "text": " the need for training, our method is able to find accurate networks in seconds instead of hours." }, { "start": 2035.2, "end": 2042, "text": " And here you can see the accuracy and here you can see the time and all the good ones are either" }, { "start": 2042, "end": 2051.44, "text": " way over here or here. And theirs is almost at zero while being quite close to the accuracy of" }, { "start": 2051.44, "end": 2060.16, "text": " the other ones. All right, yeah, that was that was this paper. Again, I think this is pretty" }, { "start": 2060.16, "end": 2066.48, "text": " valuable if you are especially if you're in a new domain, where you might not know what kind of" }, { "start": 2066.48, "end": 2071.92, "text": " network to build, you might just be able to write a little script that generates networks, run it" }, { "start": 2071.92, "end": 2077.04, "text": " through this algorithm, and at least you get an idea of which ones are certainly not worth" }, { "start": 2077.04, "end": 2082.8, "text": " considering. And then you can simply select one of the other ones. It doesn't, you know, often it" }, { "start": 2082.8, "end": 2087.44, "text": " doesn't need to be the best ones. And you can then tweak it a little bit manually, the ones you found," }, { "start": 2087.44, "end": 2093.12, "text": " maybe you see some regularity. And yeah, that was my two cents on this paper. I hope you liked it." }, { "start": 2093.12, "end": 2100.24, "text": " If you did, consider sharing it out and telling your friends about it and subscribing, liking," }, { "start": 2100.24, "end": 2127.2799999999997, "text": " and leave a comment if you agree or disagree. That was it. Bye bye." } ]
eyxmSmjmNS0
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Classic] Generative Adversarial Networks (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "gan", "generator", "discriminator", "convolution", "deconvolution", "goodfellow", "bengio", "convolutional neural network", "mnist", "cifar10", "generative", "generative model", "image generation", "face model", "latent space", "interpolation", "minmax", "nash equilibrium", "game theory" ]
#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 Ian J. Goodfellow et al. So this one is another installment in our series of historical papers that had great impact. GANs nowadays, or Generative Adversarial Nets back then, were sort of... This was the starting shot in a long line of research that is still continuing today. So I remember when I started my PhD in 2015, GANs were just about spiking. I remember NURiPS, or back then NIPS, in 2016, and every other paper was about GANs. There was also this famous Schmidhuber Goodfellow moment at the tutorial. It was a wild time. And this is the paper that started it all. The paper is quite well written. It's very focused on convincing you that this is a sound method mathematically. That it doesn't just do wild things. And also it has a lot of modern tricks for GANs already built into it. So astounding how much foresight there was already in this paper. But of course, GANs have come 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 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, 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 to sample a couple of times from the data, and sometimes you sample from this model G, and then the discriminator is supposed to decide whether or not it comes from the data set or from your counterfeiter, like from this generator G. And it's supposed to say whether it's data or fake. So you train the D model as a simple image classifier. So people already knew how to build image classifiers. This was shortly, as you can see, before ResNet came on the scene. So people already kind of knew how to build CNNs, build really good image classifiers. And the thought here was really generative models weren't really a thing until then. So people were in language models, Word2Vec was kind of coming up, but they would still be doing like RNNs using these Word2Vec vectors for generating language. In images, generative models weren't really much of a thing. So you would do like compositional models or you would do autoencoders, which were just either really blurry or really, really artifactory. And there were 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 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 like harness the power of building really good classifiers for training a generator? And this is this idea right here. This wasn't the one before, as you know, in like an autoencoder, what you do is you'd 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 autoencoders 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. 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 generators task now isn't to match any sort of data point. The generators task is to produce images that the discriminator would classify as data. And you can do that by simply back propagating through the discriminator to the generator. 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 minimax two player game. So as I said, the paper is very much focused on convincing you that there's something sound happening here, because at that time, if you were to look at this, you would say something like there is no way. This is you would be like, yeah. So I can understand the motivation here to really convince people that, you know, something something good is happening also on the on the theoretical side. In the space, sorry, in the space of arbitrary functions, G and D, a unique solution exists with G recovering the training data distribution D equals to one half everywhere. In the case where G and D are defined by multilayer perceptrons, the entire system can be trained with back propagation. There is no need for any Markov chains or unrolled approximate inference networks during either training or generation of samples. OK, 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 minimax game with value function V. 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 they are kind of adversarial and they they pump each other up and so on. And this here was more much more into the direction of kind of a a theoretical reasoning into why something like this would work. Of course, there is still a lot of engineering going on to actually make it work. So they they have there is this value function right here. OK, 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. OK, so you have a prior on your input noise to the generator because the generator is supposed to come up with very many different data points. And if it is a if it is a, you know, non-stochastic function like a neural network, then you need some way to make to produce different images. So there is this prior distribution over the noise. You feed that noise into the generator. The generator will produce an output. You put that into the discriminator and then this right here, as you can see, the discriminator is trying to maximize this objective. So the discriminator is trying to maximize the probability of real data and it is trying to minimize the probability of fake data. OK, it is this is simply a two way classification problem. At the same time, the generator, as you can see, is trying to minimize the objective. In fact, the order here is quite important. So the generator, as you can see, is trying to minimize whatever this here is. So the generator sort of is trying to minimize against the best possible discriminator. And so this is one one observation right here is that the formulation is always with respect to a perfect discriminator. Now, we know that this doesn't work because if you have a perfect discriminator, then generator cannot catch up because you have insufficient gradients and so on. And this was already recognized in this paper as well. But the formulation is with respect to a min max game and not a max min game. So the other point I want to make here is that you can see the discriminator appears in both in both terms right here. However, the generator only appears right here. And this this basically means that the objective for the generator is only this part here because the other part is constant. So the generator is just trying to make the discriminator think that fake data is real. So it is trying to make the discriminator the class of fake data as small as possible for the data that it outputs. Well, the discriminator is trying to make the class of fake data more than the class of sorry, real data. Yeah, it's trying to make it's trying to classify fake data as fake and real data as real. Whereas the generator has only this part on the right. This is I feel this is it's quite important. Why? Because already in this paper, they recognize that this might not be the best practical objective. And for the generator, they can actually exchange this part here on the right to simply say we want to. So we want to instead of one minus D, instead of log one minus D, we simply want to use minus log D as an objective for the generator. So you can kind of play around with this. And as you know, lots of formulations have played around with this loss right here. And yeah, that's why we have like a billion, billion, billion, billion GAN variations. They introduced the reasoning behind this. So there's an intuition right here. And you can see already in practice, equation one may not provide sufficient gradient for G to learn well. Early in learning, when G is poor, D can reject samples with high confidence because they're clearly different from the training data. In this case, this saturates rather than training G to minimize that we can train G to maximize log D. This objective function results in the same fixed point for the dynamic, but provides much stronger gradients in early, much stronger gradients early in learning. This is in contrast to like other papers that 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. OK, so this strategy is analogous to other things. Training maintains samples from a Markov chain from one learning step in the next order to avoid burning in a Markov chain in another loop of learning. Sorry. OK, this is from another paper. So their point here is that it's analogous to other papers that use these Markov chains where you always do one step in G and one step in D. We alternate between K steps of optimizing D and one step of optimizing G because you have this inner maximization over D and then the outer maximization, the outer minimization over G. So this has already been around the fact that you kind of have to have these optimizations in lockstep. But the difference here is you don't need any sort of like Markov chain in the inner loop and so on. You simply need back propagation. So here's an illustration of how that might work. So at the beginning here, you have your Z space and this is always sampled uniformly, as you can see right here. This is from a prior distribution and through the mapping. So this here is from Z to X is G. So this is the mapping G. You can see that the uniform distribution is now mapped to something non-uniform, which results in the green thing. So G is the green line, while as this is data, the black dots are data. And if you have a discriminator, the discriminator is supposed to tell you where there's data and where there's fake data. Now, so green here is fake. Now, this blue line is sort of a half trained discriminator. Now you train D, right? You max maximize D, the discriminator, and that gives you this blue line right here. So this this is a perfect discriminator for these two data distributions. It tells you it's basically the ratio of green to black at each point. And now you train the generator according to this. And you can see that the gradient of the discriminator is so the gradient of the discriminator. Discriminator is in this direction. OK, 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 optimize the generator. So now we shift this green curve over in order to in along the gradient of the blue curve. So it's important the green curve doesn't see the black curve ever. The generator doesn't see the data. The generator simply sees that blue curve and it goes along the gradient of that blue curve of the discriminator. OK, 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 end up with the probability of data equal to the probability of the output generated samples. And this can happen if the generator simply remembers the training data. But there are a number of things that counter that. For example, the generator is continuous while the training data is, of course, discrete. So there is this in between things right here where there is no training data. In fact, to hit exactly training data is very, very unlikely. But of course, you can still you can still peek at the training data. But also, 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 multilayer 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 GANs. So even if it doesn't remember the training data, it might focus on the easiest part of the training data and forget all other parts. And that was a direct result, actually, of this objective. So where was it? So this objective directly led to mode collapse in some in some form, because it penalizes different errors differently. So of course, people have come up with ways to to solve that. OK, 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 this is this is pretty much what we use today. The early days of GAN were still like, how much do I need to discriminator per generator and so on. Nowadays, everyone is just using one step here, one step there, or even training and jointly works in some cases. So you want to sample a mini batch of noise samples and you will sample a mini batch of M examples from training data generation. So from this data, you want to update the discriminator by sending its stochastic gradient. And this is simply the gradient of the objective. And then after those K steps, you want to sample another mini batch of noise samples and update the generator by descending its stochastic gradient. And you can see right here already, there is this reduced objective that doesn't include this because it falls away in the gradient. 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 multilayer network, so it's kind of a multilayer network that outputs an image. 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 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 this one, I guess, turned out to be fairly good. OK, 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 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. OK, so you train, you almost train this discriminator in the inner loop. And that's simply the consequence of this, of a pointwise. This is true pointwise, therefore it's true over the entire data distribution. In the next thing, they convince you that the global minimum of the virtual training criterion, 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 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, 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 criterion ends up being negative log 4 plus twice the Jensen-Shannon divergence between the data and the generated distribution. And since this term here is always positive, that means that this thing here can never be less than negative log 4. And therefore, the negative log 4 is the optimum. OK, 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 convergence is simply predicated on the fact that if you look at each of these problems individually, they are convex. So like here is convex in X for every alpha. So each of these are sort of convex problems, and then it will naturally converge to 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 suggest 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. OK, so again, it's very much focused on convincing 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 data sets, namely MNIST, the Toronto Phase Database and C410. The generator nets used a 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 at the discriminator net. While our theoretical framework permits the use of dropout and other noise at intermediate layers of the generator, we used noise as the input to only the bottom most layer of the generator network. Again, this wasn't kind of clear at the beginning. And also the fact that to leave out dropout and so on in the generator was, I guess they found that empirically. And then there was of course no way to evaluate these things. Like how do we evaluate generative models? Nowadays we have these inception distances and so on. But then we estimate probability of the test set under P under the generated data by fitting a Gaussian 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. And 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. Like we have better methods, but it's yeah, it's not really it's not really satisfactory how it is right now. So you see that these models, these adversarial nets, by the way, they're always called adversarial nets right here, where I think we call them like most people would call them adversarial networks. But it's just interesting to see the nets also in the title. Right. It says I think it says nets, does it? I think it does. We'll look at it after. So the out they outperform these other models, especially these these belief networks were kind of popular at the time. And you can see the samples right here were in no way comparable to examples that you get from the modern GANs. But this was already very, very, very good, especially the MNIST. And then here you could actually recognize. So the ones with the yellow are always from the training data set. They're like the nearest neighbors of the things on the left. So they want to show that it doesn't simply remember the training data, though I'm not so sure. Like this seems like it has some sort of somehow remember the training data a little bit. Also, this one right here. And there was already a way. So this was also very foresighted. So these A to C were fully connected networks, which might be one of the reasons why it worked moderately well. Right. But the last one was a convolutional discriminator and a deconvolutional generator. So already using kind of deconvolutions that are used everywhere today. So they are used in GANs and whatnot. VAs 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 GAN paper to use deconvolutions. Haha. Yeah. They also say we make no claim that these samples are better than samples generated by existing methods. We believe that these samples are at least competitive with the better generative models in the literature and highlight the potential of the adversarial framework. Today, this paper would be so rejected. Like, wait, you're not better. Get out of here. You can't claim it anymore. No, it doesn't work anymore. I'm sorry. Yours has always has to be better than everything else nowadays. Otherwise, it's a it's a it's a weak reject their experimental evidence doesn't doesn't convince me. You can't simply say something's cool. Also already introduced in this paper digits obtained by linearly interpolating between coordinates in z space of the full model like this thing here. Every single GAN paper had interpolations in the like in this in the GAN spike. And it came all came from here. So already this is just like this is like every GAN paper then had like rows of these like of these interpolations. I should know if I've written a paper on it and introduced right here. Who knows if they hadn't done this. Yeah, I guess it's it's kind of an obvious thing. But still, you know, very, very cool to see that this was already done. And here GANs compared to other different methods like deep directed graphical models, generative auto encoders and compared in very many ways. So this is a actually a good reference if you want to learn about these different kinds of models. And they make the claim here that their advantages and disadvantages. So disadvantages mainly come with training these things because you have to train them in lockstep. But then also the disadvantages that you don't have an explicit representation. So there is no explicit representation of this probability distribution. You never build the data distribution. You can only sample from it. However, the advantages are that Markov chains are never needed. Only backprop is used to obtain gradients. No inference is needed during learning. And a wide variety of functions can be incorporated into the model. 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. Like, oh, GANs would be so much better if they had an MCMC sampler somewhere. You're like, no, the point was to get rid of it. And like no inference is needed during learning, which, you know, for some of these other models, you actually need an inference during training. Right. So this is very, very costly. And how many models are there nowadays where it's like, oh, if we just do this inference during training. Yeah. So it's quite it's quite funny to see people kind of trying to to just combine everything with everything. And in the process, sort of reverse, reverse whatever these methods were originally meant to get rid of. Now, I'm not saying anything against these methods, but it's just kind of funny. Yeah. So they had a lot of conclusions and future work. They already say, you know, conditional GANs are very easy to do straightforward. 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 that the so if you have the G network producing some producing an X and then the D network discriminating, that you would also have like a encoder right here to produce back the Z noise to give you the latent encoding, sort of like a variational autoencoder, but not really. It's more like a reverse generator. You know, this model nowadays are big by GAN and things like this that employ this exact thing that was sort of predicted right here. Of course, there are 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 paper is pretty cool. And the coolest thing, look at that savages good fellow, not even using the full eight pages, just 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, "end": 6, "text": " Hi there! Today we'll look at Generative Adversarial Nets by Ian J. Goodfellow et al." }, { "start": 6, "end": 12, "text": " So this one is another installment in our series of historical papers that had great impact." }, { "start": 12, "end": 20, "text": " GANs nowadays, or Generative Adversarial Nets back then, were sort of..." }, { "start": 20, "end": 26, "text": " This was the starting shot in a long line of research that is still continuing today." }, { "start": 26, "end": 34, "text": " So I remember when I started my PhD in 2015, GANs were just about spiking." }, { "start": 34, "end": 41, "text": " I remember NURiPS, or back then NIPS, in 2016, and every other paper was about GANs." }, { "start": 41, "end": 47, "text": " There was also this famous Schmidhuber Goodfellow moment at the tutorial." }, { "start": 47, "end": 54, "text": " It was a wild time. And this is the paper that started it all." }, { "start": 54, "end": 64, "text": " The paper is quite well written. It's very focused on convincing you that this is a sound method mathematically." }, { "start": 64, "end": 69, "text": " That it doesn't just do wild things." }, { "start": 69, "end": 79, "text": " And also it has a lot of modern tricks for GANs already built into it." }, { "start": 79, "end": 84, "text": " So astounding how much foresight there was already in this paper." }, { "start": 84, "end": 89, "text": " But of course, GANs have come a super long way since then." }, { "start": 89, "end": 96, "text": " And today we'll just go through the paper and look at how it looked back then and what this paper was like." }, { "start": 96, "end": 100, "text": " So yeah, join me in this. If you like it, please share it out." }, { "start": 100, "end": 104, "text": " Let me know in the comments what you think of historic paper reviews." }, { "start": 104, "end": 109, "text": " This is not going to be like a beginner's tutorial in GANs." }, { "start": 109, "end": 112, "text": " This is really going to be... We'll go through the paper." }, { "start": 112, "end": 117, "text": " You'll see right here the paper is from 2014." }, { "start": 117, "end": 124, "text": " So it would still be another two years or so until GANs really take off from this point on." }, { "start": 124, "end": 129, "text": " But the introduction, of course, was really important." }, { "start": 129, "end": 132, "text": " Okay, so abstract. Here we go." }, { "start": 132, "end": 138, "text": " We propose a new framework for estimating generative models via an adversarial process" }, { "start": 138, "end": 145, "text": " in which we simultaneously train two models, a generative model G that captures the data distribution" }, { "start": 145, "end": 154, "text": " and a discriminative model D that estimates the probability that a sample came from the training data rather than G." }, { "start": 154, "end": 156, "text": " Okay, this was sort of a new thing." }, { "start": 156, "end": 161, "text": " Now, I know, I know people disagree with this being a new thing, but this was a new thing." }, { "start": 161, "end": 169, "text": " And specifically, this was the first paper that made something like this really work for data." }, { "start": 169, "end": 177, "text": " So to have a discriminator, the words generator and discriminator were also introduced in this paper." }, { "start": 177, "end": 181, "text": " So you train this D model, which is the discriminator," }, { "start": 181, "end": 187, "text": " and the D model basically decides whether or not a given data point comes from data" }, { "start": 187, "end": 192, "text": " or comes from the fake distribution." }, { "start": 192, "end": 202, "text": " And then you have a generative model G that is supposed to just create this data X rather than coming from the database." }, { "start": 202, "end": 209, "text": " So you want to sample a couple of times from the data, and sometimes you sample from this model G," }, { "start": 209, "end": 215, "text": " and then the discriminator is supposed to decide whether or not it comes from the data set" }, { "start": 215, "end": 222, "text": " or from your counterfeiter, like from this generator G." }, { "start": 222, "end": 225, "text": " And it's supposed to say whether it's data or fake." }, { "start": 225, "end": 229, "text": " So you train the D model as a simple image classifier." }, { "start": 229, "end": 232, "text": " So people already knew how to build image classifiers." }, { "start": 232, "end": 238, "text": " This was shortly, as you can see, before ResNet came on the scene." }, { "start": 238, "end": 244, "text": " So people already kind of knew how to build CNNs, build really good image classifiers." }, { "start": 244, "end": 251, "text": " And the thought here was really generative models weren't really a thing until then." }, { "start": 251, "end": 256, "text": " So people were in language models, Word2Vec was kind of coming up," }, { "start": 256, "end": 263, "text": " but they would still be doing like RNNs using these Word2Vec vectors for generating language." }, { "start": 263, "end": 267, "text": " In images, generative models weren't really much of a thing." }, { "start": 267, "end": 272, "text": " So you would do like compositional models or you would do autoencoders," }, { "start": 272, "end": 278, "text": " which were just either really blurry or really, really artifactory." }, { "start": 278, "end": 281, "text": " And there were also approaches like deep belief networks and so on," }, { "start": 281, "end": 283, "text": " but they had their own problems." }, { "start": 283, "end": 292, "text": " So there wasn't really a satisfactory way to do image generation that resulted in really high quality images." }, { "start": 292, "end": 296, "text": " Now here, I think the entire thought, and this is not really spelled out," }, { "start": 296, "end": 304, "text": " but the entire thought here is that, hey, we know how to train really, really good image classifiers." }, { "start": 304, "end": 309, "text": " This has been evident in these since AlexNet." }, { "start": 309, "end": 313, "text": " So for two years, this was evident how to build really good image classifiers." }, { "start": 313, "end": 319, "text": " And the question here is to say that rather than also building really good generators," }, { "start": 319, "end": 326, "text": " can't we like harness the power of building really good classifiers for training a generator?" }, { "start": 326, "end": 329, "text": " And this is this idea right here." }, { "start": 329, "end": 332, "text": " This wasn't the one before, as you know, in like an autoencoder," }, { "start": 332, "end": 338, "text": " what you do is you'd input a sample into some kind of auto bottleneck thing, whatever." }, { "start": 338, "end": 345, "text": " And then at the end, you train your output sample to match the input sample as close as possible." }, { "start": 345, "end": 350, "text": " And then in here, after you've trained this, this part here is your generative model." }, { "start": 350, "end": 355, "text": " And then here, in here, you'd input like MCMC sampler or whatnot." }, { "start": 355, "end": 359, "text": " And then, of course, variational autoencoders came up and so on." }, { "start": 359, "end": 365, "text": " But still, what you always would do is you would somehow use the data directly." }, { "start": 365, "end": 368, "text": " So this is data in order to train your model." }, { "start": 368, "end": 373, "text": " So you would somehow say, ah, the output here should probably match the input in some way" }, { "start": 373, "end": 377, "text": " or in some at least distributional way." }, { "start": 377, "end": 385, "text": " This was a new thing. As you can see right here, there is no direct connection between the data and the generator." }, { "start": 385, "end": 388, "text": " And I think this was the success of this model." }, { "start": 388, "end": 396, "text": " 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." }, { "start": 396, "end": 407, "text": " The philosophy here is let's use the power of discriminative models, which we know how to build in order to train this generator." }, { "start": 407, "end": 411, "text": " So the generators task now isn't to match any sort of data point." }, { "start": 411, "end": 417, "text": " The generators task is to produce images that the discriminator would classify as data." }, { "start": 417, "end": 424, "text": " And you can do that by simply back propagating through the discriminator to the generator." }, { "start": 424, "end": 434, "text": " 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." }, { "start": 434, "end": 442, "text": " But everything else is spelled out very well in this paper, I have to say, if you read through it." }, { "start": 442, "end": 450, "text": " So the training procedure for G is to maximize the probability of D making a mistake." }, { "start": 450, "end": 453, "text": " This framework corresponds to a minimax two player game." }, { "start": 453, "end": 458, "text": " So as I said, the paper is very much focused on convincing you that there's something sound happening here," }, { "start": 458, "end": 465, "text": " because at that time, if you were to look at this, you would say something like there is no way." }, { "start": 465, "end": 469, "text": " This is you would be like, yeah." }, { "start": 469, "end": 480, "text": " So I can understand the motivation here to really convince people that, you know, something something good is happening also on the on the theoretical side." }, { "start": 480, "end": 491, "text": " 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." }, { "start": 491, "end": 497, "text": " In the case where G and D are defined by multilayer perceptrons, the entire system can be trained with back propagation." }, { "start": 497, "end": 505, "text": " There is no need for any Markov chains or unrolled approximate inference networks during either training or generation of samples." }, { "start": 505, "end": 514, "text": " OK, so the point here is that it's much easier than current methods of producing of generative models." }, { "start": 514, "end": 518, "text": " And also it does something sound." }, { "start": 518, "end": 524, "text": " Now, let's jump into the loss function right here." }, { "start": 524, "end": 532, "text": " So they say G and D play the following two player minimax game with value function V." }, { "start": 532, "end": 546, "text": " 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." }, { "start": 546, "end": 552, "text": " And they they are kind of adversarial and they they pump each other up and so on." }, { "start": 552, "end": 560, "text": " And this here was more much more into the direction of kind of a a theoretical reasoning into why something like this would work." }, { "start": 560, "end": 565, "text": " Of course, there is still a lot of engineering going on to actually make it work." }, { "start": 565, "end": 570, "text": " So they they have there is this value function right here." }, { "start": 570, "end": 573, "text": " OK, and the value function is the following." }, { "start": 573, "end": 585, "text": " 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." }, { "start": 585, "end": 590, "text": " So here you can see and this was introduced, this seems also obvious now." }, { "start": 590, "end": 596, "text": " Right. But you have a prior on what this is called the noise distribution." }, { "start": 596, "end": 606, "text": " OK, so you have a prior on your input noise to the generator because the generator is supposed to come up with very many different data points." }, { "start": 606, "end": 616, "text": " And if it is a if it is a, you know, non-stochastic function like a neural network, then you need some way to make to produce different images." }, { "start": 616, "end": 620, "text": " So there is this prior distribution over the noise." }, { "start": 620, "end": 623, "text": " You feed that noise into the generator." }, { "start": 623, "end": 625, "text": " The generator will produce an output." }, { "start": 625, "end": 634, "text": " You put that into the discriminator and then this right here, as you can see, the discriminator is trying to maximize this objective." }, { "start": 634, "end": 643, "text": " So the discriminator is trying to maximize the probability of real data and it is trying to minimize the probability of fake data." }, { "start": 643, "end": 650, "text": " OK, it is this is simply a two way classification problem." }, { "start": 650, "end": 655, "text": " At the same time, the generator, as you can see, is trying to minimize the objective." }, { "start": 655, "end": 658, "text": " In fact, the order here is quite important." }, { "start": 658, "end": 667, "text": " So the generator, as you can see, is trying to minimize whatever this here is." }, { "start": 667, "end": 672, "text": " So the generator sort of is trying to minimize against the best possible discriminator." }, { "start": 672, "end": 681, "text": " And so this is one one observation right here is that the formulation is always with respect to a perfect discriminator." }, { "start": 681, "end": 690, "text": " 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." }, { "start": 690, "end": 694, "text": " And this was already recognized in this paper as well." }, { "start": 694, "end": 701, "text": " But the formulation is with respect to a min max game and not a max min game." }, { "start": 701, "end": 711, "text": " So the other point I want to make here is that you can see the discriminator appears in both in both terms right here." }, { "start": 711, "end": 715, "text": " However, the generator only appears right here." }, { "start": 715, "end": 723, "text": " And this this basically means that the objective for the generator is only this part here because the other part is constant." }, { "start": 723, "end": 730, "text": " So the generator is just trying to make the discriminator think that fake data is real." }, { "start": 730, "end": 739, "text": " So it is trying to make the discriminator the class of fake data as small as possible for the data that it outputs." }, { "start": 739, "end": 748, "text": " Well, the discriminator is trying to make the class of fake data more than the class of sorry, real data." }, { "start": 748, "end": 754, "text": " Yeah, it's trying to make it's trying to classify fake data as fake and real data as real." }, { "start": 754, "end": 757, "text": " Whereas the generator has only this part on the right." }, { "start": 757, "end": 761, "text": " This is I feel this is it's quite important." }, { "start": 761, "end": 768, "text": " Why? Because already in this paper, they recognize that this might not be the best practical objective." }, { "start": 768, "end": 775, "text": " And for the generator, they can actually exchange this part here on the right to simply say we want to." }, { "start": 775, "end": 789, "text": " So we want to instead of one minus D, instead of log one minus D, we simply want to use minus log D as an objective for the generator." }, { "start": 789, "end": 791, "text": " So you can kind of play around with this." }, { "start": 791, "end": 795, "text": " And as you know, lots of formulations have played around with this loss right here." }, { "start": 795, "end": 802, "text": " And yeah, that's why we have like a billion, billion, billion, billion GAN variations." }, { "start": 802, "end": 805, "text": " They introduced the reasoning behind this." }, { "start": 805, "end": 809, "text": " So there's an intuition right here." }, { "start": 809, "end": 816, "text": " And you can see already in practice, equation one may not provide sufficient gradient for G to learn well." }, { "start": 816, "end": 822, "text": " Early in learning, when G is poor, D can reject samples with high confidence because they're clearly different from the training data." }, { "start": 822, "end": 830, "text": " In this case, this saturates rather than training G to minimize that we can train G to maximize log D." }, { "start": 830, "end": 839, "text": " 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." }, { "start": 839, "end": 843, "text": " This is in contrast to like other papers that seem to say, oh, we do this." }, { "start": 843, "end": 846, "text": " And they at least say it provides the same fixed point." }, { "start": 846, "end": 848, "text": " Right. Yeah." }, { "start": 848, "end": 854, "text": " So again, they're trying to convince you that this is doing something useful and that this is easier." }, { "start": 854, "end": 858, "text": " OK, so this strategy is analogous to other things." }, { "start": 858, "end": 869, "text": " Training maintains samples from a Markov chain from one learning step in the next order to avoid burning in a Markov chain in another loop of learning." }, { "start": 869, "end": 871, "text": " Sorry. OK, this is from another paper." }, { "start": 871, "end": 881, "text": " So their point here is that it's analogous to other papers that use these Markov chains where you always do one step in G and one step in D." }, { "start": 881, "end": 893, "text": " We alternate between K steps of optimizing D and one step of optimizing G because you have this inner maximization over D and then the outer maximization, the outer minimization over G." }, { "start": 893, "end": 899, "text": " So this has already been around the fact that you kind of have to have these optimizations in lockstep." }, { "start": 899, "end": 905, "text": " But the difference here is you don't need any sort of like Markov chain in the inner loop and so on." }, { "start": 905, "end": 907, "text": " You simply need back propagation." }, { "start": 907, "end": 911, "text": " So here's an illustration of how that might work." }, { "start": 911, "end": 918, "text": " So at the beginning here, you have your Z space and this is always sampled uniformly, as you can see right here." }, { "start": 918, "end": 922, "text": " This is from a prior distribution and through the mapping." }, { "start": 922, "end": 926, "text": " So this here is from Z to X is G." }, { "start": 926, "end": 928, "text": " So this is the mapping G." }, { "start": 928, "end": 935, "text": " You can see that the uniform distribution is now mapped to something non-uniform, which results in the green thing." }, { "start": 935, "end": 943, "text": " So G is the green line, while as this is data, the black dots are data." }, { "start": 943, "end": 952, "text": " And if you have a discriminator, the discriminator is supposed to tell you where there's data and where there's fake data." }, { "start": 952, "end": 957, "text": " Now, so green here is fake." }, { "start": 957, "end": 960, "text": " Now, this blue line is sort of a half trained discriminator." }, { "start": 960, "end": 962, "text": " Now you train D, right?" }, { "start": 962, "end": 969, "text": " You max maximize D, the discriminator, and that gives you this blue line right here." }, { "start": 969, "end": 974, "text": " So this this is a perfect discriminator for these two data distributions." }, { "start": 974, "end": 980, "text": " It tells you it's basically the ratio of green to black at each point." }, { "start": 980, "end": 985, "text": " And now you train the generator according to this." }, { "start": 985, "end": 991, "text": " And you can see that the gradient of the discriminator is so the gradient of the discriminator." }, { "start": 991, "end": 994, "text": " Discriminator is in this direction." }, { "start": 994, "end": 997, "text": " OK, so it's like up this hill." }, { "start": 997, "end": 1005, "text": " And that's why you want to shift your green curve over here according to the gradient of the discriminator." }, { "start": 1005, "end": 1016, "text": " Note that we first trained the discriminator and now in a second step, we optimize the generator." }, { "start": 1016, "end": 1024, "text": " So now we shift this green curve over in order to in along the gradient of the blue curve." }, { "start": 1024, "end": 1029, "text": " So it's important the green curve doesn't see the black curve ever." }, { "start": 1029, "end": 1031, "text": " The generator doesn't see the data." }, { "start": 1031, "end": 1038, "text": " The generator simply sees that blue curve and it goes along the gradient of that blue curve of the discriminator." }, { "start": 1038, "end": 1044, "text": " OK, and then if you do this many, many steps, actually, there are dots right here." }, { "start": 1044, "end": 1050, "text": " You will end up with a discriminator that has no clue what's where." }, { "start": 1050, "end": 1053, "text": " This is one half probability everywhere because the ratio is the same." }, { "start": 1053, "end": 1063, "text": " And you end up with the probability of data equal to the probability of the output generated samples." }, { "start": 1063, "end": 1069, "text": " And this can happen if the generator simply remembers the training data." }, { "start": 1069, "end": 1071, "text": " But there are a number of things that counter that." }, { "start": 1071, "end": 1078, "text": " For example, the generator is continuous while the training data is, of course, discrete." }, { "start": 1078, "end": 1085, "text": " So there is this in between things right here where there is no training data." }, { "start": 1085, "end": 1089, "text": " In fact, to hit exactly training data is very, very unlikely." }, { "start": 1089, "end": 1093, "text": " But of course, you can still you can still peek at the training data." }, { "start": 1093, "end": 1101, "text": " But also, I think there are two things why the generator doesn't simply remember the training data first," }, { "start": 1101, "end": 1104, "text": " because it doesn't ever see the training data directly." }, { "start": 1104, "end": 1108, "text": " So it can only see it through the discriminator." }, { "start": 1108, "end": 1113, "text": " And second of all, because it is built as these multilayer neural networks," }, { "start": 1113, "end": 1118, "text": " it doesn't have the power to just remember this," }, { "start": 1118, "end": 1123, "text": " because as there is kind of this notion of continuous function." }, { "start": 1123, "end": 1128, "text": " So and these neural networks are rather smooth functions often." }, { "start": 1128, "end": 1135, "text": " And therefore, I think that is something that helps the generator avoid remembering the training data." }, { "start": 1135, "end": 1139, "text": " Of course, there is still this problem of mode collapse that was really big in GANs." }, { "start": 1139, "end": 1141, "text": " So even if it doesn't remember the training data," }, { "start": 1141, "end": 1146, "text": " it might focus on the easiest part of the training data and forget all other parts." }, { "start": 1146, "end": 1151, "text": " And that was a direct result, actually, of this objective." }, { "start": 1151, "end": 1153, "text": " So where was it?" }, { "start": 1153, "end": 1160, "text": " So this objective directly led to mode collapse in some in some form," }, { "start": 1160, "end": 1163, "text": " because it penalizes different errors differently." }, { "start": 1163, "end": 1169, "text": " So of course, people have come up with ways to to solve that." }, { "start": 1169, "end": 1173, "text": " OK, now here is the algorithm." }, { "start": 1173, "end": 1181, "text": " As you can see, this was already quite this was already quite the algorithm we use nowadays." }, { "start": 1181, "end": 1184, "text": " So for K steps, this is the inner maximization." }, { "start": 1184, "end": 1187, "text": " And here they say that we use K equals one." }, { "start": 1187, "end": 1190, "text": " So this is this is pretty much what we use today." }, { "start": 1190, "end": 1196, "text": " The early days of GAN were still like, how much do I need to discriminator per generator and so on." }, { "start": 1196, "end": 1199, "text": " Nowadays, everyone is just using one step here, one step there," }, { "start": 1199, "end": 1204, "text": " or even training and jointly works in some cases." }, { "start": 1204, "end": 1207, "text": " So you want to sample a mini batch of noise samples" }, { "start": 1207, "end": 1214, "text": " and you will sample a mini batch of M examples from training data generation." }, { "start": 1214, "end": 1220, "text": " So from this data, you want to update the discriminator by sending its stochastic gradient." }, { "start": 1220, "end": 1222, "text": " And this is simply the gradient of the objective." }, { "start": 1222, "end": 1227, "text": " And then after those K steps, you want to sample another mini batch of noise samples" }, { "start": 1227, "end": 1231, "text": " and update the generator by descending its stochastic gradient." }, { "start": 1231, "end": 1235, "text": " And you can see right here already, there is this reduced objective" }, { "start": 1235, "end": 1241, "text": " that doesn't include this because it falls away in the gradient." }, { "start": 1241, "end": 1245, "text": " And they say the gradient based up this can use any standard learning based rule." }, { "start": 1245, "end": 1248, "text": " We use momentum in our experiments." }, { "start": 1248, "end": 1250, "text": " Very cool." }, { "start": 1250, "end": 1259, "text": " So I believe they already also say that it is somewhere here." }, { "start": 1259, "end": 1266, "text": " It's pretty fun that they say, oh, in our generator, we only input noise at the lowest layer." }, { "start": 1266, "end": 1272, "text": " This is also something that if you think that G here is a multilayer network," }, { "start": 1272, "end": 1276, "text": " so it's kind of a multilayer network that outputs an image." }, { "start": 1276, "end": 1281, "text": " And if you ask yourself, if I have noise, how would I input that into there?" }, { "start": 1281, "end": 1285, "text": " It's so clear nowadays that we just put it here." }, { "start": 1285, "end": 1287, "text": " But this was not clear at all." }, { "start": 1287, "end": 1293, "text": " This was kind of an invention of this paper because you could put it pretty much at all layers." }, { "start": 1293, "end": 1295, "text": " You could distribute it and so on." }, { "start": 1295, "end": 1298, "text": " You could add some right here." }, { "start": 1298, "end": 1304, "text": " It was this paper that already established the fact that we input noise kind of as a vector" }, { "start": 1304, "end": 1309, "text": " at the very beginning and then just let the neural network produce the image from that." }, { "start": 1309, "end": 1312, "text": " So yeah, pretty cool." }, { "start": 1312, "end": 1316, "text": " It's pretty sneaky how many things are hidden in these initial papers," }, { "start": 1316, "end": 1320, "text": " how many decisions that are made there then are just taken over." }, { "start": 1320, "end": 1324, "text": " And this one, I guess, turned out to be fairly good." }, { "start": 1324, "end": 1328, "text": " OK, so here they go for some theoretical analysis." }, { "start": 1328, "end": 1336, "text": " And the first they want to convince you that if the generator, if this all works well," }, { "start": 1336, "end": 1344, "text": " if both parties, this generator and the discriminator, optimize their objective to the optimum," }, { "start": 1344, "end": 1353, "text": " then the generator will have captured the data distribution, so the global optimality of this." }, { "start": 1353, "end": 1356, "text": " And they go about convincing you of that." }, { "start": 1356, "end": 1362, "text": " So the first thing that they convince you of is that if you fix the generator," }, { "start": 1362, "end": 1364, "text": " the optimal discriminator is this." }, { "start": 1364, "end": 1366, "text": " And we've already seen this in this drawing right here." }, { "start": 1366, "end": 1375, "text": " So the optimal discriminator is simply the ratio of the data, of the likelihood of data" }, { "start": 1375, "end": 1379, "text": " versus the likelihood of the generated data." }, { "start": 1379, "end": 1385, "text": " OK, so you train, you almost train this discriminator in the inner loop." }, { "start": 1385, "end": 1390, "text": " And that's simply the consequence of this, of a pointwise." }, { "start": 1390, "end": 1396, "text": " This is true pointwise, therefore it's true over the entire data distribution." }, { "start": 1396, "end": 1405, "text": " In the next thing, they convince you that the global minimum of the virtual training criterion," }, { "start": 1405, "end": 1412, "text": " this is the value function, this min-max game, is achieved if and only if this holds." }, { "start": 1412, "end": 1418, "text": " At that point, the training criterion achieves the value of negative log 4." }, { "start": 1418, "end": 1426, "text": " And this, again, this was already here, the fact that this has a global minimum," }, { "start": 1426, "end": 1432, "text": " and it is achieved when the generator matches the data distribution, which is pretty cool." }, { "start": 1432, "end": 1434, "text": " So in the proof, it's pretty simple, actually." }, { "start": 1434, "end": 1440, "text": " They first say, look, if this is the case, we just simply plug that in," }, { "start": 1440, "end": 1443, "text": " the discriminator will be confused." }, { "start": 1443, "end": 1450, "text": " So if the generator exactly captures the data, the discriminator will have no clue what's going on, right?" }, { "start": 1450, "end": 1453, "text": " Because it can't, because they're equal." }, { "start": 1453, "end": 1457, "text": " So it must basically output the probability of one half everywhere," }, { "start": 1457, "end": 1462, "text": " and then your objective becomes a constant negative log 4." }, { "start": 1462, "end": 1466, "text": " Now, if you then plug that into the other equation," }, { "start": 1466, "end": 1473, "text": " you'll see that the training criterion ends up being negative log 4 plus twice the Jensen-Shannon divergence" }, { "start": 1473, "end": 1476, "text": " between the data and the generated distribution." }, { "start": 1476, "end": 1486, "text": " And since this term here is always positive, that means that this thing here can never be less than negative log 4." }, { "start": 1486, "end": 1489, "text": " And therefore, the negative log 4 is the optimum." }, { "start": 1489, "end": 1501, "text": " OK, that's the proof is pretty cool, I have to say, to show that this has the optimum at that place." }, { "start": 1501, "end": 1507, "text": " And the last thing they convince you of is that this algorithm actually converges." }, { "start": 1507, "end": 1514, "text": " And the convergence is simply predicated on the fact that if you look at each of these problems individually," }, { "start": 1514, "end": 1523, "text": " they are convex. So like here is convex in X for every alpha." }, { "start": 1523, "end": 1534, "text": " So each of these are sort of convex problems, and then it will naturally converge to their minimum." }, { "start": 1534, "end": 1540, "text": " However, in practice, adversarial nets represent a limited family of distributions via the function." }, { "start": 1540, "end": 1544, "text": " And we optimize the parameters rather than the distribution itself." }, { "start": 1544, "end": 1550, "text": " Using a multilayer perceptron to define G introduces multiple critical points in parameter space." }, { "start": 1550, "end": 1556, "text": " However, the excellent performance of the multilayer perceptrons in practice suggest that they are a reasonable model to use," }, { "start": 1556, "end": 1558, "text": " despite their lack of theoretical guarantees." }, { "start": 1558, "end": 1566, "text": " So they say if we could optimize this probability distribution directly, it is a convex problem and we will always converge." }, { "start": 1566, "end": 1573, "text": " But in practice, of course, we only optimize the parameters of an MLP or a CNN." }, { "start": 1573, "end": 1580, "text": " And that doesn't always converge. But we have reasonable hopes that it will converge." }, { "start": 1580, "end": 1588, "text": " OK, so again, it's very much focused on convincing that this is doing something sensible, which I hope now you are convinced." }, { "start": 1588, "end": 1597, "text": " So there is a global optimum point. It's when the generator captures the data distribution perfectly." }, { "start": 1597, "end": 1609, "text": " This is this can be achieved and will be achieved if you can optimize these probability distributions with a reasonable degree of freedom." }, { "start": 1609, "end": 1617, "text": " And the neural networks provide that reasonable degree of freedom and give us good hope that in practice it will work." }, { "start": 1617, "end": 1627, "text": " So they apply this to data sets, namely MNIST, the Toronto Phase Database and C410." }, { "start": 1627, "end": 1636, "text": " The generator nets used a mixture of rectifier linear activations and sigmoid activations, while the discriminator net used max out activations." }, { "start": 1636, "end": 1642, "text": " That was still a thing. Dropout was applied in training at the discriminator net." }, { "start": 1642, "end": 1653, "text": " While our theoretical framework permits the use of dropout and other noise at intermediate layers of the generator," }, { "start": 1653, "end": 1660, "text": " we used noise as the input to only the bottom most layer of the generator network." }, { "start": 1660, "end": 1671, "text": " 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." }, { "start": 1671, "end": 1678, "text": " And then there was of course no way to evaluate these things. Like how do we evaluate generative models?" }, { "start": 1678, "end": 1681, "text": " Nowadays we have these inception distances and so on." }, { "start": 1681, "end": 1692, "text": " But then we estimate probability of the test set under P under the generated data by fitting a Gaussian parsing window to the samples generated with G" }, { "start": 1692, "end": 1695, "text": " and reporting the log likelihood under this distribution." }, { "start": 1695, "end": 1702, "text": " The theta parameter, yada yada yada. Results are reported." }, { "start": 1702, "end": 1712, "text": " 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." }, { "start": 1712, "end": 1721, "text": " Advances in generative models that can sample but not estimate likelihood directly motivate further research into how to evaluate such models." }, { "start": 1721, "end": 1728, "text": " They were absolutely right in this. And there was a lot of research into how to evaluate these models." }, { "start": 1728, "end": 1737, "text": " However, it is my opinion that we still have very, very limited methods of evaluating models like this." }, { "start": 1737, "end": 1747, "text": " Like we have better methods, but it's yeah, it's not really it's not really satisfactory how it is right now." }, { "start": 1747, "end": 1760, "text": " 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." }, { "start": 1760, "end": 1772, "text": " But it's just interesting to see the nets also in the title. Right. It says I think it says nets, does it? I think it does. We'll look at it after." }, { "start": 1772, "end": 1782, "text": " So the out they outperform these other models, especially these these belief networks were kind of popular at the time." }, { "start": 1782, "end": 1790, "text": " And you can see the samples right here were in no way comparable to examples that you get from the modern GANs." }, { "start": 1790, "end": 1798, "text": " But this was already very, very, very good, especially the MNIST. And then here you could actually recognize." }, { "start": 1798, "end": 1806, "text": " So the ones with the yellow are always from the training data set. They're like the nearest neighbors of the things on the left." }, { "start": 1806, "end": 1812, "text": " So they want to show that it doesn't simply remember the training data, though I'm not so sure." }, { "start": 1812, "end": 1818, "text": " Like this seems like it has some sort of somehow remember the training data a little bit." }, { "start": 1818, "end": 1824, "text": " Also, this one right here. And there was already a way." }, { "start": 1824, "end": 1834, "text": " 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." }, { "start": 1834, "end": 1842, "text": " Right. But the last one was a convolutional discriminator and a deconvolutional generator." }, { "start": 1842, "end": 1848, "text": " So already using kind of deconvolutions that are used everywhere today." }, { "start": 1848, "end": 1858, "text": " So they are used in GANs and whatnot. VAs to up sample anything. If you want to do pixel wise classification, you use deconvolutions." }, { "start": 1858, "end": 1869, "text": " So again, this paper sort of introduced a lot of things that later that we still use in GANs today." }, { "start": 1869, "end": 1876, "text": " Now, I'm sure deconvolutions weren't invented here, but we still use them." }, { "start": 1876, "end": 1884, "text": " So legit, they were the first GAN paper to use deconvolutions. Haha. Yeah." }, { "start": 1884, "end": 1891, "text": " They also say we make no claim that these samples are better than samples generated by existing methods." }, { "start": 1891, "end": 1899, "text": " 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." }, { "start": 1899, "end": 1909, "text": " Today, this paper would be so rejected. Like, wait, you're not better. Get out of here. You can't claim it anymore." }, { "start": 1909, "end": 1916, "text": " No, it doesn't work anymore. I'm sorry. Yours has always has to be better than everything else nowadays." }, { "start": 1916, "end": 1924, "text": " Otherwise, it's a it's a it's a weak reject their experimental evidence doesn't doesn't convince me." }, { "start": 1924, "end": 1935, "text": " 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." }, { "start": 1935, "end": 1941, "text": " Every single GAN paper had interpolations in the like in this in the GAN spike." }, { "start": 1941, "end": 1953, "text": " And it came all came from here. So already this is just like this is like every GAN paper then had like rows of these like of these interpolations." }, { "start": 1953, "end": 1961, "text": " I should know if I've written a paper on it and introduced right here. Who knows if they hadn't done this." }, { "start": 1961, "end": 1969, "text": " Yeah, I guess it's it's kind of an obvious thing. But still, you know, very, very cool to see that this was already done." }, { "start": 1969, "end": 1981, "text": " And here GANs compared to other different methods like deep directed graphical models, generative auto encoders and compared in very many ways." }, { "start": 1981, "end": 1985, "text": " So this is a actually a good reference if you want to learn about these different kinds of models." }, { "start": 1985, "end": 1991, "text": " And they make the claim here that their advantages and disadvantages." }, { "start": 1991, "end": 1999, "text": " So disadvantages mainly come with training these things because you have to train them in lockstep." }, { "start": 1999, "end": 2005, "text": " But then also the disadvantages that you don't have an explicit representation." }, { "start": 2005, "end": 2009, "text": " So there is no explicit representation of this probability distribution." }, { "start": 2009, "end": 2014, "text": " You never build the data distribution. You can only sample from it." }, { "start": 2014, "end": 2018, "text": " However, the advantages are that Markov chains are never needed." }, { "start": 2018, "end": 2023, "text": " Only backprop is used to obtain gradients. No inference is needed during learning." }, { "start": 2023, "end": 2026, "text": " And a wide variety of functions can be incorporated into the model." }, { "start": 2026, "end": 2030, "text": " This, you know, I hadn't read this paper in a while." }, { "start": 2030, "end": 2044, "text": " 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." }, { "start": 2044, "end": 2049, "text": " Like, oh, GANs would be so much better if they had an MCMC sampler somewhere." }, { "start": 2049, "end": 2053, "text": " You're like, no, the point was to get rid of it." }, { "start": 2053, "end": 2064, "text": " And like no inference is needed during learning, which, you know, for some of these other models, you actually need an inference during training." }, { "start": 2064, "end": 2067, "text": " Right. So this is very, very costly." }, { "start": 2067, "end": 2075, "text": " And how many models are there nowadays where it's like, oh, if we just do this inference during training." }, { "start": 2075, "end": 2084, "text": " Yeah. So it's quite it's quite funny to see people kind of trying to to just combine everything with everything." }, { "start": 2084, "end": 2092, "text": " And in the process, sort of reverse, reverse whatever these methods were originally meant to get rid of." }, { "start": 2092, "end": 2099, "text": " Now, I'm not saying anything against these methods, but it's just kind of funny." }, { "start": 2099, "end": 2103, "text": " Yeah. So they had a lot of conclusions and future work." }, { "start": 2103, "end": 2110, "text": " They already say, you know, conditional GANs are very easy to do straightforward." }, { "start": 2110, "end": 2115, "text": " Learned approximate inference can be performed by training an auxiliary network to predict Z given X." }, { "start": 2115, "end": 2120, "text": " And this, of course, as you know, has come, you know, has come to fruit very often." }, { "start": 2120, "end": 2131, "text": " Early papers already introduced that the so if you have the G network producing some producing an X and then the D network discriminating," }, { "start": 2131, "end": 2141, "text": " that you would also have like a encoder right here to produce back the Z noise to give you the latent encoding," }, { "start": 2141, "end": 2144, "text": " sort of like a variational autoencoder, but not really." }, { "start": 2144, "end": 2147, "text": " It's more like a reverse generator." }, { "start": 2147, "end": 2158, "text": " You know, this model nowadays are big by GAN and things like this that employ this exact thing that was sort of predicted right here." }, { "start": 2158, "end": 2161, "text": " Of course, there are much earlier models also using this." }, { "start": 2161, "end": 2169, "text": " As long as I can remember, people have attempted to bring encoders into GANs." }, { "start": 2169, "end": 2173, "text": " They have a bunch of other things like semi supervised learning." }, { "start": 2173, "end": 2179, "text": " You can use this to do to do get more data for a classifier, which is also done." }, { "start": 2179, "end": 2184, "text": " So a lot of things here already foresight in this paper is pretty cool." }, { "start": 2184, "end": 2194, "text": " And the coolest thing, look at that savages good fellow, not even using the full eight pages, just dropping this on the world." }, { "start": 2194, "end": 2198, "text": " Absolutely cool. Mad respect." }, { "start": 2198, "end": 2204, "text": " So, yeah, this was kind of my take on general." }, { "start": 2204, "end": 2207, "text": " Yeah, it is generative adversarial nets." }, { "start": 2207, "end": 2212, "text": " And yeah, please tell me if you like historic paper overviews." }, { "start": 2212, "end": 2216, "text": " It's more kind of a rant than it really is a paper explanation." }, { "start": 2216, "end": 2220, "text": " But I do enjoy going through this papers and kind of looking at them in hindsight." }, { "start": 2220, "end": 2248, "text": " All right. That was it from me. I wish you a nice day. Bye bye." } ]
yexR53My2O4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Classic] Word2Vec: Distributed Representations of Words and Phrases and their Compositionality
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "jeff dean", "mikolov", "word2vec", "word vectors", "word representations", "nlp", "natural language processing", "sentiment classification", "king", "queen", "man", "woman", "arithmetic", "latent space", "distributed", "country", "capital", "semantic", "synonyms", "skip gram", "negative sampling", "nce", "noise contrastive estimation" ]
#ai #research #word2vec Word vectors have been one of the most influential techniques in modern NLP to date. This paper describes Word2Vec, which the most popular technique to obtain word vectors. The paper introduces the negative sampling technique as an approximation to noise contrastive estimation and shows that this allows the training of word vectors from giant corpora on a single machine in a very short time. OUTLINE: 0:00 - Intro & Outline 1:50 - Distributed Word Representations 5:40 - Skip-Gram Model 12:00 - Hierarchical Softmax 14:55 - Negative Sampling 22:30 - Mysterious 3/4 Power 25:50 - Frequent Words Subsampling 28:15 - Empirical Results 29:45 - Conclusion & Comments Paper: https://arxiv.org/abs/1310.4546 Code: https://code.google.com/archive/p/word2vec/ Abstract: The recently introduced continuous Skip-gram model is an efficient method for learning high-quality distributed vector representations that capture a large number of precise syntactic and semantic word relationships. In this paper we present several extensions that improve both the quality of the vectors and the training speed. By subsampling of the frequent words we obtain significant speedup and also learn more regular word representations. We also describe a simple alternative to the hierarchical softmax called negative sampling. An inherent limitation of word representations is their indifference to word order and their inability to represent idiomatic phrases. For example, the meanings of "Canada" and "Air" cannot be easily combined to obtain "Air Canada". Motivated by this example, we present a simple method for finding phrases in text, and show that learning good vector representations for millions of phrases is possible. Authors: Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, Jeffrey Dean Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at distributed representations of words and phrases and their compositionality by Thomas Mikolov, Ilya Sotskyver, Kai Chen, Greg Corrado and Jeffrey Dean. This is another historical paper, it's one of three papers, it's the middle one that introduces the original Word2vec algorithm. And as you might know, Word2vec was extremely influential in NLP since this paper basically until recently, where it's sort of gone out of fashion a bit in research with the rise of things like ELMo and BERT, but it's still very, very relevant. So we'll look at this historical paper today with kind of the hindsight of being a couple years into the future. In fact, as you see right here, this was released in 2013, so it's seven years later now. And we'll look back and we'll see what they said back then about the system. This is not going to be like a very well-enhanced PowerPoint presentation of how Word2vec 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, you know, 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 Mikhailov in an earlier paper that came out, I believe not like one or two months prior to this one. As I said, Word2vec is a series of papers. I don't think there is a paper called Word2vec. Rather, they here have released the code along with the paper. The code was called Word2vec. 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 the two might be mapped to, I don't know, 0.1, 0.9, and 0.3. Learn might be mapped to negative 0.5 and so on. So each word gets assigned a vector in the same dimensional space. And what the previous paper kind of discovered is that if you do this correctly, then these vectors, they have some kind of properties. So we can already kind of jump ahead because this was already a bit, a bit researched in the last paper. The semantics of these vectors will be something like this. So here they have a two dimensional PCA. So these are the first two dimensions of the 1000 dimensional 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 their capitals and you average that vector, you get a kind of a direction for capitalness of a city. Given a country, you can see that there is a pretty clear relation here. Now, some of these things have later been revised to such that they are ultimately ended up being not that impressive. For example, there was always this kind of math with vectors. And I don't, I believe this is, this might not be in this. This is in the last paper where they discovered that if you take the vector for king and you subtract the vector for man and you add the vector for woman, then that would result in the vector for queen. So the way they did it was basically they did this calculation right here and then they searched in the point they ended up, they searched for the nearest neighbor in their vocabulary. And that turned out to be queen. But in order to make it queen, actually, you have to exclude the original word king. People quickly discovered that if you don't exclude the original word, 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 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 big dictionary basically says that the word two is going to be mapped to this vector point one, da, da, da, da, da, da, and so on. The word learn is going to be mapped to that vector. And then you also have these output vectors right here. And what you're trying to do is you're trying to take a phrase from the data set like this one right here. And you take out one word like this word vector right here. And you're trying to frame this as a prediction task. So you're trying to frame this as, in this case, four different prediction tasks. So you're telling your machine, I give you the word vector, and which other words are around the word vector? You just tell it that you don't tell it anything else. You just say, which other words are around the word vector? And the correct answers in this case would be to, learn, word, and representations. So 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 so on. So this here, each training sample is a classification task. And the classification task is, as you can see, no, you can't see right here, but the classification task is you have the input word, and you classify it into one of many, many, many, many, many, many classes. Namely, there are as many classes as you have words in the dictionary. So each word in the dictionary will have a class associated with it. So in ImageNet, you have like 1,000 classes, but in these, that's already a lot. But in these tasks, you're going to have 100,000 classes, because there are 100,000 words in the English language that you want to treat. 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 classification task. But ultimately, if you do something like this, then the origin, so the representation that you end up with is going to be very, very good at doing these kind of downstream tasks. And that's what they discovered. So their skip gram model is nothing else than taking a word and predicting the surrounding words from that word. And this is what it means. This is the formal statement of the skip gram objective. What you want to do is the objective of the skip gram model is to maximize the average log probability this one. So for the word we're considering, the word T, we want to maximize the log probability of each word w that is in around the word c, sorry, around the word w in a context window of c. That's exactly what we did before. Take a word like this model right here. And from it, we predict all of the words around it in a given window. That's all. That's the entire objective. And that will give you very good representations. And this is how you would implement that. So what you'll have is you'll have these vector representation v that comes from your original dictionary. Those are the things you learn. And then because you have like a 30,000 way classifier, you know that a classification layer is nothing else than a linear layer followed by a softmax operation. And that linear layer also has parameters. These are the v primes. So first you have the look up in the dictionary for the word vector right here. And this is the vector of the classification layer. Now there are modifications where you can use like the same vectors and so on. Or you can also make use of these vectors. But ultimately, you care about these vectors right here. And the vectors here are simply the classification layers weights. So here you can see that there is what you're trying to maximize is the inner product between the word that you're considering and the words around that word. And you're trying to do a classification task. So you need to normalize. Now this is the normalization constant, and it goes over all of your vocabulary. So that's what they tackle here. They say w is the number of words in the vocabulary. This formulation is impractical because the cost of computing the gradient is proportional to w, which is often large. And that's 10 to the five to 10 to the seven terms. So many like tens of millions of terms in your vocabulary. That's just not feasible. So people have been sort of trying different ways to get around very, very large number of classes. And here it seems that that is really our bottleneck. In the previous paper, they've already shown that this objective can give you very good word representation. But now we need to get around the fact that we have such large vocabularies. So the first idea here is hierarchical softmax. And this is kind of a tangent. I find this paper, by the way, it's sort of hard to read because it's like a half engineering paper. But yeah, so first they 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 1000 classes, instead of classifying 1000 ways, we first classify in two ways. And then we classify in two ways again, from each one, and then we classify in two ways again, as you know, 1000 is like two to the 10. So we need approximately 10 layers of this before we are actually arriving at 1000 classes. But it also means that we only have two way classifications each time. So in the hierarchical softmax, we build trees like this, and then we so we have a word, we look up its vector, sorry, its vector, and then we classify it for each of these nodes. So your output isn't going to be 1000, 1000 log probabilities, your output is going to be a log probability, a binary log probability for each of the nodes right here. So you want to know, okay, here, is it in the upper half or the lower half of my classes? Okay, cool. It's in the upper half. Okay, here is in the upper half or the lower half and so on. And you learn all to predict all of these junctions right here. And that's going to end up you with you having to predict less. Now, of course, you are constrained, you impose a very big prior on the class distribution, classes aren't independently anymore. Namely, if two classes here are in the same subtree, that means that they are going to be predicted, their predictions are going to be correlated because the path to them is the same partially. So how you arrange the classes here is very important. And there has been a lot of work in this. But as I said, this is rather a distraction right here. Hierarchical softmax is a way to solve this. However, they went with a different way right here. They went with this approach called negative sampling. Negative sampling has been, it's been very influential. Not only in word2vec, but negative sampling is one of the cornerstones of the current trend in self supervised learning and contrastive estimation and so on. So this all of this, you know, it pops up in unlikely ways in other fields. And it sort of, I'm not going to say it originated here, but definitely it was introduced into the popular deep learning world right here. So they say an alternative to hierarchical softmax is noise contrastive estimation. Okay, so in noise contrastive estimation posits that a good model should be able to differentiate data from noise by means of logistic regression. You know, that seems very reasonable. This is similar to the hinge loss and so on, yada yada yada. While NCE can be shown to approximately maximize the log probability of the softmax, the skip grab model is only concerned with learning high quality vector representations. So we are free to simplify noise contrastive estimation as long as the vector representations retain their quality. We define negative sampling by this following objective. So this is very interesting. They see, okay, noise contrastive estimation, you know, it approximately maximizes the log probability. So the noise contrastive estimation would actually be the correct way to approximate their problem. However, they say, well, as long as, you know, as long as something reasonable comes out, we're free to change that up a bit. So they go with this negative sampling approach right here. And you can see that this is almost the same. So it's written a bit differently from the original softmax thing because the original softmax thing was written as a fraction and here it's as a sum. But what you're trying to do in the negative sampling framework is you're 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 now minimize the inner product between those words and your word. Okay. So what does that ultimately lead to? It ultimately leads to the following. You have a word like this word here, negative. And what you're trying to do is you're not trying that much to predict the word sampling. What you're trying to do is you're trying to say that in my space right here, I simply want sampling to be closer than any other words that's not in the context window. Okay. So here is my word negative and here is my word sampling. And I want these two to be close. And if I sample another word, like here, this is the word cake. If I, 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 10,000 or a million way classification, I now maybe have, I have a K plus one way classification, right? Pretty easy, right? I simply sample K other words. And I assume because I have so many words, chances that I actually sample one that's in my context window is very small, right? So I simply sample other words and I say, well, these other words are random. They have nothing to do with the current frame that I'm looking at. So they should be, you know, they can be whatever they want, but at least they should be farther away than the words that are actually in my con 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, um, 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, um, self supervised learning where you want to have the same image augmented twice, go through the pipeline, you know, you augment, you 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 dataset. And that, you know, works, of course that works much, much, much faster. And you can see that this, um, this, uh, turns out to give you vectors that are pretty good and you can train with higher vectors, sorry, with higher dimensional vectors, you can train with bigger vocabularies with this. This has turned out to be very, very influential. As I said, uh, now with the rise of BERT and so on, work to back is kind of getting forgotten, but, um, 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 dist, dist, they would sort of chunk up their sentences into N-grams into overlapping N-grams and then have a big giant, uh, table for their, where they index their N-grams. So the word, I don't know, so the word, um, hello is ID one. The word hello there is ID two and so on. So you have a big table for all the N-grams. And then what we would try to do is you would try to do this kind of bag of words estimation where you would take a, you know, whatever N-grams appeared in your sentence and you would have this big 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. Um, yeah. So there are a number of tricks right here that are, I think, not understood until this day. For example, the question is how do you sample these negative samples? Right here, this basically says get K words from your vocabulary at random according to this distribution right here. Now how are you going to do that? Basically you have a spectrum of options. The one side of the spectrum is going to be completely uniform. Okay. We sample each word with the same probability. And the other side of the spectrum is something like sample this according to their uni-gram. These are two different things. They're opposites in this, in this fashion. So here you say, Hey, um, some words appear way, way, way more often than other words. Shouldn't we prefer them when we sample? Right? So if we have a corpus, um, 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, um, both NCE and negative sampling have noise distribution as a free parameter. We investigated a number of choices and found that the uni-gram distribution raised to the three quarter power, i.e. uni-gram to the three quarter, outperformed significantly the uni-gram and uniform distributions. For both NCE and negative on every task we tried including language modeling. This I think is a mystery until today. And it actually turned out that this exponent right here is magically much better than like the exponent of one or even the exponent of one half. Like you might be reasonably assumed that the square root, you know, might be something, but the three quarters I think turned out to be very good and very mystical. So what does it mean? It means that you have kind of a balance between words that appear often and words that don't appear often. Usually in these kind of things, you have a power law where you have very few words that appear very often. And then you have, okay, that's the tail shouldn't go up, but you have a very long tail of words. And what you want to do is in this case, you want to sample these words here more, but they appear so much more often than if you simply sample according to their uni-gram 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 skipgram model benefits from observing the co-occurrences of France and Paris, it benefits much less from observing the frequent co-occurrences of France and the as nearly every word co-occurring frequently with in a sentence with the. So they do another trick here to counter this imbalance between rare and frequent words use a simple sub sampling approach, each word in the training set is discarded with probability computed by that formula. Right, so therefore formula right here and you might be asking again why why this formula? So this is the sampling probability of a word and it goes with one over T. T is a temperature parameter and F is the frequency with which the word appears in the corpus. So as you can see, as the word appears more in the in the corpus, then so this is the frequency as the word appears more than this thing goes down than this thing goes up. So it's discarded with this probability. So it's discarded with a higher probability if it appears more often. Where F is frequency of a word, T is a chosen threshold. We chose this sub sampling formula because it aggressively sub samples words whose 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 more understandable than the three quarters, but still it's sort of arbitrary. They 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 contrastive estimation. And in the previous paper, they also compared with other baselines and saw that it also outperforms those while being quite time efficient. So you can see that especially with the sub sampling approaches, the time here is 36 minutes for and I think they have like a huge corpus that they train on these were to back code turned out to be really, really efficient code. And that's why it got so popular as well. They did the same thing for phrases right here. So for phrases like New York Times and so on, but this was kind of more of a this was more of a side thing. The phrase vectors turned out to be, you know, rather a side thing from the actual code right here. So yeah, as 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 this it is a very cool paper, very cool series of papers. And it's very cool that actually, they released the code, and they made the code such that it is super duper efficient, even like on a single machine. And that was very cool, because you know, being Google, they could have just released code that is very efficient on a distributed data center. And they didn't do that. So that this is, it's sort of not really like today anymore. Like today, when they release code, it's always you need you need like 50 cloud TPUs to do it. And it's still cool that they release code. But this was this was really a step into kind of democratizing AI. And yeah, so that was my rant about Word2vec. I hope you enjoyed this. I hope this still was useful to you, even though most of you probably already knew Word2vec. And yeah, so I'll see you next time. Bye bye.
[ { "start": 0, "end": 5.5200000000000005, "text": " Hi there, today we'll look at distributed representations of words and phrases and their" }, { "start": 5.5200000000000005, "end": 12.56, "text": " compositionality by Thomas Mikolov, Ilya Sotskyver, Kai Chen, Greg Corrado and Jeffrey Dean." }, { "start": 12.56, "end": 17.580000000000002, "text": " This is another historical paper, it's one of three papers, it's the middle one that" }, { "start": 17.580000000000002, "end": 21.16, "text": " introduces the original Word2vec algorithm." }, { "start": 21.16, "end": 29.240000000000002, "text": " And as you might know, Word2vec was extremely influential in NLP since this paper basically" }, { "start": 29.24, "end": 34.6, "text": " until recently, where it's sort of gone out of fashion a bit in research with the rise" }, { "start": 34.6, "end": 40.12, "text": " of things like ELMo and BERT, but it's still very, very relevant." }, { "start": 40.12, "end": 45.12, "text": " So we'll look at this historical paper today with kind of the hindsight of being a couple" }, { "start": 45.12, "end": 46.12, "text": " years into the future." }, { "start": 46.12, "end": 53.92, "text": " In fact, as you see right here, this was released in 2013, so it's seven years later now." }, { "start": 53.92, "end": 58.86, "text": " And we'll look back and we'll see what they said back then about the system." }, { "start": 58.86, "end": 66.6, "text": " This is not going to be like a very well-enhanced PowerPoint presentation of how Word2vec works." }, { "start": 66.6, "end": 70.96, "text": " We're going to look at the paper and read it together." }, { "start": 70.96, "end": 75.56, "text": " If you like content like this, if you like historical paper readings, let me know in" }, { "start": 75.56, "end": 81.34, "text": " the comments, share it out if you do like it and of course subscribe." }, { "start": 81.34, "end": 86.74, "text": " Because this kind of historical papers, I enjoy them, but many people might already" }, { "start": 86.74, "end": 89, "text": " know what these things are." }, { "start": 89, "end": 90.83999999999999, "text": " So, yeah." }, { "start": 90.83999999999999, "end": 91.83999999999999, "text": " Okay." }, { "start": 91.83999999999999, "end": 97.56, "text": " Let's, you know, go through the paper and pick up their ideas and kind of put them in" }, { "start": 97.56, "end": 98.94, "text": " context." }, { "start": 98.94, "end": 103.06, "text": " They say the recently introduced continuous skip gram model is an efficient method for" }, { "start": 103.06, "end": 109.28, "text": " learning high quality distributed vector representations that capture a large number of precise syntactic" }, { "start": 109.28, "end": 111.44, "text": " and semantic word relationships." }, { "start": 111.44, "end": 116.24, "text": " So the skip gram model was already introduced by Mikhailov in an earlier paper that came" }, { "start": 116.24, "end": 121.08, "text": " out, I believe not like one or two months prior to this one." }, { "start": 121.08, "end": 123.75999999999999, "text": " As I said, Word2vec is a series of papers." }, { "start": 123.75999999999999, "end": 126.67999999999999, "text": " I don't think there is a paper called Word2vec." }, { "start": 126.67999999999999, "end": 132, "text": " Rather, they here have released the code along with the paper." }, { "start": 132, "end": 135.28, "text": " The code was called Word2vec." }, { "start": 135.28, "end": 140.42, "text": " So the skip gram model was introduced previously, but it is replicated right here." }, { "start": 140.42, "end": 146.23999999999998, "text": " So in the skip gram model, what you're trying to do is you're trying to get a distributed" }, { "start": 146.23999999999998, "end": 148.28, "text": " word representation." }, { "start": 148.28, "end": 149.27999999999997, "text": " So what does that mean?" }, { "start": 149.27999999999997, "end": 154.07999999999998, "text": " That means that for each word in your language, let's take these words right here." }, { "start": 154.07999999999998, "end": 158.51999999999998, "text": " For each word in the language, you want to come up with a vector that somehow describes" }, { "start": 158.51999999999998, "end": 161.07999999999998, "text": " that word in a continuous fashion." }, { "start": 161.08, "end": 170.60000000000002, "text": " So with the two might be mapped to, I don't know, 0.1, 0.9, and 0.3." }, { "start": 170.60000000000002, "end": 174.48000000000002, "text": " Learn might be mapped to negative 0.5 and so on." }, { "start": 174.48000000000002, "end": 179.72000000000003, "text": " So each word gets assigned a vector in the same dimensional space." }, { "start": 179.72000000000003, "end": 184.98000000000002, "text": " And what the previous paper kind of discovered is that if you do this correctly, then these" }, { "start": 184.98000000000002, "end": 187.64000000000001, "text": " vectors, they have some kind of properties." }, { "start": 187.64, "end": 194.04, "text": " So we can already kind of jump ahead because this was already a bit, a bit researched in" }, { "start": 194.04, "end": 195.92, "text": " the last paper." }, { "start": 195.92, "end": 199.55999999999997, "text": " The semantics of these vectors will be something like this." }, { "start": 199.55999999999997, "end": 202.76, "text": " So here they have a two dimensional PCA." }, { "start": 202.76, "end": 208.14, "text": " So these are the first two dimensions of the 1000 dimensional skip gram vector." }, { "start": 208.14, "end": 213.79999999999998, "text": " So the vectors they obtain, they can do things like this, where they can show that in these" }, { "start": 213.8, "end": 221, "text": " spaces, for example, there appears to be a vector direction that characterizes the capital" }, { "start": 221, "end": 222.72, "text": " of a country." }, { "start": 222.72, "end": 229.12, "text": " So if you take a few countries and their capitals and you average that vector, you get a kind" }, { "start": 229.12, "end": 233.52, "text": " of a direction for capitalness of a city." }, { "start": 233.52, "end": 237.76000000000002, "text": " Given a country, you can see that there is a pretty clear relation here." }, { "start": 237.76, "end": 245.92, "text": " Now, some of these things have later been revised to such that they are ultimately ended" }, { "start": 245.92, "end": 247.56, "text": " up being not that impressive." }, { "start": 247.56, "end": 252.78, "text": " For example, there was always this kind of math with vectors." }, { "start": 252.78, "end": 256.2, "text": " And I don't, I believe this is, this might not be in this." }, { "start": 256.2, "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.32, "text": " subtract the vector for man and you add the vector for woman, then that would result in" }, { "start": 272.32, "end": 274.96, "text": " the vector for queen." }, { "start": 274.96, "end": 281.56, "text": " So the way they did it was basically they did this calculation right here and then they" }, { "start": 281.56, "end": 285.35999999999996, "text": " searched in the point they ended up, they searched for the nearest neighbor in their" }, { "start": 285.35999999999996, "end": 287.38, "text": " vocabulary." }, { "start": 287.38, "end": 288.79999999999995, "text": " And that turned out to be queen." }, { "start": 288.8, "end": 295.36, "text": " But in order to make it queen, actually, you have to exclude the original word king." }, { "start": 295.36, "end": 301.6, "text": " People quickly discovered that if you don't exclude the original word, the result of this" }, { "start": 301.6, "end": 305.82, "text": " kind of arithmetic will almost always lead back to the original word." }, { "start": 305.82, "end": 311.94, "text": " And then a lot of these analogy tasks are simply the result of you then discarding that" }, { "start": 311.94, "end": 313.72, "text": " word during the nearest neighbor search." }, { "start": 313.72, "end": 317.90000000000003, "text": " And then queen just happens to be one of the closest words." }, { "start": 317.9, "end": 323.78, "text": " And it's sort of much less dependent on which exact calculation you do here." }, { "start": 323.78, "end": 329.2, "text": " So there's been a lot of follow up work kind of analyzing, criticizing these vector maths." }, { "start": 329.2, "end": 334.85999999999996, "text": " But definitely we know that these word vectors turned out to be extremely, extremely helpful" }, { "start": 334.85999999999996, "end": 341.08, "text": " and syntactically and semantically relevant in downstream tasks because they have performed" }, { "start": 341.08, "end": 343.12, "text": " very, very well." }, { "start": 343.12, "end": 346.17999999999995, "text": " So how does the skip gram model work?" }, { "start": 346.18, "end": 352.84000000000003, "text": " How does it assign vectors to each word?" }, { "start": 352.84000000000003, "end": 357.04, "text": " So first of all, it has a dictionary." }, { "start": 357.04, "end": 360.38, "text": " So there is a word, an input word." }, { "start": 360.38, "end": 363.44, "text": " And for each word, you have a big dictionary." }, { "start": 363.44, "end": 369.68, "text": " And the big dictionary basically says that the word two is going to be mapped to this" }, { "start": 369.68, "end": 372.54, "text": " vector point one, da, da, da, da, da, da, and so on." }, { "start": 372.54, "end": 377.8, "text": " The word learn is going to be mapped to that vector." }, { "start": 377.8, "end": 383.62, "text": " And then you also have these output vectors right here." }, { "start": 383.62, "end": 390.56, "text": " And what you're trying to do is you're trying to take a phrase from the data set like this" }, { "start": 390.56, "end": 392.48, "text": " one right here." }, { "start": 392.48, "end": 398.46000000000004, "text": " And you take out one word like this word vector right here." }, { "start": 398.46, "end": 405.08, "text": " And you're trying to frame this as a prediction task." }, { "start": 405.08, "end": 410.68, "text": " So you're trying to frame this as, in this case, four different prediction tasks." }, { "start": 410.68, "end": 417.4, "text": " So you're telling your machine, I give you the word vector, and which other words are" }, { "start": 417.4, "end": 419.84, "text": " around the word vector?" }, { "start": 419.84, "end": 421.96, "text": " You just tell it that you don't tell it anything else." }, { "start": 421.96, "end": 426.03999999999996, "text": " You just say, which other words are around the word vector?" }, { "start": 426.04, "end": 433.04, "text": " And the correct answers in this case would be to, learn, word, and representations." }, { "start": 433.04, "end": 439.92, "text": " So you construct four different training examples where you have an X and a Y." }, { "start": 439.92, "end": 445.36, "text": " So the X is always vector, and the Y is two." }, { "start": 445.36, "end": 453.92, "text": " And then the next training sample, the X is vector, and the Y is learn, and so on." }, { "start": 453.92, "end": 459.24, "text": " So this here, each training sample is a classification task." }, { "start": 459.24, "end": 466.8, "text": " And the classification task is, as you can see, no, you can't see right here, but the" }, { "start": 466.8, "end": 474.44, "text": " classification task is you have the input word, and you classify it into one of many," }, { "start": 474.44, "end": 477.48, "text": " many, many, many, many, many classes." }, { "start": 477.48, "end": 482.64, "text": " Namely, there are as many classes as you have words in the dictionary." }, { "start": 482.64, "end": 488.76, "text": " So each word in the dictionary will have a class associated with it." }, { "start": 488.76, "end": 493.36, "text": " So in ImageNet, you have like 1,000 classes, but in these, that's already a lot." }, { "start": 493.36, "end": 499.59999999999997, "text": " But in these tasks, you're going to have 100,000 classes, because there are 100,000 words in" }, { "start": 499.59999999999997, "end": 502.47999999999996, "text": " the English language that you want to treat." }, { "start": 502.47999999999996, "end": 507.28, "text": " There are many more, but in this case, they leave away all the words that appear less" }, { "start": 507.28, "end": 509.08, "text": " than five times in their corpus." }, { "start": 509.08, "end": 510.84, "text": " That's still a lot of words." }, { "start": 510.84, "end": 515.6999999999999, "text": " So it's like a super duper duper lot of classification task." }, { "start": 515.6999999999999, "end": 522.22, "text": " But ultimately, if you do something like this, then the origin, so the representation that" }, { "start": 522.22, "end": 527.56, "text": " you end up with is going to be very, very good at doing these kind of downstream tasks." }, { "start": 527.56, "end": 529.88, "text": " And that's what they discovered." }, { "start": 529.88, "end": 536.68, "text": " So their skip gram model is nothing else than taking a word and predicting the surrounding" }, { "start": 536.68, "end": 540.4, "text": " words from that word." }, { "start": 540.4, "end": 542.48, "text": " And this is what it means." }, { "start": 542.48, "end": 545.76, "text": " This is the formal statement of the skip gram objective." }, { "start": 545.76, "end": 552.28, "text": " What you want to do is the objective of the skip gram model is to maximize the average" }, { "start": 552.28, "end": 554.68, "text": " log probability this one." }, { "start": 554.68, "end": 561.6, "text": " So for the word we're considering, the word T, we want to maximize the log probability" }, { "start": 561.6, "end": 571.4, "text": " of each word w that is in around the word c, sorry, around the word w in a context window" }, { "start": 571.4, "end": 572.4, "text": " of c." }, { "start": 572.4, "end": 573.72, "text": " That's exactly what we did before." }, { "start": 573.72, "end": 576.6, "text": " Take a word like this model right here." }, { "start": 576.6, "end": 585, "text": " And from it, we predict all of the words around it in a given window." }, { "start": 585, "end": 586, "text": " That's all." }, { "start": 586, "end": 587.5, "text": " That's the entire objective." }, { "start": 587.5, "end": 592.76, "text": " And that will give you very good representations." }, { "start": 592.76, "end": 594.96, "text": " And this is how you would implement that." }, { "start": 594.96, "end": 602.68, "text": " So what you'll have is you'll have these vector representation v that comes from your original" }, { "start": 602.68, "end": 603.68, "text": " dictionary." }, { "start": 603.68, "end": 605.32, "text": " Those are the things you learn." }, { "start": 605.32, "end": 610.7, "text": " And then because you have like a 30,000 way classifier, you know that a classification" }, { "start": 610.7, "end": 616.08, "text": " layer is nothing else than a linear layer followed by a softmax operation." }, { "start": 616.08, "end": 618.58, "text": " And that linear layer also has parameters." }, { "start": 618.58, "end": 620.4000000000001, "text": " These are the v primes." }, { "start": 620.4000000000001, "end": 627.48, "text": " So first you have the look up in the dictionary for the word vector right here." }, { "start": 627.48, "end": 630.74, "text": " And this is the vector of the classification layer." }, { "start": 630.74, "end": 634.36, "text": " Now there are modifications where you can use like the same vectors and so on." }, { "start": 634.36, "end": 636.94, "text": " Or you can also make use of these vectors." }, { "start": 636.94, "end": 641.88, "text": " But ultimately, you care about these vectors right here." }, { "start": 641.88, "end": 646.52, "text": " And the vectors here are simply the classification layers weights." }, { "start": 646.52, "end": 654.46, "text": " So here you can see that there is what you're trying to maximize is the inner product between" }, { "start": 654.46, "end": 662.28, "text": " the word that you're considering and the words around that word." }, { "start": 662.28, "end": 665.94, "text": " And you're trying to do a classification task." }, { "start": 665.94, "end": 667.58, "text": " So you need to normalize." }, { "start": 667.58, "end": 674.8000000000001, "text": " Now this is the normalization constant, and it goes over all of your vocabulary." }, { "start": 674.8000000000001, "end": 677.48, "text": " So that's what they tackle here." }, { "start": 677.48, "end": 682.6, "text": " They say w is the number of words in the vocabulary." }, { "start": 682.6, "end": 688.0600000000001, "text": " This formulation is impractical because the cost of computing the gradient is proportional" }, { "start": 688.0600000000001, "end": 691.2, "text": " to w, which is often large." }, { "start": 691.2, "end": 694, "text": " And that's 10 to the five to 10 to the seven terms." }, { "start": 694, "end": 699.6, "text": " So many like tens of millions of terms in your vocabulary." }, { "start": 699.6, "end": 701.52, "text": " That's just not feasible." }, { "start": 701.52, "end": 707.44, "text": " So people have been sort of trying different ways to get around very, very large number" }, { "start": 707.44, "end": 708.92, "text": " of classes." }, { "start": 708.92, "end": 711.88, "text": " And here it seems that that is really our bottleneck." }, { "start": 711.88, "end": 716.08, "text": " In the previous paper, they've already shown that this objective can give you very good" }, { "start": 716.08, "end": 717.9, "text": " word representation." }, { "start": 717.9, "end": 722.32, "text": " But now we need to get around the fact that we have such large vocabularies." }, { "start": 722.32, "end": 724.88, "text": " So the first idea here is hierarchical softmax." }, { "start": 724.88, "end": 726.36, "text": " And this is kind of a tangent." }, { "start": 726.36, "end": 732.2, "text": " I find this paper, by the way, it's sort of hard to read because it's like a half engineering" }, { "start": 732.2, "end": 733.88, "text": " paper." }, { "start": 733.88, "end": 740.4000000000001, "text": " But yeah, so first they introduce this hierarchical softmax, which is kind of a distraction." }, { "start": 740.4000000000001, "end": 743.0400000000001, "text": " It's kind of a here is what we do." }, { "start": 743.0400000000001, "end": 746.9200000000001, "text": " Here is what we considered first, but then didn't end up using really." }, { "start": 746.92, "end": 753, "text": " They do compare with it, but the flow of text is sort of that you expect this to be part" }, { "start": 753, "end": 755.12, "text": " of the final model, which it isn't." }, { "start": 755.12, "end": 760.4799999999999, "text": " So in the hierarchical softmax, what you do instead of having this giant multi class classification" }, { "start": 760.4799999999999, "end": 767.4799999999999, "text": " task right here, you take all of these classes right here, and you put them in a sort of" }, { "start": 767.4799999999999, "end": 768.4799999999999, "text": " a tree." }, { "start": 768.4799999999999, "end": 773.24, "text": " Okay, so you take this and you put them into a tree." }, { "start": 773.24, "end": 777.8, "text": " So instead of classifying, you know, let's say we have 1000 classes, instead of classifying" }, { "start": 777.8, "end": 782, "text": " 1000 ways, we first classify in two ways." }, { "start": 782, "end": 787.64, "text": " And then we classify in two ways again, from each one, and then we classify in two ways" }, { "start": 787.64, "end": 791.1, "text": " again, as you know, 1000 is like two to the 10." }, { "start": 791.1, "end": 800.16, "text": " So we need approximately 10 layers of this before we are actually arriving at 1000 classes." }, { "start": 800.16, "end": 805.88, "text": " But it also means that we only have two way classifications each time." }, { "start": 805.88, "end": 812.5, "text": " So in the hierarchical softmax, we build trees like this, and then we so we have a word," }, { "start": 812.5, "end": 818.4399999999999, "text": " we look up its vector, sorry, its vector, and then we classify it for each of these" }, { "start": 818.4399999999999, "end": 819.4399999999999, "text": " nodes." }, { "start": 819.4399999999999, "end": 826.64, "text": " So your output isn't going to be 1000, 1000 log probabilities, your output is going to" }, { "start": 826.64, "end": 832.96, "text": " be a log probability, a binary log probability for each of the nodes right here." }, { "start": 832.96, "end": 838.96, "text": " So you want to know, okay, here, is it in the upper half or the lower half of my classes?" }, { "start": 838.96, "end": 839.96, "text": " Okay, cool." }, { "start": 839.96, "end": 840.96, "text": " It's in the upper half." }, { "start": 840.96, "end": 844, "text": " Okay, here is in the upper half or the lower half and so on." }, { "start": 844, "end": 848.16, "text": " And you learn all to predict all of these junctions right here." }, { "start": 848.16, "end": 851.4, "text": " And that's going to end up you with you having to predict less." }, { "start": 851.4, "end": 859.0799999999999, "text": " Now, of course, you are constrained, you impose a very big prior on the class distribution," }, { "start": 859.0799999999999, "end": 860.68, "text": " classes aren't independently anymore." }, { "start": 860.68, "end": 866, "text": " Namely, if two classes here are in the same subtree, that means that they are going to" }, { "start": 866, "end": 873.88, "text": " be predicted, their predictions are going to be correlated because the path to them" }, { "start": 873.88, "end": 875.8, "text": " is the same partially." }, { "start": 875.8, "end": 880.68, "text": " So how you arrange the classes here is very important." }, { "start": 880.68, "end": 882.9599999999999, "text": " And there has been a lot of work in this." }, { "start": 882.9599999999999, "end": 888.52, "text": " But as I said, this is rather a distraction right here." }, { "start": 888.52, "end": 891.16, "text": " Hierarchical softmax is a way to solve this." }, { "start": 891.16, "end": 895.92, "text": " However, they went with a different way right here." }, { "start": 895.92, "end": 899.12, "text": " They went with this approach called negative sampling." }, { "start": 899.12, "end": 904.5999999999999, "text": " Negative sampling has been, it's been very influential." }, { "start": 904.5999999999999, "end": 910.56, "text": " Not only in word2vec, but negative sampling is one of the cornerstones of the current" }, { "start": 910.56, "end": 915.8, "text": " trend in self supervised learning and contrastive estimation and so on." }, { "start": 915.8, "end": 922.4399999999999, "text": " So this all of this, you know, it pops up in unlikely ways in other fields." }, { "start": 922.4399999999999, "end": 929.9, "text": " And it sort of, I'm not going to say it originated here, but definitely it was introduced into" }, { "start": 929.9, "end": 933.28, "text": " the popular deep learning world right here." }, { "start": 933.28, "end": 939.1199999999999, "text": " So they say an alternative to hierarchical softmax is noise contrastive estimation." }, { "start": 939.12, "end": 946.04, "text": " Okay, so in noise contrastive estimation posits that a good model should be able to differentiate" }, { "start": 946.04, "end": 949.2, "text": " data from noise by means of logistic regression." }, { "start": 949.2, "end": 951.72, "text": " You know, that seems very reasonable." }, { "start": 951.72, "end": 956.16, "text": " This is similar to the hinge loss and so on, yada yada yada." }, { "start": 956.16, "end": 961.32, "text": " While NCE can be shown to approximately maximize the log probability of the softmax, the skip" }, { "start": 961.32, "end": 965.66, "text": " grab model is only concerned with learning high quality vector representations." }, { "start": 965.66, "end": 971.1999999999999, "text": " So we are free to simplify noise contrastive estimation as long as the vector representations" }, { "start": 971.1999999999999, "end": 973.24, "text": " retain their quality." }, { "start": 973.24, "end": 976.4, "text": " We define negative sampling by this following objective." }, { "start": 976.4, "end": 977.88, "text": " So this is very interesting." }, { "start": 977.88, "end": 983.64, "text": " They see, okay, noise contrastive estimation, you know, it approximately maximizes the log" }, { "start": 983.64, "end": 984.64, "text": " probability." }, { "start": 984.64, "end": 989.92, "text": " So the noise contrastive estimation would actually be the correct way to approximate" }, { "start": 989.92, "end": 990.92, "text": " their problem." }, { "start": 990.92, "end": 997, "text": " However, they say, well, as long as, you know, as long as something reasonable comes out," }, { "start": 997, "end": 998.92, "text": " we're free to change that up a bit." }, { "start": 998.92, "end": 1004.24, "text": " So they go with this negative sampling approach right here." }, { "start": 1004.24, "end": 1009.26, "text": " And you can see that this is almost the same." }, { "start": 1009.26, "end": 1015.16, "text": " So it's written a bit differently from the original softmax thing because the original" }, { "start": 1015.16, "end": 1018.64, "text": " softmax thing was written as a fraction and here it's as a sum." }, { "start": 1018.64, "end": 1025.52, "text": " But what you're trying to do in the negative sampling framework is you're trying to maximize" }, { "start": 1025.52, "end": 1026.66, "text": " the following." }, { "start": 1026.66, "end": 1032.04, "text": " You're trying to maximize the inner product of the word you're considering and the words" }, { "start": 1032.04, "end": 1033.2, "text": " around them." }, { "start": 1033.2, "end": 1034.2, "text": " Okay." }, { "start": 1034.2, "end": 1038.16, "text": " So you're trying to still predict the words around you." }, { "start": 1038.16, "end": 1045.12, "text": " But now instead of having this prediction softmax over all of the classes, you only" }, { "start": 1045.12, "end": 1049.56, "text": " have the softmax over a subset of classes." }, { "start": 1049.56, "end": 1057.28, "text": " So what you'll do is you sample words from your vocabulary at random and you sample k" }, { "start": 1057.28, "end": 1064.76, "text": " of them and you're simply trying to now minimize the inner product between those words and" }, { "start": 1064.76, "end": 1066.08, "text": " your word." }, { "start": 1066.08, "end": 1067.08, "text": " Okay." }, { "start": 1067.08, "end": 1070.2199999999998, "text": " So what does that ultimately lead to?" }, { "start": 1070.2199999999998, "end": 1073.3, "text": " It ultimately leads to the following." }, { "start": 1073.3, "end": 1077.8799999999999, "text": " You have a word like this word here, negative." }, { "start": 1077.8799999999999, "end": 1082.9199999999998, "text": " And what you're trying to do is you're not trying that much to predict the word sampling." }, { "start": 1082.9199999999998, "end": 1088.6599999999999, "text": " What you're trying to do is you're trying to say that in my space right here, I simply" }, { "start": 1088.6599999999999, "end": 1095.68, "text": " want sampling to be closer than any other words that's not in the context window." }, { "start": 1095.68, "end": 1096.68, "text": " Okay." }, { "start": 1096.68, "end": 1101.9199999999998, "text": " So here is my word negative and here is my word sampling." }, { "start": 1101.92, "end": 1104.6000000000001, "text": " And I want these two to be close." }, { "start": 1104.6000000000001, "end": 1109.76, "text": " And if I sample another word, like here, this is the word cake." }, { "start": 1109.76, "end": 1116.96, "text": " If I, sorry, if I sample that, I simply want that to be far away, farther than the word" }, { "start": 1116.96, "end": 1117.96, "text": " sampling." }, { "start": 1117.96, "end": 1118.96, "text": " Okay." }, { "start": 1118.96, "end": 1120.6200000000001, "text": " So this is now a comparative." }, { "start": 1120.6200000000001, "end": 1124.2, "text": " It's not I classify sampling as the highest class." }, { "start": 1124.2, "end": 1132.56, "text": " It's simply I want to classify the word sampling against the other classes higher." }, { "start": 1132.56, "end": 1133.56, "text": " All right." }, { "start": 1133.56, "end": 1136.68, "text": " So, and this is now much, much easier." }, { "start": 1136.68, "end": 1142.0800000000002, "text": " So instead of a thousand or 10,000 or a million way classification, I now maybe have, I have" }, { "start": 1142.0800000000002, "end": 1146, "text": " a K plus one way classification, right?" }, { "start": 1146, "end": 1147, "text": " Pretty easy, right?" }, { "start": 1147, "end": 1149.52, "text": " I simply sample K other words." }, { "start": 1149.52, "end": 1155.72, "text": " And I assume because I have so many words, chances that I actually sample one that's" }, { "start": 1155.72, "end": 1158.8, "text": " in my context window is very small, right?" }, { "start": 1158.8, "end": 1162.68, "text": " So I simply sample other words and I say, well, these other words are random." }, { "start": 1162.68, "end": 1166.8, "text": " They have nothing to do with the current frame that I'm looking at." }, { "start": 1166.8, "end": 1173.2, "text": " So they should be, you know, they can be whatever they want, but at least they should be farther" }, { "start": 1173.2, "end": 1180.0800000000002, "text": " away than the words that are actually in my con in my context." }, { "start": 1180.0800000000002, "end": 1185.8, "text": " And that is negative sampling, the process of sampling negatives, this right here, and" }, { "start": 1185.8, "end": 1191.96, "text": " then making sure that the positives, which are these here, um, in this case, the words" }, { "start": 1191.96, "end": 1198.8, "text": " in the context are classified with a higher probability than the negatives for a given" }, { "start": 1198.8, "end": 1200.04, "text": " input word, right?" }, { "start": 1200.04, "end": 1205.3999999999999, "text": " This here is the input word." }, { "start": 1205.3999999999999, "end": 1206.3999999999999, "text": " That's it." }, { "start": 1206.3999999999999, "end": 1207.3999999999999, "text": " That's negative sampling." }, { "start": 1207.3999999999999, "end": 1214.12, "text": " And of course, yeah, as I said, you recognize this from current things like, um, self supervised" }, { "start": 1214.12, "end": 1220.8799999999999, "text": " learning where you want to have the same image augmented twice, go through the pipeline," }, { "start": 1220.8799999999999, "end": 1224.72, "text": " you know, you augment, you put a little bit of different noise and then you have a different" }, { "start": 1224.72, "end": 1231, "text": " image and at the end you say these two should be close together while this other one should" }, { "start": 1231, "end": 1232.94, "text": " be far apart." }, { "start": 1232.94, "end": 1238.52, "text": " It's the exact same thing here, except that you have a different way of obtaining the" }, { "start": 1238.52, "end": 1241.26, "text": " positive and the negative samples." }, { "start": 1241.26, "end": 1245.66, "text": " In this case, positive samples are everything that's in the context." }, { "start": 1245.66, "end": 1252.14, "text": " Negative samples are just randomly sampled from the dataset." }, { "start": 1252.14, "end": 1256.5200000000002, "text": " And that, you know, works, of course that works much, much, much faster." }, { "start": 1256.5200000000002, "end": 1263.8400000000001, "text": " And you can see that this, um, this, uh, turns out to give you vectors that are pretty good" }, { "start": 1263.8400000000001, "end": 1268.44, "text": " and you can train with higher vectors, sorry, with higher dimensional vectors, you can train" }, { "start": 1268.44, "end": 1270.6000000000001, "text": " with bigger vocabularies with this." }, { "start": 1270.6000000000001, "end": 1274.0600000000002, "text": " This has turned out to be very, very influential." }, { "start": 1274.0600000000002, "end": 1280.2800000000002, "text": " As I said, uh, now with the rise of BERT and so on, work to back is kind of getting forgotten," }, { "start": 1280.28, "end": 1285.84, "text": " but, um, this was a revolution and distributed vectors." }, { "start": 1285.84, "end": 1288.12, "text": " So it wasn't a thing really." }, { "start": 1288.12, "end": 1292.92, "text": " It kind of was a thing before that, but it wasn't really a thing that people used." }, { "start": 1292.92, "end": 1297.18, "text": " What people would do is still, they would do N-gram models before that." }, { "start": 1297.18, "end": 1302.6, "text": " So they would kind of dist, dist, they would sort of chunk up their sentences into N-grams" }, { "start": 1302.6, "end": 1308.68, "text": " into overlapping N-grams and then have a big giant, uh, table for their, where they index" }, { "start": 1308.68, "end": 1309.68, "text": " their N-grams." }, { "start": 1309.68, "end": 1316.2, "text": " So the word, I don't know, so the word, um, hello is ID one." }, { "start": 1316.2, "end": 1321.4, "text": " The word hello there is ID two and so on." }, { "start": 1321.4, "end": 1324.14, "text": " So you have a big table for all the N-grams." }, { "start": 1324.14, "end": 1328.5600000000002, "text": " And then what we would try to do is you would try to do this kind of bag of words estimation" }, { "start": 1328.5600000000002, "end": 1333.88, "text": " where you would take a, you know, whatever N-grams appeared in your sentence and you" }, { "start": 1333.88, "end": 1340.5200000000002, "text": " would have this big classification where you'd associate the N-grams with each other and" }, { "start": 1340.5200000000002, "end": 1341.5200000000002, "text": " so on." }, { "start": 1341.5200000000002, "end": 1346.2, "text": " So distributed word representations were kind of a revolution at that point, especially" }, { "start": 1346.2, "end": 1351.48, "text": " distributed representation that actually outperformed these old N-gram methods." }, { "start": 1351.48, "end": 1353.18, "text": " Um, yeah." }, { "start": 1353.18, "end": 1358.3200000000002, "text": " So there are a number of tricks right here that are, I think, not understood until this" }, { "start": 1358.3200000000002, "end": 1359.3200000000002, "text": " day." }, { "start": 1359.32, "end": 1364, "text": " For example, the question is how do you sample these negative samples?" }, { "start": 1364, "end": 1372.8799999999999, "text": " Right here, this basically says get K words from your vocabulary at random according to" }, { "start": 1372.8799999999999, "end": 1374.84, "text": " this distribution right here." }, { "start": 1374.84, "end": 1376.84, "text": " Now how are you going to do that?" }, { "start": 1376.84, "end": 1379.6, "text": " Basically you have a spectrum of options." }, { "start": 1379.6, "end": 1384.4399999999998, "text": " The one side of the spectrum is going to be completely uniform." }, { "start": 1384.4399999999998, "end": 1385.4399999999998, "text": " Okay." }, { "start": 1385.4399999999998, "end": 1388.76, "text": " We sample each word with the same probability." }, { "start": 1388.76, "end": 1396.64, "text": " And the other side of the spectrum is something like sample this according to their uni-gram." }, { "start": 1396.64, "end": 1398.96, "text": " These are two different things." }, { "start": 1398.96, "end": 1401.16, "text": " They're opposites in this, in this fashion." }, { "start": 1401.16, "end": 1409, "text": " So here you say, Hey, um, some words appear way, way, way more often than other words." }, { "start": 1409, "end": 1411.36, "text": " Shouldn't we prefer them when we sample?" }, { "start": 1411.36, "end": 1412.36, "text": " Right?" }, { "start": 1412.36, "end": 1419.1599999999999, "text": " So if we have a corpus, um, and shouldn't we sample from the corpus?" }, { "start": 1419.1599999999999, "end": 1423.76, "text": " And if in the corpus, one word appears 50 times more than the other word, then shouldn't" }, { "start": 1423.76, "end": 1428.6, "text": " we sample that 50 times more as a negative because it's, you know, so abundant and it" }, { "start": 1428.6, "end": 1431.6399999999999, "text": " should give a higher classification accuracy." }, { "start": 1431.6399999999999, "end": 1434.3799999999999, "text": " Whereas on the other hand, you could say, no, no, no, we should simply sample every" }, { "start": 1434.3799999999999, "end": 1437.08, "text": " word in our dictionary uniformly." }, { "start": 1437.08, "end": 1445.8799999999999, "text": " They came up with something in between, which they say, um, both NCE and negative sampling" }, { "start": 1445.8799999999999, "end": 1448.3799999999999, "text": " have noise distribution as a free parameter." }, { "start": 1448.3799999999999, "end": 1454.12, "text": " We investigated a number of choices and found that the uni-gram distribution raised to the" }, { "start": 1454.12, "end": 1461.1399999999999, "text": " three quarter power, i.e. uni-gram to the three quarter, outperformed significantly" }, { "start": 1461.1399999999999, "end": 1463.96, "text": " the uni-gram and uniform distributions." }, { "start": 1463.96, "end": 1469.32, "text": " For both NCE and negative on every task we tried including language modeling." }, { "start": 1469.32, "end": 1471.92, "text": " This I think is a mystery until today." }, { "start": 1471.92, "end": 1478.72, "text": " And it actually turned out that this exponent right here is magically much better than like" }, { "start": 1478.72, "end": 1481.4, "text": " the exponent of one or even the exponent of one half." }, { "start": 1481.4, "end": 1487.48, "text": " Like you might be reasonably assumed that the square root, you know, might be something," }, { "start": 1487.48, "end": 1492.64, "text": " but the three quarters I think turned out to be very good and very mystical." }, { "start": 1492.64, "end": 1494.68, "text": " So what does it mean?" }, { "start": 1494.68, "end": 1499.16, "text": " It means that you have kind of a balance between words that appear often and words that don't" }, { "start": 1499.16, "end": 1500.44, "text": " appear often." }, { "start": 1500.44, "end": 1504.8200000000002, "text": " Usually in these kind of things, you have a power law where you have very few words" }, { "start": 1504.8200000000002, "end": 1506.46, "text": " that appear very often." }, { "start": 1506.46, "end": 1512.16, "text": " And then you have, okay, that's the tail shouldn't go up, but you have a very long tail of words." }, { "start": 1512.16, "end": 1517.3600000000001, "text": " And what you want to do is in this case, you want to sample these words here more, but" }, { "start": 1517.3600000000001, "end": 1522.0800000000002, "text": " they appear so much more often than if you simply sample according to their uni-gram" }, { "start": 1522.08, "end": 1526.96, "text": " distribution, you'll basically not regard these words right here, you'll forget about" }, { "start": 1526.96, "end": 1532.08, "text": " them and your performance will suffer because they do appear every now and then." }, { "start": 1532.08, "end": 1537.96, "text": " So what you want to do is you want to push that those down a little bit and the optimal" }, { "start": 1537.96, "end": 1544.48, "text": " amount for the little bit turns out to be to raise it the you raise it to the three" }, { "start": 1544.48, "end": 1547.48, "text": " quarters." }, { "start": 1547.48, "end": 1551.9199999999998, "text": " Strange but you know, turned out to work well." }, { "start": 1551.92, "end": 1557.88, "text": " The other thing they do is they do the they do a sub sampling of frequent words." }, { "start": 1557.88, "end": 1564.16, "text": " So again, this is a way to kind of push down the often appearing words where they say the" }, { "start": 1564.16, "end": 1569.44, "text": " most frequent words can easily occur hundreds of millions of times like in the or a such" }, { "start": 1569.44, "end": 1573.74, "text": " words usually provide less information value than the rare words." }, { "start": 1573.74, "end": 1577.96, "text": " For example, while the skipgram model benefits from observing the co-occurrences of France" }, { "start": 1577.96, "end": 1582.72, "text": " and Paris, it benefits much less from observing the frequent co-occurrences of France and" }, { "start": 1582.72, "end": 1589.24, "text": " the as nearly every word co-occurring frequently with in a sentence with the." }, { "start": 1589.24, "end": 1595.68, "text": " So they do another trick here to counter this imbalance between rare and frequent words" }, { "start": 1595.68, "end": 1601.04, "text": " use a simple sub sampling approach, each word in the training set is discarded with probability" }, { "start": 1601.04, "end": 1603.44, "text": " computed by that formula." }, { "start": 1603.44, "end": 1610.92, "text": " Right, so therefore formula right here and you might be asking again why why this formula?" }, { "start": 1610.92, "end": 1618.96, "text": " So this is the sampling probability of a word and it goes with one over T. T is a temperature" }, { "start": 1618.96, "end": 1625.2, "text": " parameter and F is the frequency with which the word appears in the corpus." }, { "start": 1625.2, "end": 1632.76, "text": " So as you can see, as the word appears more in the in the corpus, then so this is the" }, { "start": 1632.76, "end": 1638.72, "text": " frequency as the word appears more than this thing goes down than this thing goes up." }, { "start": 1638.72, "end": 1642.48, "text": " So it's discarded with this probability." }, { "start": 1642.48, "end": 1648.92, "text": " So it's discarded with a higher probability if it appears more often." }, { "start": 1648.92, "end": 1653.46, "text": " Where F is frequency of a word, T is a chosen threshold." }, { "start": 1653.46, "end": 1658, "text": " We chose this sub sampling formula because it aggressively sub samples words whose frequency" }, { "start": 1658, "end": 1663.24, "text": " is greater than T while preserving the ranking of the frequencies." }, { "start": 1663.24, "end": 1667, "text": " Although this sub sampling formula was chosen heuristically, we found it to work well in" }, { "start": 1667, "end": 1668.08, "text": " practice." }, { "start": 1668.08, "end": 1673.12, "text": " It accelerates learning and even significantly improves the accuracy of the learned vectors" }, { "start": 1673.12, "end": 1676.8, "text": " of the rare words as will be shown in the following sections." }, { "start": 1676.8, "end": 1682.18, "text": " So again, something sort of arbitrary, it's more understandable than the three quarters," }, { "start": 1682.18, "end": 1684.08, "text": " but still it's sort of arbitrary." }, { "start": 1684.08, "end": 1689.28, "text": " They experimented around, they found this works well and then everybody ended up using" }, { "start": 1689.28, "end": 1690.28, "text": " that." }, { "start": 1690.28, "end": 1693.6799999999998, "text": " So that's how this kind of stuff happens." }, { "start": 1693.6799999999998, "end": 1698.36, "text": " Okay, so now we get into the empirical results." }, { "start": 1698.36, "end": 1704.04, "text": " And the empirical results in this case were already sort of given in the previous paper," }, { "start": 1704.04, "end": 1713.9199999999998, "text": " but here they have these the analogical reasoning task where you can see that the negative sampling" }, { "start": 1713.92, "end": 1718.68, "text": " did outperform the others by quite a bit right here." }, { "start": 1718.68, "end": 1724.48, "text": " So the negative sampling approaches outperformed the hierarchical softmax and the noise contrastive" }, { "start": 1724.48, "end": 1726.02, "text": " estimation." }, { "start": 1726.02, "end": 1730.44, "text": " And in the previous paper, they also compared with other baselines and saw that it also" }, { "start": 1730.44, "end": 1738.92, "text": " outperforms those while being quite time efficient." }, { "start": 1738.92, "end": 1747.3600000000001, "text": " So you can see that especially with the sub sampling approaches, the time here is 36 minutes" }, { "start": 1747.3600000000001, "end": 1754.0800000000002, "text": " for and I think they have like a huge corpus that they train on these were to back code" }, { "start": 1754.0800000000002, "end": 1757.3600000000001, "text": " turned out to be really, really efficient code." }, { "start": 1757.3600000000001, "end": 1760.3600000000001, "text": " And that's why it got so popular as well." }, { "start": 1760.3600000000001, "end": 1765.1200000000001, "text": " They did the same thing for phrases right here." }, { "start": 1765.12, "end": 1772.1799999999998, "text": " So for phrases like New York Times and so on, but this was kind of more of a this was" }, { "start": 1772.1799999999998, "end": 1775.52, "text": " more of a side thing." }, { "start": 1775.52, "end": 1782.6, "text": " The phrase vectors turned out to be, you know, rather a side thing from the actual code right" }, { "start": 1782.6, "end": 1785.36, "text": " here." }, { "start": 1785.36, "end": 1792.08, "text": " So yeah, as I said, this paper is very different from other research papers in that it's it's" }, { "start": 1792.08, "end": 1797.1999999999998, "text": " sort of half an engineering paper and all of these papers are they're kind of hard to" }, { "start": 1797.1999999999998, "end": 1805.1799999999998, "text": " read because they just kind of state some things in the order is kind of weird sometimes." }, { "start": 1805.1799999999998, "end": 1808.58, "text": " Why they do things is kind of weird sometimes." }, { "start": 1808.58, "end": 1815.04, "text": " But you can't you know, you can't deny that it had the quite the effect on the community." }, { "start": 1815.04, "end": 1820.8999999999999, "text": " And this it is a very cool paper, very cool series of papers." }, { "start": 1820.9, "end": 1826.48, "text": " And it's very cool that actually, they released the code, and they made the code such that" }, { "start": 1826.48, "end": 1831.3200000000002, "text": " it is super duper efficient, even like on a single machine." }, { "start": 1831.3200000000002, "end": 1836.3600000000001, "text": " And that was very cool, because you know, being Google, they could have just released" }, { "start": 1836.3600000000001, "end": 1842.88, "text": " code that is very efficient on a distributed data center." }, { "start": 1842.88, "end": 1844.8000000000002, "text": " And they didn't do that." }, { "start": 1844.8000000000002, "end": 1849.5600000000002, "text": " So that this is, it's sort of not really like today anymore." }, { "start": 1849.56, "end": 1856.44, "text": " Like today, when they release code, it's always you need you need like 50 cloud TPUs to do" }, { "start": 1856.44, "end": 1857.44, "text": " it." }, { "start": 1857.44, "end": 1858.84, "text": " And it's still cool that they release code." }, { "start": 1858.84, "end": 1866.44, "text": " But this was this was really a step into kind of democratizing AI." }, { "start": 1866.44, "end": 1870.6799999999998, "text": " And yeah, so that was my rant about Word2vec." }, { "start": 1870.6799999999998, "end": 1871.96, "text": " I hope you enjoyed this." }, { "start": 1871.96, "end": 1878.1599999999999, "text": " I hope this still was useful to you, even though most of you probably already knew Word2vec." }, { "start": 1878.16, "end": 1880.8000000000002, "text": " And yeah, so I'll see you next time." }, { "start": 1880.8, "end": 1908.8, "text": " Bye bye." } ]
GWt6Fu05voI
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Classic] Deep Residual Learning for Image Recognition (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "vision", "computer vision", "kaiming he", "google", "resnet", "resnet50", "resnet151", "deep neural network", "imagenet", "residual", "identity function", "very deep", "convolutional neural network", "bottleneck", "overfitting" ]
#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 Kai Ming He, Xiang Yu Cheng, Shao Qing Ren and Jian Sun. So this, you know it, this is an old paper. It is from 2015 but I thought we'd still look at it because this not only is it one of the most influential papers in modern deep learning, it is also a very well written paper and I remember it like it was yesterday when this came out. This was like a bomb. So around that time this this meme was going around. I was winning ImageNet but then someone made a deeper net. This was a this was a the time when after AlexNet people were trying to build bigger and bigger networks and every time someone managed to build a bigger network the accuracy on ImageNet data set would increase pretty much in lockstep with how much bigger the network was but people got to the limit of building big networks and then this paper drops and changed everything and now residual connections are everywhere not only in image recognition they are in transformers they are in whatever wherever you go you'll probably find some residual connections somewhere in there. So yeah let's let's look at this paper and let's revisit what kind of problems people had then and how they solved it. So here they go directly into into this problem of deep neural networks and the problem that people had was they knew that if you can increase the if you can increase the depth of a neural network you can make it perform better you can make it 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 is this learning rate drop people have all had already figured out that you need to drop drop the learning rate and it would reach a certain level and here this would be the test error over here. However if after a certain point if they increase the depth even more the training error would actually go up again and so 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 and draw more filters you would stack more and more filters while downscaling the resolution of the image the reasoning was that if you do image classification right then you know where on this where on this maybe you want to classify this into a Lego tower or whatever that is it's not that important where it is so on the lower levels you would want to parse out like very low layer features like edges and so on and these are still important where they are right the fact that here's an edge here's an edge here's an edge but then as you go higher up and go to more and more abstracted 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 but it's not that important where exactly they are and then the higher layers would learn to combine the individual parts to each other and again it becomes less and less important where these things are and more and more important that you build more expressive features so people would downscale the resolution upscale the number of filters now that's a good heuristic but this is based this was basically the architecture of these networks and we would question why would if we increase the number of layers so if we instead of one here we have two of these layers right we simply have two of these layers and here we have two of these layers why does it get worse especially this paper here makes an interesting observation so it is not caused caused by overfitting and adding more layers leads to a higher training error the degradation indicates that is not all systems are similarly easy to optimize let us consider a shallower architecture and its deeper counterparts that adds more layers onto it there exists a solution by construction to the deeper model the added layers are identity mapping and the other layers are copied from the learned shallower model so pretty easy if you have a shallow model like five layers that learns a particular function I can pretty easily prove that there is a deep model that learns the same function by simply copying over these five layers and having these here learn the identity function okay so if we are able to learn this we should be able to train this network to at least the same accuracy that's what this paper argues because it can you know these layers can simply learn the identity function so it must have something to do with the easiness of optimizing these deep architectures not with overfitting this is I think if you read the entire text here it's very very clear if you read it they lead you through this reasoning saying that look all these layers have to do is learn the identity function and then we could at least get the same accuracy so so what why don't they learn the identity function well because we initialize most weights you know towards zero we initialize them randomly but mostly we initialize them around zero our initialization procedure usually sample from some Gaussian with some kind of a standard deviation but around the mean of zero and also if we use things like weight decay L2 regularization all of these things they do they bias the weights towards zero so if there is any natural thing that these networks are good at is they learn the zero function really well learning the identity function is as difficult as learning any other function the identity function the convolutional filter is actually pretty difficult to learn because you know if I have a my if I have my three by three filter where is my no no this is my three by three filter the identity function is it like a one here and zeros everywhere else that's the that that would be one of the things it's not that easy you need to learn nine weights in the correct way so this paper says can we do something to make the default function of the network not be the zero function or whatever the randomly initialized function can we make the default function the one function can we make the default function the identity function and that brings you to residual connection so instead of learning to transform X via a neural network into X which is the identity function why don't we have X stay X and then learn whatever we need to change okay so if let's call that tilde if the assumption is that it's a good default to not change much so this is almost the same as this we might make this 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 desired property because what do we know about weight layers from before well they tend towards the zero function right if we use weight decay or generally how we initialize them they tend towards the zero function well if F tends towards the zero function then H becomes the identity function so the default function of this network is the identity function and whenever we learn something we learn how to deviate from the identity function and that is that is a much better default function now it's not entirely true that the default function is the identity function you see that here for example there's after the skip connection there is actually a relu so there's still it's still a nonlinear function in total the network in total but the default for the individual blocks here is the identity okay now if you chain these blocks you get a residual network and that's what they propose right here so on the left you see this original VGG architecture like we described it so you can see you have an image which has four channels and you first up it to 64 channels you keep the resolution and then you max pool which halves the resolution but you go up with the filters to 128 you max pool again go up with the filters and so on now this has even though it doesn't look like it this has a lot of parameters and it needs a lot of computation so it has 19.6 billion floating point operation for a forward pass in contrast the networks we're going to build here the residual networks have 3.6 billion flops so they are much much less in terms of complexity than the old VGG networks while still being much deeper okay the hypothesis is the deeper the better and as a trade-off per layer you don't actually need to have that many parameters because you don't learn that much per layer but the succession of layers it gains you much more than simply having single massive layers you can see at the same size of resolution here you the the Resnets can get away with much less amounts of filters and that's why they are less they are of less size so this is the comparison the VGG 19 now they do build this 34 layer network which they call plane and you can see it is simply a 34 layer network with no pooling right here and here instead of pooling they do a stride to convolution which has also become this has become kind of more standard than doing max or average pooling to downscale to do simply stride to convolution so this paper has actually set the standards for a lot of things in modern deep learning so our goal is to going to be to compare first of all the VGG 19 to the 34 layer plane to show that you will 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 these 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 it is twice the number of filters you can see right here this has 64 filters and here we go to 128 filters that's why this connection right here has parameters in order to simply expand the number of filters these 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 they still explore three different options and I guess here in this particular experiment the option a is simply to zero pad so to leave the first 64 channels but to simply append 128 zero padded filters there or channels option B is the one by one convolution and option C is actually that all of these connections right here also have the one by one convolutions which introduces extra parameters and they they realize that option C isn't improving over option B substantially and in fact is only improving marginally and they say okay that's probably just because we have more parameters so ultimately they went with option B and I think that's what the world does right now I also I when I read this first I particularly enjoyed this paragraph right here let's read it together our implementation for image net follows the practice in the data the image is resized with shorter randomly sampled in this for scale augmentation a this crop is randomly sampled from the image or its horizontal flip with the per pixel has been subtracted the standard color augmentation is used we adopt the batch normalization right after each convolution before activation this an age-old discussion was born when to use batch normalization before come before the activation or after the activation I still I think people are still fighting over this today we initialize the weights as in 13 and train all plain residual nets from scratch use SGD data data data the learning rate starts from this is divided by then so here in this perhaps in this paragraph they detail basically all the training procedure and all the tricks that they use that I remember specifically that you know I've read all of this which was the idea and I could follow like oh this is super well explained this is so cool and so on and then I expect basically an implementation of that and then there's one single paragraph with like 20 lines saying oh and by the way we use these 50 tricks from these other papers and yeah that's when it I guess it was already happening you needed to do all the modern tricks in order to really reach the top accuracies but you know in hindsight we know it wasn't the tricks that helped them it was actually their idea I just I just thought it was rather funny so you can see right here the results of this if you look at the left these are the plane networks and we've already sort of seen this now this is on image net 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 image net bold curves denote the 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 it this is because we can't train these deep networks because we should be able to the solution space of the 18 layer network is a subspace of the solution space of the 34 layer network everything tells us we should be able to learn the 34 layers to at least the accuracy of the 18 layers but we can't however introduce residual connections bum bum bum bum and you can see that the trend is exactly reversed now the 34 layer with residual connections has a much much lower training and validation error than the 18 layer in fact look at this table right here if you introduce the residual connections to the 18 layers it's marginally better however if you introduce the residual connections to the 34 layers it is a lot better and this is another testament to the fact that these residual connections they really help more and more the deeper you go you can see the effect in so this 18 layers this is sort of a VGG 19 depth network well if and there we already know we can train these without residual connections right because we were able to train VGG 19 however if we go higher to more layers we can these residual connections all of a sudden make it a lot a lot better you can see that it's not it's not that we can't train the 34 layers but the residual connections just help a lot more and it most of a sudden it most of most importantly they don't degrade the performance from the shallower network so they they explore the different options right here and compare it to others different options as I said being a B and C where a is the zero padding for the projection B is having projections simply between where the channels don't fit and C being having projections in every single residual connection and you can see right here that the option B gives you quite a bit of a boost well option C doesn't give you that much of a boost introduces many more parameters and you know overall is I guess they decided against it which since then the world has also decided against it they also do deeper networks so they built deeper networks like 50 layer resnet 101 layer resnet and 152 layer resnet and the 152 layer resnet ended up being the best one as you can see here and you can see a pretty gain like it almost almost lock step gain depth more depth means better network in this at the time this these numbers they were unheard of like even 50 layer deep neural network was bombastic but a hundred and fifty two layers it was it was crazy and the fact that still it has less parameters than the VGG 19 and performs better that was mind mind-blowing absolutely mind-blowing and then at the end they built an ensemble of these models and ended up taking the 2015 ImageNet competition winner that was still like very important back then it was still very important who wins who wins ImageNet that year where I think I haven't even followed up on the last few years it's some kind of wide fixed resnet whatnot with pre-trained and 50 billion extra data yeah so for the deeper networks they decide that they are computationally rather become rather expensive so they introduce these bottleneck blocks here on the right where as you can see so here if you have a 64 dimensional input you do 64 feature channels in your convolution have a 64 dimensional output you can save computation if you first project the higher so here you have a 256 dimensional input and they say we can save computational power by pretty much projecting down to 64 first because then our complexity of this layer which is the expensive layer will be the same as the complexity of one of these layers and then we can project up again the one by one convolution they are significantly lower computational intensive than the three by three convolutions like it's nine times less operations if you think about it so that's what they use to build the deeper residual networks and these residual networks the ResNet 50, 101, 152 they are still staples today you can have these are you can have pre-trained versions of those and people still use it like ResNet 50 is used in every segmentation whatnot application so yeah this has turned out these decisions here have you know made it long way here you can see the number of parameters in these residual networks and this was the absolute craziest thing right here 1202 layers okay so you can see still until here ResNet 110 now this is on CIFAR 10 right here not on image net anymore but you can see that even 110 layers still had less parameters or actually the select the same order of parameters than these previous networks that were only 19 layers deep this was unheard of and much more unheard of 1202 layer network to train on CIFAR 10 it's a bit of an overkill but they say their goal was explicitly to study depth and you can see here that with the deeper and deeper networks they outperformed all of the previous networks so all of the baselines and themselves as they went deeper and deeper and deeper however once you go to 1002 layers you go up again so here's the question was this all just kind of a trick a hack and do we run into the same problem again and that's the question they 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 1200 layer network you see your validation error going up again however your training error and I can't zoom in more but it's the same it's the same and it's at zero so here they conclude and the the here they conclude now we are overfitting they don't use like the biggest data augmentation like we use today so overfitting was still a thing back then so now they conclude okay now we have actually built a large enough network that is overfitting and then and the fact that we go up again in the training error is due to the fact that we are probably overfitting so not only have they enabled us to build deeper networks they have effectively shown that this can get you to the to the point where you don't need deeper networks anymore at least on C410 because you are overfitting and it can effectively get you there this is a lot of evidence for the fact that this biasing the networks towards the identity function is a very valid thing to do and is the solution to the we can't train deep networks problems lastly they investigate the size of the responses so their hypothesis is that if if it is really beneficial to bias the network towards the identity function and if it is really true that each of these layers only learns a little bit right because the identity function is already very good each of these layers only needs to learn kind of a small function they look at the responses of these things so the the response magnitude of these layers right here of the signal through the layers and they compare those with the response magnitude of the other neural networks where you don't have the skip connection the hypothesis is if we look at these then the responses of these layers should be much larger because they have to learn much more and the responses here will be much smaller because the identity function is already doing most of the work and that's exactly what you find so here the layers are ordered by response and you can see the plane networks in the dashed lines are significantly above the residual network even and that's not a function of the depth because if the depth was actually equal here you would expect that the dashed lines would would stretch like this right they would kind of stretch out however exactly the opposite is happening you can see that the residual networks even at the beginning their responses are very much smaller and this is kind of what I like about this paper it's it's one narrative it is a hypothesis and then every single like the the hypothesis is taken and they make predictions from the hypothesis they say okay if we are right with our hypothesis not only should our idea get us better accuracy that's what most people most papers do today but also you know but also it should be that we can for example push our network to the brink of where we actually are overfitting like here and it should also be that the responses of our signal through our layers is smaller and yeah that's research like this is just pretty pretty cool and it's I think a lesson for us that sadly the world has taken the resonance but the world hasn't all taken the research methodology of this paper yeah if you again if you want a good read it's very well written you I'm very sure you can follow it even if you have read very few papers and with that yeah I hope you enjoyed this please tell me what you think of going through kind of old papers looking at whether or not they have stood the test of time and yeah any other comments leave them in the comments I do read them and I'll see you next time bye bye
[ { "start": 0, "end": 4.74, "text": " Hi there! Today we'll look at deep residual learning for image recognition" }, { "start": 4.74, "end": 13.44, "text": " by Kai Ming He, Xiang Yu Cheng, Shao Qing Ren and Jian Sun. So this, you know it, this is an" }, { "start": 13.44, "end": 21.400000000000002, "text": " old paper. It is from 2015 but I thought we'd still look at it because this not" }, { "start": 21.400000000000002, "end": 26.68, "text": " only is it one of the most influential papers in modern deep learning, it is" }, { "start": 26.68, "end": 33.12, "text": " also a very well written paper and I remember it like it was yesterday when" }, { "start": 33.12, "end": 40.480000000000004, "text": " this came out. This was like a bomb. So around that time this this meme was" }, { "start": 40.480000000000004, "end": 48.84, "text": " going around. I was winning ImageNet but then someone made a deeper net. This" }, { "start": 48.84, "end": 54.879999999999995, "text": " was a this was a the time when after AlexNet people were trying to build" }, { "start": 54.88, "end": 60.440000000000005, "text": " bigger and bigger networks and every time someone managed to build a bigger" }, { "start": 60.440000000000005, "end": 67.48, "text": " network the accuracy on ImageNet data set would increase pretty much in lockstep" }, { "start": 67.48, "end": 73, "text": " with how much bigger the network was but people got to the limit of building big" }, { "start": 73, "end": 78.84, "text": " networks and then this paper drops and changed everything and now residual" }, { "start": 78.84, "end": 83.32000000000001, "text": " connections are everywhere not only in image recognition they are in" }, { "start": 83.32, "end": 88.44, "text": " transformers they are in whatever wherever you go you'll probably find" }, { "start": 88.44, "end": 96.08, "text": " some residual connections somewhere in there. So yeah let's let's look at this" }, { "start": 96.08, "end": 102.96, "text": " paper and let's revisit what kind of problems people had then and how they" }, { "start": 102.96, "end": 110.72, "text": " solved it. So here they go directly into into this problem of deep neural" }, { "start": 110.72, "end": 118.56, "text": " networks and the problem that people had was they knew that if you can increase" }, { "start": 118.56, "end": 124.28, "text": " the if you can increase the depth of a neural network you can make it perform" }, { "start": 124.28, "end": 129.48, "text": " better you can make it generalize better you can reach lower training loss but" }, { "start": 129.48, "end": 134.68, "text": " optimizing it was hard. Specifically this was a phenomenon that people observed. So" }, { "start": 134.68, "end": 138.56, "text": " if you have a 20 layer neural network you could train it and you know there is" }, { "start": 138.56, "end": 142.72, "text": " this learning rate drop people have all had already figured out that you need to" }, { "start": 142.72, "end": 148.76, "text": " drop drop the learning rate and it would reach a certain level and here this would" }, { "start": 148.76, "end": 154.76, "text": " be the test error over here. However if after a certain point if they increase" }, { "start": 154.76, "end": 161.96, "text": " the depth even more the training error would actually go up again and so would" }, { "start": 161.96, "end": 167.56, "text": " the test error and this is not a problem of overfitting because overfitting would" }, { "start": 167.56, "end": 173.52, "text": " be when the training error is lower or as low and then the test error went up. So" }, { "start": 173.52, "end": 176.84, "text": " this is the first thing this is not a phenomenon of overfitting of too many" }, { "start": 176.84, "end": 183.56, "text": " parameters so why can't we train bigger layers networks until that time have" }, { "start": 183.56, "end": 189.28, "text": " very much followed kind of the original network design that was envisioned by" }, { "start": 189.28, "end": 196.48000000000002, "text": " sort of people like Jan LeCun and also Alex Net and the most popular ones were" }, { "start": 196.48, "end": 201.79999999999998, "text": " these VGG nets and they were very much of the philosophy that you'd have like" }, { "start": 201.79999999999998, "end": 209.23999999999998, "text": " some you have the image here and you input that into convolutional layers" }, { "start": 209.23999999999998, "end": 216.44, "text": " which first would kind of keep a big resolution but would increase the" }, { "start": 216.44, "end": 221.56, "text": " channel size by you know some amount and then you would sort of downscale the" }, { "start": 221.56, "end": 227.28, "text": " image as you increase the number of filters so you would stack more and more" }, { "start": 227.28, "end": 233.12, "text": " filters and draw more filters you would stack more and more filters while" }, { "start": 233.12, "end": 238.88, "text": " downscaling the resolution of the image the reasoning was that if you do image" }, { "start": 238.88, "end": 244.88, "text": " classification right then you know where on this where on this maybe you want to" }, { "start": 244.88, "end": 252.24, "text": " classify this into a Lego tower or whatever that is it's not that important" }, { "start": 252.24, "end": 257.48, "text": " where it is so on the lower levels you would want to parse out like very low" }, { "start": 257.48, "end": 262.52, "text": " layer features like edges and so on and these are still important where they are" }, { "start": 262.52, "end": 266.24, "text": " right the fact that here's an edge here's an edge here's an edge but then" }, { "start": 266.24, "end": 270.8, "text": " as you go higher up and go to more and more abstracted features and we already" }, { "start": 270.8, "end": 276, "text": " knew that these neural network they tend to learn more and more abstract features" }, { "start": 276, "end": 281, "text": " as you go up the layers the hypothesis was that the exact localization of" }, { "start": 281, "end": 285.8, "text": " these abstract features would be less and less important so if there is if you" }, { "start": 285.8, "end": 291.16, "text": " recognize that there is a rectangle it's not that important where it is just that" }, { "start": 291.16, "end": 295.6, "text": " it's somewhere there and maybe where it is in relation to the other so if you" }, { "start": 295.6, "end": 301.24, "text": " have if you recognize want to recognize a car the lower layers would recognize" }, { "start": 301.24, "end": 305.6, "text": " the fact that there are edges and then the intermediate layers would recognize" }, { "start": 305.6, "end": 310.8, "text": " the geometric shapes of maybe here the wheels and these bodies but it's not that" }, { "start": 310.8, "end": 314.52000000000004, "text": " important where exactly they are and then the higher layers would learn to" }, { "start": 314.52000000000004, "end": 321.64000000000004, "text": " combine the individual parts to each other and again it becomes less and less" }, { "start": 321.64, "end": 325.96, "text": " important where these things are and more and more important that you build" }, { "start": 325.96, "end": 330.96, "text": " more expressive features so people would downscale the resolution upscale the" }, { "start": 330.96, "end": 335.47999999999996, "text": " number of filters now that's a good heuristic but this is based this was" }, { "start": 335.47999999999996, "end": 342.76, "text": " basically the architecture of these networks and we would question why would" }, { "start": 342.76, "end": 348.96, "text": " if we increase the number of layers so if we instead of one here we have two of" }, { "start": 348.96, "end": 354.35999999999996, "text": " these layers right we simply have two of these layers and here we have two of" }, { "start": 354.35999999999996, "end": 361.88, "text": " these layers why does it get worse especially this paper here makes an" }, { "start": 361.88, "end": 370.35999999999996, "text": " interesting observation so it is not caused caused by overfitting and adding" }, { "start": 370.35999999999996, "end": 377.15999999999997, "text": " more layers leads to a higher training error the degradation indicates that is" }, { "start": 377.16, "end": 382.44, "text": " not all systems are similarly easy to optimize let us consider a shallower" }, { "start": 382.44, "end": 387.08000000000004, "text": " architecture and its deeper counterparts that adds more layers onto it there" }, { "start": 387.08000000000004, "end": 391.40000000000003, "text": " exists a solution by construction to the deeper model the added layers are" }, { "start": 391.40000000000003, "end": 395.36, "text": " identity mapping and the other layers are copied from the learned shallower" }, { "start": 395.36, "end": 401.84000000000003, "text": " model so pretty easy if you have a shallow model like five layers that" }, { "start": 401.84000000000003, "end": 406.52000000000004, "text": " learns a particular function I can pretty easily prove that there is a deep" }, { "start": 406.52, "end": 412.15999999999997, "text": " model that learns the same function by simply copying over these five layers and" }, { "start": 412.15999999999997, "end": 418.91999999999996, "text": " having these here learn the identity function okay so if we are able to learn" }, { "start": 418.91999999999996, "end": 423.79999999999995, "text": " this we should be able to train this network to at least the same accuracy" }, { "start": 423.79999999999995, "end": 428.24, "text": " that's what this paper argues because it can you know these layers can simply" }, { "start": 428.24, "end": 432.76, "text": " learn the identity function so it must have something to do with the easiness" }, { "start": 432.76, "end": 440.15999999999997, "text": " of optimizing these deep architectures not with overfitting this is I think if" }, { "start": 440.15999999999997, "end": 445.68, "text": " you read the entire text here it's very very clear if you read it they lead you" }, { "start": 445.68, "end": 451.3, "text": " through this reasoning saying that look all these layers have to do is learn the" }, { "start": 451.3, "end": 457.68, "text": " identity function and then we could at least get the same accuracy so so what" }, { "start": 457.68, "end": 462.48, "text": " why don't they learn the identity function well because we initialize most" }, { "start": 462.48, "end": 467.6, "text": " weights you know towards zero we initialize them randomly but mostly we" }, { "start": 467.6, "end": 472.04, "text": " initialize them around zero our initialization procedure usually sample" }, { "start": 472.04, "end": 477.36, "text": " from some Gaussian with some kind of a standard deviation but around the mean" }, { "start": 477.36, "end": 483.84000000000003, "text": " of zero and also if we use things like weight decay L2 regularization all of" }, { "start": 483.84000000000003, "end": 490.72, "text": " these things they do they bias the weights towards zero so if there is any" }, { "start": 490.72, "end": 495.46000000000004, "text": " natural thing that these networks are good at is they learn the zero function" }, { "start": 495.46000000000004, "end": 501.12, "text": " really well learning the identity function is as difficult as learning any" }, { "start": 501.12, "end": 505.36, "text": " other function the identity function the convolutional filter is actually pretty" }, { "start": 505.36, "end": 511.72, "text": " difficult to learn because you know if I have a my if I have my three by three" }, { "start": 511.72, "end": 519.52, "text": " filter where is my no no this is my three by three filter the identity" }, { "start": 519.52, "end": 524.76, "text": " function is it like a one here and zeros everywhere else that's the that that" }, { "start": 524.76, "end": 529.4399999999999, "text": " would be one of the things it's not that easy you need to learn nine weights in" }, { "start": 529.4399999999999, "end": 537.48, "text": " the correct way so this paper says can we do something to make the default" }, { "start": 537.48, "end": 541.4, "text": " function of the network not be the zero function or whatever the randomly" }, { "start": 541.4, "end": 546.1999999999999, "text": " initialized function can we make the default function the one function can we" }, { "start": 546.2, "end": 551.2, "text": " make the default function the identity function and that brings you to" }, { "start": 551.2, "end": 556.88, "text": " residual connection so instead of learning to transform X via a neural" }, { "start": 556.88, "end": 566, "text": " network into X which is the identity function why don't we have X stay X and" }, { "start": 566, "end": 574.12, "text": " then learn whatever we need to change okay so if let's call that tilde if the" }, { "start": 574.12, "end": 579.68, "text": " assumption is that it's a good default to not change much so this is almost the" }, { "start": 579.68, "end": 585.88, "text": " same as this we might make this build this directly into the architecture the" }, { "start": 585.88, "end": 592.96, "text": " fact that these two are equal plus plus some deviation that is learned right" }, { "start": 592.96, "end": 599.64, "text": " here and the hypothesis is that especially the deeper you go if you go" }, { "start": 599.64, "end": 604.8, "text": " very deep each function here will actually learn not that much it will" }, { "start": 604.8, "end": 609.28, "text": " learn to basically change the signal a little bit but mostly it will learn the" }, { "start": 609.28, "end": 613.52, "text": " identity function if it behaves well and therefore it might be you know" }, { "start": 613.52, "end": 617.52, "text": " reasonable to build this into the architecture and of course this has" }, { "start": 617.52, "end": 622.8, "text": " turned out to be very accurate it has actually been reasonable to build this" }, { "start": 622.8, "end": 628.26, "text": " into the architecture so that's what they propose right here so instead of" }, { "start": 628.26, "end": 632.88, "text": " just having weight layers one after another what they propose is to have" }, { "start": 632.88, "end": 638.84, "text": " these skip connections in here so these skip connections they will instead of" }, { "start": 638.84, "end": 642.66, "text": " learning the function they call this entire function H of X which might be" }, { "start": 642.66, "end": 651.36, "text": " very complicated they learn the function whatever F and F is whatever you need to" }, { "start": 651.36, "end": 657.28, "text": " change about X you see at the end you add X to it so these weight layers here" }, { "start": 657.28, "end": 664.12, "text": " they simply learn whatever makes this next this output different from this" }, { "start": 664.12, "end": 669.9599999999999, "text": " input and learning differences now you have the desired property because what" }, { "start": 669.9599999999999, "end": 674.12, "text": " do we know about weight layers from before well they tend towards the zero" }, { "start": 674.12, "end": 679.28, "text": " function right if we use weight decay or generally how we initialize them they" }, { "start": 679.28, "end": 684.92, "text": " tend towards the zero function well if F tends towards the zero function then H" }, { "start": 684.92, "end": 691.0799999999999, "text": " becomes the identity function so the default function of this network is the" }, { "start": 691.0799999999999, "end": 695.36, "text": " identity function and whenever we learn something we learn how to deviate from" }, { "start": 695.36, "end": 702.5999999999999, "text": " the identity function and that is that is a much better default function now" }, { "start": 702.5999999999999, "end": 706, "text": " it's not entirely true that the default function is the identity function you" }, { "start": 706, "end": 711.0799999999999, "text": " see that here for example there's after the skip connection there is actually a" }, { "start": 711.08, "end": 717.08, "text": " relu so there's still it's still a nonlinear function in total the network" }, { "start": 717.08, "end": 722.8000000000001, "text": " in total but the default for the individual blocks here is the identity" }, { "start": 722.8000000000001, "end": 728.5600000000001, "text": " okay now if you chain these blocks you get a residual network and that's what" }, { "start": 728.5600000000001, "end": 734.88, "text": " they propose right here so on the left you see this original VGG architecture" }, { "start": 734.88, "end": 738.84, "text": " like we described it so you can see you have an image which has four channels" }, { "start": 738.84, "end": 744.96, "text": " and you first up it to 64 channels you keep the resolution and then you max" }, { "start": 744.96, "end": 750.52, "text": " pool which halves the resolution but you go up with the filters to 128 you max" }, { "start": 750.52, "end": 758.1600000000001, "text": " pool again go up with the filters and so on now this has even though it doesn't" }, { "start": 758.1600000000001, "end": 762.32, "text": " look like it this has a lot of parameters and it needs a lot of" }, { "start": 762.32, "end": 767.08, "text": " computation so it has 19.6 billion floating point operation for a forward" }, { "start": 767.08, "end": 772.32, "text": " pass in contrast the networks we're going to build here the residual" }, { "start": 772.32, "end": 780.4000000000001, "text": " networks have 3.6 billion flops so they are much much less in terms of complexity" }, { "start": 780.4000000000001, "end": 787.6800000000001, "text": " than the old VGG networks while still being much deeper okay the hypothesis is" }, { "start": 787.6800000000001, "end": 794.24, "text": " the deeper the better and as a trade-off per layer you don't actually need to" }, { "start": 794.24, "end": 798.72, "text": " have that many parameters because you don't learn that much per layer but the" }, { "start": 798.72, "end": 803.84, "text": " succession of layers it gains you much more than simply having single massive" }, { "start": 803.84, "end": 809.76, "text": " layers you can see at the same size of resolution here you the the Resnets can" }, { "start": 809.76, "end": 815.8, "text": " get away with much less amounts of filters and that's why they are less they" }, { "start": 815.8, "end": 822.64, "text": " are of less size so this is the comparison the VGG 19 now they do build" }, { "start": 822.64, "end": 829.28, "text": " this 34 layer network which they call plane and you can see it is simply a 34" }, { "start": 829.28, "end": 835.04, "text": " layer network with no pooling right here and here instead of pooling they do a" }, { "start": 835.04, "end": 839.92, "text": " stride to convolution which has also become this has become kind of more" }, { "start": 839.92, "end": 845.68, "text": " standard than doing max or average pooling to downscale to do simply stride" }, { "start": 845.68, "end": 850.8199999999999, "text": " to convolution so this paper has actually set the standards for a lot of" }, { "start": 850.82, "end": 856.48, "text": " things in modern deep learning so our goal is to going to be to compare first" }, { "start": 856.48, "end": 863.7600000000001, "text": " of all the VGG 19 to the 34 layer plane to show that you will lose performance" }, { "start": 863.7600000000001, "end": 868.96, "text": " when you simply up the number of layers but then when you introduce the residual" }, { "start": 868.96, "end": 873.6400000000001, "text": " connections as you can see right here so there is always this jumping connection" }, { "start": 873.6400000000001, "end": 878.36, "text": " right here so along these jumping connections the signal can travel as the" }, { "start": 878.36, "end": 882.88, "text": " identity function what we're going to see is that if we go from plane to" }, { "start": 882.88, "end": 889.28, "text": " residual introducing no extra parameters just these skip connections will change" }, { "start": 889.28, "end": 895.84, "text": " everything will make this network all of a sudden trainable and make the deeper" }, { "start": 895.84, "end": 902.28, "text": " networks the better networks okay the only little caveat here is of course in" }, { "start": 902.28, "end": 906.52, "text": " order to build a residual connection the output has to be of the same size as" }, { "start": 906.52, "end": 911.16, "text": " the input because you need to add the input to the output and this here for" }, { "start": 911.16, "end": 917.3199999999999, "text": " example is not given so here you can see this signal after this layer is going to" }, { "start": 917.3199999999999, "end": 921.92, "text": " be half as big because it's a stride to convolution so the output right here is" }, { "start": 921.92, "end": 929.88, "text": " only half the size but it is it is twice the number of filters you can see right" }, { "start": 929.88, "end": 935.76, "text": " here this has 64 filters and here we go to 128 filters that's why this" }, { "start": 935.76, "end": 941.4, "text": " connection right here has parameters in order to simply expand the number of" }, { "start": 941.4, "end": 947.08, "text": " filters these are these one by one convolutions that simply up that simply" }, { "start": 947.08, "end": 954.08, "text": " project the 64 filters to 128 filters however this doesn't introduce too many" }, { "start": 954.08, "end": 961.92, "text": " parameters because it's only one by one in fact here the 34 parameters residual" }, { "start": 961.92, "end": 970.4799999999999, "text": " network no I'm wrong you have different options so the world has ended up at the" }, { "start": 970.4799999999999, "end": 975.1999999999999, "text": " option of doing one by one convolutions but in this paper they still they still" }, { "start": 975.1999999999999, "end": 979.16, "text": " explore three different options and I guess here in this particular experiment" }, { "start": 979.16, "end": 987.9599999999999, "text": " the option a is simply to zero pad so to leave the first 64 channels but to" }, { "start": 987.96, "end": 997.2, "text": " simply append 128 zero padded filters there or channels option B is the one by" }, { "start": 997.2, "end": 1002.6800000000001, "text": " one convolution and option C is actually that all of these connections right here" }, { "start": 1002.6800000000001, "end": 1008.36, "text": " also have the one by one convolutions which introduces extra parameters and" }, { "start": 1008.36, "end": 1013.9200000000001, "text": " they they realize that option C isn't improving over option B" }, { "start": 1013.92, "end": 1019.16, "text": " substantially and in fact is only improving marginally and they say okay" }, { "start": 1019.16, "end": 1023.36, "text": " that's probably just because we have more parameters so ultimately they went" }, { "start": 1023.36, "end": 1030.3999999999999, "text": " with option B and I think that's what the world does right now I also I when I" }, { "start": 1030.3999999999999, "end": 1034.96, "text": " read this first I particularly enjoyed this paragraph right here let's read it" }, { "start": 1034.96, "end": 1038.72, "text": " together our implementation for image net follows the practice in the data" }, { "start": 1038.72, "end": 1043.04, "text": " the image is resized with shorter randomly sampled in this for scale" }, { "start": 1043.04, "end": 1047.12, "text": " augmentation a this crop is randomly sampled from the image or its horizontal" }, { "start": 1047.12, "end": 1050.3999999999999, "text": " flip with the per pixel has been subtracted the standard color" }, { "start": 1050.3999999999999, "end": 1053.76, "text": " augmentation is used we adopt the batch normalization right after each" }, { "start": 1053.76, "end": 1060.1599999999999, "text": " convolution before activation this an age-old discussion was born when to use" }, { "start": 1060.1599999999999, "end": 1065.56, "text": " batch normalization before come before the activation or after the activation I" }, { "start": 1065.56, "end": 1071.68, "text": " still I think people are still fighting over this today we initialize the weights" }, { "start": 1071.68, "end": 1077.5600000000002, "text": " as in 13 and train all plain residual nets from scratch use SGD data data" }, { "start": 1077.5600000000002, "end": 1081.88, "text": " data the learning rate starts from this is divided by then so here in this" }, { "start": 1081.88, "end": 1086.8400000000001, "text": " perhaps in this paragraph they detail basically all the training procedure and" }, { "start": 1086.8400000000001, "end": 1090.8400000000001, "text": " all the tricks that they use that I remember specifically that you know I've" }, { "start": 1090.8400000000001, "end": 1095.3200000000002, "text": " read all of this which was the idea and I could follow like oh this is super" }, { "start": 1095.3200000000002, "end": 1100.1200000000001, "text": " well explained this is so cool and so on and then I expect basically an" }, { "start": 1100.12, "end": 1104.6799999999998, "text": " implementation of that and then there's one single paragraph with like 20 lines" }, { "start": 1104.6799999999998, "end": 1110.8799999999999, "text": " saying oh and by the way we use these 50 tricks from these other papers and yeah" }, { "start": 1110.8799999999999, "end": 1115.84, "text": " that's when it I guess it was already happening you needed to do all the" }, { "start": 1115.84, "end": 1122.8, "text": " modern tricks in order to really reach the top accuracies but you know in" }, { "start": 1122.8, "end": 1126.7199999999998, "text": " hindsight we know it wasn't the tricks that helped them it was actually their" }, { "start": 1126.72, "end": 1134.96, "text": " idea I just I just thought it was rather funny so you can see right here the" }, { "start": 1134.96, "end": 1140.32, "text": " results of this if you look at the left these are the plane networks and we've" }, { "start": 1140.32, "end": 1145.44, "text": " already sort of seen this now this is on image net right here you can see the 18" }, { "start": 1145.44, "end": 1151.08, "text": " layer network simply has lower train and validation accuracy so the solid line" }, { "start": 1151.08, "end": 1160.48, "text": " here is the validation on image net bold curves denote the validation error of" }, { "start": 1160.48, "end": 1165, "text": " the center crops so I guess they do yeah they do center crops so the training" }, { "start": 1165, "end": 1170.6399999999999, "text": " error is going to be higher because they do these different augmentations but you" }, { "start": 1170.6399999999999, "end": 1176.84, "text": " can see the training and the validation error are higher in the deeper network" }, { "start": 1176.84, "end": 1181.28, "text": " if you don't use residual connections again this is not due to overfitting" }, { "start": 1181.28, "end": 1187.6399999999999, "text": " and it this is because we can't train these deep networks because we should be" }, { "start": 1187.6399999999999, "end": 1192.36, "text": " able to the solution space of the 18 layer network is a subspace of the" }, { "start": 1192.36, "end": 1197.28, "text": " solution space of the 34 layer network everything tells us we should be able to" }, { "start": 1197.28, "end": 1202.32, "text": " learn the 34 layers to at least the accuracy of the 18 layers but we can't" }, { "start": 1202.32, "end": 1208.6399999999999, "text": " however introduce residual connections bum bum bum bum and you can see that the" }, { "start": 1208.6399999999999, "end": 1213.56, "text": " trend is exactly reversed now the 34 layer with residual connections has a" }, { "start": 1213.56, "end": 1220.84, "text": " much much lower training and validation error than the 18 layer in fact look at" }, { "start": 1220.84, "end": 1225.56, "text": " this table right here if you introduce the residual connections to the 18" }, { "start": 1225.56, "end": 1231, "text": " layers it's marginally better however if you introduce the residual connections" }, { "start": 1231, "end": 1236.4, "text": " to the 34 layers it is a lot better and this is another testament to the fact" }, { "start": 1236.4, "end": 1241.36, "text": " that these residual connections they really help more and more the deeper you" }, { "start": 1241.36, "end": 1248.96, "text": " go you can see the effect in so this 18 layers this is sort of a VGG 19 depth" }, { "start": 1248.96, "end": 1254.36, "text": " network well if and there we already know we can train these without residual" }, { "start": 1254.36, "end": 1260.24, "text": " connections right because we were able to train VGG 19 however if we go higher" }, { "start": 1260.24, "end": 1266, "text": " to more layers we can these residual connections all of a sudden make it a" }, { "start": 1266, "end": 1272.48, "text": " lot a lot better you can see that it's not it's not that we can't train the 34" }, { "start": 1272.48, "end": 1278.1200000000001, "text": " layers but the residual connections just help a lot more and it most of a sudden" }, { "start": 1278.1200000000001, "end": 1284.08, "text": " it most of most importantly they don't degrade the performance from the" }, { "start": 1284.08, "end": 1291.48, "text": " shallower network so they they explore the different options right here and" }, { "start": 1291.48, "end": 1298.56, "text": " compare it to others different options as I said being a B and C where a is the" }, { "start": 1298.56, "end": 1303.6, "text": " zero padding for the projection B is having projections simply between where" }, { "start": 1303.6, "end": 1308.6799999999998, "text": " the channels don't fit and C being having projections in every single" }, { "start": 1308.6799999999998, "end": 1313.1999999999998, "text": " residual connection and you can see right here that the option B gives you" }, { "start": 1313.2, "end": 1317.68, "text": " quite a bit of a boost well option C doesn't give you that much of a boost" }, { "start": 1317.68, "end": 1324.68, "text": " introduces many more parameters and you know overall is I guess they decided" }, { "start": 1324.68, "end": 1330.52, "text": " against it which since then the world has also decided against it they also" }, { "start": 1330.52, "end": 1341.24, "text": " do deeper networks so they built deeper networks like 50 layer resnet 101 layer" }, { "start": 1341.24, "end": 1348.88, "text": " resnet and 152 layer resnet and the 152 layer resnet ended up being the best one" }, { "start": 1348.88, "end": 1354.32, "text": " as you can see here and you can see a pretty gain like it almost almost lock" }, { "start": 1354.32, "end": 1360.92, "text": " step gain depth more depth means better network in this at the time this these" }, { "start": 1360.92, "end": 1367.44, "text": " numbers they were unheard of like even 50 layer deep neural network was" }, { "start": 1367.44, "end": 1375.1200000000001, "text": " bombastic but a hundred and fifty two layers it was it was crazy and the fact" }, { "start": 1375.1200000000001, "end": 1381.64, "text": " that still it has less parameters than the VGG 19 and performs better that was" }, { "start": 1381.64, "end": 1386.2, "text": " mind mind-blowing absolutely mind-blowing and then at the end they" }, { "start": 1386.2, "end": 1392.44, "text": " built an ensemble of these models and ended up taking the 2015 ImageNet" }, { "start": 1392.44, "end": 1396.8, "text": " competition winner that was still like very important back then it was still" }, { "start": 1396.8, "end": 1402.68, "text": " very important who wins who wins ImageNet that year where I think I" }, { "start": 1402.68, "end": 1407.68, "text": " haven't even followed up on the last few years it's some kind of wide fixed resnet" }, { "start": 1407.68, "end": 1414.9199999999998, "text": " whatnot with pre-trained and 50 billion extra data yeah so for the deeper" }, { "start": 1414.9199999999998, "end": 1420.68, "text": " networks they decide that they are computationally rather become rather" }, { "start": 1420.68, "end": 1425.1599999999999, "text": " expensive so they introduce these bottleneck blocks here on the right" }, { "start": 1425.16, "end": 1434.6000000000001, "text": " where as you can see so here if you have a 64 dimensional input you do 64 feature" }, { "start": 1434.6000000000001, "end": 1439.3400000000001, "text": " channels in your convolution have a 64 dimensional output you can save" }, { "start": 1439.3400000000001, "end": 1444.96, "text": " computation if you first project the higher so here you have a 256" }, { "start": 1444.96, "end": 1450.92, "text": " dimensional input and they say we can save computational power by pretty much" }, { "start": 1450.92, "end": 1456.0800000000002, "text": " projecting down to 64 first because then our complexity of this layer which is" }, { "start": 1456.0800000000002, "end": 1460.44, "text": " the expensive layer will be the same as the complexity of one of these layers" }, { "start": 1460.44, "end": 1466.16, "text": " and then we can project up again the one by one convolution they are" }, { "start": 1466.16, "end": 1470.28, "text": " significantly lower computational intensive than the three by three" }, { "start": 1470.28, "end": 1477.2, "text": " convolutions like it's nine times less operations if you think about it so" }, { "start": 1477.2, "end": 1482.0800000000002, "text": " that's what they use to build the deeper residual networks and these residual" }, { "start": 1482.0800000000002, "end": 1488.44, "text": " networks the ResNet 50, 101, 152 they are still staples today you can have these" }, { "start": 1488.44, "end": 1492.76, "text": " are you can have pre-trained versions of those and people still use it like" }, { "start": 1492.76, "end": 1501.4, "text": " ResNet 50 is used in every segmentation whatnot application so yeah this has" }, { "start": 1501.4, "end": 1506.82, "text": " turned out these decisions here have you know made it long way here you can see" }, { "start": 1506.82, "end": 1513.08, "text": " the number of parameters in these residual networks and this was the" }, { "start": 1513.08, "end": 1523.48, "text": " absolute craziest thing right here 1202 layers okay so you can see still until" }, { "start": 1523.48, "end": 1529.48, "text": " here ResNet 110 now this is on CIFAR 10 right here not on image net anymore but" }, { "start": 1529.48, "end": 1536.24, "text": " you can see that even 110 layers still had less parameters or actually the" }, { "start": 1536.24, "end": 1541.76, "text": " select the same order of parameters than these previous networks that were only" }, { "start": 1541.76, "end": 1552.44, "text": " 19 layers deep this was unheard of and much more unheard of 1202 layer network" }, { "start": 1552.44, "end": 1557.48, "text": " to train on CIFAR 10 it's a bit of an overkill but they say their goal was" }, { "start": 1557.48, "end": 1563.36, "text": " explicitly to study depth and you can see here that with the deeper and deeper" }, { "start": 1563.36, "end": 1569.1999999999998, "text": " networks they outperformed all of the previous networks so all of the" }, { "start": 1569.1999999999998, "end": 1575.6799999999998, "text": " baselines and themselves as they went deeper and deeper and deeper however once" }, { "start": 1575.6799999999998, "end": 1584.1599999999999, "text": " you go to 1002 layers you go up again so here's the question was this all just" }, { "start": 1584.1599999999999, "end": 1588.56, "text": " kind of a trick a hack and do we run into the same problem again and that's" }, { "start": 1588.56, "end": 1596.36, "text": " the question they ask themselves and the answer is no so if you look right here" }, { "start": 1596.36, "end": 1602.08, "text": " so here you see again the plane networks in the plane networks you can pretty" }, { "start": 1602.08, "end": 1609.84, "text": " easily see that the more layers you have the higher your error goes whereas in" }, { "start": 1609.84, "end": 1614.56, "text": " the residual network it's exactly the opposite way the more layers you have" }, { "start": 1614.56, "end": 1622.12, "text": " the lower your error and if you compare this 110 layer network with the 1200" }, { "start": 1622.12, "end": 1627.1599999999999, "text": " layer network you see your validation error going up again however your" }, { "start": 1627.1599999999999, "end": 1632.32, "text": " training error and I can't zoom in more but it's the same it's the same and it's" }, { "start": 1632.32, "end": 1639.34, "text": " at zero so here they conclude and the the here they conclude now we are" }, { "start": 1639.34, "end": 1643.72, "text": " overfitting they don't use like the biggest data augmentation like we use" }, { "start": 1643.72, "end": 1649.3600000000001, "text": " today so overfitting was still a thing back then so now they conclude okay now" }, { "start": 1649.3600000000001, "end": 1653.8, "text": " we have actually built a large enough network that is overfitting and then and" }, { "start": 1653.8, "end": 1659.44, "text": " the fact that we go up again in the training error is due to the fact that" }, { "start": 1659.44, "end": 1665.6200000000001, "text": " we are probably overfitting so not only have they enabled us to build deeper" }, { "start": 1665.62, "end": 1673.52, "text": " networks they have effectively shown that this can get you to the to the point" }, { "start": 1673.52, "end": 1678.52, "text": " where you don't need deeper networks anymore at least on C410 because you are" }, { "start": 1678.52, "end": 1683.6399999999999, "text": " overfitting and it can effectively get you there this is a lot of evidence for" }, { "start": 1683.6399999999999, "end": 1688.9599999999998, "text": " the fact that this biasing the networks towards the identity function is a very" }, { "start": 1688.9599999999998, "end": 1694.9199999999998, "text": " valid thing to do and is the solution to the we can't train deep networks" }, { "start": 1694.92, "end": 1700.8400000000001, "text": " problems lastly they investigate the size of the responses so their hypothesis" }, { "start": 1700.8400000000001, "end": 1706.4, "text": " is that if if it is really beneficial to bias the network towards the identity" }, { "start": 1706.4, "end": 1714.28, "text": " function and if it is really true that each of these layers only learns a" }, { "start": 1714.28, "end": 1718.72, "text": " little bit right because the identity function is already very good each of" }, { "start": 1718.72, "end": 1723.72, "text": " these layers only needs to learn kind of a small function they look at the" }, { "start": 1723.72, "end": 1730.28, "text": " responses of these things so the the response magnitude of these layers right" }, { "start": 1730.28, "end": 1734.8, "text": " here of the signal through the layers and they compare those with the response" }, { "start": 1734.8, "end": 1739.16, "text": " magnitude of the other neural networks where you don't have the skip" }, { "start": 1739.16, "end": 1745.8, "text": " connection the hypothesis is if we look at these then the responses of these" }, { "start": 1745.8, "end": 1753.1000000000001, "text": " layers should be much larger because they have to learn much more and the" }, { "start": 1753.1, "end": 1756.8799999999999, "text": " responses here will be much smaller because the identity function is already" }, { "start": 1756.8799999999999, "end": 1762.4399999999998, "text": " doing most of the work and that's exactly what you find so here the layers" }, { "start": 1762.4399999999998, "end": 1766.1999999999998, "text": " are ordered by response and you can see the plane networks in the dashed lines" }, { "start": 1766.1999999999998, "end": 1771.6399999999999, "text": " are significantly above the residual network even and that's not a function" }, { "start": 1771.6399999999999, "end": 1777.8, "text": " of the depth because if the depth was actually equal here you would expect" }, { "start": 1777.8, "end": 1782.56, "text": " that the dashed lines would would stretch like this right they would kind" }, { "start": 1782.56, "end": 1786.6399999999999, "text": " of stretch out however exactly the opposite is happening you can see that" }, { "start": 1786.6399999999999, "end": 1790.56, "text": " the residual networks even at the beginning their responses are very much" }, { "start": 1790.56, "end": 1795.84, "text": " smaller and this is kind of what I like about this paper it's it's one narrative" }, { "start": 1795.84, "end": 1802.8, "text": " it is a hypothesis and then every single like the the hypothesis is taken and" }, { "start": 1802.8, "end": 1806.52, "text": " they make predictions from the hypothesis they say okay if we are right" }, { "start": 1806.52, "end": 1812.1799999999998, "text": " with our hypothesis not only should our idea get us better accuracy that's what" }, { "start": 1812.18, "end": 1818.18, "text": " most people most papers do today but also you know but also it should be that" }, { "start": 1818.18, "end": 1823.64, "text": " we can for example push our network to the brink of where we actually are" }, { "start": 1823.64, "end": 1829.3600000000001, "text": " overfitting like here and it should also be that the responses of our signal" }, { "start": 1829.3600000000001, "end": 1836.5600000000002, "text": " through our layers is smaller and yeah that's research like this is just" }, { "start": 1836.56, "end": 1843.52, "text": " pretty pretty cool and it's I think a lesson for us that sadly the world has" }, { "start": 1843.52, "end": 1848.76, "text": " taken the resonance but the world hasn't all taken the research methodology of" }, { "start": 1848.76, "end": 1855.6399999999999, "text": " this paper yeah if you again if you want a good read it's very well written you" }, { "start": 1855.6399999999999, "end": 1862.52, "text": " I'm very sure you can follow it even if you have read very few papers and with" }, { "start": 1862.52, "end": 1867.44, "text": " that yeah I hope you enjoyed this please tell me what you think of going through" }, { "start": 1867.44, "end": 1874.04, "text": " kind of old papers looking at whether or not they have stood the test of time and" }, { "start": 1874.04, "end": 1879.08, "text": " yeah any other comments leave them in the comments I do read them and I'll" }, { "start": 1879.08, "end": 1893.6799999999998, "text": " see you next time bye bye" } ]
GwItCHOifG8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
I'M TAKING A BREAK... (Channel Update July 2020)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper" ]
Past, Present & Future of this Channel. OUTLINE: 0:00 - I'm going on a break 0:20 - Channel Stats 1:20 - Other Platforms 4:20 - Drama Videos 5:30 - Flatland 8:40 - SpineNet Thumbnail 9:55 - Future Content 12:55 - How do I select papers? 15:50 - Financial Support, Ads & Merch 18:50 - Conclusion Our Flatland Repo: https://github.com/yk/youtube-flatland Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Yes, you read that right. I am going on a break. Don't worry though, there will still be videos, just not as many. I've decided to basically reduce the upload frequency a little bit, mostly because I am going on a break, but also because I kind of want to have time to do other things, but we'll get to that later. So how's our little channel doing? We've just passed 1 million views. 1 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 a 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 100,000. It's only a matter of time. And I think I've said this in the last update, but this is just absolutely overwhelming how many people are interested in machine learning research and topics related to it. So that's pretty cool and encouraging. Thank you everyone who has already subscribed, and especially the people that leave comments, the people that share the videos. This means a lot and I think it's awesome. And it's quite motivating to continue doing this, honestly. I'm having lots of fun. Along with that, I've gained almost 5,000 Twitter followers. I think more than 5,000 Twitter followers. Which is strange, because Twitter is weird. But, you know. So that's pretty cool, I guess. I wonder if all of those are subscribed to the channel. In any case, I just want to highlight again that the community around machine learning research is in the absolute largest part a very, very positive community. You people are absolutely great. The comment sections are just so much better than anything else on the entire internet. Including paper reviews at major conferences. Really, this is a half joke that the comment section is better than the reviews on papers, but it is actually very often true. People are discussing ideas in the comments that are valuable and creative and asking interesting questions and helping each other out. And that also counts for our Discord server. So if you're not on our Discord server, we do have one. There is a channel for beginners question. There's a channel for discussing the videos that are on the YouTube channel. And people are generally very, very helpful there. It's a vibrant community and I can only recommend that if you're looking to contribute to the community and be part of it, it's a great place. That being said, I'm also on a number of other platforms such as LinkedIn. I finally made a LinkedIn account. I was always kind of sceptic. I don't know how LinkedIn works. What is the difference between follow and connect? And then people write little messages while connecting and it says, I'd love to connect. But then you accept them and then that message pops up and then it's saying, I'd love to connect, but you've already connected at that point. This is weird. How does LinkedIn work? Someone tell me. What is it for? I get it. It's like professional social networking. Ah, it's just it seems weird to me. OK, but there is an entire community there and I do post my videos there. I'm not like super active on LinkedIn. I have to say that. I'm also on BitChute, Minds, Parlor. So the reason why I'm mentioning these things is that with recent developments, especially around this Yann LeCun video, there were some developments that potentially threatened 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'd follow me on at least one other thing, at least one other point of contact so that in the case that something might happen, which is unlikely, but you know, can I still have a way of distributing this content? All the links are in the video description. I'd love to see you there wherever. So with respect to the Yann LeCun situation, he has left Twitter now de facto. And people wanted me to kind of make a follow up video, asked 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's sake is 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 outrages, 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, Yann LeCun is an adult and he's able to make his decisions of whether he wants to leave Twitter or not. It's probably for the better for his mental health. So with respect to the drama videos, I always kind of say that I'll pull you in with the drama and then before you know it, I educate you. Ha, checkmate. So that's how this works and how we ultimately end up with many more machine learners than originally wanted to be. We gotcha. So in other news, Flatland, round one of Flatland has officially started. And I've previously made a video about Flatland. It is a NeurIPS challenge. It is a challenge where you have to route trains around a 2D map. And I wanted to make this kind of a community project where we do research together, hopefully do something with machine learning, with reinforcement learning to tackle this problem and to crush the challenge. And this is looking extremely good. So on our Discord server, there is a core group of people that is really engaged. And this is one of the reasons why I kind of want to reduce my upload frequency, because I want to have time to participate more in these community efforts. I really want to have time to do more myself in the Flatland research group that we have. We do open research. Anyone is welcome. You're still very welcome. Join our Discord server and join us and contribute to the code. There is a core group right now that is really pushing forward. So just to highlight a few of them, there is Novik, Edward Durek, Dolash, Frostbite, China CEO, trademarked, Ai Adrian and I'm Peter. And I forgot NuberPonage. I'm so sorry, NuberPonage. You're beautiful. These people are helping each other reach more and better performance, profiling code, implementing parts from other papers. And it's just great to see that people can collaborate on this, even though it's technically a competition. But, you know, I guess we're competing against nature. For anyone I haven't mentioned here, I'm very, very sorry. Any list of names is always prone to leave people out. I do not want to diminish your impact. So right now, this DQN algorithm is able to reach about a 95 percent success rate with three to five agents on the map. So three to five trains. But round one has just started and we see that some of these environments have many, many more agents in them. So there's still a lot of work to do. So we need you to come and contribute and join the fun. It is fun. And as I said, I will be working on this myself more as well because it's fun. So again, big shout out to anyone on this court that has contributed in any way. This is just awesome. We've just had recently our first Flatland Town Hall with entirely community generated content. So these people came together and basically joined in making one PowerPoint presentation and then presented to each other their knowledge of the environment. And amazingly, we also had the Flatland organizers come in and tell us their perspective about the challenge, the environment and what's challenging and what's changed and so on. This was just unprecedented for me, the amount of contributions there. The first town hall is available if you join 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. OK, next thing, you've probably seen the SpineNet video and the thumbnail there was excessively beautiful. So the story behind it is on the Discord server, I've asked people to help me with the thumbnail, which was originally rather boring. And I just kind of wanted to know which subtitle I should put there. And then one of the Discord members, Lucas Ferreira, just gone ahead and drawn up this very beautiful image of a SpineNet robot that has the SpineNet as a spine. And this is this kind of stuff is just awesome. So again, big shout out to Lucas Ferreira and the absolutely amazing thumbnail that this has generated. And also the contributions to anyone that comes on the Discord server and into the beginners question channel, 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. OK, so how does this channel go forward? I want to make the content a bit more diverse and kind of branch out. And as I already said, the upload frequency will be sort of lower after my break and also during my break. But I have some ideas of how to generate kind of more interesting content or different content. So here are my ideas. And this is a list. And please tell me what you think of it. And you can do this at this video and you can do this at any point. You can give feedback about what kind of videos you like, what kind of style of videos you like, anything. Really, I'm happy to listen to people and incorporate all the feedback that I can. So I want to do some more channel updates, maybe more frequently, maybe once every two or three weeks just to let you know what's going on, kind of what's going on with the channel, what's going on with the community. This should be fun. So another idea I had is to look at kind of historical papers. And I think I got the idea from a comment in my comment section. So shout out to whoever lifted me to that. It's a great idea to basically go back to historical papers and just kind of see what people back then knew and didn't know and predicted and were right about. And especially I wonder what kind of choices did they make that survive until this day, kind of arbitrary choices that someone made in some paper that just stuck around. It's interesting to see. And there will be a series of kind of classical papers that I will extend from time to time. And I hope you enjoy that. Also want to do more a bit of live coding videos. Lots of people have requested that. I'm not the best coder in the world, but I have done my fair share of machine learning research hands on. I have lots of more stupid ideas that might or might not work out and I'm very happy to implement them live. Then next thing I want to branch out in topics, maybe more exotic things. Causality is a big thing. Quantum machine learning, what not, more practical applications, robotics control, also fairness. A lot of people, especially after the Yann LeCun video, asked me to look more into the fairness literature. I am naturally very interested in that and approach it from kind of a technical but also a societal standpoint. Throughout all of that I would like to include the community more. So you. I don't really know how to do that properly yet. So here's the first thing that I'm going to include you. If you have a good idea of how to do more community inclusion in the channel's content, please tell me because I think the community has lots of stuff to give. And it would be a shame if it were only me always doing all the things where other people would be much better at it. OK, the last question on this is a question that I get very often and that is how do I select papers? And there seems to be a misconception in this. So let me tell you, I select papers by what interests me and that alone. If I make a video about a paper, it means that I found it interesting enough to read it and I found it interesting enough to make a video about it. Now, this can be accelerated by sending me appropriate amounts of protein and carbohydrates. But generally, me making a video is not an endorsement of a paper. It doesn't mean that this paper is the most important paper or influential. It doesn't mean anything beyond I find it interesting. If I ever get sponsored deals, I'll let you know that a video is sponsored. And that's that. I will not change how I select papers. I will not go by some kind of impact. I would like to branch out my content. I see the danger in only kind of covering what the big companies do, but honestly, they do a lot of interesting stuff. They do a lot of stuff and I'm constantly looking at research that's kind of outside the box. Whatever is interesting, you know, that's what it's going to be. I will not start going by some impact factor and I will not start politicizing my paper review selection any time soon. You know, I've already had multiple people, high profile people come to me and say, well, with your platform, couldn't you once a week take a paper where the first author is an underrepresented minority and review that? And, you know, I appreciate the sentiment behind it and I see where it comes from. But if you consider the practical implications of something like this, like I'd have to, you know, go through papers, Google the first author, kind of try to find a talk or a picture of them and estimate whether the melanin content in their skin is high enough for this to qualify now. And something like this and just the thought of this, how someone could do something like this and not start to vomit is just beyond me. I don't know what to say other than that. So let me say this. If your thinking leads you to a place where it's necessary to treat people differently based on the color of their skin, you're wrong. Like, that's my opinion. But you're wrong. The answer to bias cannot consist of more bias. That's that. I do not care how the person that wrote a paper looks like. If your paper is on this channel, it means your work was interesting to me. And I hope that can be my contribution to making the community more fair and just. OK, 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. I didn't want to kind of trick people into thinking that I was going to continue this forever. Again, financial support is not my main goal here. And it is completely, absolutely and utterly voluntary. And so I just want to have that out there. So I have made a Patreon page. I do have some reservation with respect to Patreon because of free speech issues and so on. So I've also made a Subscribestar page. Both are equal. Both have equal tiers. All the tiers are equal. There's no option where it just where you could just put an amount which I would like. So I just try to make a bunch of tiers. 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 OneNote document of the papers that I review. I mean, it's not very helpful because I mostly scribble and it's going to be like subdividing the pages weirdly. Maybe it has more of a symbolic value and if you're really into that, you know, at least there's something. I've also made a bunch of crypto wallets. So if you'd rather want to use that to 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 thank anyone that does. I am also going to experiment with ads on the videos. And as creators, we have kind of different options of which ads are displayed and how often and so on. I find mid video ads annoying. I find non-skippable ads annoying and so on. I'm really counting on you here to give me feedback after various videos of how much the ads annoy you, which ones annoy you, which ones don't. I'm really counting on you. 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 going to work out. But, you know, maybe if you have fun t-shirt ideas or so, just let me know. All right. That was the update. As I said, I probably won't be reading comments too much, but I will catch up after the break. And I hope you continue enjoying this channel even with kind of the lower upload frequency and the new types of content that come in. If you do have suggestions for new exotic content that vaguely has to do with machine learning or not, let me know. Let me know what you think of anything I said. And I wish you an awesome summer. And I hope to see you here anytime. Ciao.
[ { "start": 0, "end": 7.5, "text": " Yes, you read that right. I am going on a break. Don't worry though, there will still be videos, just not as many." }, { "start": 7.5, "end": 14.5, "text": " I've decided to basically reduce the upload frequency a little bit, mostly because I am going on a break," }, { "start": 14.5, "end": 20, "text": " but also because I kind of want to have time to do other things, but we'll get to that later." }, { "start": 20, "end": 24, "text": " So how's our little channel doing? We've just passed 1 million views." }, { "start": 24, "end": 34.5, "text": " 1 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 a video." }, { "start": 34.5, "end": 37.5, "text": " I think, I still think that's a net gain, honestly." }, { "start": 37.5, "end": 46, "text": " The channel just surpassed 30,000 subscribers, so technically in log space we're already halfway to 100,000." }, { "start": 46, "end": 50, "text": " It's only a matter of time. And I think I've said this in the last update," }, { "start": 50, "end": 59, "text": " but this is just absolutely overwhelming how many people are interested in machine learning research and topics related to it." }, { "start": 59, "end": 62.5, "text": " So that's pretty cool and encouraging." }, { "start": 62.5, "end": 71, "text": " Thank you everyone who has already subscribed, and especially the people that leave comments, the people that share the videos." }, { "start": 71, "end": 74.5, "text": " This means a lot and I think it's awesome." }, { "start": 74.5, "end": 78, "text": " And it's quite motivating to continue doing this, honestly." }, { "start": 78, "end": 80, "text": " I'm having lots of fun." }, { "start": 80, "end": 86.5, "text": " Along with that, I've gained almost 5,000 Twitter followers. I think more than 5,000 Twitter followers." }, { "start": 86.5, "end": 91.5, "text": " Which is strange, because Twitter is weird." }, { "start": 91.5, "end": 96.5, "text": " But, you know. So that's pretty cool, I guess." }, { "start": 96.5, "end": 100.5, "text": " I wonder if all of those are subscribed to the channel." }, { "start": 100.5, "end": 111, "text": " 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." }, { "start": 111, "end": 119.5, "text": " You people are absolutely great. The comment sections are just so much better than anything else on the entire internet." }, { "start": 119.5, "end": 123, "text": " Including paper reviews at major conferences." }, { "start": 123, "end": 131, "text": " Really, this is a half joke that the comment section is better than the reviews on papers, but it is actually very often true." }, { "start": 131, "end": 141, "text": " People are discussing ideas in the comments that are valuable and creative and asking interesting questions and helping each other out." }, { "start": 141, "end": 143.5, "text": " And that also counts for our Discord server." }, { "start": 143.5, "end": 148, "text": " So if you're not on our Discord server, we do have one." }, { "start": 148, "end": 150.5, "text": " There is a channel for beginners question." }, { "start": 150.5, "end": 154, "text": " There's a channel for discussing the videos that are on the YouTube channel." }, { "start": 154, "end": 157.5, "text": " And people are generally very, very helpful there." }, { "start": 157.5, "end": 167, "text": " 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." }, { "start": 167, "end": 172, "text": " That being said, I'm also on a number of other platforms such as LinkedIn." }, { "start": 172, "end": 177, "text": " I finally made a LinkedIn account. I was always kind of sceptic." }, { "start": 177, "end": 182, "text": " I don't know how LinkedIn works. What is the difference between follow and connect?" }, { "start": 182, "end": 188, "text": " And then people write little messages while connecting and it says, I'd love to connect." }, { "start": 188, "end": 196, "text": " But then you accept them and then that message pops up and then it's saying, I'd love to connect, but you've already connected at that point." }, { "start": 196, "end": 201, "text": " This is weird. How does LinkedIn work? Someone tell me. What is it for?" }, { "start": 201, "end": 204, "text": " I get it. It's like professional social networking." }, { "start": 204, "end": 212, "text": " Ah, it's just it seems weird to me. OK, but there is an entire community there and I do post my videos there." }, { "start": 212, "end": 216, "text": " I'm not like super active on LinkedIn. I have to say that." }, { "start": 216, "end": 221, "text": " I'm also on BitChute, Minds, Parlor." }, { "start": 221, "end": 228, "text": " So the reason why I'm mentioning these things is that with recent developments, especially around this Yann LeCun video," }, { "start": 228, "end": 238, "text": " there were some developments that potentially threatened the existence of this channel and I don't want to make it a single point of failure." }, { "start": 238, "end": 246, "text": " So I would appreciate it if you'd follow me on at least one other thing, at least one other point of contact" }, { "start": 246, "end": 257, "text": " so that in the case that something might happen, which is unlikely, but you know, can I still have a way of distributing this content?" }, { "start": 257, "end": 261, "text": " All the links are in the video description. I'd love to see you there wherever." }, { "start": 261, "end": 269, "text": " So with respect to the Yann LeCun situation, he has left Twitter now de facto." }, { "start": 269, "end": 274, "text": " And people wanted me to kind of make a follow up video, asked me about it." }, { "start": 274, "end": 284, "text": " But I feel, you know, I have I have nothing more substantial to say and just to make a video for video's sake is not really a thing I want to go into general." }, { "start": 284, "end": 292, "text": " It's kind of sad, but these kind of news and drama videos, they do get a lot of attention, not like outrages, but they do get." }, { "start": 292, "end": 301, "text": " 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." }, { "start": 301, "end": 308, "text": " You know, Yann LeCun is an adult and he's able to make his decisions of whether he wants to leave Twitter or not." }, { "start": 308, "end": 312, "text": " It's probably for the better for his mental health." }, { "start": 312, "end": 320, "text": " 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." }, { "start": 320, "end": 329, "text": " Ha, checkmate. So that's how this works and how we ultimately end up with many more machine learners than originally wanted to be." }, { "start": 329, "end": 336, "text": " We gotcha. So in other news, Flatland, round one of Flatland has officially started." }, { "start": 336, "end": 340, "text": " And I've previously made a video about Flatland. It is a NeurIPS challenge." }, { "start": 340, "end": 346, "text": " It is a challenge where you have to route trains around a 2D map." }, { "start": 346, "end": 350, "text": " And I wanted to make this kind of a community project where we do research together," }, { "start": 350, "end": 358, "text": " hopefully do something with machine learning, with reinforcement learning to tackle this problem and to crush the challenge." }, { "start": 358, "end": 366, "text": " And this is looking extremely good. So on our Discord server, there is a core group of people that is really engaged." }, { "start": 366, "end": 375, "text": " 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." }, { "start": 375, "end": 381, "text": " I really want to have time to do more myself in the Flatland research group that we have." }, { "start": 381, "end": 389, "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, "end": 393, "text": " There is a core group right now that is really pushing forward." }, { "start": 393, "end": 404, "text": " So just to highlight a few of them, there is Novik, Edward Durek, Dolash, Frostbite, China CEO, trademarked, Ai Adrian and I'm Peter." }, { "start": 404, "end": 409, "text": " And I forgot NuberPonage. I'm so sorry, NuberPonage. You're beautiful." }, { "start": 409, "end": 418, "text": " These people are helping each other reach more and better performance, profiling code, implementing parts from other papers." }, { "start": 418, "end": 423, "text": " And it's just great to see that people can collaborate on this, even though it's technically a competition." }, { "start": 423, "end": 427, "text": " But, you know, I guess we're competing against nature." }, { "start": 427, "end": 433, "text": " For anyone I haven't mentioned here, I'm very, very sorry. Any list of names is always prone to leave people out." }, { "start": 433, "end": 436, "text": " I do not want to diminish your impact." }, { "start": 436, "end": 444, "text": " So right now, this DQN algorithm is able to reach about a 95 percent success rate with three to five agents on the map." }, { "start": 444, "end": 452, "text": " So three to five trains. But round one has just started and we see that some of these environments have many, many more agents in them." }, { "start": 452, "end": 459, "text": " So there's still a lot of work to do. So we need you to come and contribute and join the fun." }, { "start": 459, "end": 466, "text": " It is fun. And as I said, I will be working on this myself more as well because it's fun." }, { "start": 466, "end": 473, "text": " So again, big shout out to anyone on this court that has contributed in any way." }, { "start": 473, "end": 482, "text": " This is just awesome. We've just had recently our first Flatland Town Hall with entirely community generated content." }, { "start": 482, "end": 492, "text": " So these people came together and basically joined in making one PowerPoint presentation and then presented to each other their knowledge of the environment." }, { "start": 492, "end": 502, "text": " 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." }, { "start": 502, "end": 508, "text": " This was just unprecedented for me, the amount of contributions there." }, { "start": 508, "end": 515, "text": " The first town hall is available if you join this court. It's linked there. It's recorded. You can still see it." }, { "start": 515, "end": 522, "text": " And as I said, there's still plenty of time to join the competition together with us." }, { "start": 522, "end": 531, "text": " OK, next thing, you've probably seen the SpineNet video and the thumbnail there was excessively beautiful." }, { "start": 531, "end": 540, "text": " So the story behind it is on the Discord server, I've asked people to help me with the thumbnail, which was originally rather boring." }, { "start": 540, "end": 544, "text": " And I just kind of wanted to know which subtitle I should put there." }, { "start": 544, "end": 557, "text": " And then one of the Discord members, Lucas Ferreira, just gone ahead and drawn up this very beautiful image of a SpineNet robot that has the SpineNet as a spine." }, { "start": 557, "end": 567, "text": " 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." }, { "start": 567, "end": 577, "text": " 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." }, { "start": 577, "end": 589, "text": " 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." }, { "start": 589, "end": 597, "text": " 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." }, { "start": 597, "end": 604, "text": " OK, so how does this channel go forward? I want to make the content a bit more diverse and kind of branch out." }, { "start": 604, "end": 613, "text": " And as I already said, the upload frequency will be sort of lower after my break and also during my break." }, { "start": 613, "end": 618, "text": " But I have some ideas of how to generate kind of more interesting content or different content." }, { "start": 618, "end": 624, "text": " So here are my ideas. And this is a list. And please tell me what you think of it." }, { "start": 624, "end": 628, "text": " And you can do this at this video and you can do this at any point." }, { "start": 628, "end": 635, "text": " You can give feedback about what kind of videos you like, what kind of style of videos you like, anything." }, { "start": 635, "end": 642, "text": " Really, I'm happy to listen to people and incorporate all the feedback that I can." }, { "start": 642, "end": 653, "text": " So I want to do some more channel updates, maybe more frequently, maybe once every two or 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." }, { "start": 653, "end": 658, "text": " This should be fun. So another idea I had is to look at kind of historical papers." }, { "start": 658, "end": 662, "text": " And I think I got the idea from a comment in my comment section." }, { "start": 662, "end": 676, "text": " So shout out to whoever lifted me to that. It's a great idea to basically go back to historical papers and just kind of see what people back then knew and didn't know and predicted and were right about." }, { "start": 676, "end": 688, "text": " 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." }, { "start": 688, "end": 697, "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. And I hope you enjoy that." }, { "start": 697, "end": 708, "text": " 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." }, { "start": 708, "end": 715, "text": " I have lots of more stupid ideas that might or might not work out and I'm very happy to implement them live." }, { "start": 715, "end": 728, "text": " Then next thing I want to branch out in topics, maybe more exotic things. Causality is a big thing. Quantum machine learning, what not, more practical applications, robotics control, also fairness." }, { "start": 728, "end": 742, "text": " A lot of people, especially after the Yann LeCun video, asked me to look more into the fairness literature. I am naturally very interested in that and approach it from kind of a technical but also a societal standpoint." }, { "start": 742, "end": 754, "text": " 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." }, { "start": 754, "end": 764, "text": " If you have a good idea of how to do more community inclusion in the channel's content, please tell me because I think the community has lots of stuff to give." }, { "start": 764, "end": 772, "text": " 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." }, { "start": 772, "end": 779, "text": " OK, the last question on this is a question that I get very often and that is how do I select papers?" }, { "start": 779, "end": 789, "text": " And there seems to be a misconception in this. So let me tell you, I select papers by what interests me and that alone." }, { "start": 789, "end": 798, "text": " 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." }, { "start": 798, "end": 804, "text": " Now, this can be accelerated by sending me appropriate amounts of protein and carbohydrates." }, { "start": 804, "end": 813, "text": " 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." }, { "start": 813, "end": 821, "text": " It doesn't mean anything beyond I find it interesting. If I ever get sponsored deals, I'll let you know that a video is sponsored." }, { "start": 821, "end": 830, "text": " 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." }, { "start": 830, "end": 837, "text": " I see the danger in only kind of covering what the big companies do, but honestly, they do a lot of interesting stuff." }, { "start": 837, "end": 841, "text": " They do a lot of stuff and I'm constantly looking at research that's kind of outside the box." }, { "start": 841, "end": 845, "text": " Whatever is interesting, you know, that's what it's going to be." }, { "start": 845, "end": 854, "text": " I will not start going by some impact factor and I will not start politicizing my paper review selection any time soon." }, { "start": 854, "end": 862, "text": " You know, I've already had multiple people, high profile people come to me and say, well, with your platform," }, { "start": 862, "end": 872, "text": " couldn't you once a week take a paper where the first author is an underrepresented minority and review that?" }, { "start": 872, "end": 878, "text": " And, you know, I appreciate the sentiment behind it and I see where it comes from." }, { "start": 878, "end": 887, "text": " 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," }, { "start": 887, "end": 899, "text": " kind of try to find a talk or a picture of them and estimate whether the melanin content in their skin is high enough for this to qualify now." }, { "start": 899, "end": 910, "text": " And something like this and just the thought of this, how someone could do something like this and not start to vomit is just beyond me." }, { "start": 910, "end": 914, "text": " I don't know what to say other than that. So let me say this." }, { "start": 914, "end": 927, "text": " If your thinking leads you to a place where it's necessary to treat people differently based on the color of their skin, you're wrong." }, { "start": 927, "end": 937, "text": " Like, that's my opinion. But you're wrong. The answer to bias cannot consist of more bias." }, { "start": 937, "end": 942, "text": " That's that. I do not care how the person that wrote a paper looks like." }, { "start": 942, "end": 946, "text": " If your paper is on this channel, it means your work was interesting to me." }, { "start": 946, "end": 951, "text": " And I hope that can be my contribution to making the community more fair and just." }, { "start": 951, "end": 957, "text": " OK, last thing. Lots of people have asked me if I had a Patreon or something like this." }, { "start": 957, "end": 967, "text": " And I've sort of resisted that kind of stuff until now, mainly because I knew that the day would come when I reduce my upload frequency." }, { "start": 967, "end": 974, "text": " I didn't want to kind of trick people into thinking that I was going to continue this forever." }, { "start": 974, "end": 979, "text": " Again, financial support is not my main goal here." }, { "start": 979, "end": 987, "text": " And it is completely, absolutely and utterly voluntary. And so I just want to have that out there." }, { "start": 987, "end": 996, "text": " So I have made a Patreon page. I do have some reservation with respect to Patreon because of free speech issues and so on." }, { "start": 996, "end": 1003, "text": " So I've also made a Subscribestar page. Both are equal. Both have equal tiers. All the tiers are equal." }, { "start": 1003, "end": 1008, "text": " There's no option where it just where you could just put an amount which I would like." }, { "start": 1008, "end": 1011, "text": " So I just try to make a bunch of tiers. All of them are equal." }, { "start": 1011, "end": 1014, "text": " So I have to ask myself, what do I give as a benefit?" }, { "start": 1014, "end": 1022, "text": " 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," }, { "start": 1022, "end": 1030, "text": " including people that don't have money to go to good universities that might live in other parts of the world" }, { "start": 1030, "end": 1034, "text": " where education is not as available, where resources are not as available." }, { "start": 1034, "end": 1037, "text": " To give extra content to people that pay seems to be..." }, { "start": 1037, "end": 1044, "text": " So I thought, okay, what I could give to the people that do support me on these pages is" }, { "start": 1044, "end": 1052, "text": " you will get a PDF of my scribbled OneNote document of the papers that I review." }, { "start": 1052, "end": 1058, "text": " I mean, it's not very helpful because I mostly scribble and it's going to be like subdividing the pages weirdly." }, { "start": 1058, "end": 1065, "text": " Maybe it has more of a symbolic value and if you're really into that, you know, at least there's something." }, { "start": 1065, "end": 1076, "text": " I've also made a bunch of crypto wallets. So if you'd rather want to use that to support me, you are welcome to do so." }, { "start": 1076, "end": 1080, "text": " All the links are in the description of the video." }, { "start": 1080, "end": 1085, "text": " Again, financial support, very, very, very optional and very voluntary." }, { "start": 1085, "end": 1088, "text": " Though, of course, I do thank anyone that does." }, { "start": 1088, "end": 1092, "text": " I am also going to experiment with ads on the videos." }, { "start": 1092, "end": 1098, "text": " And as creators, we have kind of different options of which ads are displayed and how often and so on." }, { "start": 1098, "end": 1103, "text": " I find mid video ads annoying. I find non-skippable ads annoying and so on." }, { "start": 1103, "end": 1110, "text": " I'm really counting on you here to give me feedback after various videos of how much the ads annoy you," }, { "start": 1110, "end": 1114, "text": " which ones annoy you, which ones don't. I'm really counting on you. Okay." }, { "start": 1114, "end": 1122, "text": " Okay, last thing I am planning, planning on a line of merch, mainly because I think it's funny." }, { "start": 1122, "end": 1129, "text": " But I don't know if that's going to work out. But, you know, maybe if you have fun t-shirt ideas or so, just let me know." }, { "start": 1129, "end": 1131, "text": " All right. That was the update." }, { "start": 1131, "end": 1137, "text": " As I said, I probably won't be reading comments too much, but I will catch up after the break." }, { "start": 1137, "end": 1146, "text": " And I hope you continue enjoying this channel even with kind of the lower upload frequency and the new types of content that come in." }, { "start": 1146, "end": 1154, "text": " If you do have suggestions for new exotic content that vaguely has to do with machine learning or not, let me know." }, { "start": 1154, "end": 1156, "text": " Let me know what you think of anything I said." }, { "start": 1156, "end": 1160, "text": " And I wish you an awesome summer." }, { "start": 1160, "end": 1176, "text": " And I hope to see you here anytime. Ciao." } ]
5IRlUVrEVL8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Deep Ensembles: A Loss Landscape Perspective (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ensembles", "bayesian", "modes", "loss function", "nonconvex", "google", "deepmind", "stan fort", "foundational", "weight space", "labels", "agreement", "minima", "loss landscape", "trajectory", "local minima", "optimization" ]
#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 lost landscape perspective by Stanislav Fort, Hui Yi Hu and Balaji Lakshminarayanan. This paper on a high level explains the lost landscape of deep ensemble models, so ensembles of deep neural network. And it hypothesizes, and it shows through experiments, that each member of the ensemble, by means of being initialized at a random point, will go and, through optimization, go and end up at a different place in weight space. And therefore the deep ensemble is able to capture different modes of the functional space, of the space of solutions. They compare this to Bayesian networks, which are sort of promised to do the same thing, but they often only characterize a single mode, and therefore they don't generalize as well. So join me exploring this paper, I think it's 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, you know, 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, you know, giant resources of compute, even though this is by DeepMind. But I do believe that this kind of research is still, you know, 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 tell me what you think, and leave a like if you enjoyed it. All right, so we'll start off. The abstract says, deep ensembles have been empirically shown to be a promising approach for improving accuracy, uncertainty, and out-of-distribution robustness of deep learning models. So what are deep ensembles? Really quick, an ensemble model, and we're in the classification setting. So in the classification setting, we have data points, and each data point has features, so which are the x, x is some kind of d-dimensional feature, and then you have y, which is the label. So that's in some, let's say that's some natural number or something like this, or is element of a class set. Now that's the complex numbers. It's element of some bounded set of class labels, so it's either a cat or a dog or you know, 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 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 network of many, many layers. If you build an ensemble now, what you would do is you would take the data set and simply train multiple different ones of these deep neural networks. So you'll train multiple different ones. And if you now want to classify data point, you'll input that data point into all of these three. And at the end, you would somehow aggregate, and there are different methods of doing this, but the most obvious one is simply either to aggregate by the mean or the mode, median, whatever you want, you could also kind of also learn something here. But you can just average the predictions. And that will usually give you a better prediction than if you only have one model. So this is called an ensemble model. And if the ensemble members, these things here are neural networks or deep networks, this is called a deep ensemble. So why do we hope to become better? That's the point of this paper is to show what happens in the lost landscape of these deep neural networks. And why do they perform better than other methods that are supposed to achieve the same thing. So usually, when you build an ensemble model, what are you hoping for? You're hoping to sort of learn a generalizable function. And they have this drawing right here, where it's a bit of a you have to sort of think differently than you usually do. So on the x axis, you have the space of solutions. So imagine that your, your neural network only has a single weight. So this axis here is that single weight, or you can project or or whatnot, this is the space of different solutions. So after you optimize, you land somewhere on this axis. And you can see that there is a solid line which represents the accuracy on the training set. And then there is a dashed line which represents the accuracy of the validation set for a given parameter. So what you usually do is you optimize one neural network to its very best training accuracy. So let's say you start off here, what you would do is you would see my training accuracy is this high, I need a different color right here is this high. And you calculate the gradient, and you could do gradient descent. And that means you go down the loss up the accuracy. So you go over and over and over until you reach this point right here, where you have maximum training accuracy, and then you'll suffer some generalization loss like you're gonna see right here, it's all for some generalization loss, because the validation accuracy at that point isn't as high. But generally, it's correlated, as you can see, by the general overlap of these two lines of these two shapes right here. Okay, so this is called a maximum a posteriori estimate, you simply optimize one neural network until the best training error. There are different approaches right here, there are approaches that say, okay, we can do we could do better. So first of all, what you see right here is rather peculiar. And you might not be used to this, that there are different peaks right here, there are different peaks, as you can see in the training and the validation error. So they're correlated. And the idea is that neural networks are very nonlinear. And we've known from other papers that they have many, many local minima. And in fact, so this is one of the astounding things about neural network, most of these minima are performing equally well. So even though the neural network has different local minima, they all perform about equally well. And other papers even say they're all sort of connected on a low loss landscape. So there are many, many things that are still mysterious about neural network. But we know that there are multiple minima. And we know that we basically need to find one of them. And it doesn't really matter which one 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 there are approaches to say, why don't we just capture this entire curve right here. So if we could build a model that could not only tell us at this point right here, you're this good, but could tell us that at any point, how good we are captured 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 posteriors in closed 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're, 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 multimodal solutions. Another approach is a deep ensemble. Now, this paper shows that in general, if you train a deep ensemble, what will happen is because you randomly initialize the deep ensemble, at some points, it will happen that if you do gradient descent on all of them, they will end up sort of covering all these different modes, they still they don't have an idea of you know, the curvature, 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 you have to capture one of the peaks, but really accurately. So, their hypothesis here is that deep ensembles do this job of capturing the different modes of the functional space much better than the Bayesian methods. And it is why the deep methods, sorry, why the deep ensembles work so well, because they end up in different minima. And that is, it's really interesting proposition. And what I find really interesting as well are the experiments that they do to show this. So they have a lot of these experiments right here. First of all, to the setup, they use C410, C4100, and so on. And on C410, you can see right here, they use a small CNN, medium CNN, and a ResNet. Now the small CNN and a ResNet. Now the small and medium CNNs, their accuracy is really, really subpar. So, take the results here with some grain of salt, because there are effects in these neural network that are really qualitatively different if you are seriously underperforming, like this one, like if you have a seriously too small network rather than a large network. Now they do verify all of their things also with this large network and 90% accuracy is acceptable for 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 does training of neural networks do? And they reach some very, very cool conclusions that even are independent of deep ensembles. So here, the first thing we do is we have some initial random initialization in weight 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 end up at a different minimum. Okay, this is a property. So these are not convex functions, right? We know about neural networks, you'll end up a different minima, but the minima, they will, they will perform about equally well. So the question is, do those different minima that perform equally well, describe the same function? Or are they fundamentally different functions that just happen to reach the same accuracy? And the question is very interesting. And this paper attempts to answer that. So here you can see in the description, on the left, cosine similarity between checkpoints to measure weight space alignment along optimization trajectory. So we only consider one of these runs, only consider the left one, for example, and you plot it here, and here, this later one comes later, sorry. So you plot the left only a single run, and you ask yourself, the checkpoint that I have after epoch 20, how similar is it to the checkpoint that I have after epoch five? That 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's a decent chance that they describe the same thing. So as you can see here, we go as we go down the optimization trajectory, of course, each one is similar to themselves. But you can see that there is kind of a shift right here. So at the beginning, the zero of checkpoint is very dissimilar to the checkpoint at the end. But after very short while, you kind of cross over, and then all these checkpoints right here are sort of similar. So the if you just look at two rows, you look at the bottom row, and you look at the top row, the bottom row tells you how similar are the checkpoints during training to the initial checkpoint. And you can see pretty quickly, they are very dissimilar. So at this point right here, there 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 lost landscape, right? You initialize randomly somewhere here. And then you go go go and at some point you fall into one of one of those valleys, and then you simply go to that to that valley. If you initialize somewhere differently, you can see that at the beginning, you might be here somewhere, and then you fall into that valley over here. And after that, you're pretty much set. So this is going to be our hypothesis from now on that in these neural networks, you the initialization is basically you you're somewhere and you kind of meander around a bit until you happen to go into one of these directions, which happens pretty quickly. And then you fall into a hole basically. And that's that's rather a convex setting in that thing. Okay, a really interesting thing that they do is a really interesting thing is that they check the disagreement of predictions. So you might think that if a neural network achieves 65 or 90, let's call it 90% accuracy on C410, right, that there are just you know, there are this data set, that's 100%. And there are just these 10% over here, that are just the hardest, right. And the more you train, the more are you you're able to push this boundary to the right. So if you train more, if you have a better network, you're just able to explain more and more of the samples. However, this this experiment here is going to show that this is not the case. What they measure is the disagreement in predictions, which basically means that if I there is this data set, the validation data set, and if I have one random initialization and I train it to 90% accuracy, it will have it will say these, it will not be able to classify these here. But if I have the same network, but a different initialization, it might not be able to classify these over here, but will be perfectly able to classify these over here. Right. This is a very, also very interesting property. And you can see right here, the disagreement of predictions as you go through the training. So again, we're going to look at the bottom and the top row. So the bottom row, and the top row, red is very disagreeing, blue is very agreeing. You can see again, that that I introduced, again, I introduced the different runs, I'm already taking this away from later, we are just looking at one single run for now. This this is a result that's going to come up later, when we look at two different runs of the same neural network. And that's the astounding part. Okay, here, we're just going to look at one run again during training. So we can see right here at the beginning, of course, every checkpoint agrees with itself on the predictions. However, you can see that pretty quickly, the checkpoints start disagreeing very quickly, everything is red right here. However, on the top, you can see how much how much do these checkpoints agree with the end with the 30th epoch checkpoint, and see that there is a period that is red, right from here to let's say here. And then after that, they all start agreeing. So from here on out, it's all pretty blue, which basically means that that they agree with the last checkpoint. So with the that all of these agree with the end of the training. Again, this is our hypothesis here that once you're in this valley, that the function kind of stays the same, and you only sort of micro optimize the function. However, at the beginning, you decide into which of those valleys you want to go. And the different initializations will lead you to different valleys. And that's what they show right here. So they do a t-sne plot of predictions t-sne is a method to project to down project high dimensional vectors. And this is the weight space projected to two dimensions. So t-sne x is 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 multi at different places. And what we're wondering is we already know that a single network is very different at the end than at the beginning of training. What we want to know is 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'm seeing here. So using two different architectures, okay, for each of these architectures, the left subplot shows the cosine similarity between the different solution weight space, and the right subplot shows the fraction of labels on which the predictions from different solutions disagree. Okay, so it's the same as before, the left is the alignment. And now it's not during training. Now we restart independently, we train the same network 10 different times. And after that, we're going to compare the 10 different solutions. Remember, these all achieve roughly the same accuracy on the data sets. And this is the same whether you go to a big architecture like this ResNet 20, or to a small architecture like this small CNN right here. You can see that every single solution, of course, agrees a lot with itself. That's the diagonal right here. But it's completely, 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's, you know, some symmetry in weight space because, you know, if I have a neural network, I can just exchange the connections. And if I also exchange the neurons, then it will be the same function. However, you can see right here that they completely disagree. So this small CNN, remember, it had like a 65% accuracy, the solutions, the red here, they disagree on 25% of the labels. So that this is exactly this effect we saw before, we train one solution, and it will not be able to classify these parts of the validation data set. And we train the same network with the same data set with the same loss with everything the same, again, just from a random initialization that's different, it will end up equally performing equally well, but it will make the mistakes and 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 all the kind of data points have an intrinsic hardness. And if if we get to 70% accuracy, it will always be the same 70% of data points that we miss classify or sorry, that we correctly classify. This is not the case. And this is one thing I think this paper and this line of research does pretty cool is to look at these networks in terms of their prediction agreement. So they go further and they compare this to four different methods. So they say, okay, ensembles, ensembles are one method of kind of doing these getting different solutions, which means we start from random initializations, but there are other ones. So for example, there is just place this correctly here, random subspace sampling. So what does it mean? They say we start at an optimized solution. So you train a network one single network, and then we choose a random direction at V in weight space, we step in that direction by choosing different values of t looking at the predictions at configurations, theta zero plus TV, we repeat this from many different V, but always the same theta zero. So in our original kind of drawing of this thing, we optimize one single network, let's say that's here. And then we sort of wiggle around in here, into different random directions. Now, of course, there's only one random direction right here. If maybe we can look at this at, at the so if here, we have the loss landscape, and maybe over here, there is a bit of a of a thing. And over here, there is a bit of a thing 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 ensembles is of course, is that they are able to capture all of the three different modes right here. But it is a way to obtain different solutions that all also perform quite well, if you only perturb your solution by a little bit, it also works quite well. And you can build an ensemble out of these methods right here, you can build an ensemble out of these. In fact, these Bayesian methods, if you do these approximations with Gaussians, that's pretty much what they will end up doing is they will end up characterizing the local, the local landscape around one of these minimum. But here, we simply do it by randomly stepping into a direction. That's the first method that we're going to investigate to obtain an ensemble of different solutions. So deep ensembles means we initially random, we randomly initialize many times and then train from scratch each member. This method here means we start from an or 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 start at an optimized solution, apply dropout with randomly chosen probability. Again, our hypothesis is going to be that this is going to keep the network rather in the sort of same kind of functional mode and not switch over diagonal Gaussian subspace. Again, we start from an optimized solution, you can see the pattern. And here we actually do some sort of a Gaussian approximation to the functional space, we calculate a mean and a standard deviation. And we draw samples of the parameters from that distribution. And then the same in a low rank regime. And here you see what happens. So here is these things, for example, the random subspaces. Here is this overlapped with the plot we saw before. So here we have three different trajectories of runs. And then at the end of each trajectory, we take the best solution, and we do this random exploration around it. And this here is the t-sne, the t-sne projection. Now this isn't, I have to say this isn't 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 we'll build an ensemble that combines points in here, and so on. And you'll see this for all the different methods that we consider here, especially the Gaussian methods. And that's a hint to why, even though Bayesian networks explicitly try to capture the entire distribution right here, what they'll end up doing is they'll simply end up capturing a single mode. And that's important because the single mode is always functionally sort of equal. We saw that this is a training trajectory, and at the end of training, after like this step right here, all the functions are pretty much the same, right? They pretty much agree with the end optimum. Whereas between the runs, 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 deep ensembles can do that so far. So this is another experiment where they show this lost landscape. And I really like these kind of plots. So what you see here is a plane, it's a 2D plane. And the 2D plane is described by three points. So one point is the origin, you see right here the origin, that's the origin of that's the zero in weight space. Okay, then what you have are the two optima. So you run an optimization, and then you 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 what you'll do is simply 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 basin of attraction, the blue one is a little bit more to this basin of attraction. So they move over and as soon as they're in, it's like boom, they go to the minimum of that basin. And this area is rather convex. And this area is rather convex. And in the middle, you can see is a less is more loss. So no solution will go there. That's how you get these different minima. That's how you get these different modes. 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? To or to maybe build different high level features from the same low level features. And maybe we're still under parameterizing these models, because not a single model can sort of look at both features at the same time, as evidenced by the fact that each of these is always going to one of these things. Or it could be that in fact, the task is way too simple. And it's it can be solved in like 500 different ways. And each of these Optima is simply one way of solving the task one way of combining feature. And it's actually completely an over specified problem. That's another hypothesis, it would be, I guess, interesting to look at these things. And I'm sure there's work on this. So you can see the same thing for optimum two right here, where, okay, go away, where you can see that optimum one, it agrees almost nothing with optimum two, right? It doesn't it doesn't agree. There's not even a hint of a valley right here, in the terms of functional similarity. That is very, very interesting. So it really means that these two things describe two different functions. They do these other plots right here, that they call diversity versus accuracy plots. So what they'll do is they are going to have different models, and they're going to look at them in terms of their diversity and their accuracy. So here, the y axis is going to be how different are these functions, and that's going to be again in fraction of labels changed normalized by the base accuracy. So here you can see, we're always start from this baseline optimum, this baseline optimum has zero diversity zero, because it agrees with itself on all the on all the different labels, of course. And then we're going to disturb that using our four methods that we defined before. So we're going to randomly subspace, we're going to drop out, we're going to Gaussian perturb it, and so on. And the more we perturb it, the more diverse our function is going to be naturally, right? Because we perturb the function, it starts disagreeing more and more and more with our original optimum. However, what we also expect is, you know, if we are in the local optimum, and maybe here, and you know, maybe the validation accuracy is sort of beside it, or a little bit larger, and so on. So if we perturb it a little bit, you know, that might not make too much to our accuracy. But if we perturb it a lot, you know, we go actually up the loss landscape, and then we get less accuracy also on the validation set. So that's what you see right here in these in these this curve right here, as you make the function more diverse, so you perturb it a little bit, you see that your accuracy doesn't suffer too much, you kind of stay at the same accuracy. But as if you make it more and more and more diverse, you can see that the accuracy suffers until the diversity of one basically means that you disagree on the maximum amount of labels that you can. And so you're sort of sort of out of this valley right here. And also, you can see that your accuracy goes to zero. So the more these functions disagree, the less their accuracy is, that seems natural. However, you can see that these red stars right here, they seem to be also very different, they seem to not agree with the original baseline optimum, but they seem to be doing perfectly fine in terms of accuracy, be at the same accuracy. And those are the independent optima, those are the optima from runs where we initialized at a different point and then also trained. And that, again, is evidence for the fact that there are probably other optima far away, where these different initializations find this here. So they are very different in terms of functional space, they're quite far apart, they predict different things. However, in terms of loss, they're almost the same or actually the same. So this is very, very cool experiments right here. And they do this for the different for different architectures. And you can see that, especially the larger architectures, this actually happens more pronounced. And they also make the point of saying, if you go to harder problems like a CIFAR 100 or an image net, this this effect is more pronounced that you can see, these here are closer together as a curve. And these these are these these are the the independent optima. So I hope you're all you're already on board and still know why we're doing these things. We're doing these things because we want to build some sort of ensemble that captures the distribution of solutions in order to generalize better. Now we have two options, either we start kind of from a an optimum and characterize the space around that optimum, which is what these methods do right here. And what also the Bayesian methods do this, even though they don't want to, because they do these approximations, because they're intractable, they're going to end up doing this. Or our other our other option is to restart training a bunch of times. And then we end up at different optima. And the point of the paper is it's better to do that than to build the ensemble out of the of these Gaussian methods or of these perturbation methods. And the paper, I guess the main claim of the paper is why that happens. And it happens because the ensemble members obtain different minima that are functionally different. Okay, so exactly, that's what they do here. So they now build ensembles out of these different things. And you can see that here on the x axis, you have the ensemble size. So how many ensemble members do you have? And the dashed lines here are the baseline accuracies if you just have a single model. And the test accuracy is plotted on the y axis. Now I actually was, I was not, that's not correct. You always build the ensemble out of random initializations. But on top of that, you do these things. So what you can see right here is, if I have this classifier, which is my original classifier, and I add on top of that, this PCA Gaussian, you know, perturbation stuff, I increase in accuracy. However, if I build an ensemble, I increase in accuracy, if I build an ensemble out of 10 members, I increase in accuracy this much. And then if, because I can do both things. So if I increase if I do an ensemble, and then on top of that to the PCA Gaussian, I gain another this much right here. So that's sort of evidence for the fact that you'd rather build an ensemble than do this, these other methods of, of approximating the Bayesian posterior of weights. So yes, I'm, I'm sort of convinced. I hope you are too. And they do a lot of they do some more experiments right here where you can see that the difference between so this is single model, sorry, this is, I guess, here, accuracy, oh, yeah, if you this is the out of distribution test, so you can take a data set, and you can corrupt it by corruption. So there are predefined data sets, but you can also do it yourself, you crop it, you can do luminosity, whatever, you can destroy parts of the image, you can see that having more ensemble members, so this is your original models, here is how they sync with increasing corruption. It almost doesn't matter which ones of these methods you do, you see the bottom one is the original model, and you gain a little bit by doing these things, but not nearly as much by building an ensemble and going here, or actually an ensemble of two members or five members, in which case you jump this much in accuracy. So these ensembles from different initializations are also very, very, are also very good at countering corruption, which you see also here. Yeah, so this is the JS divergence, okay, I've read that, but let's not go here, videos already too long. And this is the last thing is on ImageNet test set and the ImageNet 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 go from method to method, then it is between the different groups of ensembles, meaning that the ensemble is a much more pronounced effect that these other effects. So I hope I have convinced you a little bit of how these subspaces look like, how the loss landscape of neural networks look like, especially the fact that there are these different minima, and the random initializations of these different groups of models, and the random initializations will almost always hit these different minima. And the interesting part is that even though these different minima perform equally well, they are functionally very different. And an ensemble of differently initialized and independently optimized models can actually capture these different modes of the functional space. And therefore, if you build an ensemble out of that, it will generalize better, because it kind of can draw information from all of those different modes, rather than if you do some sort of Bayesian network, which will, because you have to approximate usually with Gaussians, will end up only covering one of these modes. That is sort of a good summary of what this paper says. 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 one could do. And yeah, as I said, this research is still wide open. We don't know so many things about neural network. And you know, tell me, tell me what you think is going on, actually, that that would be very interesting. And yeah, I'll see you next time. Bye bye.
[ { "start": 0, "end": 5.8, "text": " Hi there! Today we'll look at Deep Ensembles, a lost landscape perspective by Stanislav Fort," }, { "start": 5.8, "end": 12.8, "text": " Hui Yi Hu and Balaji Lakshminarayanan. This paper on a high level explains the lost landscape" }, { "start": 12.8, "end": 19.080000000000002, "text": " of deep ensemble models, so ensembles of deep neural network. And it hypothesizes, and it" }, { "start": 19.080000000000002, "end": 24.6, "text": " shows through experiments, that each member of the ensemble, by means of being initialized" }, { "start": 24.6, "end": 31.880000000000003, "text": " at a random point, will go and, through optimization, go and end up at a different place in weight" }, { "start": 31.880000000000003, "end": 36.800000000000004, "text": " space. And therefore the deep ensemble is able to capture different modes of the functional space," }, { "start": 36.800000000000004, "end": 43.08, "text": " of the space of solutions. They compare this to Bayesian networks, which are sort of promised to" }, { "start": 43.08, "end": 48.32, "text": " do the same thing, but they often only characterize a single mode, and therefore they don't generalize" }, { "start": 48.32, "end": 54.68, "text": " as well. So join me exploring this paper, I think it's a pretty cool paper. The experiments are" }, { "start": 54.68, "end": 60.92, "text": " cleverly designed to show what they're supposed to show, and I generally enjoy this type of research" }, { "start": 60.92, "end": 66.76, "text": " because it's kind of an explanatory research that shows you what's going on inside of these networks," }, { "start": 66.76, "end": 72.24000000000001, "text": " rather than, you know, chasing the next state-of-the-art number. It's also an example of research that you" }, { "start": 72.24, "end": 80.08, "text": " can still do while you don't have, you know, giant resources of compute, even though this is by" }, { "start": 80.08, "end": 86.16, "text": " DeepMind. But I do believe that this kind of research is still, you know, wide open and" }, { "start": 86.16, "end": 95.75999999999999, "text": " available to academia, and whereas the other kind, the state-of-the-art kind, slowly goes into more" }, { "start": 95.75999999999999, "end": 101.72, "text": " and more of the money game. All right, in any case, join me in reading this paper. If you like it," }, { "start": 101.72, "end": 109.08, "text": " share it out, leave a comment to tell me what you think, and leave a like if you enjoyed it." }, { "start": 109.08, "end": 117.12, "text": " All right, so we'll start off. The abstract says, deep ensembles have been empirically shown to be" }, { "start": 117.12, "end": 122.2, "text": " a promising approach for improving accuracy, uncertainty, and out-of-distribution robustness" }, { "start": 122.2, "end": 129.9, "text": " of deep learning models. So what are deep ensembles? Really quick, an ensemble model, and we're in the" }, { "start": 129.9, "end": 134.48000000000002, "text": " classification setting. So in the classification setting, we have data points, and each data point" }, { "start": 134.48000000000002, "end": 141.52, "text": " has features, so which are the x, x is some kind of d-dimensional feature, and then you have y," }, { "start": 141.52, "end": 149.72, "text": " which is the label. So that's in some, let's say that's some natural number or something like this," }, { "start": 149.72, "end": 158.48000000000002, "text": " or is element of a class set. Now that's the complex numbers. It's element of some bounded" }, { "start": 158.48, "end": 165.44, "text": " set of class labels, so it's either a cat or a dog or you know, whatever you want. So you have a" }, { "start": 165.44, "end": 173.95999999999998, "text": " data set of these things, and your plan is to use x to predict y. If you build a model, a deep neural" }, { "start": 173.95999999999998, "end": 178.35999999999999, "text": " network, for example, for this task, you would simply characterize this function here, you would" }, { "start": 178.35999999999999, "end": 185.92, "text": " parameterize it as a deep neural network of many, many layers. If you build an ensemble now, what you" }, { "start": 185.92, "end": 191.72, "text": " would do is you would take the data set and simply train multiple different ones of these deep neural" }, { "start": 191.72, "end": 198.44, "text": " networks. So you'll train multiple different ones. And if you now want to classify data point, you'll" }, { "start": 198.44, "end": 204.77999999999997, "text": " input that data point into all of these three. And at the end, you would somehow aggregate, and there" }, { "start": 204.77999999999997, "end": 210.04, "text": " are different methods of doing this, but the most obvious one is simply either to aggregate by the" }, { "start": 210.04, "end": 218.64, "text": " mean or the mode, median, whatever you want, you could also kind of also learn something here. But" }, { "start": 218.64, "end": 224.44, "text": " you can just average the predictions. And that will usually give you a better prediction than if" }, { "start": 224.44, "end": 230.28, "text": " you only have one model. So this is called an ensemble model. And if the ensemble members," }, { "start": 230.28, "end": 237.32, "text": " these things here are neural networks or deep networks, this is called a deep ensemble. So why" }, { "start": 237.32, "end": 245.44, "text": " do we hope to become better? That's the point of this paper is to show what happens in the lost" }, { "start": 245.44, "end": 252.95999999999998, "text": " landscape of these deep neural networks. And why do they perform better than other methods that are" }, { "start": 252.95999999999998, "end": 259, "text": " supposed to achieve the same thing. So usually, when you build an ensemble model, what are you" }, { "start": 259, "end": 266.88, "text": " hoping for? You're hoping to sort of learn a generalizable function. And they have this drawing" }, { "start": 266.88, "end": 274.6, "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.6, "end": 282.08, "text": " the x axis, you have the space of solutions. So imagine that your, your neural network only has a" }, { "start": 282.08, "end": 289.68, "text": " single weight. So this axis here is that single weight, or you can project or or whatnot, this is" }, { "start": 289.68, "end": 297, "text": " the space of different solutions. So after you optimize, you land somewhere on this axis. And you" }, { "start": 297, "end": 303.92, "text": " can see that there is a solid line which represents the accuracy on the training set. And then there" }, { "start": 303.92, "end": 309.96000000000004, "text": " is a dashed line which represents the accuracy of the validation set for a given parameter. So what" }, { "start": 309.96000000000004, "end": 317.84000000000003, "text": " you usually do is you optimize one neural network to its very best training accuracy. So let's say" }, { "start": 317.84, "end": 323.91999999999996, "text": " you start off here, what you would do is you would see my training accuracy is this high, I need a" }, { "start": 323.91999999999996, "end": 330.08, "text": " different color right here is this high. And you calculate the gradient, and you could do gradient" }, { "start": 330.08, "end": 336.08, "text": " descent. And that means you go down the loss up the accuracy. So you go over and over and over" }, { "start": 336.08, "end": 341.84, "text": " until you reach this point right here, where you have maximum training accuracy, and then you'll" }, { "start": 341.84, "end": 347.32, "text": " suffer some generalization loss like you're gonna see right here, it's all for some generalization" }, { "start": 347.32, "end": 351.88, "text": " loss, because the validation accuracy at that point isn't as high. But generally, it's correlated," }, { "start": 351.88, "end": 358.92, "text": " as you can see, by the general overlap of these two lines of these two shapes right here. Okay," }, { "start": 358.92, "end": 366.08, "text": " so this is called a maximum a posteriori estimate, you simply optimize one neural network until the" }, { "start": 366.08, "end": 374.76, "text": " best training error. There are different approaches right here, there are approaches that say, okay," }, { "start": 374.76, "end": 380.03999999999996, "text": " we can do we could do better. So first of all, what you see right here is rather peculiar. And" }, { "start": 380.03999999999996, "end": 385.4, "text": " you might not be used to this, that there are different peaks right here, there are different" }, { "start": 385.4, "end": 392.92, "text": " peaks, as you can see in the training and the validation error. So they're correlated. And the" }, { "start": 392.92, "end": 399.68, "text": " idea is that neural networks are very nonlinear. And we've known from other papers that they have" }, { "start": 399.68, "end": 405.6, "text": " many, many local minima. And in fact, so this is one of the astounding things about neural network," }, { "start": 405.6, "end": 412.96000000000004, "text": " most of these minima are performing equally well. So even though the neural network has different" }, { "start": 412.96000000000004, "end": 420.16, "text": " local minima, they all perform about equally well. And other papers even say they're all sort of" }, { "start": 420.16, "end": 427.6, "text": " connected on a low loss landscape. So there are many, many things that are still mysterious about" }, { "start": 427.6, "end": 434, "text": " neural network. But we know that there are multiple minima. And we know that we basically need to find" }, { "start": 434, "end": 442.32000000000005, "text": " one of them. And it doesn't really matter which one they all perform sort of equally well. Now," }, { "start": 443.44, "end": 450.16, "text": " as you can, as you might imagine, there are people who aren't really satisfied with this. And there" }, { "start": 450.16, "end": 456.88, "text": " are approaches to say, why don't we just capture this entire curve right here. So if we could build" }, { "start": 456.88, "end": 463.84, "text": " a model that could not only tell us at this point right here, you're this good, but could tell us" }, { "start": 463.84, "end": 470.64, "text": " that at any point, how good we are captured the entire distribution of solutions. And these are" }, { "start": 470.64, "end": 477.92, "text": " usually in the category of the Bayesian neural networks, they try to capture the entire distribution." }, { "start": 477.92, "end": 482.8, "text": " Of course, that's not really feasible, because you always have to calculate that posterior." }, { "start": 482.8, "end": 487.36, "text": " So what they end up doing is they do some approximation. And usually they do some sort" }, { "start": 487.36, "end": 493.12, "text": " of a multivariate Gaussian approximation, because you can calculate posteriors in closed form and so" }, { "start": 493.12, "end": 500.32, "text": " on. And this paper, this paper's hypothesis is that these can only usually capture one of these" }, { "start": 500.32, "end": 506.72, "text": " peaks. So they are very able to capture the surrounding right here, they're, they can capture" }, { "start": 506.72, "end": 513.2, "text": " very accurately what happens around this particular peak. They are very aware of the shape of the" }, { "start": 513.2, "end": 518.96, "text": " curvature here, and can tell you a lot of things about it. So they can tell you, for example, that" }, { "start": 518.96, "end": 528.5600000000001, "text": " the validation so that you might want to be a bit over here, rather than over here. But they cannot" }, { "start": 528.5600000000001, "end": 533.76, "text": " they don't generally know about these other modes, because they are only approximations." }, { "start": 533.76, "end": 540.64, "text": " They generally don't produce multimodal solutions. Another approach is a deep ensemble." }, { "start": 541.52, "end": 547.68, "text": " Now, this paper shows that in general, if you train a deep ensemble, what will happen is because" }, { "start": 547.68, "end": 555.36, "text": " you randomly initialize the deep ensemble, at some points, it will happen that if you do gradient" }, { "start": 555.36, "end": 560.56, "text": " descent on all of them, they will end up sort of covering all these different modes, they still" }, { "start": 560.56, "end": 565.1999999999999, "text": " they don't have an idea of you know, the curvature, sorry, this one shouldn't go here," }, { "start": 565.1999999999999, "end": 569.28, "text": " this one should go here, the curve, they don't really know about the curvature, but they will" }, { "start": 569.28, "end": 576.16, "text": " give you these different minima right here. And therefore, they can capture the landscape much," }, { "start": 576.16, "end": 582.4799999999999, "text": " much more easily. If you know that these three are minima, you sort of, it might look something like" }, { "start": 582.4799999999999, "end": 588.3199999999999, "text": " this. And that's a hell of a lot better than simply the Bayesian approximation that you have" }, { "start": 588.32, "end": 595.6800000000001, "text": " to capture one of the peaks, but really accurately. So, their hypothesis here is that deep ensembles" }, { "start": 595.6800000000001, "end": 604.08, "text": " do this job of capturing the different modes of the functional space much better than the Bayesian" }, { "start": 604.8000000000001, "end": 611.7600000000001, "text": " methods. And it is why the deep methods, sorry, why the deep ensembles work so well, because they" }, { "start": 611.76, "end": 618.88, "text": " end up in different minima. And that is, it's really interesting proposition. And what I find" }, { "start": 618.88, "end": 624.88, "text": " really interesting as well are the experiments that they do to show this. So they have a lot of these" }, { "start": 624.88, "end": 632.4, "text": " experiments right here. First of all, to the setup, they use C410, C4100, and so on. And on C410," }, { "start": 633.36, "end": 639.28, "text": " you can see right here, they use a small CNN, medium CNN, and a ResNet. Now the small CNN" }, { "start": 639.28, "end": 645.92, "text": " and a ResNet. Now the small and medium CNNs, their accuracy is really, really subpar. So," }, { "start": 646.72, "end": 653.4399999999999, "text": " take the results here with some grain of salt, because there are effects in these neural network" }, { "start": 653.4399999999999, "end": 659.92, "text": " that are really qualitatively different if you are seriously underperforming, like this one," }, { "start": 659.92, "end": 666.4, "text": " like if you have a seriously too small network rather than a large network. Now they do verify" }, { "start": 666.4, "end": 674, "text": " all of their things also with this large network and 90% accuracy is acceptable for C410. I don't" }, { "start": 674, "end": 679.68, "text": " think there's the big qualitative difference between 90 and 95 and so on. But the 64," }, { "start": 680.56, "end": 687.76, "text": " if it were only this, I would be rather critical of this work. But it's fine to, if you see the" }, { "start": 687.76, "end": 694.72, "text": " effect at 64, and then some of the effects you check to carry over to the 90% one, I'm going to" }, { "start": 694.72, "end": 704, "text": " generally believe you. Okay, so first of all, what they do here is they look at a training trajectory" }, { "start": 704, "end": 712.32, "text": " of just a single run. So this paper is half about ensembles, but also half generally about" }, { "start": 713.9200000000001, "end": 718.5600000000001, "text": " what does training of neural networks do? And they reach some very, very cool conclusions that even" }, { "start": 718.56, "end": 725.1199999999999, "text": " are independent of deep ensembles. So here, the first thing we do is we have some initial random" }, { "start": 725.1199999999999, "end": 730.8, "text": " initialization in weight space of your weight, and then you do gradient descent and you run and you" }, { "start": 730.8, "end": 739.04, "text": " run, right, and you get to some minima right here, some minimum right here. And then you do a second" }, { "start": 739.04, "end": 746.64, "text": " one. So you initialize somewhere else. And because you initialize somewhere else, you run, you run," }, { "start": 746.64, "end": 752.72, "text": " you run, you end up at a different minimum. Okay, this is a property. So these are not convex" }, { "start": 752.72, "end": 758, "text": " functions, right? We know about neural networks, you'll end up a different minima, but the minima," }, { "start": 758, "end": 765.4399999999999, "text": " they will, they will perform about equally well. So the question is, do those different minima that" }, { "start": 765.4399999999999, "end": 771.76, "text": " perform equally well, describe the same function? Or are they fundamentally different functions" }, { "start": 771.76, "end": 780.3199999999999, "text": " that just happen to reach the same accuracy? And the question is very interesting. And this paper" }, { "start": 781.36, "end": 788.08, "text": " attempts to answer that. So here you can see in the description, on the left, cosine similarity" }, { "start": 788.08, "end": 795.04, "text": " between checkpoints to measure weight space alignment along optimization trajectory. So we" }, { "start": 795.04, "end": 802.16, "text": " only consider one of these runs, only consider the left one, for example, and you plot it here," }, { "start": 802.16, "end": 809.36, "text": " and here, this later one comes later, sorry. So you plot the left only a single run, and you ask" }, { "start": 809.36, "end": 818.3199999999999, "text": " yourself, the checkpoint that I have after epoch 20, how similar is it to the checkpoint that I have" }, { "start": 818.32, "end": 827.0400000000001, "text": " after epoch five? That would be right here. Now, we have to read up how they compare the checkpoints." }, { "start": 827.0400000000001, "end": 833.6, "text": " And this is weight space alignment. Okay, so weight space alignment, it basically means how much do" }, { "start": 833.6, "end": 839.36, "text": " the weights align in the cosine fashion, as you can see right here, this is simply the cosine between" }, { "start": 839.36, "end": 845.9200000000001, "text": " the weights, this is one way of comparing two functions. If two functions align in weight space," }, { "start": 845.92, "end": 850.16, "text": " there's a decent chance that they describe the same thing. So as you can see here," }, { "start": 851.4399999999999, "end": 857.92, "text": " we go as we go down the optimization trajectory, of course, each one is similar to themselves. But" }, { "start": 859.12, "end": 865.36, "text": " you can see that there is kind of a shift right here. So at the beginning, the zero of checkpoint" }, { "start": 865.36, "end": 872.0799999999999, "text": " is very dissimilar to the checkpoint at the end. But after very short while, you kind of cross over," }, { "start": 872.08, "end": 876.72, "text": " and then all these checkpoints right here are sort of similar. So the" }, { "start": 879.5200000000001, "end": 884.48, "text": " if you just look at two rows, you look at the bottom row, and you look at the top row," }, { "start": 884.48, "end": 889.6, "text": " the bottom row tells you how similar are the checkpoints during training to the initial" }, { "start": 889.6, "end": 896.8000000000001, "text": " checkpoint. And you can see pretty quickly, they are very dissimilar. So at this point right here," }, { "start": 896.8, "end": 902.9599999999999, "text": " there is kind of a dissimilarity happening where the checkpoint goes away from its initialization" }, { "start": 902.9599999999999, "end": 908.88, "text": " to something else. And the top row tells you how similar are they to where the network ends up." }, { "start": 909.8399999999999, "end": 918.24, "text": " And you can see that there appears to be a period in, let's say here, where this shift away starts" }, { "start": 918.24, "end": 926.16, "text": " up until here, where it's kind of not similar to anything. But then after that, after here," }, { "start": 926.16, "end": 933.76, "text": " everything is similar to the final checkpoint. Okay, so this is sort of tells us a hypothesis is" }, { "start": 933.76, "end": 940, "text": " that you initialize randomly somewhere you have this lost landscape, right? You initialize randomly" }, { "start": 940, "end": 945.76, "text": " somewhere here. And then you go go go and at some point you fall into one of one of those valleys," }, { "start": 945.76, "end": 951.92, "text": " and then you simply go to that to that valley. If you initialize somewhere differently, you can see" }, { "start": 951.92, "end": 957.4399999999999, "text": " that at the beginning, you might be here somewhere, and then you fall into that valley over here." }, { "start": 957.4399999999999, "end": 964.4799999999999, "text": " And after that, you're pretty much set. So this is going to be our hypothesis from now on that" }, { "start": 964.4799999999999, "end": 971.04, "text": " in these neural networks, you the initialization is basically you you're somewhere and you kind of" }, { "start": 971.04, "end": 976.3199999999999, "text": " meander around a bit until you happen to go into one of these directions, which happens pretty" }, { "start": 976.32, "end": 983.9200000000001, "text": " quickly. And then you fall into a hole basically. And that's that's rather a convex setting in that" }, { "start": 983.9200000000001, "end": 993.6800000000001, "text": " thing. Okay, a really interesting thing that they do is a really interesting thing is that they check" }, { "start": 993.6800000000001, "end": 1003.2, "text": " the disagreement of predictions. So you might think that if a neural network achieves 65 or 90," }, { "start": 1003.2, "end": 1008.96, "text": " let's call it 90% accuracy on C410, right, that there are just you know, there are this data set," }, { "start": 1009.84, "end": 1016.32, "text": " that's 100%. And there are just these 10% over here, that are just the hardest, right. And the" }, { "start": 1016.32, "end": 1022.5600000000001, "text": " more you train, the more are you you're able to push this boundary to the right. So if you train" }, { "start": 1022.5600000000001, "end": 1027.68, "text": " more, if you have a better network, you're just able to explain more and more of the samples." }, { "start": 1027.68, "end": 1033.52, "text": " However, this this experiment here is going to show that this is not the case. What they measure" }, { "start": 1033.52, "end": 1039.1200000000001, "text": " is the disagreement in predictions, which basically means that if I there is this data set," }, { "start": 1039.1200000000001, "end": 1046, "text": " the validation data set, and if I have one random initialization and I train it to 90% accuracy," }, { "start": 1046, "end": 1053.2, "text": " it will have it will say these, it will not be able to classify these here. But if I have the" }, { "start": 1053.2, "end": 1059.92, "text": " same network, but a different initialization, it might not be able to classify these over here," }, { "start": 1059.92, "end": 1066.0800000000002, "text": " but will be perfectly able to classify these over here. Right. This is a very, also very interesting" }, { "start": 1066.0800000000002, "end": 1073.68, "text": " property. And you can see right here, the disagreement of predictions as you go through" }, { "start": 1073.68, "end": 1079.2, "text": " the training. So again, we're going to look at the bottom and the top row. So the bottom row," }, { "start": 1079.2, "end": 1087.04, "text": " and the top row, red is very disagreeing, blue is very agreeing. You can see again, that" }, { "start": 1088.4, "end": 1096.16, "text": " that I introduced, again, I introduced the different runs, I'm already taking this away from later," }, { "start": 1096.8, "end": 1102, "text": " we are just looking at one single run for now. This this is a result that's going to come up" }, { "start": 1102, "end": 1106.24, "text": " later, when we look at two different runs of the same neural network. And that's the astounding" }, { "start": 1106.24, "end": 1111.92, "text": " part. Okay, here, we're just going to look at one run again during training. So we can see right" }, { "start": 1111.92, "end": 1117.76, "text": " here at the beginning, of course, every checkpoint agrees with itself on the predictions. However," }, { "start": 1119.04, "end": 1124.64, "text": " you can see that pretty quickly, the checkpoints start disagreeing very quickly, everything is red" }, { "start": 1124.64, "end": 1132.24, "text": " right here. However, on the top, you can see how much how much do these checkpoints agree" }, { "start": 1132.24, "end": 1139.1200000000001, "text": " with the end with the 30th epoch checkpoint, and see that there is a period that is red," }, { "start": 1139.1200000000001, "end": 1146.88, "text": " right from here to let's say here. And then after that, they all start agreeing. So from here on out," }, { "start": 1146.88, "end": 1156.56, "text": " it's all pretty blue, which basically means that that they agree with the last checkpoint. So with" }, { "start": 1156.56, "end": 1166.1599999999999, "text": " the that all of these agree with the end of the training. Again, this is our hypothesis here that" }, { "start": 1166.1599999999999, "end": 1172.3999999999999, "text": " once you're in this valley, that the function kind of stays the same, and you only sort of" }, { "start": 1172.3999999999999, "end": 1176.96, "text": " micro optimize the function. However, at the beginning, you decide into which of those" }, { "start": 1176.96, "end": 1181.6799999999998, "text": " valleys you want to go. And the different initializations will lead you to different" }, { "start": 1181.68, "end": 1187.3600000000001, "text": " valleys. And that's what they show right here. So they do a t-sne plot of predictions t-sne is" }, { "start": 1187.3600000000001, "end": 1196.24, "text": " a method to project to down project high dimensional vectors. And this is the weight space projected to" }, { "start": 1196.24, "end": 1203.44, "text": " two dimensions. So t-sne x is one, and two, these are rather arbitrary. It's just the if you think" }, { "start": 1203.44, "end": 1209.04, "text": " of a PCA, it's the directions of maximum variance. And you can see the three different runs, they" }, { "start": 1209.04, "end": 1214.32, "text": " immediately at the beginning right here, they immediately go, you can see they have they do" }, { "start": 1214.32, "end": 1220.8, "text": " large distances at the beginning, between the steps of optimization. And they do in very" }, { "start": 1220.8, "end": 1226.08, "text": " different directions, just by means of being initialized at different points and having maybe" }, { "start": 1226.08, "end": 1232.96, "text": " a bit of noise in the training process. But once they are at the particular location, they sort of" }, { "start": 1232.96, "end": 1240.88, "text": " just kind of bounce around right here and try to find the best minima in that region. So" }, { "start": 1242.8, "end": 1248.56, "text": " this is our first indication that the if we train the same network multiple times with random" }, { "start": 1248.56, "end": 1256.24, "text": " initializations, it's going to end up at multi at different places. And what we're wondering is we" }, { "start": 1256.24, "end": 1263.68, "text": " already know that a single network is very different at the end than at the beginning of training." }, { "start": 1263.68, "end": 1269.36, "text": " What we want to know is our two networks also very different, even though they're trained on the same" }, { "start": 1269.36, "end": 1274.4, "text": " objective, just because they are at different places in the weight space doesn't mean they are" }, { "start": 1274.4, "end": 1279.44, "text": " functionally that different, there are symmetries. And it's going to turn out yes, they actually are" }, { "start": 1279.44, "end": 1289.1200000000001, "text": " very, very different. So this is right here, here you can see two different things. And we're going" }, { "start": 1289.1200000000001, "end": 1296.96, "text": " to read the plot along with it. Just so I remember what I'm seeing here. So using two different" }, { "start": 1296.96, "end": 1303.28, "text": " architectures, okay, for each of these architectures, the left subplot shows the cosine similarity" }, { "start": 1303.28, "end": 1307.76, "text": " between the different solution weight space, and the right subplot shows the fraction of labels on" }, { "start": 1307.76, "end": 1312.8799999999999, "text": " which the predictions from different solutions disagree. Okay, so it's the same as before," }, { "start": 1312.8799999999999, "end": 1319.04, "text": " the left is the alignment. And now it's not during training. Now we restart independently," }, { "start": 1319.04, "end": 1326.08, "text": " we train the same network 10 different times. And after that, we're going to compare the 10" }, { "start": 1326.08, "end": 1332.8799999999999, "text": " different solutions. Remember, these all achieve roughly the same accuracy on the data sets. And" }, { "start": 1332.88, "end": 1339.1200000000001, "text": " this is the same whether you go to a big architecture like this ResNet 20, or to a small" }, { "start": 1339.1200000000001, "end": 1345.92, "text": " architecture like this small CNN right here. You can see that every single solution, of course," }, { "start": 1345.92, "end": 1351.6000000000001, "text": " agrees a lot with itself. That's the diagonal right here. But it's completely, it's not a line," }, { "start": 1351.6000000000001, "end": 1357.1200000000001, "text": " it's completely orthogonal to all the other solutions. So all the solutions in weight space" }, { "start": 1357.1200000000001, "end": 1362, "text": " are orthogonal. Now there's still the chance that there's, you know, some symmetry in weight space" }, { "start": 1362, "end": 1371.04, "text": " because, you know, if I have a neural network, I can just exchange the connections. And if I also" }, { "start": 1371.04, "end": 1376.64, "text": " exchange the neurons, then it will be the same function. However, you can see right here that" }, { "start": 1376.64, "end": 1385.36, "text": " they completely disagree. So this small CNN, remember, it had like a 65% accuracy, the solutions," }, { "start": 1385.36, "end": 1393.28, "text": " the red here, they disagree on 25% of the labels. So that this is exactly this effect we saw before," }, { "start": 1393.28, "end": 1400, "text": " we train one solution, and it will not be able to classify these parts of the validation data set." }, { "start": 1400, "end": 1405.36, "text": " And we train the same network with the same data set with the same loss with everything the same," }, { "start": 1405.36, "end": 1410.9599999999998, "text": " again, just from a random initialization that's different, it will end up equally performing" }, { "start": 1410.96, "end": 1416.64, "text": " equally well, but it will make the mistakes and an entirely different set of the validation data" }, { "start": 1416.64, "end": 1423.8400000000001, "text": " points. Like this is rather astounding, I feel, because I think most people are of the of the idea" }, { "start": 1423.8400000000001, "end": 1432.48, "text": " that all the kind of data points have an intrinsic hardness. And if if we get to 70% accuracy," }, { "start": 1432.48, "end": 1438.24, "text": " it will always be the same 70% of data points that we miss classify or sorry, that we correctly" }, { "start": 1438.24, "end": 1444.96, "text": " classify. This is not the case. And this is one thing I think this paper and this line of research" }, { "start": 1444.96, "end": 1453.52, "text": " does pretty cool is to look at these networks in terms of their prediction agreement. So they go" }, { "start": 1453.52, "end": 1461.28, "text": " further and they compare this to four different methods. So they say, okay, ensembles, ensembles" }, { "start": 1461.28, "end": 1467.36, "text": " are one method of kind of doing these getting different solutions, which means we start from" }, { "start": 1467.36, "end": 1474, "text": " random initializations, but there are other ones. So for example, there is just place this correctly" }, { "start": 1474, "end": 1480.7199999999998, "text": " here, random subspace sampling. So what does it mean? They say we start at an optimized solution." }, { "start": 1480.7199999999998, "end": 1487.12, "text": " So you train a network one single network, and then we choose a random direction at V in weight" }, { "start": 1487.12, "end": 1491.4399999999998, "text": " space, we step in that direction by choosing different values of t looking at the predictions" }, { "start": 1491.44, "end": 1498.0800000000002, "text": " at configurations, theta zero plus TV, we repeat this from many different V, but always the same" }, { "start": 1498.0800000000002, "end": 1505.52, "text": " theta zero. So in our original kind of drawing of this thing, we optimize one single network," }, { "start": 1506.48, "end": 1512.56, "text": " let's say that's here. And then we sort of wiggle around in here, into different random" }, { "start": 1512.56, "end": 1517.3600000000001, "text": " directions. Now, of course, there's only one random direction right here. If maybe we can look at this" }, { "start": 1517.36, "end": 1524.32, "text": " at, at the so if here, we have the loss landscape, and maybe over here, there is a bit of a" }, { "start": 1524.9599999999998, "end": 1529.12, "text": " of a thing. And over here, there is a bit of a thing you thought I was going to draw." }, { "start": 1531.9199999999998, "end": 1538.3999999999999, "text": " Okay, so we start here, and maybe that converges to somewhere here. So what we're going to do is" }, { "start": 1538.3999999999999, "end": 1543.4399999999998, "text": " we're going to select random directions in that space. And we're just going to go a few steps into" }, { "start": 1543.44, "end": 1549.76, "text": " this direction and compare the weights. Now here, you can already see by the way I'm drawing it that" }, { "start": 1549.76, "end": 1557.44, "text": " this will probably make you stay in the same region. And our hope with ensembles is of course," }, { "start": 1557.44, "end": 1564.4, "text": " is that they are able to capture all of the three different modes right here. But it is a way to" }, { "start": 1564.4, "end": 1569.8400000000001, "text": " obtain different solutions that all also perform quite well, if you only perturb your solution by" }, { "start": 1569.84, "end": 1576.72, "text": " a little bit, it also works quite well. And you can build an ensemble out of these methods right" }, { "start": 1576.72, "end": 1583.12, "text": " here, you can build an ensemble out of these. In fact, these Bayesian methods, if you do these" }, { "start": 1583.12, "end": 1589.04, "text": " approximations with Gaussians, that's pretty much what they will end up doing is they will" }, { "start": 1589.04, "end": 1594.9599999999998, "text": " end up characterizing the local, the local landscape around one of these minimum. But here," }, { "start": 1594.96, "end": 1600.32, "text": " we simply do it by randomly stepping into a direction. That's the first method that we're" }, { "start": 1600.32, "end": 1608.4, "text": " going to investigate to obtain an ensemble of different solutions. So deep ensembles means we" }, { "start": 1608.4, "end": 1615.6000000000001, "text": " initially random, we randomly initialize many times and then train from scratch each member." }, { "start": 1616.48, "end": 1622.8, "text": " This method here means we start from an or from a solution and we simply perturb it into random" }, { "start": 1622.8, "end": 1631.12, "text": " directions. The next thing we can do is we can do dropout subspace dropout. We again start at an" }, { "start": 1631.12, "end": 1638.32, "text": " optimized solution, apply dropout with randomly chosen probability. Again, our hypothesis is going" }, { "start": 1638.32, "end": 1644.72, "text": " to be that this is going to keep the network rather in the sort of same kind of functional mode" }, { "start": 1644.72, "end": 1651.44, "text": " and not switch over diagonal Gaussian subspace. Again, we start from an optimized solution," }, { "start": 1651.44, "end": 1657.1200000000001, "text": " you can see the pattern. And here we actually do some sort of a Gaussian approximation to the" }, { "start": 1657.1200000000001, "end": 1663.76, "text": " functional space, we calculate a mean and a standard deviation. And we draw samples of" }, { "start": 1663.76, "end": 1671.3600000000001, "text": " the parameters from that distribution. And then the same in a low rank regime. And here you see" }, { "start": 1671.3600000000001, "end": 1677.04, "text": " what happens. So here is these things, for example, the random subspaces." }, { "start": 1677.04, "end": 1683.04, "text": " Here is this overlapped with the plot we saw before. So here we have three different trajectories" }, { "start": 1683.04, "end": 1689.2, "text": " of runs. And then at the end of each trajectory, we take the best solution, and we do this random" }, { "start": 1689.2, "end": 1696.8799999999999, "text": " exploration around it. And this here is the t-sne, the t-sne projection. Now this isn't, I have to" }, { "start": 1696.8799999999999, "end": 1702.3999999999999, "text": " say this isn't the projection of the weights itself. Sorry, I did not say that before. This is a" }, { "start": 1702.4, "end": 1711.3600000000001, "text": " projection of the predictions, I believe of a subset of data points. So this is the prediction" }, { "start": 1711.3600000000001, "end": 1719.44, "text": " projection of that. And you can see that if we perturb the solutions like this, all of these" }, { "start": 1719.44, "end": 1727.52, "text": " solutions, all of these ensembles, they rather they stay in their basin of attraction, as you can see" }, { "start": 1727.52, "end": 1734.48, "text": " right here. So with a deep ensemble, we would build an ensemble that, sorry, sorry, sorry." }, { "start": 1735.36, "end": 1741.44, "text": " We would build an ensemble that combines this point, and this point, and this point. Whereas" }, { "start": 1741.44, "end": 1748.4, "text": " here, we will simply either build an ensemble that combines points in here, or we'll build an" }, { "start": 1748.4, "end": 1753.52, "text": " ensemble that combines points in here, and so on. And you'll see this for all the different methods" }, { "start": 1753.52, "end": 1759.84, "text": " that we consider here, especially the Gaussian methods. And that's a hint to why, even though" }, { "start": 1759.84, "end": 1767.04, "text": " Bayesian networks explicitly try to capture the entire distribution right here, what they'll end" }, { "start": 1767.04, "end": 1774, "text": " up doing is they'll simply end up capturing a single mode. And that's important because the" }, { "start": 1774, "end": 1781.44, "text": " single mode is always functionally sort of equal. We saw that this is a training trajectory," }, { "start": 1781.44, "end": 1786.8, "text": " and at the end of training, after like this step right here, all the functions are pretty much the" }, { "start": 1786.8, "end": 1794.4, "text": " same, right? They pretty much agree with the end optimum. Whereas between the runs, these functions" }, { "start": 1794.4, "end": 1799.44, "text": " completely disagree with each other. So it is important if we want to build an ensemble to" }, { "start": 1799.44, "end": 1808.3200000000002, "text": " capture as many of these modes as possible, and only the deep ensembles can do that so far. So this" }, { "start": 1808.32, "end": 1815.12, "text": " is another experiment where they show this lost landscape. And I really like these kind of plots." }, { "start": 1815.12, "end": 1822.24, "text": " So what you see here is a plane, it's a 2D plane. And the 2D plane is described by three points." }, { "start": 1822.24, "end": 1828.32, "text": " So one point is the origin, you see right here the origin, that's the origin of that's the zero in" }, { "start": 1828.32, "end": 1836.96, "text": " weight space. Okay, then what you have are the two optima. So you run an optimization, and then you" }, { "start": 1836.96, "end": 1844.64, "text": " run an optimization two different times. Once it's initialized here, and it runs to here. And once" }, { "start": 1844.64, "end": 1852, "text": " it's initialized here, and it runs to here. Okay, so that defines the plane that we're going to look" }, { "start": 1852, "end": 1858.4, "text": " at. Now they for each single pixel in this plane, or actually for each single pixel in this half" }, { "start": 1858.4, "end": 1867.0400000000002, "text": " circle right here, they evaluated the networks. So what you'll do is simply do linear combination" }, { "start": 1867.0400000000002, "end": 1872.72, "text": " of these weight of the weight vector here at this optimum, the weight vector here at this optimum." }, { "start": 1873.2800000000002, "end": 1880.64, "text": " And you can for each point here defines a neural network with those weights. And you can evaluate" }, { "start": 1880.64, "end": 1886.88, "text": " it. And that's what you get. This is the accuracy of the neural network at that point. So here you" }, { "start": 1886.88, "end": 1895.6000000000001, "text": " can see very, very clearly that there are these two different modes right here. So each even though" }, { "start": 1895.6000000000001, "end": 1899.92, "text": " they're initialized super close to each other, right, you can see this right here, they're" }, { "start": 1899.92, "end": 1905.2800000000002, "text": " initialized super close to each other, because they are this is the flat area right here that" }, { "start": 1905.2800000000002, "end": 1913.1200000000001, "text": " we saw before, because they are in the flat area. They're even though they're initialized pretty" }, { "start": 1913.12, "end": 1918.7199999999998, "text": " close, the red one is a little bit more to this basin of attraction, the blue one is a little bit" }, { "start": 1918.7199999999998, "end": 1923.4399999999998, "text": " more to this basin of attraction. So they move over and as soon as they're in, it's like boom," }, { "start": 1923.4399999999998, "end": 1928.7199999999998, "text": " they go to the minimum of that basin. And this area is rather convex. And this area is rather" }, { "start": 1928.7199999999998, "end": 1936.9599999999998, "text": " convex. And in the middle, you can see is a less is more loss. So no solution will go there. That's" }, { "start": 1936.9599999999998, "end": 1941.1999999999998, "text": " how you get these different minima. That's how you get these different modes. And you can see the" }, { "start": 1941.2, "end": 1948.88, "text": " accuracy or from the color is going to be the same in each of the in each of the valleys," }, { "start": 1949.44, "end": 1957.68, "text": " consistent with our what we know so far. Now here, the pink stripe is a Gaussian exploration." }, { "start": 1957.68, "end": 1963.2, "text": " So if you now do a Gaussian perturbation Gaussian exploration around this minimum," }, { "start": 1963.2, "end": 1968.32, "text": " you basically you can see again, you don't get out of this valley, you don't you're not going to go" }, { "start": 1968.32, "end": 1975.12, "text": " to different modes, the weight space is just too large, and you're going to simply be stuck in there." }, { "start": 1975.84, "end": 1981.04, "text": " So the only chance almost you have is to initialize again, and hope that you end up in a different" }, { "start": 1981.04, "end": 1988.48, "text": " place. And I guess my hypothesis is that there are many, many more of these valleys of these basins" }, { "start": 1988.48, "end": 1994.32, "text": " than that you can you could ever capture. So basically, every single initialization that is" }, { "start": 1994.32, "end": 2002.3999999999999, "text": " different will lead you to a different one of these basins. I guess it's only a matter of this size." }, { "start": 2003.76, "end": 2010.1599999999999, "text": " So here again, they do a function similarity. So in this case, it's the function similarity" }, { "start": 2010.1599999999999, "end": 2018.6399999999999, "text": " to optimum one. And this is again, how many of the labels agree with the optimum right here." }, { "start": 2018.64, "end": 2024.48, "text": " And you can see that within this basin of attraction, you have fairly high overlap of the functional" }, { "start": 2024.48, "end": 2032.4, "text": " similarity. But here, none, right? So 15% or so, it's not going to be zero, because they're going" }, { "start": 2032.4, "end": 2038.3200000000002, "text": " to agree on like some of the examples, I guess there's still something like intrinsic hardness," }, { "start": 2038.3200000000002, "end": 2046.96, "text": " but they agree on almost none of the labels, at least I guess, if you normalize by their base" }, { "start": 2046.96, "end": 2057.84, "text": " accuracy. So even though optimum two is performing as well, it is functionally extremely dissimilar" }, { "start": 2057.84, "end": 2064.32, "text": " to optimum one. So these describe really different functions. And I really don't know what to make of" }, { "start": 2064.32, "end": 2072.16, "text": " this other than, you know, each one of these is maybe sort of deciding to look at different" }, { "start": 2072.16, "end": 2078.72, "text": " features in the in the data set, right? To or to maybe build different high level features from" }, { "start": 2078.72, "end": 2086.3999999999996, "text": " the same low level features. And maybe we're still under parameterizing these models, because not a" }, { "start": 2086.3999999999996, "end": 2092.08, "text": " single model can sort of look at both features at the same time, as evidenced by the fact that" }, { "start": 2092.7999999999997, "end": 2098.96, "text": " each of these is always going to one of these things. Or it could be that in fact, the task" }, { "start": 2098.96, "end": 2106.8, "text": " is way too simple. And it's it can be solved in like 500 different ways. And each of these" }, { "start": 2106.8, "end": 2112.2400000000002, "text": " Optima is simply one way of solving the task one way of combining feature. And it's actually" }, { "start": 2112.2400000000002, "end": 2117.6, "text": " completely an over specified problem. That's another hypothesis, it would be, I guess," }, { "start": 2117.6, "end": 2122.48, "text": " interesting to look at these things. And I'm sure there's work on this. So you can see the same thing" }, { "start": 2122.48, "end": 2134.08, "text": " for optimum two right here, where, okay, go away, where you can see that optimum one, it agrees" }, { "start": 2134.64, "end": 2140.4, "text": " almost nothing with optimum two, right? It doesn't it doesn't agree. There's not even a" }, { "start": 2140.4, "end": 2146.56, "text": " hint of a valley right here, in the terms of functional similarity. That is very, very" }, { "start": 2146.56, "end": 2153.2, "text": " interesting. So it really means that these two things describe two different functions." }, { "start": 2153.92, "end": 2160.4, "text": " They do these other plots right here, that they call diversity versus accuracy plots. So" }, { "start": 2161.68, "end": 2168.48, "text": " what they'll do is they are going to have different models, and they're going to look at them" }, { "start": 2168.48, "end": 2176.96, "text": " in terms of their diversity and their accuracy. So here, the y axis is going to be how different" }, { "start": 2176.96, "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": 2200.3199999999997, "text": " optimum has zero diversity zero, because it agrees with itself on all the on all the different labels," }, { "start": 2200.3199999999997, "end": 2207.04, "text": " of course. And then we're going to disturb that using our four methods that we defined before." }, { "start": 2207.04, "end": 2213.68, "text": " So we're going to randomly subspace, we're going to drop out, we're going to Gaussian perturb it," }, { "start": 2213.68, "end": 2218.9599999999996, "text": " and so on. And the more we perturb it, the more diverse our function is going to be naturally," }, { "start": 2218.96, "end": 2224.4, "text": " right? Because we perturb the function, it starts disagreeing more and more and more with our" }, { "start": 2224.4, "end": 2231.84, "text": " original optimum. However, what we also expect is, you know, if we are in the local optimum," }, { "start": 2231.84, "end": 2239.52, "text": " and maybe here, and you know, maybe the validation accuracy is sort of beside it, or a little bit" }, { "start": 2239.52, "end": 2245.2, "text": " larger, and so on. So if we perturb it a little bit, you know, that might not make too much to our" }, { "start": 2245.2, "end": 2250.7999999999997, "text": " accuracy. But if we perturb it a lot, you know, we go actually up the loss landscape, and then we get" }, { "start": 2250.7999999999997, "end": 2258, "text": " less accuracy also on the validation set. So that's what you see right here in these in these this" }, { "start": 2258, "end": 2264.96, "text": " curve right here, as you make the function more diverse, so you perturb it a little bit, you see" }, { "start": 2264.96, "end": 2270.96, "text": " that your accuracy doesn't suffer too much, you kind of stay at the same accuracy. But as if you" }, { "start": 2270.96, "end": 2277.52, "text": " make it more and more and more diverse, you can see that the accuracy suffers until the diversity" }, { "start": 2277.52, "end": 2284.2400000000002, "text": " of one basically means that you disagree on the maximum amount of labels that you can. And so" }, { "start": 2284.2400000000002, "end": 2291.68, "text": " you're sort of sort of out of this valley right here. And also, you can see that your accuracy" }, { "start": 2291.68, "end": 2300.56, "text": " goes to zero. So the more these functions disagree, the less their accuracy is, that seems natural." }, { "start": 2300.56, "end": 2307.6, "text": " However, you can see that these red stars right here, they seem to be also very different, they" }, { "start": 2307.6, "end": 2313.6, "text": " seem to not agree with the original baseline optimum, but they seem to be doing perfectly fine" }, { "start": 2313.6, "end": 2320.4, "text": " in terms of accuracy, be at the same accuracy. And those are the independent optima, those are" }, { "start": 2320.4, "end": 2326.08, "text": " the optima from runs where we initialized at a different point and then also trained." }, { "start": 2326.08, "end": 2332.72, "text": " And that, again, is evidence for the fact that there are probably other optima far away," }, { "start": 2333.68, "end": 2340.24, "text": " where these different initializations find this here. So they are very different in terms of" }, { "start": 2340.24, "end": 2345.7599999999998, "text": " functional space, they're quite far apart, they predict different things. However, in terms of" }, { "start": 2345.7599999999998, "end": 2354.7999999999997, "text": " loss, they're almost the same or actually the same. So this is very, very cool experiments" }, { "start": 2354.8, "end": 2361.92, "text": " right here. And they do this for the different for different architectures. And you can see that," }, { "start": 2361.92, "end": 2367.2000000000003, "text": " especially the larger architectures, this actually happens more pronounced. And they also make the" }, { "start": 2367.2000000000003, "end": 2374.32, "text": " point of saying, if you go to harder problems like a CIFAR 100 or an image net, this this effect is" }, { "start": 2374.32, "end": 2383.1200000000003, "text": " more pronounced that you can see, these here are closer together as a curve. And these these are" }, { "start": 2383.12, "end": 2391.04, "text": " these these are the the independent optima. So I hope you're all you're already on board" }, { "start": 2392.16, "end": 2398.08, "text": " and still know why we're doing these things. We're doing these things because we want to build some" }, { "start": 2398.08, "end": 2404.16, "text": " sort of ensemble that captures the distribution of solutions in order to generalize better." }, { "start": 2404.16, "end": 2412.72, "text": " Now we have two options, either we start kind of from a an optimum and characterize the space" }, { "start": 2412.72, "end": 2419.52, "text": " around that optimum, which is what these methods do right here. And what also the Bayesian methods" }, { "start": 2419.52, "end": 2424, "text": " do this, even though they don't want to, because they do these approximations, because they're" }, { "start": 2424, "end": 2433.52, "text": " intractable, they're going to end up doing this. Or our other our other option is to restart" }, { "start": 2433.52, "end": 2440.88, "text": " training a bunch of times. And then we end up at different optima. And the point of the paper is" }, { "start": 2440.88, "end": 2449.6, "text": " it's better to do that than to build the ensemble out of the of these Gaussian methods or of these" }, { "start": 2449.6, "end": 2455.44, "text": " perturbation methods. And the paper, I guess the main claim of the paper is why that happens. And" }, { "start": 2455.44, "end": 2460.96, "text": " it happens because the ensemble members obtain different minima that are functionally different." }, { "start": 2460.96, "end": 2471.2, "text": " Okay, so exactly, that's what they do here. So they now build ensembles out of these different things." }, { "start": 2471.2, "end": 2480, "text": " And you can see that here on the x axis, you have the ensemble size. So how many ensemble members" }, { "start": 2480, "end": 2485.92, "text": " do you have? And the dashed lines here are the baseline accuracies if you just have a single model." }, { "start": 2485.92, "end": 2496.88, "text": " And the test accuracy is plotted on the y axis. Now I actually was, I was not, that's not correct." }, { "start": 2496.88, "end": 2502.88, "text": " You always build the ensemble out of random initializations. But on top of that, you do these" }, { "start": 2502.88, "end": 2510.96, "text": " things. So what you can see right here is, if I have this classifier, which is my original classifier," }, { "start": 2510.96, "end": 2521.2, "text": " and I add on top of that, this PCA Gaussian, you know, perturbation stuff, I increase in accuracy." }, { "start": 2522.08, "end": 2529.92, "text": " However, if I build an ensemble, I increase in accuracy, if I build an ensemble out of 10 members," }, { "start": 2529.92, "end": 2538.08, "text": " I increase in accuracy this much. And then if, because I can do both things. So if I increase" }, { "start": 2538.08, "end": 2545.12, "text": " if I do an ensemble, and then on top of that to the PCA Gaussian, I gain another this much right here." }, { "start": 2545.12, "end": 2551.84, "text": " So that's sort of evidence for the fact that you'd rather build an ensemble than do this," }, { "start": 2551.84, "end": 2562.08, "text": " these other methods of, of approximating the Bayesian posterior of weights. So yes, I'm," }, { "start": 2562.08, "end": 2569.68, "text": " I'm sort of convinced. I hope you are too. And they do a lot of they do some more experiments" }, { "start": 2569.68, "end": 2575.68, "text": " right here where you can see that the difference between so this is single model, sorry, this is," }, { "start": 2577.12, "end": 2585.2, "text": " I guess, here, accuracy, oh, yeah, if you this is the out of distribution test, so you can take a" }, { "start": 2585.2, "end": 2591.04, "text": " data set, and you can corrupt it by corruption. So there are predefined data sets, but you can also" }, { "start": 2591.04, "end": 2599.12, "text": " do it yourself, you crop it, you can do luminosity, whatever, you can destroy parts of the image," }, { "start": 2599.12, "end": 2607.8399999999997, "text": " you can see that having more ensemble members, so this is your original models, here is how they" }, { "start": 2607.84, "end": 2614.6400000000003, "text": " sync with increasing corruption. It almost doesn't matter which ones of these methods you do, you see" }, { "start": 2614.6400000000003, "end": 2619.28, "text": " the bottom one is the original model, and you gain a little bit by doing these things, but not" }, { "start": 2619.28, "end": 2625.36, "text": " nearly as much by building an ensemble and going here, or actually an ensemble of two members or" }, { "start": 2625.36, "end": 2632.7200000000003, "text": " five members, in which case you jump this much in accuracy. So these ensembles from different" }, { "start": 2632.72, "end": 2642.8799999999997, "text": " initializations are also very, very, are also very good at countering corruption, which you see also" }, { "start": 2642.8799999999997, "end": 2653.3599999999997, "text": " here. Yeah, so this is the JS divergence, okay, I've read that, but let's not go here, videos" }, { "start": 2653.3599999999997, "end": 2659.2, "text": " already too long. And this is the last thing is on ImageNet test set and the ImageNet" }, { "start": 2659.2, "end": 2665.04, "text": " corrupted set, where they pretty much show the same thing. It's not as pronounced here, but you" }, { "start": 2665.04, "end": 2673.68, "text": " can see pretty much how the different, if you go from single model to ensemble with two members to" }, { "start": 2673.68, "end": 2679.4399999999996, "text": " ensemble with four members, there is a general upwards trend, and the general upwards trend is" }, { "start": 2679.4399999999996, "end": 2685.4399999999996, "text": " much less pronounced within each ensemble, so if you go just go from method to method, then it" }, { "start": 2685.44, "end": 2692.4, "text": " is between the different groups of ensembles, meaning that the ensemble is a much more pronounced" }, { "start": 2692.4, "end": 2702.16, "text": " effect that these other effects. So I hope I have convinced you a little bit of how these subspaces" }, { "start": 2702.16, "end": 2707.36, "text": " look like, how the loss landscape of neural networks look like, especially the fact that there" }, { "start": 2707.36, "end": 2713.36, "text": " are these different minima, and the random initializations of these different groups of" }, { "start": 2713.36, "end": 2718.96, "text": " models, and the random initializations will almost always hit these different minima. And the" }, { "start": 2718.96, "end": 2723.76, "text": " interesting part is that even though these different minima perform equally well, they are" }, { "start": 2723.76, "end": 2730.48, "text": " functionally very different. And an ensemble of differently initialized and independently" }, { "start": 2730.48, "end": 2736.96, "text": " optimized models can actually capture these different modes of the functional space. And" }, { "start": 2736.96, "end": 2742.1600000000003, "text": " therefore, if you build an ensemble out of that, it will generalize better, because it kind of can" }, { "start": 2742.16, "end": 2747.68, "text": " draw information from all of those different modes, rather than if you do some sort of Bayesian" }, { "start": 2747.68, "end": 2753.7599999999998, "text": " network, which will, because you have to approximate usually with Gaussians, will end up only covering" }, { "start": 2753.7599999999998, "end": 2763.52, "text": " one of these modes. That is sort of a good summary of what this paper says. Again, I enjoy" }, { "start": 2764.3199999999997, "end": 2771.44, "text": " research like this, because it's easy and it gives, it kind of makes you think, right? So I'll be" }, { "start": 2771.44, "end": 2776.2400000000002, "text": " thinking about these things for a while now and thinking of new kind of experiments that one could" }, { "start": 2776.2400000000002, "end": 2782, "text": " do. And yeah, as I said, this research is still wide open. We don't know so many things about" }, { "start": 2782, "end": 2787.76, "text": " neural network. And you know, tell me, tell me what you think is going on, actually, that that would" }, { "start": 2787.76, "end": 2801.84, "text": " be very interesting. And yeah, I'll see you next time. Bye bye." } ]
v-ZxzTSpmk4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Gradient Origin Networks (Paper Explained w/ Live Coding)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "gon", "gradient", "negative gradient", "implicit", "implicit representation", "siren", "sirens", "deep neural networks", "convolutional neural network", "dnns", "mnist", "cifar10", "fashion mnist", "gradient descent", "sgd", "inner loop", "backpropagation", "live code", "code", "machine learning code", "research", "research paper" ]
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 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 yeah, share this video out maybe that helps someone else understand. So this paper is a very short paper, it is four pages. And it's a dense paper, it definitely can warrant it definitely can warrant making a longer paper out of it. 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 models, 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 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. A siren is or generally an implicit representation network is a network that takes in any X and Y coordinate as the input. So the input itself is the numerical X and Y coordinate of that picture, and it passes it through a neural network and outcomes the RGB value. OK, 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 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, it can capture some regularity in the data. Usually sirens have sine waves as nonlinearities 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 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. All right, so these are implicit representation models or implicit generative models, or these neural networks right here that map from coordinates to two colors. Now what's the problem with this is, as we said, you need one neural network per data point. Now, the idea that these people here go with is that can't we do kind of the same thing, but except we have one neural network per data point, we want to have the same neural network for the entire data set. So again, they want to have a neural network that somehow outputs RGB coordinates. But now it's not for a single image. Now we have a data set. Okay, and the data set has many images like this is image i, this is image j, this is image k. So what we could do is we could simply tell the neural network the x and y coordinate that we where we would like the RGB values to know. And we could also tell it which image it is right, k, or i or j. And this will give us a neural network right here that can represent the entire data set because it always can see, ah, I want of image j, I want these 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 GAN, right? If you train this correctly, then this z right here will be sort of a a latent encoding of the what the what of the information in the image itself. Okay. And that can generalize. So now I can input a picture that the model has never seen during training. And the encoder will map it to a latent representation that sort of makes sense that is able to reconstruct the image that I've put in. Okay, so the your hope with these latent representation is is that there is some kind of data manifold somewhere in hidden in the in the entire space of parameters. And as long as you're on that data manifold, you will produce a sensible data point. And this is kind of a continuous and so on. So even though you've only seen a few during training, if you have a new one during testing, then you can sort of it will be mapped to a correct place on the data manifold and it will produce a data point again. And you've seen this right, you've seen these interpolations in GANs where you can interpolate in latent space, and, and so on. The problem here is that, you know, in so in GANs, we sample these things right here. So that's a different story. But in VAEs, we need this encoder or in auto encoders, we need this encoder to obtain a latent representation for a given data point. In GANs, there is no way if we have an image, there is no way to obtain the corresponding Z variable. If we don't have an encoder, right, and that's the problem we're tackling right here. So here, what we want to do is we want to give the X and Y, we want to give the Z, we say we have some way of obtaining a latent representation of one of the image right here. And from that, we want to generate the RGB variables. Now the question is, think of again, the question is, how do we obtain the Z variable without having without having access to the encoder? And that's that's the problem of this paper. And this paper proposes a solution. So they say this is achieved with an implicit neural network that takes as inputs points in the coordinate space, alongside a latent vector initialized with zero. So that's the model that we saw. That's this, this is sorry about that. This is this right here, it takes in the coordinates, this is the coordinates, and it takes in the latent vector Z. Now, this whole point with it being initialized at zeros will get will get to that in one second. Okay. For the fact right now is just that the represent the implicit neural network also takes the identity of the image. So each image, the image is always going to have the same Z. And then we sort of say which x and y coordinate of that image we want. So the Z is per image. And then each image has all the x and y coordinates of, you know, itself. So yeah. So if yeah, you you I think you can follow. They go on they say the gradients of the data fitting loss with respect to this zero vector are jointly optimized to act as latent points that capture the data manifold. So this is where this is where I already got lost reading the first time through the results show similar characteristics to auto encoders, but with fewer parameters and the advantages of implicit representation networks. Okay, so we'll actually we'll, we'll jump to this right here. So this is the this is the comparison between a variational auto encoder and the gradient origin network. So in a variational auto encoder, what you would do is you would have this explicit encoder right here, as we said, and in the variational auto encoder, you don't obtain the latent representation directly, you actually obtain the distribution in terms of the mean and standard deviation of the latent representation. And then you sample from that distribution to obtain that latent representation. I think the point here is simply to show that you first of all, you do need an encoder, which you do need to train. And second of all, it's kind of a complicated process to get that latent representation for the data point x. And then you need to decoder that generates an image. And then you have the loss right here that compares the two that is used to train the encoder and the decoder. Whereas in the gradient origin networks, what you do is you start you basically have a function f and the function f it's a bit weird right here, the function f uses two things. So this here is that z, which is termed zero here. But in fact, it's the latent representation of the image, which is derived from the image itself. And I don't really know, so I guess you can hear you can input this x is derived from the image itself by some way that doesn't require parameters that is not learned. And it also takes in these coordinates, and it produces that image. Now let's disentangle two things right here, what we're going to see is equally applicable to non implicit neural networks. So for the rest of this paper, I'm not saying it's going to work as well, maybe it's going to work specifically well with implicit neural networks. But we need to differentiate the these two things. So the first thing is explicit versus implicit. Okay, we're simply going to view these as functions that take a z and give you an x. Okay, if this is this is most notably the explicit version, the implicit version is simply that we're going to take a z along with all the x and y of the image. And we're going to obtain the R, g and b values of all the images, right, which is equal to the x. So this this entire set of RGB values is equal to the x, and we input the entire set right here. So 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. All 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 gradient origin network loss function. That's that's it. That's what you that's what you get. And then you get the loss thrown in your face. But 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 siren, whatever you minimize over the parameters of f across your entire data set. Okay, so this is your standard loss function. And this is some 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't 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 a remany an integral or a little big integral? And I'm like, okay, but in in this case, this is this simply means that you want the loss of each of the coordinates and you want to sum them up, right, which is the same as simply the the normal loss function with respect to a data point. This right here is the data point itself. As you can see, this is the this is your natural signal. So this is the function that you don't know. This is the true image function that maps the coordinates to the RGB space. In the case of explicit representation, this here is simply x. Okay, and forget about this integral for now. Cool. So we have a loss between x and whatever this is right here. This is a bit too long and whatever this is right here, you can see the loss function between two things. So what is this thing? The loss function, I can tell you the one they use in this particular paper is the L two loss. This is simply the reconstruction loss between a data point and its its reconstruction. Okay, so this part on the right is what's going to make the reconstruction. You can see, yes, our F here is going to be our siren, our neural network that will take in a Z. So F is one of these function explicit or implicit that takes in a Z and gives you x the the reconstruction. Now the question is, what does F take in? F takes in two things. First of all, the coordinates concatenated with the thing on the right. And you remember, we said that instead of giving x y to the implicit representation, we now give x y and z where z is the latent vector of the image we're trying to reconstruct. So if we were to see this as a non implicit method, we can simply leave away this right. So we as we leave away the x and y coordinates in a in a GAN or a VAE, we simply give it this thing right here. Again, we're trying to disentangle the implicit network, the implicit generator from how we are going to obtain the Z. So this is not important. So what remains is this quantity right here. So this must be our Z for the image. Okay, this thing. So what's this thing? I'm running slowly out of colors. This thing is going to be somehow the negative gradient of something. Again, you have the integral right here of the loss function. This again is x. This here again, we can leave this away. We can leave away the integral and you'll start to see kind of a repetitive thing. So this is going to be the gradient somehow of your loss function with that. Again, there is x and then there is f of z zero. So this is somehow an x to an x hat as well. But it's a special x hat. Let's call it x hat prime or x hat zero. Because the input is not z, but the input is now z zero. Okay, this is kind of a complicated thing. So I'm going to explain what's going on right here. Maybe in drawing. So what you want to do is you want to start out with z zero, which is an initial guess of what your latent representation is. You do it without looking even at the image, at the data point. You simply start with one. And there are multiple ways to do this. And this paper right here simply says we're going to see zero is just going to be a constant value zero, the constant value zero. That's why it's called gradient origin networks, because you always start with your z zero, your initial guess of your latent representation is the origin. Okay. Then you use F, your neural network to obtain a estimate, a first estimate of what your image could look like. Again, you have not looked at the image, you're simply taking the z zero and you produce an image. Then you somehow somehow obtain a better representation z. And that you use your F again to obtain x hat. And then from that x hat, you can now compare this to your x and that will give you your loss that you back propagate. So two things here, you can see you use F twice, which means that your loss, if you back 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 image. How would you need to change your initial guess in order to make that loss go down? So the negative here is to make the loss go down because otherwise it 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 this in a single step this gives you the correct z or something like this. And I don't agree. They say with respect to the origin we obtain a latent vector that minimizes the reconstruction loss is obtained in a single step thereby playing the similar role to an explicit encoder. So this is true. This is kind of like an encoder, right? You simply ask what z would I need to put in in order to make this representation be a better sorry in order to make the latent representation be a better latent representation for the particular image x. However, if you compare so what is this? This is essentially gradient descent in the latent space, right? And the fact that we look at the explicit gradient is only because they started at the zero point right here. The fact that they started at the zero point means that here they can just leave away the following. So if we 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 the learning rate is one in this case. So this is and again, the z zero because it's zero, you can just leave it away. So this is simply one single step of gradient descent in the latent space in order to get a better z right here. However, this is not a this is doesn't it doesn't guarantee you that in 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. And again, because you back propagate to both of the F's, you say you basically say I want my neural network first of all to reconstruct the data point better from a given latent representation and I also want my neural network to give me a latent representation basically to help my latent to help this procedure. You back propagate through the gradient descent procedure. So you say I want my neural network to help me obtain a better latent representation if I do one step of gradient descent. So therefore it's not just pure gradient descent in that space. It actually the back propagation makes it such that your neural network also supports that supports obtaining a good representation in one step. Okay, now that we've disentangled this, basically, you can see two things. First of all, you could probably get an even better representation by doing multiple steps of gradient descent right here, maybe adjusting the learning rate a bit. It depends right because you have to back propagate through all the gradient descent steps. But pretty sure you could probably improve this by doing multiple steps. Second of all, it doesn't really matter that this is a constant zero. It gives you know, there's a cool name gradient origin networks, but you could probably start with any constant or even here's the thing even non constant initial points, you could sample them from a distribution and so on. 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 game, right? Alright, so here we go. I've cloned the repo and 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 colab 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 these siren layers and so on. And then you have the real deal thing right here. So you have the step. So we do 500 steps. And in each step, we as you can see right here, we start with zeros as z, then we put this into f concatenated with the coordinates. So the coordinates is like a kind of a mesh grid type thing. We obtain the inner loss right here, we do a gradient with respect so of the inner loss with respect to z. And then the negative gradient that's going to become our outer z. So this z up here is z zero, and this z down here is going to be our true z from the paper. We are going to concatenate that again, with the coordinates to obtain the g, which is the kind of reconstruction of x. And then our outer loss is going to be simply this reconstruction loss right here. And then we're going to backward to all of the parameters. Okay. So first hypothesis is that this here is simply kind of gradient descent. So what we should be able to do is first, let's run let's run this. So I've run this like that. So this is shipping it to a GPU server. And as you will be able to see, the loss will be output. And it's going to kind of decrease the loss over the course of 500 steps. And we can also look at the samples. So while that's happening, what we can do is we can actually already prepare what we want to do. So if this is really gradient descent, we should be basically just able to do this z minus this gradient right here, because it's zeros. We would simply expect this to yield the same loss. So we're going to do this, and then we're going to ship this off to the server again. Sorry. So we were here. And okay, the logs failed. All right. So this is called images. I have this thing set up such that it's called logs. But you can basically see that the loss right here was from 24 going to down to about 13 or so over the course of training. So by subtracting z minus the gradient, we there really shouldn't be any change, right? Because z is zero at the beginning. So again, we're going to run this. And while it's running, we're going to prepare the different things. So my hypothesis is that we can maybe we could make this z here pretty much anything. So let's do it. Let's put it into ones. Again, you see that the loss, I guess, you know, we get an idea of kind of the noisiness of this thing. And 2119, and so on. We can in fact, over here, we might be able to if we ship it to a different GPU, might be able to run two things in parallel. So this now is when we just start with ones instead of zeros. So let's see how that happens. While that's the case. So you can see right here that we ended up at also about 1413. This pretty much is the same if you can we can look at the images that it's produced. So the reconstructions look kind of like this of fashion MNIST, 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. 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. So now if this is correct, I'm pretty sure this is correct. So the normal initialized isn't really the hit right here, as you can see. Wow. Okay. The normal isn't. Maybe it's because it's too large. I'm not sure. The other thing is deterministic, so that's going to be a lot easier. We can quickly go back and let's go ones. Let's go to normal. And let's multiply it with a tiny 0.01 or so. I just want to see whether this works. I have no big hopes. Okay. So we are here again, and we're going to make this into two different things. Two steps of gradient descent. All right. So now we have two steps of gradient descent. And let's see whether that helps. Ah, okay. So the normal distribution already helps or is not worse. We simply initialized it with too big of a variance. The 0.01 seems to be some kind of magic number for normal distributions and neural networks. So on the right side over here, and you can see we're a bit 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 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, wah, wah, wee wah. 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 divide it by a generous three and then by maybe, you know, 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're almost perfect. So we're now, I guess we're overfitting a bit. So this is now trading off kind of power of the encoder decoder and so on. But ultimately, yeah, so let's just for the last part, just try to have this gradient descent with the decreasing step size and see where that gets us if that gets us to even a lower reconstruction loss. And that will be our investigation into the code right here. Okay. Do do do do do. Okay, we start with 19. Maybe we're as good as before. That's fine, you know. But I hope I hope that kind of gives a bit of evidence to my point that this is basically reversing a generator by using gradient descent, which has been around for a while. And I happen to know someone who who once attempted to write a paper about it. So yeah, but it's it's with implicit networks, which are pretty cool. So you know, maybe this might work especially well with them given that the gradient of a siren is a gradient and is a siren, and so on. Yep, as you can see, this works as well decreasing learning rate. And now you can go nuts. Oh, nine. Wow. This is the lowest loss we've gotten so far. Right? Yeah. So pretty cool. Interpolations look like things. These are the best samples. I think these are the best samples we've seen today. Maybe not. I'm not sure. Let's look at the interpolations quickly. Yeah, this looks like interpolations. I mean, if you squint. Okay, this was it for coding. See ya. Now, GANs have come with encoders before or it much more looks like a variational auto encoder as well. The difference here is we replace the encoder. So this here is our encoder, right? This is our implicit encoder is simply gradient descent. This has also been done before for GANs. So people train GANs and then they try to find the latent representation by back propagating. And some people even do this while training. They do gradient descent and then either do or do not back prop through the GAN, through the gradient descent procedure. So in a way or another, this is kind of sort of like those ideas, not saying it is equal. And again, there could be like some special interaction because you actually back prop through both these things and there could be some special interaction because these are implicit neural networks. However, I very much view these as two different things. The cool, there is a rather cool derivation of that where you can say, okay, you can also use it as a classifier by basically doing this. And now hope you can understand this much better. So what we'll have is we'll have the classification loss for sample X is going to be your cross entropy loss between two things. Okay. Well, can you please go down again? Thanks. So your cross your loss between two things is going to be the loss between your label Y. So that's one thing. And usually you have the feature, the logits on this side, right? Now you can see right here, you have an F that's probably that something that gives you the logits from your features. And here your features aren't going to be the data point itself, but your features are going to be the Z variable that comes with the data 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 variational autoencoder and then simply use that encoder as a feature producer for a classifier, which generally doesn't work very well. But you know, you can, you can do it right here. And the 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're kind of freed from the coordinate representation here and you get kind of a latent vector back. So this is how you would use an implicit neural network in order to do classification. That's I think, you know, pretty, pretty cool derivation of this. So here they make some empirical claims, which I don't, I don't want to go too much into, but there are certain advantages, certain practical advantages of doing things like this. Like you can have very, very few parameters to represent an entire set of data. The interpolations here work nicely as you can see. And I think generally they make the claim that this trains fast and you can see after three seconds, it already has a lot of information about the data set and it does some sensible things. Okay. So the code is available and in fact, I'll probably enter, inter parse into this video a let's actually test our hypotheses, right? Let's test these hypotheses that I said. So first hypothesis is probably we can start with something else than the constant zero and second hypothesis is we can probably improve by doing multiple steps of gradient descent in the inner loop. Yes, I, this might be somewhere in this video. And if not, it comes at the end like right now. Okay. So I'll see you next time. Bye bye.
[ { "start": 0, "end": 6.92, "text": " Hi there, today we'll look at gradient origin networks by Sam Bond Taylor and Chris G Wilcox" }, { "start": 6.92, "end": 8.96, "text": " of Durham University." }, { "start": 8.96, "end": 14.72, "text": " So on a high level, this paper trains implicit representation networks, but not on single" }, { "start": 14.72, "end": 17.66, "text": " data points, but on entire data set." }, { "start": 17.66, "end": 21.54, "text": " It does so by using a latent encoding of each data point." }, { "start": 21.54, "end": 27, "text": " And it doesn't obtain that encoding through an explicit encoder, but by simply looking" }, { "start": 27, "end": 33.480000000000004, "text": " at the gradient of the latent variable when initialized at the origin." }, { "start": 33.480000000000004, "end": 38.480000000000004, "text": " So it's a bit of a weird formulation, and I've seen this paper upvoted on Reddit, and" }, { "start": 38.480000000000004, "end": 44.28, "text": " the top comments would always say like, I don't really get it, I don't really get it." }, { "start": 44.28, "end": 49.28, "text": " And I thought, you know, maybe I'm completely wrong, but I can just give my opinion kind" }, { "start": 49.28, "end": 51.760000000000005, "text": " of what's going on in this paper." }, { "start": 51.76, "end": 57.64, "text": " Now also, most people on Reddit or a lot did say, I don't really get it, but here is what" }, { "start": 57.64, "end": 59.099999999999994, "text": " I think is going on." }, { "start": 59.099999999999994, "end": 62.96, "text": " And then listing something and that's there is where I stopped reading." }, { "start": 62.96, "end": 69, "text": " So as to not be kind of as to form my own opinion, I like to kind of understand papers" }, { "start": 69, "end": 70.14, "text": " by myself." }, { "start": 70.14, "end": 72.72, "text": " So again, maybe I'm completely wrong." }, { "start": 72.72, "end": 75.82, "text": " But here is my opinion." }, { "start": 75.82, "end": 82.24, "text": " If you like opinions, hit the like button and subscribe if you aren't yet." }, { "start": 82.24, "end": 87.03999999999999, "text": " And yeah, share this video out maybe that helps someone else understand." }, { "start": 87.03999999999999, "end": 92.75999999999999, "text": " So this paper is a very short paper, it is four pages." }, { "start": 92.75999999999999, "end": 100.35999999999999, "text": " And it's a dense paper, it definitely can warrant it definitely can warrant making a" }, { "start": 100.35999999999999, "end": 101.88, "text": " longer paper out of it." }, { "start": 101.88, "end": 105.19999999999999, "text": " That being said, it's an archive paper for now." }, { "start": 105.2, "end": 111.68, "text": " So you know, there's nothing wrong with archiving kind of unfinished work." }, { "start": 111.68, "end": 115.60000000000001, "text": " But we're just going to look at it and try to understand it." }, { "start": 115.60000000000001, "end": 116.60000000000001, "text": " Okay." }, { "start": 116.60000000000001, "end": 122.76, "text": " So the abstract says this paper proposes a new type of implicit generative model that" }, { "start": 122.76, "end": 129.24, "text": " is able to quickly learn a latent representation without an explicit encoder." }, { "start": 129.24, "end": 133.92000000000002, "text": " So for that, you need to know what an implicit generative model is." }, { "start": 133.92, "end": 139.48, "text": " And I've covered one type of implicit generative models, specifically the type that they're" }, { "start": 139.48, "end": 142.39999999999998, "text": " using here, what they're called siren." }, { "start": 142.39999999999998, "end": 146.44, "text": " So sirens are implicit representation networks." }, { "start": 146.44, "end": 147.83999999999997, "text": " And I've made a video about sirens." }, { "start": 147.83999999999997, "end": 149.83999999999997, "text": " So if you don't know what that is, go look it up." }, { "start": 149.83999999999997, "end": 156.82, "text": " But very quickly, a siren will is a neural network to represent a single data point." }, { "start": 156.82, "end": 163.5, "text": " So each data point in a data set is represented by its own neural network." }, { "start": 163.5, "end": 167.16, "text": " And the neural network, so this might be a bit foreign to you." }, { "start": 167.16, "end": 170.2, "text": " But usually you have some kind of image, right?" }, { "start": 170.2, "end": 175.12, "text": " And it's simply represented as an as an array of RGB coordinates, right?" }, { "start": 175.12, "end": 180.44, "text": " It's it's simply an array of this is like one zero point five and so on." }, { "start": 180.44, "end": 182.1, "text": " So all the pixels are in this array." }, { "start": 182.1, "end": 186.28, "text": " This is the explicit representation of that data point." }, { "start": 186.28, "end": 191.32, "text": " Now, this here is a long list, and it has some regularities to it." }, { "start": 191.32, "end": 196.6, "text": " So that's why you can also think of an implicit representation of the data point." }, { "start": 196.6, "end": 199.32, "text": " The implicit representation works as follows." }, { "start": 199.32, "end": 204.78, "text": " You imagine again your image, your image is made up of pixels, and these pixels are on" }, { "start": 204.78, "end": 206.32, "text": " X and Y coordinates." }, { "start": 206.32, "end": 209.1, "text": " So this pixel right here would be zero zero." }, { "start": 209.1, "end": 212.95999999999998, "text": " This pixel right here would be zero one, and so on." }, { "start": 212.95999999999998, "end": 220.12, "text": " A siren is or generally an implicit representation network is a network that takes in any X and" }, { "start": 220.12, "end": 222.14000000000001, "text": " Y coordinate as the input." }, { "start": 222.14000000000001, "end": 228.84, "text": " So the input itself is the numerical X and Y coordinate of that picture, and it passes" }, { "start": 228.84, "end": 234.12, "text": " it through a neural network and outcomes the RGB value." }, { "start": 234.12, "end": 240.20000000000002, "text": " OK, so an entire picture is represented by this neural network." }, { "start": 240.20000000000002, "end": 244, "text": " The neural network maps each coordinate to its RGB value." }, { "start": 244, "end": 251, "text": " And here you can see that a single picture can become an entire data set for this neural" }, { "start": 251, "end": 252, "text": " network." }, { "start": 252, "end": 255.86, "text": " In fact, it has to, because for a different picture, of course, there is a different mapping" }, { "start": 255.86, "end": 260.08, "text": " from X and Y coordinates to RGB coordinates." }, { "start": 260.08, "end": 261.92, "text": " But this allows you to do multiple things." }, { "start": 261.92, "end": 267.26, "text": " So first of all, this neural network can be smaller than the explicit representation." }, { "start": 267.26, "end": 271.08, "text": " Second of all, it can capture some regularity in the data." }, { "start": 271.08, "end": 279.2, "text": " Usually sirens have sine waves as nonlinearities in the neural network here, which is also" }, { "start": 279.2, "end": 284.91999999999996, "text": " a bit special, but lends itself very well to capture natural signals, because natural" }, { "start": 284.91999999999996, "end": 290.44, "text": " signals are often repeated at different scales and derivatives of themselves and so on." }, { "start": 290.44, "end": 294.56, "text": " So I've covered this all in my video." }, { "start": 294.56, "end": 300.15999999999997, "text": " And also this allows you to have a continuous representation rather than a discrete representation." }, { "start": 300.16, "end": 302.20000000000005, "text": " Like here, you just have each pixel." }, { "start": 302.20000000000005, "end": 305.36, "text": " Now you have a continuous representation." }, { "start": 305.36, "end": 312.36, "text": " All right, so these are implicit representation models or implicit generative models, or these" }, { "start": 312.36, "end": 318.64000000000004, "text": " neural networks right here that map from coordinates to two colors." }, { "start": 318.64000000000004, "end": 323.92, "text": " Now what's the problem with this is, as we said, you need one neural network per data" }, { "start": 323.92, "end": 324.92, "text": " point." }, { "start": 324.92, "end": 333.04, "text": " Now, the idea that these people here go with is that can't we do kind of the same thing," }, { "start": 333.04, "end": 338.08000000000004, "text": " but except we have one neural network per data point, we want to have the same neural" }, { "start": 338.08000000000004, "end": 341.52000000000004, "text": " network for the entire data set." }, { "start": 341.52000000000004, "end": 348.96000000000004, "text": " So again, they want to have a neural network that somehow outputs RGB coordinates." }, { "start": 348.96000000000004, "end": 351.12, "text": " But now it's not for a single image." }, { "start": 351.12, "end": 352.48, "text": " Now we have a data set." }, { "start": 352.48, "end": 357.92, "text": " Okay, and the data set has many images like this is image i, this is image j, this is" }, { "start": 357.92, "end": 359.12, "text": " image k." }, { "start": 359.12, "end": 365.76, "text": " So what we could do is we could simply tell the neural network the x and y coordinate" }, { "start": 365.76, "end": 370.20000000000005, "text": " that we where we would like the RGB values to know." }, { "start": 370.20000000000005, "end": 376.44, "text": " And we could also tell it which image it is right, k, or i or j." }, { "start": 376.44, "end": 383.6, "text": " And this will give us a neural network right here that can represent the entire data set" }, { "start": 383.6, "end": 388.76, "text": " because it always can see, ah, I want of image j, I want these and these x y coordinate doesn't" }, { "start": 388.76, "end": 394.32, "text": " help you very much though, because it still has to learn for each image individually," }, { "start": 394.32, "end": 397.84, "text": " how to encode it, how to produce it." }, { "start": 397.84, "end": 404.76, "text": " What's much more interesting is, if you kind of mix this with the kind of old style, the" }, { "start": 404.76, "end": 407, "text": " kind of old style generative models." }, { "start": 407, "end": 412.18, "text": " So in old style generative models, let's consider for example, an auto encoder." }, { "start": 412.18, "end": 416.4, "text": " So in an auto encoder, what you would do is you would take your image and you would put" }, { "start": 416.4, "end": 419.24, "text": " it through an encoder." }, { "start": 419.24, "end": 422.84, "text": " And this encoder will give you a latent variable z." }, { "start": 422.84, "end": 426.14, "text": " And then you would put it through a decoder again." }, { "start": 426.14, "end": 428.58, "text": " And that would give you an image." }, { "start": 428.58, "end": 434.88, "text": " So your generative model now is this part right here, and this z variable is your latent" }, { "start": 434.88, "end": 437.4, "text": " encoding of this data point." }, { "start": 437.4, "end": 445, "text": " Now, if you train these models correctly, be this a be this a an auto encoder or a variational" }, { "start": 445, "end": 450.32, "text": " auto encoder, or the green part can actually just be a GAN, right?" }, { "start": 450.32, "end": 459.08, "text": " If you train this correctly, then this z right here will be sort of a a latent encoding of" }, { "start": 459.08, "end": 463.84, "text": " the what the what of the information in the image itself." }, { "start": 463.84, "end": 464.84, "text": " Okay." }, { "start": 464.84, "end": 466.4, "text": " And that can generalize." }, { "start": 466.4, "end": 472.48, "text": " So now I can input a picture that the model has never seen during training." }, { "start": 472.48, "end": 480.2, "text": " And the encoder will map it to a latent representation that sort of makes sense that is able to reconstruct" }, { "start": 480.2, "end": 482.76, "text": " the image that I've put in." }, { "start": 482.76, "end": 490.03999999999996, "text": " Okay, so the your hope with these latent representation is is that there is some kind of data manifold" }, { "start": 490.03999999999996, "end": 496.4, "text": " somewhere in hidden in the in the entire space of parameters." }, { "start": 496.4, "end": 501.84, "text": " And as long as you're on that data manifold, you will produce a sensible data point." }, { "start": 501.84, "end": 504.08, "text": " And this is kind of a continuous and so on." }, { "start": 504.08, "end": 510.96, "text": " So even though you've only seen a few during training, if you have a new one during testing," }, { "start": 510.96, "end": 517.12, "text": " then you can sort of it will be mapped to a correct place on the data manifold and it" }, { "start": 517.12, "end": 519.98, "text": " will produce a data point again." }, { "start": 519.98, "end": 524.54, "text": " And you've seen this right, you've seen these interpolations in GANs where you can interpolate" }, { "start": 524.54, "end": 527.92, "text": " in latent space, and, and so on." }, { "start": 527.92, "end": 534.66, "text": " The problem here is that, you know, in so in GANs, we sample these things right here." }, { "start": 534.66, "end": 536.24, "text": " So that's a different story." }, { "start": 536.24, "end": 543.68, "text": " But in VAEs, we need this encoder or in auto encoders, we need this encoder to obtain a" }, { "start": 543.68, "end": 546.76, "text": " latent representation for a given data point." }, { "start": 546.76, "end": 552.68, "text": " In GANs, there is no way if we have an image, there is no way to obtain the corresponding" }, { "start": 552.68, "end": 554.3199999999999, "text": " Z variable." }, { "start": 554.32, "end": 559.5400000000001, "text": " If we don't have an encoder, right, and that's the problem we're tackling right here." }, { "start": 559.5400000000001, "end": 564.6, "text": " So here, what we want to do is we want to give the X and Y, we want to give the Z, we" }, { "start": 564.6, "end": 571.44, "text": " say we have some way of obtaining a latent representation of one of the image right here." }, { "start": 571.44, "end": 575.2800000000001, "text": " And from that, we want to generate the RGB variables." }, { "start": 575.2800000000001, "end": 583.22, "text": " Now the question is, think of again, the question is, how do we obtain the Z variable without" }, { "start": 583.22, "end": 589.64, "text": " having without having access to the encoder?" }, { "start": 589.64, "end": 592.36, "text": " And that's that's the problem of this paper." }, { "start": 592.36, "end": 596.52, "text": " And this paper proposes a solution." }, { "start": 596.52, "end": 603.88, "text": " So they say this is achieved with an implicit neural network that takes as inputs points" }, { "start": 603.88, "end": 608.64, "text": " in the coordinate space, alongside a latent vector initialized with zero." }, { "start": 608.64, "end": 610.36, "text": " So that's the model that we saw." }, { "start": 610.36, "end": 614.08, "text": " That's this, this is sorry about that." }, { "start": 614.08, "end": 621.08, "text": " This is this right here, it takes in the coordinates, this is the coordinates, and it takes in the" }, { "start": 621.08, "end": 623.44, "text": " latent vector Z." }, { "start": 623.44, "end": 629.72, "text": " Now, this whole point with it being initialized at zeros will get will get to that in one" }, { "start": 629.72, "end": 630.72, "text": " second." }, { "start": 630.72, "end": 631.72, "text": " Okay." }, { "start": 631.72, "end": 636.32, "text": " For the fact right now is just that the represent the implicit neural network also takes the" }, { "start": 636.32, "end": 637.72, "text": " identity of the image." }, { "start": 637.72, "end": 641.78, "text": " So each image, the image is always going to have the same Z." }, { "start": 641.78, "end": 646.6600000000001, "text": " And then we sort of say which x and y coordinate of that image we want." }, { "start": 646.6600000000001, "end": 648.72, "text": " So the Z is per image." }, { "start": 648.72, "end": 653.88, "text": " And then each image has all the x and y coordinates of, you know, itself." }, { "start": 653.88, "end": 656.12, "text": " So yeah." }, { "start": 656.12, "end": 661.76, "text": " So if yeah, you you I think you can follow." }, { "start": 661.76, "end": 667.1600000000001, "text": " They go on they say the gradients of the data fitting loss with respect to this zero vector" }, { "start": 667.16, "end": 671.64, "text": " are jointly optimized to act as latent points that capture the data manifold." }, { "start": 671.64, "end": 677.4399999999999, "text": " So this is where this is where I already got lost reading the first time through the results" }, { "start": 677.4399999999999, "end": 681.8399999999999, "text": " show similar characteristics to auto encoders, but with fewer parameters and the advantages" }, { "start": 681.8399999999999, "end": 684.76, "text": " of implicit representation networks." }, { "start": 684.76, "end": 690.18, "text": " Okay, so we'll actually we'll, we'll jump to this right here." }, { "start": 690.18, "end": 696.6, "text": " So this is the this is the comparison between a variational auto encoder and the gradient" }, { "start": 696.6, "end": 697.6, "text": " origin network." }, { "start": 697.6, "end": 704.64, "text": " So in a variational auto encoder, what you would do is you would have this explicit encoder" }, { "start": 704.64, "end": 709.32, "text": " right here, as we said, and in the variational auto encoder, you don't obtain the latent" }, { "start": 709.32, "end": 714.48, "text": " representation directly, you actually obtain the distribution in terms of the mean and" }, { "start": 714.48, "end": 717.72, "text": " standard deviation of the latent representation." }, { "start": 717.72, "end": 722.6, "text": " And then you sample from that distribution to obtain that latent representation." }, { "start": 722.6, "end": 728.12, "text": " I think the point here is simply to show that you first of all, you do need an encoder," }, { "start": 728.12, "end": 729.44, "text": " which you do need to train." }, { "start": 729.44, "end": 733.16, "text": " And second of all, it's kind of a complicated process to get that latent representation" }, { "start": 733.16, "end": 735.48, "text": " for the data point x." }, { "start": 735.48, "end": 738.48, "text": " And then you need to decoder that generates an image." }, { "start": 738.48, "end": 744.5600000000001, "text": " And then you have the loss right here that compares the two that is used to train the" }, { "start": 744.5600000000001, "end": 747.52, "text": " encoder and the decoder." }, { "start": 747.52, "end": 755.96, "text": " Whereas in the gradient origin networks, what you do is you start you basically have a function" }, { "start": 755.96, "end": 763.56, "text": " f and the function f it's a bit weird right here, the function f uses two things." }, { "start": 763.56, "end": 768.24, "text": " So this here is that z, which is termed zero here." }, { "start": 768.24, "end": 773.88, "text": " But in fact, it's the latent representation of the image, which is derived from the image" }, { "start": 773.88, "end": 774.88, "text": " itself." }, { "start": 774.88, "end": 780.6, "text": " And I don't really know, so I guess you can hear you can input this x is derived from" }, { "start": 780.6, "end": 786.72, "text": " the image itself by some way that doesn't require parameters that is not learned." }, { "start": 786.72, "end": 792.52, "text": " And it also takes in these coordinates, and it produces that image." }, { "start": 792.52, "end": 799.5, "text": " Now let's disentangle two things right here, what we're going to see is equally applicable" }, { "start": 799.5, "end": 802.08, "text": " to non implicit neural networks." }, { "start": 802.08, "end": 807.36, "text": " So for the rest of this paper, I'm not saying it's going to work as well, maybe it's going" }, { "start": 807.36, "end": 810.5400000000001, "text": " to work specifically well with implicit neural networks." }, { "start": 810.5400000000001, "end": 813.96, "text": " But we need to differentiate the these two things." }, { "start": 813.96, "end": 818.88, "text": " So the first thing is explicit versus implicit." }, { "start": 818.88, "end": 827.6800000000001, "text": " Okay, we're simply going to view these as functions that take a z and give you an x." }, { "start": 827.68, "end": 833.2199999999999, "text": " Okay, if this is this is most notably the explicit version, the implicit version is" }, { "start": 833.2199999999999, "end": 839.1999999999999, "text": " simply that we're going to take a z along with all the x and y of the image." }, { "start": 839.1999999999999, "end": 846.92, "text": " And we're going to obtain the R, g and b values of all the images, right, which is equal to" }, { "start": 846.92, "end": 849.78, "text": " the x." }, { "start": 849.78, "end": 854.8, "text": " So this this entire set of RGB values is equal to the x, and we input the entire set right" }, { "start": 854.8, "end": 855.8, "text": " here." }, { "start": 855.8, "end": 862.28, "text": " So essentially, it's simply a function that takes in a latent representation of an image" }, { "start": 862.28, "end": 865.68, "text": " and gives you back a image." }, { "start": 865.68, "end": 871.78, "text": " The second thing, which is an entirely different thing, in my opinion, is how do we obtain" }, { "start": 871.78, "end": 873.74, "text": " a z from an x?" }, { "start": 873.74, "end": 877, "text": " So how do we get to have an image?" }, { "start": 877, "end": 881.16, "text": " How do we obtain the corresponding latent representation?" }, { "start": 881.16, "end": 884.52, "text": " And such that such that." }, { "start": 884.52, "end": 890.48, "text": " So this must be such that this function right here, the function that gives you the x from" }, { "start": 890.48, "end": 893.16, "text": " the z will reproduce the x." }, { "start": 893.16, "end": 894.16, "text": " Okay." }, { "start": 894.16, "end": 901.24, "text": " So how do we obtain the correct latent representation for any for any input data point?" }, { "start": 901.24, "end": 902.8, "text": " Two different things." }, { "start": 902.8, "end": 904, "text": " Don't." }, { "start": 904, "end": 909.78, "text": " So I think they're not dependent on each other, except, as I said, they might work especially" }, { "start": 909.78, "end": 911.8, "text": " well together or something like this." }, { "start": 911.8, "end": 912.8, "text": " All right." }, { "start": 912.8, "end": 916.3199999999999, "text": " So this becomes a lot easier right now in this formula." }, { "start": 916.3199999999999, "end": 920.12, "text": " So this is the thing ultimately that they optimize." }, { "start": 920.12, "end": 926.9599999999999, "text": " They optimize the this thing and it's introduced like I don't know why they limited themselves" }, { "start": 926.9599999999999, "end": 928.12, "text": " to four pages here." }, { "start": 928.12, "end": 931.0999999999999, "text": " And again, this is work in progress, as I understand it." }, { "start": 931.0999999999999, "end": 934.78, "text": " But it is it is not it's like cold water." }, { "start": 934.78, "end": 941.12, "text": " It's like, you know, an expressive neural network can be trained in this space to mimic" }, { "start": 941.12, "end": 944.08, "text": " this by minimizing the gradient origin network loss function." }, { "start": 944.08, "end": 945.24, "text": " That's that's it." }, { "start": 945.24, "end": 947.52, "text": " That's what you that's what you get." }, { "start": 947.52, "end": 950.12, "text": " And then you get the loss thrown in your face." }, { "start": 950.12, "end": 951.76, "text": " But let's deconstruct it." }, { "start": 951.76, "end": 956.38, "text": " So this g thing right here, what's it?" }, { "start": 956.38, "end": 958.36, "text": " This is the loss that you minimize." }, { "start": 958.36, "end": 966.44, "text": " Okay, you can see that this is simply an integral of this loss function over your entire coordinate" }, { "start": 966.44, "end": 967.44, "text": " space." }, { "start": 967.44, "end": 969.76, "text": " So see here is the entire coordinate space." }, { "start": 969.76, "end": 975.98, "text": " So this is for a given for a given image, right for a given image f x, you would minimize" }, { "start": 975.98, "end": 979.68, "text": " this actually across your across your entire data set." }, { "start": 979.68, "end": 986.72, "text": " So you would minimize the parameters of f f here is going to be your generator neural" }, { "start": 986.72, "end": 993.06, "text": " network, your siren, whatever you minimize over the parameters of f across your entire" }, { "start": 993.06, "end": 994.06, "text": " data set." }, { "start": 994.06, "end": 997.72, "text": " Okay, so this is your standard loss function." }, { "start": 997.72, "end": 1000.96, "text": " And this is some across your entire data set." }, { "start": 1000.96, "end": 1002.24, "text": " Cool." }, { "start": 1002.24, "end": 1007.8000000000001, "text": " So what are you going to minimize, you're going to minimize each data point consists" }, { "start": 1007.8000000000001, "end": 1014.44, "text": " of an integral over the coordinate space, which you can't see of this loss function" }, { "start": 1014.44, "end": 1015.44, "text": " right here." }, { "start": 1015.44, "end": 1020.14, "text": " Now, this is simply due to the fact that this is an implicit representation." }, { "start": 1020.14, "end": 1025.48, "text": " If this were an explicit representation, it would simply be the loss function of that" }, { "start": 1025.48, "end": 1027.78, "text": " data point, okay." }, { "start": 1027.78, "end": 1030.08, "text": " So don't don't be scared by the integral." }, { "start": 1030.08, "end": 1033.08, "text": " I'm usually scared by integrals, I never get them." }, { "start": 1033.08, "end": 1037.4, "text": " And then I try to talk to them and people be like, do you think you know a remany an" }, { "start": 1037.4, "end": 1039.44, "text": " integral or a little big integral?" }, { "start": 1039.44, "end": 1047.6200000000001, "text": " And I'm like, okay, but in in this case, this is this simply means that you want the loss" }, { "start": 1047.6200000000001, "end": 1055.04, "text": " of each of the coordinates and you want to sum them up, right, which is the same as simply" }, { "start": 1055.04, "end": 1059.06, "text": " the the normal loss function with respect to a data point." }, { "start": 1059.06, "end": 1063.6399999999999, "text": " This right here is the data point itself." }, { "start": 1063.6399999999999, "end": 1068.3799999999999, "text": " As you can see, this is the this is your natural signal." }, { "start": 1068.3799999999999, "end": 1072.12, "text": " So this is the function that you don't know." }, { "start": 1072.12, "end": 1078.32, "text": " This is the true image function that maps the coordinates to the RGB space." }, { "start": 1078.32, "end": 1083.32, "text": " In the case of explicit representation, this here is simply x." }, { "start": 1083.32, "end": 1088, "text": " Okay, and forget about this integral for now." }, { "start": 1088, "end": 1089.1599999999999, "text": " Cool." }, { "start": 1089.1599999999999, "end": 1094.8799999999999, "text": " So we have a loss between x and whatever this is right here." }, { "start": 1094.8799999999999, "end": 1098.8, "text": " This is a bit too long and whatever this is right here, you can see the loss function" }, { "start": 1098.8, "end": 1099.8, "text": " between two things." }, { "start": 1099.8, "end": 1101.1599999999999, "text": " So what is this thing?" }, { "start": 1101.1599999999999, "end": 1105.48, "text": " The loss function, I can tell you the one they use in this particular paper is the L" }, { "start": 1105.48, "end": 1106.48, "text": " two loss." }, { "start": 1106.48, "end": 1113.68, "text": " This is simply the reconstruction loss between a data point and its its reconstruction." }, { "start": 1113.68, "end": 1117.64, "text": " Okay, so this part on the right is what's going to make the reconstruction." }, { "start": 1117.64, "end": 1124.1200000000001, "text": " You can see, yes, our F here is going to be our siren, our neural network that will take" }, { "start": 1124.1200000000001, "end": 1125.64, "text": " in a Z." }, { "start": 1125.64, "end": 1131.44, "text": " So F is one of these function explicit or implicit that takes in a Z and gives you x" }, { "start": 1131.44, "end": 1134.8, "text": " the the reconstruction." }, { "start": 1134.8, "end": 1139.2, "text": " Now the question is, what does F take in?" }, { "start": 1139.2, "end": 1141.8799999999999, "text": " F takes in two things." }, { "start": 1141.8799999999999, "end": 1146.9199999999998, "text": " First of all, the coordinates concatenated with the thing on the right." }, { "start": 1146.9199999999998, "end": 1153.72, "text": " And you remember, we said that instead of giving x y to the implicit representation," }, { "start": 1153.72, "end": 1162.1399999999999, "text": " we now give x y and z where z is the latent vector of the image we're trying to reconstruct." }, { "start": 1162.14, "end": 1169.66, "text": " So if we were to see this as a non implicit method, we can simply leave away this right." }, { "start": 1169.66, "end": 1176.24, "text": " So we as we leave away the x and y coordinates in a in a GAN or a VAE, we simply give it" }, { "start": 1176.24, "end": 1177.24, "text": " this thing right here." }, { "start": 1177.24, "end": 1184.24, "text": " Again, we're trying to disentangle the implicit network, the implicit generator from how we" }, { "start": 1184.24, "end": 1186.7800000000002, "text": " are going to obtain the Z." }, { "start": 1186.7800000000002, "end": 1188.7, "text": " So this is not important." }, { "start": 1188.7, "end": 1192.18, "text": " So what remains is this quantity right here." }, { "start": 1192.18, "end": 1196.92, "text": " So this must be our Z for the image." }, { "start": 1196.92, "end": 1199.18, "text": " Okay, this thing." }, { "start": 1199.18, "end": 1201.72, "text": " So what's this thing?" }, { "start": 1201.72, "end": 1204.56, "text": " I'm running slowly out of colors." }, { "start": 1204.56, "end": 1208.32, "text": " This thing is going to be somehow the negative gradient of something." }, { "start": 1208.32, "end": 1211.92, "text": " Again, you have the integral right here of the loss function." }, { "start": 1211.92, "end": 1215.04, "text": " This again is x." }, { "start": 1215.04, "end": 1218.18, "text": " This here again, we can leave this away." }, { "start": 1218.18, "end": 1224.52, "text": " We can leave away the integral and you'll start to see kind of a repetitive thing." }, { "start": 1224.52, "end": 1232.6000000000001, "text": " So this is going to be the gradient somehow of your loss function with that." }, { "start": 1232.6000000000001, "end": 1236.78, "text": " Again, there is x and then there is f of z zero." }, { "start": 1236.78, "end": 1240.3200000000002, "text": " So this is somehow an x to an x hat as well." }, { "start": 1240.3200000000002, "end": 1241.92, "text": " But it's a special x hat." }, { "start": 1241.92, "end": 1247.1200000000001, "text": " Let's call it x hat prime or x hat zero." }, { "start": 1247.12, "end": 1252.56, "text": " Because the input is not z, but the input is now z zero." }, { "start": 1252.56, "end": 1257.6, "text": " Okay, this is kind of a complicated thing." }, { "start": 1257.6, "end": 1262.6799999999998, "text": " So I'm going to explain what's going on right here." }, { "start": 1262.6799999999998, "end": 1263.76, "text": " Maybe in drawing." }, { "start": 1263.76, "end": 1269.3999999999999, "text": " So what you want to do is you want to start out with z zero, which is an initial guess" }, { "start": 1269.3999999999999, "end": 1271.3999999999999, "text": " of what your latent representation is." }, { "start": 1271.3999999999999, "end": 1275.36, "text": " You do it without looking even at the image, at the data point." }, { "start": 1275.36, "end": 1277.36, "text": " You simply start with one." }, { "start": 1277.36, "end": 1280.08, "text": " And there are multiple ways to do this." }, { "start": 1280.08, "end": 1286.4599999999998, "text": " And this paper right here simply says we're going to see zero is just going to be a constant" }, { "start": 1286.4599999999998, "end": 1290.6, "text": " value zero, the constant value zero." }, { "start": 1290.6, "end": 1296.3999999999999, "text": " That's why it's called gradient origin networks, because you always start with your z zero," }, { "start": 1296.3999999999999, "end": 1300.4399999999998, "text": " your initial guess of your latent representation is the origin." }, { "start": 1300.4399999999998, "end": 1301.6799999999998, "text": " Okay." }, { "start": 1301.68, "end": 1309.8, "text": " Then you use F, your neural network to obtain a estimate, a first estimate of what your" }, { "start": 1309.8, "end": 1310.96, "text": " image could look like." }, { "start": 1310.96, "end": 1316.48, "text": " Again, you have not looked at the image, you're simply taking the z zero and you produce an" }, { "start": 1316.48, "end": 1319.0800000000002, "text": " image." }, { "start": 1319.0800000000002, "end": 1327.5600000000002, "text": " Then you somehow somehow obtain a better representation z." }, { "start": 1327.56, "end": 1333.32, "text": " And that you use your F again to obtain x hat." }, { "start": 1333.32, "end": 1340.2, "text": " And then from that x hat, you can now compare this to your x and that will give you your" }, { "start": 1340.2, "end": 1342.3999999999999, "text": " loss that you back propagate." }, { "start": 1342.3999999999999, "end": 1348.8799999999999, "text": " So two things here, you can see you use F twice, which means that your loss, if you" }, { "start": 1348.8799999999999, "end": 1353.56, "text": " back propagate it, you must somehow back propagate to both of these things." }, { "start": 1353.56, "end": 1358.1599999999999, "text": " Okay, so this is the first the first thing if you back propagate." }, { "start": 1358.1599999999999, "end": 1360.56, "text": " The second thing is what's this thing right here?" }, { "start": 1360.56, "end": 1365.1599999999999, "text": " How are we going to obtain somehow a better z?" }, { "start": 1365.1599999999999, "end": 1371.34, "text": " And the better z is going to be obtained by basically looking at the gradient." }, { "start": 1371.34, "end": 1384.08, "text": " So you've seen that we have a gradient of z zero of the loss of x and f of z zero." }, { "start": 1384.08, "end": 1388.36, "text": " That's that thing here is going to be your z." }, { "start": 1388.36, "end": 1392, "text": " z equals that." }, { "start": 1392, "end": 1393, "text": " What does it mean?" }, { "start": 1393, "end": 1399.9199999999998, "text": " It basically means that so you've tried to produce an image, but this is the real image" }, { "start": 1399.92, "end": 1405.72, "text": " that you want to get and the loss measures how far apart you are from that real image." }, { "start": 1405.72, "end": 1413.42, "text": " How would you need to change your initial guess in order to make that loss go down?" }, { "start": 1413.42, "end": 1417.46, "text": " So the negative here is to make the loss go down because otherwise it would make the loss" }, { "start": 1417.46, "end": 1418.46, "text": " go up." }, { "start": 1418.46, "end": 1425.5800000000002, "text": " Okay, so it basically simply says how do you need to change your z zero in order to decrease" }, { "start": 1425.58, "end": 1433.46, "text": " the loss in order to get a better z for representing this particular image right here." }, { "start": 1433.46, "end": 1442.56, "text": " And in the paper here is where I kind of disagree because in the paper they say that this in" }, { "start": 1442.56, "end": 1451.74, "text": " a single step this gives you the correct z or something like this." }, { "start": 1451.74, "end": 1455.1999999999998, "text": " And I don't agree." }, { "start": 1455.2, "end": 1463.38, "text": " They say with respect to the origin we obtain a latent vector that minimizes the reconstruction" }, { "start": 1463.38, "end": 1470.3600000000001, "text": " loss is obtained in a single step thereby playing the similar role to an explicit encoder." }, { "start": 1470.3600000000001, "end": 1471.3600000000001, "text": " So this is true." }, { "start": 1471.3600000000001, "end": 1472.9, "text": " This is kind of like an encoder, right?" }, { "start": 1472.9, "end": 1477.92, "text": " You simply ask what z would I need to put in in order to make this representation be" }, { "start": 1477.92, "end": 1483.32, "text": " a better sorry in order to make the latent representation be a better latent representation" }, { "start": 1483.32, "end": 1485.32, "text": " for the particular image x." }, { "start": 1485.32, "end": 1492.12, "text": " However, if you compare so what is this?" }, { "start": 1492.12, "end": 1496.72, "text": " This is essentially gradient descent in the latent space, right?" }, { "start": 1496.72, "end": 1502.58, "text": " And the fact that we look at the explicit gradient is only because they started at the" }, { "start": 1502.58, "end": 1504.52, "text": " zero point right here." }, { "start": 1504.52, "end": 1511.04, "text": " The fact that they started at the zero point means that here they can just leave away the" }, { "start": 1511.04, "end": 1512.04, "text": " following." }, { "start": 1512.04, "end": 1515.52, "text": " So if we were to do gradient descent, what you would do is you would say this my z is" }, { "start": 1515.52, "end": 1520.1, "text": " going to be equal to z zero minus this thing, right?" }, { "start": 1520.1, "end": 1525.6399999999999, "text": " Now it looks much more like gradient descent in the latent space because you have some" }, { "start": 1525.6399999999999, "end": 1529.44, "text": " initial guess and then you update it using the gradient." }, { "start": 1529.44, "end": 1531.42, "text": " Now there is no learning rate right here." }, { "start": 1531.42, "end": 1535.28, "text": " So the learning rate is one in this case." }, { "start": 1535.28, "end": 1543.08, "text": " So this is and again, the z zero because it's zero, you can just leave it away." }, { "start": 1543.08, "end": 1551.8, "text": " So this is simply one single step of gradient descent in the latent space in order to get" }, { "start": 1551.8, "end": 1554.56, "text": " a better z right here." }, { "start": 1554.56, "end": 1559.56, "text": " However, this is not a this is doesn't it doesn't guarantee you that in the single step" }, { "start": 1559.56, "end": 1564.52, "text": " you're actually going to find the correct zero even an appropriate z simply means that" }, { "start": 1564.52, "end": 1570.68, "text": " you're going to find a better z than z zero for that particular image." }, { "start": 1570.68, "end": 1574.24, "text": " And this can work right." }, { "start": 1574.24, "end": 1580.28, "text": " And again, because you back propagate to both of the F's, you say you basically say I want" }, { "start": 1580.28, "end": 1586.96, "text": " my neural network first of all to reconstruct the data point better from a given latent" }, { "start": 1586.96, "end": 1594.68, "text": " representation and I also want my neural network to give me a latent representation basically" }, { "start": 1594.68, "end": 1598.6000000000001, "text": " to help my latent to help this procedure." }, { "start": 1598.6000000000001, "end": 1601.68, "text": " You back propagate through the gradient descent procedure." }, { "start": 1601.68, "end": 1609.44, "text": " So you say I want my neural network to help me obtain a better latent representation if" }, { "start": 1609.44, "end": 1612.56, "text": " I do one step of gradient descent." }, { "start": 1612.56, "end": 1615.8600000000001, "text": " So therefore it's not just pure gradient descent in that space." }, { "start": 1615.86, "end": 1621.58, "text": " It actually the back propagation makes it such that your neural network also supports" }, { "start": 1621.58, "end": 1626.76, "text": " that supports obtaining a good representation in one step." }, { "start": 1626.76, "end": 1633, "text": " Okay, now that we've disentangled this, basically, you can see two things." }, { "start": 1633, "end": 1637.84, "text": " First of all, you could probably get an even better representation by doing multiple steps" }, { "start": 1637.84, "end": 1642.56, "text": " of gradient descent right here, maybe adjusting the learning rate a bit." }, { "start": 1642.56, "end": 1646.1599999999999, "text": " It depends right because you have to back propagate through all the gradient descent" }, { "start": 1646.1599999999999, "end": 1647.1599999999999, "text": " steps." }, { "start": 1647.1599999999999, "end": 1652.3999999999999, "text": " But pretty sure you could probably improve this by doing multiple steps." }, { "start": 1652.3999999999999, "end": 1656.44, "text": " Second of all, it doesn't really matter that this is a constant zero." }, { "start": 1656.44, "end": 1661.48, "text": " It gives you know, there's a cool name gradient origin networks, but you could probably start" }, { "start": 1661.48, "end": 1669.12, "text": " with any constant or even here's the thing even non constant initial points, you could" }, { "start": 1669.12, "end": 1671.6, "text": " sample them from a distribution and so on." }, { "start": 1671.6, "end": 1681.9599999999998, "text": " Okay, so let's change like let's imagine changing z zero to be sampled from some normal distribution." }, { "start": 1681.9599999999998, "end": 1685.7199999999998, "text": " And then it looks much more like a game, right?" }, { "start": 1685.7199999999998, "end": 1687.76, "text": " Alright, so here we go." }, { "start": 1687.76, "end": 1693.76, "text": " I've cloned the repo and I ran the code once just to make sure that the data is downloaded" }, { "start": 1693.76, "end": 1695.08, "text": " and everything." }, { "start": 1695.08, "end": 1698.08, "text": " And the code is, you know, pretty, pretty easy." }, { "start": 1698.08, "end": 1703.52, "text": " So there is one file, and I didn't do it in the colab because the colab was, I think," }, { "start": 1703.52, "end": 1705.32, "text": " a bit slow for me." }, { "start": 1705.32, "end": 1708.1999999999998, "text": " I don't know if I've caught a wrong runtime." }, { "start": 1708.1999999999998, "end": 1714.1999999999998, "text": " But essentially, there is a bunch of setup code, they know these siren layers and so" }, { "start": 1714.1999999999998, "end": 1715.1999999999998, "text": " on." }, { "start": 1715.1999999999998, "end": 1720.54, "text": " And then you have the real deal thing right here." }, { "start": 1720.54, "end": 1721.84, "text": " So you have the step." }, { "start": 1721.84, "end": 1724.12, "text": " So we do 500 steps." }, { "start": 1724.12, "end": 1730.04, "text": " And in each step, we as you can see right here, we start with zeros as z, then we put" }, { "start": 1730.04, "end": 1733.8799999999999, "text": " this into f concatenated with the coordinates." }, { "start": 1733.8799999999999, "end": 1738.36, "text": " So the coordinates is like a kind of a mesh grid type thing." }, { "start": 1738.36, "end": 1744.4399999999998, "text": " We obtain the inner loss right here, we do a gradient with respect so of the inner loss" }, { "start": 1744.4399999999998, "end": 1746.2399999999998, "text": " with respect to z." }, { "start": 1746.2399999999998, "end": 1749.2399999999998, "text": " And then the negative gradient that's going to become our outer z." }, { "start": 1749.24, "end": 1757.48, "text": " So this z up here is z zero, and this z down here is going to be our true z from the paper." }, { "start": 1757.48, "end": 1763.44, "text": " We are going to concatenate that again, with the coordinates to obtain the g, which is" }, { "start": 1763.44, "end": 1766.36, "text": " the kind of reconstruction of x." }, { "start": 1766.36, "end": 1772.28, "text": " And then our outer loss is going to be simply this reconstruction loss right here." }, { "start": 1772.28, "end": 1775.56, "text": " And then we're going to backward to all of the parameters." }, { "start": 1775.56, "end": 1776.56, "text": " Okay." }, { "start": 1776.56, "end": 1782.52, "text": " So first hypothesis is that this here is simply kind of gradient descent." }, { "start": 1782.52, "end": 1786.56, "text": " So what we should be able to do is first, let's run let's run this." }, { "start": 1786.56, "end": 1792.04, "text": " So I've run this like that." }, { "start": 1792.04, "end": 1795.84, "text": " So this is shipping it to a GPU server." }, { "start": 1795.84, "end": 1802.32, "text": " And as you will be able to see, the loss will be output." }, { "start": 1802.32, "end": 1807.3999999999999, "text": " And it's going to kind of decrease the loss over the course of 500 steps." }, { "start": 1807.3999999999999, "end": 1816.6399999999999, "text": " And we can also look at the samples." }, { "start": 1816.6399999999999, "end": 1822.36, "text": " So while that's happening, what we can do is we can actually already prepare what we" }, { "start": 1822.36, "end": 1823.36, "text": " want to do." }, { "start": 1823.36, "end": 1827.08, "text": " So if this is really gradient descent, we should be basically just able to do this z" }, { "start": 1827.08, "end": 1830.4199999999998, "text": " minus this gradient right here, because it's zeros." }, { "start": 1830.42, "end": 1834.8400000000001, "text": " We would simply expect this to yield the same loss." }, { "start": 1834.8400000000001, "end": 1841.28, "text": " So we're going to do this, and then we're going to ship this off to the server again." }, { "start": 1841.28, "end": 1843.2, "text": " Sorry." }, { "start": 1843.2, "end": 1845.24, "text": " So we were here." }, { "start": 1845.24, "end": 1849.28, "text": " And okay, the logs failed." }, { "start": 1849.28, "end": 1850.28, "text": " All right." }, { "start": 1850.28, "end": 1852.92, "text": " So this is called images." }, { "start": 1852.92, "end": 1856.8200000000002, "text": " I have this thing set up such that it's called logs." }, { "start": 1856.82, "end": 1864.04, "text": " But you can basically see that the loss right here was from 24 going to down to about 13" }, { "start": 1864.04, "end": 1866.32, "text": " or so over the course of training." }, { "start": 1866.32, "end": 1874.82, "text": " So by subtracting z minus the gradient, we there really shouldn't be any change, right?" }, { "start": 1874.82, "end": 1878.34, "text": " Because z is zero at the beginning." }, { "start": 1878.34, "end": 1880.46, "text": " So again, we're going to run this." }, { "start": 1880.46, "end": 1885.96, "text": " And while it's running, we're going to prepare the different things." }, { "start": 1885.96, "end": 1892.44, "text": " So my hypothesis is that we can maybe we could make this z here pretty much anything." }, { "start": 1892.44, "end": 1894.26, "text": " So let's do it." }, { "start": 1894.26, "end": 1896.32, "text": " Let's put it into ones." }, { "start": 1896.32, "end": 1902.16, "text": " Again, you see that the loss, I guess, you know, we get an idea of kind of the noisiness" }, { "start": 1902.16, "end": 1904.4, "text": " of this thing." }, { "start": 1904.4, "end": 1908.42, "text": " And 2119, and so on." }, { "start": 1908.42, "end": 1914.72, "text": " We can in fact, over here, we might be able to if we ship it to a different GPU, might" }, { "start": 1914.72, "end": 1916.32, "text": " be able to run two things in parallel." }, { "start": 1916.32, "end": 1924.68, "text": " So this now is when we just start with ones instead of zeros." }, { "start": 1924.68, "end": 1926.88, "text": " So let's see how that happens." }, { "start": 1926.88, "end": 1928.3600000000001, "text": " While that's the case." }, { "start": 1928.3600000000001, "end": 1934.76, "text": " So you can see right here that we ended up at also about 1413." }, { "start": 1934.76, "end": 1940.26, "text": " This pretty much is the same if you can we can look at the images that it's produced." }, { "start": 1940.26, "end": 1946.04, "text": " So the reconstructions look kind of like this of fashion MNIST, the samples kind of look" }, { "start": 1946.04, "end": 1949.48, "text": " like this." }, { "start": 1949.48, "end": 1952.94, "text": " And the interval interpolations, you can look at those as well." }, { "start": 1952.94, "end": 1957.08, "text": " But we're mainly interested also in the in the kind of loss right here." }, { "start": 1957.08, "end": 1961.44, "text": " You can see that with the ones, pretty much the same thing is happening." }, { "start": 1961.44, "end": 1970.28, "text": " So let's say we actually change this to a normal distribution." }, { "start": 1970.28, "end": 1972.66, "text": " What does that do?" }, { "start": 1972.66, "end": 1978.56, "text": " And while that's happening, we're going to revert this to the original zeros." }, { "start": 1978.56, "end": 1982.8400000000001, "text": " And we're going to investigate what happens if we just do more than one step of gradient" }, { "start": 1982.8400000000001, "end": 1984.1200000000001, "text": " descent." }, { "start": 1984.1200000000001, "end": 1987.48, "text": " So in order to do that, it's actually pretty easy." }, { "start": 1987.48, "end": 1989.8400000000001, "text": " So this here is the gradient descent step." }, { "start": 1989.84, "end": 1993.4399999999998, "text": " What we can do is we can simply double that." }, { "start": 1993.4399999999998, "end": 1998.1999999999998, "text": " So now if this is correct, I'm pretty sure this is correct." }, { "start": 1998.1999999999998, "end": 2004.6399999999999, "text": " So the normal initialized isn't really the hit right here, as you can see." }, { "start": 2004.6399999999999, "end": 2005.6399999999999, "text": " Wow." }, { "start": 2005.6399999999999, "end": 2006.6399999999999, "text": " Okay." }, { "start": 2006.6399999999999, "end": 2010.08, "text": " The normal isn't." }, { "start": 2010.08, "end": 2016.24, "text": " Maybe it's because it's too large." }, { "start": 2016.24, "end": 2017.24, "text": " I'm not sure." }, { "start": 2017.24, "end": 2021.84, "text": " The other thing is deterministic, so that's going to be a lot easier." }, { "start": 2021.84, "end": 2027.96, "text": " We can quickly go back and let's go ones." }, { "start": 2027.96, "end": 2031.64, "text": " Let's go to normal." }, { "start": 2031.64, "end": 2038.92, "text": " And let's multiply it with a tiny 0.01 or so." }, { "start": 2038.92, "end": 2041.2, "text": " I just want to see whether this works." }, { "start": 2041.2, "end": 2043.04, "text": " I have no big hopes." }, { "start": 2043.04, "end": 2044.1200000000001, "text": " Okay." }, { "start": 2044.12, "end": 2050.68, "text": " So we are here again, and we're going to make this into two different things." }, { "start": 2050.68, "end": 2053.2799999999997, "text": " Two steps of gradient descent." }, { "start": 2053.2799999999997, "end": 2055.3599999999997, "text": " All right." }, { "start": 2055.3599999999997, "end": 2058.3199999999997, "text": " So now we have two steps of gradient descent." }, { "start": 2058.3199999999997, "end": 2060.48, "text": " And let's see whether that helps." }, { "start": 2060.48, "end": 2062.18, "text": " Ah, okay." }, { "start": 2062.18, "end": 2068.68, "text": " So the normal distribution already helps or is not worse." }, { "start": 2068.68, "end": 2073.5, "text": " We simply initialized it with too big of a variance." }, { "start": 2073.5, "end": 2079.52, "text": " The 0.01 seems to be some kind of magic number for normal distributions and neural networks." }, { "start": 2079.52, "end": 2086.28, "text": " So on the right side over here, and you can see we're a bit off, but I guess with a bit" }, { "start": 2086.28, "end": 2088.6, "text": " of tuning you could do that." }, { "start": 2088.6, "end": 2092.24, "text": " And it gets down to about the same loss as you saw." }, { "start": 2092.24, "end": 2098.96, "text": " If we look at the images that this produced, I'm going to guess they seem a bit worse," }, { "start": 2098.96, "end": 2101.32, "text": " but it kind of works." }, { "start": 2101.32, "end": 2105.44, "text": " On the right side, however, if you do more than one step of gradient descent, wah, wah," }, { "start": 2105.44, "end": 2106.44, "text": " wee wah." }, { "start": 2106.44, "end": 2109.48, "text": " You see, we already started lower losses." }, { "start": 2109.48, "end": 2114.7200000000003, "text": " And since this is gradient descent, we can also, you know, there's no need why the learning" }, { "start": 2114.7200000000003, "end": 2115.84, "text": " rate should be one." }, { "start": 2115.84, "end": 2126.52, "text": " So let's try to divide it by a generous three and then by maybe, you know, it's a six, like" }, { "start": 2126.52, "end": 2131, "text": " a decreasing learning rate seems like a rather good idea." }, { "start": 2131, "end": 2136.56, "text": " And yeah, let's just take the two steps with the decreasing learning rate." }, { "start": 2136.56, "end": 2137.56, "text": " Oops." }, { "start": 2137.56, "end": 2143.16, "text": " So you can see that the loss now is way down just because we did two steps of gradient" }, { "start": 2143.16, "end": 2146.76, "text": " descent and the reconstructions, I'm going to guess they're almost perfect." }, { "start": 2146.76, "end": 2150.28, "text": " So we're now, I guess we're overfitting a bit." }, { "start": 2150.28, "end": 2155.22, "text": " So this is now trading off kind of power of the encoder decoder and so on." }, { "start": 2155.22, "end": 2161.48, "text": " But ultimately, yeah, so let's just for the last part, just try to have this gradient" }, { "start": 2161.48, "end": 2166, "text": " descent with the decreasing step size and see where that gets us if that gets us to" }, { "start": 2166, "end": 2171.4599999999996, "text": " even a lower reconstruction loss." }, { "start": 2171.4599999999996, "end": 2175.9599999999996, "text": " And that will be our investigation into the code right here." }, { "start": 2175.9599999999996, "end": 2177.9599999999996, "text": " Okay." }, { "start": 2177.9599999999996, "end": 2181.16, "text": " Do do do do do." }, { "start": 2181.16, "end": 2185.12, "text": " Okay, we start with 19." }, { "start": 2185.12, "end": 2188, "text": " Maybe we're as good as before." }, { "start": 2188, "end": 2190.48, "text": " That's fine, you know." }, { "start": 2190.48, "end": 2197.7999999999997, "text": " But I hope I hope that kind of gives a bit of evidence to my point that this is basically" }, { "start": 2197.7999999999997, "end": 2205.3199999999997, "text": " reversing a generator by using gradient descent, which has been around for a while." }, { "start": 2205.3199999999997, "end": 2211.7599999999998, "text": " And I happen to know someone who who once attempted to write a paper about it." }, { "start": 2211.76, "end": 2216.8, "text": " So yeah, but it's it's with implicit networks, which are pretty cool." }, { "start": 2216.8, "end": 2220.5200000000004, "text": " So you know, maybe this might work especially well with them given that the gradient of" }, { "start": 2220.5200000000004, "end": 2225.0400000000004, "text": " a siren is a gradient and is a siren, and so on." }, { "start": 2225.0400000000004, "end": 2229.32, "text": " Yep, as you can see, this works as well decreasing learning rate." }, { "start": 2229.32, "end": 2230.8, "text": " And now you can go nuts." }, { "start": 2230.8, "end": 2231.8, "text": " Oh, nine." }, { "start": 2231.8, "end": 2232.8, "text": " Wow." }, { "start": 2232.8, "end": 2235.0800000000004, "text": " This is the lowest loss we've gotten so far." }, { "start": 2235.0800000000004, "end": 2236.0800000000004, "text": " Right?" }, { "start": 2236.0800000000004, "end": 2237.0800000000004, "text": " Yeah." }, { "start": 2237.0800000000004, "end": 2239.1200000000003, "text": " So pretty cool." }, { "start": 2239.12, "end": 2241.92, "text": " Interpolations look like things." }, { "start": 2241.92, "end": 2243.24, "text": " These are the best samples." }, { "start": 2243.24, "end": 2246.1, "text": " I think these are the best samples we've seen today." }, { "start": 2246.1, "end": 2247.1, "text": " Maybe not." }, { "start": 2247.1, "end": 2248.2799999999997, "text": " I'm not sure." }, { "start": 2248.2799999999997, "end": 2250.4, "text": " Let's look at the interpolations quickly." }, { "start": 2250.4, "end": 2254.3199999999997, "text": " Yeah, this looks like interpolations." }, { "start": 2254.3199999999997, "end": 2256.88, "text": " I mean, if you squint." }, { "start": 2256.88, "end": 2258.96, "text": " Okay, this was it for coding." }, { "start": 2258.96, "end": 2261.3199999999997, "text": " See ya." }, { "start": 2261.32, "end": 2269.1200000000003, "text": " Now, GANs have come with encoders before or it much more looks like a variational auto" }, { "start": 2269.1200000000003, "end": 2270.7200000000003, "text": " encoder as well." }, { "start": 2270.7200000000003, "end": 2273.6400000000003, "text": " The difference here is we replace the encoder." }, { "start": 2273.6400000000003, "end": 2277.2200000000003, "text": " So this here is our encoder, right?" }, { "start": 2277.2200000000003, "end": 2281.3, "text": " This is our implicit encoder is simply gradient descent." }, { "start": 2281.3, "end": 2284.56, "text": " This has also been done before for GANs." }, { "start": 2284.56, "end": 2289.84, "text": " So people train GANs and then they try to find the latent representation by back propagating." }, { "start": 2289.84, "end": 2296.08, "text": " And some people even do this while training." }, { "start": 2296.08, "end": 2302.8, "text": " They do gradient descent and then either do or do not back prop through the GAN, through" }, { "start": 2302.8, "end": 2304.8, "text": " the gradient descent procedure." }, { "start": 2304.8, "end": 2314, "text": " So in a way or another, this is kind of sort of like those ideas, not saying it is equal." }, { "start": 2314, "end": 2318.28, "text": " And again, there could be like some special interaction because you actually back prop" }, { "start": 2318.28, "end": 2322.1400000000003, "text": " through both these things and there could be some special interaction because these" }, { "start": 2322.1400000000003, "end": 2324.32, "text": " are implicit neural networks." }, { "start": 2324.32, "end": 2329.6000000000004, "text": " However, I very much view these as two different things." }, { "start": 2329.6000000000004, "end": 2335.7400000000002, "text": " The cool, there is a rather cool derivation of that where you can say, okay, you can also" }, { "start": 2335.7400000000002, "end": 2339.1200000000003, "text": " use it as a classifier by basically doing this." }, { "start": 2339.1200000000003, "end": 2342.88, "text": " And now hope you can understand this much better." }, { "start": 2342.88, "end": 2348.52, "text": " So what we'll have is we'll have the classification loss for sample X is going to be your cross" }, { "start": 2348.52, "end": 2351.6, "text": " entropy loss between two things." }, { "start": 2351.6, "end": 2352.96, "text": " Okay." }, { "start": 2352.96, "end": 2356.96, "text": " Well, can you please go down again?" }, { "start": 2356.96, "end": 2357.96, "text": " Thanks." }, { "start": 2357.96, "end": 2364.32, "text": " So your cross your loss between two things is going to be the loss between your label" }, { "start": 2364.32, "end": 2365.32, "text": " Y." }, { "start": 2365.32, "end": 2366.32, "text": " So that's one thing." }, { "start": 2366.32, "end": 2371.2000000000003, "text": " And usually you have the feature, the logits on this side, right?" }, { "start": 2371.2, "end": 2374.96, "text": " Now you can see right here, you have an F that's probably that something that gives" }, { "start": 2374.96, "end": 2378.52, "text": " you the logits from your features." }, { "start": 2378.52, "end": 2383.8799999999997, "text": " And here your features aren't going to be the data point itself, but your features are" }, { "start": 2383.8799999999997, "end": 2388.7599999999998, "text": " going to be the Z variable that comes with the data point." }, { "start": 2388.7599999999998, "end": 2392.46, "text": " So basically you use this as a feature producer." }, { "start": 2392.46, "end": 2399.12, "text": " And the feature producer is made by again, minimizing this reconstruction loss." }, { "start": 2399.12, "end": 2404.7999999999997, "text": " Now I'm not sure this is going to work really well for classifiers because classifiers generally" }, { "start": 2404.7999999999997, "end": 2407.6, "text": " don't require you to reconstruct things." }, { "start": 2407.6, "end": 2415, "text": " And we know this, you know, people try to, this is like you were to have a variational" }, { "start": 2415, "end": 2421, "text": " autoencoder and then simply use that encoder as a feature producer for a classifier, which" }, { "start": 2421, "end": 2422.96, "text": " generally doesn't work very well." }, { "start": 2422.96, "end": 2426.7999999999997, "text": " But you know, you can, you can do it right here." }, { "start": 2426.8, "end": 2433.1200000000003, "text": " And the cool thing is that you can actually use the implicit representation network F" }, { "start": 2433.1200000000003, "end": 2438.6400000000003, "text": " to give you features for the entire data sample Z." }, { "start": 2438.6400000000003, "end": 2443.5600000000004, "text": " So you're kind of freed from the coordinate representation here and you get kind of a" }, { "start": 2443.5600000000004, "end": 2447.7000000000003, "text": " latent vector back." }, { "start": 2447.7000000000003, "end": 2453.1600000000003, "text": " So this is how you would use an implicit neural network in order to do classification." }, { "start": 2453.16, "end": 2457.48, "text": " That's I think, you know, pretty, pretty cool derivation of this." }, { "start": 2457.48, "end": 2463.72, "text": " So here they make some empirical claims, which I don't, I don't want to go too much into," }, { "start": 2463.72, "end": 2467.7599999999998, "text": " but there are certain advantages, certain practical advantages of doing things like" }, { "start": 2467.7599999999998, "end": 2468.7599999999998, "text": " this." }, { "start": 2468.7599999999998, "end": 2474.52, "text": " Like you can have very, very few parameters to represent an entire set of data." }, { "start": 2474.52, "end": 2481.04, "text": " The interpolations here work nicely as you can see." }, { "start": 2481.04, "end": 2486.7599999999998, "text": " And I think generally they make the claim that this trains fast and you can see after" }, { "start": 2486.7599999999998, "end": 2492.64, "text": " three seconds, it already has a lot of information about the data set and it does some sensible" }, { "start": 2492.64, "end": 2494.12, "text": " things." }, { "start": 2494.12, "end": 2495.62, "text": " Okay." }, { "start": 2495.62, "end": 2505.72, "text": " So the code is available and in fact, I'll probably enter, inter parse into this video" }, { "start": 2505.72, "end": 2509.66, "text": " a let's actually test our hypotheses, right?" }, { "start": 2509.66, "end": 2511.48, "text": " Let's test these hypotheses that I said." }, { "start": 2511.48, "end": 2516.2, "text": " So first hypothesis is probably we can start with something else than the constant zero" }, { "start": 2516.2, "end": 2521.8999999999996, "text": " and second hypothesis is we can probably improve by doing multiple steps of gradient descent" }, { "start": 2521.8999999999996, "end": 2523.68, "text": " in the inner loop." }, { "start": 2523.68, "end": 2528.68, "text": " Yes, I, this might be somewhere in this video." }, { "start": 2528.68, "end": 2531.72, "text": " And if not, it comes at the end like right now." }, { "start": 2531.72, "end": 2532.72, "text": " Okay." }, { "start": 2532.72, "end": 2533.72, "text": " So I'll see you next time." }, { "start": 2533.72, "end": 2540.48, "text": " Bye bye." } ]
x6T1zMSE4Ts
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
NVAE: A Deep Hierarchical Variational Autoencoder (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "gan", "vae", "kl", "elbo", "autoencoder", "variational", "latent", "sampling", "hierarchical", "scales", "faces", "mnist", "cifar10", "swish", "batch norm", "generative", "nvidia", "mixed precision", "memory", "deep", "layers", "depthwise convolutions", "cnn", "convolutional", "generation", "generative model" ]
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 NVAE, I don't know how to pronounce that, a deep hierarchical variational autoencoder by Arash Wadat and Jan Kautz of NVIDIA. 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. But 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, real. 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 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. Now, 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 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 encoder and the decoder to reproduce these images correctly. Now, if you only do that, 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, 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'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 the thing around my mean. And so this here will always be kind of the same Z. So it won't be a distribution at all. It will just be this dirac. And I'm back to the original 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, not only this objective, the reconstruction objective, but there is a second objective where we say that we impose a regularization. And the regularization is that this here is as close as possible to a standard normal distribution. And I guess you can choose that the prior but in regularly you say, okay, this here, I don't want you encoder, I don't want you to go far away from a standard normal distribution, like do what you have to do to make the loss small, but don't go away too far. Alright, so that's the kind of balance in the VAE. And as you can imagine, if you have a normal distribution, and you sample these Z vectors here, and the reconstruction loss is always the same. So if you input the same x here a bunch of times, you'll get different Z's, right? You get 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 there is an interaction, I think, I think that's what's happening. I guess I'm not an expert on VAEs. 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 VAEs produce usually blurry images. And that's been a problem for a long time that everything's kind of kind of blurry. So here, the VA, 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, Nvidia 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, this is a learned quantity, but you can also view it as just kind of the zero vector, we start out with our noise, we sample our noise, but our noise is going to be, it's going to be, let's say it's in the shape of an image, we can do that, we can reshape images, right. So it's going to just be a 16 entry vector. And it's going to be shaped like this, okay, we sample noise like this. And then we produce an image of 16 by 16 from it, I think they start with eight by eight or something like this. But in conceptually, you do that, then you have a neural network, this is a residual neural network produce an image out of that noise, right, it maps the noise to the image. So this is your, this is your D, your discriminator part. But then you're not done. What you do is you would actually upscale that image, or that can happen in the neural network, I believe, or you are up sampled from the beginning, and you enlarge these things. But what you would do is you would upscale your neural network. And you go higher. And so on. So you go higher and higher and higher in the hierarchy of noises. So this is a hierarchical model. Oh, yeah, down here. So they start, they start from, as you can see, it consists of 36 groups, in their case, of latent variables, starting from eight by eight, scaled up to 128 to 128, with two residual cells per latent variable groups. Okay, so you continuously scale and scale and scale up your your your images, and each time you add another bunch of these noises right here. So that means that in this model, you can, the uppermost residual model can sort of get the coarse 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 coarse scale. And then you up sample it and you let another model add on top of that, the next layer of the next layer of features, you can see this is kind of a residual connection right here. And you, again, sample, and you let another neural network up sample, sorry, 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, there will be additional details added. And that's why in their samples, you will see that they're not super blurry at all. Though, I have to say something right here, if you look at these images, and you compare them, so later they compare them, they, like, they're almost look like puppets, right. So here you compare it to these are these are previous methods down there. Now, you know, to say that they're pretty, they're, you can see they're clearly kind of worse in that you can hear the symmetry of the faces aren't really given also the symmetries. Here, you can see that there are no symmetries. Here, there are no long range dependencies. The hair details are often missing as compared to like here, this is pretty crisp. But if you look at like the skin of people, and can just kind of the image composition in shadows, it looks like these, these people are like cardboard cutouts here, they have like these multiple layers where I mean, I'm I the only one that just sees this, this is like a plastic cutout. And then the face is again, like a plastic cutout and the faces are so smooth. I mean, look at this. These are like, too pretty. Like you can just look at this for hours. This is so like the diff. It maybe it just seems like this to me, but the difference if you kind of look at the skin and it almost feels like the bottom ones are actual real photographs in just in terms of the faces and the the kind of the color, just the smoothness is just all look like porcelain. This might actually be an effect of the VAE, right? Because it's not blurry, right? As a you know, the the lines and so on. But the the skin texture might just be one one scale too much here. And that's where we now see the blurriness or it might just be that I don't I don't know. Okay, I have no idea. This just this just somehow whereas was popping out to me as the main difference, like they are much more crisp and so on and much more beautiful, but also they look like puppets. Yeah. 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 the uppermost thing here is a regular VAE noise, right? We have a noise, we sample from it, and we generate this particular scale of image. Okay, so how do we get that noise? We simply this is this 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 the kind of VAE encoding method. Okay, now the interesting part is how do we get Z two, and you might just think, well, we'll just go like one layer up here, but Z two, as you can see here, it depends on Z one during sampling. So during inference, we have also have to have that Z two depends on Z one. And that's why we first need to go to Z one and actually produce a sample. So our method of inferring the latent codes includes already sampling from those latent codes, right? So you sample, and you do the same thing as you would do in the right. In fact, these models are shared. And then you can see that Z two now depends on Z one in this procedure, because you go here, and you go here and here. So Z two depends on Z one, Z three, in turn would depend on Z two and Z one. And you have a properly hierarchically factorized model right here. Okay, so this, this is called a hierarchical VAE, it pretty much works like a VAE, except that it is hierarchical. And you need to do here need to have this bottom up and this top down model in order in your encoder. And so now there are a bunch of questions with respect to the hierarchical VAE. The problem here is that you have not only one sampling procedure, but you have sampling procedure upon sampling procedure upon sampling procedure. And this can get pretty unstable, I guess pretty quickly. So the rest of the paper is going to be how to get this to work. So the main, I think one of the main parts they do in order to get this to work in order to get this to train our residual connections. So we know that residual connections are kind of a sort of a gradient flow highway in order in order to to train very deep networks. And we've already seen this with residual networks 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, even okay, the the pluses might actually not be okay, the pluses can also be combination, I guess. I guess that that I might be wrong, and they can actually be combinations. In any case, they use residual networks in in a in a lot of cases in their generative and in their generator and in their encoder. You can see right here, there is a residual cell for the generative model and a residual cell for the encoder. Now, the exact method of these residual cell, you can see that they use batch norm, then they use one by one convolutions in order to go to a higher to a higher channel number before they do the depth separated five by five convolutions. So five by five, because you need a larger receptive field, they make that clear, they need a large receptive field. However, the large receptive field means many parameters means their model would be too big and too much memory. So they do the depth separated convolutions, which simply means that you don't mix the channels during 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 a swish non-linearity as you can see here. And then here as well in the encoder, they also say in the text, like they stress the importance, we found that first the batch norm and then the convolution is better than the other way around and so on. So this there's a lot of engineering work that went into this right here. So you see there's batch norm. And also you have to kind of hack the batch norm, because in batch norm you have these training parameters and people have observed that in VAEs. If you during inference, during sampling, if you use the training way where you only regularize within the batch, it's better than if you use the running averages. So you kind of have to hack that. We modify the momentum parameter of batch norm such that running statistic can catch up faster with the batch statistics. There's a lot of engineering in here. Like there's a lot of things that you have to get right to get something like this to work apparently. And yeah, this the paper, the paper just goes on in this style. So you can see they use the swish activation. They use squeeze and excitation blocks, which are another form of residual blocks that were introduced quite a long time ago, but still being used as you can see. And yeah, so that's the architecture. So you can see they have residual cells there, residual cells here, reducing the memory requirements. They say they use two tricks. First of all, we they do mixed precision using a cool new Nvidia library. Given that they're from Nvidia, they get to try these things out first. And second of all, they also to reduce the memory, we fuse batch norm and swish and we store only one feature map for the backward pass instead of two. And they have to then recompute this trick is known as gradient checkpointing and cries, recomputing batch norm in the backward pass. I believe like future deep learning frameworks should just take care of that for you, instead of you having to do this kind of stuff. Honestly, so they also need to, they hear they say taming the unbounded KL term. So the KL term is what makes the distribution that the encoder outputs close to that distribution that you want like that normal distribution. So this is the regularization term, you can see here, it's a KL divergence between q, which is what your encoder outputs, you can see that's the, the latent code for the image x, between the two, the two, the two, the two, the two. And 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 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. 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, so the encoder has to produce a z of the first layer and then a z of the second layer and so on, in order for the encoder to reproduce that and to be close it must match this distribution and it must match this distribution. So if it doesn't match this distribution correctly it will kind of sample somewhere else a bit. 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, 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 0 that's the same thing, right, because the prior is going to be zero mean and unit variance. So that's this here, this here will be zero and this here will be one. But in all the upper layers this is going to make it easier. So that's one trick you have to make this repeated sampling not hurt you as much. The other trick they employ here is special regular, sorry, spectral regularization, which is a regularization where you regularize the top singular value per layer. You can use that, you can compute that with a power iteration, people have been done doing this before, and also you can build in some normalizing flows. So here 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 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 want to go too much into this because it doesn't gain that much, they say you can just build that in if you want. Okay so these are all the things that at least they list in the method section. Now there are like a lot more that they have to do, but ultimately as you can see right here 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, to 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. 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 non or auto regressive models and it gets pretty close to the best auto regressive models which are down here. They are still better, but the gap is kind of shrinking is what they say. Cool so that's the main result. Then they have ablations where they basically, as I said, all of these things kind of contribute a little bit, a little bit, a little bit, a little bit to building this bigger and bigger and deeper variational auto encoder. So it's hard to say what exactly makes this work because all of it makes it work. And I guess they just kept going until they beat state-of-the-art or until you know they ran out of tricks. Again these are the samples that we looked at and I do want to spend some time in the appendix right here because I think it's pretty interesting what they do. So first of all they show that their model doesn't remember the training samples. As you can see right here these are always the nearest neighbor from the training sample so the model is fairly you know fairly far away from the training samples. But yeah I mean okay maybe it's just me but the left they just look like more kind of more ideal idealized humans like very smooth humans like designer babies. Here they show that if you use batch norm as you would use it I think regularly where you keep these running stats or you do the batch norm from training then you get into this kind of degenerate case if you sample at lower temperatures. So the temperature that you sample from describes the width of the Gaussian that you ultimately want to sample from. And if you do they have this method to readjust the batch norm statistics which I don't want to go into here but you can you can read it up to basically fix that problem. It is a problem that apparently other people have observed as well and their method apparently is you know is a is one that manages to do that. Okay lastly there are some more samples right here. And 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 right and so that give gets you like an image and then there's z2 and that gets you an image and then there's z3 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 8 by 8 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 8 by 8 dimensional groups the second scale does apply at some global motive does apply some global modifications such as changing eyes hair color skin tone the shape of the face the bottom groups capture mostly low-level variations however the lowest scale can still still make some subtle long-range modifications for example the hair color is slightly modified when we are only sampling from the lowest scale in the last row this is potentially enabled because of the larger receptive field in our depth wise separate separable residual cell yeah I don't the hair color changes okay slightly maybe I don't know my my eyes are too many faces okay but you know what's certainly the case is that their models exhibit much better kind of global unity compared to these other samples where you can pretty clearly see like the different sides of the faces have little to do with each other and so on and this is the benefit that you get from doing this hierarchically so you have part of your model that's responsible for kind of the global shape of the image and then that keeps it consistent and then you have other parts that are responsible for the details okay so I hope this was something to you know that interested you I myself it's as I said it's it's an engineering paper so there is lots of things described there 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 I hope you gained something from it and I'll see you next time
[ { "start": 0, "end": 5.6000000000000005, "text": " Alright, hi there. Have a look at these faces right here. So you're probably used by now to seeing" }, { "start": 5.6000000000000005, "end": 11.200000000000001, "text": " computer-generated faces of really high quality, but probably you're used to seeing these faces" }, { "start": 11.200000000000001, "end": 17.64, "text": " coming from a generative adversarial network. However, these faces right here are from a" }, { "start": 17.64, "end": 23, "text": " variational autoencoder. Now, variational autoencoders are fundamentally different than GANs," }, { "start": 23, "end": 29.64, "text": " and traditionally they've been a bit harder to scale up to high-resolution images and give sort" }, { "start": 29.64, "end": 37.6, "text": " of very detailed, sharp output. This paper right here attempts to build such a VAE for these high" }, { "start": 37.6, "end": 45.64, "text": " resolution large data set. And it basically details everything you need to do to get a VAE like this." }, { "start": 45.64, "end": 51.92, "text": " So the paper is called NVAE or NVAE, I don't know how to pronounce that, a deep hierarchical" }, { "start": 51.92, "end": 58.2, "text": " variational autoencoder by Arash Wadat and Jan Kautz of NVIDIA. As I said, on a high level," }, { "start": 58.2, "end": 65.64, "text": " this paper is about how to build a deep hierarchical variational autoencoder, which is sort of a" }, { "start": 65.64, "end": 72.12, "text": " combination of already existing techniques combined in a clever way, and then listing all" }, { "start": 72.12, "end": 78.60000000000001, "text": " the engineering efforts that you need to do to actually make this work. And there is not one" }, { "start": 78.60000000000001, "end": 83.12, "text": " thing where you can say, ah, this is the thing that really made it work. But each of these" }, { "start": 83.12, "end": 90.86, "text": " techniques is going to stack and stack and stack until they reach a model that surpasses the state" }, { "start": 90.86, "end": 96.80000000000001, "text": " of the art on these data sets. And they are also able to apply this to an entirely new high quality" }, { "start": 96.80000000000001, "end": 103.4, "text": " image data set. So these again are some of the samples from that model. And as you can see," }, { "start": 103.4, "end": 114.92, "text": " they look very, very crisp, very sharp, and also very, let's say, real. Yeah. So really briefly," }, { "start": 114.92, "end": 121.04, "text": " variational autoencoders. So this paper attempts to build a variational autoencoder. What is it?" }, { "start": 121.04, "end": 126.28, "text": " For that, you need to start with what an autoencoder is. So an autoencoder traditionally," }, { "start": 126.28, "end": 131.84, "text": " let's say you have an image data set, and you take an image and you train a model that consists of" }, { "start": 131.84, "end": 138.12, "text": " an encoder that maps your image to a lower dimensional space, a compressed space, which" }, { "start": 138.12, "end": 145.68, "text": " you call the latent space Z. And then you train a decoder to, again, go from the latent space back" }, { "start": 145.68, "end": 152.76, "text": " to the image space. And then you train those two models such that the distance between the output" }, { "start": 152.76, "end": 159.88, "text": " and the input is minimized. Okay, this is called the reconstruction loss. And you train the encoder" }, { "start": 159.88, "end": 166.12, "text": " and the decoder to minimize that reconstruction loss. And thereby, you hope that this latent space" }, { "start": 166.12, "end": 173.56, "text": " will learn something about the data. Now, a sort of advanced version of this and a probabilistic" }, { "start": 173.56, "end": 179.48, "text": " version of this is the variational autoencoder, where we say, what we want to do is we don't want" }, { "start": 179.48, "end": 187.51999999999998, "text": " the encoder to just output directly the latent code, but we interpret this in a probabilistic" }, { "start": 187.52, "end": 193.96, "text": " fashion. So the encoder is now a probabilistic function that outputs a distribution over latent" }, { "start": 193.96, "end": 200.8, "text": " codes. So we take our same image. And what we want to do is we want a Bayesian, basically," }, { "start": 200.8, "end": 205.76000000000002, "text": " it's a Bayesian way of thinking of it, we want a distribution over latent codes corresponding to" }, { "start": 205.76000000000002, "end": 213.64000000000001, "text": " that image. So our encoder here is not going to output Z, but it's going to output mu and sigma." }, { "start": 213.64, "end": 218.48, "text": " So it would be ideal if you could output an entire distribution, but we're going to make" }, { "start": 218.48, "end": 223.48, "text": " some assumptions here that that is a normal distribution. And it's going to output the mean" }, { "start": 223.48, "end": 231.67999999999998, "text": " and the standard deviation of that normal distribution. And then you actually, because" }, { "start": 231.67999999999998, "end": 236.64, "text": " now you how you're going to feed this into the decoder, if you just feed mu, you are back to the" }, { "start": 236.64, "end": 242.32, "text": " normal autoencoder. So that doesn't work. What you do is you actually instantiate that normal" }, { "start": 242.32, "end": 249.32, "text": " distribution with the mu and the sigma. So you plug that in here, you sample one sample from that" }, { "start": 249.32, "end": 256.76, "text": " normal distribution. And then you feed that sample into your decoder. Again, your decoder outputs" }, { "start": 256.76, "end": 262.92, "text": " an image from that sample. And you compare this with the reconstruction loss. And now you train" }, { "start": 262.92, "end": 273.72, "text": " the entire process. So you train the encoder and the decoder to reproduce these images correctly." }, { "start": 273.72, "end": 281.88, "text": " Now, if you only do that, then the model will basically regress to a standard autoencoder." }, { "start": 281.88, "end": 287.64, "text": " Why is that? Well, what's pretty easy for the... You can see that estimating the distribution is" }, { "start": 287.64, "end": 294.91999999999996, "text": " harder than estimating just the latent code, at least for the training data set, right? So if you" }, { "start": 294.91999999999996, "end": 300.91999999999996, "text": " don't pay attention, what's going to what the encoder is going to do is it's going to say," }, { "start": 300.91999999999996, "end": 309.32, "text": " oh, well, if I just make this here, my latent code, and if I just make this as small as possible," }, { "start": 309.32, "end": 318.92, "text": " like zero, or like one to the minus 10, 10, that's still one, 10 to the minus one. That's not that" }, { "start": 318.92, "end": 327.24, "text": " small. 10 to the minus 10, 11, 12, okay, a very small number, then that normal distribution will" }, { "start": 327.24, "end": 337.8, "text": " basically be just spiky around the thing around my mean. And so this here will always be kind of the" }, { "start": 337.8, "end": 344.6, "text": " same Z. So it won't be a distribution at all. It will just be this dirac. And I'm back to the" }, { "start": 344.6, "end": 349.8, "text": " original autoencoder, which I don't want. I want my probabilistic framework so I can compute" }, { "start": 349.8, "end": 354.28000000000003, "text": " likelihoods and so on. There are various advantages to having a probabilistic view" }, { "start": 354.28000000000003, "end": 362.2, "text": " of the data rather than just a model that produces it. Okay, and that's why in a VAE," }, { "start": 362.2, "end": 367.96, "text": " there is not only the objective, not only this objective, the reconstruction objective, but there" }, { "start": 367.96, "end": 376.76, "text": " is a second objective where we say that we impose a regularization. And the regularization is that" }, { "start": 376.76, "end": 386.52, "text": " this here is as close as possible to a standard normal distribution. And I guess you can choose" }, { "start": 386.52, "end": 393.4, "text": " that the prior but in regularly you say, okay, this here, I don't want you encoder, I don't want" }, { "start": 393.4, "end": 398.91999999999996, "text": " you to go far away from a standard normal distribution, like do what you have to do to" }, { "start": 398.91999999999996, "end": 406.76, "text": " make the loss small, but don't go away too far. Alright, so that's the kind of balance in the VAE." }, { "start": 406.76, "end": 412.91999999999996, "text": " And as you can imagine, if you have a normal distribution, and you sample these Z vectors here," }, { "start": 412.92, "end": 418.52000000000004, "text": " and the reconstruction loss is always the same. So if you input the same x here a bunch of times," }, { "start": 418.52000000000004, "end": 425.16, "text": " you'll get different Z's, right? You get Z1, Z2, Z3, because it's sampled from this distribution," }, { "start": 425.16, "end": 432.44, "text": " there's a sampling procedure right here. So if your discriminator here is kind of smooth," }, { "start": 432.44, "end": 439.16, "text": " then it will output different images. Now these images will always be compared to that same input" }, { "start": 439.16, "end": 446.28000000000003, "text": " image, right? So you're training this whole architecture to always reconstruct that input" }, { "start": 446.28000000000003, "end": 453.16, "text": " image from different images. So there is an interaction, I think, I think that's what's" }, { "start": 453.16, "end": 460.76000000000005, "text": " happening. I guess I'm not an expert on VAEs. But this here usually is something like the L2 loss." }, { "start": 460.76000000000005, "end": 467.72, "text": " So in terms of how this affects the images, if I have different images that are sort of the same," }, { "start": 467.72, "end": 475.72, "text": " but sort of different, and I have to make it L2 loss close to this image right here, then one" }, { "start": 475.72, "end": 483.40000000000003, "text": " option I have is to make them kind of blurry. So if I make all of them kind of blurry in the L2 loss," }, { "start": 483.40000000000003, "end": 490.20000000000005, "text": " that will give me a lower penalty. So that's, I believe that's one of the explanations I heard" }, { "start": 490.20000000000005, "end": 496.6, "text": " at some point why VAEs produce usually blurry images. And that's been a problem for a long time" }, { "start": 496.6, "end": 506.36, "text": " that everything's kind of kind of blurry. So here, the VA, the hierarchical VAE comes to the rescue." }, { "start": 507.32000000000005, "end": 513.88, "text": " So how they are going to battle this problem is by doing a hierarchical variational auto encoder." }, { "start": 513.88, "end": 519.64, "text": " And this is how it works. So you start off, this is your generator, by the way, once you've trained" }, { "start": 519.64, "end": 526.2, "text": " your VAE, right, once you've trained it, you can simply sample from your prior from this here," }, { "start": 526.2, "end": 531.4000000000001, "text": " because that's, you know, close enough to this, or you can, I guess, learn the prior of your data" }, { "start": 531.4000000000001, "end": 536.5200000000001, "text": " distribution, and so on. And you can just use the generator right here, the generative part," }, { "start": 536.5200000000001, "end": 543.88, "text": " this part right here is your generator in order to produce images. So you can sample from a VAE," }, { "start": 544.5200000000001, "end": 552.84, "text": " like you could sample from a GAN. Okay, so here, we'll look at a model that could combat those" }, { "start": 552.84, "end": 559.1600000000001, "text": " things. On the right side, you can see the model that you would ultimately sample from. So this is" }, { "start": 559.1600000000001, "end": 566.12, "text": " going to be your decoder, okay, this generative model right here. And what they do is it's very" }, { "start": 566.12, "end": 573.48, "text": " similar to if you, Nvidia also had this paper about this GAN, where they are on different scales," }, { "start": 573.48, "end": 579.24, "text": " like progressive, I think, prog GAN, which was the first that introduced actually this high quality" }, { "start": 579.24, "end": 585.96, "text": " face data sets, I believe, at least. So here, we're going to do a very, very similar trick." }, { "start": 585.96, "end": 593.32, "text": " So the idea is that we start out, this is a learned quantity, but you can also view it as" }, { "start": 593.32, "end": 598.84, "text": " just kind of the zero vector, we start out with our noise, we sample our noise, but our noise is" }, { "start": 598.84, "end": 604.6800000000001, "text": " 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" }, { "start": 604.68, "end": 613.0799999999999, "text": " reshape images, right. So it's going to just be a 16 entry vector. And it's going to be shaped like" }, { "start": 613.0799999999999, "end": 621, "text": " this, okay, we sample noise like this. And then we produce an image of 16 by 16 from it, I think" }, { "start": 621, "end": 627.4, "text": " they start with eight by eight or something like this. But in conceptually, you do that, then you" }, { "start": 627.4, "end": 633.24, "text": " have a neural network, this is a residual neural network produce an image out of that noise, right," }, { "start": 633.24, "end": 640.04, "text": " it maps the noise to the image. So this is your, this is your D, your discriminator part. But then" }, { "start": 640.04, "end": 646.6800000000001, "text": " you're not done. What you do is you would actually upscale that image, or that can happen in the" }, { "start": 646.6800000000001, "end": 653.08, "text": " neural network, I believe, or you are up sampled from the beginning, and you enlarge these things." }, { "start": 654.12, "end": 658.36, "text": " But what you would do is you would upscale your neural network." }, { "start": 658.36, "end": 669.5600000000001, "text": " And you go higher. And so on. So you go higher and higher and higher in the hierarchy of noises. So" }, { "start": 669.5600000000001, "end": 676.84, "text": " this is a hierarchical model. Oh, yeah, down here. So they start, they start from, as you can see," }, { "start": 677.4, "end": 684.9200000000001, "text": " it consists of 36 groups, in their case, of latent variables, starting from eight by eight," }, { "start": 684.92, "end": 695.4, "text": " scaled up to 128 to 128, with two residual cells per latent variable groups. Okay, so you continuously" }, { "start": 695.4, "end": 703, "text": " scale and scale and scale up your your your images, and each time you add another bunch of these" }, { "start": 703, "end": 711.56, "text": " noises right here. So that means that in this model, you can, the uppermost residual model can" }, { "start": 711.56, "end": 717.2399999999999, "text": " sort of get the coarse details of the image. And that's going to be blurry, because it's a VAE," }, { "start": 717.2399999999999, "end": 723, "text": " but it's going to be blurry in that coarse scale. And then you up sample it and you let another" }, { "start": 723, "end": 730.04, "text": " model add on top of that, the next layer of the next layer of features, you can see this is kind" }, { "start": 730.04, "end": 737.0799999999999, "text": " of a residual connection right here. And you, again, sample, and you let another neural network" }, { "start": 737.08, "end": 744.44, "text": " up sample, sorry, you know, let another neural network add more features in a higher resolution." }, { "start": 744.44, "end": 751.48, "text": " So even though each VAE can be blurry in its own scale, it will be upscaled and there," }, { "start": 752.84, "end": 758.6800000000001, "text": " there will be additional details added. And that's why in their samples, you will see that" }, { "start": 758.6800000000001, "end": 765, "text": " they're not super blurry at all. Though, I have to say something right here, if you look at" }, { "start": 765, "end": 772.92, "text": " these images, and you compare them, so later they compare them, they, like, they're almost look like" }, { "start": 772.92, "end": 780.44, "text": " puppets, right. So here you compare it to these are these are previous methods down there. Now," }, { "start": 780.44, "end": 787.56, "text": " you know, to say that they're pretty, they're, you can see they're clearly kind of worse in that you" }, { "start": 787.56, "end": 794.28, "text": " can hear the symmetry of the faces aren't really given also the symmetries. Here, you can see that" }, { "start": 794.28, "end": 800.6, "text": " there are no symmetries. Here, there are no long range dependencies. The hair details are often" }, { "start": 800.6, "end": 807.72, "text": " missing as compared to like here, this is pretty crisp. But if you look at like the skin of people," }, { "start": 807.72, "end": 812.76, "text": " and can just kind of the image composition in shadows, it looks like these, these people are" }, { "start": 812.76, "end": 819.9599999999999, "text": " like cardboard cutouts here, they have like these multiple layers where I mean, I'm I the only one" }, { "start": 819.96, "end": 825.8000000000001, "text": " that just sees this, this is like a plastic cutout. And then the face is again, like a plastic cutout" }, { "start": 825.8000000000001, "end": 833.8000000000001, "text": " and the faces are so smooth. I mean, look at this. These are like, too pretty. Like you can just look" }, { "start": 833.8000000000001, "end": 840.76, "text": " at this for hours. This is so like the diff. It maybe it just seems like this to me, but the" }, { "start": 840.76, "end": 848.6800000000001, "text": " difference if you kind of look at the skin and it almost feels like the bottom ones are actual real" }, { "start": 848.68, "end": 858.28, "text": " photographs in just in terms of the faces and the the kind of the color, just the smoothness is just" }, { "start": 858.28, "end": 865.8, "text": " all look like porcelain. This might actually be an effect of the VAE, right? Because it's not blurry," }, { "start": 865.8, "end": 873.56, "text": " right? As a you know, the the lines and so on. But the the skin texture might just be one one scale" }, { "start": 873.56, "end": 879.16, "text": " too much here. And that's where we now see the blurriness or it might just be that I don't I" }, { "start": 879.16, "end": 888.76, "text": " don't know. Okay, I have no idea. This just this just somehow whereas was popping out to me as the" }, { "start": 888.76, "end": 894.76, "text": " main difference, like they are much more crisp and so on and much more beautiful, but also they look" }, { "start": 894.76, "end": 905.16, "text": " like puppets. Yeah. Alright, so let's get back to the model right here because so once we decided" }, { "start": 905.16, "end": 910.2, "text": " that we want such a hierarchical model, what we need to do is we need to simply build a VAE for" }, { "start": 910.2, "end": 917.72, "text": " each of these hierarchies, right? So the the uppermost thing here is a regular VAE noise," }, { "start": 917.72, "end": 924.52, "text": " right? We have a noise, we sample from it, and we generate this particular scale of image." }, { "start": 924.52, "end": 930.1999999999999, "text": " Okay, so how do we get that noise? We simply this is this down here is our this is our encoder and" }, { "start": 930.1999999999999, "end": 936.68, "text": " this is our decoder. We simply have our encoder, this is a series of neural networks, and we get" }, { "start": 936.68, "end": 946.12, "text": " our latent encoding, right? So the Z is obtained through the the kind of VAE encoding method. Okay," }, { "start": 946.12, "end": 951, "text": " now the interesting part is how do we get Z two, and you might just think, well, we'll just go" }, { "start": 951, "end": 957.56, "text": " like one layer up here, but Z two, as you can see here, it depends on Z one during sampling." }, { "start": 957.56, "end": 963.16, "text": " So during inference, we have also have to have that Z two depends on Z one. And that's why we" }, { "start": 963.16, "end": 969.96, "text": " first need to go to Z one and actually produce a sample. So our method of inferring the latent" }, { "start": 969.96, "end": 979.08, "text": " codes includes already sampling from those latent codes, right? So you sample, and you do the same" }, { "start": 979.08, "end": 985.24, "text": " thing as you would do in the right. In fact, these models are shared. And then you can see that Z two" }, { "start": 985.24, "end": 993.1600000000001, "text": " now depends on Z one in this procedure, because you go here, and you go here and here. So Z two" }, { "start": 993.1600000000001, "end": 999.8000000000001, "text": " depends on Z one, Z three, in turn would depend on Z two and Z one. And you have a properly" }, { "start": 999.8000000000001, "end": 1008.2, "text": " hierarchically factorized model right here. Okay, so this, this is called a hierarchical VAE, it" }, { "start": 1008.2, "end": 1013.96, "text": " pretty much works like a VAE, except that it is hierarchical. And you need to do here need to have" }, { "start": 1013.96, "end": 1021.6400000000001, "text": " this bottom up and this top down model in order in your encoder. And so now there are a bunch of" }, { "start": 1021.6400000000001, "end": 1027.32, "text": " questions with respect to the hierarchical VAE. The problem here is that you have not only one" }, { "start": 1027.32, "end": 1032.3600000000001, "text": " sampling procedure, but you have sampling procedure upon sampling procedure upon sampling" }, { "start": 1032.36, "end": 1038.1999999999998, "text": " procedure. And this can get pretty unstable, I guess pretty quickly. So the rest of the paper is" }, { "start": 1038.1999999999998, "end": 1045.7199999999998, "text": " going to be how to get this to work. So the main, I think one of the main parts they do in order to" }, { "start": 1045.7199999999998, "end": 1052.36, "text": " get this to work in order to get this to train our residual connections. So we know that residual" }, { "start": 1052.36, "end": 1061.32, "text": " connections are kind of a sort of a gradient flow highway in order in order to to train very deep" }, { "start": 1061.32, "end": 1068.28, "text": " networks. And we've already seen this with residual networks in CNNs, where you have an input," }, { "start": 1068.28, "end": 1073.8, "text": " and you have some computation in form of a neural network, or in this case, a sampling procedure" }, { "start": 1073.8, "end": 1079.96, "text": " through a distribution, and you have an output and the residual connection would allow you to skip" }, { "start": 1080.52, "end": 1088.2, "text": " part of that, as you can see, used here in both the encoders and the decoders. So in the encoders," }, { "start": 1088.2, "end": 1092.6000000000001, "text": " you have residual connections and also in the decoders right here, you can see you have residual" }, { "start": 1092.6000000000001, "end": 1099.48, "text": " connections. In fact, you always take that lower scale, and you don't transform it into an upper" }, { "start": 1099.48, "end": 1107.56, "text": " scale, you actually sample noise, and then you add the lower scale and the upper scale together." }, { "start": 1109.64, "end": 1116.8400000000001, "text": " So it's really an additive model in a hierarchical fashion, even okay, the the pluses might actually" }, { "start": 1116.84, "end": 1124.76, "text": " not be okay, the pluses can also be combination, I guess. I guess that that I might be wrong," }, { "start": 1124.76, "end": 1132.36, "text": " and they can actually be combinations. In any case, they use residual networks in in a in a lot of" }, { "start": 1132.36, "end": 1139.8, "text": " cases in their generative and in their generator and in their encoder. You can see right here," }, { "start": 1139.8, "end": 1145.9599999999998, "text": " there is a residual cell for the generative model and a residual cell for the encoder. Now," }, { "start": 1145.96, "end": 1151.88, "text": " the exact method of these residual cell, you can see that they use batch norm, then they use one" }, { "start": 1151.88, "end": 1159.88, "text": " by one convolutions in order to go to a higher to a higher channel number before they do the depth" }, { "start": 1159.88, "end": 1168.1200000000001, "text": " separated five by five convolutions. So five by five, because you need a larger receptive field," }, { "start": 1168.1200000000001, "end": 1173.48, "text": " they make that clear, they need a large receptive field. However, the large receptive field means" }, { "start": 1173.48, "end": 1180.6, "text": " many parameters means their model would be too big and too much memory. So they do the depth" }, { "start": 1180.6, "end": 1185.72, "text": " separated convolutions, which simply means that you don't mix the channels during the convolutions." }, { "start": 1185.72, "end": 1191.56, "text": " So you go up the channels, you do a depth separated convolution and go down the channels again." }, { "start": 1191.56, "end": 1197.48, "text": " All of these are kind of hacks to make it work, right? Then also they have batch norm and a swish" }, { "start": 1197.48, "end": 1204.44, "text": " non-linearity as you can see here. And then here as well in the encoder, they also say in the text," }, { "start": 1204.44, "end": 1209.8, "text": " like they stress the importance, we found that first the batch norm and then the convolution" }, { "start": 1209.8, "end": 1215, "text": " is better than the other way around and so on. So this there's a lot of engineering work that" }, { "start": 1215, "end": 1222.92, "text": " went into this right here. So you see there's batch norm. And also you have to kind of hack" }, { "start": 1222.92, "end": 1227.88, "text": " the batch norm, because in batch norm you have these training parameters and people have observed" }, { "start": 1227.88, "end": 1235.88, "text": " that in VAEs. If you during inference, during sampling, if you use the training way where you" }, { "start": 1235.88, "end": 1241.4, "text": " only regularize within the batch, it's better than if you use the running averages. So you kind of" }, { "start": 1241.4, "end": 1247, "text": " have to hack that. We modify the momentum parameter of batch norm such that running statistic can" }, { "start": 1247, "end": 1252.44, "text": " catch up faster with the batch statistics. There's a lot of engineering in here. Like there's a lot" }, { "start": 1252.44, "end": 1258.1200000000001, "text": " of things that you have to get right to get something like this to work apparently. And" }, { "start": 1259.56, "end": 1264.52, "text": " yeah, this the paper, the paper just goes on in this style. So you can see they use the swish" }, { "start": 1264.52, "end": 1270.92, "text": " activation. They use squeeze and excitation blocks, which are another form of residual" }, { "start": 1270.92, "end": 1277.88, "text": " blocks that were introduced quite a long time ago, but still being used as you can see. And" }, { "start": 1277.88, "end": 1284.44, "text": " yeah, so that's the architecture. So you can see they have residual cells there, residual cells" }, { "start": 1284.44, "end": 1291.5600000000002, "text": " here, reducing the memory requirements. They say they use two tricks. First of all, we they do" }, { "start": 1291.5600000000002, "end": 1296.92, "text": " mixed precision using a cool new Nvidia library. Given that they're from Nvidia, they get to try" }, { "start": 1296.92, "end": 1304.2, "text": " these things out first. And second of all, they also to reduce the memory, we fuse batch norm and" }, { "start": 1304.2, "end": 1309.72, "text": " swish and we store only one feature map for the backward pass instead of two. And they have to" }, { "start": 1309.72, "end": 1315.4, "text": " then recompute this trick is known as gradient checkpointing and cries, recomputing batch norm" }, { "start": 1315.4, "end": 1322.28, "text": " in the backward pass. I believe like future deep learning frameworks should just take care of that" }, { "start": 1322.28, "end": 1330.8400000000001, "text": " for you, instead of you having to do this kind of stuff. Honestly, so they also need to, they hear" }, { "start": 1330.84, "end": 1340.36, "text": " they say taming the unbounded KL term. So the KL term is what makes the distribution that the encoder" }, { "start": 1340.36, "end": 1346.36, "text": " outputs close to that distribution that you want like that normal distribution. So this is the" }, { "start": 1346.36, "end": 1352.6, "text": " regularization term, you can see here, it's a KL divergence between q, which is what your encoder" }, { "start": 1352.6, "end": 1360.28, "text": " outputs, you can see that's the, the latent code for the image x, between the two, the two, the" }, { "start": 1360.28, "end": 1368.76, "text": " two, the two, the two. And between that and between your prior which you say it should be, it should" }, { "start": 1368.76, "end": 1375.72, "text": " be a like a normal distribution. In this case, it should be a hierarchical normal distribution. And" }, { "start": 1377.6399999999999, "end": 1384.52, "text": " they have a special characterization here where they say, because it's hierarchical, right. So" }, { "start": 1384.52, "end": 1389.48, "text": " So I'm going to have a hierarchy of normal distributions. This is my top" }, { "start": 1389.48, "end": 1395.04, "text": " hierarchy and then I'm going to sample one sample right here. And then in" }, { "start": 1395.04, "end": 1400.52, "text": " the next layer I'm going to have a normal distribution around that sample" }, { "start": 1400.52, "end": 1406.72, "text": " right here and I'm going to sample from that and so on. So my hierarchical" }, { "start": 1406.72, "end": 1411.04, "text": " normal distribution is going to be always where the next distribution in" }, { "start": 1411.04, "end": 1416.44, "text": " the next layer is dependent on the distribution in the hierarchy." }, { "start": 1416.44, "end": 1424.3999999999999, "text": " And they have a special parameterization where in order for the encoder to produce" }, { "start": 1424.3999999999999, "end": 1429.84, "text": " that, so the encoder has to produce a z of the first layer and then a z of the" }, { "start": 1429.84, "end": 1434.8799999999999, "text": " second layer and so on, in order for the encoder to reproduce that and to be close" }, { "start": 1434.8799999999999, "end": 1440.58, "text": " it must match this distribution and it must match this distribution. So if it" }, { "start": 1440.58, "end": 1444.78, "text": " doesn't match this distribution correctly it will kind of sample" }, { "start": 1444.78, "end": 1450.1999999999998, "text": " somewhere else a bit. And then that distribution, that base, will already be" }, { "start": 1450.1999999999998, "end": 1454.8799999999999, "text": " shifted right here. So it thinks that the distribution to match is now this" }, { "start": 1454.8799999999999, "end": 1460, "text": " normal distribution. So you can see that the base is already shifted and that's" }, { "start": 1460, "end": 1467.48, "text": " why their encoder only outputs the delta to the, as you can see here, it" }, { "start": 1467.48, "end": 1476.24, "text": " only outputs the delta to the prior. We define here, we define the Q of the z in" }, { "start": 1476.24, "end": 1482.72, "text": " a given layer as the normal distribution of the mu i, with mu i, that's your" }, { "start": 1482.72, "end": 1488.76, "text": " prior, see that's your prior of that layer, plus a delta mu. And also the" }, { "start": 1488.76, "end": 1496.52, "text": " sigma is the sigma from the prior times a delta sigma that you output. So you're" }, { "start": 1496.52, "end": 1501.48, "text": " kind of saying you're not supposed to output the actual distribution, you're" }, { "start": 1501.48, "end": 1506.6399999999999, "text": " supposed to output the difference of distribution to the prior. Now in layer" }, { "start": 1506.6399999999999, "end": 1511.96, "text": " 0 that's the same thing, right, because the prior is going to be zero mean and" }, { "start": 1511.96, "end": 1519.6, "text": " unit variance. So that's this here, this here will be zero and this here will be" }, { "start": 1519.6, "end": 1525.44, "text": " one. But in all the upper layers this is going to make it easier. So that's one" }, { "start": 1525.44, "end": 1531.16, "text": " trick you have to make this repeated sampling not hurt you as much. The other" }, { "start": 1531.16, "end": 1537.04, "text": " trick they employ here is special regular, sorry, spectral regularization," }, { "start": 1537.04, "end": 1542.4, "text": " which is a regularization where you regularize the top singular value per" }, { "start": 1542.4, "end": 1547.3600000000001, "text": " layer. You can use that, you can compute that with a power iteration, people have" }, { "start": 1547.3600000000001, "end": 1553.0800000000002, "text": " been done doing this before, and also you can build in some normalizing flows." }, { "start": 1553.08, "end": 1560.1999999999998, "text": " So here if we sample the different layers, what we're" }, { "start": 1560.1999999999998, "end": 1564.08, "text": " going to do is we're going to sample all of these things at once, right, they're" }, { "start": 1564.08, "end": 1569.46, "text": " dependent on the upper layer in the hierarchy, but we'll sample them all at" }, { "start": 1569.46, "end": 1575.56, "text": " once. And that means they are not sort of connected to each other. Now if we" }, { "start": 1575.56, "end": 1580.1999999999998, "text": " introduce a flow we'll basically make them all connected to each other and" }, { "start": 1580.2, "end": 1586.04, "text": " build like a singular distribution of them. But I don't want to go too" }, { "start": 1586.04, "end": 1590.24, "text": " much into this because it doesn't gain that much, they say you can just build" }, { "start": 1590.24, "end": 1596.48, "text": " that in if you want. Okay so these are all the things that at least they list" }, { "start": 1596.48, "end": 1603.16, "text": " in the method section. Now there are like a lot more that they have" }, { "start": 1603.16, "end": 1610.0800000000002, "text": " to do, but ultimately as you can see right here on these on four of these" }, { "start": 1610.08, "end": 1614.52, "text": " five datasets they achieve state-of-the-art. In fact okay on this" }, { "start": 1614.52, "end": 1620, "text": " dataset no one else has tried, but at least on the other datasets they are" }, { "start": 1620, "end": 1628.24, "text": " very very competitive as you can see right here. And they compare this to, first" }, { "start": 1628.24, "end": 1635.96, "text": " of all, to other models and even other models with and without auto" }, { "start": 1635.96, "end": 1641.96, "text": " regressive flows. And they come pretty close to these auto regressive models. So" }, { "start": 1641.96, "end": 1647.2, "text": " an auto regressive model would be one that generates like one pixel at a time" }, { "start": 1647.2, "end": 1651.92, "text": " conditioned on the other pixels. This model doesn't do that, this model" }, { "start": 1651.92, "end": 1658.24, "text": " generates all pixels at once, so it's not auto regressive. But as you can see it" }, { "start": 1658.24, "end": 1667.8, "text": " beats all the other non or auto regressive models and it gets" }, { "start": 1667.8, "end": 1673.8, "text": " pretty close to the best auto regressive models which are down here. They are" }, { "start": 1673.8, "end": 1681.84, "text": " still better, but the gap is kind of shrinking is what they say. Cool so" }, { "start": 1681.84, "end": 1686.92, "text": " that's the main result. Then they have ablations where they basically, as I said," }, { "start": 1686.92, "end": 1691.8400000000001, "text": " all of these things kind of contribute a little bit, a little bit, a little bit, a" }, { "start": 1691.8400000000001, "end": 1696.4, "text": " little bit to building this bigger and bigger and deeper variational auto" }, { "start": 1696.4, "end": 1702.24, "text": " encoder. So it's hard to say what exactly makes this work because all of it makes" }, { "start": 1702.24, "end": 1708.8400000000001, "text": " it work. And I guess they just kept going until they beat state-of-the-art or until" }, { "start": 1708.8400000000001, "end": 1713.4, "text": " you know they ran out of tricks. Again these are the samples that we looked at" }, { "start": 1713.4, "end": 1718.44, "text": " and I do want to spend some time in the appendix right here because I think it's" }, { "start": 1718.44, "end": 1725.88, "text": " pretty interesting what they do. So first of all they show that their" }, { "start": 1725.88, "end": 1731.0800000000002, "text": " model doesn't remember the training samples. As you can see right here these" }, { "start": 1731.0800000000002, "end": 1735.92, "text": " are always the nearest neighbor from the training sample so the model is fairly" }, { "start": 1735.92, "end": 1745.44, "text": " you know fairly far away from the training samples. But yeah I mean okay" }, { "start": 1745.44, "end": 1752.6000000000001, "text": " maybe it's just me but the left they just look like more kind of more ideal" }, { "start": 1752.6000000000001, "end": 1763.96, "text": " idealized humans like very smooth humans like designer babies. Here they show that" }, { "start": 1763.96, "end": 1771.28, "text": " if you use batch norm as you would use it I think regularly where you keep these" }, { "start": 1771.28, "end": 1777.1200000000001, "text": " running stats or you do the batch norm from training then you get into" }, { "start": 1777.1200000000001, "end": 1782, "text": " this kind of degenerate case if you sample at lower temperatures. So the" }, { "start": 1782, "end": 1785.4, "text": " temperature that you sample from describes the width of the Gaussian" }, { "start": 1785.4, "end": 1790.56, "text": " that you ultimately want to sample from. And if you do they have this method to" }, { "start": 1790.56, "end": 1796.1599999999999, "text": " readjust the batch norm statistics which I don't want to go into here but you can" }, { "start": 1796.1599999999999, "end": 1801.12, "text": " you can read it up to basically fix that problem. It is a problem that" }, { "start": 1801.12, "end": 1807.32, "text": " apparently other people have observed as well and their method apparently is you" }, { "start": 1807.32, "end": 1816.32, "text": " know is a is one that manages to do that. Okay lastly there are some more samples" }, { "start": 1816.32, "end": 1823.8, "text": " right here. And yeah this right here this is honestly this is one of the I think" }, { "start": 1823.8, "end": 1828.6799999999998, "text": " one of the most interesting things where they go and since they have this" }, { "start": 1828.6799999999998, "end": 1835.24, "text": " hierarchical model right so here is like z1 it gives right and so that give gets" }, { "start": 1835.24, "end": 1839.36, "text": " you like an image and then there's z2 and that gets you an image and then" }, { "start": 1839.36, "end": 1844.08, "text": " there's z3 and so on and you continuously upscale and hierarchically" }, { "start": 1844.08, "end": 1851.4399999999998, "text": " add the features. Here they say what if what happens if we if we sample z1 once" }, { "start": 1851.4399999999998, "end": 1857.12, "text": " and then we fix it and then we only sample the other ones conditioned on z1" }, { "start": 1857.12, "end": 1863.28, "text": " and here see where you see top scale fixed and you can see there is" }, { "start": 1863.28, "end": 1869.9199999999998, "text": " considerable variation in the image but there is there is not really a large" }, { "start": 1869.92, "end": 1877.04, "text": " scale variation. Okay so the general face keeps constant but there are details" }, { "start": 1877.04, "end": 1882.04, "text": " changing as you can see so here the hair is kind of going over the image the" }, { "start": 1882.04, "end": 1888.52, "text": " color is changing here there are a lot of changes the mouth looks slightly" }, { "start": 1888.52, "end": 1894.52, "text": " different as far as I can see but I might be hallucinating here and then if" }, { "start": 1894.52, "end": 1900.12, "text": " you fix continuously the top two scales or the top three scales right here top" }, { "start": 1900.12, "end": 1905.24, "text": " four scales you can see that there are more and more just little details that" }, { "start": 1905.24, "end": 1914.08, "text": " change more and more so yeah so this is we they are operating at five scales" }, { "start": 1914.08, "end": 1920.48, "text": " starting from 8 by 8 up to 128 to 128 in each row we fix the samples at a number" }, { "start": 1920.48, "end": 1925.3600000000001, "text": " of top scales and we sample from the rest of the hierarchy as we can see the" }, { "start": 1925.3600000000001, "end": 1930.16, "text": " long-range global structure is mostly recorded at the top of the hierarchy in" }, { "start": 1930.16, "end": 1936.16, "text": " the 8 by 8 dimensional groups the second scale does apply at some global motive" }, { "start": 1936.16, "end": 1939.96, "text": " does apply some global modifications such as changing eyes hair color skin" }, { "start": 1939.96, "end": 1944.2, "text": " tone the shape of the face the bottom groups capture mostly low-level" }, { "start": 1944.2, "end": 1948.96, "text": " variations however the lowest scale can still still make some subtle long-range" }, { "start": 1948.96, "end": 1953.52, "text": " modifications for example the hair color is slightly modified when we are only" }, { "start": 1953.52, "end": 1957.96, "text": " sampling from the lowest scale in the last row this is potentially enabled" }, { "start": 1957.96, "end": 1962.96, "text": " because of the larger receptive field in our depth wise separate separable" }, { "start": 1962.96, "end": 1975, "text": " residual cell yeah I don't the hair color changes okay slightly maybe I don't" }, { "start": 1975, "end": 1984.28, "text": " know my my eyes are too many faces okay but you know what's certainly the case" }, { "start": 1984.28, "end": 1990.36, "text": " is that their models exhibit much better kind of global unity compared to these" }, { "start": 1990.36, "end": 1994.72, "text": " other samples where you can pretty clearly see like the different sides of" }, { "start": 1994.72, "end": 1999.56, "text": " the faces have little to do with each other and so on and this is the benefit" }, { "start": 1999.56, "end": 2002.64, "text": " that you get from doing this hierarchically so you have part of your" }, { "start": 2002.64, "end": 2007.92, "text": " model that's responsible for kind of the global shape of the image and then that" }, { "start": 2007.92, "end": 2012.48, "text": " keeps it consistent and then you have other parts that are responsible for the" }, { "start": 2012.48, "end": 2021.2, "text": " details okay so I hope this was something to you know that interested you I" }, { "start": 2021.2, "end": 2026.4, "text": " myself it's as I said it's it's an engineering paper so there is lots of" }, { "start": 2026.4, "end": 2030.64, "text": " things described there is not like one jumping idea I guess residual" }, { "start": 2030.64, "end": 2034.66, "text": " connections are pretty important and these depth wise convolutions save" }, { "start": 2034.66, "end": 2040.2800000000002, "text": " memory and but also all of the all of the other things that you have to do to" }, { "start": 2040.2800000000002, "end": 2047.1000000000001, "text": " build something like this are pretty pretty interesting yeah I I hope you" }, { "start": 2047.1, "end": 2062.6, "text": " gained something from it and I'll see you next time" } ]
Jqvb7jp4Nm8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Addendum for Supermasks in Superposition: A Closer Look (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "supsup", "supermasks", "lottery ticket", "lottery ticket hypothesis", "gradient", "entropy", "surplus", "superfluous neurons", "lifelong learning", "multitask learning", "catastrophic forgetting", "continuous learning", "binary mask", "random network", "optimization", "hopfield network", "gradient descent", "superposition" ]
I take a closer look at "Supermasks in Superposition" after I've already done a video on it. Specifically, I look at: 1. The intuition and theoretical justification behind the G objective, 2. Whether Supermasks and Superposition can be viewed as two distinct ideas and 3. The Paper's Broader Impact Statement. OUTLINE: 0:00 - Intro & Overview 2:00 - SupSup Recap 4:00 - In-Depth Analysis of the G Objective 20:30 - Superposition without Supermasks 25:40 - Broader Impact Statement 36:40 - Conclusion 37:20 - Live Coding Part 1 on SupSup: https://youtu.be/3jT1qJ8ETzk My Code: https://colab.research.google.com/drive/1bEcppdN6qZRpEFplIiv41ZI3vDwDjcvC?usp=sharing Paper: https://arxiv.org/abs/2006.14769 Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hi there! Today we'll look at super masks in superposition again. So this is part two of this paper by Mitchell Wurtzman and Vivek Ramanujan 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 their modified G objective does. 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 superposition and I think my opinion is sort of that these are two separate things and they really have nothing to do with each other and I think that didn't really come through last video. And the third one being the broader impact statement of this paper which I you know I usually kind of gloss over it and go like haha but I hear there is an important point to it so yeah we'll get to that. Alright so again not a new paper today I realized this but I think it's worth kind of diving deeper into this paper which is a very cool paper you know so don't don't get me wrong right here and I feel mostly I haven't done a good part at explaining it. Like literally lying awake. Okay so let's go to the first point. We had this so if you hadn't seen the first video super masks and superposition basically says that we want to do lifelong learning and we want to do lifelong learning by lifelong learning is the task where you have a bunch of tasks in sequence and you learn them in sequence so one after the other and basically the goal is to not forget tasks once 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 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 tasks you can do this superposition trick where you apply all the masks in a superposition and then you look at sort of the gradient of an entropy function in order to decide which task reduces the entropy the most so which task is the most certain about a particular data point and that you you kind of infer that that's the task you're gonna go with so instead of the entropy which is you know well reasoned they had this other objective they call a G and G basically looks at the it's really strange it looks at the superfluous neurons so they also add these 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 okay so again that's that's pretty cool so they start off by saying you have your neural network is basically W and the the sorry the it's it's this Phi right here and the W are the last layers weights which compute your log it's so Y is going not to be your class but Y 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 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 with they initialize the weights right here actually they initialize the they have no bias term and they 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 it makes the analysis also a bit easier I guess it just works more well if you have these masks in superposition of course you want to add all of these masks with their respective alpha weighting factor then multiply by the weights and that gives you your log it's so note that this this doesn't necessarily 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 all right now the the important part here is what happens if we look at the derivative of G with respect to one of the alphas and take the maximum negative derivative of that G which is that mysterious function that only looks at the at the at the superfluous neurons so what they want they kind of construct this G by principle what they say is we want a function G that mimics the supervised loss right we want a function G that is kind of equal like the supervised loss if we had the task ID right and that's that's pretty cool because you know the the supervised loss you sort of need all the information you need the label you need you need all the all 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 simply set it to zero and in the actual code which you can achieve like this where M indicates the superfluous neurons so this is just 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 much say look the label is certainly going to be one of not the superfluous neurons because the superfluous neurons are superfluous they are never the correct neuron so this is always going to be you know not the not the neurons we look at so the gradient certainly this is always going to be zero because we never we wherever the gradient is flowing that's not where the where this is one so the gradient of any superfluous neuron is just this thing right here and that's exactly why they build the function G so the function G has this exact gradient the function G if you derive it has that same gradient as the supervised loss for the superfluous neurons okay so it's sort of magic but it's not you know it's not magic so they need two more assumptions here to have to get the following properties so the for the first property now because now we want to have G be identifying the correct task so we've already constructed G now we want to show that if we really do this the gradient with respect to the alphas then if we do it for a wrong task for the tasks that it's not the task of that particular data point that goes into computing G then we'll get a value that's probably lower than zero however if we plug in if we derive but with respect to the alpha of the correct task then we get a gradient a negative gradient that's higher than zero okay so we're now going to prove that this with high probability really allows us to distinguish the correct task from the wrong task and we need two assumptions right here the 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 are independent random variables okay so it sort of means that the the tasks themselves are kind of independent but it's not it's it's not the same requirement but you can think of in in the case of permuted M nest 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 masks are independent variable if if the data is from tax J then the features and the mask from task I are independent variable sorry the second assumption you need is that we assume that a negative weight and a positive weight are equally likely to be masked out okay so this again you can think of with some regularity this is certainly going to be to be given in a randomly initialized neural network note that when the features are 0 which will be the case for 0 mean random features yeah so um 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 0 it doesn't need to be the case but you can you can construct it such that it is so if you have the two things right if you have those two things then you can prove the following if the data X comes from task J then when you derive by an alpha that's not of task J you get a number that's smaller than zero in expectation and here the crucial part is you reframe this gradient you reframe reframe reframe and what you'll see is that this here comes out so this is a sum and each element of the sum is going to be greater or equal to zero which means that this thing is greater or equal to zero which means the negative thing is smaller than zero in lemma H1 now we're going to look at lemma H1 to get an intuition of what's going on right here so lemma H1 says if J is the true task and I is not equal to J then this quantity here is greater than zero all right I restarted my tablet and we are back so what's kind of the the intuition behind why this quantity here would be greater or equal to zero and honestly in order to make it a bit easier I first want to look at whenever I equals J so whenever J is the true task and then I equals J then we can sort of think of the opposite like why why this should be smaller or equal to zero so consider this this is the run the feature of the network of you right and then the EUV connects that to the to the mask at point V and the mask at point at that point UV is either zero or one depending on the training so this this Xi right here that's going to be the from the initialization but the mask is going to be zero or one depending on whether that feature contributes sorry whether this entire thing here contributes positively to the task or not so the secret right here why we can make a claim that this is greater or lower than zero is going to be that the mask can only be zero or one it cannot be negative one right so if the mask is zero then obviously this thing is going to be zero however if the mask is one what does it mean if the mask is one that means that this this entire feature right here let's call it F is positively impacting is positively contributing to this particular neuron right here so if the mask is one this is this it means the addition of that feature more of that feature makes that 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 measure measures how high these superfluous log it's are then what why do we find a negative interaction there because if you look at the neural network and you forward pass and this particular feature is important and you look at the loss G and you backward pass through the log it's 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 deems the feature important in a positive sense we want that if the feature goes up G goes down and that is 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 and the mass can either be 0 or 1 right if it's 0 then this quantity is 0 however if it's 1 it's more likely that the that there the feature here because it's I is not the correct task which basically means that this feature it is for a different task it is good for a different task so the mask of that different task says it's good right here and we have no reason to believe that this would decrease the loss of the loss of this particular data point in this task so it's kind of the inverse reasoning if you look at the actual derivation here it's fairly long and it goes over the cases of the interactions between actually this initialization and the mask so the initialization can be positive or negative as you can see right here and I think I just think that the the intuition here is that the superfluous neurons react differently to a data point of the trained task because they have been kind of made to decrease for that task and for that particular mask as they do for when the data point doesn't match the mask when the data point doesn't match the mask there is no reason for the logits of the superfluous neurons to be low and if the data point task does match the mask there is ample reasons for those to be low I hope that sort of makes sense it is sort of it's a bit more of an intuition but if you really want to dig into it look at the derivation right here okay second point is the fact that the masks and the super positions don't really have to do anything with each other and that's you know I've said throughout the video like remember these tasks are super easy yada yada yada so let me make it clear in this in this diagram right here the super masks these are simply a way to train a neural network in a crude way right I don't think there is you know this distinction between mask and network I don't really like that much because ultimately what you're doing is simply you're training a neural network in a kind of weird way okay the fact that you always use the same underlying you know great neural network doesn't really matter right here it's still what you do in this super mask training is you provide a severely over parameterized network and then the mask simply gets to choose which weights to mix rather than you get to adjust the weights if you adjust the weights you usually get more accurate than with the mask but it's sort of like a quantized neural network that you train right here so that's the super mask thing again I don't think it's important that the underlying network is always the same the only advantage you have is it saves space because these masks are very small the super masks on the other hand this idea that you overlay all of the masks together and then you look at where this at the gradient of the entropy and you look at which of the of the mixing factors the gradient poles the most that's a different idea and the question here is wouldn't that isn't that independent does really depend on the masks or doesn't it and the you know the hypothesis would be that if I simply train you know three different neural networks for three different tasks could I not do the same superposition trick like could I not just add all of them with a respective alpha look at the entropy calculate the gradient with respect to each of the alphas of the entropy and then decide which task it is you know don't need masks simply mix neural networks in superposition so I did it and I actually tried their code is available so big props for their code being available I tried their code it's actually very few changes and I'm going to append my live coding of this at the end of this video so if you want to if you are interested in watching that you can do so but you know the outcome is if I train neural networks and I have I've you know done super quick and initialize them wrongly probably and all but if I train these neural net if I train the masks you get to like 92 percent 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 eminent amnest is I'm going to also hypothesize that if the task gets harder and harder and I don't mean 10 class image net I mean a thousand 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 parameter eyes really heavily and they will still work okay but in any case I trade the train these neural networks and they reached higher accuracy and then I did the exact same thing I laid them in superposition to determine what task it is and I could achieve the exact same result so here in their example they have a hundred percent task classification accuracy and I reached the exact same thing code worked I'm not going to try to scale this up to 250 or 2500 in tasks but I'm going to assume that with you know tuning and stuff that it's going to work about equally well you could make an argument that the masks being sparser they might be differentiated from each other more accurately but I'm not sure maybe but it's it's not a cool it's not a qualitative difference right so these two things are really two separate ideas that find their way together in this paper but ultimately have not much to do with each other okay at least that's from what I can tell I might I might be wrong here and I might be wrong with respect to their G objective and whatnot and you know but I think that that these are two cool ideas but they can be applied independently so the last thing I want to look at is their broader impact statement right here now there is a reason so usually I kind of track these broader impact statement because I think this this is this here is sort of fundamental research right this is fundamental machine learning research we do architecture the multitask learning task isn't really important as long as we have kind of the same tasks right here uncorrelated 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 um and 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 model 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 gonna 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 neural networks is generally more confident and you're going to misclassify a lot of the tasks so so here what does this have to do with the broader impact statement if you look at the broader impact statement what they say right here so they say a goal of continue learning self-manage tasks with a single model however it is not exactly clear what qualifies as a single model therefore a concrete objective has become to learn many tasks as efficiently as possible we believe that subs up is a useful step in this direction however there are consequences to more efficient models both positive and negative so this is sort of what the community does so there are three things that I've seen so far in broader impact statement first you some people say this is not applicable to us which I agree for most fundamental research broader it 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 you just change a 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 and so what you do is you just go one level up you go up the levels it's always like optimization can be used for good and for bad I mean that's still kind of a bit vague and then you go up further well optimization can do more machine learning and machine learning can be used to do good and bad for example face recognition and things like this so you just go up the levels and that's what they essentially do here and that's what you know most people have defaulted to it's like okay so you know our model here is you know we it basically one can train more efficient models and then they simply highlight what more efficient models can do efficient models require less compute if there's a model by we run 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 because I'm really regarding what the broader impact statement should be this is not my opinion I'm I'm trying to reflect everything I've read of guidance about what the broader impact statement should be by the way there is also method method three which is to simply tell me more about your paper in the broader impact statement which I guess is the smart method because the broader impact statement can be before 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 these it's already the default people simply go level up level up level up until we can you know say something generic and we will also highlight and discuss the negative consequences of models which can efficiently learn many tasks and efficient models in general when models are more efficient they're also more available and less subject to regularization as a study 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 is like well technology this is basically a statement about technology and so why why do I have a particular not issue but why do I pick this broader impact statement they even Rick this here this is this gender shades paper right where people went and they looked at these commercial API's for face recognition I I think that's the paper yeah gender shades so if you have a face recognizer they realized they divided people up by I think gender and race so you know like they built four groups or I haven't I haven't I've just looked at the paper but in my understanding that they divided people up into groups which I find arbitrary to have the these two axes race and gender but okay you can do that and they discovered that these commercial API's have different accuracy for the different groups right and that basically our point is that you know these commercial API's if they're offered for all humans they should work equally well for all humans now now you may be see what it has to do with this paper well this paper is in the business of doing multitask learning so it is very viable to actually frame the the task for example like this is an example if you frame the task of multitask learning like face recognition on different groups of people as a multitask learning problem you have you know group group one right here group two group three and then if at inference time so you can build you know good models for each of the group at inference time you're given an image and you're trying to a fur 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 in specifically if if for one group let's say for group three the the task is way harder because you have less data I guess the one of the main problems there is that the data sets are not equally balanced if you have less data for that then the task becomes de facto harder and the model is less sure about the task which means that it's a double whammy so not only is the model itself less accurate but these the input data point if the person is actually of group three is less likely to be classified correctly into the correct model at to begin with so you know for all the for all I I've had my my share of of comments on the video I made and I still maintain that societal bias can comes about by data set but for all the people saying there are models that exaggerate existing biases in models this would be like if there is any ever any applicability of these broader impact statement guidelines this would be the paper right it's this right here is an actual system that if I have different classifiers and I combine them with this method it will double punish the classifier that is less sure that is less accurate because that is also going to be the one with the higher entropy therefore not as much selected if I give a data point of that particular task and so this is like a I'm not criticizing the method here like by all means like this is a cool method where you can recognize that this happens and try to calibrate accordingly but if there was ever any straight ball for a broader impact statement I would you know this is it and this I'm not I'm not 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 the people aren't even thinking and so this right this is one of the reasons why I simply find these broader impact statements to be not that like not a good idea because there is a default answer and people are just putting it here even in like when there is an actual obvious immensely obvious thing that they even they even cited like the basis for that so you know that's sort of my take on this I again I enjoyed this paper the code is is available everything is good about this this paper I'm not even the fact that these are you know I think these are kind of two separate ideas they're combined cool they're 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 our goal here is going to be to change this code to not use masks as mixtures but actually use neural networks with real weights as as mixtures and in superposition with each other okay so what we're going to do is we're going to train the different neural networks and then use this kind of superposition trick to figure out which task a data point came from so let's have a look at the code right here and there's a bunch of helper code and if we go down through everything you'll see that this is the MNIST permuted data set so each each task is basically a random permutation of MNIST and if you execute I believe this here and then you train the model and right now it's for five tasks but I guess that's going to be enough for now yeah so if we get some good signal here I guess it's a matter of of doing kind of engineering and plumbing and tuning if until you get it up to whatever 200 or 2000 tasks though I might be wrong there so this is training and I 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 this is multi task fully connected which has these different layers right here and it's built by these multi task mask linear models now the multi task mask linear models are defined right here so it's basically a linear model as you can see it's derived from a linear from a linear module and it has a parameter called num tasks and then it has a parameter scores which I guess is are these these masks right here and the scores I'm going to guess are always going to be multiplied by the weights here in the forward so you can see they're in forward you get the weights from the alphas yeah yeah this is the superimposed alright so if we know the task ID down here we get this subnet and we are going to multiply it with the weights if we don't know the task ID we want to get these alphas so the alphas are going to be one over the number of tasks at the beginning we're then going to multiply each of the alphas with the weights and with that we're going to get this subnet mask right here so we need to know what this self dot stacked is so this self dot stacked is getting right here in this cache mask or simply stacking this this get subnet for all of the things so our plan is going to be that this subnet right here is going to be the actual weights of the neural network okay and not just the not just the mask and then we don't need to actually multiply it with the weight we can just just forget about the weight honestly and just train the subnet so for the subnet as you can see here you have this get subnet thing and that's an autograd function which basically means in the forward pass you want to discretize it and in the backward pass this is a straight through estimator so our first task is going and this here should be done now my laptop has stopped breathing so we've trained five tasks and now we can run inference on that so this is when the task is given real quick you can see task one 92 percent 92 percent 92 percent 92 percent so we have a an overall performance of 92.44 percent then when the task is not given we have two things to evaluate whether or not basically how good we are overall and whether or not we get the tasks correct of course the tasks are at this pre requirement so we have a hundred percent task inference accuracy okay so we don't we don't okay we can we could evaluate this here but you can already see the output from last time there is 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 and to end up being our actual weights we want we don't do that we simply return the scores now this is a 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 our other initialize function so in it dot what do we have here do we have what's usual I don't even know normal Savi that that sounds about right that sounds about right all right all right so scores and yeah let's try this this could this could I break everything right if you initialize wrongly you get like dumb results so okay signed constant yada yada yada where is that used huh okay that's also initializing something so we calculate the gain and then okay this doesn't seem good we'll just keep it hey why not why not why not just keep it at that all right so cool oh yeah this is for the weight anyway we won't use the weight at all of this layer we'll just use our own weights so here we have these stacked okay we get the scores that's all good like I'm pretty happy with that I'm pretty happy with this mask in it that we make our parameters so these are going to be our different neural networks that we train this all looks good the alphas look good now the only thing we 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 hmm yeah yeah let's just try it like we're gonna get a mistake somewhere like 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 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 masked things are just kind of crude quantized ways are of training neural networks and if if my hypothesis is correct this here is going to turn out probably even better than this masked thing okay so last task training right here I'm starting to breathe good laptop fast laptop very nice come on come on come on and we're done so again we have an average top one performance of 92 point is this even did I even oh no I ran this right here okay like that's the exact same number it was last time so we need to run inference again and if we're given the task ID then we are at 93.9% so we increase slightly which might just be due to the fact that we initialize terribly terribly okay so what does it say about our task inference accuracy maybe there's some mask here set model task the alphas are to one nope no we're good we're good task inference accuracy 100% and I'm going to guess well with the task inference accuracy being 100% I'm going to guess this here will give us the exact same number I like the 93 point some percent so yeah 93.9% so I'm you know I'm going to say right here that the on the super masks and the superposition really are two separate ideas right you it's it's because the paper is like it sounds cool and all with the supermask and superposition but this inference using the superposition and then the entropy to decide is really one idea and training different super math the the advantage in using supermask is of course that the model is way smaller so you can remember it much more easily but also you know that it's really different if there's there's nothing to do with the superposition yeah all right so I'm going I'm going to guess this also works for you know 200 tasks and whatnot the higher order of tasks so I think that's it and we're done here yeah
[ { "start": 0, "end": 5.46, "text": " Hi there! Today we'll look at super masks in superposition again. So this is part" }, { "start": 5.46, "end": 10.14, "text": " two of this paper by Mitchell Wurtzman and Vivek Ramanujan and here's the" }, { "start": 10.14, "end": 16.54, "text": " reason why there's a part two. So after yesterday's video on this paper I" }, { "start": 16.54, "end": 21.98, "text": " couldn't sleep because I really felt that I had left out some important" }, { "start": 21.98, "end": 26.26, "text": " aspects that I wanted to touch on during the video. Now sometimes during videos I" }, { "start": 26.26, "end": 30.92, "text": " look at the clock and I realize like oh crap the video is already like an hour" }, { "start": 30.92, "end": 36.52, "text": " long and I know people are watching on 2x speed anyway but still it's like too" }, { "start": 36.52, "end": 40.760000000000005, "text": " long and I need to wrap it up really soon. And what I felt were pretty" }, { "start": 40.760000000000005, "end": 44.92, "text": " important messages about this paper got lost. So specifically I want to address" }, { "start": 44.92, "end": 50.760000000000005, "text": " three different things. First of all they have like a formal analysis, not a formal" }, { "start": 50.760000000000005, "end": 56.14, "text": " but a kind of more rigorous analysis of what their modified G objective does." }, { "start": 56.14, "end": 60.72, "text": " And I also want to give some intuition in that because I felt I really" }, { "start": 60.72, "end": 69.04, "text": " had done a good job at that. The second part is that the two different ideas" }, { "start": 69.04, "end": 76, "text": " right here being the super masks and the superposition and I think my opinion is" }, { "start": 76, "end": 80.52, "text": " sort of that these are two separate things and they really have nothing to" }, { "start": 80.52, "end": 84.64, "text": " do with each other and I think that didn't really come through last video." }, { "start": 84.64, "end": 89.72, "text": " And the third one being the broader impact statement of this paper which I" }, { "start": 89.72, "end": 96.04, "text": " you know I usually kind of gloss over it and go like haha but I hear there is an" }, { "start": 96.04, "end": 103.24000000000001, "text": " important point to it so yeah we'll get to that. Alright so again not a new paper" }, { "start": 103.24000000000001, "end": 107.32, "text": " today I realized this but I think it's worth kind of diving deeper into this" }, { "start": 107.32, "end": 113.48, "text": " paper which is a very cool paper you know so don't don't get me wrong right" }, { "start": 113.48, "end": 117.96000000000001, "text": " here and I feel mostly I haven't done a good part at explaining it." }, { "start": 117.96000000000001, "end": 126.48, "text": " Like literally lying awake. Okay so let's go to the first point. We had this so if" }, { "start": 126.48, "end": 130.68, "text": " you hadn't seen the first video super masks and superposition basically says" }, { "start": 130.68, "end": 135.64000000000001, "text": " that we want to do lifelong learning and we want to do lifelong learning by" }, { "start": 135.64000000000001, "end": 140.68, "text": " lifelong learning is the task where you have a bunch of tasks in sequence and" }, { "start": 140.68, "end": 145, "text": " you learn them in sequence so one after the other and basically the goal is to" }, { "start": 145, "end": 150.8, "text": " not forget tasks once you learn new tasks and this model does it by" }, { "start": 150.8, "end": 156.12, "text": " always building one of these super masks for each task that is applied to the" }, { "start": 156.12, "end": 162.64000000000001, "text": " same randomly initialized base neural network each time and you know by" }, { "start": 162.64000000000001, "end": 166.88, "text": " keeping the super mask around you won't forget the task and then at inference" }, { "start": 166.88, "end": 170.76, "text": " time if you're given the task and just retrieve the mask if you're not given" }, { "start": 170.76, "end": 175.44, "text": " the tasks you can do this superposition trick where you apply all the masks in a" }, { "start": 175.44, "end": 180.76, "text": " superposition and then you look at sort of the gradient of an entropy function" }, { "start": 180.76, "end": 185.84, "text": " in order to decide which task reduces the entropy the most so which task is" }, { "start": 185.84, "end": 192.2, "text": " the most certain about a particular data point and that you you kind of infer" }, { "start": 192.2, "end": 198.56, "text": " that that's the task you're gonna go with so instead of the entropy which is" }, { "start": 198.56, "end": 203.95999999999998, "text": " you know well reasoned they had this other objective they call a G and G" }, { "start": 203.95999999999998, "end": 210.72, "text": " basically looks at the it's really strange it looks at the superfluous" }, { "start": 210.72, "end": 214.48, "text": " neurons so they also add these superfluous neurons these S neurons" }, { "start": 214.48, "end": 223.44, "text": " right here and they they the G objective will only look at the S neurons in order" }, { "start": 223.44, "end": 228.07999999999998, "text": " to decide whether or not that's the correct task and it's basically just the" }, { "start": 228.07999999999998, "end": 232.83999999999997, "text": " log some X of the S neurons and we had some intuition about them being you know" }, { "start": 232.83999999999997, "end": 237.32, "text": " all small and so on them being like outlier detectors but there is an entire" }, { "start": 237.32, "end": 241.88, "text": " chapter in the appendix where the authors do a sort of more in-depth" }, { "start": 241.88, "end": 249.44, "text": " theoretical analysis of that which you know I it's not not necessary to do this" }, { "start": 249.44, "end": 255.92, "text": " for them so I really enjoy I enjoyed reading that and that gave me sort of" }, { "start": 255.92, "end": 263.8, "text": " the better intuition of what this G objective does so here they say the aim" }, { "start": 263.8, "end": 268.88, "text": " is not to formally prove properties of the algorithm rather we hope that a more" }, { "start": 268.88, "end": 275.56, "text": " mathematical language may prove useful in extending intuition okay so again" }, { "start": 275.56, "end": 279.4, "text": " that's that's pretty cool so they start off by saying you have your neural" }, { "start": 279.4, "end": 287.12, "text": " network is basically W and the the sorry the it's it's this Phi right here and" }, { "start": 287.12, "end": 293.6, "text": " the W are the last layers weights which compute your log it's so Y is going not" }, { "start": 293.6, "end": 297.6, "text": " to be your class but Y is going to be your log it's and P is going to be the" }, { "start": 297.6, "end": 303.84000000000003, "text": " probability vector over your class which if the you calculate this via a softmax" }, { "start": 303.84000000000003, "end": 311.88, "text": " is going to be the following expression right here if you have a mask right then" }, { "start": 311.88, "end": 318.24, "text": " at least in the last layer you can in you can infer it as this right here so" }, { "start": 318.24, "end": 324.16, "text": " you multiply the mask by the last these weights and then that gives you your" }, { "start": 324.16, "end": 331.04, "text": " log it's so they say here with they initialize the weights right here" }, { "start": 331.04, "end": 335.14000000000004, "text": " actually they initialize the they have no bias term and they initialize the" }, { "start": 335.14000000000004, "end": 340.32000000000005, "text": " weights by this constant so plus minus this constant it's not really necessary" }, { "start": 340.32000000000005, "end": 344.88, "text": " to do that but they do it right here it makes the analysis also a bit easier I" }, { "start": 344.88, "end": 349.84000000000003, "text": " guess it just works more well if you have these masks in superposition of" }, { "start": 349.84, "end": 354.2, "text": " course you want to add all of these masks with their respective alpha weighting" }, { "start": 354.2, "end": 363.76, "text": " factor then multiply by the weights and that gives you your log it's so note" }, { "start": 363.76, "end": 367.79999999999995, "text": " that this this doesn't necessarily only have to be the last layers weights" }, { "start": 367.79999999999995, "end": 373.67999999999995, "text": " right here you can view that as any sort of weights of the neural network if you" }, { "start": 373.67999999999995, "end": 378.76, "text": " formulate this Phi correctly so you don't think that they only apply the" }, { "start": 378.76, "end": 383.56, "text": " mask to the last layer they do apply the mask to the entire thing all right now" }, { "start": 383.56, "end": 390.15999999999997, "text": " the the important part here is what happens if we look at the derivative of" }, { "start": 390.15999999999997, "end": 396, "text": " G with respect to one of the alphas and take the maximum negative derivative of" }, { "start": 396, "end": 401.59999999999997, "text": " that G which is that mysterious function that only looks at the at the at the" }, { "start": 401.59999999999997, "end": 407.64, "text": " superfluous neurons so what they want they kind of construct this G by" }, { "start": 407.64, "end": 416.12, "text": " principle what they say is we want a function G that mimics the supervised" }, { "start": 416.12, "end": 422, "text": " loss right we want a function G that is kind of equal like the supervised loss" }, { "start": 422, "end": 429.15999999999997, "text": " if we had the task ID right and that's that's pretty cool because you know the" }, { "start": 429.15999999999997, "end": 435.4, "text": " the supervised loss you sort of need all the information you need the label you" }, { "start": 435.4, "end": 441.79999999999995, "text": " need you need all the all you need the task ID so the supervised loss is" }, { "start": 441.79999999999995, "end": 449.32, "text": " unavailable but we want a function G that in its gradient mimics the supervised" }, { "start": 449.32, "end": 455.56, "text": " loss so they go about constructing this right here they say lemma first lemma" }, { "start": 455.56, "end": 459.2, "text": " it's possible to construct a function G such that the gradient matches the" }, { "start": 459.2, "end": 463.47999999999996, "text": " gradient from the supervised loss for all s neurons so for all these" }, { "start": 463.48, "end": 469.20000000000005, "text": " superfluous neurons specifically we want that the gradient with respect to the" }, { "start": 469.20000000000005, "end": 473.12, "text": " log it's if the gradient to the log it's is equal that means the gradient to all" }, { "start": 473.12, "end": 477.42, "text": " the rest of the network is equal because the rest of the network goes through the" }, { "start": 477.42, "end": 481, "text": " log it's right the gradient through the log it's is equal to the gradient of the" }, { "start": 481, "end": 486.68, "text": " supervised loss to the log it's for all the superfluous neurons and zero" }, { "start": 486.68, "end": 492.44, "text": " otherwise so they say the zero otherwise is pretty easily done in math you know" }, { "start": 492.44, "end": 498.88, "text": " simply set it to zero and in the actual code which you can achieve like this" }, { "start": 498.88, "end": 504.8, "text": " where M indicates the superfluous neurons so this is just they said just" }, { "start": 504.8, "end": 510.28, "text": " multiplied here and the other ones are detached so there is no gradient" }, { "start": 510.28, "end": 516.04, "text": " flowing this is the property that we only look at the superfluous neurons and" }, { "start": 516.04, "end": 523.92, "text": " now we are going to show that the gradient is going to be equal so they" }, { "start": 523.92, "end": 530.76, "text": " say if you had the supervised loss which means if you had the label then this" }, { "start": 530.76, "end": 537.0799999999999, "text": " would be your cross entropy loss okay so you cross it divides into this part" }, { "start": 537.0799999999999, "end": 540.9599999999999, "text": " where you need the label and then this part here you don't need the label now" }, { "start": 540.96, "end": 548.2800000000001, "text": " you can pretty much say look the label is certainly going to be one of" }, { "start": 548.2800000000001, "end": 553.36, "text": " not the superfluous neurons because the superfluous neurons are superfluous they" }, { "start": 553.36, "end": 559.32, "text": " are never the correct neuron so this is always going to be you know not the not" }, { "start": 559.32, "end": 563.44, "text": " the neurons we look at so the gradient certainly this is always going to be" }, { "start": 563.44, "end": 570, "text": " zero because we never we wherever the gradient is flowing that's not where the" }, { "start": 570, "end": 579.92, "text": " where this is one so the gradient of any superfluous neuron is just this thing" }, { "start": 579.92, "end": 586.36, "text": " right here and that's exactly why they build the function G so the function G" }, { "start": 586.36, "end": 591.8, "text": " has this exact gradient the function G if you derive it has that same gradient" }, { "start": 591.8, "end": 600.3599999999999, "text": " as the supervised loss for the superfluous neurons okay so it's sort of" }, { "start": 600.3599999999999, "end": 606.24, "text": " magic but it's not you know it's not magic so they need two more assumptions" }, { "start": 606.24, "end": 611.24, "text": " here to have to get the following properties so the for the first" }, { "start": 611.24, "end": 619.56, "text": " property now because now we want to have G be identifying the correct task so" }, { "start": 619.56, "end": 624.04, "text": " we've already constructed G now we want to show that if we really do this the" }, { "start": 624.04, "end": 631.0799999999999, "text": " gradient with respect to the alphas then if we do it for a wrong task for the" }, { "start": 631.0799999999999, "end": 636.68, "text": " tasks that it's not the task of that particular data point that goes into" }, { "start": 636.68, "end": 642.5999999999999, "text": " computing G then we'll get a value that's probably lower than zero however" }, { "start": 642.5999999999999, "end": 648.8399999999999, "text": " if we plug in if we derive but with respect to the alpha of the correct task" }, { "start": 648.84, "end": 655.6800000000001, "text": " then we get a gradient a negative gradient that's higher than zero okay so" }, { "start": 655.6800000000001, "end": 660.12, "text": " we're now going to prove that this with high probability really allows us to" }, { "start": 660.12, "end": 666.8000000000001, "text": " distinguish the correct task from the wrong task and we need two assumptions" }, { "start": 666.8000000000001, "end": 670.88, "text": " right here the assumption one is we assume that the mask learn on task I" }, { "start": 670.88, "end": 677, "text": " will be independent from the data from task J if the task data is from task J" }, { "start": 677, "end": 683.88, "text": " then this are independent random variables okay so it sort of means that" }, { "start": 683.88, "end": 691.4, "text": " the the tasks themselves are kind of independent but it's not it's it's not" }, { "start": 691.4, "end": 696.02, "text": " the same requirement but you can think of in in the case of permuted M nest or" }, { "start": 696.02, "end": 703.2, "text": " so this is some it's given except if you consider this kind of frequency of" }, { "start": 703.2, "end": 708.24, "text": " brightness and so on but if you have independent task I think that this is" }, { "start": 708.24, "end": 714.6400000000001, "text": " given that means that the features right here and the masks are independent" }, { "start": 714.6400000000001, "end": 720.9200000000001, "text": " variable if if the data is from tax J then the features and the mask from task" }, { "start": 720.9200000000001, "end": 725.6400000000001, "text": " I are independent variable sorry the second assumption you need is that we" }, { "start": 725.6400000000001, "end": 729.44, "text": " assume that a negative weight and a positive weight are equally likely to be" }, { "start": 729.44, "end": 736.24, "text": " masked out okay so this again you can think of with some regularity this is" }, { "start": 736.24, "end": 743.08, "text": " certainly going to be to be given in a randomly initialized neural network note" }, { "start": 743.08, "end": 749.48, "text": " that when the features are 0 which will be the case for 0 mean random features" }, { "start": 749.48, "end": 755.32, "text": " yeah so um yeah before I said this was your neural network this is your random" }, { "start": 755.32, "end": 761.8000000000001, "text": " neural network right and then you mask that and so on if this is a randomly" }, { "start": 761.8000000000001, "end": 766.84, "text": " initialized neural network then you can make a case that the expected features" }, { "start": 766.84, "end": 775.12, "text": " of those will be 0 it doesn't need to be the case but you can you can construct" }, { "start": 775.12, "end": 779.48, "text": " it such that it is so if you have the two things right if you have those two" }, { "start": 779.48, "end": 786.8000000000001, "text": " things then you can prove the following if the data X comes from task J then" }, { "start": 786.8000000000001, "end": 792.32, "text": " when you derive by an alpha that's not of task J you get a number that's" }, { "start": 792.32, "end": 799.72, "text": " smaller than zero in expectation and here the crucial part is you reframe" }, { "start": 799.72, "end": 807.12, "text": " this gradient you reframe reframe reframe and what you'll see is that this" }, { "start": 807.12, "end": 815.6, "text": " here comes out so this is a sum and each element of the sum is going to be" }, { "start": 815.6, "end": 819.36, "text": " greater or equal to zero which means that this thing is greater or equal to" }, { "start": 819.36, "end": 824.72, "text": " zero which means the negative thing is smaller than zero in lemma H1 now we're" }, { "start": 824.72, "end": 829.76, "text": " going to look at lemma H1 to get an intuition of what's going on right here" }, { "start": 829.76, "end": 837.8, "text": " so lemma H1 says if J is the true task and I is not equal to J then this" }, { "start": 837.8, "end": 843.86, "text": " quantity here is greater than zero all right I restarted my tablet and we are" }, { "start": 843.86, "end": 851.08, "text": " back so what's kind of the the intuition behind why this quantity here would be" }, { "start": 851.08, "end": 857.3199999999999, "text": " greater or equal to zero and honestly in order to make it a bit easier I first" }, { "start": 857.32, "end": 865.08, "text": " want to look at whenever I equals J so whenever J is the true task and then I" }, { "start": 865.08, "end": 871.6, "text": " equals J then we can sort of think of the opposite like why why this should be" }, { "start": 871.6, "end": 878.6800000000001, "text": " smaller or equal to zero so consider this this is the run the feature of the" }, { "start": 878.68, "end": 887.7199999999999, "text": " network of you right and then the EUV connects that to the to the mask at point" }, { "start": 887.7199999999999, "end": 896.8, "text": " V and the mask at point at that point UV is either zero or one depending on the" }, { "start": 896.8, "end": 902.3599999999999, "text": " training so this this Xi right here that's going to be the from the" }, { "start": 902.3599999999999, "end": 907.76, "text": " initialization but the mask is going to be zero or one depending on whether that" }, { "start": 907.76, "end": 912.96, "text": " feature contributes sorry whether this entire thing here contributes" }, { "start": 912.96, "end": 919.08, "text": " positively to the task or not so the secret right here why we can make a" }, { "start": 919.08, "end": 924.76, "text": " claim that this is greater or lower than zero is going to be that the mask can" }, { "start": 924.76, "end": 932.76, "text": " only be zero or one it cannot be negative one right so if the mask is" }, { "start": 932.76, "end": 938.2, "text": " zero then obviously this thing is going to be zero however if the mask is one" }, { "start": 938.2, "end": 943.72, "text": " what does it mean if the mask is one that means that this this entire feature" }, { "start": 943.72, "end": 953.72, "text": " right here let's call it F is positively impacting is positively contributing to" }, { "start": 953.72, "end": 961.72, "text": " this particular neuron right here so if the mask is one this is this it means" }, { "start": 961.72, "end": 967.44, "text": " the addition of that feature more of that feature makes that log it go up okay" }, { "start": 967.44, "end": 977.2, "text": " so if the mask is one during training it means that the feature positively" }, { "start": 977.2, "end": 981.4, "text": " contributes to the task so if we look at the gradient with respect to this" }, { "start": 981.4, "end": 985.88, "text": " function with respect to the the log it and the function basically means it's" }, { "start": 985.88, "end": 995.4399999999999, "text": " just measure measures how high these superfluous log it's are then what why" }, { "start": 995.4399999999999, "end": 1001.12, "text": " do we find a negative interaction there because if you look at the neural" }, { "start": 1001.12, "end": 1007.64, "text": " network and you forward pass and this particular feature is important and you" }, { "start": 1007.64, "end": 1013.8, "text": " look at the loss G and you backward pass through the log it's if it is smaller" }, { "start": 1013.8, "end": 1020.12, "text": " than zero that means there there is a negative interaction right here so that" }, { "start": 1020.12, "end": 1028.3999999999999, "text": " basically means that if we make this feature higher then in this case we make" }, { "start": 1028.3999999999999, "end": 1036.96, "text": " this G function go lower okay and that is the case for the correct task because" }, { "start": 1036.96, "end": 1044.16, "text": " if this is the correct task and the mask is learned adequately that means it" }, { "start": 1044.16, "end": 1050.8400000000001, "text": " should assign a low weight to the superfluous neuron whenever the input" }, { "start": 1050.8400000000001, "end": 1057.68, "text": " features you know are of that task and so it makes sense that this here would" }, { "start": 1057.68, "end": 1063.72, "text": " be a negative number because what we want if the mask deems the feature" }, { "start": 1063.72, "end": 1068.92, "text": " important in a positive sense we want that if the feature goes up G goes down" }, { "start": 1068.92, "end": 1076.08, "text": " and that is exactly why we have the negative interaction right here right so" }, { "start": 1076.08, "end": 1081.48, "text": " the negative comes from this being negative I hope this sort of makes sense" }, { "start": 1081.48, "end": 1086.56, "text": " so if the mask is one the mask says basically if that feature goes up the" }, { "start": 1086.56, "end": 1091.84, "text": " loss goes down now G is a measure of the superfluous neurons the superfluous" }, { "start": 1091.84, "end": 1098.08, "text": " neurons should be small if the loss is small so if this is really from the task" }, { "start": 1098.08, "end": 1102.8799999999999, "text": " and this feature is really useful that means if we increase the feature the G" }, { "start": 1102.8799999999999, "end": 1107.9599999999998, "text": " function should go down and therefore this product here is going to be most" }, { "start": 1107.9599999999998, "end": 1116.56, "text": " likely negative okay and the contrary is you know analogous right here if this is" }, { "start": 1116.56, "end": 1123.44, "text": " not of this task and the mass can either be 0 or 1 right if it's 0 then this" }, { "start": 1123.44, "end": 1130.36, "text": " quantity is 0 however if it's 1 it's more likely that the that there the" }, { "start": 1130.36, "end": 1137.12, "text": " feature here because it's I is not the correct task which basically means that" }, { "start": 1137.12, "end": 1143.8799999999999, "text": " this feature it is for a different task it is good for a different task so the" }, { "start": 1143.88, "end": 1147.96, "text": " mask of that different task says it's good right here and we have no reason to" }, { "start": 1147.96, "end": 1152.7600000000002, "text": " believe that this would decrease the loss of the loss of this particular data" }, { "start": 1152.7600000000002, "end": 1160.16, "text": " point in this task so it's kind of the inverse reasoning if you look at the" }, { "start": 1160.16, "end": 1167.4, "text": " actual derivation here it's fairly long and it goes over the cases of the" }, { "start": 1167.4, "end": 1171.5600000000002, "text": " interactions between actually this initialization and the mask so the" }, { "start": 1171.56, "end": 1178.48, "text": " initialization can be positive or negative as you can see right here and I" }, { "start": 1178.48, "end": 1186.08, "text": " think I just think that the the intuition here is that the superfluous" }, { "start": 1186.08, "end": 1192.46, "text": " neurons react differently to a data point of the trained task because they" }, { "start": 1192.46, "end": 1199.96, "text": " have been kind of made to decrease for that task and for that particular mask" }, { "start": 1199.96, "end": 1204.72, "text": " as they do for when the data point doesn't match the mask when the data" }, { "start": 1204.72, "end": 1210.4, "text": " point doesn't match the mask there is no reason for the logits of the superfluous" }, { "start": 1210.4, "end": 1216.7, "text": " neurons to be low and if the data point task does match the mask there is ample" }, { "start": 1216.7, "end": 1222.8400000000001, "text": " reasons for those to be low I hope that sort of makes sense it is sort of it's a" }, { "start": 1222.8400000000001, "end": 1227.14, "text": " bit more of an intuition but if you really want to dig into it look at the" }, { "start": 1227.14, "end": 1234.72, "text": " derivation right here okay second point is the fact that the masks and the super" }, { "start": 1234.72, "end": 1238.88, "text": " positions don't really have to do anything with each other and that's you" }, { "start": 1238.88, "end": 1242.8400000000001, "text": " know I've said throughout the video like remember these tasks are super easy yada" }, { "start": 1242.8400000000001, "end": 1249.16, "text": " yada yada so let me make it clear in this in this diagram right here the" }, { "start": 1249.16, "end": 1255.5600000000002, "text": " super masks these are simply a way to train a neural network in a crude way" }, { "start": 1255.56, "end": 1260.12, "text": " right I don't think there is you know this distinction between mask and" }, { "start": 1260.12, "end": 1265.76, "text": " network I don't really like that much because ultimately what you're doing is" }, { "start": 1265.76, "end": 1271.6399999999999, "text": " simply you're training a neural network in a kind of weird way okay the fact" }, { "start": 1271.6399999999999, "end": 1276.52, "text": " that you always use the same underlying you know great neural network doesn't" }, { "start": 1276.52, "end": 1281.9199999999998, "text": " really matter right here it's still what you do in this super mask training is" }, { "start": 1281.9199999999998, "end": 1285.12, "text": " you provide a severely over parameterized network and then the mask" }, { "start": 1285.12, "end": 1289.36, "text": " simply gets to choose which weights to mix rather than you get to adjust the" }, { "start": 1289.36, "end": 1294.08, "text": " weights if you adjust the weights you usually get more accurate than with the" }, { "start": 1294.08, "end": 1299.1599999999999, "text": " mask but it's sort of like a quantized neural network that you train right here" }, { "start": 1299.1599999999999, "end": 1303.12, "text": " so that's the super mask thing again I don't think it's important that the" }, { "start": 1303.12, "end": 1306.84, "text": " underlying network is always the same the only advantage you have is it saves" }, { "start": 1306.84, "end": 1314.36, "text": " space because these masks are very small the super masks on the other hand this" }, { "start": 1314.36, "end": 1321.3999999999999, "text": " idea that you overlay all of the masks together and then you look at where this" }, { "start": 1321.3999999999999, "end": 1327.8, "text": " at the gradient of the entropy and you look at which of the of the mixing" }, { "start": 1327.8, "end": 1333.36, "text": " factors the gradient poles the most that's a different idea and the question" }, { "start": 1333.36, "end": 1337.52, "text": " here is wouldn't that isn't that independent does really depend on the" }, { "start": 1337.52, "end": 1343.8799999999999, "text": " masks or doesn't it and the you know the hypothesis would be that if I simply" }, { "start": 1343.88, "end": 1348.72, "text": " train you know three different neural networks for three different tasks could" }, { "start": 1348.72, "end": 1352.8400000000001, "text": " I not do the same superposition trick like could I not just add all of them" }, { "start": 1352.8400000000001, "end": 1358.1200000000001, "text": " with a respective alpha look at the entropy calculate the gradient with" }, { "start": 1358.1200000000001, "end": 1362.2800000000002, "text": " respect to each of the alphas of the entropy and then decide which task it is" }, { "start": 1362.2800000000002, "end": 1368, "text": " you know don't need masks simply mix neural networks in superposition so I" }, { "start": 1368, "end": 1372.96, "text": " did it and I actually tried their code is available so big props for their" }, { "start": 1372.96, "end": 1378.16, "text": " code being available I tried their code it's actually very few changes and I'm" }, { "start": 1378.16, "end": 1384.72, "text": " going to append my live coding of this at the end of this video so if you want" }, { "start": 1384.72, "end": 1388.64, "text": " to if you are interested in watching that you can do so but you know the" }, { "start": 1388.64, "end": 1393.1200000000001, "text": " outcome is if I train neural networks and I have I've you know done super quick" }, { "start": 1393.1200000000001, "end": 1398, "text": " and initialize them wrongly probably and all but if I train these neural net if I" }, { "start": 1398, "end": 1403.48, "text": " train the masks you get to like 92 percent accuracy in their tasks in each" }, { "start": 1403.48, "end": 1407.24, "text": " of the tasks and then also in the average if I train the actual neural" }, { "start": 1407.24, "end": 1412, "text": " networks I get to a higher accuracy like 93 something it doesn't matter it's just" }, { "start": 1412, "end": 1418.36, "text": " higher okay so that's hypothesis one is the training masks is just a way of" }, { "start": 1418.36, "end": 1422.7, "text": " training neural networks the fact that the masks and the network training" }, { "start": 1422.7, "end": 1428.2, "text": " itself are that close I think is a testament to how easy these tasks are" }, { "start": 1428.2, "end": 1434.0800000000002, "text": " like how easy eminent amnest is I'm going to also hypothesize that if the" }, { "start": 1434.0800000000002, "end": 1438.04, "text": " task gets harder and harder and I don't mean 10 class image net I mean a" }, { "start": 1438.04, "end": 1444.68, "text": " thousand class image net then these masks are going to degrade severely" }, { "start": 1444.68, "end": 1448.2, "text": " versus training the actual neural network I might be wrong I mean you can" }, { "start": 1448.2, "end": 1453.16, "text": " over parameter eyes really heavily and they will still work okay but in any" }, { "start": 1453.16, "end": 1455.92, "text": " case I trade the train these neural networks and they reached higher" }, { "start": 1455.92, "end": 1461, "text": " accuracy and then I did the exact same thing I laid them in superposition to" }, { "start": 1461, "end": 1465.56, "text": " determine what task it is and I could achieve the exact same result so here in" }, { "start": 1465.56, "end": 1469.6000000000001, "text": " their example they have a hundred percent task classification accuracy and" }, { "start": 1469.6000000000001, "end": 1475.16, "text": " I reached the exact same thing code worked I'm not going to try to scale" }, { "start": 1475.16, "end": 1482.3200000000002, "text": " this up to 250 or 2500 in tasks but I'm going to assume that with you know" }, { "start": 1482.3200000000002, "end": 1488.0400000000002, "text": " tuning and stuff that it's going to work about equally well you could make an" }, { "start": 1488.0400000000002, "end": 1492.8400000000001, "text": " argument that the masks being sparser they might be differentiated from each" }, { "start": 1492.8400000000001, "end": 1500.48, "text": " other more accurately but I'm not sure maybe but it's it's not a cool it's not" }, { "start": 1500.48, "end": 1507.04, "text": " a qualitative difference right so these two things are really two separate ideas" }, { "start": 1507.04, "end": 1513.2, "text": " that find their way together in this paper but ultimately have not much to do" }, { "start": 1513.2, "end": 1523.34, "text": " with each other okay at least that's from what I can tell I might I might be" }, { "start": 1523.34, "end": 1528.3600000000001, "text": " wrong here and I might be wrong with respect to their G objective and whatnot" }, { "start": 1528.36, "end": 1536.12, "text": " and you know but I think that that these are two cool ideas but they can be" }, { "start": 1536.12, "end": 1543.28, "text": " applied independently so the last thing I want to look at is their broader impact" }, { "start": 1543.28, "end": 1549.28, "text": " statement right here now there is a reason so usually I kind of track these" }, { "start": 1549.28, "end": 1552.8799999999999, "text": " broader impact statement because I think this this is this here is sort of" }, { "start": 1552.8799999999999, "end": 1556.52, "text": " fundamental research right this is fundamental machine learning research" }, { "start": 1556.52, "end": 1560.8, "text": " we do architecture the multitask learning task isn't really important as" }, { "start": 1560.8, "end": 1565.4, "text": " long as we have kind of the same tasks right here uncorrelated and so on the" }, { "start": 1565.4, "end": 1568.8799999999999, "text": " same hardness and I've also made the point that it's really important for" }, { "start": 1568.8799999999999, "end": 1574.24, "text": " these tasks to be the same hard for this to work in this place a role right here" }, { "start": 1574.24, "end": 1580.92, "text": " so um and they do they do describe some of this in this conclusion with you know" }, { "start": 1580.92, "end": 1586.44, "text": " limitation that we observed has to do with task identity inference when model" }, { "start": 1586.44, "end": 1591.3600000000001, "text": " are not well calibrated models that are overly confident for the wrong task okay" }, { "start": 1591.3600000000001, "end": 1600.4, "text": " so in order for them to infer the correct task they the sort of so if you" }, { "start": 1600.4, "end": 1605.92, "text": " look at your entropy of the models for the tasks that means you're gonna" }, { "start": 1605.92, "end": 1611.98, "text": " select the model that is the most sure about the task this only works if the" }, { "start": 1611.98, "end": 1617.84, "text": " tasks are equally hard okay if one task is much much harder than the other task" }, { "start": 1617.84, "end": 1622.04, "text": " this other task is always going to say well I'm really confident about this one" }, { "start": 1622.04, "end": 1625.84, "text": " because the task is just easier it's going to be it's going to train in neural" }, { "start": 1625.84, "end": 1630.88, "text": " networks is generally more confident and you're going to misclassify a lot of the" }, { "start": 1630.88, "end": 1637.2, "text": " tasks so so here what does this have to do with the broader impact statement if" }, { "start": 1637.2, "end": 1645.48, "text": " you look at the broader impact statement what they say right here so they say a" }, { "start": 1645.48, "end": 1649.76, "text": " goal of continue learning self-manage tasks with a single model however it is" }, { "start": 1649.76, "end": 1653.24, "text": " not exactly clear what qualifies as a single model therefore a concrete" }, { "start": 1653.24, "end": 1658.52, "text": " objective has become to learn many tasks as efficiently as possible we believe" }, { "start": 1658.52, "end": 1662.64, "text": " that subs up is a useful step in this direction however there are consequences" }, { "start": 1662.64, "end": 1667.44, "text": " to more efficient models both positive and negative so this is sort of what the" }, { "start": 1667.44, "end": 1672.1200000000001, "text": " community does so there are three things that I've seen so far in broader impact" }, { "start": 1672.1200000000001, "end": 1676.64, "text": " statement first you some people say this is not applicable to us which I agree" }, { "start": 1676.64, "end": 1682.0400000000002, "text": " for most fundamental research broader it like the broader impact statement is" }, { "start": 1682.0400000000002, "end": 1687.1200000000001, "text": " supposed to be what does this particular method how will this influence broader" }, { "start": 1687.12, "end": 1694.36, "text": " society so not applicable completely valid for most of these research papers" }, { "start": 1694.36, "end": 1702.2399999999998, "text": " because guess what you can use any method to do good or to do bad and that's" }, { "start": 1702.2399999999998, "end": 1708.6399999999999, "text": " that's the second second part second method is basically you you just change" }, { "start": 1708.6399999999999, "end": 1713.76, "text": " a generic statements how you can do good and bad and usually you can't relate it" }, { "start": 1713.76, "end": 1718.96, "text": " to your particular method in the paper right because your method is I don't" }, { "start": 1718.96, "end": 1725.96, "text": " know like my faster convergence rate of SGD but and and so what you do is you" }, { "start": 1725.96, "end": 1730.3, "text": " just go one level up you go up the levels it's always like optimization can" }, { "start": 1730.3, "end": 1733.28, "text": " be used for good and for bad I mean that's still kind of a bit vague and" }, { "start": 1733.28, "end": 1737.8799999999999, "text": " then you go up further well optimization can do more machine learning and machine" }, { "start": 1737.8799999999999, "end": 1742.24, "text": " learning can be used to do good and bad for example face recognition and things" }, { "start": 1742.24, "end": 1745.76, "text": " like this so you just go up the levels and that's what they essentially do here" }, { "start": 1745.76, "end": 1750.84, "text": " and that's what you know most people have defaulted to it's like okay so you" }, { "start": 1750.84, "end": 1756.04, "text": " know our model here is you know we it basically one can train more efficient" }, { "start": 1756.04, "end": 1760.16, "text": " models and then they simply highlight what more efficient models can do" }, { "start": 1760.16, "end": 1764.18, "text": " efficient models require less compute if there's a model by we run on the end" }, { "start": 1764.18, "end": 1769.24, "text": " device if models are more efficient than large-scale research is not limited to" }, { "start": 1769.24, "end": 1774.36, "text": " wealthier institutions by the way I also the broader impact statement I believe" }, { "start": 1774.36, "end": 1779.32, "text": " should be the impact on society and not really on the research community itself" }, { "start": 1779.32, "end": 1787.6, "text": " so I also this this is a bit shaky with respect to because I'm really regarding" }, { "start": 1787.6, "end": 1791.92, "text": " what the broader impact statement should be this is not my opinion I'm I'm trying" }, { "start": 1791.92, "end": 1797.1200000000001, "text": " to reflect everything I've read of guidance about what the broader impact" }, { "start": 1797.12, "end": 1803.2399999999998, "text": " statement should be by the way there is also method method three which is to" }, { "start": 1803.2399999999998, "end": 1806.4399999999998, "text": " simply tell me more about your paper in the broader impact statement which I" }, { "start": 1806.4399999999998, "end": 1810.6399999999999, "text": " guess is the smart method because the broader impact statement can be before" }, { "start": 1810.6399999999999, "end": 1815.2399999999998, "text": " before the references so it's in the main part and people are required to" }, { "start": 1815.2399999999998, "end": 1819.36, "text": " read it not like the appendix reviewers are not required to read the appendix" }, { "start": 1819.36, "end": 1822.76, "text": " reviewers are required to read the broader impact statement so I guess the" }, { "start": 1822.76, "end": 1827.68, "text": " smart authors will just try to cloak more information about their model in" }, { "start": 1827.68, "end": 1832.08, "text": " terms of a broader impact statement I guess well whether that's smart is a" }, { "start": 1832.08, "end": 1837.96, "text": " different discussion but here they just it's it's already defaulting right these" }, { "start": 1837.96, "end": 1843.64, "text": " it's already the default people simply go level up level up level up until we" }, { "start": 1843.64, "end": 1848.8799999999999, "text": " can you know say something generic and we will also highlight and discuss the" }, { "start": 1848.88, "end": 1852.72, "text": " negative consequences of models which can efficiently learn many tasks and" }, { "start": 1852.72, "end": 1857.0400000000002, "text": " efficient models in general when models are more efficient they're also more" }, { "start": 1857.0400000000002, "end": 1861.2800000000002, "text": " available and less subject to regularization as a study and study of" }, { "start": 1861.2800000000002, "end": 1866.0400000000002, "text": " result for instance when a high-impact model is released an institution will" }, { "start": 1866.0400000000002, "end": 1871.44, "text": " hopefully be accompanied by a model card analyzing the bias and intended use of" }, { "start": 1871.44, "end": 1877.16, "text": " the model by contrast if anyone is able to train a powerful model this may no" }, { "start": 1877.16, "end": 1881, "text": " longer be the case resulting in a proliferation of model with harmful" }, { "start": 1881, "end": 1885.8000000000002, "text": " biases or intended use taking the United States for instance bias can be harmful" }, { "start": 1885.8000000000002, "end": 1890.72, "text": " as models show disproportionately more errors for already marginalized groups" }, { "start": 1890.72, "end": 1896.8000000000002, "text": " furthering existing deeply rooted structural racism this this is like well" }, { "start": 1896.8000000000002, "end": 1904.88, "text": " technology this is basically a statement about technology and so why why do I" }, { "start": 1904.88, "end": 1911.88, "text": " have a particular not issue but why do I pick this broader impact statement they" }, { "start": 1911.88, "end": 1917.96, "text": " even Rick this here this is this gender shades paper right where people went and" }, { "start": 1917.96, "end": 1922.8000000000002, "text": " they looked at these commercial API's for face recognition I I think that's" }, { "start": 1922.8000000000002, "end": 1929.0800000000002, "text": " the paper yeah gender shades so if you have a face" }, { "start": 1929.08, "end": 1937.6, "text": " recognizer they realized they divided people up by I think gender and race so" }, { "start": 1937.6, "end": 1943.78, "text": " you know like they built four groups or I haven't I haven't I've just looked at" }, { "start": 1943.78, "end": 1947.8, "text": " the paper but in my understanding that they divided people up into groups which" }, { "start": 1947.8, "end": 1952.9199999999998, "text": " I find arbitrary to have the these two axes race and gender but okay you can do" }, { "start": 1952.9199999999998, "end": 1958.6399999999999, "text": " that and they discovered that these commercial API's have different accuracy" }, { "start": 1958.64, "end": 1964.16, "text": " for the different groups right and that basically our point is that you know" }, { "start": 1964.16, "end": 1967.2800000000002, "text": " these commercial API's if they're offered for all humans they should work" }, { "start": 1967.2800000000002, "end": 1974.68, "text": " equally well for all humans now now you may be see what it has to do with this" }, { "start": 1974.68, "end": 1982.4, "text": " paper well this paper is in the business of doing multitask learning so it is" }, { "start": 1982.4, "end": 1989, "text": " very viable to actually frame the the task for example like this is an example" }, { "start": 1989, "end": 1994.96, "text": " if you frame the task of multitask learning like face recognition on" }, { "start": 1994.96, "end": 1999.2800000000002, "text": " different groups of people as a multitask learning problem you have you" }, { "start": 1999.2800000000002, "end": 2005.3600000000001, "text": " know group group one right here group two group three and then if at inference" }, { "start": 2005.3600000000001, "end": 2009.5600000000002, "text": " time so you can build you know good models for each of the group at" }, { "start": 2009.56, "end": 2012.72, "text": " inference time you're given an image and you're trying to a fur first which" }, { "start": 2012.72, "end": 2017.4199999999998, "text": " group is that from and then take the appropriate classifier that would be you" }, { "start": 2017.4199999999998, "end": 2022.72, "text": " know that would be a good a hypothetical classifier for this thing now what do we" }, { "start": 2022.72, "end": 2030.3999999999999, "text": " know about this thing this thing is fails if the tasks aren't equally hard" }, { "start": 2030.3999999999999, "end": 2038.6799999999998, "text": " also in in specifically if if for one group let's say for group three the the" }, { "start": 2038.68, "end": 2043.24, "text": " task is way harder because you have less data I guess the one of the main" }, { "start": 2043.24, "end": 2048.36, "text": " problems there is that the data sets are not equally balanced if you have less" }, { "start": 2048.36, "end": 2054.2400000000002, "text": " data for that then the task becomes de facto harder and the model is less sure" }, { "start": 2054.2400000000002, "end": 2062.2400000000002, "text": " about the task which means that it's a double whammy so not only is the model" }, { "start": 2062.2400000000002, "end": 2068.56, "text": " itself less accurate but these the input data point if the person is actually" }, { "start": 2068.56, "end": 2074.32, "text": " of group three is less likely to be classified correctly into the correct" }, { "start": 2074.32, "end": 2081.16, "text": " model at to begin with so you know for all the for all I I've had my my share" }, { "start": 2081.16, "end": 2086.16, "text": " of of comments on the video I made and I still maintain that societal bias can" }, { "start": 2086.16, "end": 2091.2799999999997, "text": " comes about by data set but for all the people saying there are models that" }, { "start": 2091.2799999999997, "end": 2098.32, "text": " exaggerate existing biases in models this would be like if there is any ever" }, { "start": 2098.32, "end": 2103.04, "text": " any applicability of these broader impact statement guidelines this would" }, { "start": 2103.04, "end": 2108.36, "text": " be the paper right it's this right here is an actual system that if I have" }, { "start": 2108.36, "end": 2113.48, "text": " different classifiers and I combine them with this method it will double punish" }, { "start": 2113.48, "end": 2120.04, "text": " the classifier that is less sure that is less accurate because that is also going" }, { "start": 2120.04, "end": 2124.88, "text": " to be the one with the higher entropy therefore not as much selected if I give" }, { "start": 2124.88, "end": 2130.76, "text": " a data point of that particular task and so this is like a I'm not criticizing" }, { "start": 2130.76, "end": 2134.76, "text": " the method here like by all means like this is a cool method where you can" }, { "start": 2134.76, "end": 2139.32, "text": " recognize that this happens and try to calibrate accordingly but if there was" }, { "start": 2139.32, "end": 2145.2000000000003, "text": " ever any straight ball for a broader impact statement I would you know this" }, { "start": 2145.2000000000003, "end": 2151.32, "text": " is it and this I'm not I'm not trying I'm not saying that these these authors" }, { "start": 2151.32, "end": 2157.2400000000002, "text": " didn't do that for a reason I believe that look it's been whatever not even" }, { "start": 2157.2400000000002, "end": 2161.36, "text": " half a year since we've started with these general broader impact statements" }, { "start": 2161.36, "end": 2168.1200000000003, "text": " and everybody is already defaulting to simply say technology good technology" }, { "start": 2168.1200000000003, "end": 2177.8, "text": " bad that's that's the people aren't even thinking and so this right this is one" }, { "start": 2177.8, "end": 2183.6800000000003, "text": " of the reasons why I simply find these broader impact statements to be not that" }, { "start": 2183.6800000000003, "end": 2188.2400000000002, "text": " like not a good idea because there is a default answer and people are just" }, { "start": 2188.2400000000002, "end": 2194.2400000000002, "text": " putting it here even in like when there is an actual obvious immensely obvious" }, { "start": 2194.2400000000002, "end": 2202.36, "text": " thing that they even they even cited like the basis for that so you know" }, { "start": 2202.36, "end": 2210.8, "text": " that's sort of my take on this I again I enjoyed this paper the code is is" }, { "start": 2210.8, "end": 2215.96, "text": " available everything is good about this this paper I'm not even the fact that" }, { "start": 2215.96, "end": 2218.48, "text": " these are you know I think these are kind of two separate ideas they're" }, { "start": 2218.48, "end": 2225.4, "text": " combined cool they're analyzed formally in theory there's intuition given all" }, { "start": 2225.4, "end": 2232.34, "text": " good so don't get me wrong this is not like trashing this paper it's just" }, { "start": 2232.34, "end": 2240.44, "text": " I felt I had something more to say and I think that was it so yeah I'll see you" }, { "start": 2240.44, "end": 2247.2000000000003, "text": " next time with the new paper okay so our goal here is going to be to change this" }, { "start": 2247.2000000000003, "end": 2254.36, "text": " code to not use masks as mixtures but actually use neural networks with real" }, { "start": 2254.36, "end": 2260.04, "text": " weights as as mixtures and in superposition with each other okay so" }, { "start": 2260.04, "end": 2264.2, "text": " what we're going to do is we're going to train the different neural networks and" }, { "start": 2264.2, "end": 2270, "text": " then use this kind of superposition trick to figure out which task a data" }, { "start": 2270, "end": 2277.04, "text": " point came from so let's have a look at the code right here and there's a bunch" }, { "start": 2277.04, "end": 2283.4, "text": " of helper code and if we go down through everything you'll see that this is the" }, { "start": 2283.4, "end": 2288.96, "text": " MNIST permuted data set so each each task is basically a random permutation" }, { "start": 2288.96, "end": 2297.2, "text": " of MNIST and if you execute I believe this here and then you train the model" }, { "start": 2297.2, "end": 2303.32, "text": " and right now it's for five tasks but I guess that's going to be enough for now" }, { "start": 2303.32, "end": 2311.32, "text": " yeah so if we get some good signal here I guess it's a matter of of doing kind" }, { "start": 2311.32, "end": 2316.32, "text": " of engineering and plumbing and tuning if until you get it up to whatever 200" }, { "start": 2316.32, "end": 2323, "text": " or 2000 tasks though I might be wrong there so this is training and I" }, { "start": 2323, "end": 2329.44, "text": " shortly sort of had a look at the code but I haven't actually tried this yet so" }, { "start": 2329.44, "end": 2336.2000000000003, "text": " the thing the model is built here you see this is multi task fully connected" }, { "start": 2336.2000000000003, "end": 2341.6400000000003, "text": " which has these different layers right here and it's built by these multi task" }, { "start": 2341.64, "end": 2349.56, "text": " mask linear models now the multi task mask linear models are defined right" }, { "start": 2349.56, "end": 2354.6, "text": " here so it's basically a linear model as you can see it's derived from a linear" }, { "start": 2354.6, "end": 2361.2799999999997, "text": " from a linear module and it has a parameter called num tasks and then it" }, { "start": 2361.2799999999997, "end": 2369.7599999999998, "text": " has a parameter scores which I guess is are these these masks right here and the" }, { "start": 2369.76, "end": 2375.44, "text": " scores I'm going to guess are always going to be multiplied by the weights" }, { "start": 2375.44, "end": 2381.44, "text": " here in the forward so you can see they're in forward you get the weights" }, { "start": 2381.44, "end": 2389.2000000000003, "text": " from the alphas yeah yeah this is the superimposed alright so if we know the" }, { "start": 2389.2000000000003, "end": 2396.0400000000004, "text": " task ID down here we get this subnet and we are going to multiply it with the" }, { "start": 2396.04, "end": 2401.4, "text": " weights if we don't know the task ID we want to get these alphas so the alphas" }, { "start": 2401.4, "end": 2408.2799999999997, "text": " are going to be one over the number of tasks at the beginning we're then going" }, { "start": 2408.2799999999997, "end": 2417.4, "text": " to multiply each of the alphas with the weights and with that we're going to get" }, { "start": 2417.4, "end": 2423.8, "text": " this subnet mask right here so we need to know what this self dot stacked is so" }, { "start": 2423.8, "end": 2429.0800000000004, "text": " this self dot stacked is getting right here in this cache mask or simply" }, { "start": 2429.0800000000004, "end": 2435.0800000000004, "text": " stacking this this get subnet for all of the things so our plan is going to be" }, { "start": 2435.0800000000004, "end": 2440.32, "text": " that this subnet right here is going to be the actual weights of the neural" }, { "start": 2440.32, "end": 2447.2000000000003, "text": " network okay and not just the not just the mask and then we don't need to" }, { "start": 2447.2000000000003, "end": 2451.6400000000003, "text": " actually multiply it with the weight we can just just forget about the weight" }, { "start": 2451.64, "end": 2458.8799999999997, "text": " honestly and just train the subnet so for the subnet as you can see here you" }, { "start": 2458.8799999999997, "end": 2464.7599999999998, "text": " have this get subnet thing and that's an autograd function which basically means" }, { "start": 2464.7599999999998, "end": 2468.64, "text": " in the forward pass you want to discretize it and in the backward pass" }, { "start": 2468.64, "end": 2473.56, "text": " this is a straight through estimator so our first task is going and this here" }, { "start": 2473.56, "end": 2478.8399999999997, "text": " should be done now my laptop has stopped breathing so we've trained five tasks" }, { "start": 2478.84, "end": 2485, "text": " and now we can run inference on that so this is when the task is given real" }, { "start": 2485, "end": 2493.84, "text": " quick you can see task one 92 percent 92 percent 92 percent 92 percent so we have" }, { "start": 2493.84, "end": 2501.04, "text": " a an overall performance of 92.44 percent then when the task is not given" }, { "start": 2501.04, "end": 2507.32, "text": " we have two things to evaluate whether or not basically how good we are overall" }, { "start": 2507.32, "end": 2511.92, "text": " and whether or not we get the tasks correct of course the tasks are at this" }, { "start": 2511.92, "end": 2518.2000000000003, "text": " pre requirement so we have a hundred percent task inference accuracy okay so" }, { "start": 2518.2000000000003, "end": 2522.76, "text": " we don't we don't okay we can we could evaluate this here but you can already" }, { "start": 2522.76, "end": 2527.52, "text": " see the output from last time there is like no difference from the performance" }, { "start": 2527.52, "end": 2532.7200000000003, "text": " of the when the task is given it's always being able to infer the task we" }, { "start": 2532.72, "end": 2537.3599999999997, "text": " want to check out the same thing so we want to change first of all this get" }, { "start": 2537.3599999999997, "end": 2542.3199999999997, "text": " subnet this is where it's these scores are discretized now given that these" }, { "start": 2542.3199999999997, "end": 2547.2799999999997, "text": " scores are going to be and to end up being our actual weights we want we" }, { "start": 2547.2799999999997, "end": 2550.9199999999996, "text": " don't do that we simply return the scores now this is a this is pretty" }, { "start": 2550.9199999999996, "end": 2558.3999999999996, "text": " pointless right now but we'll keep it just to be as close as possible to the" }, { "start": 2558.4, "end": 2569.12, "text": " to that now mask in it this is where we initialize the mask now this is climbing" }, { "start": 2569.12, "end": 2575.2400000000002, "text": " uniform and it has some thing but we want probably we want to train the" }, { "start": 2575.2400000000002, "end": 2583.78, "text": " neural network to be initialized you know as we know it so let's try what what" }, { "start": 2583.78, "end": 2590.0800000000004, "text": " our other initialize function so in it dot what do we have here do we have" }, { "start": 2590.0800000000004, "end": 2599.6800000000003, "text": " what's usual I don't even know normal Savi that that sounds about right that" }, { "start": 2599.6800000000003, "end": 2609.28, "text": " sounds about right all right all right so scores and yeah let's try this this" }, { "start": 2609.28, "end": 2612.88, "text": " could this could I break everything right if you initialize wrongly you get" }, { "start": 2612.88, "end": 2623.96, "text": " like dumb results so okay signed constant yada yada yada where is that" }, { "start": 2623.96, "end": 2632.6, "text": " used huh okay that's also initializing something so we calculate the gain and" }, { "start": 2632.6, "end": 2641.2400000000002, "text": " then okay this doesn't seem good we'll just keep it hey why not" }, { "start": 2641.24, "end": 2651.04, "text": " why not why not just keep it at that all right so cool oh yeah this is for the" }, { "start": 2651.04, "end": 2655.4799999999996, "text": " weight anyway we won't use the weight at all of this layer we'll just use our own" }, { "start": 2655.4799999999996, "end": 2661.52, "text": " weights so here we have these stacked okay we get the scores that's all good" }, { "start": 2661.52, "end": 2667.9599999999996, "text": " like I'm pretty happy with that I'm pretty happy with this mask in it that" }, { "start": 2667.9599999999996, "end": 2670.8799999999997, "text": " we make our parameters so these are going to be our different neural" }, { "start": 2670.88, "end": 2678.6, "text": " networks that we train this all looks good the alphas look good now the only" }, { "start": 2678.6, "end": 2686.52, "text": " thing we want to do honestly is just to have not the weight times the subnet" }, { "start": 2686.52, "end": 2695.84, "text": " here but the subnet as such like this is this it do we now train actual neural" }, { "start": 2695.84, "end": 2704.56, "text": " networks I I have my doubts honestly like there should be no this should be" }, { "start": 2704.56, "end": 2716.2000000000003, "text": " it hmm yeah yeah let's just try it like we're gonna get a mistake somewhere like" }, { "start": 2716.2, "end": 2726.8399999999997, "text": " crash nope nope okay all right actually training so for real like these scores" }, { "start": 2726.8399999999997, "end": 2733.4399999999996, "text": " right here the fact what made them a mask is that we discretize them right" }, { "start": 2733.4399999999996, "end": 2737.3599999999997, "text": " here so we made them into a mask right here we're not doing that anymore so" }, { "start": 2737.3599999999997, "end": 2740.96, "text": " we're just training floats and then we're also not multiplying it by the" }, { "start": 2740.96, "end": 2745.9199999999996, "text": " weight we are just using those floats which means that we are using the" }, { "start": 2745.92, "end": 2751.8, "text": " basically a neural network and then here the bias I was worried about the bias" }, { "start": 2751.8, "end": 2757.96, "text": " but the bias is always zero as you can see here so the bias is always false" }, { "start": 2757.96, "end": 2763.44, "text": " yeah so we're training five different neural networks for five different tasks" }, { "start": 2763.44, "end": 2770.48, "text": " and you know according to my hypothesis these masked things are just kind of" }, { "start": 2770.48, "end": 2778.4, "text": " crude quantized ways are of training neural networks and if if my hypothesis" }, { "start": 2778.4, "end": 2783.8, "text": " is correct this here is going to turn out probably even better than this" }, { "start": 2783.8, "end": 2789.44, "text": " masked thing okay so last task training right here" }, { "start": 2789.44, "end": 2798.2, "text": " I'm starting to breathe good laptop fast laptop very nice come on come on come" }, { "start": 2798.2, "end": 2808.6, "text": " on and we're done so again we have an average top one performance of 92 point" }, { "start": 2808.6, "end": 2815.08, "text": " is this even did I even oh no I ran this right here okay like that's the exact" }, { "start": 2815.08, "end": 2820.08, "text": " same number it was last time so we need to run inference again and if we're" }, { "start": 2820.08, "end": 2829.2, "text": " given the task ID then we are at 93.9% so we increase slightly which might just be" }, { "start": 2829.2, "end": 2835.72, "text": " due to the fact that we initialize terribly terribly okay so what does it" }, { "start": 2835.72, "end": 2840.18, "text": " say about our task inference accuracy maybe there's some mask here set model" }, { "start": 2840.18, "end": 2849.7599999999998, "text": " task the alphas are to one nope no we're good we're good task inference accuracy" }, { "start": 2849.76, "end": 2855.88, "text": " 100% and I'm going to guess well with the task inference accuracy being 100%" }, { "start": 2855.88, "end": 2861.48, "text": " I'm going to guess this here will give us the exact same number I like the 93" }, { "start": 2861.48, "end": 2870.0800000000004, "text": " point some percent so yeah 93.9% so I'm you know I'm going to say right here" }, { "start": 2870.0800000000004, "end": 2876.6000000000004, "text": " that the on the super masks and the superposition really are two separate" }, { "start": 2876.6, "end": 2885.56, "text": " ideas right you it's it's because the paper is like it sounds cool and all" }, { "start": 2885.56, "end": 2890.88, "text": " with the supermask and superposition but this inference using the superposition" }, { "start": 2890.88, "end": 2897.04, "text": " and then the entropy to decide is really one idea and training different super" }, { "start": 2897.04, "end": 2901.2799999999997, "text": " math the the advantage in using supermask is of course that the model is" }, { "start": 2901.28, "end": 2910.5600000000004, "text": " way smaller so you can remember it much more easily but also you know that it's" }, { "start": 2910.5600000000004, "end": 2913.76, "text": " really different if there's there's nothing to do with the superposition" }, { "start": 2913.76, "end": 2920.28, "text": " yeah all right so I'm going I'm going to guess this also works for you know 200" }, { "start": 2920.28, "end": 2927.88, "text": " tasks and whatnot the higher order of tasks so I think that's it and we're" }, { "start": 2927.88, "end": 2931.56, "text": " done here yeah" } ]
3jT1qJ8ETzk
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
SupSup: Supermasks in Superposition (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "supsup", "supermasks", "lottery ticket", "lottery ticket hypothesis", "gradient", "entropy", "surplus", "superfluous neurons", "lifelong learning", "multitask learning", "catastrophic forgetting", "continuous learning", "binary mask", "random network", "optimization", "hopfield network", "gradient descent", "superposition" ]
Supermasks are binary masks of a randomly initialized neural network that result in the masked network performing well on a particular task. This paper considers the problem of (sequential) Lifelong Learning and trains one Supermask per Task, while keeping the randomly initialized base network constant. By minimizing the output entropy, the system can automatically derive the Task ID of a data point at inference time and distinguish up to 2500 tasks automatically. OUTLINE: 0:00 - Intro & Overview 1:20 - Catastrophic Forgetting 5:20 - Supermasks 9:35 - Lifelong Learning using Supermasks 11:15 - Inference Time Task Discrimination by Entropy 15:05 - Mask Superpositions 24:20 - Proof-of-Concept, Task Given at Inference 30:15 - Binary Maximum Entropy Search 32:00 - Task Not Given at Inference 37:15 - Task Not Given at Training 41:35 - Ablations 45:05 - Superfluous Neurons 51:10 - Task Selection by Detecting Outliers 57:40 - Encoding Masks in Hopfield Networks 59:40 - Conclusion Paper: https://arxiv.org/abs/2006.14769 Code: https://github.com/RAIVNLab/supsup My Video about Lottery Tickets: https://youtu.be/ZVVnvZdUMUk My Video about Supermasks: https://youtu.be/jhCInVFE2sc Abstract: We present the Supermasks in Superposition (SupSup) model, capable of sequentially learning thousands of tasks without catastrophic forgetting. Our approach uses a randomly initialized, fixed base network and for each task finds a subnetwork (supermask) that achieves good performance. If task identity is given at test time, the correct subnetwork can be retrieved with minimal memory usage. If not provided, SupSup can infer the task using gradient-based optimization to find a linear superposition of learned supermasks which minimizes the output entropy. In practice we find that a single gradient step is often sufficient to identify the correct mask, even among 2500 tasks. We also showcase two promising extensions. First, SupSup models can be trained entirely without task identity information, as they may detect when they are uncertain about new data and allocate an additional supermask for the new training distribution. Finally the entire, growing set of supermasks can be stored in a constant-sized reservoir by implicitly storing them as attractors in a fixed-sized Hopfield network. Authors: Mitchell Wortsman, Vivek Ramanujan, Rosanne Liu, Aniruddha Kembhavi, Mohammad Rastegari, Jason Yosinski, Ali Farhadi Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hi there, today we'll look at super masks in superposition by Mitchell Wirtzman, Vivek Ramanujan at AL. So on a high level this paper tackles the problem of sequentially learning many many tasks without catastrophic forgetting by leveraging these things called super masks. A super mask is basically a binary mask that you unlace over a randomly initialized neural network to make the mask network perform better than a random initialization. They will train these masks for each of the tasks that they consider and then at inference time they can recover the task that the data is from and therefore kind of do this lifelong multitask learning better than the baselines that they compare against. In fact they can do better without knowing the task than the baselines can with knowing the task. So that's pretty pretty cool. This is a pretty dense paper in terms of content and we won't go over everything in the paper but we'll go over the ideas and what kind of what I think makes them work. So stick around if you want to know that. Also consider sharing this video out, tell your friends about it and subscribe if you haven't, it helps. So yeah cool. So let's dive in. We present the super masks in superposition model capable of sequentially learning 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 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 CIFAR 10, right? So this is CIFAR 10. Cool. And now the model can do CIFAR 10 pretty well. Then you also want to learn a different task. You want to learn MNIST. Okay, so you have MNIST and you want to learn MNIST and you want to learn that one. So your hope is that your final model can do both. So you'll take this one and you simply train it on MNIST as well. And then, you know, we know there's this kind of fine tuning pre training and so on. So your hope would be that at the end it can do both. But then you want another one. You want ImageNet. Okay, now ImageNet is a pretty big data set. So you take your model and you also train it on ImageNet. And with time, the model is always going to be very good at the task you just learned, but it is going to forget the tasks that you learned previously. This is the catastrophic forgetting problem. You might ask, why don't I just train on all the tasks equally, like at the same time? And that's a valid question. You can do that. But this in the task description here, it's necessary that we learn the task one after another, because, you know, maybe we get this data in this year and then it's pretty big data. We can't just 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 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 could simply train the different models for each task and just keep them around. Right. And at, you know, test time, you need some way of deciding. So there are two different scenarios in at test time. So you learn all of these models. And then at test time, there's an image. And it could be that I tell you that this image, by the way, that's an MNIST image. 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 I have no clue. Then you need a way to decide where it comes from. But once you do decide where it comes from, it's again pretty easy. Once you think, I think this is an MNIST 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 C for 10 and ImageNet are both natural images. So they might benefit from each other's feature in some way. Now, what we're going to do here is we're sort of going to do this separate models approach. Namely, we're going to use these. We're going to build these super masks. So super masks are the second thing that we're going to combine here. Our approach uses a randomly initialized fixed base network. And for each task, find a sub network, a super mask that achieves good performance. So what's a super mask? A super mask comes from these kind of papers about lottery ticket hypothesis. And one of these papers discovered basically or conjectured and then showed in evidence that if you have a network that is randomly initialized, just like this is your neural network, the gray thing, and there is a way to mask it, which means masking basically means that you either activate or inactivate connections. So you have your network and you simply multiply it by a binary mask that for each connection is a one or a zero. So the one so here is like zero, zero, zero, zero, zero. This is a one. This is zero, zero, zero. This is a one. So the network isn't going to be zeros and ones, but it's going to be multiplied. Each connection is going to be multiplied by a zero or a one, which means wherever there's a one, whatever weight that connection had, that will be the value of the weight of the connection. If it is a zero, whatever weight that connection had, it will be it will be pinned to zero. So there will be no signal flowing. So this paper established that if you take a randomly initialized neural network, there is a way to mask it. And you can find those masks where if you mask 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. OK, and they found that. And I've made a video about that. And the sort of intuition behind the super masks is this is just my intuition. Is that, you know, MNIST, this is what I'm guessing. MNIST is a relatively easy task. In fact, most of the tasks they're considering in these papers are relatively easy. And if you have a randomly initialized neural network, basically what you have around is a bunch of weight. Right. So if if I have my two layers right here and then each connection here is is a number like point two five. This is, you know, seven. This is negative three and so on. They're going to consider they here are going to consider weights that are initialized in a very special way. But ultimately, you just have a bunch of random weights lying around. And if the task is super easy, let's say, and the the neural network is sufficiently overparameterized, 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 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 overparameterization and selecting of the weights that you have around, mixing them correctly by simply. So you can't mix arbitrarily, but you can mix with zero or one. You get good enough. OK. So this is sort of my hypothesis. My hypothesis would be that the harder the task, the the harder it gets to find super masks that perform well. That's what I think. But nevertheless, to say for the tasks they're considering here, you can find these super masks. And there is a way to do that by using gradient descent, even though the super masks are discrete. So what we're going to do is we're going to use the same randomly initialized neural network for each of the tasks. Right. So this is like C for 10. This is MNIST. This is ImageNet. We're going to use the same gray network, but we're going to find an individual mask for each of those networks, for each of those tasks on top of the same network. And they're all going to perform relatively well, according to the super mask conjecture. Now, again, this is not surprising. And the fact that we always use the same randomly initialized network, you know, isn't really it's not really necessary that we always use the same. But in this case, they say, OK, 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 training one model per task and then inferring the task. And just that we do it in a much more crude way. So it's more like learning a compressed model per task. I find it's a better way to look at it than than continuous learning. In any case, you learn these super masks. And then here is the the the hard bit. The easy bit is if I tell you which tasks the inference data point, the test data point comes from, you have a pretty easy time classifying it. You simply select the mask accordingly, you run forward pass, and that's it. If I don't tell you where the test data point comes from, that's the hard part. Now, they need a way to decide where the data point comes from. And the 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 OK, there is not good explanation here. Then the correct model should be very confident. This is an assumption that you make. So I'm going to take my image of the test set and I'm going to feed it through the model one, which, you know, you have to separate this idea is separate from the masks 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. OK, 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 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 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 superposition of masks. And actually, the picture also I find more descriptive than the formula. I can write down the formula down here. So what they'll do is they'll say, why don't we just overlap all of the masks? So we'll have all of these masks and I for one for each tasks and we'll initialize them with coefficients. Alpha I will just mix them like this and alpha here. It's initialized in one over K, where K is the number of tasks. OK, we'll just mix them and then we'll multiply them by the weight of the neural network. And that's will that neural network is where we input our image into. OK, so what does that give us? That basically gives us a mix of all the networks. Like it's pretty safe to say that the entire network is going to be in there and maybe sometimes 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 alphas and we calculate the gradient of the entropy with respect to each of the alphas. What does that give us? So what's the intuition here? The intuition is if I change my alpha a bit, how does the entropy change? So basically, this gives you the sensitivity of the entropy to these alpha parameters. So if this is high, what does it mean? It means that this mask right here has a big influence on the entropy. Specifically, if I were to increase the alpha, then the entropy would increase. OK. And if I were to decrease the alpha, then the entropy would decrease. That's 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 lowest entropy. We want the one where we're very, very, very sure. Right. I might have said that absolutely wrong. So if you see right here, this is the formalism. First, we associate each of the k learned supermasks with a coefficient alpha initially set to 1 over k. Each alpha can be interpreted as the belief that supermask m is the correct mask, equivalently the belief that the current unknown task is task i. The model output is then computed with a weighted superposition of all learned tasks, which is this thing right here. The correct mask should produce a confidence low entropy output. Therefore, we recover the correct mask. We find the coefficients alpha, which minimize the output entropy h. OK. 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 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. OK. And again, our hypothesis here is that maximum entropy, sorry, minimum entropy means most confident 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, 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 a number of steps to converge. Or you can actually do a single step. So you just observe the gradient and by the gradient, you recognize which one has the lowest gradient. And that's the one you pick. So where's the catch here? The catch is that if you do something like this, if you do something like this, there are two catches, actually. First of all, this here is a 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 gradients with respect to the alphas, you make assumptions about the problem that might not be true. So you lose, you kind of heuristically approximate the importance of these masks. That's the first thing. The second thing, of course, is that it's you still you still are implicitly saving your still are implicitly trying all the models, but you're just not trying them explicitly. You're implicitly trying all the models because when you do this combination right here, your auto differentiation library will actually keep track of what the individual models contribute. It's just that per layer. So, of course, this here, this W is multi layer perceptron, which means that if you have multiple layers, you know, there's W one and there's W two. And you have your alphas and your alphas are also, you know, you can distribute them into these. Sorry, your masks are also mask for layer one mask for layer two and so on. So your auto differentiation package needs to keep track of. OK, 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 eye of mask eye one mask eye two. The contribution of the alpha eye 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 them. And propagate that forward. And therefore, if you look at the next layer, you can only view what mask two does mask of layer two does as in terms of a convex combination of layer one. So you make multiple approximations and you rely on the optimization of your auto differentiation library to keep track of these different things and do operations in parallel. And in the case where you do it linearly, I'm going to guess you simply do it as a sequential operation, but it's going to be exact. So that's the trade off. 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 data set, which is a thousand class data set, and it distributes it into 100 different tasks. Each is a 10 class classification task. Now note two things. First thing is that split image net. Each task is approximately as hard as each other as 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 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 10 class classification. It's going to be relatively easy. So all our conditions are met for at least for my hypothesis to hold. And you can see on the right side, you can see split C for 100, which does the same thing to C for 100. It subdivides it into different, very small class classification tasks. You can see the results. The upper bound here is where you train a single model for each of the tasks. That gets you to average accuracy of 92 percent. So on image net, 92 percent. It's pretty, it's pretty good. Of course, this is again, this is 10 class, which makes the numbers a lot different with the subs. So subs up, 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. Gigi, which yes, Gigi, 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 viability of the masking approach, which as you can see, it's pretty viable and it's more viable than these baselines. This same thing on the CIFAR 100 right here. So you can see they also evaluate since I guess it's an easier problem, they also evaluate the number of bytes which they can control. So they can control the number of bytes in their model by simply increasing or decreasing the required sparsity of their mask. So you can change your mask by saying how sparse you want it. And of course, if you want it more sparse, you get a worse model because you have less less ones in your budget to make your model perform well. But you can see that if they do it with these baseline model, 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 tasks with a common trunk. That gets you pretty much nowhere. With the sub sub algorithm, you do get almost to the performance of the upper bound. And in fact, if you do this transfer approach right here, you do get there. The transfer approach simply means that so you do these tasks in succession, right? You do task one. Okay, done. You do task two. Okay, done. And for each one, you train a mask. Okay, for each one you train this is mask one, mask two. The transfer approach simply says if I start task three, I'm going to start the mask three, my initial weights basically are going to be a running average of the masks that I have already considered or an average. There is some amount of transfer going on simply to initialize the weights. It's actually astounding that this helps you so much. But with this, if you look at the actual numbers, I believe you can get like a tiny bit higher than the training a single model for each of the tasks. Okay, so this sort of establishes the viability of training the different masks for the different tasks, which I again, I think it is not surprising because essentially you're training a different model per task. And it's just the fact that you do a very crude model and that you can store very efficiently. Now you might object and say, hey, don't I need to store the underlying randomly initialized network? And the answer is yes and no. Actually, you only need to store the random seed to produce it. So checkmate. Yeah, they do. So here they explain this one shot algorithm where they simply look at the gradient of the entropy. You can see with the maximum negative gradient of the entropy, they also have this binary algorithm. If the task where they say with the task is harder to differentiate this kind of assumption of the convex combination thing does might not hold. So what they do is they have this binary algorithm where they do a binary search where they simply want to circumvent the necessity to evaluate each of the masks by itself because that takes long. So they do something in between where they do this binary algorithm. This is right here where they do this convex combination, they evaluate the gradient, but then they don't just take the highest of the negative gradients. They eliminate half of them. So 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 order might actually be different in the second and third and fourth step. Of course, this is simply this is like halfway towards between this one shot algorithm and trying each mask by itself. It's kind of a compromise. I mean, they make it they really try to not not try each mask once because it's one of their contributions. Right. But then they probably realized if we just do it one shot, sometimes it doesn't work. So they're going between, which is, you know, it's a pretty cool idea. All right. Next experiments. We're now in this situation and you see you see a number of things. So first of all, we have a new added a new baseline, this PSP, and you can see that the baselines operating this G.G. 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 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. OK. 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 two class, if you split MNIST into two tasks, you predict the first task is zero, one, two, three, four. The second task is five, six, seven, eight, nine. OK. And you have the same amount of labels. So you always have five output neurons. Right. So you have one, two, three, four, five output neurons. If you if the image here is like a five, that would be task task one label zero. Right. If your network now predicts label zero correctly, but predicts the the image to come from task one, you count it as a mistake. You say, well, you know, you've predicted the right output neuron, but you've told me it comes from task zero from from the zero to four. So I'm going to count that as a mistake. So it's really there isn't there isn't a way for the network to kind of get around predicting the wrong tasks or kind of share information. So you assume that the labels are not shared or unshared. Yeah. So it's the subs up here has a significantly harder task than the baselines. Keep keep that in mind. And now we are applying our because we we are not given the task at inference time. Now we're applying our heuristic where we go and look at which of the mask entropies is the lowest. Respectively, we use this actually this one shot algorithm where we look at the gradients. And you can see this is on permuted MNIST in permuted MNIST. What you do is you take MNIST and you simply permute the pixels. And this it sounds crazy, but you simply permute the pixels and that gives you a new task. So you can come up with like almost an infinite number of tasks because there are what? Twenty eight times, twenty eight pixels. So you can commute them seven hundred and eighty four 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 ten different tasks. However, after that quickly degrades, however, this subs up here, it 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 L'Onet 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, MNIST is really easy and can actually be solved with a fully connected network. And second of all, especially permuted MNIST, 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 each 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 MNIST. All right. And then in this experiment right here, and this is the sort of crown experiment, they learn they do this permuted MNIST, but they go up to 2500 tasks, 2500 different permutations. But so but now they have an additional thing right here. So again, they have this sub sub where it needs to predict the correct permutation, but also they compare it with a an algorithm that needs that is this NN right here. So in this NN, not not only are you not given the task label at testing time, you are actually not even given the task label at training time. But here the outputs are shared. So, you know, since since you have no way of knowing which task it is, you've never given it as long as you predict the correct class. You good. So it's always it's always a 10 class classification problem. It's just not permuted. You're not given the task label here. So first of all, I want to say that this here, the shared labels, it could actually contribute to the success of this algorithm right here, because even though you permute the pixels, you can still sort of do things like count the frequency of light pixels versus dark pixels in MNIST. And that might already give you a very, very big hint. Right. Or, you know, simple correlation of of two pixels, though that's that's a task specific thing. But 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. You kind of have to randomize the number of light pixels, but keep the classes the same. 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, OK, if we don't have no task identity during training or inference. Where task identity is entirely unknown, even during training, if subs of 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. OK, so they go with the same principle right here. They say if we get a new training sample, we just evaluate it against all the masks that we had so far. Or we do our one shot algorithm to approximate which masks 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 a fact how they tune their constants. Like they have to define a threshold where they say, OK, 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 easy. So keep keep that in mind. Yeah. OK. So this basically was the experimental part of that paper. Now they consider different extensions to that. I'm not sure how they also consider some ablations, which are pretty interesting. So here they say we are going to up the kind of the hardness of the task with with rotated MNIST and also their model does pretty well on the rotated MNIST task, where the differences of between the differences between the tasks are simply some of them are rotated by 10 degrees. So that's a tiny rotation in the right. If you have a number three, you kind of 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 images from, or it will not get the it will not get a correct reward. 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, this entropy, it just spikes when you get the correct thing, because it sort of it sort of latches onto very easy features for each task. So I'm going to guess that the tasks are generally solvable by maybe correlating two pixels. Right. If like this pixel correlated with this pixel, if the correlation is high, it's a three. The correlation is low. It's something else. OK. 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 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. They also here they compare. The one shot algorithm. So they they they use their one shot algorithm to and they put it on a baseline. So this baseline where they always actually have to give it the task, they augmented by by their their one shot algorithm to select the task. And it turns out they can make it perform fairly well, not on par with them. Interestingly, but they can make it perform also fairly well, actually better than it was performing before. So they have different extensions right here. And that's some of them are pretty important. The one important thing they do is they have these superfluous neurons and that's sort of hidden. And it's always a bit. So here, for example, you see in the output, they say we have a lunette model using output size 500. Now there are only 10 different labels in the MNIST task, right? Also in the permuted MNIST task, there are 10 different labels. I mean, there are a total of 25,000 labels if you have 2500 tasks. But the neural network has output size 10. However, their neural network here has output size 500, which is surprising. So they say right here and we're going to get to the Hopfield network at the very end for those who are still around, because that's I think that should be its own paper. But, you know, they say it could use an output of size L where L is the actual number of labels per task, though we find in practice that it helps significantly to add extra neurons to the final layer. Specifically, we consider outputs P in our S. So S is higher than L and refer to the neurons that are past L as superfluous neurons. So let's try to make sense of this. So they have a neural network. And let's say it's a three class classification task, right? So you have three classes and that's what you would do. They simply add a bunch of neurons right here. That means they also they, you know, they add all of the connections from the previous layer to those neurons. But still, the classes can only be either 0, 1 or 2. These classes never appear during training. So they claim this helps during during their procedure. And I I thought about it a bit and we might be able to try to guess why it makes sense. They say they simply say we observe that helps. And I mean, you know, let's let's try to make sense of it. OK, so if we train, if we train our model using these too many neurons, what happens? Well, our label is always going to be of the top three neurons. So let's say our label is one. This is going to result in a one hot vector like this. Now, what are we training in this layer here? In this layer here, we're training logits. OK, so pre pre softmax outputs. So our our algorithm, our cross entropy loss is going to push all of these here down during every single training point. It's going to push this one up and all of these down. Now, these three here are going to be pushed up and down depending on the label. However, all of these down here are going to be only pushed down during the entire training. So they are going to be exceptionally low numbers. OK, now, if we then come and we look at the at the entropy of this, the the entropy, I think honestly, this is simply you could achieve the same thing by using a different temperature parameter in the softmax or in the entropy that you consider. Because why can this help? And this helps with inferring which task it's coming from. Right. So if you consider a task where you only have three outputs, so you don't have this bit down here and you look at the entropy, it's going to be you know, it's going to be something something. Sorry, I have to draw this right here. It's going to be like this. 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. However, if you have those and if it's of the correct tasks, I'm going to guess this kind of stays the same because they're really low. But if it's of the incorrect tasks, then you're not sure. And you not being sure about the output also means that you allocate a lot more to these things right here. Because you've sort of never seen this particular kind of training examples. So you're not sure. 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. OK, that's what you train them for. And now if you input a data point from a different task, they have less reason to be small because this is an outlier data point. So you have much more fluctuations. So you have more fluctuations here. And therefore, the entropy is going to be even higher. All right. This is sort of how I make sense of the fact that these additional superfluous neurons help here. They act as kind of an outlier detector for the training data set of that particular task. Now, because you have different training data for each task, they go further and they say it actually works even better. It works even better if we instead of this entropy heuristic, we consider another heuristic. Accordingly, we consider an objective G, which encourages the S neurons to have large negative values and confused as an alternative to entropy in equation four. So G, they analyze down in the appendix. And we're just quickly going to look at what G is. Sorry, this is about to load right here. And it's very interesting to see what G is. Or is it? Yes. So G is going to be this right here. So why are the logits and then G is this expression right here? 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 some X of the logits. Right. So it's this is some this is somewhat like the entropy. And what we're going to consider is the gradient of G. So what we want is the gradient of G with respect to our alphas. And the condition here with this detach operation is that. The gradient of G should be, you know, the gradient of the loss function for all V that are superfluous neurons and zero otherwise. So we're going to detach the gradient of G for all the real neurons, for all the actual logits of the output class. And we're only going to consider the gradient flowing through the superfluous neurons. So all of this here is if we take the gradient, it's only going to flow to in these in the last layer through the gradients of the superfluous neurons. OK. And that's why we don't need the entropy, because the entropy always considers 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. OK. So this log the 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 low, or 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 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 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 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 it 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 MNIST. So the necessary amount will be 10. So if we train with only 25, you can see how quickly we degrade right here. However, as we go up and train with a hundred and 200, we get better and better. In fact, if we train with this G objective, it always sort of outperforms the H objective. Interestingly, the more output neurons you have, the less this difference seems to be. But maybe the percent difference is the same. The percent error difference is the same. I don't know. I can't tell from here. Yeah. So this isn't all. There is also this Hopfield network going on where they say, OK, OK. So essentially, we're actually training different models, right? We're not really superimposing all of these models. We're training a different mask for each of the tasks and kind of remembering the masks and so on. Can we also build a model where we actually only have one model? And that's what they do right here, where they build a Hopfield network, which is basically just a big matrix. This is the Hopfield network. And then they encode the masks in this Hopfield network. So specifically, the Hopfield network is of size D squared, where it is able to encode two to the D different binary strings. And it does so in a fuzzy way. But you can prove that if you construct the Hopfield network like this, where Z is a binary string, you can recover the binary strings by gradient descent in the Hopfield network. And obviously, the more binary strings you encode, the less you get out. 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 accuracy. So remember that these here are bits while these here are floating point numbers. So the comparison that I just made isn't entirely fair. But I don't want to go into the Hopfield networks because I really feel this should be its own paper. I guess they just want to show that it's also possible to compress these masks into one thing, such that I can't make the argument anymore that, hey, all you're doing is training different models for different tasks. All right. All in all, pretty cool paper. As I said, pretty dense paper. I invite you to read it. They have a big appendix where they have more experiments and so on and explain everything in detail. All in all, from this, I don't really take the method, but the ideas are very interesting. And I am excited to see where this goes in the future. All right. I'll see you next time. Bye bye.
[ { "start": 0, "end": 7, "text": " Hi there, today we'll look at super masks in superposition by Mitchell Wirtzman, Vivek Ramanujan at AL." }, { "start": 7, "end": 15, "text": " So on a high level this paper tackles the problem of sequentially learning many many tasks without catastrophic forgetting" }, { "start": 15, "end": 24, "text": " by leveraging these things called super masks. A super mask is basically a binary mask that you unlace over a randomly initialized neural network" }, { "start": 24, "end": 29, "text": " to make the mask network perform better than a random initialization." }, { "start": 29, "end": 39, "text": " 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" }, { "start": 39, "end": 47, "text": " and therefore kind of do this lifelong multitask learning better than the baselines that they compare against." }, { "start": 47, "end": 56, "text": " In fact they can do better without knowing the task than the baselines can with knowing the task. So that's pretty pretty cool." }, { "start": 56, "end": 70, "text": " 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." }, { "start": 70, "end": 80, "text": " So 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." }, { "start": 80, "end": 93, "text": " So yeah cool. So let's dive in. We present the super masks in superposition model capable of sequentially learning thousands of tasks without catastrophic forgetting." }, { "start": 93, "end": 102, "text": " So the term catastrophic forgetting comes from the world of this kind of sequential multitask learning where you have a model." }, { "start": 102, "end": 108, "text": " Let's 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." }, { "start": 108, "end": 117, "text": " So you have a data set and you let it run on this data set. You learn the data set, maybe it's CIFAR 10, right? So this is CIFAR 10. Cool." }, { "start": 117, "end": 125, "text": " And now the model can do CIFAR 10 pretty well. Then you also want to learn a different task. You want to learn MNIST." }, { "start": 125, "end": 136, "text": " 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." }, { "start": 136, "end": 145, "text": " So you'll take this one and you simply train it on MNIST as well. And then, you know, we know there's this kind of fine tuning pre training and so on." }, { "start": 145, "end": 151, "text": " So your hope would be that at the end it can do both. But then you want another one. You want ImageNet." }, { "start": 151, "end": 157, "text": " Okay, now ImageNet is a pretty big data set. So you take your model and you also train it on ImageNet." }, { "start": 157, "end": 167, "text": " 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." }, { "start": 167, "end": 175, "text": " 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?" }, { "start": 175, "end": 184, "text": " 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," }, { "start": 184, "end": 193, "text": " 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." }, { "start": 193, "end": 200, "text": " We want to kind of continuously integrate our knowledge. This is very important in the fields of lifelong learning," }, { "start": 200, "end": 209, "text": " 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." }, { "start": 209, "end": 215, "text": " Okay, and the experience might come from new data sets and so on, but you don't want to forget the old ones." }, { "start": 215, "end": 222, "text": " So catastrophic forgetting is one of the main problems in these types of research in this field of research of lifelong learning." }, { "start": 222, "end": 231, "text": " And this paper is going to tackle this. How? It's sort of. So if you think of what could you do right here," }, { "start": 231, "end": 241, "text": " what you could do is you could simply not use the same model, right? You could simply train the different models for each task and just keep them around." }, { "start": 241, "end": 249, "text": " Right. And at, you know, test time, you need some way of deciding. So there are two different scenarios in at test time." }, { "start": 249, "end": 253, "text": " So you learn all of these models. And then at test time, there's an image." }, { "start": 253, "end": 259, "text": " And it could be that I tell you that this image, by the way, that's an MNIST image." }, { "start": 259, "end": 264, "text": " So you just grab this model and you apply it. Very cool." }, { "start": 264, "end": 269, "text": " Or it could be that I don't tell you what image it is. Like I have no clue." }, { "start": 269, "end": 276, "text": " 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." }, { "start": 276, "end": 281, "text": " Once you think, I think this is an MNIST thing, you can apply this one." }, { "start": 281, "end": 289, "text": " So you could technically do that, but it's very unhelpful because these models, they can be large. Right." }, { "start": 289, "end": 297, "text": " First of all, they can be large. So that means it costs you to store those." }, { "start": 297, "end": 302, "text": " And second of all, there might actually be some overlap, like C for 10 and ImageNet are both natural images." }, { "start": 302, "end": 307, "text": " So they might benefit from each other's feature in some way." }, { "start": 307, "end": 313, "text": " Now, what we're going to do here is we're sort of going to do this separate models approach." }, { "start": 313, "end": 318, "text": " Namely, we're going to use these. We're going to build these super masks." }, { "start": 318, "end": 322, "text": " So super masks are the second thing that we're going to combine here." }, { "start": 322, "end": 326, "text": " Our approach uses a randomly initialized fixed base network." }, { "start": 326, "end": 332, "text": " And for each task, find a sub network, a super mask that achieves good performance." }, { "start": 332, "end": 339, "text": " So what's a super mask? A super mask comes from these kind of papers about lottery ticket hypothesis." }, { "start": 339, "end": 352, "text": " And one of these papers discovered basically or conjectured and then showed in evidence that if you have a network that is randomly initialized," }, { "start": 352, "end": 359, "text": " just like this is your neural network, the gray thing, and there is a way to mask it," }, { "start": 359, "end": 365, "text": " which means masking basically means that you either activate or inactivate connections." }, { "start": 365, "end": 372, "text": " So you have your network and you simply multiply it by a binary mask that for each connection is a one or a zero." }, { "start": 372, "end": 380, "text": " So the one so here is like zero, zero, zero, zero, zero. This is a one. This is zero, zero, zero. This is a one." }, { "start": 380, "end": 384, "text": " So the network isn't going to be zeros and ones, but it's going to be multiplied." }, { "start": 384, "end": 389, "text": " Each connection is going to be multiplied by a zero or a one, which means wherever there's a one," }, { "start": 389, "end": 395, "text": " whatever weight that connection had, that will be the value of the weight of the connection." }, { "start": 395, "end": 404, "text": " If it is a zero, whatever weight that connection had, it will be it will be pinned to zero." }, { "start": 404, "end": 412, "text": " So there will be no signal flowing. So this paper established that if you take a randomly initialized neural network," }, { "start": 412, "end": 419, "text": " there is a way to mask it. And you can find those masks where if you mask in a particular way," }, { "start": 419, "end": 423, "text": " the network will already perform better than random on a given task." }, { "start": 423, "end": 429, "text": " So there is a way to solve MNIST by using a randomly initialized neural network and then simply masking it cleverly." }, { "start": 429, "end": 434, "text": " And then the mask network will have a good accuracy on MNIST." }, { "start": 434, "end": 447, "text": " OK, and they found that. And I've made a video about that. And the sort of intuition behind the super masks is this is just my intuition." }, { "start": 447, "end": 453, "text": " Is that, you know, MNIST, this is what I'm guessing. MNIST is a relatively easy task." }, { "start": 453, "end": 459, "text": " In fact, most of the tasks they're considering in these papers are relatively easy." }, { "start": 459, "end": 466, "text": " And if you have a randomly initialized neural network, basically what you have around is a bunch of weight. Right." }, { "start": 466, "end": 475, "text": " So if if I have my two layers right here and then each connection here is is a number like point two five." }, { "start": 475, "end": 479, "text": " This is, you know, seven. This is negative three and so on." }, { "start": 479, "end": 486, "text": " They're going to consider they here are going to consider weights that are initialized in a very special way." }, { "start": 486, "end": 489, "text": " But ultimately, you just have a bunch of random weights lying around." }, { "start": 489, "end": 501, "text": " And if the task is super easy, let's say, and the the neural network is sufficiently overparameterized, there might be many, many ways of achieving your goal." }, { "start": 501, "end": 510, "text": " 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." }, { "start": 510, "end": 517, "text": " You get away with simply selecting the combination of weights that will give you a good performance." }, { "start": 517, "end": 525, "text": " So in it's kind of it's sort of a mix of drop out and vector quantization." }, { "start": 525, "end": 531, "text": " So in vector quantization, you also you get away with quantizing the vectors to given precision." }, { "start": 531, "end": 542, "text": " And here the task is easy enough such that by simple overparameterization and selecting of the weights that you have around, mixing them correctly by simply." }, { "start": 542, "end": 547, "text": " So you can't mix arbitrarily, but you can mix with zero or one." }, { "start": 547, "end": 550, "text": " You get good enough. OK." }, { "start": 550, "end": 560, "text": " So this is sort of my hypothesis. My hypothesis would be that the harder the task, the the harder it gets to find super masks that perform well." }, { "start": 560, "end": 568, "text": " That's what I think. But nevertheless, to say for the tasks they're considering here, you can find these super masks." }, { "start": 568, "end": 574, "text": " And there is a way to do that by using gradient descent, even though the super masks are discrete." }, { "start": 574, "end": 582, "text": " So what we're going to do is we're going to use the same randomly initialized neural network for each of the tasks." }, { "start": 582, "end": 587, "text": " Right. So this is like C for 10. This is MNIST. This is ImageNet." }, { "start": 587, "end": 598, "text": " 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." }, { "start": 598, "end": 604, "text": " And they're all going to perform relatively well, according to the super mask conjecture." }, { "start": 604, "end": 607, "text": " Now, again, this is not surprising." }, { "start": 607, "end": 617, "text": " 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." }, { "start": 617, "end": 620, "text": " But in this case, they say, OK, we always use the same." }, { "start": 620, "end": 625, "text": " And then we only need to store the mask for each task." }, { "start": 625, "end": 634, "text": " 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." }, { "start": 634, "end": 638, "text": " So we save basically a factor of 32 in our models." }, { "start": 638, "end": 649, "text": " But essentially, essentially, right, it's not the case that we are training the same model and some continue learning." }, { "start": 649, "end": 660, "text": " It's much more akin to training a training one model per task and then inferring the task." }, { "start": 660, "end": 666, "text": " And just that we do it in a much more crude way. So it's more like learning a compressed model per task." }, { "start": 666, "end": 672, "text": " I find it's a better way to look at it than than continuous learning." }, { "start": 672, "end": 674, "text": " In any case, you learn these super masks." }, { "start": 674, "end": 678, "text": " And then here is the the the hard bit." }, { "start": 678, "end": 686, "text": " The easy bit is if I tell you which tasks the inference data point, the test data point comes from, you have a pretty easy time classifying it." }, { "start": 686, "end": 691, "text": " You simply select the mask accordingly, you run forward pass, and that's it." }, { "start": 691, "end": 696, "text": " If I don't tell you where the test data point comes from, that's the hard part." }, { "start": 696, "end": 703, "text": " Now, they need a way to decide where the data point comes from." }, { "start": 703, "end": 710, "text": " And the idea that they have right here, they have sort of multiple ideas." }, { "start": 710, "end": 727, "text": " But the main idea, the first idea is that if you have trained these individual models for the individual tasks, then OK, there is not good explanation here." }, { "start": 727, "end": 731, "text": " Then the correct model should be very confident." }, { "start": 731, "end": 733, "text": " This is an assumption that you make." }, { "start": 733, "end": 746, "text": " So I'm going to take my image of the test set and I'm going to feed it through the model one, which, you know, you have to separate this idea is separate from the masks at its core." }, { "start": 746, "end": 755, "text": " 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." }, { "start": 755, "end": 761, "text": " I can simply feed it to each one of them and I can look at the output distribution." }, { "start": 761, "end": 767, "text": " So maybe my output distribution right here, this is as you can see, three output neurons." }, { "start": 767, "end": 769, "text": " It's a three class classifier right here." }, { "start": 769, "end": 773, "text": " My output distribution is somewhat here like this." }, { "start": 773, "end": 777, "text": " And here it's like this." }, { "start": 777, "end": 782, "text": " And here it's like I shouldn't do that." }, { "start": 782, "end": 783, "text": " I got a comment." }, { "start": 783, "end": 787, "text": " You know who you are." }, { "start": 787, "end": 791, "text": " And here it's like this." }, { "start": 791, "end": 794, "text": " OK, so which one would you pick?" }, { "start": 794, "end": 803, "text": " And their answer here is we should pick this one because of it has very low entropy." }, { "start": 803, "end": 808, "text": " So this middle model here is very, very sure about this data point." }, { "start": 808, "end": 817, "text": " It's very sure about its prediction because it the distance basically of the top prediction to all the other predictions is so high." }, { "start": 817, "end": 819, "text": " It's very confident in its prediction." }, { "start": 819, "end": 824, "text": " Whereas here you can see that the distance is not too high." }, { "start": 824, "end": 828, "text": " Also here, the distance between the highest and the others is not too high." }, { "start": 828, "end": 839, "text": " So they say we are going to pick the model or the mask in this case for which the output entropy is the highest." }, { "start": 839, "end": 844, "text": " And that is a heuristic for now, but it tends to work pretty well." }, { "start": 844, "end": 849, "text": " And it has a bit to do with how relatively difficult your tasks are." }, { "start": 849, "end": 854, "text": " So your tasks need to be kind of equally difficult." }, { "start": 854, "end": 860, "text": " Otherwise, it's not otherwise this can get a little bit a little bit out of hand." }, { "start": 860, "end": 862, "text": " But there are ways to solve it." }, { "start": 862, "end": 864, "text": " And they allude to that in the kind of future work section." }, { "start": 864, "end": 875, "text": " 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." }, { "start": 875, "end": 882, "text": " And therefore we can check which task it is by using the entropy as a heuristic." }, { "start": 882, "end": 890, "text": " All right, so we're left with simply trying each of the masks and then decide taking the one that has the highest entropy." }, { "start": 890, "end": 901, "text": " Now, they say this is costly because if we've learned a thousand tasks, we need to try each of the thousand masks in order to do that." }, { "start": 901, "end": 903, "text": " So they go for something else." }, { "start": 903, "end": 908, "text": " And this is the second word in the title, this superposition word." }, { "start": 908, "end": 915, "text": " So instead of doing that, what they'll do is they'll use a superposition of masks." }, { "start": 915, "end": 921, "text": " And actually, the picture also I find more descriptive than the formula." }, { "start": 921, "end": 923, "text": " I can write down the formula down here." }, { "start": 923, "end": 929, "text": " So what they'll do is they'll say, why don't we just overlap all of the masks?" }, { "start": 929, "end": 936, "text": " So we'll have all of these masks and I for one for each tasks and we'll initialize them with coefficients." }, { "start": 936, "end": 941, "text": " Alpha I will just mix them like this and alpha here." }, { "start": 941, "end": 946, "text": " It's initialized in one over K, where K is the number of tasks." }, { "start": 946, "end": 952, "text": " OK, we'll just mix them and then we'll multiply them by the weight of the neural network." }, { "start": 952, "end": 961, "text": " And that's will that neural network is where we input our image into." }, { "start": 961, "end": 964, "text": " OK, so what does that give us?" }, { "start": 964, "end": 968, "text": " That basically gives us a mix of all the networks." }, { "start": 968, "end": 976, "text": " Like it's pretty safe to say that the entire network is going to be in there and maybe sometimes multiple times." }, { "start": 976, "end": 983, "text": " Like if multiple masks use the same weight, it's going to be in there with a higher weight and so on." }, { "start": 983, "end": 985, "text": " So that's what you see right here." }, { "start": 985, "end": 989, "text": " You can see that all the masks are overlapped in superposition with each other." }, { "start": 989, "end": 991, "text": " Now, what does the output give you?" }, { "start": 991, "end": 992, "text": " The output gives you nothing." }, { "start": 992, "end": 996, "text": " The output gives you kind of the average prediction of the network." }, { "start": 996, "end": 1003, "text": " 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." }, { "start": 1003, "end": 1010, "text": " But of course, what we can do is we can look at the gradients of this." }, { "start": 1010, "end": 1021, "text": " So if we from this calculate the entropy, which is here denoted H, and we calculate, we back propagate this." }, { "start": 1021, "end": 1032, "text": " So we back propagate this to the alphas and we calculate the gradient of the entropy with respect to each of the alphas." }, { "start": 1032, "end": 1033, "text": " What does that give us?" }, { "start": 1033, "end": 1035, "text": " So what's the intuition here?" }, { "start": 1035, "end": 1042, "text": " The intuition is if I change my alpha a bit, how does the entropy change?" }, { "start": 1042, "end": 1048, "text": " So basically, this gives you the sensitivity of the entropy to these alpha parameters." }, { "start": 1048, "end": 1052, "text": " So if this is high, what does it mean?" }, { "start": 1052, "end": 1058, "text": " It means that this mask right here has a big influence on the entropy." }, { "start": 1058, "end": 1067, "text": " Specifically, if I were to increase the alpha, then the entropy would increase." }, { "start": 1067, "end": 1072, "text": " OK. And if I were to decrease the alpha, then the entropy would decrease." }, { "start": 1072, "end": 1076, "text": " That's the kind of what the gradient gives you." }, { "start": 1076, "end": 1081, "text": " Now, did I say before we want the one with the highest entropy?" }, { "start": 1081, "end": 1086, "text": " I'm pretty sure we want the one with the lowest entropy." }, { "start": 1086, "end": 1090, "text": " We want the one where we're very, very, very sure." }, { "start": 1090, "end": 1095, "text": " Right. I might have said that absolutely wrong." }, { "start": 1095, "end": 1105, "text": " So if you see right here, this is the formalism." }, { "start": 1105, "end": 1111, "text": " First, we associate each of the k learned supermasks with a coefficient alpha initially set to 1 over k." }, { "start": 1111, "end": 1116, "text": " Each alpha can be interpreted as the belief that supermask m is the correct mask," }, { "start": 1116, "end": 1121, "text": " equivalently the belief that the current unknown task is task i." }, { "start": 1121, "end": 1128, "text": " The model output is then computed with a weighted superposition of all learned tasks, which is this thing right here." }, { "start": 1128, "end": 1133, "text": " The correct mask should produce a confidence low entropy output." }, { "start": 1133, "end": 1136, "text": " Therefore, we recover the correct mask." }, { "start": 1136, "end": 1140, "text": " We find the coefficients alpha, which minimize the output entropy h." }, { "start": 1140, "end": 1148, "text": " OK. So, yes, we want the task with the lowest entropy, of course, not with the highest entropy." }, { "start": 1148, "end": 1157, "text": " 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." }, { "start": 1157, "end": 1165, "text": " And if we simply select the alpha where the gradient here is the most negative number." }, { "start": 1165, "end": 1172, "text": " So we want this to be as low as possible, not zero, but negative as high as possible." }, { "start": 1172, "end": 1183, "text": " Then we know that if we increase this, the contribution of this mask, then the entropy will go down the most." }, { "start": 1183, "end": 1197, "text": " OK. And again, our hypothesis here is that maximum entropy, sorry, minimum entropy means most confident prediction means that the if all tasks are equally hard," }, { "start": 1197, "end": 1203, "text": " it probably means that the data point is from the task where we have the lowest entropy." }, { "start": 1203, "end": 1207, "text": " So what's the what's the deal here?" }, { "start": 1207, "end": 1211, "text": " Like they show in this graph right here, they show this is much faster." }, { "start": 1211, "end": 1222, "text": " 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," }, { "start": 1222, "end": 1225, "text": " because we need to try out each of these masks." }, { "start": 1225, "end": 1238, "text": " However, if we do what they're doing here, we simply run one, we mix these ones, we run one forward pass, we do back prop and they consider two strategies." }, { "start": 1238, "end": 1246, "text": " So what you can do is you can do gradient descent on these alphas, which takes a number of steps to converge." }, { "start": 1246, "end": 1248, "text": " Or you can actually do a single step." }, { "start": 1248, "end": 1255, "text": " So you just observe the gradient and by the gradient, you recognize which one has the lowest gradient." }, { "start": 1255, "end": 1257, "text": " And that's the one you pick." }, { "start": 1257, "end": 1258, "text": " So where's the catch here?" }, { "start": 1258, "end": 1267, "text": " The catch is that if you do something like this, if you do something like this, there are two catches, actually." }, { "start": 1267, "end": 1273, "text": " First of all, this here is a convex combination, right?" }, { "start": 1273, "end": 1275, "text": " This is convex combination." }, { "start": 1275, "end": 1278, "text": " And the problem isn't convex at all." }, { "start": 1278, "end": 1290, "text": " 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." }, { "start": 1290, "end": 1300, "text": " And if you then observe these gradients with respect to the alphas, you make assumptions about the problem that might not be true." }, { "start": 1300, "end": 1305, "text": " So you lose, you kind of heuristically approximate the importance of these masks." }, { "start": 1305, "end": 1307, "text": " That's the first thing." }, { "start": 1307, "end": 1321, "text": " The second thing, of course, is that it's you still you still are implicitly saving your still are implicitly trying all the models, but you're just not trying them explicitly." }, { "start": 1321, "end": 1335, "text": " 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." }, { "start": 1335, "end": 1337, "text": " It's just that per layer." }, { "start": 1337, "end": 1349, "text": " So, of course, this here, this W is multi layer perceptron, which means that if you have multiple layers, you know, there's W one and there's W two." }, { "start": 1349, "end": 1358, "text": " And you have your alphas and your alphas are also, you know, you can distribute them into these." }, { "start": 1358, "end": 1364, "text": " Sorry, your masks are also mask for layer one mask for layer two and so on." }, { "start": 1364, "end": 1368, "text": " So your auto differentiation package needs to keep track of." }, { "start": 1368, "end": 1375, "text": " OK, mask one goes here with this alpha mask to the layer two goes here with this alpha." }, { "start": 1375, "end": 1378, "text": " And there is there." }, { "start": 1378, "end": 1381, "text": " So it needs to keep track of this graph." }, { "start": 1381, "end": 1388, "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, "end": 1398, "text": " So the contribution of alpha of mask one, this is maybe alpha eye of mask eye one mask eye two." }, { "start": 1398, "end": 1405, "text": " The contribution of the alpha eye will not be explicit in this layer." }, { "start": 1405, "end": 1410, "text": " It will be implicit as an average across the layer." }, { "start": 1410, "end": 1417, "text": " Right. So, again, this is you assume in each layer, you assume a convex combination of all the alphas and propagate them." }, { "start": 1417, "end": 1419, "text": " And propagate that forward." }, { "start": 1419, "end": 1431, "text": " 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." }, { "start": 1431, "end": 1441, "text": " 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." }, { "start": 1441, "end": 1453, "text": " And in the case where you do it linearly, I'm going to guess you simply do it as a sequential operation, but it's going to be exact." }, { "start": 1453, "end": 1455, "text": " So that's the trade off." }, { "start": 1455, "end": 1462, "text": " All right. So we now know how we can figure out where the task is from." }, { "start": 1462, "end": 1465, "text": " And let's see how that works." }, { "start": 1465, "end": 1470, "text": " So in this first task, we are looking at split image net." }, { "start": 1470, "end": 1480, "text": " Split image net simply it takes the image net data set, which is a thousand class data set, and it distributes it into 100 different tasks." }, { "start": 1480, "end": 1483, "text": " Each is a 10 class classification task." }, { "start": 1483, "end": 1485, "text": " Now note two things." }, { "start": 1485, "end": 1488, "text": " First thing is that split image net." }, { "start": 1488, "end": 1494, "text": " Each task is approximately as hard as each other as the other tasks." }, { "start": 1494, "end": 1495, "text": " Right." }, { "start": 1495, "end": 1503, "text": " It's still image net classification and it's the same number of the of it's the same number of labels." }, { "start": 1503, "end": 1508, "text": " And each task is about the same hardness." }, { "start": 1508, "end": 1509, "text": " You can make that assumption." }, { "start": 1509, "end": 1513, "text": " And second of all, the tasks are actually pretty, pretty easy." }, { "start": 1513, "end": 1514, "text": " Right." }, { "start": 1514, "end": 1518, "text": " It's hard to distinguish image net into a thousand classes." }, { "start": 1518, "end": 1526, "text": " But if you split that task, I'm going to bet that you have these high resolution images and you have a 10 class classification." }, { "start": 1526, "end": 1529, "text": " It's going to be relatively easy." }, { "start": 1529, "end": 1533, "text": " So all our conditions are met for at least for my hypothesis to hold." }, { "start": 1533, "end": 1542, "text": " And you can see on the right side, you can see split C for 100, which does the same thing to C for 100." }, { "start": 1542, "end": 1548, "text": " It subdivides it into different, very small class classification tasks." }, { "start": 1548, "end": 1550, "text": " You can see the results." }, { "start": 1550, "end": 1554, "text": " The upper bound here is where you train a single model for each of the tasks." }, { "start": 1554, "end": 1558, "text": " That gets you to average accuracy of 92 percent." }, { "start": 1558, "end": 1562, "text": " So on image net, 92 percent." }, { "start": 1562, "end": 1564, "text": " It's pretty, it's pretty good." }, { "start": 1564, "end": 1571, "text": " Of course, this is again, this is 10 class, which makes the numbers a lot different with the subs." }, { "start": 1571, "end": 1578, "text": " So subs up, you get to this pretty good 88 percent accuracy." }, { "start": 1578, "end": 1581, "text": " This is this super masks in superposition." }, { "start": 1581, "end": 1586, "text": " This here is a baseline that also does lifelong learning." }, { "start": 1586, "end": 1591, "text": " Now, they have these annotations right here." }, { "start": 1591, "end": 1594, "text": " Gigi, which yes, Gigi, haha." }, { "start": 1594, "end": 1602, "text": " But so the first letter will always tell you whether the task ID is given during training." }, { "start": 1602, "end": 1607, "text": " And the second letter will tell you whether the task ID is given during testing." }, { "start": 1607, "end": 1614, "text": " So this here simply evaluates whether or not this masking is feasible, which you can see here it is." }, { "start": 1614, "end": 1622, "text": " So this will we know which mask to train during training and we know which mask to retrieve during testing." }, { "start": 1622, "end": 1626, "text": " So there is nothing of this entropy gradients here." }, { "start": 1626, "end": 1627, "text": " None of it." }, { "start": 1627, "end": 1638, "text": " This simply evaluates the viability of the masking approach, which as you can see, it's pretty viable and it's more viable than these baselines." }, { "start": 1638, "end": 1643, "text": " This same thing on the CIFAR 100 right here." }, { "start": 1643, "end": 1650, "text": " 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." }, { "start": 1650, "end": 1658, "text": " So they can control the number of bytes in their model by simply increasing or decreasing the required sparsity of their mask." }, { "start": 1658, "end": 1664, "text": " So you can change your mask by saying how sparse you want it." }, { "start": 1664, "end": 1676, "text": " 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." }, { "start": 1676, "end": 1688, "text": " 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." }, { "start": 1688, "end": 1701, "text": " The upper bound again is where you train a model per task and separate heads here is another kind of dummy baseline where you train a different head for each of the tasks with a common trunk." }, { "start": 1701, "end": 1704, "text": " That gets you pretty much nowhere." }, { "start": 1704, "end": 1710, "text": " With the sub sub algorithm, you do get almost to the performance of the upper bound." }, { "start": 1710, "end": 1715, "text": " And in fact, if you do this transfer approach right here, you do get there." }, { "start": 1715, "end": 1720, "text": " The transfer approach simply means that so you do these tasks in succession, right?" }, { "start": 1720, "end": 1724, "text": " You do task one. Okay, done. You do task two. Okay, done." }, { "start": 1724, "end": 1730, "text": " And for each one, you train a mask. Okay, for each one you train this is mask one, mask two." }, { "start": 1730, "end": 1745, "text": " 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." }, { "start": 1745, "end": 1752, "text": " There is some amount of transfer going on simply to initialize the weights." }, { "start": 1752, "end": 1755, "text": " It's actually astounding that this helps you so much." }, { "start": 1755, "end": 1766, "text": " But with this, if you look at the actual numbers, I believe you can get like a tiny bit higher than the training a single model for each of the tasks." }, { "start": 1766, "end": 1782, "text": " 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." }, { "start": 1782, "end": 1791, "text": " And it's just the fact that you do a very crude model and that you can store very efficiently." }, { "start": 1791, "end": 1796, "text": " Now you might object and say, hey, don't I need to store the underlying randomly initialized network?" }, { "start": 1796, "end": 1801, "text": " And the answer is yes and no. Actually, you only need to store the random seed to produce it." }, { "start": 1801, "end": 1806, "text": " So checkmate. Yeah, they do." }, { "start": 1806, "end": 1812, "text": " So here they explain this one shot algorithm where they simply look at the gradient of the entropy." }, { "start": 1812, "end": 1821, "text": " You can see with the maximum negative gradient of the entropy, they also have this binary algorithm." }, { "start": 1821, "end": 1831, "text": " If the task where they say with the task is harder to differentiate this kind of assumption of the convex combination thing does might not hold." }, { "start": 1831, "end": 1848, "text": " So what they do is they have this binary algorithm where they do a binary search where they simply want to circumvent the necessity to evaluate each of the masks by itself because that takes long." }, { "start": 1848, "end": 1853, "text": " So they do something in between where they do this binary algorithm." }, { "start": 1853, "end": 1866, "text": " This is right here where they do this convex combination, they evaluate the gradient, but then they don't just take the highest of the negative gradients." }, { "start": 1866, "end": 1869, "text": " They eliminate half of them." }, { "start": 1869, "end": 1878, "text": " 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." }, { "start": 1878, "end": 1892, "text": " 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 order might actually be different in the second and third and fourth step." }, { "start": 1892, "end": 1901, "text": " Of course, this is simply this is like halfway towards between this one shot algorithm and trying each mask by itself." }, { "start": 1901, "end": 1904, "text": " It's kind of a compromise." }, { "start": 1904, "end": 1912, "text": " I mean, they make it they really try to not not try each mask once because it's one of their contributions." }, { "start": 1912, "end": 1917, "text": " Right. But then they probably realized if we just do it one shot, sometimes it doesn't work." }, { "start": 1917, "end": 1921, "text": " So they're going between, which is, you know, it's a pretty cool idea." }, { "start": 1921, "end": 1924, "text": " All right. Next experiments." }, { "start": 1924, "end": 1928, "text": " We're now in this situation and you see you see a number of things." }, { "start": 1928, "end": 1936, "text": " So first of all, we have a new added a new baseline, this PSP, and you can see that the baselines operating this G.G. regime." }, { "start": 1936, "end": 1943, "text": " So the baselines are given the task during training and given the task during evaluation." }, { "start": 1943, "end": 1948, "text": " You see the upper bound here in gray is where you train a model for each task." }, { "start": 1948, "end": 1956, "text": " And you assume that's an upper bound because you assume the tasks are kind of unrelated to each other, which is not the case." }, { "start": 1956, "end": 1962, "text": " So there is actually potential to beat the to beat the upper bound baseline." }, { "start": 1962, "end": 1966, "text": " And subs up here you see operates in a different regime." }, { "start": 1966, "end": 1974, "text": " Namely, there's this regime of you're given the task during training, but then during testing, you're not given the task." }, { "start": 1974, "end": 1981, "text": " OK. And this you here, it basically means that the labels you assume that the labels of the tasks are not shared." }, { "start": 1981, "end": 2000, "text": " So in in this case, if you predict, if you predict like if you split MNIST into always two class, if you split MNIST into two tasks, you predict the first task is zero, one, two, three, four." }, { "start": 2000, "end": 2003, "text": " The second task is five, six, seven, eight, nine." }, { "start": 2003, "end": 2008, "text": " OK. And you have the same amount of labels. So you always have five output neurons. Right." }, { "start": 2008, "end": 2011, "text": " So you have one, two, three, four, five output neurons." }, { "start": 2011, "end": 2021, "text": " If you if the image here is like a five, that would be task task one label zero." }, { "start": 2021, "end": 2032, "text": " Right. If your network now predicts label zero correctly, but predicts the the image to come from task one, you count it as a mistake." }, { "start": 2032, "end": 2040, "text": " 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." }, { "start": 2040, "end": 2042, "text": " So I'm going to count that as a mistake." }, { "start": 2042, "end": 2052, "text": " So it's really there isn't there isn't a way for the network to kind of get around predicting the wrong tasks or kind of share information." }, { "start": 2052, "end": 2058, "text": " So you assume that the labels are not shared or unshared." }, { "start": 2058, "end": 2065, "text": " Yeah. So it's the subs up here has a significantly harder task than the baselines." }, { "start": 2065, "end": 2067, "text": " Keep keep that in mind." }, { "start": 2067, "end": 2073, "text": " And now we are applying our because we we are not given the task at inference time." }, { "start": 2073, "end": 2081, "text": " Now we're applying our heuristic where we go and look at which of the mask entropies is the lowest." }, { "start": 2081, "end": 2086, "text": " Respectively, we use this actually this one shot algorithm where we look at the gradients." }, { "start": 2086, "end": 2091, "text": " And you can see this is on permuted MNIST in permuted MNIST." }, { "start": 2091, "end": 2097, "text": " What you do is you take MNIST and you simply permute the pixels." }, { "start": 2097, "end": 2103, "text": " And this it sounds crazy, but you simply permute the pixels and that gives you a new task." }, { "start": 2103, "end": 2108, "text": " So you can come up with like almost an infinite number of tasks because there are what?" }, { "start": 2108, "end": 2117, "text": " Twenty eight times, twenty eight pixels. So you can commute them seven hundred and eighty four factorial times," }, { "start": 2117, "end": 2122, "text": " which gives you like infinitely many tasks. And so you can modulate." }, { "start": 2122, "end": 2125, "text": " So here you can see the number of tasks learned increases." }, { "start": 2125, "end": 2136, "text": " And at the beginning, this baselines, especially this baseline, is doing fairly well, actually, on par with the upper bound when you only have ten different tasks." }, { "start": 2136, "end": 2153, "text": " However, after that quickly degrades, however, this subs up here, it keeps it keeps its performance, which it so this doesn't only mean that it correctly predicts the output neuron." }, { "start": 2153, "end": 2163, "text": " It also correctly predicts which task, which permutation was applied to the digit simply by looking where the entropy is high." }, { "start": 2163, "end": 2166, "text": " Right. So that's pretty cool." }, { "start": 2166, "end": 2172, "text": " And, you know, it's it's actually kind of surprising to be to be honest." }, { "start": 2172, "end": 2176, "text": " So on the left, this is a L'Onet architecture on the right." }, { "start": 2176, "end": 2183, "text": " It's a fully connected network. Now, the fully connected network here performing better is sort of expected." }, { "start": 2183, "end": 2187, "text": " First of all, MNIST is really easy and can actually be solved with a fully connected network." }, { "start": 2187, "end": 2199, "text": " And second of all, especially permuted MNIST, I guess, doesn't really conform to the to the assumptions of convolutional neural networks anymore." }, { "start": 2199, "end": 2202, "text": " Again, keep in mind, these tasks are very easy." }, { "start": 2202, "end": 2216, "text": " 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" }, { "start": 2216, "end": 2221, "text": " that each pixels are next to each other. Simply each pixel is a different thing." }, { "start": 2221, "end": 2228, "text": " It's just the fact that it cannot it cannot learn from one tasks much about the other tasks." }, { "start": 2228, "end": 2233, "text": " That's why you that's the nature of permuted MNIST." }, { "start": 2233, "end": 2243, "text": " All right. And then in this experiment right here, and this is the sort of crown experiment, they learn they do this permuted MNIST," }, { "start": 2243, "end": 2250, "text": " but they go up to 2500 tasks, 2500 different permutations." }, { "start": 2250, "end": 2255, "text": " But so but now they have an additional thing right here." }, { "start": 2255, "end": 2261, "text": " So again, they have this sub sub where it needs to predict the correct permutation," }, { "start": 2261, "end": 2268, "text": " but also they compare it with a an algorithm that needs that is this NN right here." }, { "start": 2268, "end": 2275, "text": " So in this NN, not not only are you not given the task label at testing time," }, { "start": 2275, "end": 2279, "text": " you are actually not even given the task label at training time." }, { "start": 2279, "end": 2282, "text": " But here the outputs are shared." }, { "start": 2282, "end": 2292, "text": " 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." }, { "start": 2292, "end": 2295, "text": " You good. So it's always it's always a 10 class classification problem." }, { "start": 2295, "end": 2298, "text": " It's just not permuted." }, { "start": 2298, "end": 2302, "text": " You're not given the task label here." }, { "start": 2302, "end": 2307, "text": " So first of all, I want to say that this here, the shared labels," }, { "start": 2307, "end": 2310, "text": " it could actually contribute to the success of this algorithm right here," }, { "start": 2310, "end": 2315, "text": " because even though you permute the pixels," }, { "start": 2315, "end": 2322, "text": " you can still sort of do things like count the frequency of light pixels versus dark pixels in MNIST." }, { "start": 2322, "end": 2326, "text": " And that might already give you a very, very big hint." }, { "start": 2326, "end": 2333, "text": " Right. Or, you know, simple correlation of of two pixels, though that's that's a task specific thing." }, { "start": 2333, "end": 2341, "text": " But the the frequency of light pixels versus dark pixels will already give you a big boost in accuracy." }, { "start": 2341, "end": 2344, "text": " And now you can actually share that feature." }, { "start": 2344, "end": 2346, "text": " That feature will always be the same for every permutation." }, { "start": 2346, "end": 2353, "text": " So this is something you can share between tasks. And I would like." }, { "start": 2353, "end": 2356, "text": " So one way I guess you could eliminate that." }, { "start": 2356, "end": 2359, "text": " Well, I don't know. I'm not sure." }, { "start": 2359, "end": 2364, "text": " You kind of have to randomize the number of light pixels, but keep the classes the same." }, { "start": 2364, "end": 2367, "text": " It's going to be complicated. Right." }, { "start": 2367, "end": 2373, "text": " But just keep that in mind. However, how how does the algorithm even decide?" }, { "start": 2373, "end": 2379, "text": " So they have a heuristic right here as well, namely." }, { "start": 2379, "end": 2390, "text": " They say, OK, if we don't have no task identity during training or inference." }, { "start": 2390, "end": 2393, "text": " Where task identity is entirely unknown, even during training," }, { "start": 2393, "end": 2396, "text": " if subs of is uncertain about the current task identity," }, { "start": 2396, "end": 2401, "text": " it is likely that the data does not do not belong to any tasks seen so far." }, { "start": 2401, "end": 2407, "text": " When this occurs, a new super mask is allocated and the number of tasks learned so far is incremented." }, { "start": 2407, "end": 2410, "text": " OK, so they go with the same principle right here." }, { "start": 2410, "end": 2417, "text": " They say if we get a new training sample, we just evaluate it against all the masks that we had so far." }, { "start": 2417, "end": 2425, "text": " Or we do our one shot algorithm to approximate which masks gets us a low entropy." }, { "start": 2425, "end": 2432, "text": " If none of the mask gets us a low entropy, then we decide this must be some kind of unseen task." }, { "start": 2432, "end": 2437, "text": " So we're going to allocate a new mask for this unseen tasks." }, { "start": 2437, "end": 2443, "text": " And that heuristic, as you can see, it performs fairly, fairly well." }, { "start": 2443, "end": 2447, "text": " Where was our graph? Our graph was down here." }, { "start": 2447, "end": 2453, "text": " In fact, it performs pretty much on par with where you know the task during training." }, { "start": 2453, "end": 2461, "text": " And just not during during inference up until like here, the very last bit." }, { "start": 2461, "end": 2465, "text": " If you really get into the high task regime." }, { "start": 2465, "end": 2469, "text": " Where I guess it starts getting it starts getting confusing." }, { "start": 2469, "end": 2475, "text": " So this this heuristic might start to break down, but it might just be a fact how they tune their constants." }, { "start": 2475, "end": 2481, "text": " Like they have to define a threshold where they say, OK, if the entropy is somehow higher than this threshold," }, { "start": 2481, "end": 2483, "text": " then we allocate a new a new task." }, { "start": 2483, "end": 2487, "text": " And this might be optimized in order to solve this." }, { "start": 2487, "end": 2491, "text": " Again, these tasks are very, very, very, very easy." }, { "start": 2491, "end": 2495, "text": " So keep keep that in mind." }, { "start": 2495, "end": 2503, "text": " Yeah. OK. So this basically was the experimental part of that paper." }, { "start": 2503, "end": 2507, "text": " Now they consider different extensions to that." }, { "start": 2507, "end": 2513, "text": " I'm not sure how they also consider some ablations, which are pretty interesting." }, { "start": 2513, "end": 2521, "text": " So here they say we are going to up the kind of the hardness of the task with with rotated MNIST" }, { "start": 2521, "end": 2525, "text": " and also their model does pretty well on the rotated MNIST task," }, { "start": 2525, "end": 2535, "text": " where the differences of between the differences between the tasks are simply some of them are rotated by 10 degrees." }, { "start": 2535, "end": 2539, "text": " So that's a tiny rotation in the right." }, { "start": 2539, "end": 2543, "text": " If you have a number three, you kind of rotated by 10." }, { "start": 2543, "end": 2547, "text": " I can't even draw that subtle of a rotation by 10 degrees." }, { "start": 2547, "end": 2556, "text": " And, you know, the subs up must correctly predict which task the images from," }, { "start": 2556, "end": 2562, "text": " or it will not get the it will not get a correct reward." }, { "start": 2562, "end": 2568, "text": " The fact that it performs pretty well and the fact that it has, you know, rotation degrees," }, { "start": 2568, "end": 2573, "text": " where it outperforms the baseline that is actually given the rotation." }, { "start": 2573, "end": 2578, "text": " So it's given the task at inference time is pretty, pretty remarkable." }, { "start": 2578, "end": 2582, "text": " Again, I believe this is due to the fact that these tasks are so easy." }, { "start": 2582, "end": 2588, "text": " And therefore, this entropy, it just spikes when you get the correct thing," }, { "start": 2588, "end": 2594, "text": " because it sort of it sort of latches onto very easy features for each task." }, { "start": 2594, "end": 2601, "text": " So I'm going to guess that the tasks are generally solvable by maybe correlating two pixels." }, { "start": 2601, "end": 2606, "text": " Right. If like this pixel correlated with this pixel, if the correlation is high, it's a three." }, { "start": 2606, "end": 2609, "text": " The correlation is low. It's something else. OK." }, { "start": 2609, "end": 2617, "text": " And then if you rotate it, it's just not the case anymore that this pixel and this pixel, the correlation is very high." }, { "start": 2617, "end": 2624, "text": " So if you predict using this correlation, you'll get a pretty low confidence." }, { "start": 2624, "end": 2629, "text": " And I'm going to guess that, yeah, if you have discrete tasks and it's in this task," }, { "start": 2629, "end": 2635, "text": " then your confidence will just spike because the task is so easy and because all the tasks are about equally hard." }, { "start": 2635, "end": 2639, "text": " Because if you can find this correlation here, you can find it over here." }, { "start": 2639, "end": 2644, "text": " It's simply going to be two different two different pixels in this task." }, { "start": 2644, "end": 2654, "text": " And then as you try the masks, whenever you hit the one where you can predict pretty confidently with those two pixels," }, { "start": 2654, "end": 2658, "text": " then your confidence is going to spike, your entropy is going to get down." }, { "start": 2658, "end": 2666, "text": " And, you know, it's that task. They also here they compare." }, { "start": 2666, "end": 2676, "text": " The one shot algorithm. So they they they use their one shot algorithm to and they put it on a baseline." }, { "start": 2676, "end": 2682, "text": " So this baseline where they always actually have to give it the task," }, { "start": 2682, "end": 2689, "text": " they augmented by by their their one shot algorithm to select the task." }, { "start": 2689, "end": 2695, "text": " And it turns out they can make it perform fairly well, not on par with them." }, { "start": 2695, "end": 2703, "text": " Interestingly, but they can make it perform also fairly well, actually better than it was performing before." }, { "start": 2703, "end": 2710, "text": " So they have different extensions right here. And that's some of them are pretty important." }, { "start": 2710, "end": 2717, "text": " The one important thing they do is they have these superfluous neurons and that's sort of hidden." }, { "start": 2717, "end": 2723, "text": " And it's always a bit. So here, for example, you see in the output," }, { "start": 2723, "end": 2728, "text": " they say we have a lunette model using output size 500." }, { "start": 2728, "end": 2732, "text": " Now there are only 10 different labels in the MNIST task, right?" }, { "start": 2732, "end": 2736, "text": " Also in the permuted MNIST task, there are 10 different labels." }, { "start": 2736, "end": 2742, "text": " I mean, there are a total of 25,000 labels if you have 2500 tasks." }, { "start": 2742, "end": 2751, "text": " But the neural network has output size 10. However, their neural network here has output size 500," }, { "start": 2751, "end": 2761, "text": " which is surprising. So they say right here and we're going to get to the Hopfield network at the very end" }, { "start": 2761, "end": 2766, "text": " for those who are still around, because that's I think that should be its own paper." }, { "start": 2766, "end": 2775, "text": " But, you know, they say it could use an output of size L where L is the actual number of labels per task," }, { "start": 2775, "end": 2782, "text": " though we find in practice that it helps significantly to add extra neurons to the final layer." }, { "start": 2782, "end": 2795, "text": " Specifically, we consider outputs P in our S. So S is higher than L and refer to the neurons that are past L as superfluous neurons." }, { "start": 2795, "end": 2802, "text": " So let's try to make sense of this. So they have a neural network." }, { "start": 2802, "end": 2810, "text": " And let's say it's a three class classification task, right? So you have three classes and that's what you would do." }, { "start": 2810, "end": 2815, "text": " They simply add a bunch of neurons right here. That means they also they, you know," }, { "start": 2815, "end": 2818, "text": " they add all of the connections from the previous layer to those neurons." }, { "start": 2818, "end": 2826, "text": " But still, the classes can only be either 0, 1 or 2. These classes never appear during training." }, { "start": 2826, "end": 2832, "text": " So they claim this helps during during their procedure." }, { "start": 2832, "end": 2842, "text": " And I I thought about it a bit and we might be able to try to guess why it makes sense." }, { "start": 2842, "end": 2850, "text": " They say they simply say we observe that helps. And I mean, you know, let's let's try to make sense of it." }, { "start": 2850, "end": 2856, "text": " OK, so if we train, if we train our model using these too many neurons, what happens?" }, { "start": 2856, "end": 2861, "text": " Well, our label is always going to be of the top three neurons. So let's say our label is one." }, { "start": 2861, "end": 2867, "text": " This is going to result in a one hot vector like this. Now, what are we training in this layer here?" }, { "start": 2867, "end": 2875, "text": " In this layer here, we're training logits. OK, so pre pre softmax outputs." }, { "start": 2875, "end": 2888, "text": " So our our algorithm, our cross entropy loss is going to push all of these here down during every single training point." }, { "start": 2888, "end": 2895, "text": " It's going to push this one up and all of these down. Now, these three here are going to be pushed up and down depending on the label." }, { "start": 2895, "end": 2902, "text": " However, all of these down here are going to be only pushed down during the entire training." }, { "start": 2902, "end": 2915, "text": " So they are going to be exceptionally low numbers. OK, now, if we then come and we look at the at the entropy of this," }, { "start": 2915, "end": 2929, "text": " the the entropy, I think honestly, this is simply you could achieve the same thing by using a different temperature parameter in the softmax or in the entropy that you consider." }, { "start": 2929, "end": 2936, "text": " Because why can this help? And this helps with inferring which task it's coming from. Right." }, { "start": 2936, "end": 2945, "text": " 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," }, { "start": 2945, "end": 2953, "text": " it's going to be you know, it's going to be something something. Sorry, I have to draw this right here." }, { "start": 2953, "end": 2963, "text": " It's going to be like this. It's fairly confident. But if and maybe for the other tasks, it's not going to be as confident." }, { "start": 2963, "end": 2975, "text": " You know, it's maybe going to be like this. 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." }, { "start": 2975, "end": 2987, "text": " But if it's of the incorrect tasks, then you're not sure. And you not being sure about the output also means that you allocate a lot more to these things right here." }, { "start": 2987, "end": 2993, "text": " Because you've sort of never seen this particular kind of training examples. So you're not sure." }, { "start": 2993, "end": 3004, "text": " 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." }, { "start": 3004, "end": 3010, "text": " Right. It's very important to see that this is task. This is the correct task, which they always label J." }, { "start": 3010, "end": 3023, "text": " 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." }, { "start": 3023, "end": 3032, "text": " You simply train these things during training. You make them small. But you it's important to notice you always make them small." }, { "start": 3032, "end": 3040, "text": " From a data point that comes from their particular task. OK, that's what you train them for." }, { "start": 3040, "end": 3050, "text": " 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." }, { "start": 3050, "end": 3057, "text": " So you have much more fluctuations. So you have more fluctuations here. And therefore, the entropy is going to be even higher." }, { "start": 3057, "end": 3064, "text": " All right. This is sort of how I make sense of the fact that these additional superfluous neurons help here." }, { "start": 3064, "end": 3072, "text": " They act as kind of an outlier detector for the training data set of that particular task." }, { "start": 3072, "end": 3081, "text": " Now, because you have different training data for each task, they go further and they say it actually works even better." }, { "start": 3081, "end": 3089, "text": " It works even better if we instead of this entropy heuristic, we consider another heuristic." }, { "start": 3089, "end": 3100, "text": " Accordingly, we consider an objective G, which encourages the S neurons to have large negative values and confused as an alternative to entropy in equation four." }, { "start": 3100, "end": 3108, "text": " So G, they analyze down in the appendix. And we're just quickly going to look at what G is." }, { "start": 3108, "end": 3116, "text": " Sorry, this is about to load right here. And it's very interesting to see what G is." }, { "start": 3116, "end": 3125, "text": " Or is it? Yes. So G is going to be this right here." }, { "start": 3125, "end": 3131, "text": " So why are the logits and then G is this expression right here?" }, { "start": 3131, "end": 3143, "text": " 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 some X of the logits." }, { "start": 3143, "end": 3150, "text": " Right. So it's this is some this is somewhat like the entropy." }, { "start": 3150, "end": 3158, "text": " 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." }, { "start": 3158, "end": 3169, "text": " And the condition here with this detach operation is that." }, { "start": 3169, "end": 3182, "text": " The gradient of G should be, you know, the gradient of the loss function for all V that are superfluous neurons and zero otherwise." }, { "start": 3182, "end": 3191, "text": " So we're going to detach the gradient of G for all the real neurons, for all the actual logits of the output class." }, { "start": 3191, "end": 3196, "text": " And we're only going to consider the gradient flowing through the superfluous neurons." }, { "start": 3196, "end": 3211, "text": " So all of this here is if we take the gradient, it's only going to flow to in these in the last layer through the gradients of the superfluous neurons." }, { "start": 3211, "end": 3221, "text": " OK. And that's why we don't need the entropy, because the entropy always considers the difference, sort of the difference between the correct label and the other labels." }, { "start": 3221, "end": 3226, "text": " We are pretty sure that in our superfluous neurons, we don't have the correct label." }, { "start": 3226, "end": 3235, "text": " OK. So this log the log some X of our of these outputs here, what will they represent?" }, { "start": 3235, "end": 3246, "text": " 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." }, { "start": 3246, "end": 3257, "text": " If one of them is very high and the other ones are very low, or if they're generally very high up, then this will be high." }, { "start": 3257, "end": 3267, "text": " However, consider the difference between this and this, where they're all super small and also they're all pretty equal." }, { "start": 3267, "end": 3270, "text": " The log some X will be very small." }, { "start": 3270, "end": 3281, "text": " 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?" }, { "start": 3281, "end": 3287, "text": " And, you know, none of them basically says I'm the correct label." }, { "start": 3287, "end": 3292, "text": " Then we can be pretty sure that over here there is some confidence." }, { "start": 3292, "end": 3306, "text": " However, if they are sort of kind of larger and generally kind of generally large, maybe unequal, that means we're not very confident because these are our outlier classes." }, { "start": 3306, "end": 3309, "text": " They shouldn't be. They shouldn't be large at all." }, { "start": 3309, "end": 3320, "text": " 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." }, { "start": 3320, "end": 3325, "text": " And so the gradient of only those in order to decide which task it's from." }, { "start": 3325, "end": 3328, "text": " It's an interesting idea, I have to say." }, { "start": 3328, "end": 3340, "text": " But maybe one could achieve sort of the same thing with a with a temperature parameter here or by building an explicit outlier detection." }, { "start": 3340, "end": 3344, "text": " But it's generally an interesting idea for outlier detection, I have to say." }, { "start": 3344, "end": 3350, "text": " I've never really seen anything like this, though I also haven't really considered it." }, { "start": 3350, "end": 3352, "text": " So here they show the importance." }, { "start": 3352, "end": 3358, "text": " And you've seen in the experiments before that there sometimes was this H objective and also this G objective." }, { "start": 3358, "end": 3362, "text": " So you can look at the entropy, but also you can look at the G." }, { "start": 3362, "end": 3365, "text": " In both cases, you have superfluous neurons." }, { "start": 3365, "end": 3374, "text": " So before you actually saw you have 500 neurons for a task of for a task of 10 that needed 10 output classes." }, { "start": 3374, "end": 3380, "text": " Right. So this tells me that these superfluous neurons are pretty important for them." }, { "start": 3380, "end": 3387, "text": " And it this is probably one of the things that makes this work." }, { "start": 3387, "end": 3389, "text": " Right. These superfluous neurons." }, { "start": 3389, "end": 3401, "text": " 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." }, { "start": 3401, "end": 3407, "text": " And only if the correct model is trained to not do that on the particular data that you're considering." }, { "start": 3407, "end": 3414, "text": " 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." }, { "start": 3414, "end": 3417, "text": " And you can see right here they actually do an experiment." }, { "start": 3417, "end": 3425, "text": " So I don't want to be too mean where they say, look, if we train with just 25 classes and this is permuted MNIST." }, { "start": 3425, "end": 3428, "text": " So the necessary amount will be 10." }, { "start": 3428, "end": 3433, "text": " So if we train with only 25, you can see how quickly we degrade right here." }, { "start": 3433, "end": 3439, "text": " However, as we go up and train with a hundred and 200, we get better and better." }, { "start": 3439, "end": 3448, "text": " In fact, if we train with this G objective, it always sort of outperforms the H objective." }, { "start": 3448, "end": 3453, "text": " Interestingly, the more output neurons you have, the less this difference seems to be." }, { "start": 3453, "end": 3457, "text": " But maybe the percent difference is the same." }, { "start": 3457, "end": 3460, "text": " The percent error difference is the same." }, { "start": 3460, "end": 3462, "text": " I don't know. I can't tell from here." }, { "start": 3462, "end": 3466, "text": " Yeah. So this isn't all." }, { "start": 3466, "end": 3472, "text": " There is also this Hopfield network going on where they say, OK, OK." }, { "start": 3472, "end": 3476, "text": " So essentially, we're actually training different models, right?" }, { "start": 3476, "end": 3478, "text": " We're not really superimposing all of these models." }, { "start": 3478, "end": 3484, "text": " We're training a different mask for each of the tasks and kind of remembering the masks and so on." }, { "start": 3484, "end": 3490, "text": " Can we also build a model where we actually only have one model?" }, { "start": 3490, "end": 3496, "text": " And that's what they do right here, where they build a Hopfield network, which is basically just a big matrix." }, { "start": 3496, "end": 3498, "text": " This is the Hopfield network." }, { "start": 3498, "end": 3502, "text": " And then they encode the masks in this Hopfield network." }, { "start": 3502, "end": 3513, "text": " So specifically, the Hopfield network is of size D squared, where it is able to encode two to the D different binary strings." }, { "start": 3513, "end": 3515, "text": " And it does so in a fuzzy way." }, { "start": 3515, "end": 3522, "text": " But you can prove that if you construct the Hopfield network like this, where Z is a binary string," }, { "start": 3522, "end": 3528, "text": " you can recover the binary strings by gradient descent in the Hopfield network." }, { "start": 3528, "end": 3534, "text": " And obviously, the more binary strings you encode, the less you get out." }, { "start": 3534, "end": 3540, "text": " It's not magic. You can't store that many bits into a thing that doesn't have that many bits." }, { "start": 3540, "end": 3550, "text": " But I believe, you know, again, this is using gradient descent, and it can do so with surprising accuracy." }, { "start": 3550, "end": 3555, "text": " So remember that these here are bits while these here are floating point numbers." }, { "start": 3555, "end": 3560, "text": " So the comparison that I just made isn't entirely fair." }, { "start": 3560, "end": 3565, "text": " But I don't want to go into the Hopfield networks because I really feel this should be its own paper." }, { "start": 3565, "end": 3575, "text": " I guess they just want to show that it's also possible to compress these masks into one thing," }, { "start": 3575, "end": 3581, "text": " such that I can't make the argument anymore that, hey, all you're doing is training different models for different tasks." }, { "start": 3581, "end": 3585, "text": " All right. All in all, pretty cool paper. As I said, pretty dense paper." }, { "start": 3585, "end": 3593, "text": " I invite you to read it. They have a big appendix where they have more experiments and so on and explain everything in detail." }, { "start": 3593, "end": 3600, "text": " All in all, from this, I don't really take the method, but the ideas are very interesting." }, { "start": 3600, "end": 3627, "text": " And I am excited to see where this goes in the future. All right. I'll see you next time. Bye bye." } ]
z_3Qv4In2ac
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Live Machine Learning Research] Plain Self-Ensembles (I actually DISCOVER SOMETHING) - Part 1
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ensemble", "pytorch", "lightning", "cifar10", "github", "vim", "code", "cuda", "gpu", "research", "ml", "ml research", "how to", "implement", "live coding", "python", "self", "distillation", "born again", "deep ensembles", "cnn", "resnet", "vgg", "torchvision", "imagenet" ]
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 have no idea whether it's going to work out or not and that's it and I think we can do open source software development you know completely in the open whereas with research we're all like super scared that people are gonna scoop us and we people just keep it keep their work hidden until they're done and then boom they put it in an archive and all I want to go to a world where we collaborate much more in research and it's much more like open source software development so here is my way here's 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 time stamps in there's this new YouTube chapter video so that will be very helpful I guess yeah and with that being said I hope you enjoy this let me know what you think of videos like this and I'll see you next time hey what's going on today we're going to take a research idea and implement it as fast as we can so this is not really to show you the best research idea because it's not and it's probably been done before so I have no high hopes here but this is just to show that if you had like some research idea and you've actually done the literature research and figured no one has done that yet which I haven't because probably someone has done that how you could take this and like get started up initially pretty quickly and this is just the process that I would go through and I'm going to go through with you today and we're going to try to get this up and running as quickly as possible so I had this idea that looking at SimClear v2 there's a lot of things to be done still in the space of let's say self teaching self distillation and so on you know there's mean teacher and then there's whatnot and this is all usually done in the semi supervised very few label regime and so on but we know that these self supervised techniques can help you and supervised learning and then in SimClear v2 you do semi supervised in that you do self supervised and then fully supervised and then distillation like self distillation there's there's all these kinds of interleaving stuff and I thought okay what if I just take a pre-trained network that performs really well on something and I self distill it into a bunch of student models like a number like 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% chance it's not going to work but let's try to test this today so I got my drink I got my carbs since it's weekend and we're going to give this a shot all right so first thing we need some sort of base to go from in research it's good to build your own stuff but a lot of times if you want to be as fast as possible you want to go as quickly as you can so here I found this repo thankfully with an MIT license so shout out to who even fun I guess for training for putting up a repo training these C for 10 models or training these PI torch vision models on C for 10 C for 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 report says it downloads these I've not done this before I have no clue how this is gonna work out in this download script here downloads the weights from box and I hope you can see this and then I guess you can load the the pre-trained weights with pre-trained equals true and yeah we'll get into all that later so the first thing we got to do is get this to run let's say so let's look at this downloads thing first so the download thing is going to have a URL it's going to use requests to get that URL and then save this into this state dicts thing now what I usually want to do is I don't I want my folder of code to only have code and not to be intermixed with data and code because this is the thing that I'm gonna ship around to various servers and so on so I'd rather have the code in one folder and then the data and like a central folder so I'm not really fine with this sort of downloading the this right here into into the folder that we have so what I'm going to do is I'm going to change that such that it downloads it into a central folder so first we already have OS so what we're going to do is we're going to get some like data path going which is going to be our home folder OS path and I guess I also I already have a C for 10 folder right here so we'll use this and then so path dot join will join that and that's going to download it's not really data is it it's more like models okay let's do this cool so data path is this is the models that is going to download all right and then it unzips the file again so here it unzips the file to the current working directory I don't want this so I'm going to change that again to the models path all right 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 C for 10 what was it called C 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 that's if OS path exists zip path then return okay so we're good in the download script what else do we need the data set I probably already have the data set from torch vision so that's not going to be an issue okay so here we're gonna call C 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 file or directory probably need to make that probably need to make that directory right okay if OS make theirs 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 C for 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 C for 10 module is a lightning module as you can see right here it is we know how tensor sorry pytorch lightning works if you don't know how pytorch 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 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 CUDA and put that to true and then we'll say da da da da oh come on there is like a lot of stuff going on here let's so and then torch is called torch I'd hate that can I do this can I import it like twice with different names probably it's probably not very good but I'll do it okay so if CUDA is not available we'll just set the CUDA to false if th.cuda.is available okay not if it's not available then hparams.cuda equals false and then we'll set the GPUs to zero comma I guess that's what it expects if else none and that should do it for the GPUs okay so second thing that we need we're going to need we're calling fit here and there is this logs directory where the checkpoints are going to be saved I'm fine with that I just want to kind of remove the logs directory at the beginning so I'll do that and whenever we start this I'm going to remove the logs directory this is a controversial move but you know on remove tree recursively delete the 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 nope nope okay it doesn't find the it doesn't find the the state dicts and so on now we're going to have to fix this we're going to have to fix the fact that it doesn't load okay okay and that's probably going to be here in these models so if I look in the dense net for example which we can learn and there's this pre-trained argument and what's that going to be it's oh that's bad okay it like has a hard code at the fact as hard code at the fact that there are there is this state dicts directory okay um yeah that's terrible terrible terrible terrible so I guess this is going to be in every single one of these models and that's not good so what we're going to do is probably always late loaded without the pre-trained and then kind of loaded ourselves from the from the correct directory so what's the correct directory again we're going to set the model 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 dates directory I'm gonna guess you can models see for ten state dicts we haven't unpacked it where have we not where have we unpacked it to help help oh no have we unpacked it to here we have not we have not so what is in here ah it's the C for ten models sub thing 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 C for ten models state dicts that's fine and then it's always going to be the architecture plus a PT so let's look at one of these models to see how this is loaded we've saw we've seen this here so we simply want to load this state dict in and here it constructs the thing this is let's do proper string interpolation shall we oh device where this device come from we should check that out device is given device device device CPU where is device given okay dense net device CPU oh I guess device is always CPU and then then we map it to wherever I'm not entirely sure so here we say set device I guess we can just get the device from somewhere let's try it out okay so we're going to need this right here so we're going to OS path join models path and something that's dot PT so and here we're going to get the architecture which is the classifier cool so that's how we load something and then the device maybe we can just go torch kuda dot get device is that possible let's try nope ah okay nope no get device device maybe nope map location was given okay so we have to figure out where this device comes from honestly here no module there's this get classifier right here but just just says pre trained this 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 tried to do this by myself and now the problems start missing keys in state dick a lot of missing stuff we can't we can't possibly load that yeah no not going to you 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 now 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 resin at 18 and we got this thing that we might want to load so why doesn't it work torch load load file name see that works so that's the state dict is that let's look at its keys we got a you know a bunch of stuff okay so why can't we load that well load state dict state dict and now unexpected keys in state dick missing keys so this is always prepended with model dot and here it's not okay what do we do about that I guess this is because we loaded ourselves okay cool so our model is not yes so our model has the sub path model so we need model dot model dot load state dict right look at us we made it so this is testing I guess this is this resin at 18 or whatnot so we can leave that to run for itself so we figured out how to load this stuff took us a while now let's go ahead and we know how to load the models we know how to load the weights so this is our teacher model right our teacher model is supposed to load up the weights and then and then teach the student models so here what does this training thing do we download the thing we make our GPUs to be really good okay and then we instantiate this module right here as you can see so now we're going to check out this module by the way the testing is done and as you can see there's an accuracy of 93.33 which I'm pretty happy with this is congruent with what we saw right here the resin at 18 do okay and we can I guess we can take a resin at 18 or a resin at 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 pretend 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 n and 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 bar in range in range and here we probably need a flag so h params dot num students okay so these are going to be our student 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 because this module list what can we do with it does anyone know I don't know by the way I'm sorry for the switching between the dark and the bright background I don't know how to fix that so pytorch and an module list it would be nice if we could give them some names right so I guess that's just an iterable right here so probably there's nothing that we can do to give them proper names or we'd have to hack around and I don't want to do that so I guess we can just check if that actually computes until here so let's check it out let's try the ensemble it doesn't data set not found or corrupted okay so what we'll have to do is we'll have to implement have to change this data directory right here so the data deer is going to be OS this whatever my C for 10 directory is no such file directory logs okay so logs doesn't exist so let's actually make it still no such file a directory logs why why doesn't it make it no such file a directory logs ah okay we need to ignore errors here and we're good okay so it computes until the point you probably you probably can't see that right I guess now you can see it let's check yeah now you can see it all right so where are we we are at the point right here in our module after we've created the teacher and the students so if we look at self technically we should be able to see right here a whole bunch of resin at 18s whole bunch so here you can see the teacher model right and I'm going to guess you can see layer 4 and here you can see the student models so the student models are going to be in a whole list of models and now we're going to train them so since they're initialized differently our hope is going to be that they're sort of going to end up at different places we're going to train them with the same like we're going to be really really stupid about this okay all right so let's be really stupid about it so what what are we gonna have to change here is our training step and our training step is actually fine we'll simply forward we'll get a loss from that and then we are going to return that and that's going to be back propped so in our optimizer wherever we initialize our optimizer we should probably give it the parameters that are not only the student model parameters right not the teacher model parameters so it should only train the student models okay and even even like that we should probably always set the teacher model in eval mode but we'll do that in the forward step right here so in the forward step we get images and labels and here it runs it just forward through the model we want to change that we actually want to have teacher predictions which we're going to have the teacher model we're going to forward this through the teacher models now the criterion I'm going to guess is a cross entropy so the predictions here are actually going to be logits right and this is this is good except that what we want to do is have a distribution of over labels so after the teacher here runs through and let's put a break point right here and actually look at it I find it's always easy if you go and just run until the point where you 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 logits now we want them that to be a soft max over the last dimension and that's going to be of the same shape but of course now we're going to have a proper distribution so if we sum over the last dimension you should see a bunch of ones all right so the teacher predictions are going to be soft max over the last dimension and since we since we don't want to back prop through the teacher we can do this in an environment of no grad right here so we have that with not being stupid and we also set the teacher model into eval mode so I guess that does it set train no that should do it I have no idea yeah let's let's run it again we could have done that there okay so so far so good so we have the teacher predictions now what we need to do is run them through the student and use them as labels so we'll go for student in student models we'll go student forward or we simply run the images through that and that give us the logits and then we use our loss function on the logits and that not the labels but the teacher predictions right so we never actually use the labels here as you can see and that's going to be the student loss and now we have a bunch of losses and we're going to append that ah 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 losses I guess we could make it the average just so if we change the number of students we'll get some kind of some sort of a better sense of the actual numbers what what what okay I think over here we're good yeah so our teacher model is not in training mode but our student models hopefully are in training mode no is this the eval pass I guess this is the eval pass this is the validation sanity check pass okay so this is going to be our loss and our accuracy now right so okay what's going to be our accuracy our accuracy is going to be we have these student losses all of them and what we are going to do is we're simply going to take the maximum prediction across the students pretty easy pretty easy but we need to collect the 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 a softmax over each and then take the average prediction I'm not duper 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 gonna 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 and we need to somehow concatenate those or stack them so how are we gonna stack them so they're 256 their batch size by number of classes so we'll just stack them at dimension zero I guess that's fine and then we are going to mean also across dimension zero so those are going to be our 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 yes the rest here should just do by itself and I'm going to go ahead and run give this another run and see where we run into problems can't really see how this could ever go wrong we'll just take everything over okay we actually got a problem 1d target tensor expected multi-target not supported so the cross entropy loss in pytorch does not support that let's let's give it a shot make this a little bigger for you and let's go for the cross P loss I can't type today so here we have the cross entropy loss and the cross entropy loss is useful when training cross because problem with the classes yada yada yada wait should be one that okay criterion expects a class index as the target okay so what we need is like a soft loss right we don't need this cross entropy loss we actually want we want to have soft targets so what do we do we want to do I think the cross entropy loss is a combination of the here of the log softmax and the NLL loss can we take the NLL loss maybe so the NLL loss right here is going to be the target that this loss expect should be a class index no okay that's not good so next let's go do we have we somehow need a soft cross entropy loss let's search for that pytorch soft cross entropy soft classes I guess people do that kind of stuff so the problem with these kind of losses is that what you do what you have to do is kind of protect yourself against against numerical instabilities right so what we want to do is find a function that does this for us I guess if we do the loft the the log softmax that should take care of it for us okay this is tensor flow okay following thread cross entropy loss I guess people just do really the log softmax and then do that and we should be fine with this okay thanks okay 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 hmm multi label we don't really want multi label right we want this but not with the targets okay I guess we're just gonna have to write this ourselves so ultimately what is the cross entropy that cross entropy is simply the probability of the true label times the log probability of the wrong or of the predicted label yeah as you see right here so we are going to simply multiply target times the log probability of the predicted label and then some some 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 so we're going to take student logits and we're going to take teacher probabilities okay so how's that gonna work out we're going to do the log soft max from the student logits so and then dot does that exist log soft max functional okay 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 probes and then what we want to do is simply multiply the teacher probes times the student log probes and the negative of that is going to be our loss the question is do we want to sum that I guess across this dimension or mean it I guess the sum sum should do all right this is it easy as that why have we searched for so long so the criterion we can simply replace that now by our loss function cool so let's run it again yada yada yada okay so I need to check maybe we should have taken like a smaller model it sometimes pays off to you know start with a really small model small model just so you can you can do these kind of things fast so here we have dimension out of range to do okay which is where is that in forward in line 78 let's go there line 78 okay here the max is not going to be as much fun let's go there I think this is some of these things change over time in pytorch so this code might be written when you know so what we have is we have a max over the predictions and predictions oh it's already an arg max so I guess we can remove this all whether or not that agrees with labels dot data we don't need any of that dot float and we also don't need that we so the accuracy is simply going to be the mean of this no I guess so we're here can't we just do predictions equals labels yes and we want the sum of that actually we want the float first and then we want the mean yeah that seems reasonable so let's do it like this yeah float mean perfect how could this be any more easy but this right here is all of it so validation step accuracy corrects we'll just look at it once we've done it and what I do is usually just run it until it doesn't give me any mistakes anymore and then I know I sort of have succeeded okay we're pretty close I feel so it says grad can implicitly 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 data point so what we need to do I guess is call mean on this or some when they created the criterion in the original one now we've thrown it away look at the git diff right here so I guess this reduces how does this reduce the cross entropy loss when we don't do anything cross entropy loss reduces reduction mean okay so let's reduce with the mean so if we call loss then after that we should call mean and then here I'm not so sure anymore we should divide here because the learning rate is kind of tuned to the original loss size so I guess we'll be content for now with summing up these things and over here I guess we've we've solved that right no losses yeah see our losses is going to be an entire tensor and now we just fixed that right now okay so let's try it again in the meantime what can we do we can so we already take care of our GPU we take care of the logs one thing to do when with respect to this download stuff right here is you know if you have a server or something and you let a lot of things run in parallel what you want to do is make sure they don't all download the same stuff at the same time that's pretty bad so what you want to do is ideally have some sort of lock such that they coordinate and I usually use a file lock for this so I'm gonna create that right here from import the file lock and then I simply create the lock let's go file lock and here you have to input a file so sometimes like yeah data lock I don't know you just pick some file and that's the file that these these processes are going to sync on and then once you do this you simply wrap all of it in a with lock so only one at a time can go in in this function all right so that's that that should make us safe and right here we're now training this is excellent we are training the students now we need to do that on an actual GPU so I have multiple tools to ship this to a GPU so first of all I can try to ship this to and try to ship this to a let's say to to one GPU so the way you do that is first of all I want some sort of unbuffered version of Python and then I have this do I even have this tool I do have the tool okay so I'm gonna call one of our servers and we don't know what's going on okay so cannot import name seed everything from pytorch lightning seed everything is that some kind of new thing in pytorch lightning I guess I have it apparently so here seed everything with zero why I don't need that we are running without any seed here we are being really cool okay next mistake cannot okay still same mistake of course since we don't yep next mistake we'll just go through the mistake learning rate late learning rate loggers so I guess we need to update pytorch lightning on the servers and I'll do that quickly okay I've updated pytorch lightning let's check out whether or not we can actually run something yeah we can run something so this again is now downloading this on the server while this is happening there's another thing we can do namely I have sort of sort of made a system to run stuff on servers which I like a lot honestly so I guess we can try this out how do I hidden oh with I okay so I want to first of all delete this delete this yes I guess delete this cool and this git folder is a bit annoying let's restructure because otherwise it will always ship the git folder with everything up here does it do that yeah I don't like to have the code in a top level so quickly make a sources directory move everything in there so move the c410 models into the source directory move all the Python files into the source directory no clear the logs and we're much better much better okay much better so what we what what we will do is my system requires like a file and I'm just gonna copy one from another project quickly okay so we're back and I copied that over as you can see you basically give hyper parameters and it blasts ever 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 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 bang cool so what do we want we want basically we just want to try it like a bunch of times and then see like average across it right that's all maybe we want the the architecture to change so let's say the classifier is a resnet 18 or a resnet 34 or a resnet 50 just so we have a bunch of stuff to 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 that this has this has no effect except for randomizing it a bit I guess we can try to seed stuff so whenever it says seed everything we'll just seed it with this we'll call it seed no is it here this seed everything yeah so h params dot rep sorry seed cool 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 again we can try a bunch of them we can try all of them but why don't we try all of them like this then let's go into this rat file I don't know why I called it rat I just want it like some three-letter thing so yep like this and then we can just take all of that crap and delete it and delete this and those are going to be all our models so our classifier is going to consist of all of this stuff let's I know I know I know I suck at them don't tell me actually tell me I want them tips trying to learn something new like each week in them but it is hard and tend to make myself actually do it so let's go let's go with just one repetition so far if we if we are not sure we can still up the number of repetitions we don't even have the rep right now this is called seed all right so we have different classifiers and what we're going to need we also have this num students right let's go with one with five and with 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 we'll cancel this right now and we'll go ahead and just blast this onto our servers and hopefully that that's gonna work I have no idea is everything fine everything's fine go no what what cool and let me get back to you once this is finished all right we're back so I've just written some code here to extract the results of that run and something you know it's pretty interesting what came out so in these plots you'll see on the x-axis of 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 the single teacher for reference you can see that if you have one student model it sometimes under performs or sometimes out performs the single teacher model but then if you have more student models you can see that there is a pretty monotonic relationship so here it's the reason this fit doesn't finish here is because there'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 kink so the first idea like this this is really astounding because these students have all been trained from that single teacher and they have been trained for as long as the teacher has been trained so they don't have more compute than 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 like this this is this seems like to like come on there's no new information here so I thought hey I the teacher the teacher model I've just grabbed them from this from this repo from this pre-trained checkpoints and these pre-trained checkpoints they are you know the checkpoints that have performed best on the validation set so this is sort of a sneaky way of how we could train on the validation set right because we annotate each data point in the training data set with this checkpoint and the checkpoint has been selected for performing especially well on the validation data set it could explain why we get a gain on the validation data set so what I did is I retrained all of the teacher models such that I just retrained them for these 100 epochs and I just took the last checkpoint the all everything's the same the hyper parameters learning rate schedule and so on this is not tuned for any particular model and it's pretty like it's pretty standard it's like it's not like 0.12589 it's like 0.01 and 100 epochs or so fairly standard parameters and I just took the last checkpoint to make it didn't even look at its performance to make sure that I didn't you know select something that was especially good on the validation data set and the results here you'll see are actually already the results of that run which the previous run it was almost the same like I was astounded how well it works and then I thought hey maybe I'm kind of you know cheating here so I redid it with the teachers that are not specifically selected and this is already the results so that's pretty cool right so then I wondered what happens if I now if I increase my training amount so I just let this run for more like what if I let the students run for more than the teacher has run again there's no new information here so you can see that the now the okay the green is now the teacher the blue is a hundred epochs and the orange is 250 epochs and you can see with that even one student will outperform the teacher but many students will outperform even more so if you give more compute there's lots of lots of headroom here to improve you'll see this here I think this last one with the blue line is just a bit of a weird a weird configuration I guess if you were to rerun that that would you know fall in line so this is pretty pretty weird right so I have a bunch of questions so first of all I've searched the literature a bit more and I came up with a number of papers that do things like this now usually when you do distillation you people stress the importance of like how to introduce noise like in the noisy student paper or that you really need these data augmentations or you know same clear V2 uses the self distillation in order to do in in order to label more data so they say it's important that we bring more unlabeled data into the process and so on so all of this it really doesn't match right here and especially this focus on we need noise during the distillation process to build these ensembles this is also you know if you know mean teacher things like this I also found a paper called born again neural networks that does something quite similar but not very simple not like the same where they distill a teacher to the student with the same architecture and then they distill the student again into another student and then that into another student and so on and then at the end they say oh we can also build an ensemble but sometimes their ensembles outperform their you know chain of distillation sometimes they don't they don't really focus on that part a lot and it's way more complicated like you distill one student after another and I also think they they have some introduction of variability in the students like like noise or different augmentations and so on so this here seems you know really really really simple now I want to know this ensemble effect it seems pretty pretty weird right so what gives so the first thing we could do is we could say what what does how does this compare to an ensemble of teacher models like if 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 student with these self ensembles there's not really a way where we can learn more from data because we can only learn from the teacher and the teacher is fixed and has seen that much data right so how does this compare so wrote some rewrote some code is it's just plumbing and I release the code it's linked but it's just plumbing don't worry don't worry there is no great thoughts in there it's just plumbing such that my students don't are not all in parallel so the ensembles are not trained in parallel anymore I train each model individually which means that at maximum I have to have two models on the same GPU one teacher and one student so I make sure that the teachers they are trained from scratch and the students they're always trained from the same teacher right so the student ensembles will be exactly the same as we have them here that means one teacher is responsible for all the students but yeah so okay I'll just show you the results right here so if we look at those results you can see that and I've done it for a bunch of models right here the blue line is the ensemble of teachers and here on the x-axis you see the number of models and now since I'm not training everything on the same GPU but I recombine later that that basically means that I have doubt the ability to train up to 10 models are actually however many I want and the only real trick in the code is that when I evaluate one of these ensembles what I do is I load a mini batch and then I basically load the first checkpoint run the forward pass load the second checkpoint run 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 the there is a significant like this is almost overlapping right here for most models there sometimes the student wins sometimes the teacher wins so the teacher ensemble wins now remember the teachers are trained on you know ten times as much data right here but it's always the same data but still they have the opportunity to learn ten times as much information from the data whereas the students they're all distilled from that same teacher without any noise any augmentate any augmentations except for the augmentations that you use during training anyway and I've done this for a hundred epochs and I've done this for 250 is this already 250 I think that was a hundred I just put that there nope okay yeah that was a hundred epochs but you'll see the 250 epoch plots they look very much the same okay they are just a bit better if you train for 250 epochs now interestingly okay here's the interesting part about the 250 epochs the student is still distilled from a teacher model that has been trained for a hundred epochs so all of this all of this makes no sense to me right the student is still distilled from the hundred epoch teacher model yet if you train the student for 250 epochs in self distillation and then build an ensemble of these students from that same teacher model and you compare that to an ensemble of teachers that have all been trained for longer for 250 epochs which you know should out it the 250 epochs generally outperforms the hundred epochs models still they are the same this is this is pretty crazy results I I think and sort of my conclusion from this is that the ensemble effect right here is not a function of learning of extracting more information from the data the ensemble effect might actually be have something to do with the function landscape itself and kind of exploring different minima of the of the same function not of the same function but exploring different functions to describe the same phenomena and I've also found a paper that explains the lost landscape of deep ensembles and I will make a video on that maybe it's out already maybe it will be out after you see this one I I haven't decided yet which which order I'm going to release things but this here I it's it's pretty interesting and we need like a name so self self ensembles are already a thing but they are always with noise and stuff like this so let's call them something like plain self ensembles but that that that sounds like a good name plain self ensembles the act of self distillation a single model into multiple models without any noise any augmentations anything just you run as if you were to train the model itself and then you build an ensemble of these models by simply averaging the log it's plain self ensembles alright so the plan from here is to check on like at least one other data set you know these these models I appreciate that I could get them pre trained but they're just the image net models and then kind of let run on C for 10 so there's no kind of guarantee that these have been you know tuned or anything that the learning rates or whatnot so I want to take like an image net model you 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 five minute video of like whoo I discovered something because then you know there's no clue of what's what's happening but maybe like an hour or so is also too long I'm not sure yeah let me know what you think and I'll see you next time bye
[ { "start": 0, "end": 5.84, "text": " Hey what's up! So I've had this relatively dumb research idea and people" }, { "start": 5.84, "end": 10.64, "text": " have been asking me for more coding videos and so on so I thought why not do" }, { "start": 10.64, "end": 15.56, "text": " a video where I take a research idea and implement it from scratch just to show" }, { "start": 15.56, "end": 21.6, "text": " how one would go or how I would go about implementing something like this. Now" }, { "start": 21.6, "end": 26.12, "text": " this was simply meant as sort of a demonstration but then at the end it" }, { "start": 26.12, "end": 33.120000000000005, "text": " actually worked and so yeah that was unexpected and my initial reaction was" }, { "start": 33.120000000000005, "end": 38.36, "text": " just to be like oh crap just hold everything you know stop video making" }, { "start": 38.36, "end": 44.8, "text": " you develop the idea write a paper about it okay and I was about doing that when" }, { "start": 44.8, "end": 49.480000000000004, "text": " I realized that you know I'm always the one complaining that research is not" }, { "start": 49.480000000000004, "end": 54.92, "text": " transparent enough and people aren't open enough and so on so I sort of" }, { "start": 54.92, "end": 60.04, "text": " thought I might do a different thing right here in that I will actually share" }, { "start": 60.04, "end": 65.24000000000001, "text": " the process of this non-finished research project so currently I am in" }, { "start": 65.24000000000001, "end": 68.68, "text": " the middle of this I have no idea whether it's going to work out or not" }, { "start": 68.68, "end": 75.2, "text": " and that's it and I think we can do open source software development you know" }, { "start": 75.2, "end": 80.28, "text": " completely in the open whereas with research we're all like super scared" }, { "start": 80.28, "end": 85.16, "text": " that people are gonna scoop us and we people just keep it keep their work" }, { "start": 85.16, "end": 90.8, "text": " hidden until they're done and then boom they put it in an archive and all I" }, { "start": 90.8, "end": 96.28, "text": " want to go to a world where we collaborate much more in research and" }, { "start": 96.28, "end": 104.64, "text": " it's much more like open source software development so here is my way here's" }, { "start": 104.64, "end": 110.04, "text": " here's my process of implementing this idea and it's fairly long so if you just" }, { "start": 110.04, "end": 114.2, "text": " want to get to the results you can just skip at the end I'll put time stamps in" }, { "start": 114.2, "end": 120.48, "text": " there's this new YouTube chapter video so that will be very helpful I guess yeah" }, { "start": 120.48, "end": 124.48, "text": " and with that being said I hope you enjoy this let me know what you think of" }, { "start": 124.48, "end": 131.20000000000002, "text": " videos like this and I'll see you next time hey what's going on today we're" }, { "start": 131.20000000000002, "end": 136.84, "text": " going to take a research idea and implement it as fast as we can so this" }, { "start": 136.84, "end": 141.84, "text": " is not really to show you the best research idea because it's not and it's" }, { "start": 141.84, "end": 147, "text": " probably been done before so I have no high hopes here but this is just to show" }, { "start": 147, "end": 150.52, "text": " that if you had like some research idea and you've actually done the literature" }, { "start": 150.52, "end": 154.76, "text": " research and figured no one has done that yet which I haven't because probably" }, { "start": 154.76, "end": 161.44, "text": " someone has done that how you could take this and like get started up initially" }, { "start": 161.44, "end": 166.48000000000002, "text": " pretty quickly and this is just the process that I would go through and I'm" }, { "start": 166.48, "end": 171.23999999999998, "text": " going to go through with you today and we're going to try to get this up and" }, { "start": 171.23999999999998, "end": 179.07999999999998, "text": " running as quickly as possible so I had this idea that looking at SimClear v2" }, { "start": 179.07999999999998, "end": 186.2, "text": " there's a lot of things to be done still in the space of let's say self teaching" }, { "start": 186.2, "end": 190.6, "text": " self distillation and so on you know there's mean teacher and then there's" }, { "start": 190.6, "end": 195.83999999999997, "text": " whatnot and this is all usually done in the semi supervised very few label" }, { "start": 195.84, "end": 200.68, "text": " regime and so on but we know that these self supervised techniques can help you" }, { "start": 200.68, "end": 205.6, "text": " and supervised learning and then in SimClear v2 you do semi supervised in" }, { "start": 205.6, "end": 210.8, "text": " that you do self supervised and then fully supervised and then distillation" }, { "start": 210.8, "end": 215, "text": " like self distillation there's there's all these kinds of interleaving stuff" }, { "start": 215, "end": 220.6, "text": " and I thought okay what if I just take a pre-trained network that performs really" }, { "start": 220.6, "end": 227.12, "text": " well on something and I self distill it into a bunch of student models like a" }, { "start": 227.12, "end": 233.44, "text": " number like 10 or so and then I like that's my ensemble model will that" }, { "start": 233.44, "end": 239.16, "text": " perform better than the original model like this is a terrible idea and it's" }, { "start": 239.16, "end": 243.44, "text": " probably not going to work like there's 99% chance it's not going to work but" }, { "start": 243.44, "end": 250.29999999999998, "text": " let's try to test this today so I got my drink I got my carbs since it's" }, { "start": 250.3, "end": 256.04, "text": " weekend and we're going to give this a shot all right so first thing we need" }, { "start": 256.04, "end": 261.6, "text": " some sort of base to go from in research it's good to build your own stuff but a" }, { "start": 261.6, "end": 266.28000000000003, "text": " lot of times if you want to be as fast as possible you want to go as quickly as" }, { "start": 266.28000000000003, "end": 272.88, "text": " you can so here I found this repo thankfully with an MIT license so shout" }, { "start": 272.88, "end": 282.06, "text": " out to who even fun I guess for training for putting up a repo training" }, { "start": 282.06, "end": 289.12, "text": " these C for 10 models or training these PI torch vision models on C for 10 C for" }, { "start": 289.12, "end": 293.08, "text": " 10 is a small enough data set so that we can kind of work with it and these" }, { "start": 293.08, "end": 298.64, "text": " models are already pre-trained so I've cloned this repo and we're going to" }, { "start": 298.64, "end": 304.64, "text": " adjust that so there is a first of all there is a download as you can see here" }, { "start": 304.64, "end": 309.32, "text": " which in this report says it downloads these I've not done this before I have no" }, { "start": 309.32, "end": 314.91999999999996, "text": " clue how this is gonna work out in this download script here downloads the" }, { "start": 314.91999999999996, "end": 322.15999999999997, "text": " weights from box and I hope you can see this and then I guess you can load the" }, { "start": 322.15999999999997, "end": 327.8, "text": " the pre-trained weights with pre-trained equals true and yeah we'll get into all" }, { "start": 327.8, "end": 332.8, "text": " that later so the first thing we got to do is get this to run let's say so let's" }, { "start": 332.8, "end": 339.12, "text": " look at this downloads thing first so the download thing is going to have a" }, { "start": 339.12, "end": 343.68, "text": " URL it's going to use requests to get that URL and then save this into this" }, { "start": 343.68, "end": 349.44, "text": " state dicts thing now what I usually want to do is I don't I want my folder" }, { "start": 349.44, "end": 354.08000000000004, "text": " of code to only have code and not to be intermixed with data and code because" }, { "start": 354.08000000000004, "end": 357.74, "text": " this is the thing that I'm gonna ship around to various servers and so on so" }, { "start": 357.74, "end": 361.88, "text": " I'd rather have the code in one folder and then the data and like a central" }, { "start": 361.88, "end": 369.24, "text": " folder so I'm not really fine with this sort of downloading the this right here" }, { "start": 369.24, "end": 375.2, "text": " into into the folder that we have so what I'm going to do is I'm going to" }, { "start": 375.2, "end": 378.92, "text": " change that such that it downloads it into a central folder so first we" }, { "start": 378.92, "end": 384.84000000000003, "text": " already have OS so what we're going to do is we're going to get some like data" }, { "start": 384.84, "end": 397.84, "text": " path going which is going to be our home folder OS path and I guess I also I" }, { "start": 397.84, "end": 408.64, "text": " already have a C for 10 folder right here so we'll use this and then so path" }, { "start": 408.64, "end": 417.8, "text": " dot join will join that and that's going to download it's not really data is it" }, { "start": 417.8, "end": 427.59999999999997, "text": " it's more like models okay let's do this cool so data path is this is the models" }, { "start": 427.59999999999997, "end": 433.4, "text": " that is going to download all right and then it unzips the file again so here it" }, { "start": 433.4, "end": 437.68, "text": " unzips the file to the current working directory I don't want this so I'm going" }, { "start": 437.68, "end": 446.32, "text": " to change that again to the models path all right no directory to path to zip" }, { "start": 446.32, "end": 451.36, "text": " file directory to extract to I think we're fine right now so this download" }, { "start": 451.36, "end": 457.8, "text": " script is going to download the path the all the weights there now I want this to" }, { "start": 457.8, "end": 463.64, "text": " happen sort of automatically while this is in a server or while this is on a" }, { "start": 463.64, "end": 468.64, "text": " server so what I'm going to do is probably just to so if this script runs" }, { "start": 468.64, "end": 473.28, "text": " you can see it runs the main but in the other script I might just want to do" }, { "start": 473.28, "end": 479.44, "text": " this automatically so let's go to the test script right here or let's say we" }, { "start": 479.44, "end": 484.56, "text": " go to the train script this is probably the main script right here the train" }, { "start": 484.56, "end": 496.48, "text": " script so we have to somehow call this other script here probably in the main" }, { "start": 496.48, "end": 502.76, "text": " function all right so let's import this other so import C for 10 what was it" }, { "start": 502.76, "end": 515.84, "text": " called C for 10 download okay and here we're going to call that and does this" }, { "start": 515.84, "end": 520.64, "text": " does this not download it if it already exists we have to check that so a lot of" }, { "start": 520.64, "end": 525.64, "text": " this is just going to be you know beating the stuff into beating stuff into" }, { "start": 525.64, "end": 532.04, "text": " into existence so if this zip file already exists we're not going to we're" }, { "start": 532.04, "end": 541.0799999999999, "text": " not going to do anything right which leaves us open if like if the unzipping" }, { "start": 541.0799999999999, "end": 548.04, "text": " fails then we're going to be in a kind of dumb path but you know we'll risk it" }, { "start": 548.04, "end": 562, "text": " zip path would be that so that's if OS path exists zip path then return" }, { "start": 562, "end": 571.48, "text": " okay so we're good in the download script what else do we need the data set" }, { "start": 571.48, "end": 575.4, "text": " I probably already have the data set from torch vision so that's not going to" }, { "start": 575.4, "end": 586.08, "text": " be an issue okay so here we're gonna call C for 10 download dot main all" }, { "start": 586.08, "end": 593.08, "text": " right and that should do we can't really call that yet let's actually just run" }, { "start": 593.08, "end": 605.76, "text": " this download script no no such file or directory probably need to make that" }, { "start": 605.76, "end": 620.16, "text": " probably need to make that directory right okay if OS make theirs models path" }, { "start": 622.96, "end": 632.16, "text": " exist okay true yeah that should be something all right and we're" }, { "start": 632.16, "end": 638.0799999999999, "text": " downloading so this is 2.4 gigabytes which can you know be put by itself" }, { "start": 638.0799999999999, "end": 644.48, "text": " let's put that over there and while that's downloading let's check out the" }, { "start": 644.48, "end": 652.36, "text": " test script actually let's check out the test script so this simply takes in this" }, { "start": 652.36, "end": 660.68, "text": " C for 10 module and instantiates a trainer and as you can see it calls" }, { "start": 660.68, "end": 664.9599999999999, "text": " test on it so this should not be too hard I'm going to guess this C for 10" }, { "start": 664.9599999999999, "end": 671.9599999999999, "text": " module is a lightning module as you can see right here it is we know how tensor" }, { "start": 671.9599999999999, "end": 675.8399999999999, "text": " sorry pytorch lightning works if you don't know how pytorch lightning works" }, { "start": 675.8399999999999, "end": 679.4799999999999, "text": " pretty easy you configure this module right here you configure a bunch of" }, { "start": 679.4799999999999, "end": 685.04, "text": " stuff like the data sets the training step and so on and you're good to go so" }, { "start": 685.04, "end": 692.52, "text": " I guess what we're going to do is we're going to change this train script and" }, { "start": 692.52, "end": 701.88, "text": " change it to our needs okay so let's copy that let's go with train ensemble" }, { "start": 701.88, "end": 709.92, "text": " bang so this is what we're going to change all right so first if the GPUs" }, { "start": 709.92, "end": 718.0799999999999, "text": " is a string then the other yada yada if it's two then wow that's that's that's" }, { "start": 718.0799999999999, "end": 725.8, "text": " kind of a weird engineering quirk right here okay what I want to do is make the" }, { "start": 725.8, "end": 736.48, "text": " GPU use transparent so we'll only ever use one GPU so let's call that CUDA and" }, { "start": 736.48, "end": 750.24, "text": " put that to true and then we'll say da da da da oh come on there is like a lot" }, { "start": 750.24, "end": 762.44, "text": " of stuff going on here let's so and then torch is called torch I'd hate that can" }, { "start": 762.44, "end": 767.1600000000001, "text": " I do this can I import it like twice with different names probably it's" }, { "start": 767.1600000000001, "end": 775.6400000000001, "text": " probably not very good but I'll do it okay so if CUDA is not available we'll" }, { "start": 775.6400000000001, "end": 784.8000000000001, "text": " just set the CUDA to false if th.cuda.is available okay not if it's not" }, { "start": 784.8, "end": 798.52, "text": " available then hparams.cuda equals false and then we'll set the GPUs to zero" }, { "start": 798.52, "end": 809, "text": " comma I guess that's what it expects if else none and that should do it for the" }, { "start": 809, "end": 819.04, "text": " GPUs okay so second thing that we need we're going to need we're calling fit" }, { "start": 819.04, "end": 824.44, "text": " here and there is this logs directory where the checkpoints are going to be" }, { "start": 824.44, "end": 831.12, "text": " saved I'm fine with that I just want to kind of remove the logs directory at the" }, { "start": 831.12, "end": 838.68, "text": " beginning so I'll do that and whenever we start this I'm going to remove the" }, { "start": 838.68, "end": 848.5999999999999, "text": " logs directory this is a controversial move but you know on remove tree" }, { "start": 848.5999999999999, "end": 859.16, "text": " recursively delete the directory tree yes logs good okay our download is done" }, { "start": 859.16, "end": 867.92, "text": " so what do we do next we might want to do just try to test test something and" }, { "start": 867.92, "end": 874.64, "text": " here in the test thing we might want to set the GPUs I don't have a GPU right" }, { "start": 874.64, "end": 899.24, "text": " here so none and the data directory is going to be yeah I'll put it so nope nope nope" }, { "start": 899.24, "end": 906, "text": " okay it doesn't find the it doesn't find the the state dicts and so on now we're" }, { "start": 906, "end": 909.6, "text": " going to have to fix this we're going to have to fix the fact that it doesn't" }, { "start": 909.6, "end": 920.84, "text": " load okay okay and that's probably going to be here in these models so if I look" }, { "start": 920.84, "end": 926.08, "text": " in the dense net for example which we can learn and there's this pre-trained" }, { "start": 926.08, "end": 933.5600000000001, "text": " argument and what's that going to be it's oh that's bad okay it like has a" }, { "start": 933.5600000000001, "end": 940.12, "text": " hard code at the fact as hard code at the fact that there are there is this" }, { "start": 940.12, "end": 953.08, "text": " state dicts directory okay um yeah that's terrible terrible terrible terrible so I" }, { "start": 953.08, "end": 958.4000000000001, "text": " guess this is going to be in every single one of these models and that's not" }, { "start": 958.4000000000001, "end": 962.76, "text": " good so what we're going to do is probably always late loaded without the" }, { "start": 962.76, "end": 969.1600000000001, "text": " pre-trained and then kind of loaded ourselves from the from the correct" }, { "start": 969.1600000000001, "end": 974.9200000000001, "text": " directory so what's the correct directory again we're going to set the" }, { "start": 974.92, "end": 985.9599999999999, "text": " model dear we probably can just take that from the download script like that" }, { "start": 987.12, "end": 998.0799999999999, "text": " state dicts okay and then we want the architecture I guess that's a thing we" }, { "start": 998.08, "end": 1005.1, "text": " can actually put the classifier here right here that's something we can so" }, { "start": 1005.1, "end": 1008.5200000000001, "text": " it's going to be the classifier if you look in the state dates directory I'm" }, { "start": 1008.5200000000001, "end": 1019.6, "text": " gonna guess you can models see for ten state dicts we haven't unpacked it where" }, { "start": 1019.6, "end": 1026.9, "text": " have we not where have we unpacked it to help help oh no have we unpacked it to" }, { "start": 1026.9, "end": 1039.52, "text": " here we have not we have not so what is in here ah it's the C for ten models" }, { "start": 1039.52, "end": 1043.8400000000001, "text": " sub thing and then state dicts okay so it's always going to be the architecture" }, { "start": 1043.8400000000001, "end": 1051.6000000000001, "text": " plus PT so we can you know we can deal with that so it's going to be C for ten" }, { "start": 1051.6, "end": 1058, "text": " models state dicts that's fine and then it's always going to be the architecture" }, { "start": 1058, "end": 1068.08, "text": " plus a PT so let's look at one of these models to see how this is loaded we've" }, { "start": 1068.08, "end": 1079.32, "text": " saw we've seen this here so we simply want to load this state dict in and here" }, { "start": 1079.32, "end": 1085.32, "text": " it constructs the thing this is let's do proper string interpolation shall we oh" }, { "start": 1085.32, "end": 1098.12, "text": " device where this device come from we should check that out device is given" }, { "start": 1098.12, "end": 1115.6799999999998, "text": " device device device CPU where is device given okay dense net device CPU oh I" }, { "start": 1115.6799999999998, "end": 1123.6799999999998, "text": " guess device is always CPU and then then we map it to wherever I'm not entirely" }, { "start": 1123.68, "end": 1130.96, "text": " sure so here we say set device I guess we can just get the device from" }, { "start": 1130.96, "end": 1148.04, "text": " somewhere let's try it out okay so we're going to need this right here so we're" }, { "start": 1148.04, "end": 1161.44, "text": " going to OS path join models path and something that's dot PT so and here we're" }, { "start": 1161.44, "end": 1172.8, "text": " going to get the architecture which is the classifier cool so that's how we" }, { "start": 1172.8, "end": 1183.6, "text": " load something and then the device maybe we can just go torch kuda dot get device" }, { "start": 1183.6, "end": 1189.1599999999999, "text": " is that possible let's try" }, { "start": 1189.16, "end": 1203.1200000000001, "text": " nope ah okay" }, { "start": 1203.12, "end": 1224.8799999999999, "text": " nope no get device device maybe nope map location was given okay so we have to" }, { "start": 1224.88, "end": 1237.44, "text": " figure out where this device comes from honestly here no module there's this get" }, { "start": 1237.44, "end": 1242, "text": " classifier right here but just just says pre trained" }, { "start": 1242, "end": 1257.48, "text": " this device always CPU I just can't believe that I guess I'll believe it" }, { "start": 1257.48, "end": 1272.84, "text": " we'll always load to the CPU okay cool we can do that I guess pytorch lightning" }, { "start": 1272.84, "end": 1281.24, "text": " will then put it on the GPU for us cool so this is about how far I got when I" }, { "start": 1281.24, "end": 1294.68, "text": " tried to do this by myself and now the problems start missing keys in state" }, { "start": 1294.68, "end": 1305.16, "text": " dick a lot of missing stuff we can't we can't possibly load that yeah no not" }, { "start": 1305.16, "end": 1326.28, "text": " going to you so we can't load stuff what does it do load file name equals and" }, { "start": 1326.28, "end": 1334.2, "text": " then let's paste this and let's put some kind of break point here so we can check" }, { "start": 1334.2, "end": 1336.4, "text": " it out" }, { "start": 1336.4, "end": 1363.8000000000002, "text": " okay that exists now she feels like that should exist" }, { "start": 1367.0800000000002, "end": 1379.4, "text": " yeah that exists what's the what's the deal what's the matter here so we got" }, { "start": 1379.4, "end": 1390.6000000000001, "text": " model which is I guess a resin at 18 and we got this thing that we might want to" }, { "start": 1390.6, "end": 1401.04, "text": " load so why doesn't it work torch load load file name see that works so that's" }, { "start": 1401.04, "end": 1411.8799999999999, "text": " the state dict is that let's look at its keys we got a you know a bunch of stuff" }, { "start": 1411.88, "end": 1426.3200000000002, "text": " okay so why can't we load that well load state dict state dict and now unexpected" }, { "start": 1426.3200000000002, "end": 1438.6000000000001, "text": " keys in state dick missing keys so this is always prepended with model dot and" }, { "start": 1438.6, "end": 1456.08, "text": " here it's not okay what do we do about that I guess this is because we loaded" }, { "start": 1456.08, "end": 1470.6799999999998, "text": " ourselves okay cool so our model is not yes so our model has the sub path model" }, { "start": 1470.6799999999998, "end": 1480.96, "text": " so we need model dot model dot load state dict right look at us we made it so" }, { "start": 1480.96, "end": 1486.52, "text": " this is testing I guess this is this resin at 18 or whatnot so we can leave" }, { "start": 1486.52, "end": 1496, "text": " that to run for itself so we figured out how to load this stuff took us a while" }, { "start": 1496, "end": 1503.72, "text": " now let's go ahead and we know how to load the models we know how to load the" }, { "start": 1503.72, "end": 1508.04, "text": " weights so this is our teacher model right our teacher model is supposed to" }, { "start": 1508.04, "end": 1515.92, "text": " load up the weights and then and then teach the student models so here what" }, { "start": 1515.92, "end": 1523, "text": " does this training thing do we download the thing we make our GPUs to be really" }, { "start": 1523, "end": 1529.2, "text": " good okay and then we instantiate this module right here as you can see so now" }, { "start": 1529.2, "end": 1532.92, "text": " we're going to check out this module by the way the testing is done and as you" }, { "start": 1532.92, "end": 1538, "text": " can see there's an accuracy of 93.33 which I'm pretty happy with this is" }, { "start": 1538, "end": 1544.2, "text": " congruent with what we saw right here the resin at 18 do okay and we can I" }, { "start": 1544.2, "end": 1548.04, "text": " guess we can take a resin at 18 or a resin at 50 they're both fairly small" }, { "start": 1548.04, "end": 1553.5600000000002, "text": " right here so a lot of them are going to fit on our GPUs once we use the GPUs so" }, { "start": 1553.5600000000002, "end": 1559.26, "text": " let's change this module around right here to actually do the to actually do" }, { "start": 1559.26, "end": 1565.04, "text": " the let's say the the proper thing that we wanted to do so here we have self dot" }, { "start": 1565.04, "end": 1572.82, "text": " model as you can see and it's get classifier and the question is does it" }, { "start": 1572.82, "end": 1578.08, "text": " load it pre-trained so what we want to do is this is going to be our teacher" }, { "start": 1578.08, "end": 1585.04, "text": " model and this in this get classifier we want pre-trained to be false always" }, { "start": 1585.04, "end": 1591.12, "text": " right here we don't want any sort of we don't want to load the pre-trained" }, { "start": 1591.12, "end": 1597.6399999999999, "text": " instead what we want to do is we actually want to have the we want to" }, { "start": 1597.6399999999999, "end": 1603.84, "text": " load it ourselves right so here pretend false and now we're going from our test" }, { "start": 1603.84, "end": 1609.56, "text": " script we're going to take over the path they think the code that we used to load" }, { "start": 1609.56, "end": 1623.72, "text": " this okay all right so but a beam but a boom OS we don't have OS that common" }, { "start": 1623.72, "end": 1633.32, "text": " along just fine yep yep yep so now here we're going to have our self teacher" }, { "start": 1633.32, "end": 1641.4399999999998, "text": " model to load that state dict all right so this is it for initialization now we" }, { "start": 1641.4399999999998, "end": 1646.12, "text": " also need our student models of course so our student models are going to be a" }, { "start": 1646.12, "end": 1658.9199999999998, "text": " bunch of models models are going to be a bunch of models where what do we say so" }, { "start": 1658.92, "end": 1666.8400000000001, "text": " this is going to be a torch or a like a module list there's this module list" }, { "start": 1678.76, "end": 1688.44, "text": " torch dot n and dot module list right so I initialize that with a list and the" }, { "start": 1688.44, "end": 1692.16, "text": " list is going to be get me the classifier and we're just going to go for" }, { "start": 1692.16, "end": 1696.76, "text": " the same kind of classifiers right now to really boil it down to have the same" }, { "start": 1696.76, "end": 1709.48, "text": " architecture for the students and for the teachers for bar in range in range" }, { "start": 1709.48, "end": 1718.0800000000002, "text": " and here we probably need a flag so h params dot num students okay so these" }, { "start": 1718.08, "end": 1721.96, "text": " are going to be our student models so let's quickly create this num students" }, { "start": 1721.96, "end": 1730.6799999999998, "text": " thing right here I'll probably have to have an integer and we'll go with five" }, { "start": 1730.6799999999998, "end": 1738.04, "text": " students for now okay so we're creating five students all of them are not" }, { "start": 1738.04, "end": 1743.1599999999999, "text": " pre trained so we're going to are we going to train them from scratch or do" }, { "start": 1743.16, "end": 1748.24, "text": " we want actually to take over the weights we probably don't want to take" }, { "start": 1748.24, "end": 1754.16, "text": " over the weights let's just train them from scratch in a distillation mode I" }, { "start": 1754.16, "end": 1760.64, "text": " have no clue about this stuff by the way okay I guess this concludes this" }, { "start": 1760.64, "end": 1768.48, "text": " already concludes what we what we wanted to do so because this module list what" }, { "start": 1768.48, "end": 1773.92, "text": " can we do with it does anyone know I don't know by the way I'm sorry for the" }, { "start": 1773.92, "end": 1779.44, "text": " switching between the dark and the bright background I don't know how to" }, { "start": 1779.44, "end": 1787, "text": " fix that so pytorch and an module list it would be nice if we could give them" }, { "start": 1787, "end": 1796.3600000000001, "text": " some names right so I guess that's just an iterable right here so probably" }, { "start": 1796.36, "end": 1800.1599999999999, "text": " there's nothing that we can do to give them proper names or we'd have to hack" }, { "start": 1800.1599999999999, "end": 1806.3999999999999, "text": " around and I don't want to do that so I guess we can just check if that actually" }, { "start": 1806.3999999999999, "end": 1817.3999999999999, "text": " computes until here so let's check it out let's try the ensemble it doesn't" }, { "start": 1817.3999999999999, "end": 1823.4799999999998, "text": " data set not found or corrupted okay so what we'll have to do is we'll have to" }, { "start": 1823.48, "end": 1829.08, "text": " implement have to change this data directory right here so the data deer" }, { "start": 1829.08, "end": 1836.52, "text": " is going to be OS this" }, { "start": 1838.04, "end": 1849.52, "text": " whatever my C for 10 directory is no such file directory logs okay so logs" }, { "start": 1849.52, "end": 1853.92, "text": " doesn't exist so let's actually make it" }, { "start": 1859, "end": 1868.84, "text": " still no such file a directory logs why why doesn't it make it no such file a" }, { "start": 1868.84, "end": 1879.2, "text": " directory logs ah okay we need to ignore errors here and we're good okay so it" }, { "start": 1879.2, "end": 1885.4, "text": " computes until the point you probably you probably can't see that right I guess" }, { "start": 1885.4, "end": 1891.4, "text": " now you can see it let's check yeah now you can see it all right so where are we" }, { "start": 1891.4, "end": 1898.32, "text": " we are at the point right here in our module after we've created the teacher" }, { "start": 1898.32, "end": 1905.18, "text": " and the students so if we look at self technically we should be able to see" }, { "start": 1905.18, "end": 1912.8400000000001, "text": " right here a whole bunch of resin at 18s whole bunch so here you can see the" }, { "start": 1912.8400000000001, "end": 1919.6000000000001, "text": " teacher model right and I'm going to guess you can see layer 4 and here you" }, { "start": 1919.6000000000001, "end": 1922.6000000000001, "text": " can see the student models so the student models are going to be in a" }, { "start": 1922.6000000000001, "end": 1927.4, "text": " whole list of models and now we're going to train them so since they're" }, { "start": 1927.4, "end": 1930.68, "text": " initialized differently our hope is going to be that they're sort of going" }, { "start": 1930.68, "end": 1934.8400000000001, "text": " to end up at different places we're going to train them with the same like" }, { "start": 1934.84, "end": 1941.36, "text": " we're going to be really really stupid about this okay all right so let's be" }, { "start": 1941.36, "end": 1948.32, "text": " really stupid about it so what what are we gonna have to change here is our" }, { "start": 1948.32, "end": 1953.6799999999998, "text": " training step and our training step is actually fine we'll simply forward we'll" }, { "start": 1953.6799999999998, "end": 1959.32, "text": " get a loss from that and then we are going to return that and that's going to" }, { "start": 1959.32, "end": 1965.32, "text": " be back propped so in our optimizer wherever we initialize our optimizer we" }, { "start": 1965.32, "end": 1970.2, "text": " should probably give it the parameters that are not only the student model" }, { "start": 1970.2, "end": 1979.6, "text": " parameters right not the teacher model parameters so it should only train the" }, { "start": 1979.6, "end": 1986.9399999999998, "text": " student models okay and even even like that we should probably always set the" }, { "start": 1986.94, "end": 1995.52, "text": " teacher model in eval mode but we'll do that in the forward step right here so" }, { "start": 1995.52, "end": 2001.1000000000001, "text": " in the forward step we get images and labels and here it runs it just forward" }, { "start": 2001.1000000000001, "end": 2005.4, "text": " through the model we want to change that we actually want to have teacher" }, { "start": 2005.4, "end": 2011.8400000000001, "text": " predictions which we're going to have the teacher model we're going to forward" }, { "start": 2011.8400000000001, "end": 2016.48, "text": " this through the teacher models now the criterion I'm going to guess is a cross" }, { "start": 2016.48, "end": 2020.84, "text": " entropy so the predictions here are actually going to be logits right and" }, { "start": 2020.84, "end": 2030.6, "text": " this is this is good except that what we want to do is have a distribution of" }, { "start": 2030.6, "end": 2036.6, "text": " over labels so after the teacher here runs through and let's put a break point" }, { "start": 2036.6, "end": 2042.1200000000001, "text": " right here and actually look at it I find it's always easy if you go and just" }, { "start": 2042.12, "end": 2050.16, "text": " run until the point where you are at the code and then you can just look at stuff" }, { "start": 2050.16, "end": 2056.68, "text": " so here there's oh there's a validation sanity check okay probably don't want" }, { "start": 2056.68, "end": 2062, "text": " that and now we have the break right here and now we can look at teacher" }, { "start": 2062, "end": 2069.24, "text": " predictions dot shape so that's a batch size times 10 and if we look at it I'm" }, { "start": 2069.24, "end": 2072.08, "text": " going to guess there's some negative numbers in there so that's not going to" }, { "start": 2072.08, "end": 2078.08, "text": " be that those are going to be logits now we want them that to be a soft max over" }, { "start": 2078.08, "end": 2082.64, "text": " the last dimension and that's going to be of the same shape but of course now" }, { "start": 2082.64, "end": 2086.72, "text": " we're going to have a proper distribution so if we sum over the last" }, { "start": 2086.72, "end": 2091.2, "text": " dimension you should see a bunch of ones all right so the teacher predictions are" }, { "start": 2091.2, "end": 2101.8399999999997, "text": " going to be soft max over the last dimension and since we since we don't" }, { "start": 2101.8399999999997, "end": 2107.6, "text": " want to back prop through the teacher we can do this in an environment of no grad" }, { "start": 2107.6, "end": 2116.4399999999996, "text": " right here so we have that with not being stupid and we also set the teacher" }, { "start": 2116.44, "end": 2131.68, "text": " model into eval mode so I guess that does it set train no that should do it" }, { "start": 2131.68, "end": 2144.52, "text": " I have no idea yeah let's let's run it again we could have done that there okay" }, { "start": 2144.52, "end": 2150.28, "text": " so so far so good so we have the teacher predictions now what we need to do is" }, { "start": 2150.28, "end": 2156.68, "text": " run them through the student and use them as labels so we'll go for student" }, { "start": 2156.68, "end": 2167.12, "text": " in student models we'll go student forward or we simply run the images" }, { "start": 2167.12, "end": 2179.8399999999997, "text": " through that and that give us the logits and then we use our loss function on the" }, { "start": 2179.8399999999997, "end": 2188.6, "text": " logits and that not the labels but the teacher predictions right so we never" }, { "start": 2188.6, "end": 2195.68, "text": " actually use the labels here as you can see and that's going to be the student" }, { "start": 2195.68, "end": 2206.44, "text": " loss and now we have a bunch of losses and we're going to append that" }, { "start": 2206.44, "end": 2221.56, "text": " ah nope dot like this and our loss is simply going to be the sum of all the" }, { "start": 2221.56, "end": 2229.56, "text": " student losses not even the average I guess we could" }, { "start": 2230.7999999999997, "end": 2237, "text": " losses I guess we could make it the average just so if we change the number" }, { "start": 2237, "end": 2244.32, "text": " of students we'll get some kind of some sort of a better sense of the" }, { "start": 2244.32, "end": 2253.88, "text": " actual numbers what what what okay I think over here we're good yeah so our" }, { "start": 2253.88, "end": 2262.6800000000003, "text": " teacher model is not in training mode but our student models hopefully are in" }, { "start": 2262.6800000000003, "end": 2267.7200000000003, "text": " training mode no is this the eval pass I guess this is the eval pass this is the" }, { "start": 2267.7200000000003, "end": 2273.32, "text": " validation sanity check pass okay so this is going to be our loss and our" }, { "start": 2273.32, "end": 2281.1600000000003, "text": " accuracy now right so okay what's going to be our accuracy our accuracy is going" }, { "start": 2281.1600000000003, "end": 2285.96, "text": " to be we have these student losses all of them and what we are going to do is" }, { "start": 2285.96, "end": 2293.6800000000003, "text": " we're simply going to take the maximum prediction across the students pretty" }, { "start": 2293.68, "end": 2309.52, "text": " easy pretty easy but we need to collect the log it's so come on so we'll also" }, { "start": 2309.52, "end": 2318.6, "text": " have the log it's append the student log it's okay so we have a whole bunch of" }, { "start": 2318.6, "end": 2325.64, "text": " log it's right here and we'll get some predictions out of that now the question" }, { "start": 2325.64, "end": 2330.56, "text": " is do we want to simply take the mode or do we actually want to run a softmax" }, { "start": 2330.56, "end": 2337.8399999999997, "text": " over each and then take the average prediction I'm not duper super sure but" }, { "start": 2337.8399999999997, "end": 2344.08, "text": " we can try to do it in different different ways so right now we might just" }, { "start": 2344.08, "end": 2351.12, "text": " want to take the maybe the average log it and then run a softmax on top of that" }, { "start": 2351.12, "end": 2357.68, "text": " because I'm gonna guess the log it's our outputs of a linear layer so they might" }, { "start": 2357.68, "end": 2362.2, "text": " behave more in a linear fashion than if we were to average the actual" }, { "start": 2362.2, "end": 2374.06, "text": " probabilities that come out right maybe let's let's do this okay so we'll go" }, { "start": 2374.06, "end": 2378.92, "text": " we'll take these log it's they're all and we need to somehow concatenate" }, { "start": 2378.92, "end": 2389.64, "text": " those or stack them so how are we gonna stack them so they're 256 their batch" }, { "start": 2389.64, "end": 2395.7599999999998, "text": " size by number of classes so we'll just stack them at dimension zero I guess" }, { "start": 2395.7599999999998, "end": 2402.96, "text": " that's fine and then we are going to mean also across dimension zero so those" }, { "start": 2402.96, "end": 2409.52, "text": " are going to be our log it's our final log it's and then our predictions are" }, { "start": 2409.52, "end": 2422.36, "text": " going to be the argmax of the log it's in the last dimension yep that should" }, { "start": 2422.36, "end": 2436.88, "text": " be pretty straightforward I guess that's it easy as that yes the rest here should" }, { "start": 2436.88, "end": 2444.1200000000003, "text": " just do by itself and I'm going to go ahead and run give this another run and" }, { "start": 2444.1200000000003, "end": 2450.92, "text": " see where we run into problems can't really see how this could ever go wrong" }, { "start": 2450.92, "end": 2461.16, "text": " we'll just take everything over okay we actually got a problem 1d target tensor" }, { "start": 2461.16, "end": 2466.4, "text": " expected multi-target not supported so the cross entropy loss in pytorch does" }, { "start": 2466.4, "end": 2472.96, "text": " not support that let's let's give it a shot make this a little bigger for you" }, { "start": 2472.96, "end": 2485.68, "text": " and let's go for the cross P loss I can't type today so here we have the" }, { "start": 2485.68, "end": 2490.86, "text": " cross entropy loss and the cross entropy loss is useful when training cross" }, { "start": 2490.86, "end": 2496.36, "text": " because problem with the classes yada yada yada wait should be one that okay" }, { "start": 2496.36, "end": 2506.4, "text": " criterion expects a class index as the target okay so what we need is like a" }, { "start": 2506.4, "end": 2513.1, "text": " soft loss right we don't need this cross entropy loss we actually want we want to" }, { "start": 2513.1, "end": 2520.46, "text": " have soft targets so what do we do we want to do I think the cross entropy" }, { "start": 2520.46, "end": 2527.52, "text": " loss is a combination of the here of the log softmax and the NLL loss can we take" }, { "start": 2527.52, "end": 2540.44, "text": " the NLL loss maybe so the NLL loss right here is going to be the target that this" }, { "start": 2540.44, "end": 2552.36, "text": " loss expect should be a class index no okay that's not good so next let's go do" }, { "start": 2552.36, "end": 2561.32, "text": " we have we somehow need a soft cross entropy loss let's search for that" }, { "start": 2561.32, "end": 2577.0800000000004, "text": " pytorch soft cross entropy soft classes I guess people do that kind of stuff so" }, { "start": 2578.76, "end": 2584.7200000000003, "text": " the problem with these kind of losses is that what you do what you have to do is" }, { "start": 2584.72, "end": 2593.9599999999996, "text": " kind of protect yourself against against numerical instabilities right so what we" }, { "start": 2593.9599999999996, "end": 2600.7599999999998, "text": " want to do is find a function that does this for us I guess if we do the loft" }, { "start": 2600.7599999999998, "end": 2606.68, "text": " the the log softmax that should take care of it for us okay this is tensor" }, { "start": 2606.68, "end": 2622.16, "text": " flow okay following thread cross entropy loss I guess people just do really the" }, { "start": 2622.16, "end": 2634.96, "text": " log softmax and then do that and we should be fine with this okay thanks" }, { "start": 2634.96, "end": 2645.96, "text": " okay Frank yeah maybe maybe this has advanced since then so we can give like" }, { "start": 2645.96, "end": 2651.2, "text": " a last look at this and this is a bit too big I'm sorry your eyes are gonna" }, { "start": 2651.2, "end": 2662.16, "text": " have to suffer and we're going to look at loss functions and we're going to" }, { "start": 2662.16, "end": 2673.2799999999997, "text": " just look through them multi label soft margin loss hmm multi label we don't" }, { "start": 2673.2799999999997, "end": 2684.2799999999997, "text": " really want multi label right we want this but not with the targets okay I" }, { "start": 2684.2799999999997, "end": 2689.72, "text": " guess we're just gonna have to write this ourselves so ultimately what is the" }, { "start": 2689.72, "end": 2695.24, "text": " cross entropy that cross entropy is simply the probability of the true label" }, { "start": 2695.24, "end": 2702.9599999999996, "text": " times the log probability of the wrong or of the predicted label yeah as you" }, { "start": 2702.9599999999996, "end": 2707.64, "text": " see right here so we are going to simply multiply target times the log" }, { "start": 2707.64, "end": 2716.66, "text": " probability of the predicted label and then some some dot take that mean across" }, { "start": 2716.66, "end": 2727.52, "text": " the batch I guess yeah that should do we can implement this let's do it so this" }, { "start": 2727.52, "end": 2733.2799999999997, "text": " criterion right here is going to be our loss function and that's only used once" }, { "start": 2733.28, "end": 2747.88, "text": " so what we can do is going to be a function so we're going to take student" }, { "start": 2747.88, "end": 2756.5600000000004, "text": " logits and we're going to take teacher probabilities okay so how's that gonna" }, { "start": 2756.56, "end": 2763.68, "text": " work out we're going to do the log soft max from the student logits so and then" }, { "start": 2763.68, "end": 2776.12, "text": " dot does that exist log soft max functional okay we need functional and" }, { "start": 2776.12, "end": 2784.12, "text": " student logits of that dimension so now we have properly normalized student" }, { "start": 2784.12, "end": 2790.7599999999998, "text": " logit so that's going to be student log probes and then what we want to do is" }, { "start": 2790.7599999999998, "end": 2798.56, "text": " simply multiply the teacher probes times the student log probes and the negative" }, { "start": 2798.56, "end": 2806.7999999999997, "text": " of that is going to be our loss the question is do we want to sum that I" }, { "start": 2806.8, "end": 2819.84, "text": " guess across this dimension or mean it I guess the sum sum should do all right" }, { "start": 2819.84, "end": 2829.0800000000004, "text": " this is it easy as that why have we searched for so long so the criterion we" }, { "start": 2829.08, "end": 2839.04, "text": " can simply replace that now by our loss function cool so let's run it again" }, { "start": 2841.72, "end": 2850.44, "text": " yada yada yada okay so I need to check maybe we should have taken like a smaller" }, { "start": 2850.44, "end": 2854.7999999999997, "text": " model it sometimes pays off to you know start with a really small model small" }, { "start": 2854.8, "end": 2863.44, "text": " model just so you can you can do these kind of things fast so here we have" }, { "start": 2863.44, "end": 2872.32, "text": " dimension out of range to do okay which is where is that in forward in line 78" }, { "start": 2872.32, "end": 2884.0800000000004, "text": " let's go there line 78 okay here the max is not going to be as much fun let's" }, { "start": 2884.08, "end": 2889.2, "text": " go there I think this is some of these things change over time in pytorch so" }, { "start": 2889.2, "end": 2896.3199999999997, "text": " this code might be written when you know so what we have is we have a max over" }, { "start": 2896.3199999999997, "end": 2903.92, "text": " the predictions and predictions oh it's already an arg max so I guess we can" }, { "start": 2903.92, "end": 2910.52, "text": " remove this all whether or not that agrees with labels dot data we don't" }, { "start": 2910.52, "end": 2920.84, "text": " need any of that dot float and we also don't need that we so the accuracy is" }, { "start": 2920.84, "end": 2929.48, "text": " simply going to be the mean of this no I guess so we're here can't we just do" }, { "start": 2929.48, "end": 2946.56, "text": " predictions equals labels yes and we want the sum of that actually we want" }, { "start": 2946.56, "end": 2953.4, "text": " the float first and then we want the mean yeah that seems reasonable so let's" }, { "start": 2953.4, "end": 2967.2000000000003, "text": " do it like this yeah float mean perfect how could this be any more easy but this" }, { "start": 2967.2000000000003, "end": 2976.36, "text": " right here is all of it so validation step accuracy corrects we'll just look" }, { "start": 2976.36, "end": 2982.36, "text": " at it once we've done it and what I do is usually just run it until it doesn't" }, { "start": 2982.36, "end": 2988.4, "text": " give me any mistakes anymore and then I know I sort of have succeeded" }, { "start": 3012.36, "end": 3031.32, "text": " okay we're pretty close I feel so it says grad can implicitly create it only" }, { "start": 3031.32, "end": 3037.08, "text": " for scalar outputs which probably means our loss function is not a scalar so" }, { "start": 3037.08, "end": 3042.6, "text": " when we return the loss right here here we have the sum of the losses divided by" }, { "start": 3042.6, "end": 3055.36, "text": " the length of the losses let's go here and check out what's up with that so" }, { "start": 3055.36, "end": 3061.72, "text": " what will do I see this loss function here will output basically one loss for" }, { "start": 3061.72, "end": 3071.2, "text": " each data point so what we need to do I guess is call mean on this or some when" }, { "start": 3071.2, "end": 3077.04, "text": " they created the criterion in the original one now we've thrown it away" }, { "start": 3077.48, "end": 3087.3999999999996, "text": " look at the git diff right here so I guess this reduces how does this reduce" }, { "start": 3087.4, "end": 3097.1600000000003, "text": " the cross entropy loss when we don't do anything cross entropy loss reduces" }, { "start": 3097.1600000000003, "end": 3106.4, "text": " reduction mean okay so let's reduce with the mean so if we call loss then after" }, { "start": 3106.4, "end": 3112.32, "text": " that we should call mean and then here I'm not so sure anymore we should divide" }, { "start": 3112.32, "end": 3117.12, "text": " here because the learning rate is kind of tuned to the original loss size so I" }, { "start": 3117.12, "end": 3124.04, "text": " guess we'll be content for now with summing up these things and over here I" }, { "start": 3124.04, "end": 3132.56, "text": " guess we've we've solved that right no losses yeah see our losses is going to be" }, { "start": 3132.56, "end": 3140.92, "text": " an entire tensor and now we just fixed that right now okay so let's try it" }, { "start": 3140.92, "end": 3149.32, "text": " again in the meantime what can we do we can so we already take care of our GPU" }, { "start": 3149.32, "end": 3155.36, "text": " we take care of the logs one thing to do when with respect to this download" }, { "start": 3155.36, "end": 3163.44, "text": " stuff right here is you know if you have a server or something and you let a lot" }, { "start": 3163.44, "end": 3167.2000000000003, "text": " of things run in parallel what you want to do is make sure they don't all" }, { "start": 3167.2, "end": 3172.7599999999998, "text": " download the same stuff at the same time that's pretty bad so what you want to do" }, { "start": 3172.7599999999998, "end": 3177.3599999999997, "text": " is ideally have some sort of lock such that they coordinate and I usually use a" }, { "start": 3177.3599999999997, "end": 3188.3599999999997, "text": " file lock for this so I'm gonna create that right here from import the file" }, { "start": 3188.36, "end": 3197.76, "text": " lock and then I simply create the lock let's go file lock and here you have to" }, { "start": 3197.76, "end": 3211.88, "text": " input a file so sometimes like yeah data lock I don't know you just pick some" }, { "start": 3211.88, "end": 3218.8, "text": " file and that's the file that these these processes are going to sync on and" }, { "start": 3218.8, "end": 3231.2400000000002, "text": " then once you do this you simply wrap all of it in a with lock so only one at" }, { "start": 3231.24, "end": 3242.8799999999997, "text": " a time can go in in this function all right so that's that that should make us" }, { "start": 3242.8799999999997, "end": 3250, "text": " safe and right here we're now training this is excellent we are training the" }, { "start": 3250, "end": 3257.8399999999997, "text": " students now we need to do that on an actual GPU so I have multiple tools to" }, { "start": 3257.84, "end": 3265.76, "text": " ship this to a GPU so first of all I can try to ship this to and try to ship this" }, { "start": 3265.76, "end": 3274.3, "text": " to a let's say to to one GPU so the way you do that is first of all I want some" }, { "start": 3274.3, "end": 3279.32, "text": " sort of unbuffered version of Python and then I have this do I even have this" }, { "start": 3279.32, "end": 3295.96, "text": " tool I do have the tool okay so I'm gonna call one of our servers and we" }, { "start": 3295.96, "end": 3302.96, "text": " don't know what's going on okay so cannot import name seed everything from" }, { "start": 3302.96, "end": 3309.96, "text": " pytorch lightning seed everything is that some kind of new thing in pytorch" }, { "start": 3309.96, "end": 3329.44, "text": " lightning I guess I have it apparently so here seed everything with zero why I" }, { "start": 3329.44, "end": 3337, "text": " don't need that we are running without any seed here we are being really cool" }, { "start": 3337, "end": 3348.4, "text": " okay next mistake cannot okay still same mistake of course since we don't yep" }, { "start": 3352.36, "end": 3358.44, "text": " next mistake we'll just go through the mistake learning rate late learning rate" }, { "start": 3358.44, "end": 3365.2400000000002, "text": " loggers so I guess we need to update pytorch lightning on the servers and I'll" }, { "start": 3365.2400000000002, "end": 3371.84, "text": " do that quickly okay I've updated pytorch lightning let's check out whether" }, { "start": 3371.84, "end": 3377, "text": " or not we can actually run something yeah we can run something so this again" }, { "start": 3377, "end": 3381.92, "text": " is now downloading this on the server while this is happening there's another" }, { "start": 3381.92, "end": 3388.52, "text": " thing we can do namely I have sort of sort of made a system to run stuff on" }, { "start": 3388.52, "end": 3396.96, "text": " servers which I like a lot honestly so I guess we can try this out how do I" }, { "start": 3396.96, "end": 3409.96, "text": " hidden oh with I okay so I want to first of all delete this delete this yes I" }, { "start": 3409.96, "end": 3419, "text": " guess delete this cool and this git folder is a bit annoying let's restructure" }, { "start": 3419, "end": 3425.4, "text": " because otherwise it will always ship the git folder with everything up here" }, { "start": 3425.4, "end": 3433.7200000000003, "text": " does it do that yeah I don't like to have the code in a top level so quickly" }, { "start": 3433.72, "end": 3447.52, "text": " make a sources directory move everything in there so move the c410 models into" }, { "start": 3447.52, "end": 3458.4399999999996, "text": " the source directory move all the Python files into the source directory no clear" }, { "start": 3458.44, "end": 3470.88, "text": " the logs and we're much better much better okay much better so what we what" }, { "start": 3470.88, "end": 3476.52, "text": " what we will do is my system requires like a file and I'm just gonna copy one" }, { "start": 3476.52, "end": 3499, "text": " from another project quickly okay so we're back and I copied that over as you" }, { "start": 3499, "end": 3505.08, "text": " can see you basically give hyper parameters and it blasts ever the hyper" }, { "start": 3505.08, "end": 3508.2599999999998, "text": " parameters through in a kind of a random search fashion it's not too" }, { "start": 3508.2599999999998, "end": 3520.92, "text": " sophisticated but we can work with it so 10 that's the file right for 10 train" }, { "start": 3520.92, "end": 3528.72, "text": " ensemble yes that's the file cool and here we're just going to put all of our" }, { "start": 3528.72, "end": 3537.3199999999997, "text": " hyper parameters and that will remove the logs file I'm okay with that but" }, { "start": 3537.3199999999997, "end": 3540.56, "text": " want this" }, { "start": 3546.4399999999996, "end": 3554.9199999999996, "text": " bang cool so what do we want we want basically we just want to try it like a" }, { "start": 3554.92, "end": 3562.4, "text": " bunch of times and then see like average across it right that's all maybe we want" }, { "start": 3562.4, "end": 3575.2400000000002, "text": " the the architecture to change so let's say the classifier is a resnet 18 or a" }, { "start": 3575.24, "end": 3587.16, "text": " resnet 34 or a resnet 50 just so we have a bunch of stuff to do okay and this" }, { "start": 3587.16, "end": 3596.3999999999996, "text": " downloaded and is training on GPU hopefully if this works then we can ship" }, { "start": 3596.3999999999996, "end": 3601.64, "text": " this off and we'll make this other hyper parameter that I like to use called rep" }, { "start": 3601.64, "end": 3606.64, "text": " which is just basically a dummy parameter and so I can just repeat the" }, { "start": 3606.64, "end": 3615, "text": " experiment a bunch of times and let's put that in here so this is really that" }, { "start": 3615, "end": 3624, "text": " this has this has no effect except for randomizing it a bit I guess we can try" }, { "start": 3624, "end": 3630.04, "text": " to seed stuff so whenever it says seed everything we'll just seed it with this" }, { "start": 3630.04, "end": 3646, "text": " we'll call it seed no is it here this seed everything yeah so h params dot rep" }, { "start": 3646, "end": 3658.12, "text": " sorry seed cool what this this is doing something nice you can see it so this is" }, { "start": 3658.12, "end": 3668.6, "text": " unbuffered Python output thanks yeah so what other classifiers do we have we can" }, { "start": 3668.6, "end": 3676, "text": " again we can try a bunch of them we can try all of them but why don't we try all" }, { "start": 3676, "end": 3684.52, "text": " of them like this then let's go into this rat file I don't know why I called" }, { "start": 3684.52, "end": 3696.7599999999998, "text": " it rat I just want it like some three-letter thing so yep like this and" }, { "start": 3696.7599999999998, "end": 3704.32, "text": " then we can just take all of that crap and delete it and delete this and those" }, { "start": 3704.32, "end": 3709.52, "text": " are going to be all our models so our classifier is going to consist of all" }, { "start": 3709.52, "end": 3721.36, "text": " of this stuff let's I know I know I know I suck at them don't tell me actually" }, { "start": 3721.36, "end": 3727.16, "text": " tell me I want them tips trying to learn something new like each week in them but" }, { "start": 3727.16, "end": 3734.7599999999998, "text": " it is hard and tend to make myself actually do it so let's go let's go" }, { "start": 3734.7599999999998, "end": 3739.32, "text": " with just one repetition so far if we if we are not sure we can still up the" }, { "start": 3739.32, "end": 3745.7200000000003, "text": " number of repetitions we don't even have the rep right now this is called seed" }, { "start": 3745.84, "end": 3751.7200000000003, "text": " all right so we have different classifiers and what we're going to" }, { "start": 3751.7200000000003, "end": 3760.52, "text": " need we also have this num students right let's go with one with five and" }, { "start": 3760.52, "end": 3773.28, "text": " with 20 so here we got one epoch done and we get a validation loss do we get a" }, { "start": 3773.28, "end": 3780.7599999999998, "text": " validation accuracy validating validating I have no idea we'll cancel" }, { "start": 3780.7599999999998, "end": 3788.92, "text": " this right now and we'll go ahead and just blast this onto our servers and" }, { "start": 3788.92, "end": 3798.48, "text": " hopefully that that's gonna work I have no idea is everything fine everything's" }, { "start": 3798.48, "end": 3807.7200000000003, "text": " fine go no what what" }, { "start": 3807.72, "end": 3816.2799999999997, "text": " cool" }, { "start": 3820.2799999999997, "end": 3827.08, "text": " and let me get back to you once this is finished all right we're back so I've" }, { "start": 3827.08, "end": 3833.56, "text": " just written some code here to extract the results of that run and something" }, { "start": 3833.56, "end": 3837.48, "text": " you know it's pretty interesting what came out so in these plots you'll see on" }, { "start": 3837.48, "end": 3842.6, "text": " the x-axis of the number of students in the ensemble remember these students are" }, { "start": 3842.6, "end": 3846.52, "text": " all trained from the same teacher the teacher you can see in orange that's" }, { "start": 3846.52, "end": 3851.92, "text": " just the single teacher for reference you can see that if you have one student" }, { "start": 3851.92, "end": 3857.6, "text": " model it sometimes under performs or sometimes out performs the single" }, { "start": 3857.6, "end": 3863.68, "text": " teacher model but then if you have more student models you can see that there is" }, { "start": 3863.68, "end": 3869.44, "text": " a pretty monotonic relationship so here it's the reason this fit doesn't finish" }, { "start": 3869.44, "end": 3875.64, "text": " here is because there's not enough space on the GPU for that many student models" }, { "start": 3875.64, "end": 3880.68, "text": " but you can see that the relationship here is fairly monotonic here it's a bit" }, { "start": 3880.68, "end": 3887.04, "text": " of a kink so the first idea like this this is really astounding because these" }, { "start": 3887.04, "end": 3890.6, "text": " students have all been trained from that single teacher and they have been" }, { "start": 3890.6, "end": 3894.64, "text": " trained for as long as the teacher has been trained so they don't have more" }, { "start": 3894.64, "end": 3897.68, "text": " compute than the teacher they've been trained from scratch not from some" }, { "start": 3897.68, "end": 3903.08, "text": " checkpoint or from the teacher weights it's simple distillation from the" }, { "start": 3903.08, "end": 3907.3199999999997, "text": " teacher no labels and the students are all in parallel as well so they don't" }, { "start": 3907.3199999999997, "end": 3911.2, "text": " see different data or even different data augmentations it's the exact same" }, { "start": 3911.2, "end": 3915.52, "text": " order of the exact same data points going through all of the students the" }, { "start": 3915.52, "end": 3922.24, "text": " exact same learning rate schedule there's no noise and so on so the first" }, { "start": 3922.24, "end": 3926.04, "text": " thought that came to my mind like something fishy is going on here right" }, { "start": 3926.04, "end": 3933.24, "text": " like this this is this seems like to like come on there's no new information" }, { "start": 3933.24, "end": 3939.24, "text": " here so I thought hey I the teacher the teacher model I've just grabbed them" }, { "start": 3939.24, "end": 3942.84, "text": " from this from this repo from this pre-trained checkpoints and these" }, { "start": 3942.84, "end": 3947.08, "text": " pre-trained checkpoints they are you know the checkpoints that have performed" }, { "start": 3947.08, "end": 3952.88, "text": " best on the validation set so this is sort of a sneaky way of how we could" }, { "start": 3952.88, "end": 3956.92, "text": " train on the validation set right because we annotate each data point in" }, { "start": 3956.92, "end": 3960.6400000000003, "text": " the training data set with this checkpoint and the checkpoint has been" }, { "start": 3960.6400000000003, "end": 3965.84, "text": " selected for performing especially well on the validation data set it could" }, { "start": 3965.84, "end": 3971.44, "text": " explain why we get a gain on the validation data set so what I did is I" }, { "start": 3971.44, "end": 3977.84, "text": " retrained all of the teacher models such that I just retrained them for these 100" }, { "start": 3977.84, "end": 3983.2400000000002, "text": " epochs and I just took the last checkpoint the all everything's the same" }, { "start": 3983.2400000000002, "end": 3987.4, "text": " the hyper parameters learning rate schedule and so on this is not tuned for" }, { "start": 3987.4, "end": 3991.8, "text": " any particular model and it's pretty like it's pretty standard it's like it's" }, { "start": 3991.8, "end": 4000.2400000000002, "text": " not like 0.12589 it's like 0.01 and 100 epochs or so fairly standard" }, { "start": 4000.24, "end": 4004.8799999999997, "text": " parameters and I just took the last checkpoint to make it didn't even look at" }, { "start": 4004.8799999999997, "end": 4009.4799999999996, "text": " its performance to make sure that I didn't you know select something that" }, { "start": 4009.4799999999996, "end": 4014.6, "text": " was especially good on the validation data set and the results here you'll see" }, { "start": 4014.6, "end": 4020.8799999999997, "text": " are actually already the results of that run which the previous run it was almost" }, { "start": 4020.8799999999997, "end": 4024.8399999999997, "text": " the same like I was astounded how well it works and then I thought hey maybe" }, { "start": 4024.84, "end": 4031.44, "text": " I'm kind of you know cheating here so I redid it with the teachers that are not" }, { "start": 4031.44, "end": 4038.48, "text": " specifically selected and this is already the results so that's pretty" }, { "start": 4038.48, "end": 4045.48, "text": " cool right so then I wondered what happens if I now if I increase my" }, { "start": 4045.48, "end": 4049.7200000000003, "text": " training amount so I just let this run for more like what if I let the students" }, { "start": 4049.72, "end": 4056.2799999999997, "text": " run for more than the teacher has run again there's no new information here so" }, { "start": 4056.2799999999997, "end": 4061.04, "text": " you can see that the now the okay the green is now the teacher the blue is a" }, { "start": 4061.04, "end": 4068.04, "text": " hundred epochs and the orange is 250 epochs and you can see with that even" }, { "start": 4068.04, "end": 4075.16, "text": " one student will outperform the teacher but many students will outperform even" }, { "start": 4075.16, "end": 4079.6, "text": " more so if you give more compute there's lots of lots of headroom here to" }, { "start": 4079.6, "end": 4084.08, "text": " improve you'll see this here I think this last one with the blue line is just" }, { "start": 4084.08, "end": 4089.48, "text": " a bit of a weird a weird configuration I guess if you were to rerun that that" }, { "start": 4089.48, "end": 4096.64, "text": " would you know fall in line so this is pretty pretty weird right so I have a" }, { "start": 4096.64, "end": 4102.04, "text": " bunch of questions so first of all I've searched the literature a bit more and I" }, { "start": 4102.04, "end": 4106.24, "text": " came up with a number of papers that do things like this now usually when you do" }, { "start": 4106.24, "end": 4111.12, "text": " distillation you people stress the importance of like how to introduce" }, { "start": 4111.12, "end": 4117.639999999999, "text": " noise like in the noisy student paper or that you really need these data" }, { "start": 4117.639999999999, "end": 4124.36, "text": " augmentations or you know same clear V2 uses the self distillation in order to" }, { "start": 4124.36, "end": 4129.5199999999995, "text": " do in in order to label more data so they say it's important that we bring" }, { "start": 4129.5199999999995, "end": 4135.719999999999, "text": " more unlabeled data into the process and so on so all of this it really doesn't" }, { "start": 4135.72, "end": 4140.400000000001, "text": " match right here and especially this focus on we need noise during the" }, { "start": 4140.400000000001, "end": 4144.8, "text": " distillation process to build these ensembles this is also you know if you" }, { "start": 4144.8, "end": 4149.6, "text": " know mean teacher things like this I also found a paper called born again" }, { "start": 4149.6, "end": 4154.64, "text": " neural networks that does something quite similar but not very simple not" }, { "start": 4154.64, "end": 4159, "text": " like the same where they distill a teacher to the student with the same" }, { "start": 4159, "end": 4165.360000000001, "text": " architecture and then they distill the student again into another student and" }, { "start": 4165.36, "end": 4169.679999999999, "text": " then that into another student and so on and then at the end they say oh we can" }, { "start": 4169.679999999999, "end": 4174.48, "text": " also build an ensemble but sometimes their ensembles outperform their you" }, { "start": 4174.48, "end": 4179.28, "text": " know chain of distillation sometimes they don't they don't really focus on" }, { "start": 4179.28, "end": 4183.08, "text": " that part a lot and it's way more complicated like you distill one" }, { "start": 4183.08, "end": 4187.4, "text": " student after another and I also think they they have some introduction of" }, { "start": 4187.4, "end": 4193.62, "text": " variability in the students like like noise or different augmentations and so" }, { "start": 4193.62, "end": 4201.44, "text": " on so this here seems you know really really really simple now I want to know" }, { "start": 4201.44, "end": 4207.72, "text": " this ensemble effect it seems pretty pretty weird right so what gives so the" }, { "start": 4207.72, "end": 4214.28, "text": " first thing we could do is we could say what what does how does this compare to" }, { "start": 4214.28, "end": 4218.82, "text": " an ensemble of teacher models like if we actually were to build an ensemble like" }, { "start": 4218.82, "end": 4225.12, "text": " train five teacher models on you know five five different teacher models it's" }, { "start": 4225.12, "end": 4231.639999999999, "text": " still the same data but reasonably they might be able to learn something more" }, { "start": 4231.639999999999, "end": 4235.12, "text": " from the data if we have five teacher models they might learn different things" }, { "start": 4235.12, "end": 4241, "text": " from the data and therefore if we combine them they might kind of overlap" }, { "start": 4241, "end": 4246.599999999999, "text": " their knowledge and sort of catch where if one doesn't generalize in one data" }, { "start": 4246.6, "end": 4250.68, "text": " point the other four can overrule it whereas with these student with these" }, { "start": 4250.68, "end": 4254.96, "text": " self ensembles there's not really a way where we can learn more from data" }, { "start": 4254.96, "end": 4259.84, "text": " because we can only learn from the teacher and the teacher is fixed and has" }, { "start": 4259.84, "end": 4264.200000000001, "text": " seen that much data right so how does this compare so wrote some rewrote some" }, { "start": 4264.200000000001, "end": 4269.84, "text": " code is it's just plumbing and I release the code it's linked but it's just" }, { "start": 4269.84, "end": 4274.92, "text": " plumbing don't worry don't worry there is no great thoughts in there it's just" }, { "start": 4274.92, "end": 4280, "text": " plumbing such that my students don't are not all in parallel so the ensembles are" }, { "start": 4280, "end": 4284.88, "text": " not trained in parallel anymore I train each model individually which means that" }, { "start": 4284.88, "end": 4291.04, "text": " at maximum I have to have two models on the same GPU one teacher and one student" }, { "start": 4291.04, "end": 4297.4400000000005, "text": " so I make sure that the teachers they are trained from scratch and the" }, { "start": 4297.4400000000005, "end": 4302.12, "text": " students they're always trained from the same teacher right so the student" }, { "start": 4302.12, "end": 4306.64, "text": " ensembles will be exactly the same as we have them here that means one teacher is" }, { "start": 4306.64, "end": 4311.72, "text": " responsible for all the students but yeah so okay I'll just show you the" }, { "start": 4311.72, "end": 4319.72, "text": " results right here so if we look at those results you can see that and I've" }, { "start": 4319.72, "end": 4324.16, "text": " done it for a bunch of models right here the blue line is the ensemble of" }, { "start": 4324.16, "end": 4328.36, "text": " teachers and here on the x-axis you see the number of models and now since I'm" }, { "start": 4328.36, "end": 4334.92, "text": " not training everything on the same GPU but I recombine later that that" }, { "start": 4334.92, "end": 4339.639999999999, "text": " basically means that I have doubt the ability to train up to 10 models are" }, { "start": 4339.639999999999, "end": 4346.24, "text": " actually however many I want and the only real trick in the code is that when" }, { "start": 4346.24, "end": 4351.24, "text": " I evaluate one of these ensembles what I do is I load a mini batch and then I" }, { "start": 4351.24, "end": 4356.4, "text": " basically load the first checkpoint run the forward pass load the second" }, { "start": 4356.4, "end": 4359.879999999999, "text": " checkpoint run a forward pass load the third checkpoint run a forward pass I do" }, { "start": 4359.879999999999, "end": 4363.5599999999995, "text": " this for all the checkpoints until I go to the next mini batch but that's just" }, { "start": 4363.5599999999995, "end": 4370.08, "text": " for evaluating right it just seemed easiest with the code that I had so you" }, { "start": 4370.08, "end": 4374.719999999999, "text": " can see right here that the there is a significant like this is almost" }, { "start": 4374.719999999999, "end": 4380.719999999999, "text": " overlapping right here for most models there sometimes the student wins" }, { "start": 4380.719999999999, "end": 4386.12, "text": " sometimes the teacher wins so the teacher ensemble wins now remember the" }, { "start": 4386.12, "end": 4391.5199999999995, "text": " teachers are trained on you know ten times as much data right here but it's" }, { "start": 4391.5199999999995, "end": 4395.76, "text": " always the same data but still they have the opportunity to learn ten times as" }, { "start": 4395.76, "end": 4399.68, "text": " much information from the data whereas the students they're all distilled from" }, { "start": 4399.68, "end": 4405.88, "text": " that same teacher without any noise any augmentate any augmentations except for" }, { "start": 4405.88, "end": 4411.36, "text": " the augmentations that you use during training anyway and I've done this for a" }, { "start": 4411.36, "end": 4417.679999999999, "text": " hundred epochs and I've done this for 250 is this already 250 I think that was" }, { "start": 4417.679999999999, "end": 4424.28, "text": " a hundred I just put that there nope okay yeah that was a hundred epochs but" }, { "start": 4424.28, "end": 4430.96, "text": " you'll see the 250 epoch plots they look very much the same okay they are" }, { "start": 4430.96, "end": 4437.46, "text": " just a bit better if you train for 250 epochs now interestingly okay here's the" }, { "start": 4437.46, "end": 4445.4, "text": " interesting part about the 250 epochs the student is still distilled from a" }, { "start": 4445.4, "end": 4452.4800000000005, "text": " teacher model that has been trained for a hundred epochs so all of this all of" }, { "start": 4452.4800000000005, "end": 4457.28, "text": " this makes no sense to me right the student is still distilled from the" }, { "start": 4457.28, "end": 4463.8, "text": " hundred epoch teacher model yet if you train the student for 250 epochs in" }, { "start": 4463.8, "end": 4469, "text": " self distillation and then build an ensemble of these students from that" }, { "start": 4469, "end": 4474.08, "text": " same teacher model and you compare that to an ensemble of teachers that have all" }, { "start": 4474.08, "end": 4482.28, "text": " been trained for longer for 250 epochs which you know should out it the 250" }, { "start": 4482.28, "end": 4487.88, "text": " epochs generally outperforms the hundred epochs models still they are the same" }, { "start": 4487.88, "end": 4495, "text": " this is this is pretty crazy results I I think and sort of my conclusion from" }, { "start": 4495, "end": 4502.12, "text": " this is that the ensemble effect right here is not a function of learning of" }, { "start": 4502.12, "end": 4507.88, "text": " extracting more information from the data the ensemble effect might actually" }, { "start": 4507.88, "end": 4512.4400000000005, "text": " be have something to do with the function landscape itself and kind of" }, { "start": 4512.4400000000005, "end": 4517.56, "text": " exploring different minima of the of the same function not of the same function" }, { "start": 4517.56, "end": 4523.4400000000005, "text": " but exploring different functions to describe the same phenomena and I've" }, { "start": 4523.4400000000005, "end": 4528.080000000001, "text": " also found a paper that explains the lost landscape of deep ensembles and I" }, { "start": 4528.080000000001, "end": 4532.56, "text": " will make a video on that maybe it's out already maybe it will be out after you" }, { "start": 4532.56, "end": 4538.76, "text": " see this one I I haven't decided yet which which order I'm going to release" }, { "start": 4538.76, "end": 4544.280000000001, "text": " things but this here I it's it's pretty interesting and we need like a name so" }, { "start": 4544.28, "end": 4551.24, "text": " self self ensembles are already a thing but they are always with noise and stuff" }, { "start": 4551.24, "end": 4556.48, "text": " like this so let's call them something like plain self ensembles but that that" }, { "start": 4556.48, "end": 4562.599999999999, "text": " that sounds like a good name plain self ensembles the act of self distillation a" }, { "start": 4562.599999999999, "end": 4567.44, "text": " single model into multiple models without any noise any augmentations" }, { "start": 4567.44, "end": 4573.16, "text": " anything just you run as if you were to train the model itself and then you" }, { "start": 4573.16, "end": 4579.16, "text": " build an ensemble of these models by simply averaging the log it's plain" }, { "start": 4579.16, "end": 4585.5599999999995, "text": " self ensembles alright so the plan from here is to check on like at least one" }, { "start": 4585.5599999999995, "end": 4591.28, "text": " other data set you know these these models I appreciate that I could get" }, { "start": 4591.28, "end": 4596.92, "text": " them pre trained but they're just the image net models and then kind of let" }, { "start": 4596.92, "end": 4603.24, "text": " run on C for 10 so there's no kind of guarantee that these have been you know" }, { "start": 4603.24, "end": 4609.16, "text": " tuned or anything that the learning rates or whatnot so I want to take like" }, { "start": 4609.16, "end": 4614.4400000000005, "text": " an image net model you still make sure that I don't use any like hidden" }, { "start": 4614.4400000000005, "end": 4620, "text": " information where I could cheat on the validation set but try this on at least" }, { "start": 4620, "end": 4625.58, "text": " one thing and see if that works as well if we can sort of push image net" }, { "start": 4625.58, "end": 4632.96, "text": " performance simply by doing this trick so that's the plan for now and I have" }, { "start": 4632.96, "end": 4638.5599999999995, "text": " some other ideas but I just wanted to let you know and this is sort of how" }, { "start": 4638.5599999999995, "end": 4645.88, "text": " research works I guess you have a dumb idea and it turns out to work and then" }, { "start": 4645.88, "end": 4651.08, "text": " you go on and still probably probably there is not maybe too much interesting" }, { "start": 4651.08, "end": 4655.12, "text": " things here maybe it doesn't work on image net because these models are just" }, { "start": 4655.12, "end": 4660.88, "text": " under train and this somehow made them better somehow or regularize them" }, { "start": 4660.88, "end": 4665.28, "text": " somehow that usually doesn't work there's so much that can go wrong still" }, { "start": 4665.28, "end": 4673.76, "text": " so but yeah that was it and I invite you to like check out other papers in this" }, { "start": 4673.76, "end": 4679.84, "text": " space if you want it's a pretty interesting space and with that I don't" }, { "start": 4679.84, "end": 4686.2, "text": " have much more to say yeah I hope you enjoyed this let me know what you think" }, { "start": 4686.2, "end": 4692.360000000001, "text": " of like research implementation or research process videos like this I'm" }, { "start": 4692.360000000001, "end": 4697.4400000000005, "text": " not sure what people expect like I can't make this into five minute video of like" }, { "start": 4697.4400000000005, "end": 4702.04, "text": " whoo I discovered something because then you know there's no clue of what's" }, { "start": 4702.04, "end": 4709.04, "text": " what's happening but maybe like an hour or so is also too long I'm not sure yeah" }, { "start": 4709.04, "end": 4714.32, "text": " let me know what you think and I'll see you next time bye" } ]
qFRfnIRMNlk
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
SpineNet: Learning Scale-Permuted Backbone for Recognition and Localization (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "vision", "recognition", "localization", "resnet", "resnet50", "fpn", "backbone", "permuation", "upsampling", "stride", "convolution", "convolutional neural network", "google", "spine", "spine net", "imagenet", "coco", "segmentation", "bounding box", "skip connections", "residual", "bottleneck" ]
#machinelearning #ai #google The high-level architecture of CNNs has not really changed over the years. We tend to build high-resolution low-dimensional layers first, followed by ever more coarse, but deep layers. This paper challenges this decades-old heuristic and uses neural architecture search to find an alternative, called SpineNet that employs multiple rounds of re-scaling and long-range skip connections. OUTLINE: 0:00 - Intro & Overview 1:00 - Problem Statement 2:30 - The Problem with Current Architectures 8:20 - Scale-Permuted Networks 11:40 - Neural Architecture Search 14:00 - Up- and Downsampling 19:10 - From ResNet to SpineNet 24:20 - Ablations 27:00 - My Idea: Attention Routing for CNNs 29:55 - More Experiments 34:45 - Conclusion & Comments Papers: https://arxiv.org/abs/1912.05027 Code: https://github.com/tensorflow/tpu/tree/master/models/official/detection Abstract: Convolutional neural networks typically encode an input image into a series of intermediate features with decreasing resolutions. While this structure is suited to classification tasks, it does not perform well for tasks requiring simultaneous recognition and localization (e.g., object detection). The encoder-decoder architectures are proposed to resolve this by applying a decoder network onto a backbone model designed for classification tasks. In this paper, we argue encoder-decoder architecture is ineffective in generating strong multi-scale features because of the scale-decreased backbone. We propose SpineNet, a backbone with scale-permuted intermediate features and cross-scale connections that is learned on an object detection task by Neural Architecture Search. Using similar building blocks, SpineNet models outperform ResNet-FPN models by ~3% AP at various scales while using 10-20% fewer FLOPs. In particular, SpineNet-190 achieves 52.5% AP with a MaskR-CNN detector and achieves 52.1% AP with a RetinaNet detector on COCO for a single model without test-time augmentation, significantly outperforms prior art of detectors. SpineNet can transfer to classification tasks, achieving 5% top-1 accuracy improvement on a challenging iNaturalist fine-grained dataset. Code is at: this https URL. Authors: Xianzhi Du, Tsung-Yi Lin, Pengchong Jin, Golnaz Ghiasi, Mingxing Tan, Yin Cui, Quoc V. Le, Xiaodan Song Thumbnail art by Lucas Ferreira Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at SpineNet Learning Scale-Permuted Backbone for Recognition and Localization by Xianze Du at Aal 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 tasks, 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 an image that is of the same shape, that if this is your input image, I'm just gonna quickly redraw without the labels, if this is your input image then the output image, let's say we're doing bounding boxes, the output would say something like here are bounding boxes and also the output would be cat and house. So these are the two outputs that the neural network would generate. This is some sort of a convolutional neural network because they deal with images fairly well. Now usually when we do image processing and we know this from for example image classification, so if we just have image classification just to classify here, if we just want the outputs cat or house or even just one single thing like an image net, our convolutional neural networks have a particular architecture. Namely what we do is we have the first convolutional neural net, the first layers will take the image and run these convolutional filters across them which gives you the same shape image back but then with time we scale it down. We have a max pooling or a convolution with stride 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 you have a stack of features right here because that's what your convolutional layer does and then when you scale it down you have even more feature maps so we tend to scale down the resolution of our feature maps but we tend to increase the number of feature maps right here. The reasoning behind this is if you look at these bounding boxes they don't really... sorry if you look at the labels right here the fact that there's a cat on the image shouldn't depend on the exact pixel location of the cat right so even if I scale this down a bit I'll still recognize that there's a cat somewhere it can still aggregate that information in fact I could deal with scaling this down successively up to a single pixel and that's ultimately what an image classifier does you simply have a single vector at the end with the features in it and from that you classify. So the reasoning is that as you go through the network you pick up the low level features first like here you pick up the edges and the kind of low level shapes as you go higher through the network your features become more abstract but less localized which means that it's less important where they are and that's why you look at this image through a coarser and coarser segmentation and at the end your segmentation might be something like this. Okay so we 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. Now when we do something like this bounding box classification or even per pixel classification all of a sudden it is very important where the things are right it is very important that it's this pixel and this pixel and this pixel and this pixel forming the bounding box because the more accurate you are the better your bounding box classifier you still have this right here this recognition but the localization part we can't just scale down anymore because we need to output something that's of the same size so what people have done is they've gone from this kind of from architecture that scales down because we know that works well we know the downscaling works well so we take that and then we scale up again and there is some reasoning behind this right so that's what we can do because we know this part works very well for extracting high-level features that are not that localized so our reasoning is going to be something like okay we'll force the network through this kind of bottleneck right here we'll force it to learn some high-level features we because otherwise you can just you know kind of remember the individual pixels and that won't work as well we'll force it to remember the high-level we'll force it to remember what a cat is and then it will help in the pixel segmentation to know what a cat is this is very valid assumption but it doesn't need to be the case and so there 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're a you have to segment the ear of the cat you know you can only either color an entire pixel or not so you want to gain back some of that some of those high-level features and that's what you do with skip connections and that's why these networks usually look like this now in this work the authors sort of criticize this they say why why are we doing it like this isn't there a better way to do it specifically we want to look at this part right here which is called the backbone so we assume that we have these these output layers that give you at different scales different features and what we have to do is we have to construct a backbone that somehow feeds features either you know through this direct way or through these connections right here and feeds features to this these ultimate classifiers so these classifiers will then be used to classify the bounding boxes and classify the output classes for recognition and localization this is an illustration of this on the left you see a typical backbone and they call this a scale decreased network so an example of scale decreased network on the left versus a scale permuted network on the right the width of the block indicates feature resolution and the height indicates feature dimension dotted arrows represent connections from two blocks not plotted okay so on the left you have the typical architecture you see that the the width so this is the resolution is very high and as you go through the layers that resolution gets smaller and smaller and smaller but the number of features indicated by the height gets higher and higher and higher as you go through this is your typical architecture we are looking into that say that this is not the only one what we can do is we can build any sort of backbone and here they restrict themselves they say okay in order to make it comparable in order to be you know scientifically a bit more rigorous than just building anything what we restrict ourselves are simply permutations of this so we only allow us to permute these things so all the you know this goes here and this goes here as you see and that ensures that you still have roughly the same amount of parameters now there is it sort of a parameter difference because these connections here you need to up and down sample the images and sometimes that introduces parameters but in essence you have the rough same amount of parameters and then you can really research what can we improve a network simply by rearranging its blocks because that would give evidence that this scaling down architecture isn't really the best one okay so here you can see an example of this this is what they call a scale permuted network sorry this scale permuted network right here so in a scale permuted network what you're allowed to do is you're allowed you have these blocks on the left and you're allowed to put them anywhere you want in in any in any sort of I don't want to say order but yes in any sort of order yes it's an order actually so it goes from here down if 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 okay then you're done with this block you place the next block this one here also you're allowed to have two incoming connections this one here and this one here and you place the next block and so on now how you make this you also see that there doesn't need to be like a straight linear path because there is no connection right here if you can see that so you might be wondering how do I decide which block goes where and how do I decide on which connections connect where and that is going to be the idea here to use neural architecture search so neural architecture search right now is still a fancy way of saying let's try stuff out and so what you'll do is you will initialize a reinforcement learning controller that decides on the ordering and on the connections and it has some action space and you basically let it run so it it you know proposes a couple of architectures and and then you measure all of them you train all of these architectures and you see how well they fare and then you go back to the controller that's the reward signal and so we can draw so you have an agent which builds the building plan so the agent in the agent will emit as an action a building plan like big small big small big with connections like this and like this and like this and then that will go to the environment the environment here simply takes the architecture and trains train the architecture and then the let's say the eval loss or the validation loss the validation accuracy is equal is going to be your reward signal so you simply train a reinforcement learning agent to solve this particular problem which is training this in recognition and localization on the particular data set as well as possible to basically come up with the best architecture which you know it's it's fancy and it's a bit better than trying everything out but it's not much better right now and it takes a lot of compute to run these experiments because it takes a lot of iterations of this and every iteration consists of training one of these networks fully once 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 we said every layer can receive inputs from two layers you see at the very end these are just added together okay so we have two things first of all the number of features is different you can see right over here the number of features the number of channels is different than the number of channels in the output image let's say right here so those are different and in fact they're different in both inputs and we have this method of one by one convolutions that was introduced in the original resonant paper if we do one by one convolutions it's basically a 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 up scaling or up up upping the number of feature maps you can see these one by one convolutions are employed here in various ways so because this is fairly compute intensive or so they claim what they do first is they always first go to less features so here we have a number of features which is maybe let's say this is f or sorry this is 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 one half so first we always go to one half the number of features before we do this switch here and then we have two options either so you go to one half the features and at the end you go to the number of target features so it could be if the target features are more than you currently have it could be that you first go to less features and then you go to even more features right as if you the the current one has more features than the end it's probably not as bad because you first go to less features and to even less features this is probably one of the things they did to save computation but which you can imagine that it hurts because here you simply have to you have to basically throw away half the features or you have to like linearly combine them in every step where you connect two layers to each other 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 this overlapping convolution such that the result is the same size as you started with but you can also do a bigger stride and I'm a bit over drawing this here but you can do a bigger stride such that the final resolution is smaller and you can also do this max pooling right here so the max pooling is also a way to reduce the number of of the resolution of the image so if we're bigger we can do that if we are currently smaller than the 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 in cross-scale connections yada yada yada yada yada yada yada it's important to keep the computational resampling low we introduce a scaling factor alpha we had that then we use a nearest neighbor interpolation for up sampling or a stride to three by three convolution okay so it's nearest neighbor by up sampling alright so that's that's how they up and down sample the feature maps to the correct shapes either using nearest neighbor up sampling or using multi stride convolution followed by max pooling so what does that give them now they do several different steps in this so the first architecture this resnet 50 is the original architecture and remember we're only talking about the backbone right here now in the original resnet 50 architecture you have this resnet 50 fpn and this fpn is these are called the output layers this is what then goes and classifies the bounding boxes and the labels and so on now here you can see the resnet 50 is continuously getting smaller and more features they do an intermediate step so this this right here is their final thing where they let this let this algorithm go wild and you can see that it's pretty pretty fuzzy so this RL controller finds this architecture to be the best architecture and you can see it's continuously down and up and down and sorry and up and down and there is considerable cross connections between all of these things and then here you have the you have the different output layers built into the network rather than next to the network right so these are the ones that are now the red border ones are now the features that are used for going in classifying as an intermediate step they also consider this architecture where they basically built a smaller resnet right here and then let the algorithm decide on the rest right here so it still has the same amount of parameters roughly but they can investigate what happens if we go to these to this lower if we have this structure at the beginning but then part of it we can do with our algorithm and lastly they also consider this architecture now this architecture again their algorithm has control over the whole network but there is an additional thing that the algorithm can do the algorithm can also decide to change the number of features and to change the type of block so here you can see these are all residual blocks and these are these called bottleneck blocks they're simply a different way of of doing a residual block it was introduced in the original resnet paper but the 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 percent average precision if you liberate the top part to leave it to the algorithm it's at 39 if you liberate the entire network it's at 40.7 and remember these are like roughly the same amount of parameters and then if you if you also let the network control a bit of the feature size and the type of block you get a 40.8 which is the same as before but now this one I believe has about oh yeah here we go with 10% fewer flops okay so that's that's pretty cool though remember that the left thing this is this is made by humans this is just our heuristic and the right things they are made by RL and they are you know for these particular data sets though 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 before we go to the experiments I want to state my idea right here so you get the general gist here and so another kind of coral I have with this is that you know in here you always have these single connections and here you always have these these double connections and I've looked through the experiment it seems like nowhere do they ablate or anything what what it means to only have single connections or if they so if they let the resnet run with double connections so if their controller could not switch the order but only introduce the connections they might have done this they have a lot of experiments where they do the different ablations so I would be interested what happens when you let it run on the resnet but let it have two connections per per layer is it then better or not so here the importance I'll get to my idea later the importance of scale permutation that's where they investigate how important is it that you permute the layers and that turns out to be fairly important then the importance of cross scale connections that's how they investigate here so these are these connections they say the cross scale connections play a crucial role in fusing features at different resolutions throughout the scale permuted network so that's the reasoning behind it we we take features from different 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 this is only in the things that they learned right so this model is where they fully give their model control over the ordering and connections you can see that as this forty point seven percent now if they delete the short-range connections they drop to thirty five if they delete the only the long-range they drop to even more so here you can see that these long-range connections which I guess are connections that are going across multiple blocks skipping multiple blocks these tend to be very important so you can make the case that it might be very important to fuse these things from different layers to fuse the features from different resolutions because these long-range connections tend to be important though it's one thing to say that if we just leave them away with our model if we just damage it and then let it run it it it drops in accuracy it's not entirely the same thing as to say that these are important because you don't really know what happens like if you train without them maybe you could if you train without them you could reach as good an accuracy so this graph damage investigation it has something but not I wouldn't trust it too much and yeah I think they haven't investigated what happens if they keep the resinette order but let the connections be twice but you get the general the general idea of the paper right here of of what they do now they do this with architecture search right here but here's an idea okay I propose the following you have an image right here and we are wondering here should we let it go through a layer that's wide and with less features should we let it go through a layer that's you know very many features but not as wide but we have to downscale the image or should we let it go first through something intermediate let's see it like this okay so we're wondering how should we order these blocks why can't we do all of them at the same time why can't we do this this and this okay and then in the next layer again do all of them at the same time and you you 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 your sequences or you can also make them as attention heads okay these are you 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 head so you maybe want to replicate some of those here but ultimately I would guess the attention mechanism itself isn't that much of an overhead maybe it's an overhead that you have so many in parallel yeah but you know it remains to be seen that's that's the idea yeah you heard it here first okay so they have more experiments so they also build here is where they say okay we have the spine net 49 now and we found this to work we found this to work really well this is our spine net 49 architecture cool and 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 wanted to go to a resonant 100 or a resonant 150 there you you don't have the computational resources do neural architectures imagine this Google has doesn't have the computational resources to do neural architecture search on this thing so this must be expensive or I'm just I have no idea but what they do is they kind of do a trick so here they take the the spine net 49 and they say we build a spine net 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 two in and maybe there's actually no limit to how many outgoing connections you can have and also you can also do this three times which I think is a bit of a cheap way and it kind of defeats the entire purpose right couldn't you make the exact same argument again here that maybe it's helpful to route from this block right here or maybe it's helpful that these don't have the same scale right after one another it just seems but okay so they say we found this good structure and we simply duplicate each block I'm not that big of a fan in any case so they train this and it of course outperforms everything else if you compare with kind of models of the same size so here you compare this spine net 49 to the resnet 50 and you can see there's about the same number of parameters how about it outperforms the resnet 50 pretty much and as you go up the number of parameters here the performance goes up yet again and I believe these dagger ones here are simply trained with a special schedule with here with applying stochastic depth and swish activation for a longer training schedule so you can see that not only do are these spine nets sorry of the number of parameters is here not only are the spine nets slightly smaller than the resnets they do require less flops and they reach better accuracy so you know every everything is a win here yeah so they apply this to these data sets I don't want to go you know too much into into that but in the last part they also apply this to image net so there's image classification where they basically say okay we can just go to our architecture and we can just add up all the output blocks we scale them appropriately and add up all the output blocks right here because these are good features for localization and so on and we can train it to do image classification so all of these go into a big combination classifier that does the 1000 classes of image net image classification and that also works pretty well with this network so they basically argue what they found is sort of a better image image processing network than the resnet 50 and I guess they would argue that from now on you should take this as your backbone for image classification and recognition and so on which it's entirely possible that this works better there's no particular reason why the resnet 50 should work at all right it's just a heuristic but I guess the I it remains to be to be seen whether that's generally true or just in the things they considered so you can see right here the spine net generally improving over the image net which isn't is not stated right here but it does generally improve and you can see as you go higher and higher spine net the the numbers tend to improve as well and this is already pretty respectable respectable number for image net right all right so this was it for this paper for this particular paper they do have you know two different of these object detection recognition datasets 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 to get a better model out of that and if it turns out that this model is a good model the entire community will be better off unfortunately there's no broader impact statement to tell us that also the terrorists will be able to use this for purposes but you can imagine that yourself all right that was it for me again leave a comment if you want me to change anything or have suggestions leave a like if you like the video share it out bye bye
[ { "start": 0, "end": 5.16, "text": " Hi there, today we'll look at SpineNet Learning Scale-Permuted Backbone for" }, { "start": 5.16, "end": 10.96, "text": " Recognition and Localization by Xianze Du at Aal of Google Research. On a high" }, { "start": 10.96, "end": 16.28, "text": " level this paper proposes to take current recognition and localization" }, { "start": 16.28, "end": 20.34, "text": " networks which have a CNN backbone, usually something like a ResNet, and" }, { "start": 20.34, "end": 26.6, "text": " switch up the order of the blocks in the ResNet and cross-connect them in a" }, { "start": 26.6, "end": 31.560000000000002, "text": " different way, such that they reach a higher accuracy with the new network" }, { "start": 31.560000000000002, "end": 35.36, "text": " that has the same amount of parameters or almost the same amount of parameters." }, { "start": 35.36, "end": 39.400000000000006, "text": " They then further modify this network such that it reaches that higher" }, { "start": 39.400000000000006, "end": 45.16, "text": " accuracy with less compute than the original network. So if you want to know" }, { "start": 45.16, "end": 51.160000000000004, "text": " how it's done, you know, stick around. You can help me by sharing out this video if" }, { "start": 51.160000000000004, "end": 55.44, "text": " you liked it, if you didn't like it, leave a comment and tell me what you didn't" }, { "start": 55.44, "end": 61.519999999999996, "text": " like, otherwise I have no chance of improving. So that's the deal, okay? Cool." }, { "start": 61.519999999999996, "end": 67.75999999999999, "text": " So the task here is a recognition and localization as you can see here, which" }, { "start": 67.75999999999999, "end": 72.92, "text": " basically means that you have an image and there's stuff on the image. Maybe" }, { "start": 72.92, "end": 78.2, "text": " there's a cat right here and maybe there is some kind of a house right here. And" }, { "start": 78.2, "end": 84.66, "text": " the tasks, these tasks come in various forms, but some of the tasks are to say" }, { "start": 84.66, "end": 92.47999999999999, "text": " what's on the image, so in this case cat and house, and also where is it? Now this" }, { "start": 92.47999999999999, "end": 96.12, "text": " could be a point, this could be a bounding box, or this could actually be a" }, { "start": 96.12, "end": 103.32, "text": " pixel segmentation. All of this sort of tasks exists in various forms. What" }, { "start": 103.32, "end": 110.75999999999999, "text": " usually is done in these tasks is you want to go in some way through a neural" }, { "start": 110.76, "end": 116.2, "text": " network and the neural network will output the same image again or the same" }, { "start": 116.2, "end": 121.74000000000001, "text": " shape. So it will output an image that is of the same shape, that if this is your" }, { "start": 121.74000000000001, "end": 128.04000000000002, "text": " input image, I'm just gonna quickly redraw without the labels, if this is" }, { "start": 128.04000000000002, "end": 132.04000000000002, "text": " your input image then the output image, let's say we're doing bounding boxes, the" }, { "start": 132.04000000000002, "end": 138.12, "text": " output would say something like here are bounding boxes and also the output would" }, { "start": 138.12, "end": 145.36, "text": " be cat and house. So these are the two outputs that the neural network would" }, { "start": 145.36, "end": 149.56, "text": " generate. This is some sort of a convolutional neural network because" }, { "start": 149.56, "end": 156.24, "text": " they deal with images fairly well. Now usually when we do image processing and" }, { "start": 156.24, "end": 160.12, "text": " we know this from for example image classification, so if we just have image" }, { "start": 160.12, "end": 167.36, "text": " classification just to classify here, if we just want the outputs cat or house or" }, { "start": 167.36, "end": 172.32000000000002, "text": " even just one single thing like an image net, our convolutional neural networks" }, { "start": 172.32000000000002, "end": 177.48000000000002, "text": " have a particular architecture. Namely what we do is we have the first" }, { "start": 177.48000000000002, "end": 184, "text": " convolutional neural net, the first layers will take the image and run these" }, { "start": 184, "end": 190.56, "text": " convolutional filters across them which gives you the same shape image back but" }, { "start": 190.56, "end": 195.32000000000002, "text": " then with time we scale it down. We have a max pooling or a convolution with" }, { "start": 195.32, "end": 201.72, "text": " stride 2 so that the image is only this big anymore and then we have a bunch of" }, { "start": 201.72, "end": 207.64, "text": " further layers and then we scale it down again and so on. Now as we scale it down" }, { "start": 207.64, "end": 211.16, "text": " the number of channels goes up. Of course at the beginning you have three channels" }, { "start": 211.16, "end": 214.4, "text": " for the three colors but then after the first convolution you might have" }, { "start": 214.4, "end": 219.72, "text": " whatever 32 channels right here. This is no longer the original image, this now is" }, { "start": 219.72, "end": 225.32, "text": " of course for each pixel you have a stack of features right you have a stack" }, { "start": 225.32, "end": 231.52, "text": " of features right here because that's what your convolutional layer does and" }, { "start": 231.52, "end": 237.16, "text": " then when you scale it down you have even more feature maps so we tend to" }, { "start": 237.16, "end": 243, "text": " scale down the resolution of our feature maps but we tend to increase the number" }, { "start": 243, "end": 247.92, "text": " of feature maps right here. The reasoning behind this is if you look at these" }, { "start": 247.92, "end": 253.83999999999997, "text": " bounding boxes they don't really... sorry if you look at the labels" }, { "start": 253.83999999999997, "end": 259.32, "text": " right here the fact that there's a cat on the image shouldn't depend on the exact" }, { "start": 259.32, "end": 264.36, "text": " pixel location of the cat right so even if I scale this down a bit I'll still" }, { "start": 264.36, "end": 268.68, "text": " recognize that there's a cat somewhere it can still aggregate that information" }, { "start": 268.68, "end": 273.12, "text": " in fact I could deal with scaling this down" }, { "start": 273.12, "end": 278.4, "text": " successively up to a single pixel and that's ultimately what an image classifier" }, { "start": 278.4, "end": 283.2, "text": " does you simply have a single vector at the end with the features in it and from" }, { "start": 283.2, "end": 288.76, "text": " that you classify. So the reasoning is that as you go through the network you" }, { "start": 288.76, "end": 294.36, "text": " pick up the low level features first like here you pick up the edges and the" }, { "start": 294.36, "end": 300.76, "text": " kind of low level shapes as you go higher through the network your features" }, { "start": 300.76, "end": 305.52, "text": " become more abstract but less localized which means that it's less important" }, { "start": 305.52, "end": 310.56, "text": " where they are and that's why you look at this image through a coarser and" }, { "start": 310.56, "end": 314.96, "text": " coarser segmentation and at the end your segmentation might be something like" }, { "start": 314.96, "end": 322.28, "text": " this. Okay so we have had a lot of success building image classifiers with" }, { "start": 322.28, "end": 326.03999999999996, "text": " this reasoning and this is sort of a human heuristic that just has worked" }, { "start": 326.04, "end": 333.6, "text": " well. Now when we do something like this bounding box classification or even per" }, { "start": 333.6, "end": 338.8, "text": " pixel classification all of a sudden it is very important where the things are" }, { "start": 338.8, "end": 342.84000000000003, "text": " right it is very important that it's this pixel and this pixel and this pixel" }, { "start": 342.84000000000003, "end": 347.04, "text": " and this pixel forming the bounding box because the more accurate you are the" }, { "start": 347.04, "end": 350.84000000000003, "text": " better your bounding box classifier you still have this right here this" }, { "start": 350.84, "end": 356.4, "text": " recognition but the localization part we can't just scale down anymore because" }, { "start": 356.4, "end": 360.2, "text": " we need to output something that's of the same size so what people have done" }, { "start": 360.2, "end": 366.76, "text": " is they've gone from this kind of from architecture that scales down because we" }, { "start": 366.76, "end": 371.28, "text": " know that works well we know the downscaling works well so we take that" }, { "start": 371.28, "end": 377.71999999999997, "text": " and then we scale up again and there is some reasoning behind this right so" }, { "start": 377.72, "end": 382.72, "text": " that's what we can do because we know this part works very well for" }, { "start": 382.72, "end": 387.32000000000005, "text": " extracting high-level features that are not that localized so our reasoning is" }, { "start": 387.32000000000005, "end": 391.48, "text": " going to be something like okay we'll force the network through this kind of" }, { "start": 391.48, "end": 396.8, "text": " bottleneck right here we'll force it to learn some high-level features we because" }, { "start": 396.8, "end": 400.56, "text": " otherwise you can just you know kind of remember the individual pixels and that" }, { "start": 400.56, "end": 404.44000000000005, "text": " won't work as well we'll force it to remember the high-level we'll force it" }, { "start": 404.44, "end": 410.84, "text": " to remember what a cat is and then it will help in the pixel segmentation to" }, { "start": 410.84, "end": 417.68, "text": " know what a cat is this is very valid assumption but it doesn't need to be the" }, { "start": 417.68, "end": 422.8, "text": " case and so there is one additional thing that these networks usually do is" }, { "start": 422.8, "end": 425.88, "text": " that they have like some skip connections here from the layers that" }, { "start": 425.88, "end": 430.24, "text": " are of the same size to the layers that are of the same size right here to here" }, { "start": 430.24, "end": 434.2, "text": " in order to kind of recover these high-level features because if you only" }, { "start": 434.2, "end": 439.32, "text": " look at an image through the lens of this right here and you're a you have to" }, { "start": 439.32, "end": 443.92, "text": " segment the ear of the cat you know you can only either color an entire pixel or" }, { "start": 443.92, "end": 449.36, "text": " not so you want to gain back some of that some of those high-level features" }, { "start": 449.36, "end": 452.4, "text": " and that's what you do with skip connections and that's why these" }, { "start": 452.4, "end": 458.96, "text": " networks usually look like this now in this work the authors sort of criticize" }, { "start": 458.96, "end": 463.68, "text": " this they say why why are we doing it like this isn't there a better way to do" }, { "start": 463.68, "end": 468.52, "text": " it specifically we want to look at this part right here which is called the" }, { "start": 468.52, "end": 474.08, "text": " backbone so we assume that we have these these output layers that give you at" }, { "start": 474.08, "end": 479.04, "text": " different scales different features and what we have to do is we have to" }, { "start": 479.04, "end": 484.32, "text": " construct a backbone that somehow feeds features either you know through this" }, { "start": 484.32, "end": 489.24, "text": " direct way or through these connections right here and feeds features to this" }, { "start": 489.24, "end": 494.16, "text": " these ultimate classifiers so these classifiers will then be used to" }, { "start": 494.16, "end": 499.76, "text": " classify the bounding boxes and classify the output classes for" }, { "start": 499.76, "end": 506.76, "text": " recognition and localization this is an illustration of this on the left you see" }, { "start": 506.76, "end": 513.76, "text": " a typical backbone and they call this a scale decreased network so an example of" }, { "start": 513.76, "end": 518.28, "text": " scale decreased network on the left versus a scale permuted network on the" }, { "start": 518.28, "end": 522.48, "text": " right the width of the block indicates feature resolution and the height" }, { "start": 522.48, "end": 527.04, "text": " indicates feature dimension dotted arrows represent connections from two" }, { "start": 527.04, "end": 531.0799999999999, "text": " blocks not plotted okay so on the left you have the typical architecture you" }, { "start": 531.0799999999999, "end": 538.64, "text": " see that the the width so this is the resolution is very high and as you go" }, { "start": 538.64, "end": 543.24, "text": " through the layers that resolution gets smaller and smaller and smaller but the" }, { "start": 543.24, "end": 548.32, "text": " number of features indicated by the height gets higher and higher and higher" }, { "start": 548.32, "end": 553.44, "text": " as you go through this is your typical architecture we are looking into that" }, { "start": 553.44, "end": 558.08, "text": " say that this is not the only one what we can do is we can build any sort of" }, { "start": 558.08, "end": 562.8, "text": " backbone and here they restrict themselves they say okay in order to" }, { "start": 562.8, "end": 567.44, "text": " make it comparable in order to be you know scientifically a bit more rigorous" }, { "start": 567.44, "end": 573.2, "text": " than just building anything what we restrict ourselves are simply permutations" }, { "start": 573.2, "end": 579.72, "text": " of this so we only allow us to permute these things so all the you know this" }, { "start": 579.72, "end": 585.4000000000001, "text": " goes here and this goes here as you see and that ensures that you still have" }, { "start": 585.4000000000001, "end": 589.08, "text": " roughly the same amount of parameters now there is it sort of a parameter" }, { "start": 589.08, "end": 593.9200000000001, "text": " difference because these connections here you need to up and down sample the" }, { "start": 593.92, "end": 599.68, "text": " images and sometimes that introduces parameters but in essence you have the" }, { "start": 599.68, "end": 606.04, "text": " rough same amount of parameters and then you can really research what can we" }, { "start": 606.04, "end": 610.4799999999999, "text": " improve a network simply by rearranging its blocks because that would give" }, { "start": 610.4799999999999, "end": 615.5999999999999, "text": " evidence that this scaling down architecture isn't really the best one" }, { "start": 615.5999999999999, "end": 620.76, "text": " okay so here you can see an example of this this is what they call a scale" }, { "start": 620.76, "end": 627.64, "text": " permuted network sorry this scale permuted network right here so in a" }, { "start": 627.64, "end": 632.12, "text": " scale permuted network what you're allowed to do is you're allowed you have" }, { "start": 632.12, "end": 636.2, "text": " these blocks on the left and you're allowed to put them anywhere you want in" }, { "start": 636.2, "end": 642.28, "text": " in any in any sort of I don't want to say order but yes in any sort of order" }, { "start": 642.28, "end": 648.8, "text": " yes it's an order actually so it goes from here down if this is one two three" }, { "start": 648.8, "end": 654.76, "text": " four five any block for any block you first place you first place this block" }, { "start": 654.76, "end": 660.9599999999999, "text": " you're allowed to connect it to any other block before it now here we don't" }, { "start": 660.9599999999999, "end": 665.76, "text": " see but you can see there's two incoming connections right here so we make use of" }, { "start": 665.76, "end": 669.1999999999999, "text": " more than one connection on the left you see there's always one connection" }, { "start": 669.1999999999999, "end": 675.56, "text": " between the blocks and on the right you see we allow up to two blocks to connect" }, { "start": 675.56, "end": 683.4, "text": " to a given block okay then you're done with this block you place the next block" }, { "start": 683.4, "end": 688, "text": " this one here also you're allowed to have two incoming connections this one" }, { "start": 688, "end": 693.76, "text": " here and this one here and you place the next block and so on now how you make" }, { "start": 693.76, "end": 698.3599999999999, "text": " this you also see that there doesn't need to be like a straight linear path" }, { "start": 698.3599999999999, "end": 704.1199999999999, "text": " because there is no connection right here if you can see that so you might" }, { "start": 704.12, "end": 710.28, "text": " be wondering how do I decide which block goes where and how do I decide on which" }, { "start": 710.28, "end": 718.68, "text": " connections connect where and that is going to be the idea here to use neural" }, { "start": 718.68, "end": 722.64, "text": " architecture search so neural architecture search right now is still a" }, { "start": 722.64, "end": 729.36, "text": " fancy way of saying let's try stuff out and so what you'll do is you will" }, { "start": 729.36, "end": 734.5600000000001, "text": " initialize a reinforcement learning controller that decides on the ordering" }, { "start": 734.5600000000001, "end": 739.28, "text": " and on the connections and it has some action space and you basically let it" }, { "start": 739.28, "end": 746.44, "text": " run so it it you know proposes a couple of architectures and and then you measure" }, { "start": 746.44, "end": 749.6, "text": " all of them you train all of these architectures and you see how well they" }, { "start": 749.6, "end": 753.5600000000001, "text": " fare and then you go back to the controller that's the reward signal and" }, { "start": 753.56, "end": 759.76, "text": " so we can draw so you have an agent which builds the building plan so the" }, { "start": 759.76, "end": 766, "text": " agent in the agent will emit as an action a building plan like big small" }, { "start": 766, "end": 772.7199999999999, "text": " big small big with connections like this and like this and like this and then" }, { "start": 772.7199999999999, "end": 776.9, "text": " that will go to the environment the environment here simply takes the" }, { "start": 776.9, "end": 785.1999999999999, "text": " architecture and trains train the architecture and then the let's say the" }, { "start": 785.1999999999999, "end": 792.04, "text": " eval loss or the validation loss the validation accuracy is equal is going to" }, { "start": 792.04, "end": 797.6999999999999, "text": " be your reward signal so you simply train a reinforcement learning agent to" }, { "start": 797.6999999999999, "end": 802.4399999999999, "text": " solve this particular problem which is training this in recognition and" }, { "start": 802.4399999999999, "end": 806.76, "text": " localization on the particular data set as well as possible to basically come up" }, { "start": 806.76, "end": 811.48, "text": " with the best architecture which you know it's it's fancy and it's a bit" }, { "start": 811.48, "end": 815.28, "text": " better than trying everything out but it's not much better right now and it" }, { "start": 815.28, "end": 819.24, "text": " takes a lot of compute to run these experiments because it takes a lot of" }, { "start": 819.24, "end": 823.24, "text": " iterations of this and every iteration consists of training one of these" }, { "start": 823.24, "end": 827.9399999999999, "text": " networks fully once now you can do something with like early stopping and" }, { "start": 827.9399999999999, "end": 834.9, "text": " stuff but so you get the idea this is what they what they propose and this is" }, { "start": 834.9, "end": 842.3199999999999, "text": " you know how they get better so there are a number of challenges in this" }, { "start": 842.3199999999999, "end": 850.48, "text": " namely we we said okay when you input a signal for example when you input a" }, { "start": 850.48, "end": 857.66, "text": " signal from this layer to this layer you can see that you have to shrink the" }, { "start": 857.66, "end": 864.56, "text": " resolution and you have to up the number of features and this was already sort of" }, { "start": 864.56, "end": 870.04, "text": " solved in the resonant original resonant paper but they reiterate how" }, { "start": 870.04, "end": 876.04, "text": " they do this here basically you have we have this layer and it is connected to" }, { "start": 876.04, "end": 881.68, "text": " these two layers we said every layer can receive inputs from two layers you see" }, { "start": 881.68, "end": 889.68, "text": " at the very end these are just added together okay so we have two things first" }, { "start": 889.68, "end": 894.8, "text": " of all the number of features is different you can see right over here" }, { "start": 894.8, "end": 900.12, "text": " the number of features the number of channels is different than the number of" }, { "start": 900.12, "end": 906.9599999999999, "text": " channels in the output image let's say right here so those are different and in" }, { "start": 906.9599999999999, "end": 911.8399999999999, "text": " fact they're different in both inputs and we have this method of one by one" }, { "start": 911.8399999999999, "end": 916.12, "text": " convolutions that was introduced in the original resonant paper if we do one by" }, { "start": 916.12, "end": 922.24, "text": " one convolutions it's basically a a learned transformation from a number of" }, { "start": 922.24, "end": 926.64, "text": " input channels to a number of output channels without change without doing" }, { "start": 926.64, "end": 931.76, "text": " any actual convolution operation this is simply linear operation up scaling or up" }, { "start": 931.76, "end": 937.2, "text": " up upping the number of feature maps you can see these one by one convolutions" }, { "start": 937.2, "end": 945.52, "text": " are employed here in various ways so because this is fairly compute intensive" }, { "start": 945.52, "end": 952.1999999999999, "text": " or so they claim what they do first is they always first go to less features so" }, { "start": 952.1999999999999, "end": 957.52, "text": " here we have a number of features which is maybe let's say this is f or sorry" }, { "start": 957.52, "end": 965.52, "text": " this is c0 you can see very small here maybe that there is this first we go to" }, { "start": 965.52, "end": 972, "text": " alpha times c0 and alpha is I think in the default setting it's one half so" }, { "start": 972, "end": 979.8, "text": " first we always go to one half the number of features before we do this" }, { "start": 979.8, "end": 986.24, "text": " switch here and then we have two options either so you go to one half the" }, { "start": 986.24, "end": 990.6, "text": " features and at the end you go to the number of target features so it could be" }, { "start": 990.6, "end": 995.08, "text": " if the target features are more than you currently have it could be that you" }, { "start": 995.08, "end": 1001.76, "text": " first go to less features and then you go to even more features right as if you" }, { "start": 1001.76, "end": 1007, "text": " the the current one has more features than the end it's probably not as bad" }, { "start": 1007, "end": 1010.4399999999999, "text": " because you first go to less features and to even less features this is" }, { "start": 1010.4399999999999, "end": 1015.68, "text": " probably one of the things they did to save computation but which you can" }, { "start": 1015.68, "end": 1019.36, "text": " imagine that it hurts because here you simply have to you have to basically" }, { "start": 1019.36, "end": 1024.48, "text": " throw away half the features or you have to like linearly combine them in every" }, { "start": 1024.48, "end": 1031.32, "text": " step where you connect two layers to each other you know okay so there's two" }, { "start": 1031.32, "end": 1036.56, "text": " situations first situation your current resolution here is higher than the" }, { "start": 1036.56, "end": 1043.56, "text": " target resolution in that case we can simply do a convolution with a bigger" }, { "start": 1043.56, "end": 1048.2, "text": " stride than one right if you have an image and you do a convolution usually" }, { "start": 1048.2, "end": 1052.9199999999998, "text": " you have this overlapping convolution such that the result is the same size as" }, { "start": 1052.9199999999998, "end": 1058.9199999999998, "text": " you started with but you can also do a bigger stride and I'm a bit over drawing" }, { "start": 1058.92, "end": 1064.2, "text": " this here but you can do a bigger stride such that the final resolution is" }, { "start": 1064.2, "end": 1069.76, "text": " smaller and you can also do this max pooling right here so the max pooling is" }, { "start": 1069.76, "end": 1076.04, "text": " also a way to reduce the number of of the resolution of the image so if we're" }, { "start": 1076.04, "end": 1081.96, "text": " bigger we can do that if we are currently smaller than the the target" }, { "start": 1081.96, "end": 1087.52, "text": " what we can do is we can up sample and up sample you can do by doing nearest" }, { "start": 1087.52, "end": 1094.36, "text": " neighbor or things like this you can also do a learned up sample there are" }, { "start": 1094.36, "end": 1100.8799999999999, "text": " various ways I believe here they do a nearest neighbor but I'm not sure anymore" }, { "start": 1100.8799999999999, "end": 1112.2, "text": " actually let's check it out that's here somewhere resampling in cross-scale" }, { "start": 1112.2, "end": 1118.44, "text": " connections yada yada yada yada yada yada yada it's important to keep the" }, { "start": 1118.44, "end": 1122.2, "text": " computational resampling low we introduce a scaling factor alpha we had" }, { "start": 1122.2, "end": 1128.04, "text": " that then we use a nearest neighbor interpolation for up sampling or a" }, { "start": 1128.04, "end": 1133.44, "text": " stride to three by three convolution okay so it's nearest neighbor by up" }, { "start": 1133.44, "end": 1141, "text": " sampling alright so that's that's how they up and down sample the feature maps" }, { "start": 1141, "end": 1147.08, "text": " to the correct shapes either using nearest neighbor up sampling or using" }, { "start": 1147.08, "end": 1153.6, "text": " multi stride convolution followed by max pooling so what does that give them now" }, { "start": 1153.6, "end": 1159.72, "text": " they do several different steps in this so the first architecture this resnet" }, { "start": 1159.72, "end": 1164.04, "text": " 50 is the original architecture and remember we're only talking about the" }, { "start": 1164.04, "end": 1169.48, "text": " backbone right here now in the original resnet 50 architecture you have this" }, { "start": 1169.48, "end": 1175.92, "text": " resnet 50 fpn and this fpn is these are called the output layers this is what" }, { "start": 1175.92, "end": 1184.64, "text": " then goes and classifies the bounding boxes and the labels and so on now here" }, { "start": 1184.64, "end": 1189.96, "text": " you can see the resnet 50 is continuously getting smaller and more" }, { "start": 1189.96, "end": 1198.32, "text": " features they do an intermediate step so this this right here is their final" }, { "start": 1198.32, "end": 1202.8799999999999, "text": " thing where they let this let this algorithm go wild and you can see that" }, { "start": 1202.8799999999999, "end": 1208.6799999999998, "text": " it's pretty pretty fuzzy so this RL controller finds this architecture to be" }, { "start": 1208.6799999999998, "end": 1213.76, "text": " the best architecture and you can see it's continuously down and up and down" }, { "start": 1213.76, "end": 1219.6799999999998, "text": " and sorry and up and down and there is considerable cross connections between" }, { "start": 1219.6799999999998, "end": 1224.8, "text": " all of these things and then here you have the you have the different output" }, { "start": 1224.8, "end": 1229.44, "text": " layers built into the network rather than next to the network right so these" }, { "start": 1229.44, "end": 1234.8, "text": " are the ones that are now the red border ones are now the features that are used" }, { "start": 1234.8, "end": 1240.12, "text": " for going in classifying as an intermediate step they also consider" }, { "start": 1240.12, "end": 1244.76, "text": " this architecture where they basically built a smaller resnet right here and" }, { "start": 1244.76, "end": 1251.34, "text": " then let the algorithm decide on the rest right here so it still has the same" }, { "start": 1251.34, "end": 1257.08, "text": " amount of parameters roughly but they can investigate what happens if we go to" }, { "start": 1257.08, "end": 1262.84, "text": " these to this lower if we have this structure at the beginning but then part" }, { "start": 1262.84, "end": 1269.6, "text": " of it we can do with our algorithm and lastly they also consider this" }, { "start": 1269.6, "end": 1274.56, "text": " architecture now this architecture again their algorithm has control over the" }, { "start": 1274.56, "end": 1278.54, "text": " whole network but there is an additional thing that the algorithm can do the" }, { "start": 1278.54, "end": 1283.92, "text": " algorithm can also decide to change the number of features and to change the" }, { "start": 1283.92, "end": 1289.36, "text": " type of block so here you can see these are all residual blocks and these are" }, { "start": 1289.36, "end": 1295.2, "text": " these called bottleneck blocks they're simply a different way of of doing a" }, { "start": 1295.2, "end": 1302.56, "text": " residual block it was introduced in the original resnet paper but the the" }, { "start": 1302.56, "end": 1307.8, "text": " controller can simply switch to that and that can save some computation if you go" }, { "start": 1307.8, "end": 1312.9199999999998, "text": " through these bottleneck blocks so what does that give you you can see below" }, { "start": 1312.9199999999998, "end": 1321.1599999999999, "text": " that the resnet 50 is at 37.8 percent average precision if you liberate the" }, { "start": 1321.1599999999999, "end": 1325.8, "text": " top part to leave it to the algorithm it's at 39 if you liberate the entire" }, { "start": 1325.8, "end": 1330.28, "text": " network it's at 40.7 and remember these are like roughly the same amount of" }, { "start": 1330.28, "end": 1336.96, "text": " parameters and then if you if you also let the network control a bit of the" }, { "start": 1336.96, "end": 1342.8400000000001, "text": " feature size and the type of block you get a 40.8 which is the same as before" }, { "start": 1342.8400000000001, "end": 1350.52, "text": " but now this one I believe has about oh yeah here we go with 10% fewer flops" }, { "start": 1350.52, "end": 1357.52, "text": " okay so that's that's pretty cool though remember that the left thing this is" }, { "start": 1357.52, "end": 1363.16, "text": " this is made by humans this is just our heuristic and the right things they are" }, { "start": 1363.16, "end": 1368.6000000000001, "text": " made by RL and they are you know for these particular data sets though they" }, { "start": 1368.6000000000001, "end": 1374.8400000000001, "text": " do find that generally this also transfers to image net classification but" }, { "start": 1374.8400000000001, "end": 1381.2, "text": " still this is sort of a it works well for the type of data we work with and so" }, { "start": 1381.2, "end": 1386.48, "text": " on so I don't know how much I would trust it how far we should go of building" }, { "start": 1386.48, "end": 1394.04, "text": " spine net 49 as our new backbone for every image task that we have it" }, { "start": 1394.04, "end": 1401.16, "text": " remains to be seen I believe before actually we go to the experiments before" }, { "start": 1401.16, "end": 1405.96, "text": " we go to the experiments I want to state my idea right here so you get the" }, { "start": 1405.96, "end": 1411.48, "text": " general gist here and so another kind of coral I have with this is that you know" }, { "start": 1411.48, "end": 1415.72, "text": " in here you always have these single connections and here you always have" }, { "start": 1415.72, "end": 1420.08, "text": " these these double connections and I've looked through the experiment it seems" }, { "start": 1420.08, "end": 1427.6000000000001, "text": " like nowhere do they ablate or anything what what it means to only have single" }, { "start": 1427.6000000000001, "end": 1434.72, "text": " connections or if they so if they let the resnet run with double connections" }, { "start": 1434.72, "end": 1439.4, "text": " so if their controller could not switch the order but only introduce the" }, { "start": 1439.4, "end": 1444.32, "text": " connections they might have done this they have a lot of experiments where" }, { "start": 1444.32, "end": 1450.08, "text": " they do the different ablations so I would be interested what happens when" }, { "start": 1450.08, "end": 1458.96, "text": " you let it run on the resnet but let it have two connections per per layer is it" }, { "start": 1458.96, "end": 1463.72, "text": " then better or not so here the importance I'll get to my idea later" }, { "start": 1463.72, "end": 1470.48, "text": " the importance of scale permutation that's where they investigate how" }, { "start": 1470.48, "end": 1474.96, "text": " important is it that you permute the layers and that turns out to be fairly" }, { "start": 1474.96, "end": 1483.76, "text": " important then the importance of cross scale connections that's how they" }, { "start": 1483.76, "end": 1487.56, "text": " investigate here so these are these connections they say the cross scale" }, { "start": 1487.56, "end": 1491.32, "text": " connections play a crucial role in fusing features at different resolutions" }, { "start": 1491.32, "end": 1496, "text": " throughout the scale permuted network so that's the reasoning behind it we we" }, { "start": 1496, "end": 1501.12, "text": " take features from different kind of resolutions and we can also scale up" }, { "start": 1501.12, "end": 1506.24, "text": " again and then scale down again to gain some additional features from the from" }, { "start": 1506.24, "end": 1512.28, "text": " the higher resolutions we study it's important by graph damage so either they" }, { "start": 1512.28, "end": 1517.04, "text": " remove the short-term connections or they remove the long-range connections or" }, { "start": 1517.04, "end": 1520.8, "text": " they remove both and then connect one block to the previous block via a" }, { "start": 1520.8, "end": 1525.48, "text": " sequential connection so this is only this is only in the things that they" }, { "start": 1525.48, "end": 1530.6, "text": " learned right so this model is where they fully give their model control over" }, { "start": 1530.6, "end": 1534.3600000000001, "text": " the ordering and connections you can see that as this forty point seven percent" }, { "start": 1534.3600000000001, "end": 1540.08, "text": " now if they delete the short-range connections they drop to thirty five if" }, { "start": 1540.08, "end": 1545.3600000000001, "text": " they delete the only the long-range they drop to even more so here you can see" }, { "start": 1545.3600000000001, "end": 1550.02, "text": " that these long-range connections which I guess are connections that are going" }, { "start": 1550.02, "end": 1556.48, "text": " across multiple blocks skipping multiple blocks these tend to be very important" }, { "start": 1556.48, "end": 1564.32, "text": " so you can make the case that it might be very important to fuse these things" }, { "start": 1564.32, "end": 1568.76, "text": " from different layers to fuse the features from different resolutions" }, { "start": 1568.76, "end": 1573.8, "text": " because these long-range connections tend to be important though it's one" }, { "start": 1573.8, "end": 1580.8799999999999, "text": " thing to say that if we just leave them away with our model if we just damage it" }, { "start": 1580.8799999999999, "end": 1585.96, "text": " and then let it run it it it drops in accuracy it's not entirely the same" }, { "start": 1585.96, "end": 1590.3999999999999, "text": " thing as to say that these are important because you don't really know what" }, { "start": 1590.3999999999999, "end": 1594.8, "text": " happens like if you train without them maybe you could if you train without" }, { "start": 1594.8, "end": 1600.44, "text": " them you could reach as good an accuracy so this graph damage investigation it" }, { "start": 1600.44, "end": 1607, "text": " has something but not I wouldn't trust it too much and yeah I think they haven't" }, { "start": 1607, "end": 1611.64, "text": " investigated what happens if they keep the resinette order but let the" }, { "start": 1611.64, "end": 1617.4, "text": " connections be twice but you get the general the general idea of the paper" }, { "start": 1617.4, "end": 1624.16, "text": " right here of of what they do now they do this with architecture search right" }, { "start": 1624.16, "end": 1629.96, "text": " here but here's an idea okay I propose the following you have an image right" }, { "start": 1629.96, "end": 1635.64, "text": " here and we are wondering here should we let it go through a layer that's wide" }, { "start": 1635.64, "end": 1641.4, "text": " and with less features should we let it go through a layer that's you know very" }, { "start": 1641.4, "end": 1647.88, "text": " many features but not as wide but we have to downscale the image or should we" }, { "start": 1647.88, "end": 1653.8400000000001, "text": " let it go first through something intermediate let's see it like this okay" }, { "start": 1653.8400000000001, "end": 1659.8, "text": " so we're wondering how should we order these blocks why can't we do all of" }, { "start": 1659.8, "end": 1666.68, "text": " them at the same time why can't we do this this and this okay and then in the" }, { "start": 1666.68, "end": 1676.12, "text": " next layer again do all of them at the same time and you you you can already" }, { "start": 1676.12, "end": 1681.8, "text": " see where this is going I hope I hope you can see where this is going so you" }, { "start": 1681.8, "end": 1687.12, "text": " have a routing right here and how do we do routing in modern times in deep" }, { "start": 1687.12, "end": 1694.32, "text": " learning with attention so I propose you have layers with different attention" }, { "start": 1694.32, "end": 1699.4399999999998, "text": " hey let's say these are these are now your your sequences or you can also make" }, { "start": 1699.4399999999998, "end": 1708.2399999999998, "text": " them as attention heads okay these are you these and the lower level features" }, { "start": 1708.2399999999998, "end": 1715.4399999999998, "text": " are routed to the higher level features with an attention mechanism and you do" }, { "start": 1715.44, "end": 1720.3200000000002, "text": " this layer by layer by layer so you let because what's the problem here the" }, { "start": 1720.3200000000002, "end": 1725.3600000000001, "text": " problem here is that the same data point has to go you know you find these good" }, { "start": 1725.3600000000001, "end": 1729.16, "text": " connections but the all the data points have to go through the same connections" }, { "start": 1729.16, "end": 1736.24, "text": " and it might actually be that you need different routing depending on the data" }, { "start": 1736.24, "end": 1739.76, "text": " point it might be that what this is this is good for the average data point but" }, { "start": 1739.76, "end": 1743.92, "text": " it would be much better if whenever there's a cat you take one path and" }, { "start": 1743.92, "end": 1748.5600000000002, "text": " whenever there's a dog you take a different path so this will allow for" }, { "start": 1748.5600000000002, "end": 1754.76, "text": " that you basically have the routing parameterized by an attention mechanism" }, { "start": 1754.76, "end": 1759.4, "text": " this I have no clue how much compute this would take it doesn't seem that" }, { "start": 1759.4, "end": 1763.3200000000002, "text": " outrageous because what's your sequence length here your sequence length is" }, { "start": 1763.3200000000002, "end": 1767.8400000000001, "text": " going to be the number of layers maybe and maybe times the number of feature" }, { "start": 1767.8400000000001, "end": 1772.16, "text": " maps maybe have different attention head so you maybe want to replicate some of" }, { "start": 1772.16, "end": 1778.5600000000002, "text": " those here but ultimately I would guess the attention mechanism itself isn't" }, { "start": 1778.5600000000002, "end": 1781.68, "text": " that much of an overhead maybe it's an overhead that you have so many in" }, { "start": 1781.68, "end": 1790.72, "text": " parallel yeah but you know it remains to be seen that's that's the idea yeah you" }, { "start": 1790.72, "end": 1797.88, "text": " heard it here first okay so they have more experiments so they also build" }, { "start": 1797.88, "end": 1802.8000000000002, "text": " here is where they say okay we have the spine net 49 now and we found this to" }, { "start": 1802.8000000000002, "end": 1807.16, "text": " work we found this to work really well this is our spine net 49 architecture" }, { "start": 1807.16, "end": 1811.68, "text": " cool and we want to make it bigger but I guess they didn't have the" }, { "start": 1811.68, "end": 1817.0400000000002, "text": " computational resources to run the neural architecture search for bigger" }, { "start": 1817.0400000000002, "end": 1822.16, "text": " networks this is now as about as big as a resonant 50 right but what if you" }, { "start": 1822.16, "end": 1828.68, "text": " wanted to go to a resonant 100 or a resonant 150 there you you don't have" }, { "start": 1828.68, "end": 1832.6000000000001, "text": " the computational resources do neural architectures imagine this Google has" }, { "start": 1832.6000000000001, "end": 1836.44, "text": " doesn't have the computational resources to do neural architecture" }, { "start": 1836.44, "end": 1841.8400000000001, "text": " search on this thing so this must be expensive or I'm just I have no idea" }, { "start": 1841.8400000000001, "end": 1847.88, "text": " but what they do is they kind of do a trick so here they take the the spine net" }, { "start": 1847.88, "end": 1855.5200000000002, "text": " 49 and they say we build a spine net 60 96 by simply repeating each block twice" }, { "start": 1855.5200000000002, "end": 1860.2800000000002, "text": " so all the incoming connections would go to the first block and all the outgoing" }, { "start": 1860.2800000000002, "end": 1863.8400000000001, "text": " connections would come from the second block right here you had two in and" }, { "start": 1863.8400000000001, "end": 1868, "text": " maybe there's actually no limit to how many outgoing connections you can have" }, { "start": 1868, "end": 1874.48, "text": " and also you can also do this three times which I think is a bit of a cheap" }, { "start": 1874.48, "end": 1879.4, "text": " way and it kind of defeats the entire purpose right couldn't you make the exact" }, { "start": 1879.4, "end": 1883.64, "text": " same argument again here that maybe it's helpful to route from this block right" }, { "start": 1883.64, "end": 1889.44, "text": " here or maybe it's helpful that these don't have the same scale right after" }, { "start": 1889.44, "end": 1895.44, "text": " one another it just seems but okay so they say we found this good structure" }, { "start": 1895.44, "end": 1902.64, "text": " and we simply duplicate each block I'm not that big of a fan in any case so" }, { "start": 1902.64, "end": 1906.8000000000002, "text": " they train this and it of course outperforms everything else if you" }, { "start": 1906.8000000000002, "end": 1911.0400000000002, "text": " compare with kind of models of the same size so here you compare this spine net" }, { "start": 1911.0400000000002, "end": 1917.96, "text": " 49 to the resnet 50 and you can see there's about the same number of" }, { "start": 1917.96, "end": 1925.1200000000001, "text": " parameters how about it outperforms the resnet 50 pretty much and as you go up" }, { "start": 1925.1200000000001, "end": 1930.92, "text": " the number of parameters here the performance goes up yet again and I" }, { "start": 1930.92, "end": 1936.0800000000002, "text": " believe these dagger ones here are simply trained with a special schedule" }, { "start": 1936.0800000000002, "end": 1941.64, "text": " with here with applying stochastic depth and swish activation for a longer" }, { "start": 1941.64, "end": 1948.5600000000002, "text": " training schedule so you can see that not only do are these spine nets sorry" }, { "start": 1948.5600000000002, "end": 1953.6000000000001, "text": " of the number of parameters is here not only are the spine nets slightly smaller" }, { "start": 1953.6, "end": 1961.9599999999998, "text": " than the resnets they do require less flops and they reach better accuracy so" }, { "start": 1961.9599999999998, "end": 1971.9199999999998, "text": " you know every everything is a win here yeah so they apply this to these data" }, { "start": 1971.9199999999998, "end": 1982.6, "text": " sets I don't want to go you know too much into into that but in the last" }, { "start": 1982.6, "end": 1987.08, "text": " part they also apply this to image net so there's image classification where" }, { "start": 1987.08, "end": 1992.4399999999998, "text": " they basically say okay we can just go to our architecture and we can just add" }, { "start": 1992.4399999999998, "end": 1998.08, "text": " up all the output blocks we scale them appropriately and add up all the output" }, { "start": 1998.08, "end": 2002.1999999999998, "text": " blocks right here because these are good features for localization and so on and" }, { "start": 2002.1999999999998, "end": 2007.36, "text": " we can train it to do image classification so all of these go into a" }, { "start": 2007.36, "end": 2014.3999999999999, "text": " big combination classifier that does the 1000 classes of image net image" }, { "start": 2014.3999999999999, "end": 2019.9199999999998, "text": " classification and that also works pretty well with this network so they" }, { "start": 2019.9199999999998, "end": 2025.56, "text": " basically argue what they found is sort of a better image image processing" }, { "start": 2025.56, "end": 2030.84, "text": " network than the resnet 50 and I guess they would argue that from now on you" }, { "start": 2030.84, "end": 2036.9599999999998, "text": " should take this as your backbone for image classification and recognition and" }, { "start": 2036.96, "end": 2043.76, "text": " so on which it's entirely possible that this works better there's no particular" }, { "start": 2043.76, "end": 2048.4, "text": " reason why the resnet 50 should work at all right it's just a heuristic but I" }, { "start": 2048.4, "end": 2055.2400000000002, "text": " guess the I it remains to be to be seen whether that's generally true or just in" }, { "start": 2055.2400000000002, "end": 2060.88, "text": " the things they considered so you can see right here the spine net generally" }, { "start": 2060.88, "end": 2067.52, "text": " improving over the image net which isn't is not stated right here but it does" }, { "start": 2067.52, "end": 2073, "text": " generally improve and you can see as you go higher and higher spine net the the" }, { "start": 2073, "end": 2080.4, "text": " numbers tend to improve as well and this is already pretty respectable" }, { "start": 2080.4, "end": 2087.6400000000003, "text": " respectable number for image net right all right so this was it for this paper" }, { "start": 2087.64, "end": 2093.24, "text": " for this particular paper they do have you know two different of these object" }, { "start": 2093.24, "end": 2098.4, "text": " detection recognition datasets and I invite you to check out the experiments" }, { "start": 2098.4, "end": 2101.6, "text": " more closely if you're interested in that sort of thing I was mainly" }, { "start": 2101.6, "end": 2107.08, "text": " interested in the method of doing and arranging these layers and so on it" }, { "start": 2107.08, "end": 2111.4, "text": " seems like it's a cool engineering project cool investigative project the" }, { "start": 2111.4, "end": 2115.92, "text": " experiments are done well and in the end they reach a better you know they" }, { "start": 2115.92, "end": 2121.6, "text": " achieve to get a better model out of that and if it turns out that this model" }, { "start": 2121.6, "end": 2127.44, "text": " is a good model the entire community will be better off unfortunately there's" }, { "start": 2127.44, "end": 2132.92, "text": " no broader impact statement to tell us that also the terrorists will be able to" }, { "start": 2132.92, "end": 2141.44, "text": " use this for purposes but you can imagine that yourself all right that was" }, { "start": 2141.44, "end": 2146.8, "text": " it for me again leave a comment if you want me to change anything or have" }, { "start": 2146.8, "end": 2173.84, "text": " suggestions leave a like if you like the video share it out bye bye" } ]
hAooAOFRsYc
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nlp", "natural language processing", "attention", "attention mechanism", "linear", "linear transformer", "linformer", "reformer", "idiap", "epfl", "queries", "keys", "softmax", "kernel", "routing", "inner product", "rnn", "recurrent neural network", "transformer", "bert", "autoregressive", "dimensions", "topic modeling", "language model" ]
#ai #attention #transformer #deeplearning Transformers are famous for two things: Their superior performance and their insane requirements of compute and memory. This paper reformulates the attention mechanism in terms of kernel functions and obtains a linear formulation, which reduces these requirements. Surprisingly, this formulation also surfaces an interesting connection between autoregressive transformers and RNNs. OUTLINE: 0:00 - Intro & Overview 1:35 - Softmax Attention & Transformers 8:40 - Quadratic Complexity of Softmax Attention 9:40 - Generalized Attention Mechanism 13:45 - Kernels 20:40 - Linear Attention 25:20 - Experiments 28:30 - Intuition on Linear Attention 33:55 - Connecting Autoregressive Transformers and RNNs 41:30 - Caveats with the RNN connection 46:00 - More Results & Conclusion Paper: https://arxiv.org/abs/2006.16236 Website: https://linear-transformers.com/ Code: https://github.com/idiap/fast-transformers My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM Abstract: Transformers achieve remarkable performance in several tasks but due to their quadratic complexity, with respect to the input's length, they are prohibitively slow for very long sequences. To address this limitation, we express the self-attention as a linear dot-product of kernel feature maps and make use of the associativity property of matrix products to reduce the complexity from (N2) to (N), where N is the sequence length. We show that this formulation permits an iterative implementation that dramatically accelerates autoregressive transformers and reveals their relationship to recurrent neural networks. Our linear transformers achieve similar performance to vanilla transformers and they are up to 4000x faster on autoregressive prediction of very long sequences. Authors: Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François Fleuret Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at transformers or RNNs, fast autoregressive transformers with linear attention by Angelos Kateropoulos, Aporvias, Nikolaos Papas and François Fleuret. So this paper on a high level proposes to interpret the attention mechanism in transformers in terms of a kernel function and therefore the resulting higher dimensional linear operation can be used to formulate the linear transformer which is orders of magnitude faster than a classic transformer. They also show that in the case of autoregressive transformers this makes the transformer essentially equivalent to a special kind of RNN. So yeah, that's what this paper is about and I think I have some comments to make that I haven't really seen made by others though I have to admit I also haven't really looked at many comments so I might just be telling old boring things. As always if you like content like this consider sharing it out, leave a like if you liked it, leave a comment to let me know what you think. I do read the comments and they're generally comment section is 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. Just let me know what you think. Alright, so what's the problem with transformers? 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 where I made a video about that so if you don't know what transformers are you can go look at that that should basically cover everything you need to know but there's many more transformers in the meantime there's BERT, GPT, 2GPT whatever the number is after that many sequence processing models are now transformers, many set processing models are now transformers. So this has reached a very very made a very big splash in the community. So essentially transformers come with this attention mechanism where you have an input set actually but let's consider it a sequence so a sequence of text maybe like I have an ice cream cone something like this and you want to classify the text or you want to perform language modeling. So in language modeling the problem is as follows I give you this piece of text and I ask you to predict the next piece of text. This is this was kind of the first task that these transformers were used on and this is what is called an autoregressive transformer because you always have a piece you predict the next piece and then I give you that next it give you that entire piece and then you predict the next piece yet again and so on and this autoregressive property is gonna you know come in play in this paper later but ultimately what you have in a transformer is called an attention mechanism. So an attention mechanism is the following each layer in the transformer you can imagine as having the same number of nodes kind of the same number of neurons as the sequence your 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 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 so this is a function you're going to produce three different things from that you're going to produce a key you're going to produce a query and you're going to produce a value. Now the key is you can imagine it being attached to this lower layer right here so that's the key for this this token right here that's the key the key here for that token right here it's a word piece right so the keys again are also just you know vectors vector vector the query you figuratively attach to the top layer right here so the queries they go here for each token and they are also vectors and the values will keep out of it for now so the queries and the keys define basically how you route the information and you route the information by going over each so each each you have to imagine each token right here this this half or half it needs to aggregate information from all the other tokens right so we're going through multiple layers of this and in each layer each of these tokens is aggregating information from the other tokens if we do this in multiple rounds is eventually you know the each token is aggregating information eventually each token knows about all the other tokens but how this information aggregation is done is very important for example if the token is a pronoun it would be very interested in information coming from any sort of named entity in the sentence because it very much wants to know what it is referring to right if you are a if you are the the pronoun in the sentence it is very vital that you understand which of these things you refer to so you'll start aggregating information for that and then once you know who or what you refer to then the other parts of the sentence can make use of that information so they will start requesting information from you and so layer after layer each token aggregates information from each other token so this works by let's say we're at this token right here what we're going to do is we're going to form the inner product between that vector and each of these vectors and then we're going to transfer that into a softmax which makes this into a first of all there's so we do the query together with all the keys key and then we run it through the exponential function and after that we're going to normalize it by the sum of all the exponential functions that will give us a properly normalized distribution so a histogram basically of where we are going to get our information from this is going to be the highest where the inner product right here is the highest so from this token right here and you know this is fairly fairly standard what I drew by accident is fairly standard that a token probably wants to know a lot about itself so you want to carry forward the information that you already have in this particular token that's why your inner products going to maybe align a lot with your own key so the keys and queries are learned so each token decides what kind of information it wants to advertise to the others and then also each token decides what kind of information it wants to gather from the others and the the routing then is put through a softmax function and that gives you this right here you do this for every single token so the problem with this is that every single token needs to do the inner product of its query with all the different keys and each of that has to go through the softmax and then the value that's actually aggregated are these values right here now the values are simply a transformation of the incoming values values are what's really propagated you can think of it as just like a one layer neural network ultimately you could also leave away the values people don't do this some people do the same queries and keys but the values are just a transformation of your input so the important thing is this right here this decides how you're going to aggregate the values 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 right and it also is going to require that much memory and this we're going to see this is in large part due to this softmax operation because because we have a softmax it makes the whole thing nonlinear and it being nonlinear basically means we'll have to you know store everything keep everything around and we have to recompute for each query we're going to see in this paper formulation where if we make the whole process linear then we will not have to do that so let's dive into it so here they go linear transformers they start off with saying each transformer layer is essentially this right here so this is a this is kind of a higher level of view what we viewed so far is just this part right here this is the attention routing mechanism each layer is actually wrapped in a residual connection and also a simple element wise or row wise feed forward layer but these things are usually not that much into consideration what's really hurting in the transformer if you go into very long sequences is this attention routing mechanism so the attention routing mechanism is as follows you can see right here this is the formal expression of what I described right here here you have the and notice this is an outer product so if 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 KT is going to be an n by n matrix this is X W Q W K X and this transposed right here nope yeah like this okay so this is sort of an outer product and then we're going to take the row wise softmax and that will give us for each row in this matrix so for each row in this matrix we're going to have these this distribution of how to aggregate information each row will give us basically for each of the upper level tokens for each of the outputs how we need to aggregate information from the inputs and the information that we're aggregating are these values right here now they generalize this first of all they say we can also we can write it in this form right here instead of having a softmax we can actually think of any kind of similarity function it between the queries and the keys so here you see what we want to do if we want to calculate output I here the important thing is there is no longer this is an entire matrix and we considered a row wise softmax and now we write this out into the individual elements of the output and we can we can do so we can say okay how do we obtain one element of the output we're going to calculate some sort of similarity of that particular crazy 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 they say equation three is equivalent to equation two if we substitute the similarity function with the exponential function now they go they go ahead and they go into kernels so for that you certainly to understand what a kernel is a kernel is a special kind for the purposes that we are you know looking at here a kernel is a special kind of a similarity function it needs to have some properties right here but essentially they say well this this kind of looks like a kernel and we will simply say okay here this similarity what if we use a kernel here so a kernel simply is a similarity function of two vectors if you interpret it like they have some more condition I know I know don't freak on me but the interesting properties about kernels is that if a similarity function is a kernel it means that there exists a mapping and where do we do so if K between A and B is a kernel if K is a kernel that means that there exists a similar a function Phi such that Phi such that the kernel between A and B can be expressed as a linear product between Phi of A and Phi of B transpose okay this is like this is an inner product so what it means is that this can be like a super nonlinear function a kernel for example it can be and the example often given in like machine learning classes is maybe something like this you have one dimensional data right and here is the 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 nonlinear I mean it can be a linear function but it can be very nonlinear but it is equivalent it is equivalent this means it is equivalent to a linear function in a high dimensional space now to figure out linear to figure out what this function Phi is is the big the big question of course for a couple of kernels we know the function Phi right for the quadratic kernel for example we know we just saw that Phi maps this to the vector of the coordinate and it's quadratic to its square we know for a couple of other kernels what their associated functions are but in general if it's a kernel then we can just replace it with a linear function and with with with this thing and in reverse we can just say well what we could do is we could just simply define a function Phi and basically map this into map these a and b into a higher dimensional space where this super duper nonlinear function would just become a linear function wouldn't that be much easier linear functions are much easier to work with than nonlinear functions and if we know that as long as we get the correct Phi we do exactly the same thing as the nonlinear function you know that would be helpful so there is an entire litters in the entire like decade of kernel ization and kernel ize everything kernel ized SVM s to start but then you can go way further in this and this is just the beginning and this is just a very sloppy explanation by me right here but ultimately they're saying hey instead of doing complicated nonlinear similarity function like the softmax can't we just project a and b into the higher dimensional space and then just do the linear inner product and do the same thing as the softmax and the answer is yes and no we know that for the softmax the particular Phi function that we would need would map to an infinite dimensional space usually usually this is applied in reverse it's like oh here instead usually in machine learning if they say you know we want to do this we want to map it into a high dimensional space that is linear but we we can't because these spaces are too high dimensional and therefore we find an equivalent kernel function and it's usually said well we've used an RBF kernel that corresponds to an infinite dimensional space and so on that's pretty cool here it's the reverse here it's we want to do we want the linear function we 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 their inner product such that the similarity function in this higher dimensional space is an inner product then we can write it as just this inner product right here explicitly and then because of the associativity you can see that here is an eye and here there is no eye so we can just sort of pull this out of this sum and as well right here it doesn't don't don't cross this away these are vectors right but you can see especially here you can see pretty clear why is there a cursor stop you can see that this here you have to pay attention to the matrix dimension so if we use like bra-cat notation this is like this like this like this and like this okay so here on the bottom you see that there is an inner product so each output will be normalized by this inner product right here however the top is going to be a vector we know that you know each output is a vector so the top will aggregate these vectors right here according to this routing okay but if we write it like this you can see that what we could technically do is we could technically compute this part here once because it doesn't contain any eye so there is no eye in that part so we could just compute it once because we have these two these two layers of the attention mechanism and these K and V they just refer to this lower layer right here we could just compute that thing on the right ones that's going to give us a matrix as you can see right here from the dimensions and then we can simply take the product of that vector right here of the vector on the left with the matrix on the right and we'd be done it's one operation right instead of for each thing you know going and attending to each other and then do the softmax without the softmax we can all do this in a linear fashion so that makes it a lot easier in fact it makes the computation linear in so this is now O of n okay plus of course the the work that you have to do for mapping this into the higher dimensional space but this is also not quadratic this is done to each of these elements individually okay so this this is now as we said it's pretty easy you can calculate the matrix on the top you can actually also calculate this part right here this vector you can aggregate over the bottom and then if you go through the top it's simply a inner product with the vector of the queries and you're done and this is it in fact in matrix form you can simply write it down as one matrix multiplication seems pretty easy so the computational cost goes way down and they use the following function right here okay this is their map to the higher dimensional to the higher dimensional space so they say for our experiments that deal with smaller sequences we employ feature map that results in a positive similarity function as defined below so right here you have to pay attention you can't just pick any function but you can you can pick a lot of different functions where LU denotes the exponential linear unit activation function okay like this seems this seems fine they also say in our experimental section we show that the feature map of equation 7 performs on par with the full transformer while significantly reducing the computational memory requirements this you know it seems it seems like the the original transformer this choice of the softmax function even though it's you know powerful and can't be approximated with this trick right here it was also somewhat arbitrary I mean there is a reasoning behind it but it's also somewhat like meh 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 way down and in terms of experiments it does perform on par it seems like it has different optimization trajectory but they show that you know there is this trade-off for the reformer where you lose inaccuracy they do not experience that trade-off in the linear transformer compared to the original transformer in their particular experiments now they do their experiments sort of show that they are not on par with the original transfer like they are on par in some of the tasks but also in some of the tasks they are not on par for example this speech data set right here where they do fairly well they actually beat the bi-lstm baseline and the reformer but they do not beat the softmax transformer so there there's it is still the case that the softmax transformer is more powerful than the thing here and will give some intuition very shortly on that but the linear transformer is way faster here it's three times faster and up here it is 300 times faster and on mnist and if you go and see for 10 is 4000 times faster simply by property of the longer either sequences are that you input the much more matters the fact that the softmax transformer has a quadratic runtime whereas the linear transformer has a linear runtime and I was also surprised here to see that the reformer wasn't that much faster that's probably due to the fact that it already has like a big overhead in these hashing rounds and so on that probably is 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 ok so what's what's happening here what's happening with these with this attention and why is it different what does it makes it different from the old attention now I wanna I wanna sort of connect this to the kind of old and old the olden literature of topic modeling so if you think of the of this transformer of this attention mechanism what you'll have is a dynamic routing of information right so for each from each output token you get to look at all the input tokens if we for example select this one you get to look and you get to decide for each one how do I want to aggregate my information ok and this is what makes this quadratic from each of the output tokens you get to look at all of the input tokens and decide how you want to do that and that is can be very long nonlinear in terms of when we use the softmax and so on so that 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 input tokens here output tokens here the dimension of this map defines is how many topics there are so in you know in these topics modeling you would have things like I want to I have news articles or words and then I define like a set of topics and I'm going to assign each word to a topic and then I'm going to assign each news article to a topic and so on and then you kind of do this dimension reduction but this can be done in many ways so let's say this is a mapping to three dimensions what this does is essentially this five function decides how you're going to map each of these inputs into these three topics so you can say all this token goes here and here this one goes here and that 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 is in between representation in this higher dimensional space and we can aggregate in only a we can distribute in a linear fashion and we can aggregate in a linear fashion in and from this higher dimensional space that's sort of how how I sort of how I imagine that that okay so you get to distribute each token right here into these topics and then the the outputs they they don't see the inputs anymore right you see that in the formulation there is a sum over j so right here there is this sum over j and that means that the outputs here they don't see the different inputs as different inputs they only see the inputs through the map of the phi function so they can only see the individual dimensions of that phi function they cannot see the outputs anymore and therefore yeah therefore you don't have the dependence on the big quadratic dependence on this on this n okay however you do have a co of course now a dependence on this the 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 such that you don't have to let's say store of all of these activations that's pretty cool as well and they implemented in CUDA there is code available for the linear transformer all of this pretty pretty cool okay so the last thing they say they make the connections to RNNs now this is a bit detached from the linear transformer but because they formulated how they do they can make this connection so this now this now is valid for all transformers what they say right here but keep in mind it is valid for the original transformers in practice if you can make this mapping Phi to map to infinite dimensions which you can't but the analysis is equivalent so they say look if we write the attention mechanism like this and therefore like this what we can do is we can define these two quantities right s and z this is what we said before we can actually pre compute these quantities right here okay so that reduces to this right here if now we are looking at a autoregressive transformer and we said before what an autoregressive transformer was an autoregressive transformers you have a piece of sequence and you are tasked to predict this next thing right here now usually if you want to train this using an RNN you have to you know run your RNN input this hidden state and input that map forward the hidden state so you have to do all of this forward propagation in order to derive at this hidden at this output right here make the output and then you need to back prop through time right here there is no way to what you would like to do is you would like to say here I have a sentence I can actually make like five different training examples from that sentence so the first one is the one you just saw I just block off the last word but I can also make that training example right here right to when I just cut a second to last word and so on I can actually make all of these different training examples for language modeling from a single sentence and what I would like to do is I would like to train them all in parallel right I load my data point once I already have it why can't I just train everything at the same time like predict this from this word now predict also this from these two words and the transformers are you know very well conditioned they are very good at this basically so what a transformer can do is if you input a sequence like sorry like the thing at the bottom you can calculate the training signal for all of these different things at the same time and okay this was maybe a mistake you can calculate the training signal for all of this at the same time by using what's called causal masking in attention so if I have my attention mechanism right here let's consider it again and 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 we could attend to the input of that token right it could simply remember what that token is and then aggregate that here and then predict that so if for each token we restrict the attention to the tokens that came before it like also for this right here we restrict the attention only to go backwards then we can train all of this in parallel this is called causal masking it's usually implemented with like a mask that is like an upper diagonal and it's a bit unclear if you can attend to yours to yourself because then I guess this will become the output and you can only attend to this I don't know exactly how it is implemented but there it is usually realized with an upper triangular matrix as a mask and you apply this mask to each layer now they say that this is actually like an or an N 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 or an N where you update the s and the Z with these quantities right here and so it's like an or an N where these are the hidden states that you pass forward right and then you can formulate any transformer as an or an N that simply updates these two states but you see you need the explicit mapping of these of this kernel function you need this explicit mapping in order to be able to do this because otherwise this is here this is not going to be a linear addition it is going to be complicated you can't do it by simply remembering the past state so you need that formulation in order to be able to express it as an RNN but their analysis shows that this a transformer autoregressive is essentially an RNN and you can you can so you can make a connection in that and you can actually formulate this as an RNN which means that you can train in the transformer fashion everything at the same time but what is cool about an RNN an RNN at inference time an RNN once it has produced you know this word it can then because if you produce autoregressively you simply say hey I have this beginning of my news article please finish it so the model must output the next word and then from that sequence it must output the next word the next word and then from that the next word and so on and RNN because of the nature of simply passing forward hidden states at inference time can simply you know remember what the hidden states were input those again input the output here and go on so it's pretty fast at inference time which a transformer isn't with their formulation now if they have the explicit function Phi they can use this at inference time to be so much faster in fact on their website which I'll link of course in the in the description you can play with image generation using one of these transformers in your browser so you can simply start a transformer run in your browser that's how easy this becomes so you can see the linear transformer with causal masking you'll simply update these states right here and then pass those forward so easy and the backward pass as we said I don't want to go into the gradient calculation but they derive the gradient such that you don't have to remember these hidden states and it becomes or it is linear in or it saves a lot of more memory than before okay note so this is the last comment from my side note that this this causal masking transformers they are they are a bit of a hack in transformers and because so ultimately let's say let's say I have this sequence right here this is given and I want to predict this word right here what and okay let's make it here so I need multiple layers for this so I want to predict that next word and I have multiple layers right so I want to predict this from from the outputs right here let's say there is an output node right here I want to predict that particular word it's true that I should only be able to aggregate information from whatever was you know on the back right here but technically in a transformer it would be completely valid to say that this node right here which is let's say that's an article and it followed by a noun right would be able to attend to that one and then that one would be able to attend to that one and or sorry the output right here would be able to attend to that one this would not violate the autoregressive property right you can but you can see that in the intermediate layer this node right here is attending to a forward node now if you do things like this you can't do this trick anymore where you train everything at once because if if this connection exists that also means that if in this other training sample where this is the word to be predicted then this node could aggregate information from that node and basically cheat but the the technical autoregressive property is not violated by this connection right here and you only get this RNN formulation if you do not have these connections right so the this this hack to make the autoregressive transformers train in parallel is actually making the transformer formulation much weaker and therefore that's then equivalent to an RNN okay I it's not that transformers in general are equivalent to an RNN or at least this paper doesn't show that it's just that this hacked transformers are and I think that's an important distinction to make here rather than saying transformers are RNNs if we could only approximate the softmax in these infinite dimensions I don't think that's entirely true but it is true for the transformers the autoregressive transformers that we currently train now why is this connection so powerful it allows a token to attend to you know tokens forward of it and what does it mean to be able to 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 let's let's say this is a program right so this token is the function F and it needs the input this argument a of whatever token comes in front of it and it needs to do something conditioned on a so if a if a is one it does something if a is two it does something else right if you if you don't have if you can't input a then you can'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 and so a autoregressive transformer in this way becomes equivalent to an RNN and here is some of the output samples you know they're they're pretty pretty good though if you look at the more output samples they have here it so here this this is the linear one and you can see for example as already in this very bottom one this one right here it's the kind of all the other transformers get the slant to the right and that the the original has whereas this one is simply straight I mean I don't want it I don't want to dunk on this like these others make a lot of mistake mistakes right here but here I also saw you know all of them get that this is going to be the number three while this one is somehow making this circle in here so it is not perfect and even though it's on par where in the tasks they see you can see right here that especially in this speech recognition the original transformer right here is significantly outperforming the linear transformer which is the one in black right here in fact in all of the tasks but ultimately it might not matter because they reach you know the same they reach the same they reach the same accuracy or whatnot and the linear transformer is way way faster so I can see that this is going to be a thing that people apply I guess time will tell right I invite you to read the paper tell me what you think I might be totally wrong here with any of my formulations or my intuition about what this new attention mechanism does yeah please let me know and I'll see you next time bye bye
[ { "start": 0, "end": 5.46, "text": " Hi there, today we're looking at transformers or RNNs, fast autoregressive" }, { "start": 5.46, "end": 12.16, "text": " transformers with linear attention by Angelos Kateropoulos, Aporvias, Nikolaos Papas" }, { "start": 12.16, "end": 17.36, "text": " and François Fleuret. So this paper on a high level proposes to interpret the" }, { "start": 17.36, "end": 22.8, "text": " attention mechanism in transformers in terms of a kernel function and" }, { "start": 22.8, "end": 28.32, "text": " therefore the resulting higher dimensional linear operation can be used" }, { "start": 28.32, "end": 33.6, "text": " to formulate the linear transformer which is orders of magnitude faster than" }, { "start": 33.6, "end": 38.56, "text": " a classic transformer. They also show that in the case of autoregressive" }, { "start": 38.56, "end": 44.68, "text": " transformers this makes the transformer essentially equivalent to a special kind" }, { "start": 44.68, "end": 50.84, "text": " of RNN. So yeah, that's what this paper is about and I think I have some" }, { "start": 50.84, "end": 56.72, "text": " comments to make that I haven't really seen made by others though I have to admit" }, { "start": 56.72, "end": 62.64, "text": " I also haven't really looked at many comments so I might just be telling old" }, { "start": 62.64, "end": 67.16, "text": " boring things. As always if you like content like this consider sharing it" }, { "start": 67.16, "end": 72.44, "text": " out, leave a like if you liked it, leave a comment to let me know what you" }, { "start": 72.44, "end": 77.24, "text": " think. I do read the comments and they're generally comment section is very" }, { "start": 77.24, "end": 83.52, "text": " helpful to me and also people respond to each other. It's fairly" }, { "start": 83.52, "end": 88.44, "text": " cool to see that the community is usually very helpful to people asking" }, { "start": 88.44, "end": 95.88, "text": " questions. Just let me know what you think. Alright, so what's the problem" }, { "start": 95.88, "end": 100.84, "text": " with transformers? I've done many videos on transformers and I keep" }, { "start": 100.84, "end": 105.03999999999999, "text": " referring back to them for people who don't know what it is but there's this" }, { "start": 105.03999999999999, "end": 111.03999999999999, "text": " original paper called Attention is all you need where I made a video about" }, { "start": 111.04, "end": 114.76, "text": " that so if you don't know what transformers are you can go look at that" }, { "start": 114.76, "end": 118.08000000000001, "text": " that should basically cover everything you need to know but there's many more" }, { "start": 118.08000000000001, "end": 124.56, "text": " transformers in the meantime there's BERT, GPT, 2GPT whatever the number is" }, { "start": 124.56, "end": 131.44, "text": " after that many sequence processing models are now transformers, many set" }, { "start": 131.44, "end": 137.64000000000001, "text": " processing models are now transformers. So this has reached a very very made a" }, { "start": 137.64, "end": 142.32, "text": " very big splash in the community. So essentially transformers come with this" }, { "start": 142.32, "end": 148.35999999999999, "text": " attention mechanism where you have an input set actually but let's consider it" }, { "start": 148.35999999999999, "end": 156.76, "text": " a sequence so a sequence of text maybe like I have an ice cream cone something" }, { "start": 156.76, "end": 161.67999999999998, "text": " like this and you want to classify the text or you want to perform language" }, { "start": 161.67999999999998, "end": 167.51999999999998, "text": " modeling. So in language modeling the problem is as follows I give you this" }, { "start": 167.52, "end": 174.20000000000002, "text": " piece of text and I ask you to predict the next piece of text. This is this was" }, { "start": 174.20000000000002, "end": 179.12, "text": " kind of the first task that these transformers were used on and this is" }, { "start": 179.12, "end": 183.12, "text": " what is called an autoregressive transformer because you always have a" }, { "start": 183.12, "end": 186.96, "text": " piece you predict the next piece and then I give you that next it give you" }, { "start": 186.96, "end": 191.08, "text": " that entire piece and then you predict the next piece yet again and so on and" }, { "start": 191.08, "end": 195.16000000000003, "text": " this autoregressive property is gonna you know come in play in this paper" }, { "start": 195.16, "end": 199.56, "text": " later but ultimately what you have in a transformer is called an attention" }, { "start": 199.56, "end": 203.6, "text": " mechanism. So an attention mechanism is the following each layer in the" }, { "start": 203.6, "end": 208.68, "text": " transformer you can imagine as having the same number of nodes kind of the" }, { "start": 208.68, "end": 213.16, "text": " same number of neurons as the sequence your sequence is long. Now from this" }, { "start": 213.16, "end": 218, "text": " input sequence you're going to generate for each of these tokens you're going to" }, { "start": 218, "end": 222.84, "text": " generate three different things you're going to generate a key query in the" }, { "start": 222.84, "end": 229.08, "text": " value so in these you do from so usually this doesn't come in form of a letter" }, { "start": 229.08, "end": 232.96, "text": " right this comes in form of some kind of embedding vector and from that you're" }, { "start": 232.96, "end": 236.52, "text": " going to generate three different things I should probably use different colors" }, { "start": 236.52, "end": 242.16, "text": " for so this is a function you're going to produce three different things from" }, { "start": 242.16, "end": 246.68, "text": " that you're going to produce a key you're going to produce a query and" }, { "start": 246.68, "end": 253.8, "text": " you're going to produce a value. Now the key is you can imagine it being attached" }, { "start": 253.8, "end": 259.84000000000003, "text": " to this lower layer right here so that's the key for this this token right here" }, { "start": 259.84000000000003, "end": 265.04, "text": " that's the key the key here for that token right here it's a word piece right" }, { "start": 265.04, "end": 270.68, "text": " so the keys again are also just you know vectors vector vector the query you" }, { "start": 270.68, "end": 276.12, "text": " figuratively attach to the top layer right here so the queries they go here" }, { "start": 276.12, "end": 283.84000000000003, "text": " for each token and they are also vectors and the values will keep out of it for" }, { "start": 283.84000000000003, "end": 287.64, "text": " now so the queries and the keys define basically how you route the information" }, { "start": 287.64, "end": 295.76, "text": " and you route the information by going over each so each each you have to" }, { "start": 295.76, "end": 303.68, "text": " imagine each token right here this this half or half it needs to aggregate" }, { "start": 303.68, "end": 308.6, "text": " information from all the other tokens right so we're going through multiple" }, { "start": 308.6, "end": 314, "text": " layers of this and in each layer each of these tokens is aggregating" }, { "start": 314, "end": 319, "text": " information from the other tokens if we do this in multiple rounds is eventually" }, { "start": 319, "end": 324.84000000000003, "text": " you know the each token is aggregating information eventually each token knows" }, { "start": 324.84000000000003, "end": 329.72, "text": " about all the other tokens but how this information aggregation is done is very" }, { "start": 329.72, "end": 335.40000000000003, "text": " important for example if the token is a pronoun it would be very interested in" }, { "start": 335.40000000000003, "end": 340.36, "text": " information coming from any sort of named entity in the sentence because it" }, { "start": 340.36, "end": 345.72, "text": " very much wants to know what it is referring to right if you are a if you" }, { "start": 345.72, "end": 351.76000000000005, "text": " are the the pronoun in the sentence it is very vital that you understand which" }, { "start": 351.76000000000005, "end": 355.92, "text": " of these things you refer to so you'll start aggregating information for that" }, { "start": 355.92, "end": 362.32, "text": " and then once you know who or what you refer to then the other parts of the" }, { "start": 362.32, "end": 366, "text": " sentence can make use of that information so they will start requesting" }, { "start": 366, "end": 373.36, "text": " information from you and so layer after layer each token aggregates information" }, { "start": 373.36, "end": 379.04, "text": " from each other token so this works by let's say we're at this token right here" }, { "start": 379.04, "end": 383.24, "text": " what we're going to do is we're going to form the inner product between that" }, { "start": 383.24, "end": 389, "text": " vector and each of these vectors and then we're going to transfer that into a" }, { "start": 389, "end": 398.72, "text": " softmax which makes this into a first of all there's so we do the query together" }, { "start": 398.72, "end": 404.6, "text": " with all the keys key and then we run it through the exponential function and" }, { "start": 404.6, "end": 409.36, "text": " after that we're going to normalize it by the sum of all the exponential" }, { "start": 409.36, "end": 415.36, "text": " functions that will give us a properly normalized distribution so a histogram" }, { "start": 415.36, "end": 420.84000000000003, "text": " basically of where we are going to get our information from this is going to" }, { "start": 420.84000000000003, "end": 425.76, "text": " be the highest where the inner product right here is the highest so from this" }, { "start": 425.76, "end": 432.72, "text": " token right here and you know this is fairly fairly standard what I drew by" }, { "start": 432.72, "end": 438.36, "text": " accident is fairly standard that a token probably wants to know a lot about" }, { "start": 438.36, "end": 442.88, "text": " itself so you want to carry forward the information that you already have in" }, { "start": 442.88, "end": 446.56, "text": " this particular token that's why your inner products going to maybe align a" }, { "start": 446.56, "end": 451.04, "text": " lot with your own key so the keys and queries are learned so each token" }, { "start": 451.04, "end": 456.56, "text": " decides what kind of information it wants to advertise to the others and" }, { "start": 456.56, "end": 462.36, "text": " then also each token decides what kind of information it wants to gather from" }, { "start": 462.36, "end": 470.12, "text": " the others and the the routing then is put through a softmax function and that" }, { "start": 470.12, "end": 474.36, "text": " gives you this right here you do this for every single token so the problem" }, { "start": 474.36, "end": 480.40000000000003, "text": " with this is that every single token needs to do the inner product of its" }, { "start": 480.40000000000003, "end": 484.52000000000004, "text": " query with all the different keys and each of that has to go through the" }, { "start": 484.52000000000004, "end": 490.12, "text": " softmax and then the value that's actually aggregated are these values" }, { "start": 490.12, "end": 496.4, "text": " right here now the values are simply a transformation of the incoming values" }, { "start": 496.4, "end": 502.36, "text": " values are what's really propagated you can think of it as just like a one layer" }, { "start": 502.36, "end": 507.64, "text": " neural network ultimately you could also leave away the values people don't do" }, { "start": 507.64, "end": 512.8, "text": " this some people do the same queries and keys but the values are just a" }, { "start": 512.8, "end": 518, "text": " transformation of your input so the important thing is this right here this" }, { "start": 518, "end": 524.76, "text": " decides how you're going to aggregate the values all right so this is has a" }, { "start": 524.76, "end": 533.04, "text": " quadratic complexity so if you if you have n input tokens then this entire" }, { "start": 533.04, "end": 537.2, "text": " process will require n squared operations because you need to form the" }, { "start": 537.2, "end": 542.64, "text": " inner products between each pair of queries and keys right and it also is" }, { "start": 542.64, "end": 547.5, "text": " going to require that much memory and this we're going to see this is in large" }, { "start": 547.5, "end": 552.96, "text": " part due to this softmax operation because because we have a softmax it" }, { "start": 552.96, "end": 558.08, "text": " makes the whole thing nonlinear and it being nonlinear basically means we'll" }, { "start": 558.08, "end": 562.32, "text": " have to you know store everything keep everything around and we have to" }, { "start": 562.32, "end": 567.6, "text": " recompute for each query we're going to see in this paper formulation where if" }, { "start": 567.6, "end": 574.84, "text": " we make the whole process linear then we will not have to do that so let's dive" }, { "start": 574.84, "end": 584.8000000000001, "text": " into it so here they go linear transformers they start off with saying" }, { "start": 584.8000000000001, "end": 589.6, "text": " each transformer layer is essentially this right here so this is a this is" }, { "start": 589.6, "end": 593.24, "text": " kind of a higher level of view what we viewed so far is just this part right" }, { "start": 593.24, "end": 597.88, "text": " here this is the attention routing mechanism each layer is actually wrapped" }, { "start": 597.88, "end": 604.08, "text": " in a residual connection and also a simple element wise or row wise feed" }, { "start": 604.08, "end": 610, "text": " forward layer but these things are usually not that much into consideration" }, { "start": 610, "end": 616.6, "text": " what's really hurting in the transformer if you go into very long sequences is" }, { "start": 616.6, "end": 622.24, "text": " this attention routing mechanism so the attention routing mechanism is as" }, { "start": 622.24, "end": 626.48, "text": " follows you can see right here this is the formal expression of what I" }, { "start": 626.48, "end": 632.5600000000001, "text": " described right here here you have the and notice this is an outer product so" }, { "start": 632.56, "end": 642.1999999999999, "text": " if if I have if I have n sequence elements the Q right here are the" }, { "start": 642.1999999999999, "end": 650, "text": " queries so this transforms each of the n into a into a d-dimensional space right" }, { "start": 650, "end": 655.64, "text": " and also the keys will transform each of these into a d-dimensional space so this" }, { "start": 655.64, "end": 665.56, "text": " here is going this here is going to be a n by n matrix right this is this Q KT is" }, { "start": 665.56, "end": 674.4399999999999, "text": " going to be an n by n matrix this is X W Q W K X and this transposed right here" }, { "start": 674.4399999999999, "end": 682.56, "text": " nope yeah like this okay so this is sort of an outer product and then we're going" }, { "start": 682.56, "end": 687.8399999999999, "text": " to take the row wise softmax and that will give us for each row in this" }, { "start": 687.8399999999999, "end": 693.3199999999999, "text": " matrix so for each row in this matrix we're going to have these this" }, { "start": 693.3199999999999, "end": 698.9599999999999, "text": " distribution of how to aggregate information each row will give us" }, { "start": 698.9599999999999, "end": 704.64, "text": " basically for each of the upper level tokens for each of the outputs how we" }, { "start": 704.64, "end": 709.3599999999999, "text": " need to aggregate information from the inputs and the information that we're" }, { "start": 709.36, "end": 717.48, "text": " aggregating are these values right here now they generalize this first of all" }, { "start": 717.48, "end": 723.96, "text": " they say we can also we can write it in this form right here instead of having a" }, { "start": 723.96, "end": 729.92, "text": " softmax we can actually think of any kind of similarity function it between" }, { "start": 729.92, "end": 735.84, "text": " the queries and the keys so here you see what we want to do if we want to" }, { "start": 735.84, "end": 740.5600000000001, "text": " calculate output I here the important thing is there is no longer this is an" }, { "start": 740.5600000000001, "end": 746.36, "text": " entire matrix and we considered a row wise softmax and now we write this out" }, { "start": 746.36, "end": 754.08, "text": " into the individual elements of the output and we can we can do so we can" }, { "start": 754.08, "end": 761, "text": " say okay how do we obtain one element of the output we're going to calculate" }, { "start": 761, "end": 768.44, "text": " some sort of similarity of that particular crazy I here I here we're" }, { "start": 768.44, "end": 771.98, "text": " going to calculate some sort of similarity between the query of that" }, { "start": 771.98, "end": 778.28, "text": " particular output with all of the keys so here you can see all of the keys of" }, { "start": 778.28, "end": 783.26, "text": " the input and we're going to act and we're going to normalize right this is" }, { "start": 783.26, "end": 788.24, "text": " the normalization that happens also in the softmax and that will give us like a" }, { "start": 788.24, "end": 794.4, "text": " histogram of how we aggregate the values right here so all of this of this red" }, { "start": 794.4, "end": 798.8, "text": " stuff will give us again some sort of a histogram of how we're going to" }, { "start": 798.8, "end": 806.28, "text": " aggregate information if you look a bit like this and you know how the softmax" }, { "start": 806.28, "end": 812.32, "text": " is defined you'll see that if we plug in the exponential function for as the" }, { "start": 812.32, "end": 817.82, "text": " similarity function then you'll get back to the softmax okay they say equation" }, { "start": 817.82, "end": 822.12, "text": " three is equivalent to equation two if we substitute the similarity function" }, { "start": 822.12, "end": 830.48, "text": " with the exponential function now they go they go ahead and they go into" }, { "start": 830.48, "end": 837.5200000000001, "text": " kernels so for that you certainly to understand what a kernel is a kernel is" }, { "start": 837.5200000000001, "end": 843.44, "text": " a special kind for the purposes that we are you know looking at here a kernel is" }, { "start": 843.44, "end": 848.8000000000001, "text": " a special kind of a similarity function it needs to have some properties right" }, { "start": 848.8000000000001, "end": 854.36, "text": " here but essentially they say well this this kind of looks like a kernel and we" }, { "start": 854.36, "end": 861.0400000000001, "text": " will simply say okay here this similarity what if we use a kernel here" }, { "start": 861.0400000000001, "end": 868, "text": " so a kernel simply is a similarity function of two vectors if you" }, { "start": 868, "end": 871.48, "text": " interpret it like they have some more condition I know I know don't freak on" }, { "start": 871.48, "end": 879.4, "text": " me but the interesting properties about kernels is that if a similarity function" }, { "start": 879.4, "end": 887.6, "text": " is a kernel it means that there exists a mapping and where do we do so if K" }, { "start": 887.6, "end": 898.76, "text": " between A and B is a kernel if K is a kernel that means that there exists a" }, { "start": 898.76, "end": 907.96, "text": " similar a function Phi such that Phi such that the kernel between A and B" }, { "start": 907.96, "end": 916.72, "text": " can be expressed as a linear product between Phi of A and Phi of B transpose" }, { "start": 916.72, "end": 925.84, "text": " okay this is like this is an inner product so what it means is that this" }, { "start": 925.84, "end": 932.6800000000001, "text": " can be like a super nonlinear function a kernel for example it can be and the" }, { "start": 932.6800000000001, "end": 938.08, "text": " example often given in like machine learning classes is maybe something like" }, { "start": 938.08, "end": 943.6, "text": " this you have one dimensional data right and here is the here is zero and you" }, { "start": 943.6, "end": 949.12, "text": " have two kinds of data points you have the X's right here and you have the" }, { "start": 949.12, "end": 957.5600000000001, "text": " circles right here now I cannot classify this data linearly however however I can" }, { "start": 957.5600000000001, "end": 965.16, "text": " transform this into a higher dimensional space so my function Phi is of my" }, { "start": 965.16, "end": 973.6800000000001, "text": " function Phi of X is going to map to the vector X X squared and that will" }, { "start": 973.68, "end": 979.3599999999999, "text": " transform the data into a two-dimensional space right and the data" }, { "start": 979.3599999999999, "end": 984.4799999999999, "text": " will look something like this so it's going to the y-axis is going to be the" }, { "start": 984.4799999999999, "end": 992.12, "text": " square of the x-axis okay and like this and now I can find a linear classifier" }, { "start": 992.12, "end": 1002.8399999999999, "text": " okay so in this case right here you can see that in this higher space things" }, { "start": 1002.84, "end": 1008.96, "text": " become linear things become linearly classifiable and very similarly like" }, { "start": 1008.96, "end": 1015.88, "text": " this is you can define the similarity between things right here so the" }, { "start": 1015.88, "end": 1022.44, "text": " similarity function would be the square function right here and this would be a" }, { "start": 1022.44, "end": 1028, "text": " quadratic an example of a quadratic kernel so this function right here can" }, { "start": 1028, "end": 1033.92, "text": " be very nonlinear I mean it can be a linear function but it can be very" }, { "start": 1033.92, "end": 1038.96, "text": " nonlinear but it is equivalent it is equivalent this means it is equivalent" }, { "start": 1038.96, "end": 1046.12, "text": " to a linear function in a high dimensional space now to figure out" }, { "start": 1046.12, "end": 1055.32, "text": " linear to figure out what this function Phi is is the big the big question of" }, { "start": 1055.32, "end": 1060.84, "text": " course for a couple of kernels we know the function Phi right for the quadratic" }, { "start": 1060.84, "end": 1067.06, "text": " kernel for example we know we just saw that Phi maps this to the vector of the" }, { "start": 1067.06, "end": 1073.4399999999998, "text": " coordinate and it's quadratic to its square we know for a couple of other" }, { "start": 1073.4399999999998, "end": 1077.6399999999999, "text": " kernels what their associated functions are but in general if it's a kernel then" }, { "start": 1077.6399999999999, "end": 1083.46, "text": " we can just replace it with a linear function and with with with this thing" }, { "start": 1083.46, "end": 1091.28, "text": " and in reverse we can just say well what we could do is we could just simply" }, { "start": 1091.28, "end": 1099.76, "text": " define a function Phi and basically map this into map these a and b into a" }, { "start": 1099.76, "end": 1104.68, "text": " higher dimensional space where this super duper nonlinear function would" }, { "start": 1104.68, "end": 1108.48, "text": " just become a linear function wouldn't that be much easier linear functions are" }, { "start": 1108.48, "end": 1115.48, "text": " much easier to work with than nonlinear functions and if we know that as long as" }, { "start": 1115.48, "end": 1120.64, "text": " we get the correct Phi we do exactly the same thing as the nonlinear function you" }, { "start": 1120.64, "end": 1124.08, "text": " know that would be helpful so there is an entire litters in the entire like" }, { "start": 1124.08, "end": 1129.84, "text": " decade of kernel ization and kernel ize everything kernel ized SVM s to start" }, { "start": 1129.84, "end": 1135.6, "text": " but then you can go way further in this and this is just the beginning and this" }, { "start": 1135.6, "end": 1140.6799999999998, "text": " is just a very sloppy explanation by me right here but ultimately they're saying" }, { "start": 1140.6799999999998, "end": 1146.76, "text": " hey instead of doing complicated nonlinear similarity function like the" }, { "start": 1146.76, "end": 1153.04, "text": " softmax can't we just project a and b into the higher dimensional space and" }, { "start": 1153.04, "end": 1159.7199999999998, "text": " then just do the linear inner product and do the same thing as the softmax and" }, { "start": 1159.72, "end": 1167.2, "text": " the answer is yes and no we know that for the softmax the particular Phi" }, { "start": 1167.2, "end": 1171.84, "text": " function that we would need would map to an infinite dimensional space usually" }, { "start": 1171.84, "end": 1178.2, "text": " usually this is applied in reverse it's like oh here instead usually in machine" }, { "start": 1178.2, "end": 1182.46, "text": " learning if they say you know we want to do this we want to map it into a high" }, { "start": 1182.46, "end": 1185.84, "text": " dimensional space that is linear but we we can't because these spaces are too" }, { "start": 1185.84, "end": 1191.12, "text": " high dimensional and therefore we find an equivalent kernel function and it's" }, { "start": 1191.12, "end": 1194.6399999999999, "text": " usually said well we've used an RBF kernel that corresponds to an infinite" }, { "start": 1194.6399999999999, "end": 1198.8799999999999, "text": " dimensional space and so on that's pretty cool here it's the reverse here" }, { "start": 1198.8799999999999, "end": 1205.4399999999998, "text": " it's we want to do we want the linear function we and the equivalent of the" }, { "start": 1205.4399999999998, "end": 1210.9199999999998, "text": " softmax function is an infinite dimensional function which we can't do" }, { "start": 1210.92, "end": 1217.64, "text": " right we can't feasibly compute an infinite dimensional space explicitly so" }, { "start": 1217.64, "end": 1224.0800000000002, "text": " it's not possible to just do the equivalent thing than in a transformer" }, { "start": 1224.0800000000002, "end": 1230.1200000000001, "text": " however you can still do something else you can still use polynomial kernels you" }, { "start": 1230.1200000000001, "end": 1234.68, "text": " can still use any kind of kernels that have corresponding functions that map to" }, { "start": 1234.68, "end": 1240.8000000000002, "text": " a finite dimensional space and that's what this paper does so here they say" }, { "start": 1240.8, "end": 1246.48, "text": " if we have such a function that maps these things into a higher dimensional" }, { "start": 1246.48, "end": 1253.04, "text": " space such that their inner product such that the similarity function in this" }, { "start": 1253.04, "end": 1257.6, "text": " higher dimensional space is an inner product then we can write it as just" }, { "start": 1257.6, "end": 1261.36, "text": " this inner product right here explicitly and then because of the" }, { "start": 1261.36, "end": 1266.32, "text": " associativity you can see that here is an eye and here there is no eye so we" }, { "start": 1266.32, "end": 1272.12, "text": " can just sort of pull this out of this sum and as well right here it doesn't" }, { "start": 1272.12, "end": 1277.96, "text": " don't don't cross this away these are vectors right but you can see especially" }, { "start": 1277.96, "end": 1284.2, "text": " here you can see pretty clear why is there a cursor stop you can see that" }, { "start": 1284.2, "end": 1290.3799999999999, "text": " this here you have to pay attention to the matrix dimension so if we use like" }, { "start": 1290.38, "end": 1301.48, "text": " bra-cat notation this is like this like this like this and like this okay so" }, { "start": 1301.48, "end": 1308.24, "text": " here on the bottom you see that there is an inner product so each output will be" }, { "start": 1308.24, "end": 1314.2, "text": " normalized by this inner product right here however the top is going to be a" }, { "start": 1314.2, "end": 1320.6000000000001, "text": " vector we know that you know each output is a vector so the top will aggregate" }, { "start": 1320.6000000000001, "end": 1326.94, "text": " these vectors right here according to this routing okay but if we write it" }, { "start": 1326.94, "end": 1331, "text": " like this you can see that what we could technically do is we could technically" }, { "start": 1331, "end": 1335.92, "text": " compute this part here once because it doesn't contain any eye so there is no eye" }, { "start": 1335.92, "end": 1342.46, "text": " in that part so we could just compute it once because we have these two these two" }, { "start": 1342.46, "end": 1350.6000000000001, "text": " layers of the attention mechanism and these K and V they just refer to this" }, { "start": 1350.6000000000001, "end": 1355.76, "text": " lower layer right here we could just compute that thing on the right ones" }, { "start": 1355.76, "end": 1359.48, "text": " that's going to give us a matrix as you can see right here from the dimensions" }, { "start": 1359.48, "end": 1365.24, "text": " and then we can simply take the product of that vector right here of the vector" }, { "start": 1365.24, "end": 1369.44, "text": " on the left with the matrix on the right and we'd be done it's one operation" }, { "start": 1369.44, "end": 1376.04, "text": " right instead of for each thing you know going and attending to each other and" }, { "start": 1376.04, "end": 1381.6000000000001, "text": " then do the softmax without the softmax we can all do this in a linear fashion" }, { "start": 1381.6000000000001, "end": 1389.3600000000001, "text": " so that makes it a lot easier in fact it makes the computation linear in so this" }, { "start": 1389.3600000000001, "end": 1398, "text": " is now O of n okay plus of course the the work that you have to do for mapping" }, { "start": 1398, "end": 1402.08, "text": " this into the higher dimensional space but this is also not quadratic this is" }, { "start": 1402.08, "end": 1411, "text": " done to each of these elements individually okay so this this is now as" }, { "start": 1411, "end": 1415.6, "text": " we said it's pretty easy you can calculate the matrix on the top you can" }, { "start": 1415.6, "end": 1420.08, "text": " actually also calculate this part right here this vector you can aggregate over" }, { "start": 1420.08, "end": 1425.52, "text": " the bottom and then if you go through the top it's simply a inner product with" }, { "start": 1425.52, "end": 1431.76, "text": " the vector of the queries and you're done and this is it in fact in matrix" }, { "start": 1431.76, "end": 1439.32, "text": " form you can simply write it down as one matrix multiplication seems pretty easy" }, { "start": 1439.32, "end": 1447.68, "text": " so the computational cost goes way down and they use the following function right" }, { "start": 1447.68, "end": 1451.4, "text": " here okay this is their map to the higher" }, { "start": 1451.4, "end": 1457.68, "text": " dimensional to the higher dimensional space so they say for our experiments" }, { "start": 1457.68, "end": 1460.88, "text": " that deal with smaller sequences we employ feature map that results in a" }, { "start": 1460.88, "end": 1466.88, "text": " positive similarity function as defined below so right here you have to pay" }, { "start": 1466.88, "end": 1471.92, "text": " attention you can't just pick any function but you can you can pick a lot" }, { "start": 1471.92, "end": 1477.48, "text": " of different functions where LU denotes the exponential linear unit activation" }, { "start": 1477.48, "end": 1485.04, "text": " function okay like this seems this seems fine they also say in our experimental" }, { "start": 1485.04, "end": 1489.04, "text": " section we show that the feature map of equation 7 performs on par with the full" }, { "start": 1489.04, "end": 1493.72, "text": " transformer while significantly reducing the computational memory requirements" }, { "start": 1493.72, "end": 1499.44, "text": " this you know it seems it seems like the the original transformer this choice of" }, { "start": 1499.44, "end": 1503.24, "text": " the softmax function even though it's you know powerful and can't be" }, { "start": 1503.24, "end": 1507.84, "text": " approximated with this trick right here it was also somewhat arbitrary I mean" }, { "start": 1507.84, "end": 1513.48, "text": " there is a reasoning behind it but it's also somewhat like meh and it's entirely" }, { "start": 1513.48, "end": 1521.6, "text": " possible right that that this here is way faster so I want to jump this causal" }, { "start": 1521.6, "end": 1527.08, "text": " masking thing for now and look at the results where you can see they verify" }, { "start": 1527.08, "end": 1534.24, "text": " the fact that in terms of time in terms of GPU memory if they apply their" }, { "start": 1534.24, "end": 1539.12, "text": " transformer and here on the x-axis you see sequence length and you can see" }, { "start": 1539.12, "end": 1544.76, "text": " that the this is log plot right these are log plots you can see that the" }, { "start": 1544.76, "end": 1551.24, "text": " original transformer right here has a way steeper slope than their transformer" }, { "start": 1551.24, "end": 1557.84, "text": " which is the black line right here the blue lines are the reformers which we've" }, { "start": 1557.84, "end": 1562.08, "text": " also I've also done a video on reformer if you want to check that out that is" }, { "start": 1562.08, "end": 1567.52, "text": " also a trick that uses locality sensitive hashing to get rid of the" }, { "start": 1567.52, "end": 1574.32, "text": " quadratic attention mechanism now the locality sensitive hashing also means" }, { "start": 1574.32, "end": 1580.52, "text": " that you kind of lose some accuracy so that's the trade-off right here but you" }, { "start": 1580.52, "end": 1584.9, "text": " can see that is also linear actually it's n log n depending on the sequence" }, { "start": 1584.9, "end": 1591.6399999999999, "text": " length but the log n is negligible so you see GPU memory and time way down and" }, { "start": 1591.6399999999999, "end": 1596.56, "text": " in terms of experiments it does perform on par it seems like it has different" }, { "start": 1596.56, "end": 1600.8, "text": " optimization trajectory but they show that you know there is this trade-off" }, { "start": 1600.8, "end": 1605.72, "text": " for the reformer where you lose inaccuracy they do not experience that" }, { "start": 1605.72, "end": 1610.6000000000001, "text": " trade-off in the linear transformer compared to the original transformer in" }, { "start": 1610.6000000000001, "end": 1618.8, "text": " their particular experiments now they do their experiments sort of show that they" }, { "start": 1618.8, "end": 1624.2, "text": " are not on par with the original transfer like they are on par in some of" }, { "start": 1624.2, "end": 1629.72, "text": " the tasks but also in some of the tasks they are not on par for example this" }, { "start": 1629.72, "end": 1635.72, "text": " speech data set right here where they do fairly well they actually beat the" }, { "start": 1635.72, "end": 1641.44, "text": " bi-lstm baseline and the reformer but they do not beat the softmax transformer" }, { "start": 1641.44, "end": 1646.32, "text": " so there there's it is still the case that the softmax transformer is more" }, { "start": 1646.32, "end": 1652.16, "text": " powerful than the thing here and will give some intuition very shortly on that" }, { "start": 1652.16, "end": 1659.68, "text": " but the linear transformer is way faster here it's three times faster and up" }, { "start": 1659.68, "end": 1667.48, "text": " here it is 300 times faster and on mnist and if you go and see for 10 is 4000" }, { "start": 1667.48, "end": 1672.48, "text": " times faster simply by property of the longer either sequences are that you" }, { "start": 1672.48, "end": 1677.88, "text": " input the much more matters the fact that the softmax transformer has a" }, { "start": 1677.88, "end": 1684.28, "text": " quadratic runtime whereas the linear transformer has a linear runtime and I" }, { "start": 1684.28, "end": 1690.3999999999999, "text": " was also surprised here to see that the reformer wasn't that much faster that's" }, { "start": 1690.3999999999999, "end": 1694.72, "text": " probably due to the fact that it already has like a big overhead in these hashing" }, { "start": 1694.72, "end": 1700.92, "text": " rounds and so on that probably is is hurting it at sort of a constant level I" }, { "start": 1700.92, "end": 1705.08, "text": " guess if you were to up the sequence length even more than the reformer would" }, { "start": 1705.08, "end": 1712.84, "text": " also improve a lot more over the softmax transformer ok so what's what's" }, { "start": 1712.84, "end": 1718.08, "text": " happening here what's happening with these with this attention and why is it" }, { "start": 1718.08, "end": 1722.6799999999998, "text": " different what does it makes it different from the old attention now I" }, { "start": 1722.6799999999998, "end": 1729.1599999999999, "text": " wanna I wanna sort of connect this to the kind of old and old the olden" }, { "start": 1729.1599999999999, "end": 1735.6799999999998, "text": " literature of topic modeling so if you think of the of this transformer of this" }, { "start": 1735.6799999999998, "end": 1740.8799999999999, "text": " attention mechanism what you'll have is a dynamic routing of information right" }, { "start": 1740.88, "end": 1748.1200000000001, "text": " so for each from each output token you get to look at all the input tokens if" }, { "start": 1748.1200000000001, "end": 1752.7600000000002, "text": " we for example select this one you get to look and you get to decide for each" }, { "start": 1752.7600000000002, "end": 1757.64, "text": " one how do I want to aggregate my information ok and this is what makes" }, { "start": 1757.64, "end": 1761.0400000000002, "text": " this quadratic from each of the output tokens you get to look at all of the" }, { "start": 1761.0400000000002, "end": 1767.24, "text": " input tokens and decide how you want to do that and that is can be very long" }, { "start": 1767.24, "end": 1773.76, "text": " nonlinear in terms of when we use the softmax and so on so that what makes it" }, { "start": 1773.76, "end": 1778.28, "text": " expensive what this thing is doing is the following it takes all the keys" }, { "start": 1778.28, "end": 1783.56, "text": " right here so here we have all the keys and it's going to map them through this" }, { "start": 1783.56, "end": 1788.6, "text": " five function right each key is going to map through the five function and each" }, { "start": 1788.6, "end": 1794.24, "text": " query is also going to be mapped through the five function into these higher" }, { "start": 1794.24, "end": 1798.92, "text": " dimensional spaces and then an inner product is performed between the two and" }, { "start": 1798.92, "end": 1804.84, "text": " that decides the routing this is very similar to like topic models where if" }, { "start": 1804.84, "end": 1813.04, "text": " you interpret this this right here can be a mapping of my dimension of these" }, { "start": 1813.04, "end": 1817.16, "text": " keys and queries to the topics so essentially what's happening right here" }, { "start": 1817.16, "end": 1823.32, "text": " is for each of the input tokens sorry input tokens here output tokens here" }, { "start": 1823.32, "end": 1830.32, "text": " the dimension of this map defines is how many topics there are so in you know in" }, { "start": 1830.32, "end": 1835.56, "text": " these topics modeling you would have things like I want to I have news" }, { "start": 1835.56, "end": 1841.56, "text": " articles or words and then I define like a set of topics and I'm going to assign" }, { "start": 1841.56, "end": 1849.12, "text": " each word to a topic and then I'm going to assign each news article to a topic" }, { "start": 1849.12, "end": 1854.6799999999998, "text": " and so on and then you kind of do this dimension reduction but this can be done" }, { "start": 1854.6799999999998, "end": 1859.32, "text": " in many ways so let's say this is a mapping to three dimensions what this" }, { "start": 1859.32, "end": 1865.9599999999998, "text": " does is essentially this five function decides how you're going to map each of" }, { "start": 1865.9599999999998, "end": 1872.2399999999998, "text": " these inputs into these three topics so you can say all this token goes here and" }, { "start": 1872.24, "end": 1879.24, "text": " here this one goes here and that bit here this one goes here and so on so" }, { "start": 1879.24, "end": 1885.6, "text": " again this is a this is a mapping into a well in this case a lower dimensional" }, { "start": 1885.6, "end": 1891.48, "text": " space and then this function decides how you're going to aggregate these topics" }, { "start": 1891.48, "end": 1898.8, "text": " over across here and since this is you know this is now a linear multiplication" }, { "start": 1898.8, "end": 1902.76, "text": " between the two things so these two are going to be your matrices this here is" }, { "start": 1902.76, "end": 1910, "text": " going to be your phi of K and this here is going to be your phi of Q so you can" }, { "start": 1910, "end": 1914.72, "text": " see the difference here between the old attention mechanism and the new attention" }, { "start": 1914.72, "end": 1919.28, "text": " mechanism right the old attention mechanism each token was directly able" }, { "start": 1919.28, "end": 1924.2, "text": " to look at all the input tokens and decide how to aggregate the information" }, { "start": 1924.2, "end": 1930, "text": " and here it's sort of we have this in between is in between representation in" }, { "start": 1930, "end": 1935.6000000000001, "text": " this higher dimensional space and we can aggregate in only a we can distribute in" }, { "start": 1935.6000000000001, "end": 1940.52, "text": " a linear fashion and we can aggregate in a linear fashion in and from this" }, { "start": 1940.52, "end": 1949, "text": " higher dimensional space that's sort of how how I sort of how I imagine that" }, { "start": 1949, "end": 1954.56, "text": " that okay so you get to distribute each token right here into these topics and" }, { "start": 1954.56, "end": 1960.08, "text": " then the the outputs they they don't see the inputs anymore right you see that in" }, { "start": 1960.08, "end": 1968.6, "text": " the formulation there is a sum over j so right here there is this sum over j and" }, { "start": 1968.6, "end": 1974.28, "text": " that means that the outputs here they don't see the different inputs as" }, { "start": 1974.28, "end": 1979.48, "text": " different inputs they only see the inputs through the map of the phi function so" }, { "start": 1979.48, "end": 1983.72, "text": " they can only see the individual dimensions of that phi function they" }, { "start": 1983.72, "end": 1990.08, "text": " cannot see the outputs anymore and therefore yeah therefore you don't have" }, { "start": 1990.08, "end": 1998, "text": " the dependence on the big quadratic dependence on this on this n okay however" }, { "start": 1998, "end": 2003.36, "text": " you do have a co of course now a dependence on this the dimension of the" }, { "start": 2003.36, "end": 2007.4399999999998, "text": " intermediate representation and they also they say this right this is you" }, { "start": 2007.4399999999998, "end": 2016.62, "text": " know reasonable yeah they do derive the gradients here to save even more memory" }, { "start": 2016.62, "end": 2023.32, "text": " so you don't have to such that you don't have to let's say store of all of these" }, { "start": 2023.32, "end": 2026.9199999999998, "text": " activations that's pretty cool as well and they implemented in CUDA there is" }, { "start": 2026.9199999999998, "end": 2031.1999999999998, "text": " code available for the linear transformer all of this pretty pretty" }, { "start": 2031.2, "end": 2039.8, "text": " cool okay so the last thing they say they make the connections to RNNs now" }, { "start": 2039.8, "end": 2046.4, "text": " this is a bit detached from the linear transformer but because they formulated" }, { "start": 2046.4, "end": 2051.52, "text": " how they do they can make this connection so this now this now is valid" }, { "start": 2051.52, "end": 2057.48, "text": " for all transformers what they say right here but keep in mind it is valid for" }, { "start": 2057.48, "end": 2063.2, "text": " the original transformers in practice if you can make this mapping Phi to map to" }, { "start": 2063.2, "end": 2069.68, "text": " infinite dimensions which you can't but the analysis is equivalent so they say" }, { "start": 2069.68, "end": 2077.04, "text": " look if we write the attention mechanism like this and therefore like this what" }, { "start": 2077.04, "end": 2081.84, "text": " we can do is we can define these two quantities right s and z this is what we" }, { "start": 2081.84, "end": 2087.88, "text": " said before we can actually pre compute these quantities right here okay so that" }, { "start": 2087.88, "end": 2095.92, "text": " reduces to this right here if now we are looking at a autoregressive transformer" }, { "start": 2095.92, "end": 2099.04, "text": " and we said before what an autoregressive transformer was an" }, { "start": 2099.04, "end": 2102.8, "text": " autoregressive transformers you have a piece of sequence and you are tasked to" }, { "start": 2102.8, "end": 2109.8, "text": " predict this next thing right here now usually if you want to train this using" }, { "start": 2109.8, "end": 2116.88, "text": " an RNN you have to you know run your RNN input this hidden state and input that" }, { "start": 2116.88, "end": 2122.28, "text": " map forward the hidden state so you have to do all of this forward propagation in" }, { "start": 2122.28, "end": 2126.5600000000004, "text": " order to derive at this hidden at this output right here make the output and" }, { "start": 2126.5600000000004, "end": 2133.1200000000003, "text": " then you need to back prop through time right here there is no way to what you" }, { "start": 2133.1200000000003, "end": 2137.1200000000003, "text": " would like to do is you would like to say here I have a sentence I can" }, { "start": 2137.12, "end": 2141.8399999999997, "text": " actually make like five different training examples from that sentence so" }, { "start": 2141.8399999999997, "end": 2147.08, "text": " the first one is the one you just saw I just block off the last word but I can" }, { "start": 2147.08, "end": 2153.88, "text": " also make that training example right here right to when I just cut a second" }, { "start": 2153.88, "end": 2157.3199999999997, "text": " to last word and so on I can actually make all of these different training" }, { "start": 2157.3199999999997, "end": 2161.72, "text": " examples for language modeling from a single sentence and what I would like to" }, { "start": 2161.72, "end": 2166.7999999999997, "text": " do is I would like to train them all in parallel right I load my data point once" }, { "start": 2166.8, "end": 2171.46, "text": " I already have it why can't I just train everything at the same time like" }, { "start": 2171.46, "end": 2176.92, "text": " predict this from this word now predict also this from these two words and the" }, { "start": 2176.92, "end": 2185.1600000000003, "text": " transformers are you know very well conditioned they are very good at this" }, { "start": 2185.1600000000003, "end": 2192.76, "text": " basically so what a transformer can do is if you input a sequence like sorry" }, { "start": 2192.76, "end": 2199.2000000000003, "text": " like the thing at the bottom you can calculate the training signal for all of" }, { "start": 2199.2000000000003, "end": 2205, "text": " these different things at the same time and okay this was maybe a mistake you" }, { "start": 2205, "end": 2209.88, "text": " can calculate the training signal for all of this at the same time by using" }, { "start": 2209.88, "end": 2215.5200000000004, "text": " what's called causal masking in attention so if I have my attention" }, { "start": 2215.5200000000004, "end": 2220.48, "text": " mechanism right here let's consider it again and let's consider these two" }, { "start": 2220.48, "end": 2224.64, "text": " layers if I have my attention mechanism what I want to do is I want to" }, { "start": 2224.64, "end": 2229.48, "text": " constrain each token to only attend to tokens that came before it in the" }, { "start": 2229.48, "end": 2234.08, "text": " sequence so for example this token right here I'm going to constrain it to only" }, { "start": 2234.08, "end": 2244.2, "text": " attend to itself and the past because it will it will predict the next token in" }, { "start": 2244.2, "end": 2248.28, "text": " the sequence and it would be it would be really easy if we could attend to the" }, { "start": 2248.28, "end": 2253.32, "text": " input of that token right it could simply remember what that token is" }, { "start": 2253.32, "end": 2259.28, "text": " and then aggregate that here and then predict that so if for each token we" }, { "start": 2259.28, "end": 2265, "text": " restrict the attention to the tokens that came before it like also for this" }, { "start": 2265, "end": 2270.6400000000003, "text": " right here we restrict the attention only to go backwards then we can train" }, { "start": 2270.6400000000003, "end": 2274.5600000000004, "text": " all of this in parallel this is called causal masking it's usually implemented" }, { "start": 2274.56, "end": 2280.44, "text": " with like a mask that is like an upper diagonal and it's a bit unclear if you" }, { "start": 2280.44, "end": 2285.04, "text": " can attend to yours to yourself because then I guess this will become the output" }, { "start": 2285.04, "end": 2289.56, "text": " and you can only attend to this I don't know exactly how it is implemented but" }, { "start": 2289.56, "end": 2296.2799999999997, "text": " there it is usually realized with an upper triangular matrix as a mask and" }, { "start": 2296.28, "end": 2305.6800000000003, "text": " you apply this mask to each layer now they say that this is actually like an" }, { "start": 2305.6800000000003, "end": 2310.44, "text": " or an N and with their formulation you can make this pretty explicit namely" }, { "start": 2310.44, "end": 2317.7200000000003, "text": " you have these two states s and a Z and in each sequence element it's actually" }, { "start": 2317.7200000000003, "end": 2324.4, "text": " like an or an N where you update the s and the Z with these quantities right" }, { "start": 2324.4, "end": 2330.6800000000003, "text": " here and so it's like an or an N where these are the hidden states that you" }, { "start": 2330.6800000000003, "end": 2336.7200000000003, "text": " pass forward right and then you can formulate any transformer as an or an N" }, { "start": 2336.7200000000003, "end": 2342.84, "text": " that simply updates these two states but you see you need the explicit mapping of" }, { "start": 2342.84, "end": 2349.4, "text": " these of this kernel function you need this explicit mapping in order to be" }, { "start": 2349.4, "end": 2353.4, "text": " able to do this because otherwise this is here this is not going to be a" }, { "start": 2353.4, "end": 2359.1600000000003, "text": " linear addition it is going to be complicated you can't do it by simply" }, { "start": 2359.1600000000003, "end": 2364, "text": " remembering the past state so you need that formulation in order to be able to" }, { "start": 2364, "end": 2369.3, "text": " express it as an RNN but their analysis shows that this a transformer" }, { "start": 2369.3, "end": 2375.12, "text": " autoregressive is essentially an RNN and you can you can so you can make a" }, { "start": 2375.12, "end": 2381.7200000000003, "text": " connection in that and you can actually formulate this as an RNN which means" }, { "start": 2381.72, "end": 2387.12, "text": " that you can train in the transformer fashion everything at the same time but" }, { "start": 2387.12, "end": 2392.9599999999996, "text": " what is cool about an RNN an RNN at inference time an RNN once it has" }, { "start": 2392.9599999999996, "end": 2399.3599999999997, "text": " produced you know this word it can then because if you produce autoregressively" }, { "start": 2399.3599999999997, "end": 2404.64, "text": " you simply say hey I have this beginning of my news article please finish it so" }, { "start": 2404.64, "end": 2409.72, "text": " the model must output the next word and then from that sequence it must output" }, { "start": 2409.72, "end": 2413.52, "text": " the next word the next word and then from that the next word and so on and" }, { "start": 2413.52, "end": 2418.12, "text": " RNN because of the nature of simply passing forward hidden states at" }, { "start": 2418.12, "end": 2422.12, "text": " inference time can simply you know remember what the hidden states were" }, { "start": 2422.12, "end": 2427.72, "text": " input those again input the output here and go on so it's pretty fast at" }, { "start": 2427.72, "end": 2434.16, "text": " inference time which a transformer isn't with their formulation now if they have" }, { "start": 2434.16, "end": 2439.8799999999997, "text": " the explicit function Phi they can use this at inference time to be so much" }, { "start": 2439.8799999999997, "end": 2444.24, "text": " faster in fact on their website which I'll link of course in the in the" }, { "start": 2444.24, "end": 2449.08, "text": " description you can play with image generation using one of these" }, { "start": 2449.08, "end": 2454.8399999999997, "text": " transformers in your browser so you can simply start a transformer run in your" }, { "start": 2454.8399999999997, "end": 2462.12, "text": " browser that's how easy this becomes so you can see the linear transformer with" }, { "start": 2462.12, "end": 2467.7599999999998, "text": " causal masking you'll simply update these states right here and then pass" }, { "start": 2467.7599999999998, "end": 2474.52, "text": " those forward so easy and the backward pass as we said I don't want to go into" }, { "start": 2474.52, "end": 2479, "text": " the gradient calculation but they derive the gradient such that you don't have to" }, { "start": 2479, "end": 2486.08, "text": " remember these hidden states and it becomes or it is linear in or it saves" }, { "start": 2486.08, "end": 2493.48, "text": " a lot of more memory than before okay note so this is the last comment from my" }, { "start": 2493.48, "end": 2501.36, "text": " side note that this this causal masking transformers they are they are a bit of" }, { "start": 2501.36, "end": 2509.92, "text": " a hack in transformers and because so ultimately let's say let's say I have" }, { "start": 2509.92, "end": 2517.36, "text": " this sequence right here this is given and I want to predict this word right" }, { "start": 2517.36, "end": 2524.44, "text": " here what and okay let's make it here so I need multiple layers for this so I" }, { "start": 2524.44, "end": 2530.44, "text": " want to predict that next word and I have multiple layers right so I want to" }, { "start": 2530.44, "end": 2535.4, "text": " predict this from from the outputs right here let's say there is an output node" }, { "start": 2535.4, "end": 2541.88, "text": " right here I want to predict that particular word it's true that I should" }, { "start": 2541.88, "end": 2547, "text": " only be able to aggregate information from whatever was you know on the back" }, { "start": 2547, "end": 2552.7200000000003, "text": " right here but technically in a transformer it would be completely valid" }, { "start": 2552.7200000000003, "end": 2558.96, "text": " to say that this node right here which is let's say that's an article and it" }, { "start": 2558.96, "end": 2564.6, "text": " followed by a noun right would be able to attend to that one and then that one" }, { "start": 2564.6, "end": 2570.04, "text": " would be able to attend to that one and or sorry the output right here would be" }, { "start": 2570.04, "end": 2574.64, "text": " able to attend to that one this would not violate the autoregressive property" }, { "start": 2574.64, "end": 2580.4, "text": " right you can but you can see that in the intermediate layer this node right" }, { "start": 2580.4, "end": 2586.6, "text": " here is attending to a forward node now if you do things like this you can't do" }, { "start": 2586.6, "end": 2592.8399999999997, "text": " this trick anymore where you train everything at once because if if this" }, { "start": 2592.84, "end": 2598.76, "text": " connection exists that also means that if in this other training sample where" }, { "start": 2598.76, "end": 2603.7200000000003, "text": " this is the word to be predicted then this node could aggregate information" }, { "start": 2603.7200000000003, "end": 2609.6400000000003, "text": " from that node and basically cheat but the the technical autoregressive" }, { "start": 2609.6400000000003, "end": 2615.76, "text": " property is not violated by this connection right here and you only get" }, { "start": 2615.76, "end": 2621.1600000000003, "text": " this RNN formulation if you do not have these connections right so the this this" }, { "start": 2621.16, "end": 2625.12, "text": " hack to make the autoregressive transformers train in parallel is" }, { "start": 2625.12, "end": 2630.72, "text": " actually making the transformer formulation much weaker and therefore" }, { "start": 2630.72, "end": 2637.08, "text": " that's then equivalent to an RNN okay I it's not that transformers in general" }, { "start": 2637.08, "end": 2642.04, "text": " are equivalent to an RNN or at least this paper doesn't show that it's just" }, { "start": 2642.04, "end": 2647.44, "text": " that this hacked transformers are and I think that's an important distinction to" }, { "start": 2647.44, "end": 2652.7200000000003, "text": " make here rather than saying transformers are RNNs if we could only" }, { "start": 2652.7200000000003, "end": 2656.8, "text": " approximate the softmax in these infinite dimensions I don't think that's" }, { "start": 2656.8, "end": 2661.44, "text": " entirely true but it is true for the transformers the autoregressive" }, { "start": 2661.44, "end": 2669.08, "text": " transformers that we currently train now why is this connection so powerful it" }, { "start": 2669.08, "end": 2676.1, "text": " allows a token to attend to you know tokens forward of it and what does it" }, { "start": 2676.1, "end": 2680.7999999999997, "text": " mean to be able to attend like let's say it's really important that this token" }, { "start": 2680.7999999999997, "end": 2687.48, "text": " right here attends to that token right here what would you need to do if you" }, { "start": 2687.48, "end": 2693.3199999999997, "text": " couldn't do that if you let's let's let's say this is a program right so this" }, { "start": 2693.3199999999997, "end": 2699.38, "text": " token is the function F and it needs the input this argument a of whatever token" }, { "start": 2699.38, "end": 2705.7599999999998, "text": " comes in front of it and it needs to do something conditioned on a so if a" }, { "start": 2705.76, "end": 2713.0400000000004, "text": " if a is one it does something if a is two it does something else right if you" }, { "start": 2713.0400000000004, "end": 2719.0800000000004, "text": " if you don't have if you can't input a then you can't simply pass on the output" }, { "start": 2719.0800000000004, "end": 2723.88, "text": " value what you'll have to do is conceptually is basically you'll have to" }, { "start": 2723.88, "end": 2729, "text": " store the entire code of the function into hidden state if this is an RNN" }, { "start": 2729, "end": 2734.2200000000003, "text": " right you can't look forward it needs to store the entire code of this function" }, { "start": 2734.22, "end": 2739.72, "text": " F so all it needs to basically build this map if a is one then this if a is" }, { "start": 2739.72, "end": 2743.7999999999997, "text": " two then this if a is three then this store that in the hidden state and then" }, { "start": 2743.7999999999997, "end": 2748.04, "text": " once a comes around in the next time step this can be resolved you can see" }, { "start": 2748.04, "end": 2752.2, "text": " that this is infinitely more complicated than simply looking forward and outputting" }, { "start": 2752.2, "end": 2759.6, "text": " the value yourself so that's sort of the difference in power that these two" }, { "start": 2759.6, "end": 2766.44, "text": " formulations are talking about okay so yeah two parts to this paper first part" }, { "start": 2766.44, "end": 2771.8399999999997, "text": " linear transformer through kernels second part if you formulate it like" }, { "start": 2771.8399999999997, "end": 2776.44, "text": " this it is equivalent and so a autoregressive transformer in this way" }, { "start": 2776.44, "end": 2781.64, "text": " becomes equivalent to an RNN and here is some of the output samples you know" }, { "start": 2781.64, "end": 2786.14, "text": " they're they're pretty pretty good though if you look at the more output" }, { "start": 2786.14, "end": 2791.7599999999998, "text": " samples they have here it so here this this is the linear one and you can see" }, { "start": 2791.7599999999998, "end": 2798.14, "text": " for example as already in this very bottom one this one right here it's the" }, { "start": 2798.14, "end": 2804.14, "text": " kind of all the other transformers get the slant to the right and that the the" }, { "start": 2804.14, "end": 2808.96, "text": " original has whereas this one is simply straight I mean I don't want it I don't" }, { "start": 2808.96, "end": 2812.6, "text": " want to dunk on this like these others make a lot of mistake mistakes right" }, { "start": 2812.6, "end": 2816.88, "text": " here but here I also saw you know all of them get that this is going to be the" }, { "start": 2816.88, "end": 2823.68, "text": " number three while this one is somehow making this circle in here so it is not" }, { "start": 2823.68, "end": 2830.5, "text": " perfect and even though it's on par where in the tasks they see you can see" }, { "start": 2830.5, "end": 2834.72, "text": " right here that especially in this speech recognition the original" }, { "start": 2834.72, "end": 2842.2599999999998, "text": " transformer right here is significantly outperforming the linear" }, { "start": 2842.26, "end": 2847, "text": " transformer which is the one in black right here in fact in all of the tasks" }, { "start": 2847, "end": 2851.2400000000002, "text": " but ultimately it might not matter because they reach you know the same" }, { "start": 2851.2400000000002, "end": 2857.88, "text": " they reach the same they reach the same accuracy or whatnot and the linear" }, { "start": 2857.88, "end": 2864.6800000000003, "text": " transformer is way way faster so I can see that this is going to be a thing" }, { "start": 2864.6800000000003, "end": 2869.0400000000004, "text": " that people apply I guess time will tell right I invite you to read the paper" }, { "start": 2869.04, "end": 2873.72, "text": " tell me what you think I might be totally wrong here with any of my" }, { "start": 2873.72, "end": 2880.04, "text": " formulations or my intuition about what this new attention mechanism does yeah" }, { "start": 2880.04, "end": 2899.84, "text": " please let me know and I'll see you next time bye bye" } ]
O9kFX33nUcU
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
On the Measure of Intelligence by François Chollet - Part 4: The ARC Challenge (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "chollet", "keras", "google", "francois", "intelligence", "iq", "iq test", "deep neural networks", "prior", "skill", "performance", "measurement", "measure", "test", "number", "intelligent", "smart", "learning", "generalization", "ability", "experience", "humans", "evolution", "nature", "nurture", "psychometrics", "range", "adaptability", "arc", "kaggle", "difficulty", "entropy", "core knowledge", "objectness", "navigation", "contact", "agent", "goal" ]
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 Chollet. This last part concerns the ARC challenge that Chollet has proposed, or the ARC dataset, which stands for the Abstraction and Reasoning Corpus. And we're just quickly going over the dataset, look how it's built and discuss what kind of solutions might be relevant right here. So if you haven't seen the last videos in this series, this is the last one of a series, you might not exactly know what's going on. But I think you can you can keep up pretty well because this part is fairly independent of the other parts. And it's just cool to think about even if you haven't seen the other ones, I encourage you to go see the other ones, but it's not necessary. Okay, let's jump in. So the ARC is a challenge currently running a Kaggle challenge. But in essence, it is a dataset. And let me just jump into one of the tasks of the dataset. So in this dataset, you always have the task in the following form. So you always have multiple input examples like this or say these are called the training examples. And then you have a test example. In this case, you have three training example one test example. So an entire if you think of this in a machine learning way, this entire thing here is your x and this thing here is your y. Okay, so the label is going to be the output of the last example that you you don't know that now in the 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 is demonstrated. These are the demonstration examples. And then you're supposed to sort of learn the regularity out of the demonstration examples. And then on this test example, you are supposed to apply this regularity that you learned. So in here, a human can fairly accurately see that there are these black squares in each image, and that in the training samples, the output will always sort of exactly match into the place of these black squares. As you can see, this is like a high rectangle. It goes here, it has the same amount of tiles and so on. And you can also see that whatever colors are in here sort of are the continuation of a symmetric pattern. So here, this is exactly the same as up here, but you know, flipped or turned by 180 degrees. So there is a notion of symmetry right here. So technically, one could compute this one would say, oh, that's probably going to be the three rows and this bunch of things. And it's probably going to be the same as this one down here, but just flipped on its head. So as a human, you get this even without a description, you realize like, oh, this is like a regular pattern, it's symmetric, there's a hole in it. And apparently, the thing here always fills the hole, I can see that, you know, three examples are enough for me to confirm that that's what's going on. And I see the hole here. So I'm going to do the same thing. So you can already see how these things are constructed in every, this is not the only task, by the way, this is just one task. Okay, there are 1000 tasks in this data set of this sort of nature. Now they're not always three demonstration examples, I believe there can be more or less. But what's always the case is they always each of these training examples consist 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 grids. In fact, not even the input grids have to be always the same size. But you have to now come up with an output grid. You have to first decide how big it is. And we've here we've determined since the whole has three rows, we're probably going to make three rows and it has like seven columns, we're probably going to make seven columns. And that's the sort of thing you have to do. And then not only do you have to decide how big it is, you now have to decide in each cell what color you put in. And only if this thing exactly matches the train or the test label, you get a you get a point. Otherwise you get no point. 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. 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 Cholay 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. 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 Cholay 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 hole 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 of control for experience by only providing a fixed amount of training data for each task. That's what we saw. And only featuring tasks that do not lend themselves well to artificially generating new data. So it's not like ImageNet where you can go on the internet and find a whole bunch of images or 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 tasks. Okay, so they say he each task consists of a small number of demonstration examples, 3.3 on average, and a small number of test examples, generally one, although it might be two or three in rare cases. Each example consists of an input grid and an output grid. Each grid is a literal grid of symbols. Each symbol is visualized by color. There are 10 unique symbols, a grid can be any height or width between one by one and 30 by 30, so it doesn't even need to be square, right? And as I said, you need to provide your own output grid as an AI taking this test. So here are the priors that this test assumes. And we're going to look at some examples that make it explicit like some tasks in the training set that where you can see these priors in action. There's 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, a human would recognize or would, you know, would recognize that these things might represent different objects, right? Now that's mainly, I think also due to the black background helps, but you would even recognize this with another background or here, the different colors indicate that those are two different things, even though those two pixels here touch and are different from black, you would recognize that those are two different things because they have different color. But you would generally recognize one of these things as an individual object. If you're not given anything here, you see, for example, a denoising task as a human, you can pretty quickly see what the task is about, right? There appear to be these green things. They're all rectangles and there appear to be these blue things. And on the right side, there are no more blue things. But the now it's not always that when there was a blue thing, there is now a green thing only here where it was sort of inside a green thing is now a green pixel. Whenever there was a blue pixel outside in this black area, then there is now black. So this is sort of like the blue things were noise and you're able to remove it. This already tests a lot of assumptions. A lot of these priors, a lot of understanding of the world. So there are objects, right? As human understands that objects are square in this case, or rectangles, the human understands that it that we need to remove the blue things going over. And the human understands that somehow this inside relation, right, if something is inside or outside of one of these rectangles, and that determines whether we have to turn the pixel green or black. You can, I mean, think about how you would train a machine to do something like this. It's not easy, especially if you don't know that this task is coming. Imagine for all of these things, you don't know that the task is coming. This is just one of 400 tasks that you know of. There are 600 tasks that you don't know of that are similar, but also in a way completely different. Here's another tasks that object influence via contact. So this is your first demonstration example. A human pretty quickly recognizes there appears to be red thing and a blue thing, and then they appear to be together. And then in the next thing, you see, oh, there appears to be a blue thing and the red thing in the next thing, they appear to be together. And if you look here, it always appears to be the red thing going to the blue thing in the most direct way. So in the in the along the grid. That's all that the human needs to see two examples and the human most humans will already make that inference and can now solve if there is like, if there now is a test example, where the blue thing is like, the blue thing is down here. And the red thing is here like this. And it asks you what comes next, you know, you know that the red thing is going down to the blue thing. But it's very hard to train a machine to do this. So I like this test, because it's sort of a different test. And I believe the test these tests weren't procedurally generated. These tests were actually generated by sholey or, you know, by by actual humans. That's pretty cool. And 1000 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 and numbers prior. So here you see like a time process. So in this demonstration example, you see blue things here, red, big thing. And then the next the output grid is this green thing. And as a human immediately recognize, okay, so it shoots out from the blue thing, the green thing shoots from the blue thing, hits the red wall and goes here. Try to make a machine understand this. This is insane, right? So if you look at the more examples, it all it appears that the blue thing always comes from somewhere like the side of the image, and the green thing comes out obviously from whatever is not at the at the border of the image and then bounces off the red thing if it hits the red thing. Now here you can you can already see what's going to happen. Remember your AI would need to first determine aha, okay, all of these output grids, they seem to be the same as the input grid. So it would need to explicitly construct the output grid in the same manner as the input grid because it understands this right? This is not the same in every task, then it needs to recognize the red thing that stays in every one. So it needs to put the red thing here right from from here. And then it needs to recognize the blue thing stays as well. And then most most shockingly needs to recognize, okay, I will draw a line in pixels and lines in pixels are hard here. And then as soon as it would hit the red thing, it bounces off into the other direction. So from just these three examples, the machine has to understand that and correctly output the exact solution, not an approximate solution, the exact solution. Okay, so yeah, there are these basic geometry and topology priors like lines, rectangular shapes, symmetries, rotations, translations, shape upscaling, containing being contained, drawing lines, connecting points, and so on. Now, let's look at some more examples. These are fun, right? Check out this one here. So you see green, red, and then somehow the green connected to the red. So this is an example of that has many of these priors in many of these concepts in there is goal directedness, you can already sort of form the hypothesis that the green wants to go to the red. But also you see that somehow it sort of appears to the blue things seem to be maybe obstacles and it appears to change direction when it encounters an obstacle like here. So here, you see the example, and you probably confirm so your hypothesis could be it always goes until it hits and then it changes direction towards the red thing, right? Always towards red thing, because it's not always towards the right because you return toward the left. So it goes somehow towards the red thing and so it's pretty ambiguous in this situation, but you can also make the assumption that if it's ambiguous, it goes towards the middle, maybe, maybe. So here, again, now we're actually confirming probably so we go towards the red thing, which would be towards this direction, then we hit an object, then we go towards the red thing until we hit an object, and then we go here. 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, again, your AI would need to recognize what size of grid it needs to draw and what the result is. So it would need to copy this entire grid and also change these pixels right here to be green pixels. That's hard. I mean, that's I find I find this to be pretty hard. This is the line extrapolation and turning on obstacle and efficiently reaching a goal prior. That's crazy. And is there more? Yes, there is two more, I believe. Yeah, those are the last examples. So in this one, you can see right here, there appear to be objects, which there's this blue objects appear to be the same and there are these red, and then the output grid is one of these blue objects. Okay, so here we again see different objects, the output grid is one of them. So as a human, you can already recognize the output grid is probably always going to be one of these objects. And now we need to decide on which one. So we can formulate the hypothesis that it's probably going to be the one that's the most like here, there's three of the blue ones here, there's four of the yellow ones, that's more than any other. And this here confirms our hypothesis that the it's the object that appears most often. Now again, see that there is this notion of object ness. 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 art 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 us appear to be able to solve the majority of tasks on their first try without any practice or verbal explanations. In effect, in this task, you get three tries at each at each of the at each of the problems, you get three, three tries and the humans can already solve it in one. So that just shows you shows you how cool humans are. So here is a shawley 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 expressible in terms of arc pairs that would only involve core knowledge. So core knowledge is this set of human priors that we discussed last time like objectness and symmetries and geometric shapes and navigation and so on. So he asks you to basically develop a DSL that can capture all the different tasks. So so kept basically define a formalism of these tasks. But it's hard because you don't know what the tasks are going to be. So your best bet is probably to make a formalism that completely over represents what the tasks can be. 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 subproblem is critical to a to general AI 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 GI step one build a GI that's sort of and not exactly but it's kind of what this says. Right. So 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 GI. So he goes on says given a task use the DSL to generate a set of candidate programs that turn the input grids into the corresponding output grids. This step would reuse and recombine sub programs that previously proved useful in other arc tasks. So says whenever you have captured the core knowledge or whenever you have captured the problem space in a formal language you can simply use that formal language to express whatever your input is so the that turn the input grids into the corresponding output grids. So you would put in these demonstration examples and describe this with your formal language that you have and you can somehow reuse and recombine sub programs that previously proved useful for 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 these things based on a criterion such as a program simplicity or program likelihood. Note that we do not expect that merely selecting the simplest possible program that works on training pairs will generalize well to test pairs. And then use the top three candidates to generate output grids for the test examples. So I hope the approach here I feel it makes sense but it is sort of over hopeful in my mind and that's mainly because of step one. So step one asks you to come up with like a programming language that can capture all the tasks in this all the tasks in the data set even though you don't know what the tasks are and that has this human core knowledge in inside of it in a in a formally describable way. And then once you have that programming language you would if you're given this task where you have you know a bunch of these demonstration you have a bunch of these demonstration things and then you have the test thing you would generate all the programs that would produce these demonstration examples or that would given the demo given the input grade would produce the output grid right you would generate all the programs and then you would select somehow among all these programs the one that you think generalizes the most and you would use that program to put this in and get out the solution. They say it's probably it's not always the simplest program not always the shortest program maybe who knows like I feel step one is the kind of the crucial issue here. Okay so they say they make some claims here and about what this what this would bring the community we posit that the existence of human level arc solver would represent the ability to program and AI from demonstrations alone only requiring a handful of demonstrations to specify complex tasks to do a wide range of human relatable tasks of a kind that would normally require human level human like fluid intelligence. As supporting evidence we note that human performance on psychometric intelligent test which are similar to our is predictive of success across all human cognitive tasks. Further we posit that since an arc solver and human intelligence would be both founded on the same knowledge priors the scope of application of an arc solver would be closer to that of human cognition making it such a solver both practically valuable and easy to interact with and would produce behavior that is in line with human expectations. Okay so they're making the same argument that anyone before has made but they condition it on some things and this is I think the conclusion of the entire article here of on the measure of intelligence because people had this hope and they say that here claims are highly speculative and may prove incorrect much like Newell's 1973 hopes that progress on chess playing would translate into meaningful progress and achieving a broad range of cognitive abilities especially if arc turns out to feature unforeseen vulnerabilities to unintelligent shortcuts. This is the AI effect and basically means that whenever you think a task the solving of a task represents AI and then you actually see the solution then the solution turns out to be not AI in the eyes of the human. So the human at first they would say oh this task really requires intelligence and then someone solves the task and they'll say oh that's not intelligence you kind of hacked your way to that and the expectation is that in this arc challenge there might be a hacky way to that but I mean the good question is when at what is there even a task like this arc challenge here could that is there even a possibility of a task where you wouldn't say that and I'm not so sure about this they seem to be more hopeful than I am but at least they say the arc challenge is founded on the same priors as a human has it gives you the same amount of experience as a human has right and therefore it is much more comparable to human intelligence. They go over some weaknesses right here of criticizing their own thing generalization is not quantified so they have a measure of generalization in the previous chapter but they don't use it right here test validity is not established data set size and diversity may be limited and so on but I in my mind this I would not consider this as like an AGI task or anything like this I'm pretty sure the solution to this will come in a form again where people don't really think it's it exhibits intelligence but I do like the task as such and as a machine learner I am very excited to think about how machine learning can go about solving this task and especially with what we've seen from something like GPT-3 it has exactly this kind of structure where you train on a giant data set blah blah blah you pre train your language model but then at inference time you input a bunch of these demonstration examples and you ask it for the next output so I feel that might be a good start for for doing it the question of course is what what then do you pre train this model on this GPT-3 for ARC what's the pre training data set for it and I guess that's going to be the challenge and probably going to require people to specifically program all of these priors into a data set generator for pre training so that would be my approach my approach would be write a data set generator for pre training and GPT-3 model to do these kind of tasks and in order to write the data set generator you'd have to basically program in all of these priors and that's not going to be easy because your best bet is to sort of put yourself into the shoes of Chalet and be like oh if I were to design a task what kind of things would I do and then try to capture that that's going to be your best bet your most honest bet with respect to the challenge is to try to as faithfully as possible implement something like an 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, "end": 9.040000000000001, "text": " Hi there and welcome to the last part of On the Measure of Intelligence by François Chollet." }, { "start": 9.040000000000001, "end": 16, "text": " This last part concerns the ARC challenge that Chollet has proposed, or the ARC dataset," }, { "start": 16, "end": 20.6, "text": " which stands for the Abstraction and Reasoning Corpus." }, { "start": 20.6, "end": 26.84, "text": " And we're just quickly going over the dataset, look how it's built and discuss what kind" }, { "start": 26.84, "end": 30.12, "text": " of solutions might be relevant right here." }, { "start": 30.12, "end": 36.08, "text": " So if you haven't seen the last videos in this series, this is the last one of a series," }, { "start": 36.08, "end": 38.56, "text": " you might not exactly know what's going on." }, { "start": 38.56, "end": 43.760000000000005, "text": " But I think you can you can keep up pretty well because this part is fairly independent" }, { "start": 43.760000000000005, "end": 45.519999999999996, "text": " of the other parts." }, { "start": 45.519999999999996, "end": 49.44, "text": " And it's just cool to think about even if you haven't seen the other ones, I encourage" }, { "start": 49.44, "end": 53.24, "text": " you to go see the other ones, but it's not necessary." }, { "start": 53.24, "end": 55.92, "text": " Okay, let's jump in." }, { "start": 55.92, "end": 61.400000000000006, "text": " So the ARC is a challenge currently running a Kaggle challenge." }, { "start": 61.400000000000006, "end": 64.36, "text": " But in essence, it is a dataset." }, { "start": 64.36, "end": 68.84, "text": " And let me just jump into one of the tasks of the dataset." }, { "start": 68.84, "end": 74.24000000000001, "text": " So in this dataset, you always have the task in the following form." }, { "start": 74.24000000000001, "end": 82.24000000000001, "text": " So you always have multiple input examples like this or say these are called the training" }, { "start": 82.24000000000001, "end": 83.48, "text": " examples." }, { "start": 83.48, "end": 85.32000000000001, "text": " And then you have a test example." }, { "start": 85.32, "end": 87.88, "text": " In this case, you have three training example one test example." }, { "start": 87.88, "end": 95.28, "text": " So an entire if you think of this in a machine learning way, this entire thing here is your" }, { "start": 95.28, "end": 98.96, "text": " x and this thing here is your y." }, { "start": 98.96, "end": 105.56, "text": " Okay, so the label is going to be the output of the last example that you you don't know" }, { "start": 105.56, "end": 113.8, "text": " that now in the course in the training data set you do, but in the test you don't." }, { "start": 113.8, "end": 118.16, "text": " So each one of these, as I said is is is demonstrated." }, { "start": 118.16, "end": 119.82, "text": " These are the demonstration examples." }, { "start": 119.82, "end": 124.72, "text": " And then you're supposed to sort of learn the regularity out of the demonstration examples." }, { "start": 124.72, "end": 130.54, "text": " And then on this test example, you are supposed to apply this regularity that you learned." }, { "start": 130.54, "end": 136.96, "text": " So in here, a human can fairly accurately see that there are these black squares in" }, { "start": 136.96, "end": 144.18, "text": " each image, and that in the training samples, the output will always sort of exactly match" }, { "start": 144.18, "end": 146.20000000000002, "text": " into the place of these black squares." }, { "start": 146.20000000000002, "end": 148.44, "text": " As you can see, this is like a high rectangle." }, { "start": 148.44, "end": 151.68, "text": " It goes here, it has the same amount of tiles and so on." }, { "start": 151.68, "end": 159.60000000000002, "text": " And you can also see that whatever colors are in here sort of are the continuation of" }, { "start": 159.60000000000002, "end": 160.96, "text": " a symmetric pattern." }, { "start": 160.96, "end": 170.52, "text": " So here, this is exactly the same as up here, but you know, flipped or turned by 180 degrees." }, { "start": 170.52, "end": 173.4, "text": " So there is a notion of symmetry right here." }, { "start": 173.4, "end": 179.72, "text": " So technically, one could compute this one would say, oh, that's probably going to be" }, { "start": 179.72, "end": 183.76000000000002, "text": " the three rows and this bunch of things." }, { "start": 183.76000000000002, "end": 187.88, "text": " And it's probably going to be the same as this one down here, but just flipped on its" }, { "start": 187.88, "end": 189.20000000000002, "text": " head." }, { "start": 189.2, "end": 194.67999999999998, "text": " So as a human, you get this even without a description, you realize like, oh, this is" }, { "start": 194.67999999999998, "end": 198.67999999999998, "text": " like a regular pattern, it's symmetric, there's a hole in it." }, { "start": 198.67999999999998, "end": 203.17999999999998, "text": " And apparently, the thing here always fills the hole, I can see that, you know, three" }, { "start": 203.17999999999998, "end": 206.56, "text": " examples are enough for me to confirm that that's what's going on." }, { "start": 206.56, "end": 207.79999999999998, "text": " And I see the hole here." }, { "start": 207.79999999999998, "end": 211.2, "text": " So I'm going to do the same thing." }, { "start": 211.2, "end": 215.56, "text": " So you can already see how these things are constructed in every, this is not the only" }, { "start": 215.56, "end": 218.35999999999999, "text": " task, by the way, this is just one task." }, { "start": 218.36, "end": 224.84, "text": " Okay, there are 1000 tasks in this data set of this sort of nature." }, { "start": 224.84, "end": 230.68, "text": " Now they're not always three demonstration examples, I believe there can be more or less." }, { "start": 230.68, "end": 235.08, "text": " But what's always the case is they always each of these training examples consist of" }, { "start": 235.08, "end": 238.76000000000002, "text": " these demonstration examples and these test example." }, { "start": 238.76000000000002, "end": 244.84, "text": " Each of the demonstration examples consists of an input grid and an output grid, the input" }, { "start": 244.84, "end": 251.24, "text": " grid and output grid, they can be anywhere from one by one to 30 by 30." }, { "start": 251.24, "end": 255.48000000000002, "text": " Okay, anywhere in between that." }, { "start": 255.48000000000002, "end": 260.88, "text": " And the colors here, I believe there are nine different colors that can go, they're just" }, { "start": 260.88, "end": 263.04, "text": " encoded by nine different numbers." }, { "start": 263.04, "end": 267.52, "text": " But there are nine different colors that these things can have, you can see black, blue," }, { "start": 267.52, "end": 271.88, "text": " orange, red, dark blue, and so on." }, { "start": 271.88, "end": 275.3, "text": " And the output grid exactly the same." }, { "start": 275.3, "end": 281.94, "text": " Now in this test example, you can only see the input grid, you cannot see the output" }, { "start": 281.94, "end": 282.94, "text": " grid." }, { "start": 282.94, "end": 285.52, "text": " And that means you don't even know how large it should be." }, { "start": 285.52, "end": 288.84, "text": " You can see right here, they're not all the same size, the output grids." }, { "start": 288.84, "end": 292.36, "text": " In fact, not even the input grids have to be always the same size." }, { "start": 292.36, "end": 295.88, "text": " But you have to now come up with an output grid." }, { "start": 295.88, "end": 297.64, "text": " You have to first decide how big it is." }, { "start": 297.64, "end": 301.44, "text": " And we've here we've determined since the whole has three rows, we're probably going" }, { "start": 301.44, "end": 307.36, "text": " to make three rows and it has like seven columns, we're probably going to make seven columns." }, { "start": 307.36, "end": 309.56, "text": " And that's the sort of thing you have to do." }, { "start": 309.56, "end": 314.12, "text": " And then not only do you have to decide how big it is, you now have to decide in each" }, { "start": 314.12, "end": 317.16, "text": " cell what color you put in." }, { "start": 317.16, "end": 326.92, "text": " And only if this thing exactly matches the train or the test label, you get a you get" }, { "start": 326.92, "end": 328.15999999999997, "text": " a point." }, { "start": 328.16, "end": 331.44, "text": " Otherwise you get no point." }, { "start": 331.44, "end": 338.52000000000004, "text": " So in the training task, there are I believe 400 of these tasks and then there are 400" }, { "start": 338.52000000000004, "end": 345.48, "text": " more as test split, but these are still public and then there are 200 that are secret." }, { "start": 345.48, "end": 349.6, "text": " There are I guess, part of this Kaggle challenge." }, { "start": 349.6, "end": 357.56, "text": " Yes, the training set features 400 tasks, while the evaluation set features 600 tasks." }, { "start": 357.56, "end": 362.32, "text": " The evaluation set is further split into a public evaluation set of 400 tasks and a private" }, { "start": 362.32, "end": 364.64, "text": " evaluation set of 200 tasks." }, { "start": 364.64, "end": 366.4, "text": " All tasks are unique." }, { "start": 366.4, "end": 370.16, "text": " And the set of tasks and the set of training tasks are disjoint." }, { "start": 370.16, "end": 373.36, "text": " Sorry, of test tasks and training tasks." }, { "start": 373.36, "end": 379.26, "text": " The task data is available at this as you can see right here." }, { "start": 379.26, "end": 386.4, "text": " So I really hope that Cholay will keep these 200 tasks as a secret, even after the Kaggle" }, { "start": 386.4, "end": 393.15999999999997, "text": " challenge, because it's going to be fun for people that might want to get into this later." }, { "start": 393.15999999999997, "end": 395.71999999999997, "text": " So here are the goals of this data set." }, { "start": 395.71999999999997, "end": 400.67999999999995, "text": " They want to stay close to these psychometric intelligence tests." }, { "start": 400.67999999999995, "end": 405.4, "text": " They say in particular, it should be solvable by humans without any specific practice or" }, { "start": 405.4, "end": 409.12, "text": " training and probably also without any language instructions." }, { "start": 409.12, "end": 413.47999999999996, "text": " So you just be able to set a human in front of it and the human should be able to solve" }, { "start": 413.48, "end": 418.36, "text": " it or a large portion of humans should be able to solve it." }, { "start": 418.36, "end": 422.12, "text": " Ideally, this test would also differentiate humans from each other." }, { "start": 422.12, "end": 426.84000000000003, "text": " But at this point, we want to simply assess machines." }, { "start": 426.84000000000003, "end": 433.08000000000004, "text": " So they say focus on measuring developer aware generalization rather than task specific skill" }, { "start": 433.08000000000004, "end": 437.28000000000003, "text": " by only featuring novel tasks in the evaluation set." }, { "start": 437.28000000000003, "end": 440.88, "text": " And the novel tasks are unknown to the developer of a test taker." }, { "start": 440.88, "end": 447, "text": " So if I develop a system, I don't know what are these 200 tasks that Cholay keeps hidden." }, { "start": 447, "end": 455.04, "text": " I simply submit my code and I'll figure out if my code does well on them." }, { "start": 455.04, "end": 462.44, "text": " So they say they want to feature highly abstract tasks must be understood by a test taker using" }, { "start": 462.44, "end": 464.71999999999997, "text": " very few examples." }, { "start": 464.71999999999997, "end": 465.71999999999997, "text": " That's what you saw." }, { "start": 465.71999999999997, "end": 470, "text": " You don't have a big training example to learn that this task is about symmetry and hole" }, { "start": 470, "end": 471, "text": " filling." }, { "start": 471, "end": 472.28, "text": " You only have three." }, { "start": 472.28, "end": 477.08, "text": " And from three, you need to recognize what's going on and produce the output of the test" }, { "start": 477.08, "end": 481.12, "text": " sample." }, { "start": 481.12, "end": 484.28, "text": " Quality of control for experience by only providing a fixed amount of training data" }, { "start": 484.28, "end": 485.28, "text": " for each task." }, { "start": 485.28, "end": 486.28, "text": " That's what we saw." }, { "start": 486.28, "end": 491.54, "text": " And only featuring tasks that do not lend themselves well to artificially generating new data." }, { "start": 491.54, "end": 496.22, "text": " So it's not like ImageNet where you can go on the internet and find a whole bunch of" }, { "start": 496.22, "end": 501.98, "text": " images or some NLP tasks where people pre train on all of Wikipedia and all of the books" }, { "start": 501.98, "end": 505.62, "text": " in the world because they want to understand language better." }, { "start": 505.62, "end": 511.94000000000005, "text": " These tasks are supposed to be such that it makes no sense for you to go out and try to" }, { "start": 511.94000000000005, "end": 517.52, "text": " find more data or find similar data or pre train your model on something." }, { "start": 517.52, "end": 523, "text": " And then lastly, and this refers to the last few chapters we looked at explicitly describe" }, { "start": 523, "end": 530.2, "text": " the complete set of priors that it assumes and enable a fair general intelligence comparison" }, { "start": 530.2, "end": 536.32, "text": " between human and machines by only requiring priors to those innate human close to innate" }, { "start": 536.32, "end": 537.84, "text": " human prior knowledge." }, { "start": 537.84, "end": 545.36, "text": " So that means that whatever human have whatever humans have as a prior built into them by" }, { "start": 545.36, "end": 550.46, "text": " let's say evolution or that most humans have picked up through life." }, { "start": 550.46, "end": 555.5400000000001, "text": " Those are the things that you have to explicitly point out." }, { "start": 555.5400000000001, "end": 560.9200000000001, "text": " So and you require that and you have to point them out." }, { "start": 560.9200000000001, "end": 566.64, "text": " Sorry, explicitly describe them such that I as a developer of a system can build them" }, { "start": 566.64, "end": 569.88, "text": " into my system such that it's a fair comparison." }, { "start": 569.88, "end": 574.52, "text": " In the last chapters, we looked at the fact that a fair intelligence comparison is only" }, { "start": 574.52, "end": 579.6600000000001, "text": " fair if two systems that are compared to each other have the same amount of experience." }, { "start": 579.66, "end": 585.52, "text": " And here we control that by only providing a fixed amount of training data and also have" }, { "start": 585.52, "end": 587.9599999999999, "text": " the same prior knowledge." }, { "start": 587.9599999999999, "end": 593.0799999999999, "text": " And here we simply do that by listing the human priors that are required for the tasks" }, { "start": 593.0799999999999, "end": 595.24, "text": " that we think that humans have." }, { "start": 595.24, "end": 599.92, "text": " And then we enable the developers to explicitly build those into machines." }, { "start": 599.92, "end": 607.36, "text": " So I would maybe build a little calculator module into my AI that solves this tasks." }, { "start": 607.36, "end": 613.88, "text": " Okay, so they say he each task consists of a small number of demonstration examples," }, { "start": 613.88, "end": 619.16, "text": " 3.3 on average, and a small number of test examples, generally one, although it might" }, { "start": 619.16, "end": 622, "text": " be two or three in rare cases." }, { "start": 622, "end": 624.32, "text": " Each example consists of an input grid and an output grid." }, { "start": 624.32, "end": 627.4, "text": " Each grid is a literal grid of symbols." }, { "start": 627.4, "end": 630.08, "text": " Each symbol is visualized by color." }, { "start": 630.08, "end": 633.72, "text": " There are 10 unique symbols, a grid can be any height or width between one by one and" }, { "start": 633.72, "end": 638, "text": " 30 by 30, so it doesn't even need to be square, right?" }, { "start": 638, "end": 644.6600000000001, "text": " And as I said, you need to provide your own output grid as an AI taking this test." }, { "start": 644.6600000000001, "end": 646.96, "text": " So here are the priors that this test assumes." }, { "start": 646.96, "end": 652.72, "text": " And we're going to look at some examples that make it explicit like some tasks in the training" }, { "start": 652.72, "end": 656.4, "text": " set that where you can see these priors in action." }, { "start": 656.4, "end": 664.3199999999999, "text": " There's an object nest prior where the task assumes that the AI or the task tests that" }, { "start": 664.3199999999999, "end": 667.4599999999999, "text": " the AI understands something about objects." }, { "start": 667.4599999999999, "end": 672.4399999999999, "text": " So these are tasks that you can only reasonably solve if you know something about objects," }, { "start": 672.4399999999999, "end": 679.1999999999999, "text": " like you would, a human would recognize or would, you know, would recognize that these" }, { "start": 679.1999999999999, "end": 682.6, "text": " things might represent different objects, right?" }, { "start": 682.6, "end": 689.0600000000001, "text": " Now that's mainly, I think also due to the black background helps, but you would even" }, { "start": 689.0600000000001, "end": 694.44, "text": " recognize this with another background or here, the different colors indicate that those" }, { "start": 694.44, "end": 700.2, "text": " are two different things, even though those two pixels here touch and are different from" }, { "start": 700.2, "end": 704.48, "text": " black, you would recognize that those are two different things because they have different" }, { "start": 704.48, "end": 705.48, "text": " color." }, { "start": 705.48, "end": 711.36, "text": " But you would generally recognize one of these things as an individual object." }, { "start": 711.36, "end": 716.82, "text": " If you're not given anything here, you see, for example, a denoising task as a human," }, { "start": 716.82, "end": 720.02, "text": " you can pretty quickly see what the task is about, right?" }, { "start": 720.02, "end": 722.62, "text": " There appear to be these green things." }, { "start": 722.62, "end": 726.9, "text": " They're all rectangles and there appear to be these blue things." }, { "start": 726.9, "end": 729.9, "text": " And on the right side, there are no more blue things." }, { "start": 729.9, "end": 735.6800000000001, "text": " But the now it's not always that when there was a blue thing, there is now a green thing" }, { "start": 735.68, "end": 742.7199999999999, "text": " only here where it was sort of inside a green thing is now a green pixel." }, { "start": 742.7199999999999, "end": 748.8, "text": " Whenever there was a blue pixel outside in this black area, then there is now black." }, { "start": 748.8, "end": 752.88, "text": " So this is sort of like the blue things were noise and you're able to remove it." }, { "start": 752.88, "end": 756.4399999999999, "text": " This already tests a lot of assumptions." }, { "start": 756.4399999999999, "end": 760.12, "text": " A lot of these priors, a lot of understanding of the world." }, { "start": 760.12, "end": 762.9599999999999, "text": " So there are objects, right?" }, { "start": 762.96, "end": 770.52, "text": " As human understands that objects are square in this case, or rectangles, the human understands" }, { "start": 770.52, "end": 775.72, "text": " that it that we need to remove the blue things going over." }, { "start": 775.72, "end": 784.08, "text": " And the human understands that somehow this inside relation, right, if something is inside" }, { "start": 784.08, "end": 788.2800000000001, "text": " or outside of one of these rectangles, and that determines whether we have to turn the" }, { "start": 788.2800000000001, "end": 790.84, "text": " pixel green or black." }, { "start": 790.84, "end": 794.9200000000001, "text": " You can, I mean, think about how you would train a machine to do something like this." }, { "start": 794.9200000000001, "end": 800.0400000000001, "text": " It's not easy, especially if you don't know that this task is coming." }, { "start": 800.0400000000001, "end": 803.32, "text": " Imagine for all of these things, you don't know that the task is coming." }, { "start": 803.32, "end": 806.48, "text": " This is just one of 400 tasks that you know of." }, { "start": 806.48, "end": 814.0400000000001, "text": " There are 600 tasks that you don't know of that are similar, but also in a way completely" }, { "start": 814.0400000000001, "end": 816.8000000000001, "text": " different." }, { "start": 816.8000000000001, "end": 820.2800000000001, "text": " Here's another tasks that object influence via contact." }, { "start": 820.28, "end": 823.36, "text": " So this is your first demonstration example." }, { "start": 823.36, "end": 828.4399999999999, "text": " A human pretty quickly recognizes there appears to be red thing and a blue thing, and then" }, { "start": 828.4399999999999, "end": 831.1, "text": " they appear to be together." }, { "start": 831.1, "end": 835.24, "text": " And then in the next thing, you see, oh, there appears to be a blue thing and the red thing" }, { "start": 835.24, "end": 837.3399999999999, "text": " in the next thing, they appear to be together." }, { "start": 837.3399999999999, "end": 843.0799999999999, "text": " And if you look here, it always appears to be the red thing going to the blue thing in" }, { "start": 843.0799999999999, "end": 844.4, "text": " the most direct way." }, { "start": 844.4, "end": 847.64, "text": " So in the in the along the grid." }, { "start": 847.64, "end": 855.1999999999999, "text": " That's all that the human needs to see two examples and the human most humans will already" }, { "start": 855.1999999999999, "end": 862.96, "text": " make that inference and can now solve if there is like, if there now is a test example, where" }, { "start": 862.96, "end": 866.84, "text": " the blue thing is like, the blue thing is down here." }, { "start": 866.84, "end": 869.92, "text": " And the red thing is here like this." }, { "start": 869.92, "end": 874.24, "text": " And it asks you what comes next, you know, you know that the red thing is going down" }, { "start": 874.24, "end": 877.12, "text": " to the blue thing." }, { "start": 877.12, "end": 879.6, "text": " But it's very hard to train a machine to do this." }, { "start": 879.6, "end": 884.32, "text": " So I like this test, because it's sort of a different test." }, { "start": 884.32, "end": 887.72, "text": " And I believe the test these tests weren't procedurally generated." }, { "start": 887.72, "end": 894.64, "text": " These tests were actually generated by sholey or, you know, by by actual humans." }, { "start": 894.64, "end": 896.72, "text": " That's pretty cool." }, { "start": 896.72, "end": 900.84, "text": " And 1000 tasks like this is going to be very hard to solve." }, { "start": 900.84, "end": 905.58, "text": " There are even more abstract priors like goal directedness." }, { "start": 905.58, "end": 911.48, "text": " So now you here you can already see this a little bit in that you can say, well, the" }, { "start": 911.48, "end": 914.7, "text": " red thing wants to go to the blue thing." }, { "start": 914.7, "end": 919.2800000000001, "text": " So there is a notion of time involved, maybe." }, { "start": 919.2800000000001, "end": 922.64, "text": " There's also counting and numbers and numbers prior." }, { "start": 922.64, "end": 925.58, "text": " So here you see like a time process." }, { "start": 925.58, "end": 931.36, "text": " So in this demonstration example, you see blue things here, red, big thing." }, { "start": 931.36, "end": 936.12, "text": " And then the next the output grid is this green thing." }, { "start": 936.12, "end": 941, "text": " And as a human immediately recognize, okay, so it shoots out from the blue thing, the" }, { "start": 941, "end": 946.5600000000001, "text": " green thing shoots from the blue thing, hits the red wall and goes here." }, { "start": 946.5600000000001, "end": 949.3000000000001, "text": " Try to make a machine understand this." }, { "start": 949.3000000000001, "end": 951, "text": " This is insane, right?" }, { "start": 951, "end": 956.98, "text": " So if you look at the more examples, it all it appears that the blue thing always comes" }, { "start": 956.98, "end": 962.44, "text": " from somewhere like the side of the image, and the green thing comes out obviously from" }, { "start": 962.44, "end": 968.74, "text": " whatever is not at the at the border of the image and then bounces off the red thing if" }, { "start": 968.74, "end": 971.82, "text": " it hits the red thing." }, { "start": 971.82, "end": 976.1, "text": " Now here you can you can already see what's going to happen." }, { "start": 976.1, "end": 982.32, "text": " Remember your AI would need to first determine aha, okay, all of these output grids, they" }, { "start": 982.32, "end": 985.16, "text": " seem to be the same as the input grid." }, { "start": 985.16, "end": 990.52, "text": " So it would need to explicitly construct the output grid in the same manner as the input" }, { "start": 990.52, "end": 992.64, "text": " grid because it understands this right?" }, { "start": 992.64, "end": 997.36, "text": " This is not the same in every task, then it needs to recognize the red thing that stays" }, { "start": 997.36, "end": 998.36, "text": " in every one." }, { "start": 998.36, "end": 1003.26, "text": " So it needs to put the red thing here right from from here." }, { "start": 1003.26, "end": 1007.26, "text": " And then it needs to recognize the blue thing stays as well." }, { "start": 1007.26, "end": 1015.92, "text": " And then most most shockingly needs to recognize, okay, I will draw a line in pixels and lines" }, { "start": 1015.92, "end": 1019, "text": " in pixels are hard here." }, { "start": 1019, "end": 1024.94, "text": " And then as soon as it would hit the red thing, it bounces off into the other direction." }, { "start": 1024.94, "end": 1030.56, "text": " So from just these three examples, the machine has to understand that and correctly output" }, { "start": 1030.56, "end": 1035.84, "text": " the exact solution, not an approximate solution, the exact solution." }, { "start": 1035.84, "end": 1043.1999999999998, "text": " Okay, so yeah, there are these basic geometry and topology priors like lines, rectangular" }, { "start": 1043.1999999999998, "end": 1051.36, "text": " shapes, symmetries, rotations, translations, shape upscaling, containing being contained," }, { "start": 1051.36, "end": 1054.72, "text": " drawing lines, connecting points, and so on." }, { "start": 1054.72, "end": 1057.1799999999998, "text": " Now, let's look at some more examples." }, { "start": 1057.1799999999998, "end": 1059.8799999999999, "text": " These are fun, right?" }, { "start": 1059.8799999999999, "end": 1062.12, "text": " Check out this one here." }, { "start": 1062.12, "end": 1068.6399999999999, "text": " So you see green, red, and then somehow the green connected to the red." }, { "start": 1068.6399999999999, "end": 1073.4799999999998, "text": " So this is an example of that has many of these priors in many of these concepts in" }, { "start": 1073.4799999999998, "end": 1078.32, "text": " there is goal directedness, you can already sort of form the hypothesis that the green" }, { "start": 1078.32, "end": 1080.4599999999998, "text": " wants to go to the red." }, { "start": 1080.4599999999998, "end": 1088.84, "text": " But also you see that somehow it sort of appears to the blue things seem to be maybe obstacles" }, { "start": 1088.84, "end": 1095.28, "text": " and it appears to change direction when it encounters an obstacle like here." }, { "start": 1095.28, "end": 1101.9599999999998, "text": " So here, you see the example, and you probably confirm so your hypothesis could be it always" }, { "start": 1101.9599999999998, "end": 1107.72, "text": " goes until it hits and then it changes direction towards the red thing, right?" }, { "start": 1107.72, "end": 1110.84, "text": " Always towards red thing, because it's not always towards the right because you return" }, { "start": 1110.84, "end": 1112.8, "text": " toward the left." }, { "start": 1112.8, "end": 1120.44, "text": " So it goes somehow towards the red thing and so it's pretty ambiguous in this situation," }, { "start": 1120.44, "end": 1125.12, "text": " but you can also make the assumption that if it's ambiguous, it goes towards the middle," }, { "start": 1125.12, "end": 1127.72, "text": " maybe, maybe." }, { "start": 1127.72, "end": 1135.36, "text": " So here, again, now we're actually confirming probably so we go towards the red thing, which" }, { "start": 1135.36, "end": 1139.8, "text": " would be towards this direction, then we hit an object, then we go towards the red thing" }, { "start": 1139.8, "end": 1145.44, "text": " until we hit an object, and then we go here." }, { "start": 1145.44, "end": 1148.9199999999998, "text": " Also see that these grids here are not the same size." }, { "start": 1148.9199999999998, "end": 1154.12, "text": " So it's not always the case that the grids of within the same tasks are even the same" }, { "start": 1154.12, "end": 1155.12, "text": " size." }, { "start": 1155.12, "end": 1160.36, "text": " So now here, again, your AI would need to recognize what size of grid it needs to draw" }, { "start": 1160.36, "end": 1161.72, "text": " and what the result is." }, { "start": 1161.72, "end": 1168.72, "text": " So it would need to copy this entire grid and also change these pixels right here to" }, { "start": 1168.72, "end": 1172.24, "text": " be green pixels." }, { "start": 1172.24, "end": 1173.24, "text": " That's hard." }, { "start": 1173.24, "end": 1176.84, "text": " I mean, that's I find I find this to be pretty hard." }, { "start": 1176.84, "end": 1183.1200000000001, "text": " This is the line extrapolation and turning on obstacle and efficiently reaching a goal" }, { "start": 1183.1200000000001, "end": 1185.24, "text": " prior." }, { "start": 1185.24, "end": 1188, "text": " That's crazy." }, { "start": 1188, "end": 1189, "text": " And is there more?" }, { "start": 1189, "end": 1190.76, "text": " Yes, there is two more, I believe." }, { "start": 1190.76, "end": 1193.56, "text": " Yeah, those are the last examples." }, { "start": 1193.56, "end": 1201.04, "text": " So in this one, you can see right here, there appear to be objects, which there's this blue" }, { "start": 1201.04, "end": 1206.22, "text": " objects appear to be the same and there are these red, and then the output grid is one" }, { "start": 1206.22, "end": 1207.76, "text": " of these blue objects." }, { "start": 1207.76, "end": 1212.52, "text": " Okay, so here we again see different objects, the output grid is one of them." }, { "start": 1212.52, "end": 1216.56, "text": " So as a human, you can already recognize the output grid is probably always going to be" }, { "start": 1216.56, "end": 1218.9199999999998, "text": " one of these objects." }, { "start": 1218.9199999999998, "end": 1220.6799999999998, "text": " And now we need to decide on which one." }, { "start": 1220.68, "end": 1227.44, "text": " So we can formulate the hypothesis that it's probably going to be the one that's the most" }, { "start": 1227.44, "end": 1231.1200000000001, "text": " like here, there's three of the blue ones here, there's four of the yellow ones, that's" }, { "start": 1231.1200000000001, "end": 1232.96, "text": " more than any other." }, { "start": 1232.96, "end": 1240.24, "text": " And this here confirms our hypothesis that the it's the object that appears most often." }, { "start": 1240.24, "end": 1245.6000000000001, "text": " Now again, see that there is this notion of object ness." }, { "start": 1245.6000000000001, "end": 1247.4, "text": " You need to upscale somehow." }, { "start": 1247.4, "end": 1250.44, "text": " No, this is not upscale because the grid is the same size." }, { "start": 1250.44, "end": 1252.8, "text": " It's simply the image that's upscale." }, { "start": 1252.8, "end": 1258, "text": " But you need to somehow focus be able to focus in on one of these objects, I need to count" }, { "start": 1258, "end": 1262.96, "text": " them, you need to compare the counts via each other." }, { "start": 1262.96, "end": 1266.64, "text": " And now here you can pretty easily see that the output grid is going to contain one of" }, { "start": 1266.64, "end": 1271.1200000000001, "text": " those blue things as a human." }, { "start": 1271.1200000000001, "end": 1275.56, "text": " And here, it's it's sort of a symmetry filling task." }, { "start": 1275.56, "end": 1281.84, "text": " Now as a human, you need one demonstration to get this." }, { "start": 1281.84, "end": 1287.48, "text": " Maybe you need more, but many tasks involve some sort of symmetry." }, { "start": 1287.48, "end": 1293.72, "text": " Okay, drawing the symmetrized version around the version of a shape around a marker, that's" }, { "start": 1293.72, "end": 1299.12, "text": " going to be fairly hard for a machine to learn without without the developer knowing that" }, { "start": 1299.12, "end": 1302.1599999999999, "text": " this task is coming." }, { "start": 1302.16, "end": 1308.78, "text": " Okay, they highlight some differentiations to standard psychometric tests." }, { "start": 1308.78, "end": 1314.28, "text": " But what I find interesting here is that this thing, what a solution to arc may look like" }, { "start": 1314.28, "end": 1318.0800000000002, "text": " and what it would imply for AI applications." }, { "start": 1318.0800000000002, "end": 1320.9, "text": " They say we have found art to be fully solvable by humans." }, { "start": 1320.9, "end": 1326.8400000000001, "text": " So they set a human in front of every, every one of these tasks, and it's solvable." }, { "start": 1326.8400000000001, "end": 1331.3600000000001, "text": " While many arc tasks are intellectually challenging human test takes us appear to be able to solve" }, { "start": 1331.36, "end": 1336.9599999999998, "text": " the majority of tasks on their first try without any practice or verbal explanations." }, { "start": 1336.9599999999998, "end": 1344.7199999999998, "text": " In effect, in this task, you get three tries at each at each of the at each of the problems," }, { "start": 1344.7199999999998, "end": 1350.3999999999999, "text": " you get three, three tries and the humans can already solve it in one." }, { "start": 1350.3999999999999, "end": 1356.8, "text": " So that just shows you shows you how cool humans are." }, { "start": 1356.8, "end": 1365.28, "text": " So here is a shawley suggests a solution approach says by start by developing a domain specific" }, { "start": 1365.28, "end": 1372.24, "text": " language capable of expressing all possible situations, all possible solution programs" }, { "start": 1372.24, "end": 1375.28, "text": " for any arc task." }, { "start": 1375.28, "end": 1382.44, "text": " Since the exact set of arc tax is purposely not formally definable, this may be challenging." }, { "start": 1382.44, "end": 1387.3200000000002, "text": " The space of tasks is defined as anything expressible in terms of arc pairs that would" }, { "start": 1387.3200000000002, "end": 1389.96, "text": " only involve core knowledge." }, { "start": 1389.96, "end": 1395.88, "text": " So core knowledge is this set of human priors that we discussed last time like objectness" }, { "start": 1395.88, "end": 1402.0800000000002, "text": " and symmetries and geometric shapes and navigation and so on." }, { "start": 1402.0800000000002, "end": 1409.22, "text": " So he asks you to basically develop a DSL that can capture all the different tasks." }, { "start": 1409.22, "end": 1414.68, "text": " So so kept basically define a formalism of these tasks." }, { "start": 1414.68, "end": 1418.18, "text": " But it's hard because you don't know what the tasks are going to be." }, { "start": 1418.18, "end": 1423.72, "text": " So your best bet is probably to make a formalism that completely over represents what the tasks" }, { "start": 1423.72, "end": 1426.48, "text": " can be." }, { "start": 1426.48, "end": 1433.64, "text": " It would require hard coding the core knowledge priors from 3.1.2 in a sufficiently abstract" }, { "start": 1433.64, "end": 1440.4, "text": " and combinable program form to serve as a basis functions for a kind of human like reasoning" }, { "start": 1440.4, "end": 1441.5600000000002, "text": " DSL." }, { "start": 1441.5600000000002, "end": 1447.64, "text": " We believe that solving this specific subproblem is critical to a to general AI progress." }, { "start": 1447.64, "end": 1456.3600000000001, "text": " Basically says whenever we can describe this is like saying that this AI progress will" }, { "start": 1456.3600000000001, "end": 1461.0400000000002, "text": " make a big step once we can formally describe human priors." }, { "start": 1461.04, "end": 1468.92, "text": " And while true this I feel the hardness of this problem is as hard as actually building" }, { "start": 1468.92, "end": 1472.24, "text": " general artificial intelligence or very close to it." }, { "start": 1472.24, "end": 1482.52, "text": " So it is a bit of a like how to how to go how to build a GI step one build a GI that's" }, { "start": 1482.52, "end": 1487.76, "text": " sort of and not exactly but it's kind of what this says." }, { "start": 1487.76, "end": 1488.76, "text": " Right." }, { "start": 1488.76, "end": 1494.96, "text": " So if I could actually have this DSL to describe every single task and I could do it you know" }, { "start": 1494.96, "end": 1502.8, "text": " such that it is not not super over capturing all the tasks then I would be able and I would" }, { "start": 1502.8, "end": 1512.08, "text": " have described human core knowledge in a sufficiently accurate degree that I could just you know" }, { "start": 1512.08, "end": 1515.46, "text": " build a GI." }, { "start": 1515.46, "end": 1520.92, "text": " So he goes on says given a task use the DSL to generate a set of candidate programs that" }, { "start": 1520.92, "end": 1524.72, "text": " turn the input grids into the corresponding output grids." }, { "start": 1524.72, "end": 1529.8, "text": " This step would reuse and recombine sub programs that previously proved useful in other arc" }, { "start": 1529.8, "end": 1531.16, "text": " tasks." }, { "start": 1531.16, "end": 1535.04, "text": " So says whenever you have captured the core knowledge or whenever you have captured the" }, { "start": 1535.04, "end": 1540.72, "text": " problem space in a formal language you can simply use that formal language to express" }, { "start": 1540.72, "end": 1545.76, "text": " whatever your input is so the that turn the input grids into the corresponding output" }, { "start": 1545.76, "end": 1546.76, "text": " grids." }, { "start": 1546.76, "end": 1551.92, "text": " So you would put in these demonstration examples and describe this with your formal language" }, { "start": 1551.92, "end": 1557.3600000000001, "text": " that you have and you can somehow reuse and recombine sub programs that previously proved" }, { "start": 1557.3600000000001, "end": 1565.46, "text": " useful for basically asking you to write to come up with source code that would generate" }, { "start": 1565.46, "end": 1572.96, "text": " these demonstration examples in the language of your DSL." }, { "start": 1572.96, "end": 1578.44, "text": " And then he says select top candidates among these programs so you would generate multiple" }, { "start": 1578.44, "end": 1587.28, "text": " versions of source code that generate these things based on a criterion such as a program" }, { "start": 1587.28, "end": 1590.16, "text": " simplicity or program likelihood." }, { "start": 1590.16, "end": 1594.46, "text": " Note that we do not expect that merely selecting the simplest possible program that works on" }, { "start": 1594.46, "end": 1599.68, "text": " training pairs will generalize well to test pairs." }, { "start": 1599.68, "end": 1605.52, "text": " And then use the top three candidates to generate output grids for the test examples." }, { "start": 1605.52, "end": 1613.28, "text": " So I hope the approach here I feel it makes sense but it is sort of over hopeful in my" }, { "start": 1613.28, "end": 1617.32, "text": " mind and that's mainly because of step one." }, { "start": 1617.32, "end": 1622.04, "text": " So step one asks you to come up with like a programming language that can capture all" }, { "start": 1622.04, "end": 1628.52, "text": " the tasks in this all the tasks in the data set even though you don't know what the tasks" }, { "start": 1628.52, "end": 1635.2, "text": " are and that has this human core knowledge in inside of it in a in a formally describable" }, { "start": 1635.2, "end": 1636.42, "text": " way." }, { "start": 1636.42, "end": 1641.48, "text": " And then once you have that programming language you would if you're given this task where" }, { "start": 1641.48, "end": 1647.36, "text": " you have you know a bunch of these demonstration you have a bunch of these demonstration things" }, { "start": 1647.36, "end": 1655.4799999999998, "text": " and then you have the test thing you would generate all the programs that would produce" }, { "start": 1655.4799999999998, "end": 1661.6799999999998, "text": " these demonstration examples or that would given the demo given the input grade would" }, { "start": 1661.6799999999998, "end": 1666.56, "text": " produce the output grid right you would generate all the programs and then you would select" }, { "start": 1666.56, "end": 1672.04, "text": " somehow among all these programs the one that you think generalizes the most and you would" }, { "start": 1672.04, "end": 1678.6, "text": " use that program to put this in and get out the solution." }, { "start": 1678.6, "end": 1683.86, "text": " They say it's probably it's not always the simplest program not always the shortest program" }, { "start": 1683.86, "end": 1690.68, "text": " maybe who knows like I feel step one is the kind of the crucial issue here." }, { "start": 1690.68, "end": 1700.18, "text": " Okay so they say they make some claims here and about what this what this would bring" }, { "start": 1700.18, "end": 1704.64, "text": " the community we posit that the existence of human level arc solver would represent" }, { "start": 1704.64, "end": 1710.8, "text": " the ability to program and AI from demonstrations alone only requiring a handful of demonstrations" }, { "start": 1710.8, "end": 1717.8400000000001, "text": " to specify complex tasks to do a wide range of human relatable tasks of a kind that would" }, { "start": 1717.8400000000001, "end": 1724.48, "text": " normally require human level human like fluid intelligence." }, { "start": 1724.48, "end": 1728.64, "text": " As supporting evidence we note that human performance on psychometric intelligent test" }, { "start": 1728.64, "end": 1734.16, "text": " which are similar to our is predictive of success across all human cognitive tasks." }, { "start": 1734.16, "end": 1738.44, "text": " Further we posit that since an arc solver and human intelligence would be both founded" }, { "start": 1738.44, "end": 1743.24, "text": " on the same knowledge priors the scope of application of an arc solver would be closer" }, { "start": 1743.24, "end": 1748.5600000000002, "text": " to that of human cognition making it such a solver both practically valuable and easy" }, { "start": 1748.5600000000002, "end": 1755.44, "text": " to interact with and would produce behavior that is in line with human expectations." }, { "start": 1755.44, "end": 1762.72, "text": " Okay so they're making the same argument that anyone before has made but they condition" }, { "start": 1762.72, "end": 1767.88, "text": " it on some things and this is I think the conclusion of the entire article here of on" }, { "start": 1767.88, "end": 1772.6000000000001, "text": " the measure of intelligence because people had this hope and they say that here claims" }, { "start": 1772.6000000000001, "end": 1779.04, "text": " are highly speculative and may prove incorrect much like Newell's 1973 hopes that progress" }, { "start": 1779.04, "end": 1783.92, "text": " on chess playing would translate into meaningful progress and achieving a broad range of cognitive" }, { "start": 1783.92, "end": 1793, "text": " abilities especially if arc turns out to feature unforeseen vulnerabilities to unintelligent" }, { "start": 1793, "end": 1795.4, "text": " shortcuts." }, { "start": 1795.4, "end": 1802.44, "text": " This is the AI effect and basically means that whenever you think a task the solving" }, { "start": 1802.44, "end": 1808.6000000000001, "text": " of a task represents AI and then you actually see the solution then the solution turns out" }, { "start": 1808.6000000000001, "end": 1812.46, "text": " to be not AI in the eyes of the human." }, { "start": 1812.46, "end": 1817, "text": " So the human at first they would say oh this task really requires intelligence and then" }, { "start": 1817, "end": 1820.8, "text": " someone solves the task and they'll say oh that's not intelligence you kind of hacked" }, { "start": 1820.8, "end": 1826, "text": " your way to that and the expectation is that in this arc challenge there might be a hacky" }, { "start": 1826, "end": 1834, "text": " way to that but I mean the good question is when at what is there even a task like this" }, { "start": 1834, "end": 1840.42, "text": " arc challenge here could that is there even a possibility of a task where you wouldn't" }, { "start": 1840.42, "end": 1848.3600000000001, "text": " say that and I'm not so sure about this they seem to be more hopeful than I am but at least" }, { "start": 1848.3600000000001, "end": 1853.64, "text": " they say the arc challenge is founded on the same priors as a human has it gives you the" }, { "start": 1853.64, "end": 1859.88, "text": " same amount of experience as a human has right and therefore it is much more comparable to" }, { "start": 1859.88, "end": 1862.88, "text": " human intelligence." }, { "start": 1862.88, "end": 1870.92, "text": " They go over some weaknesses right here of criticizing their own thing generalization" }, { "start": 1870.92, "end": 1876.8000000000002, "text": " is not quantified so they have a measure of generalization in the previous chapter but" }, { "start": 1876.8000000000002, "end": 1882.6200000000001, "text": " they don't use it right here test validity is not established data set size and diversity" }, { "start": 1882.6200000000001, "end": 1892.3600000000001, "text": " may be limited and so on but I in my mind this I would not consider this as like an" }, { "start": 1892.36, "end": 1898.8799999999999, "text": " AGI task or anything like this I'm pretty sure the solution to this will come in a form" }, { "start": 1898.8799999999999, "end": 1904.8799999999999, "text": " again where people don't really think it's it exhibits intelligence but I do like the" }, { "start": 1904.8799999999999, "end": 1912.32, "text": " task as such and as a machine learner I am very excited to think about how machine learning" }, { "start": 1912.32, "end": 1920.84, "text": " can go about solving this task and especially with what we've seen from something like GPT-3" }, { "start": 1920.84, "end": 1926.3999999999999, "text": " it has exactly this kind of structure where you train on a giant data set blah blah blah" }, { "start": 1926.3999999999999, "end": 1932, "text": " you pre train your language model but then at inference time you input a bunch of these" }, { "start": 1932, "end": 1940.4399999999998, "text": " demonstration examples and you ask it for the next output so I feel that might be a" }, { "start": 1940.4399999999998, "end": 1948.84, "text": " good start for for doing it the question of course is what what then do you pre train" }, { "start": 1948.84, "end": 1955.56, "text": " this model on this GPT-3 for ARC what's the pre training data set for it and I guess that's" }, { "start": 1955.56, "end": 1962.32, "text": " going to be the challenge and probably going to require people to specifically program" }, { "start": 1962.32, "end": 1969.1, "text": " all of these priors into a data set generator for pre training so that would be my approach" }, { "start": 1969.1, "end": 1974.56, "text": " my approach would be write a data set generator for pre training and GPT-3 model to do these" }, { "start": 1974.56, "end": 1982.1599999999999, "text": " kind of tasks and in order to write the data set generator you'd have to basically program" }, { "start": 1982.1599999999999, "end": 1988.54, "text": " in all of these priors and that's not going to be easy because your best bet is to sort" }, { "start": 1988.54, "end": 1993.36, "text": " of put yourself into the shoes of Chalet and be like oh if I were to design a task what" }, { "start": 1993.36, "end": 1997.52, "text": " kind of things would I do and then try to capture that that's going to be your best" }, { "start": 1997.52, "end": 2004.48, "text": " bet your most honest bet with respect to the challenge is to try to as faithfully as possible" }, { "start": 2004.48, "end": 2011.04, "text": " implement something like an object Ness prior where cohesion and persistence are captured" }, { "start": 2011.04, "end": 2018.1, "text": " that would be the most scientifically sound approach to my approach alright so that was" }, { "start": 2018.1, "end": 2025.08, "text": " my take on the ARC data set if you have any comments I'm very excited to hear comments" }, { "start": 2025.08, "end": 2030.8, "text": " on this if you have already tried the ARC challenge have some insight I also welcome" }, { "start": 2030.8, "end": 2035.36, "text": " comments on that and with that I'll see you next time bye bye" } ]
q6Kyvy1zLwQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
BERTology Meets Biology: Interpreting Attention in Protein Language Models (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "bert", "transformer", "mlm", "language model", "masked language modeling", "proteins", "protein", "amino acid", "primary", "secondary", "tertiary", "structure", "helix", "strand", "band", "sheet", "turn", "binding site", "contact map", "dna", "rna", "amino acids", "proline", "phenylalanine" ]
Proteins are the workhorses of almost all cellular functions and a core component of life. But despite their versatility, all proteins are built as sequences of the same 20 amino acids. These sequences can be analyzed with tools from NLP. This paper investigates the attention mechanism of a BERT model that has been trained on protein sequence data and discovers that the language model has implicitly learned non-trivial higher-order biological properties of proteins. OUTLINE: 0:00 - Intro & Overview 1:40 - From DNA to Proteins 5:20 - BERT for Amino Acid Sequences 8:50 - The Structure of Proteins 12:40 - Investigating Biological Properties by Inspecting BERT 17:45 - Amino Acid Substitution 24:55 - Contact Maps 30:15 - Binding Sites 33:45 - Linear Probes 35:25 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.15222 Code: https://github.com/salesforce/provis My Video on BERT: https://youtu.be/-9evrZnBorM My Video on Attention: https://youtu.be/iDulhoQ2pro Abstract: Transformer architectures have proven to learn useful representations for protein classification and generation tasks. However, these representations present challenges in interpretability. Through the lens of attention, we analyze the inner workings of the Transformer and explore how the model discerns structural and functional properties of proteins. We show that attention (1) captures the folding structure of proteins, connecting amino acids that are far apart in the underlying sequence, but spatially close in the three-dimensional structure, (2) targets binding sites, a key functional component of proteins, and (3) focuses on progressively more complex biophysical properties with increasing layer depth. We also present a three-dimensional visualization of the interaction between attention and protein structure. Our findings align with known biological processes and provide a tool to aid discovery in protein engineering and synthetic biology. The code for visualization and analysis is available at this https URL. Authors: Jesse Vig, Ali Madani, Lav R. Varshney, Caiming Xiong, Richard Socher, Nazneen Fatema Rajani Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we'll look at Bertology meets Biology interpreting attention in protein language models by Jesse Vig, Ali Madani, Lav R Varshini, Kaiming Xiong, Richard Sokker and Nazneen Fatima Rajani. This paper is a investigative paper into models that are trained on biological data, specifically into BERT models. Actually into one specific BERT model that is trained on protein sequences. Now it is trained to simply perform language modeling on these protein sequences, but out of this language model you can then inspect this BERT model and read important biological data of these proteins, higher order data from the attention heads of the BERT model, which is pretty interesting. Basically means that the information of these higher order functions is at some point encoded in the structure of the language of the protein sequence. So we're going to go through what this means and how this comes about and what they did in order to investigate. I think this is a pretty cool investigative work and probably very promising for future research. Yeah, as always if you like content like this, consider sharing it out and leaving a like. Also tell me what you think in the comments. So biology. Really quick for people who maybe have never heard this. In your every cell you have this thing called DNA, which basically is 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 I think negatively charged, some are neutral, some are acids and so on. So they have very different chemical properties. So once you build this protein and you kind of release it into the cell it will curl up into a three-dimensional structure. So this one might be doing something like this and sort of form a circle or something like this. Just because these proteins here they kind of attract each other maybe electrically and thus the protein forms a circle and the function of the protein is very much related to its shape. So if it is a circle it could maybe trap something else in here. So you really have to think of these things like kind of tools. There are proteins that cut other proteins and they are really shaped sort of like a scissor that exactly fits these other proteins such that you can effectively cut them. So sometimes you can substitute an amino acid for a different amino acid like this here. If it doesn't change the shape very often you're fine. The protein function isn't changed. But if you change a different amino acid that is sort of vital to the shape and the shape changes then your protein very often loses function. So mutations in DNA sometimes lead to mutations in protein. Not always because there is some redundancy in this translation step from RNA. But if they do lead to a different amino acid it doesn't actually mean that the function changes. So there is sort of value in analyzing the sequence of the structure of proteins rather than the structure of DNA. Of course it's also important to analyze the structure of DNA but it is equally important to analyze the structure of proteins because not all the information is in the sequence. Not all the obvious information is in the sequence. So what does this paper do? This paper goes and takes a model that has been trained on protein data. So if you look at this protein it is simply a sequence of amino acids and these amino acids they all have names. I think I have a table somewhere here. Yes so these are the different amino acids that exist and you can see a protein is simply a sequence of these names. So usually they're abbreviated by like a three-letter abbreviation or just a one-letter abbreviation. So a protein might be AVMMVAG and so on. And this is just a string of text. So what I can do is I can train a language model on this. A language model is simply a model that takes a piece of text and tells you what's the next piece of text. So what's the next letter, what's the next word, in this case what's the next amino acid. And we can use tools from NLP for that. Specifically we can train a BERT model. Now BERT works a bit differently than a standard language model. BERT does what is called masked language modeling. So you would take this string, you would feed it into a BERT model right here. And I've made an entire video on BERT if you want to check that out. And what you'll do by inputting that you'll mask out some of the tokens. So you'll maybe mask out this one, mask out this one, and then you ask the model to reconstruct those. 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. So it has to reconstruct this sequence. So the hope here is, in natural language, is that BERT somehow learns something about language itself. By being able to reconstruct these things it has learned something about language, about which words appear together and when. It might even learn very long distance relationships between words just because it has to predict those. And the idea carries over to biology. So we might hope that a BERT trained on an amino acid sequence will learn something about the language of proteins, about the amino acid sequence. And our goal here is to ask, can we somehow infer the 3D shape of a protein, which is the important part, from its sequence right here? So given its sequence, can we infer the 3D shape? Now as I understand it, usually this has to be done in like a simulation. So you would 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 in what does the BERT model learn about the 3D shape while only ever having been trained on predicting the sequence of amino acids. So it's never been trained to look at the 3D shape. And that's our goal here. So specifically we'll look at two different things. So here you can see examples of proteins and their high-level 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 turn. 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 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 what 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. 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. And we are interested does BERT, the BERT that is only trained on a language modeling objective, know which ones are the binding sites? Because you know that would be very interesting and not something BERT was trained on. By the way I particularly liked Richard Sockers tweet on this. I think he tweeted out, oh BERT trained only on language model can predict binding sites and biological properties and formulated it like it was you know like GPT-3 was formulated like if we train on Wikipedia our model can do math. I thought it was kind of a satire headline. If we train on Wikipedia our model can predict biology and also it can tie your shoes and cook your dinner. So it's trained on language modeling on biological data and now that makes sense. So they're going to look at two different things or actually more than two different things but they formulate this in an abstract way right here. So what they'll look at is the so-called properties. A property F and this property F can be for example that a amino acid is a binding site. The property F can also be that two amino acids are in contact with each other. So F always takes I and J. If in the case for example where this is the contact property then it simply is the indicator function for when I and J are in contact. And if it is a just a binding site then I think we are looking at J. At the token level property we define to be an indicator that returns one if the property is present in token J. So whenever J is a binding site then that holds. So what we're looking at are these attention heads in BERT. If you don't know BERT has an attention mechanism which basically means from layer to layer each token can attend to all other tokens. So here the amino acid sequence I've drawn it twice and the next layer representation of this amino acid will be able to gather information from all of the other amino acid through an attention mechanism through a dynamic routing algorithm. I've made a video on attention is all you need if you want to find out more how this works. Now what we're interested in is the strength of these connections. So the hypothesis is if molecule 1 and 3 are contact sites then maybe we will find a layer where this connection between 1 and 3 is very strong. That would indicate that there is a connection site or that would indicate that BERT has learned something about the connection sites. If we find this repeatedly so if we look at many many proteins and whenever we know that there is a contact between two things and then we observe that the corresponding attention is very high then we can be pretty sure that BERT has learned something about contact between amino acids. The same goes for binding sites so if 4 here is a binding site and then all the connections all the attention that the higher layer gets from 4 so all the information routed away from 4 is very strong that means all these other tokens are paying special attention to the token number 4 to this amino acid and if we find that there's a big correlation with this being a binding site then we can reasonably conclude that BERT has learned something about binding sites. So we're going to do a correlative analysis for proteins where we know the binding sites where we know the contacts. We can analyze them we can run simulations therefore we can know them. So we're going to look at this quantity right here which is simply a normalized quantity. So we're going to look at the attention in a given attention head so as you know BERT has many layers with many attention heads and we're going to look at whether or not this property is active and just normalize it by the total attention in that head so that we get some kind of a percentage number. That's the first task we're basically going to look at how does the attention correlate with these properties and the second task we're going to do is this probing task. So a probing task is like a linear probe in like a classifier so what we're going to do is we're going to take a layer right here and even though it's an intermediate layer we're simply going to run it through a linear classifier and then decide is this a binding site for example or not. Is a given amino acid a binding site or not? Is a given pair a contact or not? So this is kind of a linear probe but this sort of takes a backseat in this paper the analysis is really on the attention heads and what the attention heads learn. And that's already it they don't they take a pre-trained BERT model so there are these BERT models that are already trained on these protein databases and first they look simply can we find attention heads that correlate with a given amino acid. So here you see the attention to the amino acid this is proline I believe and this is phenylalanine is that the same in English? Yes phenylalanine and proline right here. So you can see that the the plots here are there's almost no attention pretty much throughout the network that pays special attention to the amino acid proline except this head right here seems to have if you look at the scale over like a 70% of attention always goes to proline in this particular head so this is layer 1 head number 11 focuses 78% of its attention on proline. Now this is not that special if you think about it because in language models as well in natural language models you might want to think that you have some mechanism in your neural network that's especially specialized on like a very particular word in the language because that might just be a often occurring very particular word for example in English maybe the is very important or the word what these these are like very indicative very often occurring words so it is reasonable to expect to find a an attention head that pays a lot of attention to these things especially here where our vocabulary size is 20 instead of like 30,000 in natural language. And the same goes for this phenylalanine where you can see that in the 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 why does this make sense because what we would expect from like single tokens these are not interactions yet these are not biological functions yet so we know that in the lower layers of a neural network we have these kind of basic features basic feature extractors and here these basic feature extractors appear to be simply paying attention to one specific token in the vocabulary a lot okay so they kind of these heads sort of specialize for single for single amino acids and the same in the last layer so in the very last layer the the task of the very last layer is to prepare for the classification tasks so if you remember the BERT model you have layer layer layer layer and at the end you'll have to predict which ones are masked down here so at the end you'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 where would you expect them we would expect the let's say the tertiary sorry the secondary structures which are sort of one level higher than the primary structure we would expect to find them maybe here and then we would expect to find the tertiary structures maybe somewhere here okay because these are most highest level and then it goes it goes back again or maybe it's like we find the tertiary structures rather here and here again and then in the middle we'll find the the most high-level the tertiary structure sorry yeah blue secondary this drawing is getting too too too weird but there there could be multiple scenarios but that could fit here but until now it sort of makes sense so they do it as an additional investigation where as I told you sometimes you can substitute an amino acid and nothing really happens right and in fact that this probably happens in you right now you probably might have some mutation that changed some amino acid and you don't even realize because it's just it's fine no notice so the biologists can build these matrices of how much you can substitute proteins with each other so here you see this blossom 62 substitution scores which are very I guess very high if you can substitute two protein two amino acids with each other and the effect is negligible and it's very low if it's the other way around now this is interesting so far but you compare this to this matrix right here this is the attention similarity so what we'll do is for each two amino acids we take those two attention things those two attention matrices and we'll calculate the correlation between the attention matrices and our hypothesis is that the more correlated the attention patterns are between the two amino acids the more likely we are to substitute them because as a direct result of our language model our language model is it's reconstructing right these things so our language model is going to treat if in natural language is like a 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 have a look for a little while and you'll see that the patterns they do not match perfectly but they are very very similar the dark spots are in the same places the light spots are in the same places so this already makes a good case that the language model here has learned something about biology now what we want to do is we want to investigate higher order higher order functions so here we are 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 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 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 will we find it in this attention head right here so this layer 12 head number four will always peek out whenever two things are in contact now you can see that it's it's not like always it's like 25% of its attention but significantly more than anything else right here in fact if you group the things by this attention you can build the following plot so you can see right here probability two amino acids are in contact as a function of attention between the amino acids in head 12 for showing attention approximates perfectly calibrated estimator which would be the green line so here we simply for each 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 funk a higher level biological structure just from the language modeling objective how can we interpret this this must somehow mean that it is it is possible it is vital to it is vital for reconstructing the sequence from its surroundings so if we delete this right here if if this if these two are in contact in the 3d structure that makes probably probably means that this thing right here is a very good predictor of what was here 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 they have very special they have very special connection to each other it's very you can basically read out from this one which one this was this is sort of like if you have a sentence and you say does I don't know I can't come up with with one right now but if it's like da da da da da and then there is a name like mark and then 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 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 ah it's mark okay so it's not like it's not like it or some or or 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 these binding sites now these are single properties of of of different amino acids and we're simply looking at all the incoming or sorry all the F all the other tokens that focuses their attention why is this important because these binding sites are central to the structure of the or to the function of the protein right if this here is a binding site then that's a very central important point of the protein so a lot of these other things are going to be determined by what this binding site is this binding site needs to have a very spurted 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 the we find that it's a bit more murky than before so you can see that the attention is kind of spread out percentage of each head's attention that focuses on binding sites especially in the deeper layers binding sites are targeted at much higher frequency than would occur by chance head 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 and you can see here this head is the highest with 34% of its attention focused on binding sites you can also see the general trend of the attention being rather in the later layers which we would expect from a tertiary structure now yeah it would be interesting here here you also see that actually most of the things are in the in the last layer which points to points to rather maybe lower lower level information because we reasoned before about the last layer or I was just wrong but also in a general trend you can see that the attention is rather shifted towards the later layers because this is sort of a higher order function okay if you look at the same calibration experiment you can see that the picture is not as clear there is the general trend at the beginning but then it sort of flattens out so you can sort of differentiate the very probably not a binding site from the somewhat probably a binding site but it's not a perfectly calibrated classifier and that might just be because there are many things specializing in different types of binding sites so you can't just go to this one head so this is just for this one head you can't just go to that one and expect that to classify all the binding sites because you might want to be you might want to combine all of the high ranking ones here to form a classifier the last experiment they do is these linear probes which where they just go and they just build classifiers from different parts of the network and you can see right here that what is predicted and how well they work so each bar here is going to be the difference of performance so this is differential performance of diagnostic classifier by layer sorted by task order in figure 8 each plot shows the change in performance between the given layer and the previous layer okay 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 at towards the middle of the end of the network than the 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 the secondary structures this their center of mass is at a lower layer in general than the tertiary functions all of this is not perfect of course but it's still an open question I guess whether or not it's not perfect because we haven't built a strong enough language model yet do I want to say GPT-4 is now for biology and not for language or is it because there is really you need you really can't very well predict the 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 this was the paper it's pretty simple they have the in the appendix they have a lot of a lot of these additional experiments or full experiments I believe for all the amino acids and so on and I invite you to check that out in general I like this kind of work because it's very applied it's and it can you know tell us something about the nature of both these language models and the biological things that we that we care about in biology okay I'm just talking crap right now thanks for being here I hope you enjoyed it and bye bye
[ { "start": 0, "end": 5.84, "text": " Hi there! Today we'll look at Bertology meets Biology interpreting attention in" }, { "start": 5.84, "end": 11.92, "text": " protein language models by Jesse Vig, Ali Madani, Lav R Varshini, Kaiming Xiong," }, { "start": 11.92, "end": 19.92, "text": " Richard Sokker and Nazneen Fatima Rajani. This paper is a investigative paper into" }, { "start": 19.92, "end": 25.560000000000002, "text": " models that are trained on biological data, specifically into BERT models." }, { "start": 25.56, "end": 31.88, "text": " Actually into one specific BERT model that is trained on protein sequences." }, { "start": 31.88, "end": 38.12, "text": " Now it is trained to simply perform language modeling on these protein" }, { "start": 38.12, "end": 45, "text": " sequences, but out of this language model you can then inspect this BERT model and" }, { "start": 45, "end": 51.72, "text": " read important biological data of these proteins, higher order data from the" }, { "start": 51.72, "end": 56.04, "text": " attention heads of the BERT model, which is pretty interesting. Basically means" }, { "start": 56.04, "end": 61.92, "text": " that the information of these higher order functions is at some point encoded" }, { "start": 61.92, "end": 68.16, "text": " in the structure of the language of the protein sequence. So we're going to go" }, { "start": 68.16, "end": 74.28, "text": " through what this means and how this comes about and what they did in order" }, { "start": 74.28, "end": 79.48, "text": " to investigate. I think this is a pretty cool investigative work and probably" }, { "start": 79.48, "end": 87.24000000000001, "text": " very promising for future research. Yeah, as always if you like content" }, { "start": 87.24000000000001, "end": 92.76, "text": " like this, consider sharing it out and leaving a like. Also tell me what you" }, { "start": 92.76, "end": 101.48, "text": " think in the comments. So biology. Really quick for people who maybe have never" }, { "start": 101.48, "end": 108.56, "text": " heard this. In your every cell you have this thing called DNA, which basically is" }, { "start": 108.56, "end": 114.8, "text": " an encoding of all of your biological functions. Now usually biological" }, { "start": 114.8, "end": 120.76, "text": " functions are realized through proteins. So DNA is basically a building plan for" }, { "start": 120.76, "end": 126.08, "text": " all of your proteins. This happens in the following two steps. First there is this" }, { "start": 126.08, "end": 132.72, "text": " transcription step where RNA is built. This is basically a copy of your DNA, but" }, { "start": 132.72, "end": 137.04, "text": " it's only single strand as you can see right here. And then there is a" }, { "start": 137.04, "end": 143.72, "text": " translation step that finally translates the RNA into the protein. What will end" }, { "start": 143.72, "end": 149.44, "text": " up is just a sequence of these beads right here. Now these beads are what are" }, { "start": 149.44, "end": 155.04, "text": " called amino acids. So a protein is simply a chain of these amino acids." }, { "start": 155.04, "end": 161.51999999999998, "text": " There are 20 different amino acids and the order of these amino acids in the" }, { "start": 161.51999999999998, "end": 166.88, "text": " chain makes the function of the protein. Now specifically we know about these" }, { "start": 166.88, "end": 172.6, "text": " proteins that it seems to be very important how their three-dimensional" }, { "start": 172.6, "end": 177.44, "text": " shape is. So a lot of these different amino acids have different chemical" }, { "start": 177.44, "end": 184.6, "text": " properties. Some are sort of I think negatively charged, some are neutral, some" }, { "start": 184.6, "end": 189.07999999999998, "text": " are acids and so on. So they have very different chemical properties. So once" }, { "start": 189.07999999999998, "end": 194.68, "text": " you build this protein and you kind of release it into the cell it will curl up" }, { "start": 194.68, "end": 198.72, "text": " into a three-dimensional structure. So this one might be doing" }, { "start": 198.72, "end": 205.48000000000002, "text": " something like this and sort of form a circle or something like this." }, { "start": 205.48000000000002, "end": 210.8, "text": " Just because these proteins here they kind of attract each other maybe" }, { "start": 210.8, "end": 216.52, "text": " electrically and thus the protein forms a circle and the function of the protein" }, { "start": 216.52, "end": 222.24, "text": " is very much related to its shape. So if it is a circle it could maybe trap" }, { "start": 222.24, "end": 226.48000000000002, "text": " something else in here. So you really have to think of these things like kind" }, { "start": 226.48000000000002, "end": 231.24, "text": " of tools. There are proteins that cut other proteins and they are really" }, { "start": 231.24, "end": 238.4, "text": " shaped sort of like a scissor that exactly fits these other proteins such" }, { "start": 238.4, "end": 245.12, "text": " that you can effectively cut them. So sometimes you can substitute an" }, { "start": 245.12, "end": 250.56, "text": " amino acid for a different amino acid like this here. If it doesn't change the" }, { "start": 250.56, "end": 257.4, "text": " shape very often you're fine. The protein function isn't changed." }, { "start": 257.4, "end": 262.56, "text": " But if you change a different amino acid that is sort of vital to the shape and" }, { "start": 262.56, "end": 269.68, "text": " the shape changes then your protein very often loses function. So mutations in" }, { "start": 269.68, "end": 277.96, "text": " DNA sometimes lead to mutations in protein. Not always because there is some" }, { "start": 277.96, "end": 282.64, "text": " redundancy in this translation step from RNA. But if they do lead to a" }, { "start": 282.64, "end": 288, "text": " different amino acid it doesn't actually mean that the function changes. So there" }, { "start": 288, "end": 294.64, "text": " is sort of value in analyzing the sequence of the structure of proteins" }, { "start": 294.64, "end": 298.56, "text": " rather than the structure of DNA. Of course it's also important to analyze" }, { "start": 298.56, "end": 304.47999999999996, "text": " the structure of DNA but it is equally important to analyze the" }, { "start": 304.48, "end": 310.88, "text": " structure of proteins because not all the information is in the" }, { "start": 310.88, "end": 317.6, "text": " sequence. Not all the obvious information is in the sequence. So what does this" }, { "start": 317.6, "end": 323.44, "text": " paper do? This paper goes and takes a model that has been trained on protein" }, { "start": 323.44, "end": 329.36, "text": " data. So if you look at this protein it is simply a sequence of amino acids and" }, { "start": 329.36, "end": 333.36, "text": " these amino acids they all have names. I think I have a table somewhere here." }, { "start": 333.36, "end": 340.24, "text": " Yes so these are the different amino acids that exist and you can see a" }, { "start": 340.24, "end": 347.68, "text": " protein is simply a sequence of these names. So usually they're abbreviated by" }, { "start": 347.68, "end": 352.6, "text": " like a three-letter abbreviation or just a one-letter abbreviation. So a protein" }, { "start": 352.6, "end": 363.52000000000004, "text": " might be AVMMVAG and so on. And this is just a string of text. So what I" }, { "start": 363.52000000000004, "end": 368.36, "text": " can do is I can train a language model on this. A language model is simply a" }, { "start": 368.36, "end": 374.56, "text": " model that takes a piece of text and tells you what's the next piece of text." }, { "start": 374.56, "end": 378.12, "text": " So what's the next letter, what's the next word, in this case what's the next" }, { "start": 378.12, "end": 385.16, "text": " amino acid. And we can use tools from NLP for that. Specifically we can train a" }, { "start": 385.16, "end": 389.96, "text": " BERT model. Now BERT works a bit differently than a standard language" }, { "start": 389.96, "end": 394.04, "text": " model. BERT does what is called masked language modeling. So you would take this" }, { "start": 394.04, "end": 399.44, "text": " string, you would feed it into a BERT model right here. And I've made an entire" }, { "start": 399.44, "end": 405.04, "text": " video on BERT if you want to check that out. And what you'll do by inputting" }, { "start": 405.04, "end": 409.36, "text": " that you'll mask out some of the tokens. So you'll maybe mask out this one, mask" }, { "start": 409.36, "end": 414.44, "text": " out this one, and then you ask the model to reconstruct those. We say that here is" }, { "start": 414.44, "end": 419, "text": " an M and here is an A without seeing them. So the model somehow has to learn" }, { "start": 419, "end": 427.48, "text": " from the surrounding amino acids what this amino acid could be. So it has" }, { "start": 427.48, "end": 433.96000000000004, "text": " to reconstruct this sequence. So the hope here is, in natural language, is that" }, { "start": 433.96, "end": 440.12, "text": " BERT somehow learns something about language itself. By being able to" }, { "start": 440.12, "end": 444.03999999999996, "text": " reconstruct these things it has learned something about language, about which" }, { "start": 444.03999999999996, "end": 448.56, "text": " words appear together and when. It might even learn very long distance" }, { "start": 448.56, "end": 455.79999999999995, "text": " relationships between words just because it has to predict those. And the idea" }, { "start": 455.79999999999995, "end": 463.47999999999996, "text": " carries over to biology. So we might hope that a BERT trained on an amino" }, { "start": 463.48, "end": 469.72, "text": " acid sequence will learn something about the language of proteins," }, { "start": 469.72, "end": 477, "text": " about the amino acid sequence. And our goal here is to ask, can we somehow" }, { "start": 477, "end": 483.96000000000004, "text": " infer the 3D shape of a protein, which is the important part, from its sequence" }, { "start": 483.96000000000004, "end": 491.16, "text": " right here? So given its sequence, can we infer the 3D shape? Now as I understand" }, { "start": 491.16, "end": 496.08000000000004, "text": " it, usually this has to be done in like a simulation. So you would build" }, { "start": 496.08000000000004, "end": 502.32000000000005, "text": " this in a simulator and then you do like some sort of a molecule simulation to" }, { "start": 502.32000000000005, "end": 507.72, "text": " see how this ends up in a 3D shape. You could train a model to just predict the" }, { "start": 507.72, "end": 511.76000000000005, "text": " 3D shape, but in this case we're just interested in what does the BERT model" }, { "start": 511.76000000000005, "end": 518.6800000000001, "text": " learn about the 3D shape while only ever having been trained on predicting the" }, { "start": 518.68, "end": 524.9599999999999, "text": " sequence of amino acids. So it's never been trained to look at the" }, { "start": 524.9599999999999, "end": 530.5999999999999, "text": " 3D shape. And that's our goal here. So specifically we'll look at two different" }, { "start": 530.5999999999999, "end": 535.3599999999999, "text": " things. So here you can see examples of proteins and their high-level structures." }, { "start": 535.3599999999999, "end": 541.76, "text": " So in these proteins what you call the primary structure is this sequence of" }, { "start": 541.76, "end": 547.76, "text": " amino acid. This is simply which amino acids are in which order. There is a" }, { "start": 547.76, "end": 554.08, "text": " thing called the secondary structures and we often observe that spans of these" }, { "start": 554.08, "end": 559.92, "text": " amino acids like substrings form these what are called these helixes as you can" }, { "start": 559.92, "end": 567.72, "text": " see here or these sheets. I don't know how they're strands in English. We call" }, { "start": 567.72, "end": 572.04, "text": " them sheets or I think these are the alpha helixes and these are the beta" }, { "start": 572.04, "end": 578, "text": " sheets and there is also a turn. I think this here might be a turn. So there are" }, { "start": 578, "end": 585.04, "text": " these kind of secondary structures and then the tertiary structure is how these" }, { "start": 585.04, "end": 589.64, "text": " this is still one protein. This is one unbroken chain of amino acid." }, { "start": 589.64, "end": 594.12, "text": " And you can see this here kind of forms this double ring which would be its" }, { "start": 594.12, "end": 600.9599999999999, "text": " tertiary structure. Very important for predicting the tertiary structure is to" }, { "start": 600.96, "end": 606.84, "text": " predict when two amino acids are close to each other. So if we have a chain" }, { "start": 606.84, "end": 612.8000000000001, "text": " right here and the chain as we saw before kind of turns and bends on itself" }, { "start": 612.8000000000001, "end": 619.48, "text": " then these two amino acids here are very close in close contact. And to predict" }, { "start": 619.48, "end": 626.2800000000001, "text": " which amino acids are in close contact to each other helps you determine the" }, { "start": 626.28, "end": 632.3199999999999, "text": " the tertiary structure. So that's a consequence of it. So we wonder does" }, { "start": 632.3199999999999, "end": 638.76, "text": " BERT know intrinsically which of these amino acids are going to end up being in" }, { "start": 638.76, "end": 644.04, "text": " contact with each other without ever having been trained to do it? The second" }, { "start": 644.04, "end": 649.76, "text": " thing we're interested in are binding sites. So here what you might not be able" }, { "start": 649.76, "end": 654.76, "text": " to see but we made this example before where this sort of forms a loop and then" }, { "start": 654.76, "end": 661.08, "text": " I say can trap something here right like another molecule. And this is what" }, { "start": 661.08, "end": 668.8, "text": " we would call a binding site. A binding site is a one amino acid that maybe" }, { "start": 668.8, "end": 673.72, "text": " through the structure of the surrounding amino acid as well but also through its" }, { "start": 673.72, "end": 680.64, "text": " properties and how it is exposed in 3d shape acts as sort of a receptor for" }, { "start": 680.64, "end": 687.92, "text": " other molecules. It binds to other things. So think of your hemoglobin" }, { "start": 687.92, "end": 695.04, "text": " that traps the oxygen in your blood or something like this. It is where a" }, { "start": 695.04, "end": 700.5, "text": " chemical reaction or a reaction with something else will happen. That's a" }, { "start": 700.5, "end": 706.6, "text": " binding site. And we are interested does BERT, the BERT that is only trained on a" }, { "start": 706.6, "end": 714.2, "text": " language modeling objective, know which ones are the binding sites? Because you" }, { "start": 714.2, "end": 719.28, "text": " know that would be very interesting and not something BERT was trained on. By the" }, { "start": 719.28, "end": 724, "text": " way I particularly liked Richard Sockers tweet on this. I think he tweeted" }, { "start": 724, "end": 729.72, "text": " out, oh BERT trained only on language model can predict binding sites and" }, { "start": 729.72, "end": 735.1800000000001, "text": " biological properties and formulated it like it was you know like GPT-3 was" }, { "start": 735.18, "end": 741, "text": " formulated like if we train on Wikipedia our model can do math. I thought it was" }, { "start": 741, "end": 746.56, "text": " kind of a satire headline. If we train on Wikipedia our model can predict biology" }, { "start": 746.56, "end": 752.7199999999999, "text": " and also it can tie your shoes and cook your dinner. So it's trained on" }, { "start": 752.7199999999999, "end": 758.3599999999999, "text": " language modeling on biological data and now that makes sense. So they're going to" }, { "start": 758.3599999999999, "end": 764.68, "text": " look at two different things or actually more than two different things but" }, { "start": 764.68, "end": 771, "text": " they formulate this in an abstract way right here. So what they'll look at is" }, { "start": 771, "end": 778.1999999999999, "text": " the so-called properties. A property F and this property F can be for example" }, { "start": 778.1999999999999, "end": 785.7199999999999, "text": " that a amino acid is a binding site. The property F can also be that two amino" }, { "start": 785.7199999999999, "end": 793.12, "text": " acids are in contact with each other. So F always takes I and J. If in the case" }, { "start": 793.12, "end": 798.76, "text": " for example where this is the contact property then it simply is the indicator" }, { "start": 798.76, "end": 810.08, "text": " function for when I and J are in contact. And if it is a just a binding site then" }, { "start": 810.08, "end": 817.52, "text": " I think we are looking at J. At the token level property we define to be an" }, { "start": 817.52, "end": 823.48, "text": " indicator that returns one if the property is present in token J. So whenever" }, { "start": 823.48, "end": 828.52, "text": " J is a binding site then that holds. So what we're looking at are these" }, { "start": 828.52, "end": 833.84, "text": " attention heads in BERT. If you don't know BERT has an attention mechanism" }, { "start": 833.84, "end": 840.56, "text": " which basically means from layer to layer each token can attend to all other" }, { "start": 840.56, "end": 846.0799999999999, "text": " tokens. So here the amino acid sequence I've drawn it twice and the next layer" }, { "start": 846.08, "end": 851.2, "text": " representation of this amino acid will be able to gather information from all" }, { "start": 851.2, "end": 855.6, "text": " of the other amino acid through an attention mechanism through a dynamic" }, { "start": 855.6, "end": 860.32, "text": " routing algorithm. I've made a video on attention is all you need if you want to" }, { "start": 860.32, "end": 867.5600000000001, "text": " find out more how this works. Now what we're interested in is the strength of" }, { "start": 867.56, "end": 879.88, "text": " these connections. So the hypothesis is if molecule 1 and 3 are" }, { "start": 879.88, "end": 888.68, "text": " contact sites then maybe we will find a layer where this connection between 1" }, { "start": 888.68, "end": 893.7199999999999, "text": " and 3 is very strong. That would indicate that there is a connection" }, { "start": 893.72, "end": 899.36, "text": " site or that would indicate that BERT has learned something about the" }, { "start": 899.36, "end": 903.6800000000001, "text": " connection sites. If we find this repeatedly so if we look at many" }, { "start": 903.6800000000001, "end": 909.88, "text": " many proteins and whenever we know that there is a contact between two things" }, { "start": 909.88, "end": 914.76, "text": " and then we observe that the corresponding attention is very high" }, { "start": 914.76, "end": 920.84, "text": " then we can be pretty sure that BERT has learned something about contact between" }, { "start": 920.84, "end": 930.4, "text": " amino acids. The same goes for binding sites so if 4 here is a binding" }, { "start": 930.4, "end": 936.24, "text": " site and then all the connections all the attention that the higher layer" }, { "start": 936.24, "end": 941.52, "text": " gets from 4 so all the information routed away from 4 is very strong that" }, { "start": 941.52, "end": 946.84, "text": " means all these other tokens are paying special attention to the token number 4" }, { "start": 946.84, "end": 952.8000000000001, "text": " to this amino acid and if we find that there's a big correlation with this" }, { "start": 952.8000000000001, "end": 957.0400000000001, "text": " being a binding site then we can reasonably conclude that BERT has" }, { "start": 957.0400000000001, "end": 962.84, "text": " learned something about binding sites. So we're going to do a correlative" }, { "start": 962.84, "end": 967.5600000000001, "text": " analysis for proteins where we know the binding sites where we know the" }, { "start": 967.5600000000001, "end": 973.96, "text": " contacts. We can analyze them we can run simulations therefore we can know" }, { "start": 973.96, "end": 979.44, "text": " them. So we're going to look at this quantity right here which is simply a" }, { "start": 979.44, "end": 983.6, "text": " normalized quantity. So we're going to look at the attention in a given" }, { "start": 983.6, "end": 988.9200000000001, "text": " attention head so as you know BERT has many layers with many attention heads" }, { "start": 988.9200000000001, "end": 995.08, "text": " and we're going to look at whether or not this property is active and just" }, { "start": 995.08, "end": 1000.0400000000001, "text": " normalize it by the total attention in that head so that we get some kind of a" }, { "start": 1000.04, "end": 1005.4399999999999, "text": " percentage number. That's the first task we're basically going to look at how" }, { "start": 1005.4399999999999, "end": 1009.92, "text": " does the attention correlate with these properties and the second task we're" }, { "start": 1009.92, "end": 1016.8, "text": " going to do is this probing task. So a probing task is like a linear probe in" }, { "start": 1016.8, "end": 1023.36, "text": " like a classifier so what we're going to do is we're going to take a layer right" }, { "start": 1023.36, "end": 1028.2, "text": " here and even though it's an intermediate layer we're simply going" }, { "start": 1028.2, "end": 1034.4, "text": " to run it through a linear classifier and then decide is this a binding site" }, { "start": 1034.4, "end": 1040.4, "text": " for example or not. Is a given amino acid a binding site or not? Is a" }, { "start": 1040.4, "end": 1046.88, "text": " given pair a contact or not? So this is kind of a linear probe but this sort of" }, { "start": 1046.88, "end": 1051.68, "text": " takes a backseat in this paper the analysis is really on the attention" }, { "start": 1051.68, "end": 1056.8, "text": " heads and what the attention heads learn. And that's already it they don't" }, { "start": 1056.8, "end": 1062.04, "text": " they take a pre-trained BERT model so there are these BERT models that are" }, { "start": 1062.04, "end": 1068.48, "text": " already trained on these protein databases and first they look simply can" }, { "start": 1068.48, "end": 1075.24, "text": " we find attention heads that correlate with a given amino acid. So here you see" }, { "start": 1075.24, "end": 1082.3999999999999, "text": " the attention to the amino acid this is proline I believe and this is phenylalanine" }, { "start": 1082.4, "end": 1090.2800000000002, "text": " is that the same in English? Yes phenylalanine and proline right here." }, { "start": 1090.2800000000002, "end": 1100.3200000000002, "text": " So you can see that the the plots here are there's almost no attention pretty" }, { "start": 1100.3200000000002, "end": 1105.2800000000002, "text": " much throughout the network that pays special attention to the amino acid" }, { "start": 1105.28, "end": 1113.16, "text": " proline except this head right here seems to have if you look at the scale" }, { "start": 1113.16, "end": 1120.16, "text": " over like a 70% of attention always goes to proline in this particular head so" }, { "start": 1120.16, "end": 1131.8, "text": " this is layer 1 head number 11 focuses 78% of its attention on proline. Now this" }, { "start": 1131.8, "end": 1137.2, "text": " is not that special if you think about it because in language models as well in" }, { "start": 1137.2, "end": 1142.18, "text": " natural language models you might want to think that you have some mechanism in" }, { "start": 1142.18, "end": 1146.2, "text": " your neural network that's especially specialized on like a very particular" }, { "start": 1146.2, "end": 1151.1599999999999, "text": " word in the language because that might just be a often occurring very" }, { "start": 1151.1599999999999, "end": 1157.9199999999998, "text": " particular word for example in English maybe the is very important or the" }, { "start": 1157.92, "end": 1164.24, "text": " word what these these are like very indicative very often occurring words so" }, { "start": 1164.24, "end": 1168.44, "text": " it is reasonable to expect to find a an attention head that pays a lot of" }, { "start": 1168.44, "end": 1173.1200000000001, "text": " attention to these things especially here where our vocabulary size is 20" }, { "start": 1173.1200000000001, "end": 1179.8400000000001, "text": " instead of like 30,000 in natural language. And the same goes for this" }, { "start": 1179.8400000000001, "end": 1186.42, "text": " phenylalanine where you can see that in the layer in the last layer and in the" }, { "start": 1186.42, "end": 1190, "text": " first layer you have attention and also in the proline you have in the last" }, { "start": 1190, "end": 1194.3600000000001, "text": " layer so why does this make sense because what we would expect from like" }, { "start": 1194.3600000000001, "end": 1198.64, "text": " single tokens these are not interactions yet these are not biological functions" }, { "start": 1198.64, "end": 1204.5600000000002, "text": " yet so we know that in the lower layers of a neural network we have these kind" }, { "start": 1204.5600000000002, "end": 1209.48, "text": " of basic features basic feature extractors and here these basic feature" }, { "start": 1209.48, "end": 1216.4, "text": " extractors appear to be simply paying attention to one specific token in the" }, { "start": 1216.4, "end": 1221.3200000000002, "text": " vocabulary a lot okay so they kind of these heads sort of specialize for" }, { "start": 1221.3200000000002, "end": 1227.3600000000001, "text": " single for single amino acids and the same in the last layer so in the very" }, { "start": 1227.3600000000001, "end": 1234.3600000000001, "text": " last layer the the task of the very last layer is to prepare for the" }, { "start": 1234.3600000000001, "end": 1239.52, "text": " classification tasks so if you remember the BERT model you have layer layer" }, { "start": 1239.52, "end": 1244.52, "text": " layer layer and at the end you'll have to predict which ones are masked down" }, { "start": 1244.52, "end": 1248.84, "text": " here so at the end you'll have to predict single amino acids again so if" }, { "start": 1248.84, "end": 1254.96, "text": " there's a proline masked here you'll have to predict the proline so it also" }, { "start": 1254.96, "end": 1262.08, "text": " makes sense that the last layers would very much specialize to single tokens so" }, { "start": 1262.08, "end": 1270.4, "text": " this does make sense now our question is going to be do we find the biological" }, { "start": 1270.4, "end": 1274.68, "text": " function where where would you expect them we would expect the let's say the" }, { "start": 1274.68, "end": 1279.8400000000001, "text": " tertiary sorry the secondary structures which are sort of one level higher than" }, { "start": 1279.8400000000001, "end": 1284.64, "text": " the primary structure we would expect to find them maybe here and then we would" }, { "start": 1284.64, "end": 1289.96, "text": " expect to find the tertiary structures maybe somewhere here okay because these" }, { "start": 1289.96, "end": 1296.3200000000002, "text": " are most highest level and then it goes it goes back again or maybe it's like" }, { "start": 1296.32, "end": 1303.8799999999999, "text": " we find the tertiary structures rather here and here again and then in the" }, { "start": 1303.8799999999999, "end": 1307.84, "text": " middle we'll find the the most high-level the tertiary structure sorry" }, { "start": 1307.84, "end": 1315.08, "text": " yeah blue secondary this drawing is getting too too too weird but there" }, { "start": 1315.08, "end": 1320.3999999999999, "text": " there could be multiple scenarios but that could fit here but until now it" }, { "start": 1320.3999999999999, "end": 1326, "text": " sort of makes sense so they do it as an additional investigation where as I" }, { "start": 1326, "end": 1331.56, "text": " told you sometimes you can substitute an amino acid and nothing really happens" }, { "start": 1331.56, "end": 1337.52, "text": " right and in fact that this probably happens in you right now you probably" }, { "start": 1337.52, "end": 1343.08, "text": " might have some mutation that changed some amino acid and you don't even" }, { "start": 1343.08, "end": 1349.96, "text": " realize because it's just it's fine no notice so the biologists can build" }, { "start": 1349.96, "end": 1356.3600000000001, "text": " these matrices of how much you can substitute proteins with each other so" }, { "start": 1356.3600000000001, "end": 1362, "text": " here you see this blossom 62 substitution scores which are very I" }, { "start": 1362, "end": 1368.76, "text": " guess very high if you can substitute two protein two amino acids with each" }, { "start": 1368.76, "end": 1376.8, "text": " other and the effect is negligible and it's very low if it's the other way" }, { "start": 1376.8, "end": 1382.68, "text": " around now this is interesting so far but you compare this to this matrix" }, { "start": 1382.68, "end": 1388.24, "text": " right here this is the attention similarity so what we'll do is for each" }, { "start": 1388.24, "end": 1393.6599999999999, "text": " two amino acids we take those two attention things those two attention" }, { "start": 1393.6599999999999, "end": 1397.76, "text": " matrices and we'll calculate the correlation between the attention" }, { "start": 1397.76, "end": 1404.2, "text": " matrices and our hypothesis is that the more correlated the attention patterns" }, { "start": 1404.2, "end": 1409.68, "text": " are between the two amino acids the more likely we are to substitute them" }, { "start": 1409.68, "end": 1416.04, "text": " because as a direct result of our language model our language model is" }, { "start": 1416.04, "end": 1424.72, "text": " it's reconstructing right these things so our language model is going to treat" }, { "start": 1424.72, "end": 1431.3600000000001, "text": " if in natural language is like a synonym right is our language model is going to" }, { "start": 1431.36, "end": 1435.8, "text": " treat synonyms very similar to each other because they're synonyms they can" }, { "start": 1435.8, "end": 1440.8799999999999, "text": " be exchanged so a good language model should learn that they are almost the" }, { "start": 1440.8799999999999, "end": 1446.28, "text": " same and therefore the attention pattern is going to be almost the same so a high" }, { "start": 1446.28, "end": 1454.1599999999999, "text": " correlation we hypothesize is a means that the function of the amino acid is" }, { "start": 1454.1599999999999, "end": 1460.3999999999999, "text": " similar and therefore we can substitute it easily so this here is the matrix of" }, { "start": 1460.4, "end": 1465.72, "text": " the correlations between each two attention patterns of these amino acid" }, { "start": 1465.72, "end": 1473.5600000000002, "text": " and if you compare the two right here they look extremely similar just have a" }, { "start": 1473.5600000000002, "end": 1479.0800000000002, "text": " have a look for a little while and you'll see that the patterns they do not" }, { "start": 1479.0800000000002, "end": 1485.22, "text": " match perfectly but they are very very similar the dark spots are in the same" }, { "start": 1485.22, "end": 1491.24, "text": " places the light spots are in the same places so this already makes a good case" }, { "start": 1491.24, "end": 1498, "text": " that the language model here has learned something about biology now what we want" }, { "start": 1498, "end": 1507.16, "text": " to do is we want to investigate higher order higher order functions so here we" }, { "start": 1507.16, "end": 1514.08, "text": " are interested in these contact maps right so how likely is it that two amino" }, { "start": 1514.08, "end": 1518.96, "text": " acids are in contact and we'll look at it through the lens of attention as we" }, { "start": 1518.96, "end": 1523.8799999999999, "text": " did before so here you'll see percentage of each each head of each head's" }, { "start": 1523.8799999999999, "end": 1529.9199999999998, "text": " attention that is aligned with contact maps averaged over data set suggesting" }, { "start": 1529.9199999999998, "end": 1535.12, "text": " that had 12 for is uniquely specialized for contact prediction so look at this" }, { "start": 1535.12, "end": 1544.06, "text": " this this head here is just spiking so remember before we said our analysis is" }, { "start": 1544.06, "end": 1551.3799999999999, "text": " whenever whenever we're basically measuring the correlation of two things" }, { "start": 1551.3799999999999, "end": 1556.8999999999999, "text": " being in contact because we know it from our simulator or from our data set the" }, { "start": 1556.8999999999999, "end": 1562.72, "text": " correlation of that with an attention connection being particularly strong and" }, { "start": 1562.72, "end": 1570.76, "text": " will we find it in this attention head right here so this layer 12 head number" }, { "start": 1570.76, "end": 1576.4, "text": " four will always peek out whenever two things are in contact now you can see" }, { "start": 1576.4, "end": 1582.2, "text": " that it's it's not like always it's like 25% of its attention but significantly" }, { "start": 1582.2, "end": 1589.04, "text": " more than anything else right here in fact if you group the things by this" }, { "start": 1589.04, "end": 1593.52, "text": " attention you can build the following plot so you can see right here" }, { "start": 1593.52, "end": 1599.32, "text": " probability two amino acids are in contact as a function of attention" }, { "start": 1599.32, "end": 1603.96, "text": " between the amino acids in head 12 for showing attention approximates perfectly" }, { "start": 1603.96, "end": 1610.36, "text": " calibrated estimator which would be the green line so here we simply for each" }, { "start": 1610.36, "end": 1617.52, "text": " for each pairs to amino acids for each pair of amino acids we plot we make a" }, { "start": 1617.52, "end": 1624.6399999999999, "text": " histogram right here of what they're sorry not a histogram we plot the" }, { "start": 1624.64, "end": 1634.3200000000002, "text": " probability if they have the attention weight point nine we plot how likely is" }, { "start": 1634.3200000000002, "end": 1640.8000000000002, "text": " it that they are in contact so this is this if we just look at the data and we" }, { "start": 1640.8000000000002, "end": 1645.5200000000002, "text": " simply take this attention weight as a measure as a predictor of being in" }, { "start": 1645.5200000000002, "end": 1650.6000000000001, "text": " contact we get the blue curve and the green curve would be if we could" }, { "start": 1650.6, "end": 1656.6399999999999, "text": " perfectly predict from this attention head what the probability of contact" }, { "start": 1656.6399999999999, "end": 1662.04, "text": " would be and you can see that the fit is fairly good you can't predict with" }, { "start": 1662.04, "end": 1666.7199999999998, "text": " super high accuracy but the fit is fairly good and you can see that general" }, { "start": 1666.7199999999998, "end": 1674.56, "text": " trend that as the attention in this head rises the probability of the two amino" }, { "start": 1674.56, "end": 1682.48, "text": " acids being in contact with each other also rises so we can sort of confidently" }, { "start": 1682.48, "end": 1689.28, "text": " say that BERT has learned something about a higher level funk a higher level" }, { "start": 1689.28, "end": 1693.6, "text": " biological structure just from the language modeling objective how can we" }, { "start": 1693.6, "end": 1702.28, "text": " interpret this this must somehow mean that it is it is possible it is vital to" }, { "start": 1702.28, "end": 1709.16, "text": " it is vital for reconstructing the sequence from its surroundings so if we" }, { "start": 1709.16, "end": 1717.44, "text": " delete this right here if if this if these two are in contact in the 3d" }, { "start": 1717.44, "end": 1724.2, "text": " structure that makes probably probably means that this thing right here is a" }, { "start": 1724.2, "end": 1729.16, "text": " very good predictor of what was here right if we mask this out and we're asked" }, { "start": 1729.16, "end": 1733.4, "text": " to reconstruct which amino acid was there then it probably helps to look at" }, { "start": 1733.4, "end": 1736.8400000000001, "text": " its neighbors right it probably always helps to look at one's neighbors" }, { "start": 1736.8400000000001, "end": 1744.5600000000002, "text": " especially also in natural language but if these two are in contact they they" }, { "start": 1744.5600000000002, "end": 1749.76, "text": " have very special they have very special connection to each other it's very you" }, { "start": 1749.76, "end": 1756, "text": " can basically read out from this one which one this was this is sort of like" }, { "start": 1756, "end": 1770, "text": " if you have a sentence and you say does I don't know I can't come up with with" }, { "start": 1770, "end": 1776.68, "text": " one right now but if it's like da da da da da and then there is a name like mark" }, { "start": 1776.68, "end": 1783.28, "text": " and then da da da da da da and then there is him right and you would expect" }, { "start": 1783.28, "end": 1790.6, "text": " if I drop out okay let's do it the other way around if I drop out him then from" }, { "start": 1790.6, "end": 1794.6399999999999, "text": " the text right here you can probably determine that it is some sort of pronoun" }, { "start": 1794.6399999999999, "end": 1799.16, "text": " but then you go back and you see ah it's mark okay so it's not like it's" }, { "start": 1799.16, "end": 1809.2, "text": " not like it or some or or or she it's probably he or him this is sort of the" }, { "start": 1809.2, "end": 1816.64, "text": " analogous structure right here in biology the second thing we're looking" }, { "start": 1816.64, "end": 1823.68, "text": " at is these these binding sites now these are single properties of of of" }, { "start": 1823.68, "end": 1828.48, "text": " different amino acids and we're simply looking at all the incoming or sorry all" }, { "start": 1828.48, "end": 1833.52, "text": " the F all the other tokens that focuses their attention why is this important" }, { "start": 1833.52, "end": 1839.56, "text": " because these binding sites are central to the structure of the or to the" }, { "start": 1839.56, "end": 1843.68, "text": " function of the protein right if this here is a binding site then that's a" }, { "start": 1843.68, "end": 1851.12, "text": " very central important point of the protein so a lot of these other things" }, { "start": 1851.12, "end": 1856.6, "text": " are going to be determined by what this binding site is this binding site needs" }, { "start": 1856.6, "end": 1859.76, "text": " to have a very spurted particular function and therefore probably needs" }, { "start": 1859.76, "end": 1865.04, "text": " to be a very particular amino acid and the other things here are sort of" }, { "start": 1865.04, "end": 1868.68, "text": " supporting this binding site because they form the 3d structure around it" }, { "start": 1868.68, "end": 1875.44, "text": " and so on so you would expect a lot of attention to be put on this binding site" }, { "start": 1875.44, "end": 1884.32, "text": " and what do we find the we find that it's a bit more murky than before so you" }, { "start": 1884.32, "end": 1888.36, "text": " can see that the attention is kind of spread out percentage of each head's" }, { "start": 1888.36, "end": 1892.76, "text": " attention that focuses on binding sites especially in the deeper layers binding" }, { "start": 1892.76, "end": 1896.8, "text": " sites are targeted at much higher frequency than would occur by chance" }, { "start": 1896.8, "end": 1905.1999999999998, "text": " head 7 1 has the highest percentage with 34% so also here you can see that it is" }, { "start": 1905.1999999999998, "end": 1910.8799999999999, "text": " spread out but this is because multiple heads are now focusing on these binding" }, { "start": 1910.8799999999999, "end": 1915.52, "text": " sites because probably binding sites come in different variations so you'll" }, { "start": 1915.52, "end": 1920.56, "text": " have lots of heads specializing on attending to binding sites and they say" }, { "start": 1920.56, "end": 1924.72, "text": " it is much higher frequency than would occur by chance and you can see here" }, { "start": 1924.72, "end": 1931.72, "text": " this head is the highest with 34% of its attention focused on binding sites you" }, { "start": 1931.72, "end": 1936.04, "text": " can also see the general trend of the attention being rather in the later" }, { "start": 1936.04, "end": 1943.76, "text": " layers which we would expect from a tertiary structure now yeah it would be" }, { "start": 1943.76, "end": 1948.8799999999999, "text": " interesting here here you also see that actually most of the things are in the" }, { "start": 1948.8799999999999, "end": 1956, "text": " in the last layer which points to points to rather maybe lower lower level" }, { "start": 1956, "end": 1959.92, "text": " information because we reasoned before about the last layer or I was just wrong" }, { "start": 1959.92, "end": 1964.84, "text": " but also in a general trend you can see that the attention is rather shifted" }, { "start": 1964.84, "end": 1973.32, "text": " towards the later layers because this is sort of a higher order function okay if" }, { "start": 1973.32, "end": 1979.84, "text": " you look at the same calibration experiment you can see that the picture" }, { "start": 1979.84, "end": 1983.2, "text": " is not as clear there is the general trend at the beginning but then it sort" }, { "start": 1983.2, "end": 1990.04, "text": " of flattens out so you can sort of differentiate the very probably not a" }, { "start": 1990.04, "end": 1995.24, "text": " binding site from the somewhat probably a binding site but it's not a perfectly" }, { "start": 1995.24, "end": 2000.2, "text": " calibrated classifier and that might just be because there are many things" }, { "start": 2000.2, "end": 2004.76, "text": " specializing in different types of binding sites so you can't just go to" }, { "start": 2004.76, "end": 2010.2, "text": " this one head so this is just for this one head you can't just go to that one" }, { "start": 2010.2, "end": 2015.6000000000001, "text": " and expect that to classify all the binding sites because you might want to" }, { "start": 2015.6000000000001, "end": 2023.4, "text": " be you might want to combine all of the high ranking ones here to form a" }, { "start": 2023.4, "end": 2029.32, "text": " classifier the last experiment they do is these linear probes which where they" }, { "start": 2029.32, "end": 2034.1599999999999, "text": " just go and they just build classifiers from different parts of the network and" }, { "start": 2034.1599999999999, "end": 2040.2, "text": " you can see right here that what is predicted and how well they work so each" }, { "start": 2040.2, "end": 2045.04, "text": " bar here is going to be the difference of performance so this is differential" }, { "start": 2045.04, "end": 2050.4, "text": " performance of diagnostic classifier by layer sorted by task order in figure 8" }, { "start": 2050.4, "end": 2054.7999999999997, "text": " each plot shows the change in performance between the given layer and" }, { "start": 2054.8, "end": 2061.48, "text": " the previous layer okay so a bar up shows it's performing better than the" }, { "start": 2061.48, "end": 2065, "text": " previous layer bar down shows it's performing worse than the previous layer" }, { "start": 2065, "end": 2070.96, "text": " so you see right here that the these are the secondary structures right here and" }, { "start": 2070.96, "end": 2075.6400000000003, "text": " you can see that there is a lot of performance in the earlier layers right" }, { "start": 2075.6400000000003, "end": 2080.92, "text": " here and sort of not that high performance in the later layers whereas" }, { "start": 2080.92, "end": 2085.4, "text": " for the tertiary structures the binding site and the contact you can see that" }, { "start": 2085.4, "end": 2092.52, "text": " there is a bit of performance on in places but it sort of tends to be more" }, { "start": 2092.52, "end": 2097.08, "text": " towards the middle certainly more at towards the middle of the end of the" }, { "start": 2097.08, "end": 2103.08, "text": " network than the the secondary structures which sort of makes sense with" }, { "start": 2103.08, "end": 2108.12, "text": " our hypothesis you can also see this here where they show the percent of" }, { "start": 2108.12, "end": 2114.64, "text": " attention focused as a function of layer and the red is the center of mass and" }, { "start": 2114.64, "end": 2120.48, "text": " you can see that as the the secondary structures this their center of mass is" }, { "start": 2120.48, "end": 2128.3599999999997, "text": " at a lower layer in general than the tertiary functions all of this is not" }, { "start": 2128.3599999999997, "end": 2134.4, "text": " perfect of course but it's still an open question I guess whether or not it's not" }, { "start": 2134.4, "end": 2140.64, "text": " perfect because we haven't built a strong enough language model yet do I" }, { "start": 2140.64, "end": 2147.28, "text": " want to say GPT-4 is now for biology and not for language or is it because there" }, { "start": 2147.28, "end": 2155.56, "text": " is really you need you really can't very well predict the these things just from" }, { "start": 2155.56, "end": 2159.1600000000003, "text": " a language model I mean you should technically all the information is there" }, { "start": 2159.16, "end": 2165.96, "text": " but maybe the language model objective as such isn't able to capture that" }, { "start": 2165.96, "end": 2171.8399999999997, "text": " information so yeah this this was the paper it's pretty simple they have the" }, { "start": 2171.8399999999997, "end": 2176.12, "text": " in the appendix they have a lot of a lot of these additional experiments or full" }, { "start": 2176.12, "end": 2180.8799999999997, "text": " experiments I believe for all the amino acids and so on and I invite you to" }, { "start": 2180.8799999999997, "end": 2187, "text": " check that out in general I like this kind of work because it's very applied" }, { "start": 2187, "end": 2192.56, "text": " it's and it can you know tell us something about the nature of both these" }, { "start": 2192.56, "end": 2200.08, "text": " language models and the biological things that we that we care about in" }, { "start": 2200.08, "end": 2207.08, "text": " biology okay I'm just talking crap right now thanks for being here I hope you" }, { "start": 2207.08, "end": 2217.7999999999997, "text": " enjoyed it and bye bye" } ]
1VdEw_mGjFk
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nlp", "billion", "parameters", "float32", "attention mechanism", "transformer", "scale", "gpt-3", "google", "gshard", "xla", "sharding", "parallelism", "mixture of experts", "trillion", "tpus", "distributed", "m4", "multilingual translation", "natural language processing" ]
Google builds a 600 billion parameter transformer to do massively multilingual, massive machine translation. Interestingly, the larger model scale does not come from increasing depth of the transformer, but from increasing width in the feedforward layers, combined with a hard routing to parallelize computations on up to 2048 TPUs. A very detailed engineering paper! OUTLINE: 0:00 - Intro & Overview 4:10 - Main Results 5:10 - Mixture-of-Experts 16:00 - Difference to Scaling Classic Transformers 18:50 - Backpropagation in Mixture-of-Experts 20:05 - MoE Routing Algorithm in GShard 38:20 - GShard Einsum Examples 47:40 - Massively Multilingual Translation 56:00 - Results 1:11:30 - Conclusion & Comments ERRATA: I said the computation of MoE scales linearly, but actually, it's sub(!)-linear. Paper: https://arxiv.org/abs/2006.16668 Abstract: Neural network scaling has been critical for improving the model quality in many real-world machine learning applications with vast amounts of training data and compute. Although this trend of scaling is affirmed to be a sure-fire approach for better model quality, there are challenges on the path such as the computation cost, ease of programming, and efficient implementation on parallel devices. GShard is a module composed of a set of lightweight annotation APIs and an extension to the XLA compiler. It provides an elegant way to express a wide range of parallel computation patterns with minimal changes to the existing model code. GShard enabled us to scale up multilingual neural machine translation Transformer model with Sparsely-Gated Mixture-of-Experts beyond 600 billion parameters using automatic sharding. We demonstrate that such a giant model can efficiently be trained on 2048 TPU v3 accelerators in 4 days to achieve far superior quality for translation from 100 languages to English compared to the prior art. Authors: Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, Zhifeng Chen Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
OpenAI has a 175 billion parameter model. You thought that was large? That's cute. Check out Google's 600 billion parameter model, 600 billion floating point numbers doing things at the same time. This has absolutely become a body part measuring competitions between companies. Google be like, oh, GPT-3. I spit on you. I spit on you and your little tiny 175 billion. OK. 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 Dmitri Lepikhin et al. of Google. And this paper basically tells the story of how they built this 600 billion parameter model, how actually they attempted to build a model that had a trillion parameters but just didn't manage to quite train it. And this is all using this system called G-shard. So I haven't actually seen the code out for G-shard yet, but I'm going to maybe assume that this is something that they're going to release at some point. Who knows? Or maybe I just haven't seen it yet. So this is basically describing a system on how to train these giant models. So if you 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 then 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 blur score. And this is a quality score for machine translation over the previous state of the art. So over their baseline, which, as you can see here, you have 37 billion weights, 150 billion weights, and 600 billion weights, which they only train. They train for, you know, 2000 and on 2048 TPUs for just four days. They stress this is very efficient because they just have to train it for four days on 2000 TPUs. Absolutely crazy. So let's have a look at what this paper does. If you enjoy this, if you enjoyed this at the end, consider, you know, sharing the video out if you like it and tell me what you think about this stuff in the comments. Alright, so we'll go through the abstract and then we'll go through highlighted sections of the paper because the paper is 23 pages long. So I won't be able to cover everything, just kind of give you the high level ideas and highlight a few things. Actually let's not go into the abstract. Let's go into these results first. So as you can see, they managed to continue the trend. The trend in NLP has always been, at least since, you know, transformers were 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 blur score, 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 in 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 transformer, it 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 standard transformers. There is an encoder and a decoder. Everything works as you know. So you have these blocks, you have n blocks. These are the number of layers that you have. And in these blocks, you always have an attention layer, and then a feed forward layer that acts on the tokens. So without repeating too much what an attention mechanism does, basically, you have input tokens. So this is a sequence, it's technically a set processing unit, but we use it for sequences of text. So here you have six tokens, a sentence of maybe six words. And then you transform it with the attention layer by having this attention mechanism that routes information from tokens to from positions to other positions, maybe like this route is here, route this here. And then you have a feed forward network that is applied on a per token basis. So each of these tokens now goes through this feed forward network and is kind of transformed. So the embedding of that token is transformed by that feed forward network. Now every token does this. And it's always the same feed forward network. So this network here is the same as this network. Now usually, when we talk about scaling transformers, we talk about this part right here, we talk about the attention mechanism. And also we talk about this part, the number of layers. So you know, we talk about scaling the number of transformer layers, more layers, more layers, more layers. And if we want to scale the attention mechanism, what that basically means is we have we 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. Like the original transformer started with something like 512 tokens that they were able to take because this attention mechanism has quadratic complexity. This went up and the open AI GPT-3, I believe, had a context size of 2048 tokens, which if it scales quadratically, that's quite an achievement. And also it stacked the layers very, very deep. Now in this paper, they scale the transformers differently. They basically leave the context size and I believe that their context size is 1024. So significantly smaller than the open AI context size. And they don't scale the layers. So their largest transformer is 36 layers, whereas I believe GPT-3 was maybe correct me but I think it was like 90 or 100 layers or something like this, at least significantly larger than this. Instead, what they scale is this part right here, the feet forward layers. Now that might seem counterintuitive. But they basically, they basically say what if we didn't only have one feed forward network right here, but we had many, right? We don't always have the same. We have many, many feed forward networks, different ones that can do different things. So that's what they call experts. Each one of these feed 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 multitask setup. So what you'll have is you'll have all kinds of languages like French and German, what's the E, and maybe 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 the individual languages. Like maybe you will have to handle a pronoun differently if it comes from German than if it comes from French. You want to do it with the same model at the same time. That means you maybe want to have the one expert specialize in German pronouns and one expert specialize in French pronouns. Also you can think of the experts as maybe one specializes in question words, it doesn't matter which language they're from. And the other one specializes in some sort of other kind of linguistic feature. In any case, this number of experts here is if you want to scale that up, then that becomes the bottleneck of the transformer. They go up to 2000, 2048 experts in parallel. So that doesn't fit into a single accelerator anymore. And that's why the entire system has to be sharded. And that's what they call G shard. So G shard, the main application here is going to be how can we build this giant model 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 what they do, they always they take these transformers. And they always consider a block of two transformer layers. So this is a block of two transformer layers, you can see there is twice the attention, and there's twice this feed forward. So in one point, this feed forward is just a regular everything, all the tokens go through the same network. So that's like a classic transformer. But here, you have a lot of these different experts and the tokens are routed to these experts. It's important that the tokens are hard routed, right? If the tokens were soft routed, you don't you don't gain anything, because every token has to go through every expert. But here, the tokens are hard routed to the expert, which means that you can if you if I have an input size of 1024 tokens, maybe only 10 go to this one, and maybe only 10 of that those go to this one. Now you also have a batch size, of course, I haven't actually looked at what the batch size here is, but you usually have quite a large batch size in these things like maybe a batch size of 1000 as well. So ultimately, what you'll end up is, you know, 1000 times 10 tokens going to the first expert and so on. But still, you can significantly parallelize this computation. Okay. So this this, if you use G chart, 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, or someone made the PowerPoint mistake. So you can see that the the attention, everything is shared between the machines. So this here and this here, these are synchronized, the weights are synchronized, right, you simply do a data sharing. But here, you can see that you have model parallelism, model parallel mixture of experts, where on the first machine, you have the first expert, and then you have e devices. And on the last one, you have the last expert. And then it's all routed out and routed in again. And then you can continue your transformer. And this is layer after layer. So what's the problem here, the problem is that an operation like this is going to come to incur significant sort of overhead in terms of communication, and so on, if you were to do it naively, and it's going to be a real pain to program this. And that's why G chart is made to do all of this automatically. And you don't, you don't incur much of a cost, because you distribute. So what's the difference to the old scaling? Why don't they just make transformers larger in number of layers? And that's because this this is, I guess, what opening into as well, if you make transformers simply larger in number of layers, sorry, if you make it transformers larger in the attention mechanism, it just won't fit into memory at some point. And you'll you'll have to share that somehow. And you can do this with G shard. If you scale it in number of layers, that incurs significant cost where you have to wait, because you have to forward propagate, and then you have to backward propagate in your training sequence. And if you have just too many layers, then a lot of the a lot of the frameworks get at their limit, where at some point they say, well, I still have to wait for the signal to come back in order to continue. And they explore this in this benchmark right here. You can see they say the largest model, the 600 billion parameter model that achieved the best translation quality was trained with 2000 TPU v3 cores for three days, a total cost of 22 TPU core years. In contrast, training all 100 bilingual baseline models would have required 29 core years. So the model here is faster than if you train them individually. But if you want to train a single transformer that is just very deep, and achieves reasonable performance, you have to invest a lot more. Our best quality dense single transformer model 2.3 billion parameters. So it's also significantly smaller. Achieving this was trained with G pipe, which is a previous framework. So G pipe is kind of a task runner that also distributes computation was trained with G pipe on 2048 TPU cores for six weeks or a total of 235 TPU core years. By the way, for if you if you have $1 per TPU hour, that'll only cause that'll only, I guess set you back about 2 million or so. It's easy peasy. Or even 200,000 just, you know, a tiny, tiny bit of of money. But you can see that this transformer model that is dense, which means that is a classic transformer where you stack the transformer layers, you stack them, you stack them, you stack them. It, in fact, it has 96 layers, their baseline 96 layer transformer model, that's sort of what opening I did, they just kept stacking the transformer layers. You get a model that has less parameters and trains for much longer. And its performance is only about this good. Whereas here, if you scale not into depth, but into width of these experts, and it's not dense, but it's shorted, which means it calculates this in a in a kind of sparsified way because it has this hard routing, you can scale up to a lot more parameters. So 600 billion parameters, over 200 times more parameters than the deep model, and you can get a much better performance. Okay, so this is what is different here, it scales into these experts rather than scaling into depth or, or size of the attention mechanism itself. All right, 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, it still works. So backprop still works through so basically you have a backprop 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 backprop signal to make it work. It can it could technically fail, but they do observe generally that it does work if you do this kind of hard routing with a bit of noise. All right, so where do we go from here, as I said, this is an engineering paper, and it's a long engineering paper. So they, they set up their, they set up a lot of a lot of the details of engineering directly in the paper, which we're not used to in the machine learning world. They really detail how they shard things and so on, which is pretty cool. But I invite you to look at the paper yourself. If you really want to know what's going on right here. Suffice to say, they, as you can see right here, what they do is, this is the input right here, and then they have this weight matrix, which is a this routing, this is learned routing weights. Okay. So you have trainable weights that decide how to route the input, and that's dependent on the input. So you have a bunch of inputs that comes from the lower layer. And this matrix right here determines where to route them. Probably says, okay, the input is a vector like this. I know that must probably go to the expert number three. Okay. And you have a softmax across that. So it's a really, it's an assignment to, it's a soft assignment to the experts. So once you've done the soft assignment to the expert, you do a hard assignment by collecting the top two. For each token, you say you collect the top two experts, and you only send it to the top two experts and you ignore all else, which is not a lot right there. At times there are 2000 experts in the system. And yeah, you distribute and you have some noise. So with a random probability, you actually don't even send it to the second expert. You just leave it at the first one. And with some noise, you send it also to the second one. And I think that that noise is part of what if 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 tends 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, mixture of experts as you would write it in code. And they make use a lot of this Einstein, 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, and I want the first axis to be a and the a is this one. And I want the last axis to be c and the c is this one. And b is nowhere b is not in the output, which means it should contract over b. So it should sum along b, sorry, it should multiply along b and then add such contract over b. So this here describes a regular matrix matrix multiplication. Now if I could do something else, I could do something like a just a element wise product, an element wise product would be something like this a b comma a b goes to a b, which means here, I have a in the first input, and here I have a again. And I'm so you already see that you can even though these are different tensors, you can call the axis the same, which means that they're going to somehow be multiplied together. Now if you leave it away here, it means that it's going to be contracted and therefore the axis no longer exists. But here we don't leave it away, which simply means that these axes are going to be multiplied together. And the same for b right here. So this describes an element wise. 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 it for all the a is it's element wise, but then over b, it's contracted. So you know, you can go, you can go wild with the Einstein some notation, you can describe a lot of things with it. So here is this algorithm to distribute the computation among these different experts. So you have the inputs and the weight matrix for the, they call this the gates function. That's the routing function to these experts. So what do we do? We first of all, we have these tensors, these, they have these grouping, these grouping dimension right here. So they come along to along groups, which in our case, we could maybe say these are batches or the batch dimension. So they come across groups, and there is the sequence length and there is this M right here. That's going to be the feature dimension, the M. And you can see the M is contracted. So the M is no longer here. So the gating function is going to route each input token right here to one of the experts for each thing in the group. So you can see, you can express this with an Einstein some notation. Then you have a top two gating, which selects the top two from each of the last, from each of the entries. And that gives you this dispatch mask and the sorry, and the weights that you have to use at the end to combine. You can use the dispatch mask in order to distribute the inputs. So you have reshaped inputs, and so on. So I'm not going to go through all of this right here, but you can express all of this in terms of the Einstein 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 underlined dimensions here are the dimensions where we want to shard the computation. So here, because we have this G underlined, that means that we are interested in sharding the computation along this axis. So this, I said, this is the batch dimension. This is your classic data parallelism, which means that the first machine gets the first couple of data points, the second machine gets the second couple of data points, and so on. And you can see in the weight matrix, there is no sharding, which means that the weight matrix lives on every machine as a copy of one another. This is different from from here, where you can see that what we're now going to do is here it's still sharded according to the batch, but we now are going to shard this according to the different experts. So we're going to route whatever the inputs are in to these experts. And then we're going to execute the computations on the experts. So this is now sharded according to the experts. And at the end, right here, you can see this is still sharded according to the experts. We're going to put it back together. And now it's sharded according to the groups again. That's what we said, we have the input right here, the inputs, and the inputs are maybe distributed according to the according to machines, right, we have these go through the first machine, these the second, these the third, and so on. This is your classic data parallelism. But then we have all of these experts. And now all of a sudden, we're going to route these things to the individual experts. And we're going to execute the computation in parallel on the experts. And then after that, we're going to put back together from wherever we got them now have to. So this goes here again. And so this is just the reverse of what we did before. So right, like that. So you get all of the outputs again. I hope you kind of can imagine how this happens. So the first difference is, 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 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 multiply it with the same weight matrix that weight matrix lives on all of the machines and is regularly synchronized, it's kept synchronous in some way. Whereas if we shard x to the experts, then the experts have individual functions. So the expert one is different from the expert two is different from the expert three, and so on. Which means that before it wasn't important where x was routed, because we would execute the same computation. So we can just, you know, sharded according to you know, the first 10 go there, the next 10 go there. But here, it's not crucially important where they are routed to to which expert. And that's why we learn the function that is going to route them. So this is learned, this is these 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 layer, the feet forward layers are, you have your input, you multiply it by wi, you have a ReLU, ReLU, and then you multiply it by wo. So it's kind of a two layer 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. But 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's sumnotations, there is no way to underline code and that magically happened something that was simply for us to visualize. Now we want to apply their system in order to make this actually sharded. And with the 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. This is a computation where we simply want to shard out the different to the different machines but keep it synchronized. And you can see if you do this, this is the operation, then the system knows, ah, this here is replicated across the machines. So that means I'm going to distribute the data points according to this G dimension, according to the batch dimension and multiply it with this matrix according to this Einstein sum notation string on all of the machines. And I'm going to keep this tensor in sync. 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 onto D different machines or into D different parts. So you see here you calculate the how you should do the routing and the resulting tensors first dimension is this E dimension. And then you say that should be split, you know, according to this first dimension onto D different places and these D different places are now separate. They don't have the they don't have to be kept in sync. Everyone has their own weights. And now when you do this, you know, according to this dimension, you can see because we know Einstein sum notation now, you can see this E appears here, here and here. So this operation is going to be applied element wise, that means independent of each other in the direction of this dimension, the system understands that since this tensor is sharded according to that dimension, I have to execute this on each of these entries in separate with on each expert having their own weight matrix right here. I hope this is a bit clear that their system makes it super easy. You can basically do two things. You can say this thing here is my classic parallelism where I want to keep it in sync. And this thing here is where I want to split up and do different computation on the different parts. And then they have also a general function that is more powerful. Yeah, they and they you can auto partition and whatnot. So they have a a a they have this we implemented the partitioner in the XLA compiler, which means that anything that can translate to XLA is a target for the system. And that's, you know, TensorFlow and pytorch can do this. So technically, this can come to any of those systems. But of course, who has their 2000 TPUs lying around to make use of this? But no, I'm kidding. I mean, this, I they here use it for transformers. And 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, 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, right? You want to multiply this, as you can see, this and this right here means that these 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 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. Yep. I find this to be a bit more a bit more insightful. So if you have something like this, this which is a regular matrix multiplication, right? And you want to contract along B, this is exactly the example we had before. So here is a situation where our tensor is sharded according to the B dimension and this tensor is also sharded according to the B dimension. 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. 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 results. This is illustrated down here. So what machine one does, it simply multiplies its shard by its own shard of the second matrix, which will give it this thing here. And by the nature of how matrix multiplication is constructed, you can simply do an all reduce, which means you reduce you sum across all of the machines, and that will give you the full result. So this is a this is a an example of how this works. This is, you know, pretty simple. And I believe you may have seen something like this already when you were looking at just parallelizing matrix multiplication, and so on. So this system handles this transparently, right? If you're shorted like this, this is what the system will do. However, if you are shorted 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 shorted according to the A dimension, the second tensor happens to be shorted according to the C dimension. And you want to end up with something that's shorted 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 shorted. So we assume that we can keep that in memory. But here we want the final result to be shorted according to C, which imposes 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 short system apparently realizes itself when something is out of memory, and it can do a smart move around being out of memory using a loop, which basically means that it will compute entry by entry or block by block. So these are the matrices we have to multiply. And you can see that if I want to do multiply this by this, that's fine, I can do this on one machine. And that will give me the block up here. But if I want the block up here, I have to multiply this by this, which is across two different machines. So what this system does is it's going into a while loop because it realizes there's not enough memory. And it kind of sends around these different slices to the different parts, each time computing a little piece. So here, first, we do this by this, this is fine. But then we grab ourselves from the we we grab ourselves this one here, calculate the next little piece up here, and then we grab ourselves the number two, calculate the piece here. And then so this is from zero, this is from two, the one we already had, and then we grab ourselves piece three, and multiply that until here, until we have this final slice that we want. Okay, so this goes in a while loop in multiple rounds, the system gets knows itself when it has to do this, and when it can calculate the full thing at once because it fits into in memory. It's even smarter than that, 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 padded accordingly, as you can see. This is 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 expect it to do in this shorted way. Completely crazy. Okay, so they apply this to massively multilingual massive machine translation. So two things, it's massively multilingual, and it's massive machine, which means, I guess a lot of machines. And the reason here is twofold. So what they say is, we have massively multilingual translation. Why don't they just look at 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 a thing where there are languages that you just don't have much data on. Like I don't know, Basque or something like this. There's not that many people speaking Basque or Swiss German. There's not even a written form, a standard written form of Swiss German. So you just don't have as many resources. And for other languages, you have giant amounts of resources. And what you can make use of is this phenomenon called positive language transfer, where it happens that, for example, Swiss German is very close to German. Now, they can't understand us, which is a giant advantage for us, but still it shares a lot of similarities with German. So if you learn a lot about German, you can sort of transfer learn to Swiss German pretty easily. So if you have a system that does German and Swiss German at the same time, you can perform better on both languages because the Swiss German part of your model, the part of your model that does Swiss German, profits from the German inputs as well. Now don't understand me wrong. There is not an individual part of your model that for each language, it's all done at the same time. But still you can imagine that, you know, some of these things will specialize in some of the languages. But the hope is that if you have German and Swiss German in the same training set, that if the model realizes what a question construct is in German, it will be able to apply that also to Swiss German with some minor modification. So there is a benefit of having these many languages, especially for the low resource languages. Okay. So as the number of languages, sorry, as the number of language pairs to be modeled within a single translation model increases, positive language transfer starts to deliver large gains for low resource languages. Given the number of languages considered, which I believe is a hundred 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. This capacity bottleneck for high resource languages can be relaxed by increasing the model size to massive scale in order to satisfy the need for additional capacity. So basically they're saying, if we train all of 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 a French to English model on this giant model. We could train that. And now that we have all these other languages in there, it just hurts us because we don't have enough parameters. And we can solve this, of course, by simply adding more parameters. So that's the solution. Add more parameters and you increase the capacity of the model and you still get the benefits of the positive language transfer. So their investigations is going to be into how much can we scale this? And is there like a sweet spot where because if you, if you increase the parameters too much, you counteract this positive language transfer again. So since, you know, since Swiss German and German can sort of benefit from each other. However, if we have too many parameters, so, and then we end up having all of these experts right here and the tokens are always routed to these experts and it always happens that all the Swiss German tokens are always routed to this expert and all the German tokens are always routed to that expert. There will be no sharing of weights. There will be this positive language transfer will not happen because we have too much capacity. So the goal is to find a sweet spot between positive language transfer and this capacity bottleneck. They do use an in-house data set, which we don't have access to, but they say the training corpus mined from the web contains parallel documents for a hundred languages to and from English adding up to a total of 25 billion training examples. However, they only use from 100 languages to English. This result in approximately 13 billion training examples to be used for model training. So that's a lot. It's a lot of data, especially for translation. It's kind of a noisy translation because it's mined from the web, but still it's a lot of data. They have baselines. So the baselines are first of all, in order to form our baselines, we trained separate bilingual neural machine translation models for each language pair. So that means a single model for each language to English, depending on the available training data per language. And then they also have a baseline where they try open AI style to build as deep as single transformer as possible. And by that, they mean we also include a variant of a dense 96 layer transformer encoder decoder network trained with G pipe pipeline parallelism on the same data set as another baseline. So the difference again here is that this 96 layer is a dense transformer, which means that all of the tokens go through the same computation and we don't shard the computation out to these experts, right? 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 that severely limits the computational efficiency. Even if we have, you know, your pipeline parallelism and so on that hurts. They say training to convergence took over six weeks on 2000 TPU course. That's crazy. But I guess, yeah, you know, I was saying earlier that that I always thought we were happy. I always thought we were happy 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. This time is over. If you start a PhD now start applying for money to get TPUs. Yeah. Okay. In any case, here you can see what this does. So they compare a bunch of models right here. So this T, this is this big dense transformer that's going to be one of our baselines and the other baseline here is going to be the zero axis. The zero axis means this is the single model for that language pair. So only so for each language, they trained one model only on data from that language. And that's going to be the worst thing here because this 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, 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, so that hurts in training efficiency. And then you have these mixture of expert models. They always consider two things. They consider different numbers of experts. You can see it goes from 128 to 2048 experts. And they consider a number, different number of layers from 12 layers to 36 layers, 36 layers still being way smaller than the 96 layer transformer here. And that's the reason why it trains faster. So it 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 multilingual translation improves significantly over the baseline where we only train a system for that language specifically. And these 10k examples, it's it's it's quite a bit, but it's not that much, especially since it's noisy data. So this is specifically good for low resource languages. But you can see also the high resource languages here benefit from the multilingual translation. And that's a function of the fact that we have, you know, large enough models. In fact, you can see the larger the models, the more the difference in blue is, and there's not really an end in sight. And they also see it say that they haven't seen convergence in training. So you can technically train this 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. So has to be said, the number of TPUs is not to be neglected, but if you're Google, you know, you just have them laying around. What's also interesting here, and you can start seeing this two things. First of all, you can see that the difference between here in between the dense transformer and this baseline model is very low for high resource languages, but gets larger for low resource languages. This is an indication that the dense transformer, it does more to share parameters between the languages because it shares parameters between all the things because all the tokens go through the same computation. So it is going to be a bit better in low resource languages, but still the general trend upwards holds even for the mixture of experts. The second thing is that you see there is a crossover here in these in these big in these biggest models. And what are the big models? One, the blue one is the one with 2048 experts and the green one is the one with 500 experts. They're both as deep models. But all of a sudden, over here for the high resource languages, it's still true that if you up the number of parameters, you get a benefit. So up the number of experts as well, you get a benefit. But over here for the low resource languages, it's it you see, it actually hurts you to up the number of experts. And that's the phenomenon exactly we talked about before. If you have too many of these experts, and you do a hard routing, that means all the tokens go a different way. And that means you don't get any sharing benefit from the multilingual translation. And they investigate a lot. And they basically claim that their sweet spot of expert in their particular task appears to be somewhere in between these 2000 and this 500 expert number, where you can see it doesn't always help you to scale up the model. So I have to say maybe the transformers, maybe they need a ResNet moment. So I believe in computer vision, it was sort of the same problem that we try to build deeper models and why like, okay, this, this is more width. But 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 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, they're cool. They must be quite mad about this, right? Like you have the trillion parameters, even though it's not that much bigger than the 600 billion, that the trillion, it would be cool to write a paper like a trillion parameter model. But for now they are at the 600 billion mark and they simply want to tell you that they have actually compiled a model that's that big, just didn't manage to train it. And yeah, that's here. Here is where I wanted to say that maybe we're waiting for the ResNet 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 ResNet. Okay, so they conclude this and so they, that's 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 you up the number of layers, you get more efficient, you can see and just look at this column for now, this point seven column, you can see it already pretty clearly. So here you go from 12 layers to 36, you gain efficiency, here you gain here you gain pretty predictable. If you up the number of layers, you need to see fewer tokens to get to the same cross entropy. And in fact, you can get to a lower cross entropy altogether at the end. We've known this for language models already. The other effect is of course, what happens if we go not deeper, but wider, if we increase these number of experts, if we increase this sparse computation. So here you can see, let's just look at the 12 layers for now. Let's look at all the rows where there's 12 layers. So here you get a significant advantage by upping the number of experts from 100 to 500. But then you hurt upping the number of experts to 2000, right? So that's that's sort of your you're hurting efficiency by upping the number of experts too much. And the same if we look at the 36 layer, so you gain massive efficiency by upping the number of experts, but you lose that 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 to achieving the best quality. Yes, yes, yes, but this is just a yeah. So here, oh, you can see the batch size in in tokens is quite, quite a bit. So yeah, if you have a 1000, if you have a context window of 1000, that means the batch size here was about 4000. So as as expected. Yeah, this is just easy peasy 22 TPU core years. I've seen someone on Twitter saying this, this is the new measure for computer. It's no longer like flops. It's TPU core years. Just mad, mad. And yeah. So 42 days to train this thing right here. Crazy, crazy, crazy. All right. They also have a number of investigations in other parts of efficiency, like per device memory consumption. You can see here that as you up the as you up the number of experts, you can see here, here, here, your weights don't go up because as you up the number of experts, you can just up the number of machines and the per machine weight usage will be the same, right? Because the experts are independent of each other, each one has their own weight matrix. So you can just add machines and you keep your weight requirements the same. However, if you go deeper, then your weights increase because you're now deeper, you have more layers. You have your so also your transformer weights will be higher and so on. So you go deeper right here. You see 3660 layers, your memory consumption increases for the weight. And also, this is the other big part in transformers, right? The activations that you have to save, because as we said, if you have a transformer and I have layer, layer, layer, layer, I basically have to keep around each of these signals in order to do back propagation. And that's why also the activation here increases as I go deeper. Now you can see percentually, it decreases again here. So what's happening? Technically, you don't have to keep these things around. You can also once the signal comes back, you can recompute them from the beginning or from an intermediate point. Now this increases computation, but saves the need to store the activations. And apparently G shard, yet another thing it does is it will recompute as necessary the activations if it realizes that you don't have enough memory to store them. So all of this is pretty crazy, honestly. And they look at where the different computations go. And I don't want to go into this. And they have these micro benchmarks where they really show that the increase in complexity is really according to square root of n, because that's how long it takes to distribute along these 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 expert across the the sharded machine. So there are no experts anymore. This is just G shard, the padding has to be correct. The strides have to be correct. Data needs to be exchanged according to the machines, the window size needs to be correct, blah, blah, blah. So just 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. It kind of shows you what goes into engineering a system like this, and how easy it can be if it's engineered well to then apply it. I think this is going to be extremely helpful to the community. And with that said, 23 pages later, see you next time. Bye bye.
[ { "start": 0, "end": 5.48, "text": " OpenAI has a 175 billion parameter model." }, { "start": 5.48, "end": 7.04, "text": " You thought that was large?" }, { "start": 7.04, "end": 8.48, "text": " That's cute." }, { "start": 8.48, "end": 16.28, "text": " Check out Google's 600 billion parameter model, 600 billion floating point numbers doing things" }, { "start": 16.28, "end": 17.400000000000002, "text": " at the same time." }, { "start": 17.400000000000002, "end": 24.68, "text": " This has absolutely become a body part measuring competitions between companies." }, { "start": 24.68, "end": 28.12, "text": " Google be like, oh, GPT-3." }, { "start": 28.12, "end": 29.32, "text": " I spit on you." }, { "start": 29.32, "end": 33.28, "text": " I spit on you and your little tiny 175 billion." }, { "start": 33.28, "end": 34.28, "text": " OK." }, { "start": 34.28, "end": 35.28, "text": " Let's stop kidding." }, { "start": 35.28, "end": 40, "text": " This is a giant model that Google has trained right here." }, { "start": 40, "end": 46.760000000000005, "text": " The paper we're going to look at today is called G-shard Scaling Giant Models with Conditional" }, { "start": 46.760000000000005, "end": 54.08, "text": " Computation and Automatic Sharding by Dmitri Lepikhin et al. of Google." }, { "start": 54.08, "end": 60.72, "text": " And this paper basically tells the story of how they built this 600 billion parameter" }, { "start": 60.72, "end": 65.96, "text": " model, how actually they attempted to build a model that had a trillion parameters but" }, { "start": 65.96, "end": 70.06, "text": " just didn't manage to quite train it." }, { "start": 70.06, "end": 73.75999999999999, "text": " And this is all using this system called G-shard." }, { "start": 73.75999999999999, "end": 79.6, "text": " So I haven't actually seen the code out for G-shard yet, but I'm going to maybe assume" }, { "start": 79.6, "end": 83.08, "text": " that this is something that they're going to release at some point." }, { "start": 83.08, "end": 85.36, "text": " Who knows?" }, { "start": 85.36, "end": 87.67999999999999, "text": " Or maybe I just haven't seen it yet." }, { "start": 87.67999999999999, "end": 96.46, "text": " So this is basically describing a system on how to train these giant models." }, { "start": 96.46, "end": 102.7, "text": " So if you have watched my video on GPT-3, which, of course, was this 175 billion parameter" }, { "start": 102.7, "end": 112.28, "text": " model of OpenAI, which already was record breaking, the paper was very much like, oh," }, { "start": 112.28, "end": 115.96000000000001, "text": " we built a model and look at what things it can do." }, { "start": 115.96000000000001, "end": 117.64, "text": " So that was the OpenAI paper." }, { "start": 117.64, "end": 122.52, "text": " This paper here is like the complete opposite." }, { "start": 122.52, "end": 125.84, "text": " It basically says, oh, yeah, we do language model." }, { "start": 125.84, "end": 130.04, "text": " But here is how we built the model, which is equally cool." }, { "start": 130.04, "end": 132.92000000000002, "text": " So OpenAI basically just made everything bigger." }, { "start": 132.92000000000002, "end": 137.36, "text": " And here they say to make everything even bigger, you need some tricks in how to build" }, { "start": 137.36, "end": 138.36, "text": " models." }, { "start": 138.36, "end": 144.84, "text": " And then they've basically developed this entire framework to build these giant models." }, { "start": 144.84, "end": 147.96, "text": " And this paper mainly describes that framework." }, { "start": 147.96, "end": 153.28, "text": " And the actual task here, which is machine translation, is almost sort of a side thing" }, { "start": 153.28, "end": 155.24, "text": " in the paper." }, { "start": 155.24, "end": 160.28000000000003, "text": " It's just a task to showcase what this system can do." }, { "start": 160.28000000000003, "end": 165.4, "text": " So this is very much an engineering paper rather than that much than a machine learning" }, { "start": 165.4, "end": 166.4, "text": " paper." }, { "start": 166.4, "end": 167.76000000000002, "text": " And that's how you have to look at it right here." }, { "start": 167.76, "end": 171.23999999999998, "text": " That being said, the machine learning results are of course, quite impressive." }, { "start": 171.23999999999998, "end": 177.12, "text": " If you look at this graph here, you have a quality gain." }, { "start": 177.12, "end": 178.88, "text": " It's a difference in blur score." }, { "start": 178.88, "end": 185.51999999999998, "text": " And this is a quality score for machine translation over the previous state of the art." }, { "start": 185.51999999999998, "end": 194.2, "text": " So over their baseline, which, as you can see here, you have 37 billion weights, 150" }, { "start": 194.2, "end": 199.51999999999998, "text": " billion weights, and 600 billion weights, which they only train." }, { "start": 199.51999999999998, "end": 205.92, "text": " They train for, you know, 2000 and on 2048 TPUs for just four days." }, { "start": 205.92, "end": 210.44, "text": " They stress this is very efficient because they just have to train it for four days on" }, { "start": 210.44, "end": 213.28, "text": " 2000 TPUs." }, { "start": 213.28, "end": 214.28, "text": " Absolutely crazy." }, { "start": 214.28, "end": 217.6, "text": " So let's have a look at what this paper does." }, { "start": 217.6, "end": 222.95999999999998, "text": " If you enjoy this, if you enjoyed this at the end, consider, you know, sharing the video" }, { "start": 222.96, "end": 230.88, "text": " out if you like it and tell me what you think about this stuff in the comments." }, { "start": 230.88, "end": 236.56, "text": " Alright, so we'll go through the abstract and then we'll go through highlighted sections" }, { "start": 236.56, "end": 239.24, "text": " of the paper because the paper is 23 pages long." }, { "start": 239.24, "end": 243.84, "text": " So I won't be able to cover everything, just kind of give you the high level ideas and" }, { "start": 243.84, "end": 248.04000000000002, "text": " highlight a few things." }, { "start": 248.04000000000002, "end": 250.44, "text": " Actually let's not go into the abstract." }, { "start": 250.44, "end": 252.94, "text": " Let's go into these results first." }, { "start": 252.94, "end": 256.44, "text": " So as you can see, they managed to continue the trend." }, { "start": 256.44, "end": 261.92, "text": " The trend in NLP has always been, at least since, you know, transformers were invented," }, { "start": 261.92, "end": 267.28, "text": " the bigger the better, like larger model, larger data, more compute means better performance." }, { "start": 267.28, "end": 272.92, "text": " And this is sort of unbroken here, as you can see, if you increase the number of parameters" }, { "start": 272.92, "end": 280.6, "text": " in these models, you do get a very, very big gain in these blur score, though it sort of" }, { "start": 280.6, "end": 285.88, "text": " seems to be kind of a logarithmic scaling, like you have to keep doubling and doubling" }, { "start": 285.88, "end": 292.48, "text": " and doubling the number of weights, sort of like Moore's law in computation." }, { "start": 292.48, "end": 298.68, "text": " You can see that at the same time, the training wall time is going down and the computational" }, { "start": 298.68, "end": 304.52000000000004, "text": " cost, the computational cost of these models, it doesn't scale quadratically like you would" }, { "start": 304.52000000000004, "end": 306.8, "text": " expect, it scales linearly." }, { "start": 306.8, "end": 313.12, "text": " And that's the big difference here in how these authors scale their model, rather than" }, { "start": 313.12, "end": 317.12, "text": " how the open AI authors scale their model." }, { "start": 317.12, "end": 323.40000000000003, "text": " So in a traditional transformer, it looks like this." }, { "start": 323.40000000000003, "end": 326.32, "text": " So it has these blocks of attention." }, { "start": 326.32, "end": 330.24, "text": " If you don't know what this is, I have a video called Attention is All You Need." }, { "start": 330.24, "end": 334.74, "text": " I explain how the attention blocks in transformers work." }, { "start": 334.74, "end": 336.28000000000003, "text": " So this is nothing different." }, { "start": 336.28, "end": 338.67999999999995, "text": " These are just standard transformers." }, { "start": 338.67999999999995, "end": 341.44, "text": " There is an encoder and a decoder." }, { "start": 341.44, "end": 342.7, "text": " Everything works as you know." }, { "start": 342.7, "end": 345.08, "text": " So you have these blocks, you have n blocks." }, { "start": 345.08, "end": 348.14, "text": " These are the number of layers that you have." }, { "start": 348.14, "end": 353.78, "text": " And in these blocks, you always have an attention layer, and then a feed forward layer that" }, { "start": 353.78, "end": 356.03999999999996, "text": " acts on the tokens." }, { "start": 356.03999999999996, "end": 362.67999999999995, "text": " So without repeating too much what an attention mechanism does, basically, you have input" }, { "start": 362.67999999999995, "end": 364.21999999999997, "text": " tokens." }, { "start": 364.22, "end": 369.24, "text": " So this is a sequence, it's technically a set processing unit, but we use it for sequences" }, { "start": 369.24, "end": 370.24, "text": " of text." }, { "start": 370.24, "end": 374.40000000000003, "text": " So here you have six tokens, a sentence of maybe six words." }, { "start": 374.40000000000003, "end": 380.20000000000005, "text": " And then you transform it with the attention layer by having this attention mechanism that" }, { "start": 380.20000000000005, "end": 387.28000000000003, "text": " routes information from tokens to from positions to other positions, maybe like this route" }, { "start": 387.28000000000003, "end": 389.32000000000005, "text": " is here, route this here." }, { "start": 389.32, "end": 394.92, "text": " And then you have a feed forward network that is applied on a per token basis." }, { "start": 394.92, "end": 402.68, "text": " So each of these tokens now goes through this feed forward network and is kind of transformed." }, { "start": 402.68, "end": 406.28, "text": " So the embedding of that token is transformed by that feed forward network." }, { "start": 406.28, "end": 408.64, "text": " Now every token does this." }, { "start": 408.64, "end": 410.94, "text": " And it's always the same feed forward network." }, { "start": 410.94, "end": 414.44, "text": " So this network here is the same as this network." }, { "start": 414.44, "end": 419.88, "text": " Now usually, when we talk about scaling transformers, we talk about this part right here, we talk" }, { "start": 419.88, "end": 422, "text": " about the attention mechanism." }, { "start": 422, "end": 425.86, "text": " And also we talk about this part, the number of layers." }, { "start": 425.86, "end": 432.12, "text": " So you know, we talk about scaling the number of transformer layers, more layers, more layers," }, { "start": 432.12, "end": 433.32, "text": " more layers." }, { "start": 433.32, "end": 438.44, "text": " And if we want to scale the attention mechanism, what that basically means is we have we increase" }, { "start": 438.44, "end": 442.2, "text": " the context size of the text we can input." }, { "start": 442.2, "end": 449.71999999999997, "text": " So transformers are very limited by the size of this context right here that they can take." }, { "start": 449.71999999999997, "end": 454.4, "text": " Like the original transformer started with something like 512 tokens that they were able" }, { "start": 454.4, "end": 459.4, "text": " to take because this attention mechanism has quadratic complexity." }, { "start": 459.4, "end": 467.56, "text": " This went up and the open AI GPT-3, I believe, had a context size of 2048 tokens, which if" }, { "start": 467.56, "end": 470.9, "text": " it scales quadratically, that's quite an achievement." }, { "start": 470.9, "end": 476.23999999999995, "text": " And also it stacked the layers very, very deep." }, { "start": 476.23999999999995, "end": 479.32, "text": " Now in this paper, they scale the transformers differently." }, { "start": 479.32, "end": 486.41999999999996, "text": " They basically leave the context size and I believe that their context size is 1024." }, { "start": 486.41999999999996, "end": 489.64, "text": " So significantly smaller than the open AI context size." }, { "start": 489.64, "end": 491.94, "text": " And they don't scale the layers." }, { "start": 491.94, "end": 498.67999999999995, "text": " So their largest transformer is 36 layers, whereas I believe GPT-3 was maybe correct" }, { "start": 498.68, "end": 503.44, "text": " me but I think it was like 90 or 100 layers or something like this, at least significantly" }, { "start": 503.44, "end": 505.32, "text": " larger than this." }, { "start": 505.32, "end": 510.6, "text": " Instead, what they scale is this part right here, the feet forward layers." }, { "start": 510.6, "end": 513.08, "text": " Now that might seem counterintuitive." }, { "start": 513.08, "end": 520.6, "text": " But they basically, they basically say what if we didn't only have one feed forward network" }, { "start": 520.6, "end": 523.16, "text": " right here, but we had many, right?" }, { "start": 523.16, "end": 524.84, "text": " We don't always have the same." }, { "start": 524.84, "end": 531.6, "text": " We have many, many feed forward networks, different ones that can do different things." }, { "start": 531.6, "end": 534.62, "text": " So that's what they call experts." }, { "start": 534.62, "end": 536.96, "text": " Each one of these feed forward layers is an expert." }, { "start": 536.96, "end": 541.88, "text": " And then you have yet another routing mechanism, kind of like in attention, you have a routing" }, { "start": 541.88, "end": 545.8000000000001, "text": " mechanism that decides which tokens go where." }, { "start": 545.8000000000001, "end": 552.9200000000001, "text": " Okay, so this token here, this token here, this token here, and the sort of the implication" }, { "start": 552.92, "end": 559.36, "text": " being that different tokens, different parts of the input you want to transform require" }, { "start": 559.36, "end": 562.4799999999999, "text": " a different kind of transformations here." }, { "start": 562.4799999999999, "end": 568.06, "text": " And these different experts can sort of specialize in how they transform the input." }, { "start": 568.06, "end": 573.7199999999999, "text": " Now their task here is going to be machine translation as a multitask setup." }, { "start": 573.7199999999999, "end": 579.8, "text": " So what you'll have is you'll have all kinds of languages like French and German, what's" }, { "start": 579.8, "end": 585.88, "text": " the E, and maybe a lot of languages." }, { "start": 585.88, "end": 588.5999999999999, "text": " I don't know any other languages." }, { "start": 588.5999999999999, "end": 595.12, "text": " And you want to translate all of them to English and you want to do it using the same model." }, { "start": 595.12, "end": 601, "text": " So these experts here, they might specialize in the individual languages." }, { "start": 601, "end": 606.8, "text": " Like maybe you will have to handle a pronoun differently if it comes from German than if" }, { "start": 606.8, "end": 608.16, "text": " it comes from French." }, { "start": 608.16, "end": 611.28, "text": " You want to do it with the same model at the same time." }, { "start": 611.28, "end": 617.52, "text": " That means you maybe want to have the one expert specialize in German pronouns and one" }, { "start": 617.52, "end": 620.3199999999999, "text": " expert specialize in French pronouns." }, { "start": 620.3199999999999, "end": 626.56, "text": " Also you can think of the experts as maybe one specializes in question words, it doesn't" }, { "start": 626.56, "end": 628.48, "text": " matter which language they're from." }, { "start": 628.48, "end": 633.76, "text": " And the other one specializes in some sort of other kind of linguistic feature." }, { "start": 633.76, "end": 640.56, "text": " In any case, this number of experts here is if you want to scale that up, then that becomes" }, { "start": 640.56, "end": 642.84, "text": " the bottleneck of the transformer." }, { "start": 642.84, "end": 648.8199999999999, "text": " They go up to 2000, 2048 experts in parallel." }, { "start": 648.8199999999999, "end": 653.5, "text": " So that doesn't fit into a single accelerator anymore." }, { "start": 653.5, "end": 656.54, "text": " And that's why the entire system has to be sharded." }, { "start": 656.54, "end": 658.36, "text": " And that's what they call G shard." }, { "start": 658.36, "end": 667.16, "text": " So G shard, the main application here is going to be how can we build this giant model on" }, { "start": 667.16, "end": 671.88, "text": " many, many distributed computers where the attention mechanism isn't the problem." }, { "start": 671.88, "end": 676.16, "text": " The attention mechanism we just distribute like we do data parallelism." }, { "start": 676.16, "end": 681.44, "text": " The attention, it lives on all of the accelerators, it synchronizes and so on." }, { "start": 681.44, "end": 687.5600000000001, "text": " But the experts here, there's only so this expert lives on machine A, this expert lives" }, { "start": 687.56, "end": 694.04, "text": " on machine B, this expert lives on machine C. And then we do a hard routing." }, { "start": 694.04, "end": 698.8199999999999, "text": " So we don't do a soft routing like an attention, we do a hard routing where one token goes" }, { "start": 698.8199999999999, "end": 702.9599999999999, "text": " to one or at maximum two experts." }, { "start": 702.9599999999999, "end": 705.1199999999999, "text": " So this is sent to these machines." }, { "start": 705.1199999999999, "end": 710.4, "text": " And then after the machines, you kind of gather all the results back right here." }, { "start": 710.4, "end": 715.4399999999999, "text": " So G shard is the system that enables this sharding of these experts." }, { "start": 715.44, "end": 720.48, "text": " And the everything in between everything that is necessary, but it can also be applied to" }, { "start": 720.48, "end": 722.48, "text": " shard any computation." }, { "start": 722.48, "end": 724.2800000000001, "text": " And that's why it's so cool." }, { "start": 724.2800000000001, "end": 732.8000000000001, "text": " So here you see what what they do, they always they take these transformers." }, { "start": 732.8000000000001, "end": 736.6800000000001, "text": " And they always consider a block of two transformer layers." }, { "start": 736.6800000000001, "end": 742.5400000000001, "text": " So this is a block of two transformer layers, you can see there is twice the attention," }, { "start": 742.5400000000001, "end": 744.9000000000001, "text": " and there's twice this feed forward." }, { "start": 744.9, "end": 750.12, "text": " So in one point, this feed forward is just a regular everything, all the tokens go through" }, { "start": 750.12, "end": 751.48, "text": " the same network." }, { "start": 751.48, "end": 753.4, "text": " So that's like a classic transformer." }, { "start": 753.4, "end": 759.24, "text": " But here, you have a lot of these different experts and the tokens are routed to these" }, { "start": 759.24, "end": 761.34, "text": " experts." }, { "start": 761.34, "end": 764.48, "text": " It's important that the tokens are hard routed, right?" }, { "start": 764.48, "end": 768.96, "text": " If the tokens were soft routed, you don't you don't gain anything, because every token" }, { "start": 768.96, "end": 771.0799999999999, "text": " has to go through every expert." }, { "start": 771.08, "end": 776.4200000000001, "text": " But here, the tokens are hard routed to the expert, which means that you can if you if" }, { "start": 776.4200000000001, "end": 786.44, "text": " I have an input size of 1024 tokens, maybe only 10 go to this one, and maybe only 10" }, { "start": 786.44, "end": 787.76, "text": " of that those go to this one." }, { "start": 787.76, "end": 791.8000000000001, "text": " Now you also have a batch size, of course, I haven't actually looked at what the batch" }, { "start": 791.8000000000001, "end": 797.32, "text": " size here is, but you usually have quite a large batch size in these things like maybe" }, { "start": 797.32, "end": 799.58, "text": " a batch size of 1000 as well." }, { "start": 799.58, "end": 804.12, "text": " So ultimately, what you'll end up is, you know, 1000 times 10 tokens going to the first" }, { "start": 804.12, "end": 805.1800000000001, "text": " expert and so on." }, { "start": 805.1800000000001, "end": 810.76, "text": " But still, you can significantly parallelize this computation." }, { "start": 810.76, "end": 812.4000000000001, "text": " Okay." }, { "start": 812.4000000000001, "end": 818.74, "text": " So this this, if you use G chart, this is going to result in the following in the thing" }, { "start": 818.74, "end": 823.76, "text": " on the right, where you have two machines, this is machine one, and this is machine two," }, { "start": 823.76, "end": 834.4399999999999, "text": " you can see that the machines will what happened here, or someone made the PowerPoint mistake." }, { "start": 834.4399999999999, "end": 839.48, "text": " So you can see that the the attention, everything is shared between the machines." }, { "start": 839.48, "end": 844.76, "text": " So this here and this here, these are synchronized, the weights are synchronized, right, you simply" }, { "start": 844.76, "end": 848.04, "text": " do a data sharing." }, { "start": 848.04, "end": 857.0799999999999, "text": " But here, you can see that you have model parallelism, model parallel mixture of experts," }, { "start": 857.0799999999999, "end": 863.8, "text": " where on the first machine, you have the first expert, and then you have e devices." }, { "start": 863.8, "end": 867.48, "text": " And on the last one, you have the last expert." }, { "start": 867.48, "end": 871.04, "text": " And then it's all routed out and routed in again." }, { "start": 871.04, "end": 874.04, "text": " And then you can continue your transformer." }, { "start": 874.04, "end": 877.06, "text": " And this is layer after layer." }, { "start": 877.06, "end": 880.8399999999999, "text": " So what's the problem here, the problem is that an operation like this is going to come" }, { "start": 880.8399999999999, "end": 887.4, "text": " to incur significant sort of overhead in terms of communication, and so on, if you were to" }, { "start": 887.4, "end": 891.28, "text": " do it naively, and it's going to be a real pain to program this." }, { "start": 891.28, "end": 896.7399999999999, "text": " And that's why G chart is made to do all of this automatically." }, { "start": 896.7399999999999, "end": 902.8399999999999, "text": " And you don't, you don't incur much of a cost, because you distribute." }, { "start": 902.8399999999999, "end": 905.5999999999999, "text": " So what's the difference to the old scaling?" }, { "start": 905.6, "end": 909.52, "text": " Why don't they just make transformers larger in number of layers?" }, { "start": 909.52, "end": 915.38, "text": " And that's because this this is, I guess, what opening into as well, if you make transformers" }, { "start": 915.38, "end": 920.5, "text": " simply larger in number of layers, sorry, if you make it transformers larger in the" }, { "start": 920.5, "end": 924.2, "text": " attention mechanism, it just won't fit into memory at some point." }, { "start": 924.2, "end": 926.24, "text": " And you'll you'll have to share that somehow." }, { "start": 926.24, "end": 928.34, "text": " And you can do this with G shard." }, { "start": 928.34, "end": 934.12, "text": " If you scale it in number of layers, that incurs significant cost where you have to" }, { "start": 934.12, "end": 938.96, "text": " wait, because you have to forward propagate, and then you have to backward propagate in" }, { "start": 938.96, "end": 940.7, "text": " your training sequence." }, { "start": 940.7, "end": 946.62, "text": " And if you have just too many layers, then a lot of the a lot of the frameworks get at" }, { "start": 946.62, "end": 952.7, "text": " their limit, where at some point they say, well, I still have to wait for the signal" }, { "start": 952.7, "end": 956.92, "text": " to come back in order to continue." }, { "start": 956.92, "end": 962.86, "text": " And they explore this in this benchmark right here." }, { "start": 962.86, "end": 968.86, "text": " You can see they say the largest model, the 600 billion parameter model that achieved" }, { "start": 968.86, "end": 975.22, "text": " the best translation quality was trained with 2000 TPU v3 cores for three days, a total" }, { "start": 975.22, "end": 979.66, "text": " cost of 22 TPU core years." }, { "start": 979.66, "end": 986.0600000000001, "text": " In contrast, training all 100 bilingual baseline models would have required 29 core years." }, { "start": 986.0600000000001, "end": 990.0600000000001, "text": " So the model here is faster than if you train them individually." }, { "start": 990.06, "end": 997.9399999999999, "text": " But if you want to train a single transformer that is just very deep, and achieves reasonable" }, { "start": 997.9399999999999, "end": 1001.06, "text": " performance, you have to invest a lot more." }, { "start": 1001.06, "end": 1006.14, "text": " Our best quality dense single transformer model 2.3 billion parameters." }, { "start": 1006.14, "end": 1008.8599999999999, "text": " So it's also significantly smaller." }, { "start": 1008.8599999999999, "end": 1013.76, "text": " Achieving this was trained with G pipe, which is a previous framework." }, { "start": 1013.76, "end": 1021.5, "text": " So G pipe is kind of a task runner that also distributes computation was trained with G" }, { "start": 1021.5, "end": 1031.66, "text": " pipe on 2048 TPU cores for six weeks or a total of 235 TPU core years." }, { "start": 1031.66, "end": 1037.58, "text": " By the way, for if you if you have $1 per TPU hour, that'll only cause that'll only," }, { "start": 1037.58, "end": 1042.46, "text": " I guess set you back about 2 million or so." }, { "start": 1042.46, "end": 1044.3, "text": " It's easy peasy." }, { "start": 1044.3, "end": 1053.06, "text": " Or even 200,000 just, you know, a tiny, tiny bit of of money." }, { "start": 1053.06, "end": 1060.8600000000001, "text": " But you can see that this transformer model that is dense, which means that is a classic" }, { "start": 1060.8600000000001, "end": 1066.26, "text": " transformer where you stack the transformer layers, you stack them, you stack them, you" }, { "start": 1066.26, "end": 1067.26, "text": " stack them." }, { "start": 1067.26, "end": 1073.62, "text": " It, in fact, it has 96 layers, their baseline 96 layer transformer model, that's sort of" }, { "start": 1073.62, "end": 1078.58, "text": " what opening I did, they just kept stacking the transformer layers." }, { "start": 1078.58, "end": 1083.02, "text": " You get a model that has less parameters and trains for much longer." }, { "start": 1083.02, "end": 1087.02, "text": " And its performance is only about this good." }, { "start": 1087.02, "end": 1093.58, "text": " Whereas here, if you scale not into depth, but into width of these experts, and it's" }, { "start": 1093.58, "end": 1098.3799999999999, "text": " not dense, but it's shorted, which means it calculates this in a in a kind of sparsified" }, { "start": 1098.3799999999999, "end": 1103.62, "text": " way because it has this hard routing, you can scale up to a lot more parameters." }, { "start": 1103.62, "end": 1110.1, "text": " So 600 billion parameters, over 200 times more parameters than the deep model, and you" }, { "start": 1110.1, "end": 1113.1, "text": " can get a much better performance." }, { "start": 1113.1, "end": 1119.6399999999999, "text": " Okay, so this is what is different here, it scales into these experts rather than scaling" }, { "start": 1119.64, "end": 1125.98, "text": " into depth or, or size of the attention mechanism itself." }, { "start": 1125.98, "end": 1131.94, "text": " All right, the question, I guess that you come up with if you're a machine learner is" }, { "start": 1131.94, "end": 1137.9, "text": " how do you back propagate if you route if here you route to these different experts," }, { "start": 1137.9, "end": 1143.0200000000002, "text": " and you do a hard routing like here, how do you back propagate the signal because it seems" }, { "start": 1143.0200000000002, "end": 1144.92, "text": " like you need a soft routing." }, { "start": 1144.92, "end": 1150.74, "text": " But this has been handled, in fact, these mixture of experts has been introduced previously," }, { "start": 1150.74, "end": 1156.66, "text": " in a paper I think called outrageously large language models or something like this." }, { "start": 1156.66, "end": 1161.26, "text": " And so they've introduced that, you know, it, it still works." }, { "start": 1161.26, "end": 1167.1000000000001, "text": " So backprop still works through so basically you have a backprop path through here." }, { "start": 1167.1000000000001, "end": 1172.78, "text": " And because you put a little bit of noise in this routing, every path gets explored" }, { "start": 1172.78, "end": 1177.42, "text": " a few times, and therefore you have enough backprop signal to make it work." }, { "start": 1177.42, "end": 1183.42, "text": " It can it could technically fail, but they do observe generally that it does work if" }, { "start": 1183.42, "end": 1186.78, "text": " you do this kind of hard routing with a bit of noise." }, { "start": 1186.78, "end": 1192.78, "text": " All right, so where do we go from here, as I said, this is an engineering paper, and" }, { "start": 1192.78, "end": 1194.24, "text": " it's a long engineering paper." }, { "start": 1194.24, "end": 1200.8999999999999, "text": " So they, they set up their, they set up a lot of a lot of the details of engineering" }, { "start": 1200.9, "end": 1205.5, "text": " directly in the paper, which we're not used to in the machine learning world." }, { "start": 1205.5, "end": 1212.98, "text": " They really detail how they shard things and so on, which is pretty cool." }, { "start": 1212.98, "end": 1217.7, "text": " But I invite you to look at the paper yourself." }, { "start": 1217.7, "end": 1220.74, "text": " If you really want to know what's going on right here." }, { "start": 1220.74, "end": 1228.8600000000001, "text": " Suffice to say, they, as you can see right here, what they do is, this is the input right" }, { "start": 1228.86, "end": 1236.58, "text": " here, and then they have this weight matrix, which is a this routing, this is learned routing" }, { "start": 1236.58, "end": 1237.58, "text": " weights." }, { "start": 1237.58, "end": 1238.58, "text": " Okay." }, { "start": 1238.58, "end": 1245.4599999999998, "text": " So you have trainable weights that decide how to route the input, and that's dependent" }, { "start": 1245.4599999999998, "end": 1246.54, "text": " on the input." }, { "start": 1246.54, "end": 1250.02, "text": " So you have a bunch of inputs that comes from the lower layer." }, { "start": 1250.02, "end": 1255.02, "text": " And this matrix right here determines where to route them." }, { "start": 1255.02, "end": 1260.06, "text": " Probably says, okay, the input is a vector like this." }, { "start": 1260.06, "end": 1264.1399999999999, "text": " I know that must probably go to the expert number three." }, { "start": 1264.1399999999999, "end": 1265.1399999999999, "text": " Okay." }, { "start": 1265.1399999999999, "end": 1267.2, "text": " And you have a softmax across that." }, { "start": 1267.2, "end": 1272.48, "text": " So it's a really, it's an assignment to, it's a soft assignment to the experts." }, { "start": 1272.48, "end": 1278.26, "text": " So once you've done the soft assignment to the expert, you do a hard assignment by collecting" }, { "start": 1278.26, "end": 1280.62, "text": " the top two." }, { "start": 1280.62, "end": 1287.4599999999998, "text": " For each token, you say you collect the top two experts, and you only send it to the top" }, { "start": 1287.4599999999998, "end": 1291.6, "text": " two experts and you ignore all else, which is not a lot right there." }, { "start": 1291.6, "end": 1296.9399999999998, "text": " At times there are 2000 experts in the system." }, { "start": 1296.9399999999998, "end": 1300.9599999999998, "text": " And yeah, you distribute and you have some noise." }, { "start": 1300.9599999999998, "end": 1306.8, "text": " So with a random probability, you actually don't even send it to the second expert." }, { "start": 1306.8, "end": 1310.8799999999999, "text": " You just leave it at the first one." }, { "start": 1310.8799999999999, "end": 1313.94, "text": " And with some noise, you send it also to the second one." }, { "start": 1313.94, "end": 1319.96, "text": " And I think that that noise is part of what if what makes the system work a bit." }, { "start": 1319.96, "end": 1325.1, "text": " And then you also have this auxiliary loss right here that you add on top, which just" }, { "start": 1325.1, "end": 1328.6399999999999, "text": " makes sure that you distribute evenly." }, { "start": 1328.64, "end": 1336.94, "text": " So this encourages the system to distribute the tokens evenly, because sorry, what it" }, { "start": 1336.94, "end": 1344.6200000000001, "text": " penalizes is a this here is the mean assignment to each expert." }, { "start": 1344.6200000000001, "end": 1353.0200000000002, "text": " So it penalizes whenever the mean assignment is out of out of line, basically, so a distribution" }, { "start": 1353.0200000000002, "end": 1357.3400000000001, "text": " assignment to the expert or one expert gets a lot of tokens, because I don't know, it" }, { "start": 1357.34, "end": 1358.82, "text": " tends to be really good at something." }, { "start": 1358.82, "end": 1360.9399999999998, "text": " So all the tokens are routed to it." }, { "start": 1360.9399999999998, "end": 1364.1799999999998, "text": " And the other expert don't get a lot that's penalized." }, { "start": 1364.1799999999998, "end": 1369.34, "text": " So you encourage the system to distribute tokens evenly between those experts." }, { "start": 1369.34, "end": 1373.8, "text": " And then there are also like upper limits where you drop tokens and so on." }, { "start": 1373.8, "end": 1382.9399999999998, "text": " They really build a system that is out for performance rather than machine learning correctness." }, { "start": 1382.94, "end": 1388.38, "text": " So they demonstrate how to do this in in sort of code with their system." }, { "start": 1388.38, "end": 1393.8600000000001, "text": " And the cool thing about their system is that you don't have to do much." }, { "start": 1393.8600000000001, "end": 1401.78, "text": " What you'll have to do is just specify which tensors are sharded at along which dimensions" }, { "start": 1401.78, "end": 1403.7, "text": " and the system does the rest." }, { "start": 1403.7, "end": 1405.8, "text": " So this is pretty cool." }, { "start": 1405.8, "end": 1414.18, "text": " So this here is this mixture of experts, mixture of experts as you would write it in code." }, { "start": 1414.18, "end": 1418.18, "text": " And they make use a lot of this Einstein, this Einstein some notation." }, { "start": 1418.18, "end": 1423.78, "text": " If you don't know what the Einstein some notation is, it's a general notation to describe matrix" }, { "start": 1423.78, "end": 1426.1, "text": " or tensor multiplications." }, { "start": 1426.1, "end": 1434.22, "text": " So a for example, if you were to multiply two matrices, you could have a string there," }, { "start": 1434.22, "end": 1441.7, "text": " you describe it as a string and it comes from how Einstein wrote up the kind of tensor contractions" }, { "start": 1441.7, "end": 1444.44, "text": " in his work." }, { "start": 1444.44, "end": 1454.18, "text": " So if you want to multiply two matrices, you can you could put the string a b b c goes" }, { "start": 1454.18, "end": 1457.32, "text": " to a c." }, { "start": 1457.32, "end": 1461.38, "text": " So this and then you put two matrices right here." }, { "start": 1461.38, "end": 1464.02, "text": " This will tell it, okay, I have a one matrix." }, { "start": 1464.02, "end": 1468.58, "text": " I'm going to call the axis a and b, I have another matrix or tensor where I'm going to" }, { "start": 1468.58, "end": 1470.9, "text": " call the axis b and c." }, { "start": 1470.9, "end": 1478.82, "text": " Now I have the resulting tensor, and I want the first axis to be a and the a is this one." }, { "start": 1478.82, "end": 1482.22, "text": " And I want the last axis to be c and the c is this one." }, { "start": 1482.22, "end": 1488.52, "text": " And b is nowhere b is not in the output, which means it should contract over b." }, { "start": 1488.52, "end": 1495.04, "text": " So it should sum along b, sorry, it should multiply along b and then add such contract" }, { "start": 1495.04, "end": 1496.04, "text": " over b." }, { "start": 1496.04, "end": 1501.6, "text": " So this here describes a regular matrix matrix multiplication." }, { "start": 1501.6, "end": 1508.74, "text": " Now if I could do something else, I could do something like a just a element wise product," }, { "start": 1508.74, "end": 1518.5, "text": " an element wise product would be something like this a b comma a b goes to a b, which" }, { "start": 1518.5, "end": 1527.86, "text": " means here, I have a in the first input, and here I have a again." }, { "start": 1527.86, "end": 1532.9, "text": " And I'm so you already see that you can even though these are different tensors, you can" }, { "start": 1532.9, "end": 1537.02, "text": " call the axis the same, which means that they're going to somehow be multiplied together." }, { "start": 1537.02, "end": 1541.18, "text": " Now if you leave it away here, it means that it's going to be contracted and therefore" }, { "start": 1541.18, "end": 1542.86, "text": " the axis no longer exists." }, { "start": 1542.86, "end": 1547.1, "text": " But here we don't leave it away, which simply means that these axes are going to be multiplied" }, { "start": 1547.1, "end": 1548.1, "text": " together." }, { "start": 1548.1, "end": 1549.78, "text": " And the same for b right here." }, { "start": 1549.78, "end": 1553.54, "text": " So this describes an element wise." }, { "start": 1553.54, "end": 1556.62, "text": " This describes an element wise product, you can go really funky with this." }, { "start": 1556.62, "end": 1566.98, "text": " So this, this here would be a row wise dot product, where a is more it for all the a" }, { "start": 1566.98, "end": 1573.38, "text": " is it's element wise, but then over b, it's contracted." }, { "start": 1573.38, "end": 1578.26, "text": " So you know, you can go, you can go wild with the Einstein some notation, you can describe" }, { "start": 1578.26, "end": 1581.78, "text": " a lot of things with it." }, { "start": 1581.78, "end": 1589.02, "text": " So here is this algorithm to distribute the computation among these different experts." }, { "start": 1589.02, "end": 1597.26, "text": " So you have the inputs and the weight matrix for the, they call this the gates function." }, { "start": 1597.26, "end": 1601.42, "text": " That's the routing function to these experts." }, { "start": 1601.42, "end": 1602.42, "text": " So what do we do?" }, { "start": 1602.42, "end": 1610.98, "text": " We first of all, we have these tensors, these, they have these grouping, these grouping dimension" }, { "start": 1610.98, "end": 1611.98, "text": " right here." }, { "start": 1611.98, "end": 1618.18, "text": " So they come along to along groups, which in our case, we could maybe say these are" }, { "start": 1618.18, "end": 1623.38, "text": " batches or the batch dimension." }, { "start": 1623.38, "end": 1629.22, "text": " So they come across groups, and there is the sequence length and there is this M right" }, { "start": 1629.22, "end": 1631.46, "text": " here." }, { "start": 1631.46, "end": 1638.6200000000001, "text": " That's going to be the feature dimension, the M. And you can see the M is contracted." }, { "start": 1638.6200000000001, "end": 1639.8400000000001, "text": " So the M is no longer here." }, { "start": 1639.8400000000001, "end": 1647.66, "text": " So the gating function is going to route each input token right here to one of the experts" }, { "start": 1647.66, "end": 1652.42, "text": " for each thing in the group." }, { "start": 1652.42, "end": 1656.74, "text": " So you can see, you can express this with an Einstein some notation." }, { "start": 1656.74, "end": 1663.9, "text": " Then you have a top two gating, which selects the top two from each of the last, from each" }, { "start": 1663.9, "end": 1668.5400000000002, "text": " of the entries." }, { "start": 1668.5400000000002, "end": 1674.4, "text": " And that gives you this dispatch mask and the sorry, and the weights that you have to" }, { "start": 1674.4, "end": 1676.1000000000001, "text": " use at the end to combine." }, { "start": 1676.1, "end": 1680.4599999999998, "text": " You can use the dispatch mask in order to distribute the inputs." }, { "start": 1680.4599999999998, "end": 1684.74, "text": " So you have reshaped inputs, and so on." }, { "start": 1684.74, "end": 1688.4599999999998, "text": " So I'm not going to go through all of this right here, but you can express all of this" }, { "start": 1688.4599999999998, "end": 1693.5, "text": " in terms of the Einstein some notation." }, { "start": 1693.5, "end": 1699.1, "text": " And you can express pretty much any sort of computation that is along the line." }, { "start": 1699.1, "end": 1703.3, "text": " You can express the attention mechanism and so on." }, { "start": 1703.3, "end": 1708.58, "text": " You can express the feed forward layers in terms of these Einstein some notations and" }, { "start": 1708.58, "end": 1715.3, "text": " the underlying the underlined dimensions here are the dimensions where we want to shard" }, { "start": 1715.3, "end": 1716.78, "text": " the computation." }, { "start": 1716.78, "end": 1727.54, "text": " So here, because we have this G underlined, that means that we are interested in sharding" }, { "start": 1727.54, "end": 1730.74, "text": " the computation along this axis." }, { "start": 1730.74, "end": 1733.02, "text": " So this, I said, this is the batch dimension." }, { "start": 1733.02, "end": 1738.94, "text": " This is your classic data parallelism, which means that the first machine gets the first" }, { "start": 1738.94, "end": 1743.58, "text": " couple of data points, the second machine gets the second couple of data points, and" }, { "start": 1743.58, "end": 1744.58, "text": " so on." }, { "start": 1744.58, "end": 1750.02, "text": " And you can see in the weight matrix, there is no sharding, which means that the weight" }, { "start": 1750.02, "end": 1756.34, "text": " matrix lives on every machine as a copy of one another." }, { "start": 1756.34, "end": 1766.74, "text": " This is different from from here, where you can see that what we're now going to do is" }, { "start": 1766.74, "end": 1771.6599999999999, "text": " here it's still sharded according to the batch, but we now are going to shard this according" }, { "start": 1771.6599999999999, "end": 1773.1399999999999, "text": " to the different experts." }, { "start": 1773.1399999999999, "end": 1782.22, "text": " So we're going to route whatever the inputs are in to these experts." }, { "start": 1782.22, "end": 1787.34, "text": " And then we're going to execute the computations on the experts." }, { "start": 1787.34, "end": 1790.6200000000001, "text": " So this is now sharded according to the experts." }, { "start": 1790.6200000000001, "end": 1794.94, "text": " And at the end, right here, you can see this is still sharded according to the experts." }, { "start": 1794.94, "end": 1798.04, "text": " We're going to put it back together." }, { "start": 1798.04, "end": 1801.92, "text": " And now it's sharded according to the groups again." }, { "start": 1801.92, "end": 1808.98, "text": " That's what we said, we have the input right here, the inputs, and the inputs are maybe" }, { "start": 1808.98, "end": 1814.1200000000001, "text": " distributed according to the according to machines, right, we have these go through" }, { "start": 1814.1200000000001, "end": 1817.66, "text": " the first machine, these the second, these the third, and so on." }, { "start": 1817.66, "end": 1820.2, "text": " This is your classic data parallelism." }, { "start": 1820.2, "end": 1824.98, "text": " But then we have all of these experts." }, { "start": 1824.98, "end": 1830.5, "text": " And now all of a sudden, we're going to route these things to the individual experts." }, { "start": 1830.5, "end": 1834.94, "text": " And we're going to execute the computation in parallel on the experts." }, { "start": 1834.94, "end": 1840.18, "text": " And then after that, we're going to put back together from wherever we got them now have" }, { "start": 1840.18, "end": 1841.18, "text": " to." }, { "start": 1841.18, "end": 1843.3, "text": " So this goes here again." }, { "start": 1843.3, "end": 1846.98, "text": " And so this is just the reverse of what we did before." }, { "start": 1846.98, "end": 1852.2, "text": " So right, like that." }, { "start": 1852.2, "end": 1854.38, "text": " So you get all of the outputs again." }, { "start": 1854.38, "end": 1857.52, "text": " I hope you kind of can imagine how this happens." }, { "start": 1857.52, "end": 1860.8200000000002, "text": " So the first difference is, is that's sharded according to a different dimension." }, { "start": 1860.82, "end": 1867.1, "text": " And the second difference is, is that when we shard in data parallelism, we execute the" }, { "start": 1867.1, "end": 1871.98, "text": " same computation on all the machines, which means that we have the same weight matrix." }, { "start": 1871.98, "end": 1881.06, "text": " If we do x times w in a feet forward layer, and we shard this thing here in data parallelism," }, { "start": 1881.06, "end": 1890.8, "text": " what we do is we send the x to different machines, we split the x, we send it to different machines," }, { "start": 1890.8, "end": 1894.18, "text": " this is x1, next to x3, x4." }, { "start": 1894.18, "end": 1898.98, "text": " But we always multiply it with the same weight matrix that weight matrix lives on all of" }, { "start": 1898.98, "end": 1903.7, "text": " the machines and is regularly synchronized, it's kept synchronous in some way." }, { "start": 1903.7, "end": 1911.3, "text": " Whereas if we shard x to the experts, then the experts have individual functions." }, { "start": 1911.3, "end": 1916.94, "text": " So the expert one is different from the expert two is different from the expert three, and" }, { "start": 1916.94, "end": 1919.62, "text": " so on." }, { "start": 1919.62, "end": 1924.3799999999999, "text": " Which means that before it wasn't important where x was routed, because we would execute" }, { "start": 1924.3799999999999, "end": 1925.54, "text": " the same computation." }, { "start": 1925.54, "end": 1930.34, "text": " So we can just, you know, sharded according to you know, the first 10 go there, the next" }, { "start": 1930.34, "end": 1931.34, "text": " 10 go there." }, { "start": 1931.34, "end": 1935.6799999999998, "text": " But here, it's not crucially important where they are routed to to which expert." }, { "start": 1935.6799999999998, "end": 1939.58, "text": " And that's why we learn the function that is going to route them." }, { "start": 1939.58, "end": 1944.34, "text": " So this is learned, this is these first line here, these are the weights that we learn" }, { "start": 1944.34, "end": 1948.62, "text": " to route, then we route right here." }, { "start": 1948.62, "end": 1955.7399999999998, "text": " And we calculate your your, we calculate the feet forward layers on the expert, you see" }, { "start": 1955.7399999999998, "end": 1962.06, "text": " that this wi and wo, they are the weight matrices of the feet forward layer, the feet forward" }, { "start": 1962.06, "end": 1970.2399999999998, "text": " layers are, you have your input, you multiply it by wi, you have a ReLU, ReLU, and then" }, { "start": 1970.2399999999998, "end": 1972.1999999999998, "text": " you multiply it by wo." }, { "start": 1972.1999999999998, "end": 1977.6399999999999, "text": " So it's kind of a two layer feet forward network." }, { "start": 1977.64, "end": 1982.5400000000002, "text": " So this two layer feet forward network, as you can see, this is sharded according to" }, { "start": 1982.5400000000002, "end": 1984.74, "text": " the experts." }, { "start": 1984.74, "end": 1992.94, "text": " And then, and the important part is, of course, that here, the weight is also sharded according" }, { "start": 1992.94, "end": 1993.94, "text": " to the experts." }, { "start": 1993.94, "end": 1996.74, "text": " And that's what makes each expert different." }, { "start": 1996.74, "end": 2000.0200000000002, "text": " And then it's combined again down here." }, { "start": 2000.0200000000002, "end": 2003.42, "text": " So I hope you kind of get the idea of what this algorithm does." }, { "start": 2003.42, "end": 2009.14, "text": " But the fact that we shard according to these experts is in fact different than your regular" }, { "start": 2009.14, "end": 2015.8200000000002, "text": " sharding where you shard the data like the batch, the batches, but keep the model in" }, { "start": 2015.8200000000002, "end": 2021.1000000000001, "text": " parallel, keep the model synchronized." }, { "start": 2021.1000000000001, "end": 2024.64, "text": " With their system right now, this is how easy this is." }, { "start": 2024.64, "end": 2028.66, "text": " So before we simply stated our algorithm in Einstein's sumnotations, there is no way" }, { "start": 2028.66, "end": 2033.94, "text": " to underline code and that magically happened something that was simply for us to visualize." }, { "start": 2033.94, "end": 2041.22, "text": " Now we want to apply their system in order to make this actually sharded." }, { "start": 2041.22, "end": 2046.5, "text": " And with the Gshard system, and as I said, I don't know if the code is out or it will" }, { "start": 2046.5, "end": 2051.32, "text": " be out, but with the Gshard system, this is basically all that you have to do." }, { "start": 2051.32, "end": 2056.26, "text": " So you have these functions, they're called split and replicate." }, { "start": 2056.26, "end": 2064.5400000000004, "text": " What replicate does is it takes that weight tensor and it replicates it on all the machines" }, { "start": 2064.5400000000004, "end": 2066.5800000000004, "text": " and that keeps it synchronized." }, { "start": 2066.5800000000004, "end": 2071.9, "text": " This is a computation where we simply want to shard out the different to the different" }, { "start": 2071.9, "end": 2074.0200000000004, "text": " machines but keep it synchronized." }, { "start": 2074.0200000000004, "end": 2081.3, "text": " And you can see if you do this, this is the operation, then the system knows, ah, this" }, { "start": 2081.3, "end": 2084.4, "text": " here is replicated across the machines." }, { "start": 2084.4, "end": 2090.98, "text": " So that means I'm going to distribute the data points according to this G dimension," }, { "start": 2090.98, "end": 2096.7000000000003, "text": " according to the batch dimension and multiply it with this matrix according to this Einstein" }, { "start": 2096.7000000000003, "end": 2099.64, "text": " sum notation string on all of the machines." }, { "start": 2099.64, "end": 2102.7000000000003, "text": " And I'm going to keep this tensor in sync." }, { "start": 2102.7000000000003, "end": 2113.58, "text": " Okay, so the system knows as opposed to that you have you have the split tensor right here." }, { "start": 2113.58, "end": 2125.58, "text": " So the split, what it does is it splits a computation here the dispatch expert inputs," }, { "start": 2125.58, "end": 2135.4, "text": " it splits it according to a axis index onto D different machines or into D different parts." }, { "start": 2135.4, "end": 2144.1600000000003, "text": " So you see here you calculate the how you should do the routing and the resulting tensors" }, { "start": 2144.1600000000003, "end": 2147.2200000000003, "text": " first dimension is this E dimension." }, { "start": 2147.2200000000003, "end": 2152.34, "text": " And then you say that should be split, you know, according to this first dimension onto" }, { "start": 2152.34, "end": 2156.2200000000003, "text": " D different places and these D different places are now separate." }, { "start": 2156.2200000000003, "end": 2160.26, "text": " They don't have the they don't have to be kept in sync." }, { "start": 2160.26, "end": 2162.7000000000003, "text": " Everyone has their own weights." }, { "start": 2162.7, "end": 2169.3799999999997, "text": " And now when you do this, you know, according to this dimension, you can see because we" }, { "start": 2169.3799999999997, "end": 2175.3599999999997, "text": " know Einstein sum notation now, you can see this E appears here, here and here." }, { "start": 2175.3599999999997, "end": 2182.12, "text": " So this operation is going to be applied element wise, that means independent of each other" }, { "start": 2182.12, "end": 2189.64, "text": " in the direction of this dimension, the system understands that since this tensor is sharded" }, { "start": 2189.64, "end": 2197.22, "text": " according to that dimension, I have to execute this on each of these entries in separate" }, { "start": 2197.22, "end": 2203.4, "text": " with on each expert having their own weight matrix right here." }, { "start": 2203.4, "end": 2209.2999999999997, "text": " I hope this is a bit clear that their system makes it super easy." }, { "start": 2209.2999999999997, "end": 2211.16, "text": " You can basically do two things." }, { "start": 2211.16, "end": 2217.18, "text": " You can say this thing here is my classic parallelism where I want to keep it in sync." }, { "start": 2217.18, "end": 2222.3599999999997, "text": " And this thing here is where I want to split up and do different computation on the different" }, { "start": 2222.3599999999997, "end": 2224.2599999999998, "text": " parts." }, { "start": 2224.2599999999998, "end": 2229.98, "text": " And then they have also a general function that is more powerful." }, { "start": 2229.98, "end": 2235.48, "text": " Yeah, they and they you can auto partition and whatnot." }, { "start": 2235.48, "end": 2243.7799999999997, "text": " So they have a a a they have this we implemented the partitioner in the XLA compiler, which" }, { "start": 2243.78, "end": 2250.7000000000003, "text": " means that anything that can translate to XLA is a target for the system." }, { "start": 2250.7000000000003, "end": 2255.6800000000003, "text": " And that's, you know, TensorFlow and pytorch can do this." }, { "start": 2255.6800000000003, "end": 2260.42, "text": " So technically, this can come to any of those systems." }, { "start": 2260.42, "end": 2264.82, "text": " But of course, who has their 2000 TPUs lying around to make use of this?" }, { "start": 2264.82, "end": 2265.82, "text": " But no, I'm kidding." }, { "start": 2265.82, "end": 2269.6000000000004, "text": " I mean, this, I they here use it for transformers." }, { "start": 2269.6, "end": 2275.62, "text": " And I am very excited to to see what people can come up with for the system, I believe" }, { "start": 2275.62, "end": 2281.2599999999998, "text": " a system like this where it's super easy to to shard." }, { "start": 2281.2599999999998, "end": 2287.36, "text": " And they have some, you know, they talk about, okay, we do the single machine compiler." }, { "start": 2287.36, "end": 2290.18, "text": " So the compiler is also fast and so on." }, { "start": 2290.18, "end": 2292.02, "text": " I don't even want to go into this." }, { "start": 2292.02, "end": 2294.8199999999997, "text": " But this is very well engineered, it seems." }, { "start": 2294.82, "end": 2304.48, "text": " And they, they, they basically implement this for all of the operators." }, { "start": 2304.48, "end": 2310.98, "text": " So I'm very excited to see what people can come up with outside of the traditional applications." }, { "start": 2310.98, "end": 2316.46, "text": " I think there can be new types of models developed simply because we have a system like this" }, { "start": 2316.46, "end": 2318.2200000000003, "text": " that makes it easier." }, { "start": 2318.2200000000003, "end": 2319.46, "text": " So yeah, I'm excited." }, { "start": 2319.46, "end": 2329.26, "text": " So here, they show a bit how this works on the example of this Einstein, some notation." }, { "start": 2329.26, "end": 2335.1, "text": " So here, we want to do this thing here, which if you remember, this is the operation where" }, { "start": 2335.1, "end": 2338.52, "text": " we want to route the input to these experts." }, { "start": 2338.52, "end": 2343.84, "text": " So we want to start with something that is sharded according to the batch dimension." }, { "start": 2343.84, "end": 2349.54, "text": " That means that we, you know, we have different different parts of the batch on different" }, { "start": 2349.54, "end": 2351.7400000000002, "text": " machines." }, { "start": 2351.7400000000002, "end": 2358.1400000000003, "text": " And we want to route this and finally end up with something that is sharded on the different" }, { "start": 2358.1400000000003, "end": 2360.3, "text": " experts." }, { "start": 2360.3, "end": 2366.5, "text": " So this is what the system does is first you have these here are the different shards," }, { "start": 2366.5, "end": 2367.6600000000003, "text": " right?" }, { "start": 2367.66, "end": 2375.46, "text": " You want to multiply this, as you can see, this and this right here means that these" }, { "start": 2375.46, "end": 2380.2599999999998, "text": " this routing table is also sharded according to the same machines." }, { "start": 2380.2599999999998, "end": 2385.2999999999997, "text": " So you have the zero is all on the same machine, the one is all on the same machine, and so" }, { "start": 2385.2999999999997, "end": 2387.3999999999996, "text": " on." }, { "start": 2387.3999999999996, "end": 2395.06, "text": " So what you want to do is you want to contract is there you want to contract according to" }, { "start": 2395.06, "end": 2404.58, "text": " this s dimension, right, which we have we have omitted right here." }, { "start": 2404.58, "end": 2409.9, "text": " And if you multiply that, sorry, okay, we omit the s so this is not much of a this is" }, { "start": 2409.9, "end": 2413.5, "text": " not much of a graphic right here." }, { "start": 2413.5, "end": 2418.22, "text": " But then they have this reshard operation where they do and you don't have to worry" }, { "start": 2418.22, "end": 2419.22, "text": " about this." }, { "start": 2419.22, "end": 2425.2599999999998, "text": " So from here to here, there is this reshard operation that just shards it according to" }, { "start": 2425.2599999999998, "end": 2426.54, "text": " the according to E." }, { "start": 2426.54, "end": 2435.7799999999997, "text": " Yep." }, { "start": 2435.7799999999997, "end": 2439.8999999999996, "text": " I find this to be a bit more a bit more insightful." }, { "start": 2439.9, "end": 2450.5, "text": " So if you have something like this, this which is a regular matrix multiplication, right?" }, { "start": 2450.5, "end": 2455.78, "text": " And you want to contract along B, this is exactly the example we had before." }, { "start": 2455.78, "end": 2462.6600000000003, "text": " So here is a situation where our tensor is sharded according to the B dimension and this" }, { "start": 2462.6600000000003, "end": 2466.02, "text": " tensor is also sharded according to the B dimension." }, { "start": 2466.02, "end": 2470.62, "text": " You want to do a matrix multiplication of the whole tensor." }, { "start": 2470.62, "end": 2474.98, "text": " So what can you do, you're supposed to multiply these two matrices, but they are sharded on" }, { "start": 2474.98, "end": 2476.58, "text": " different machines." }, { "start": 2476.58, "end": 2482.54, "text": " If you consider what you actually have to do is you have to multiply each row here with" }, { "start": 2482.54, "end": 2484.82, "text": " each column here." }, { "start": 2484.82, "end": 2486.82, "text": " And that in an element wise fashion." }, { "start": 2486.82, "end": 2493.74, "text": " So that distributes according to you have to multiply this by this plus this by this" }, { "start": 2493.74, "end": 2498.7799999999997, "text": " plus this by this plus the red by the red." }, { "start": 2498.7799999999997, "end": 2506.7, "text": " So you can simply multiply the zero tensors together, the one tensors together, the two" }, { "start": 2506.7, "end": 2510.2999999999997, "text": " tensors together and the three tensors together." }, { "start": 2510.2999999999997, "end": 2517.02, "text": " Each one will give you a full matrix and then you can simply add all of them in order to" }, { "start": 2517.02, "end": 2518.5, "text": " get your full results." }, { "start": 2518.5, "end": 2520.54, "text": " This is illustrated down here." }, { "start": 2520.54, "end": 2530.06, "text": " So what machine one does, it simply multiplies its shard by its own shard of the second matrix," }, { "start": 2530.06, "end": 2532.14, "text": " which will give it this thing here." }, { "start": 2532.14, "end": 2537.7799999999997, "text": " And by the nature of how matrix multiplication is constructed, you can simply do an all reduce," }, { "start": 2537.7799999999997, "end": 2542.02, "text": " which means you reduce you sum across all of the machines, and that will give you the" }, { "start": 2542.02, "end": 2544.46, "text": " full result." }, { "start": 2544.46, "end": 2547.7799999999997, "text": " So this is a this is a an example of how this works." }, { "start": 2547.78, "end": 2554.0600000000004, "text": " This is, you know, pretty simple. And I believe you may have seen something like this already" }, { "start": 2554.0600000000004, "end": 2559.92, "text": " when you were looking at just parallelizing matrix multiplication, and so on." }, { "start": 2559.92, "end": 2563.02, "text": " So this system handles this transparently, right?" }, { "start": 2563.02, "end": 2567.1000000000004, "text": " If you're shorted like this, this is what the system will do." }, { "start": 2567.1000000000004, "end": 2572.34, "text": " However, if you are shorted differently, the system will act differently." }, { "start": 2572.34, "end": 2576.5800000000004, "text": " So here is a system you want to do the same matrix multiplication, but the first tensor" }, { "start": 2576.58, "end": 2581.9, "text": " happens to be shorted according to the A dimension, the second tensor happens to be shorted according" }, { "start": 2581.9, "end": 2584.06, "text": " to the C dimension." }, { "start": 2584.06, "end": 2589.5, "text": " And you want to end up with something that's shorted to the C dimension." }, { "start": 2589.5, "end": 2594.94, "text": " Now we have an additional constraint here that here you can see, we kind of assume that" }, { "start": 2594.94, "end": 2602.22, "text": " this full thing here fits into memory, mainly because we want to obtain the full result" }, { "start": 2602.22, "end": 2605.62, "text": " you see here, a and c should not be shorted." }, { "start": 2605.62, "end": 2608.06, "text": " So we assume that we can keep that in memory." }, { "start": 2608.06, "end": 2615.02, "text": " But here we want the final result to be shorted according to C, which imposes the additional" }, { "start": 2615.02, "end": 2621.02, "text": " constraint that it might be that the full matrix never fits into memory." }, { "start": 2621.02, "end": 2623.8199999999997, "text": " So how are we going to calculate all of that?" }, { "start": 2623.8199999999997, "end": 2626.54, "text": " We can't do the same trick anymore." }, { "start": 2626.54, "end": 2633.38, "text": " Now this G short system apparently realizes itself when something is out of memory, and" }, { "start": 2633.38, "end": 2640.26, "text": " it can do a smart move around being out of memory using a loop, which basically means" }, { "start": 2640.26, "end": 2644.98, "text": " that it will compute entry by entry or block by block." }, { "start": 2644.98, "end": 2648.06, "text": " So these are the matrices we have to multiply." }, { "start": 2648.06, "end": 2653.38, "text": " And you can see that if I want to do multiply this by this, that's fine, I can do this on" }, { "start": 2653.38, "end": 2655.2200000000003, "text": " one machine." }, { "start": 2655.2200000000003, "end": 2657.1400000000003, "text": " And that will give me the block up here." }, { "start": 2657.1400000000003, "end": 2662.42, "text": " But if I want the block up here, I have to multiply this by this, which is across two" }, { "start": 2662.42, "end": 2665.1, "text": " different machines." }, { "start": 2665.1, "end": 2670.66, "text": " So what this system does is it's going into a while loop because it realizes there's not" }, { "start": 2670.66, "end": 2672.62, "text": " enough memory." }, { "start": 2672.62, "end": 2679.42, "text": " And it kind of sends around these different slices to the different parts, each time computing" }, { "start": 2679.42, "end": 2681.1800000000003, "text": " a little piece." }, { "start": 2681.1800000000003, "end": 2685.86, "text": " So here, first, we do this by this, this is fine." }, { "start": 2685.86, "end": 2693.6200000000003, "text": " But then we grab ourselves from the we we grab ourselves this one here, calculate the" }, { "start": 2693.6200000000003, "end": 2699.02, "text": " next little piece up here, and then we grab ourselves the number two, calculate the piece" }, { "start": 2699.02, "end": 2700.38, "text": " here." }, { "start": 2700.38, "end": 2705.7000000000003, "text": " And then so this is from zero, this is from two, the one we already had, and then we grab" }, { "start": 2705.7000000000003, "end": 2713.38, "text": " ourselves piece three, and multiply that until here, until we have this final slice that" }, { "start": 2713.38, "end": 2714.38, "text": " we want." }, { "start": 2714.38, "end": 2719.82, "text": " Okay, so this goes in a while loop in multiple rounds, the system gets knows itself when" }, { "start": 2719.82, "end": 2724.7000000000003, "text": " it has to do this, and when it can calculate the full thing at once because it fits into" }, { "start": 2724.7000000000003, "end": 2728.12, "text": " in memory." }, { "start": 2728.12, "end": 2732.26, "text": " It's even smarter than that, and that it can do these halo exchanges." }, { "start": 2732.26, "end": 2739.1, "text": " So if you have to do something like this, a convolution, now in a convolution, what you'll" }, { "start": 2739.1, "end": 2747.5, "text": " do if you think of a think of an image, and you want to do a convolution on it, but the" }, { "start": 2747.5, "end": 2750.1, "text": " image happens to be sharded." }, { "start": 2750.1, "end": 2755.18, "text": " Let's say the image is so large, it's sharded across nine different machines like this." }, { "start": 2755.18, "end": 2760.9, "text": " Now, if you want to do a convolution, that's pretty cool, you know, here, here, here, but" }, { "start": 2760.9, "end": 2767.08, "text": " here, all of a sudden, your convolution is across two different machines." }, { "start": 2767.08, "end": 2773.86, "text": " So this system, G shard will adapt automatically, and do these halo exchanges where it kind" }, { "start": 2773.86, "end": 2779.54, "text": " of sends around from this machine, it'll send something to this machine such that it can" }, { "start": 2779.54, "end": 2783.22, "text": " do the convolution in that step, and vice versa." }, { "start": 2783.22, "end": 2789.34, "text": " And then this can be padded accordingly, as you can see." }, { "start": 2789.34, "end": 2793.7799999999997, "text": " This is I think this is this is this was like super ugly to implement." }, { "start": 2793.78, "end": 2797.94, "text": " If you just imagine that for each of these operations, you have to think about, okay," }, { "start": 2797.94, "end": 2804.6600000000003, "text": " how can you express this with these MPI primitives like dynamic slice and collective permute," }, { "start": 2804.6600000000003, "end": 2806.2000000000003, "text": " and so on." }, { "start": 2806.2000000000003, "end": 2809.1000000000004, "text": " It's just an absolute nightmare." }, { "start": 2809.1000000000004, "end": 2814.5, "text": " And I'm very happy that other people have done this, and I will probably just get to" }, { "start": 2814.5, "end": 2816.28, "text": " use it." }, { "start": 2816.28, "end": 2821.0600000000004, "text": " So there is a lot more to this system than I've just explained, I just try to give you" }, { "start": 2821.06, "end": 2830.1, "text": " a flavor of what building a system like this means and how easy it is to use it like this." }, { "start": 2830.1, "end": 2835.94, "text": " In order to implement all of this mixture of experts things, you simply go from this," }, { "start": 2835.94, "end": 2844.54, "text": " which is one single machine implementation, how you would write it to this, which is now" }, { "start": 2844.54, "end": 2846.74, "text": " the same, it's almost the same code." }, { "start": 2846.74, "end": 2852.58, "text": " But this now you can run on however many machines, and if you compile it with the system, it" }, { "start": 2852.58, "end": 2857.8599999999997, "text": " will do what you expect it to do in this shorted way." }, { "start": 2857.8599999999997, "end": 2859.5, "text": " Completely crazy." }, { "start": 2859.5, "end": 2867.2799999999997, "text": " Okay, so they apply this to massively multilingual massive machine translation." }, { "start": 2867.2799999999997, "end": 2874.3599999999997, "text": " So two things, it's massively multilingual, and it's massive machine, which means, I guess" }, { "start": 2874.36, "end": 2877.6, "text": " a lot of machines." }, { "start": 2877.6, "end": 2880.3, "text": " And the reason here is twofold." }, { "start": 2880.3, "end": 2887.26, "text": " So what they say is, we have massively multilingual translation." }, { "start": 2887.26, "end": 2891.58, "text": " Why don't they just look at single machine translation?" }, { "start": 2891.58, "end": 2893.5, "text": " And it has a very specific reason." }, { "start": 2893.5, "end": 2898.38, "text": " Namely, if you have massively multilingual translation, which means that you have a lot" }, { "start": 2898.38, "end": 2904.58, "text": " of different languages, and you all have to translate them, ideally, to all the other" }, { "start": 2904.58, "end": 2908.46, "text": " languages or, you know, every language pair." }, { "start": 2908.46, "end": 2912.42, "text": " But in this case, they only look at all the languages to English." }, { "start": 2912.42, "end": 2919.46, "text": " I don't exactly know why, but I guess there must be some kind of reason." }, { "start": 2919.46, "end": 2930.5, "text": " If you do this, then you can make use of a thing where there are languages that you just" }, { "start": 2930.5, "end": 2932.42, "text": " don't have much data on." }, { "start": 2932.42, "end": 2936.7, "text": " Like I don't know, Basque or something like this." }, { "start": 2936.7, "end": 2940.9, "text": " There's not that many people speaking Basque or Swiss German." }, { "start": 2940.9, "end": 2945.44, "text": " There's not even a written form, a standard written form of Swiss German." }, { "start": 2945.44, "end": 2949.06, "text": " So you just don't have as many resources." }, { "start": 2949.06, "end": 2952.94, "text": " And for other languages, you have giant amounts of resources." }, { "start": 2952.94, "end": 2960.06, "text": " And what you can make use of is this phenomenon called positive language transfer, where it" }, { "start": 2960.06, "end": 2964.9, "text": " happens that, for example, Swiss German is very close to German." }, { "start": 2964.9, "end": 2971.2799999999997, "text": " Now, they can't understand us, which is a giant advantage for us, but still it shares" }, { "start": 2971.2799999999997, "end": 2974.66, "text": " a lot of similarities with German." }, { "start": 2974.66, "end": 2981.14, "text": " So if you learn a lot about German, you can sort of transfer learn to Swiss German pretty" }, { "start": 2981.14, "end": 2982.14, "text": " easily." }, { "start": 2982.14, "end": 2987.7799999999997, "text": " So if you have a system that does German and Swiss German at the same time, you can perform" }, { "start": 2987.7799999999997, "end": 2997.22, "text": " better on both languages because the Swiss German part of your model, the part of your" }, { "start": 2997.22, "end": 3002.7, "text": " model that does Swiss German, profits from the German inputs as well." }, { "start": 3002.7, "end": 3004.22, "text": " Now don't understand me wrong." }, { "start": 3004.22, "end": 3009.7, "text": " There is not an individual part of your model that for each language, it's all done at the" }, { "start": 3009.7, "end": 3011.4599999999996, "text": " same time." }, { "start": 3011.4599999999996, "end": 3015.3399999999997, "text": " But still you can imagine that, you know, some of these things will specialize in some" }, { "start": 3015.3399999999997, "end": 3016.64, "text": " of the languages." }, { "start": 3016.64, "end": 3021.98, "text": " But the hope is that if you have German and Swiss German in the same training set, that" }, { "start": 3021.98, "end": 3029.22, "text": " if the model realizes what a question construct is in German, it will be able to apply that" }, { "start": 3029.22, "end": 3032.3599999999997, "text": " also to Swiss German with some minor modification." }, { "start": 3032.36, "end": 3038.42, "text": " So there is a benefit of having these many languages, especially for the low resource" }, { "start": 3038.42, "end": 3039.42, "text": " languages." }, { "start": 3039.42, "end": 3040.42, "text": " Okay." }, { "start": 3040.42, "end": 3048.04, "text": " So as the number of languages, sorry, as the number of language pairs to be modeled within" }, { "start": 3048.04, "end": 3052.9, "text": " a single translation model increases, positive language transfer starts to deliver large" }, { "start": 3052.9, "end": 3056.6200000000003, "text": " gains for low resource languages." }, { "start": 3056.6200000000003, "end": 3060.98, "text": " Given the number of languages considered, which I believe is a hundred here, M4 has" }, { "start": 3060.98, "end": 3064.38, "text": " a clear advantage on improving the low resource task." }, { "start": 3064.38, "end": 3068.9, "text": " On the contrary, for high resource languages, the increased number of tasks limit per task" }, { "start": 3068.9, "end": 3075.18, "text": " capacity within the model, resulting in lower translation quality compared to a models," }, { "start": 3075.18, "end": 3079.76, "text": " to a models trained on a single language pair." }, { "start": 3079.76, "end": 3084.06, "text": " This capacity bottleneck for high resource languages can be relaxed by increasing the" }, { "start": 3084.06, "end": 3089.7, "text": " model size to massive scale in order to satisfy the need for additional capacity." }, { "start": 3089.7, "end": 3094.58, "text": " So basically they're saying, if we train all of these languages together, that will help" }, { "start": 3094.58, "end": 3098.5, "text": " a lot for these low resource languages, but it might hurt the high resource languages" }, { "start": 3098.5, "end": 3106.3799999999997, "text": " because now we would have enough data technically to train a French to English model on this" }, { "start": 3106.3799999999997, "end": 3107.3799999999997, "text": " giant model." }, { "start": 3107.3799999999997, "end": 3108.7799999999997, "text": " We could train that." }, { "start": 3108.7799999999997, "end": 3112.3799999999997, "text": " And now that we have all these other languages in there, it just hurts us because we don't" }, { "start": 3112.3799999999997, "end": 3113.98, "text": " have enough parameters." }, { "start": 3113.98, "end": 3116.96, "text": " And we can solve this, of course, by simply adding more parameters." }, { "start": 3116.96, "end": 3118.74, "text": " So that's the solution." }, { "start": 3118.74, "end": 3125.18, "text": " Add more parameters and you increase the capacity of the model and you still get the benefits" }, { "start": 3125.18, "end": 3128.54, "text": " of the positive language transfer." }, { "start": 3128.54, "end": 3134.2599999999998, "text": " So their investigations is going to be into how much can we scale this?" }, { "start": 3134.2599999999998, "end": 3141.3399999999997, "text": " And is there like a sweet spot where because if you, if you increase the parameters too" }, { "start": 3141.3399999999997, "end": 3146.08, "text": " much, you counteract this positive language transfer again." }, { "start": 3146.08, "end": 3151.46, "text": " So since, you know, since Swiss German and German can sort of benefit from each other." }, { "start": 3151.46, "end": 3157.9, "text": " However, if we have too many parameters, so, and then we end up having all of these experts" }, { "start": 3157.9, "end": 3162.9, "text": " right here and the tokens are always routed to these experts and it always happens that" }, { "start": 3162.9, "end": 3167.2999999999997, "text": " all the Swiss German tokens are always routed to this expert and all the German tokens are" }, { "start": 3167.2999999999997, "end": 3169.58, "text": " always routed to that expert." }, { "start": 3169.58, "end": 3172.02, "text": " There will be no sharing of weights." }, { "start": 3172.02, "end": 3177.94, "text": " There will be this positive language transfer will not happen because we have too much capacity." }, { "start": 3177.94, "end": 3183.32, "text": " So the goal is to find a sweet spot between positive language transfer and this capacity" }, { "start": 3183.32, "end": 3185.66, "text": " bottleneck." }, { "start": 3185.66, "end": 3195.14, "text": " They do use an in-house data set, which we don't have access to, but they say the training" }, { "start": 3195.14, "end": 3199.18, "text": " corpus mined from the web contains parallel documents for a hundred languages to and from" }, { "start": 3199.18, "end": 3202.66, "text": " English adding up to a total of 25 billion training examples." }, { "start": 3202.66, "end": 3209.46, "text": " However, they only use from 100 languages to English." }, { "start": 3209.46, "end": 3214.98, "text": " This result in approximately 13 billion training examples to be used for model training." }, { "start": 3214.98, "end": 3216.7799999999997, "text": " So that's a lot." }, { "start": 3216.7799999999997, "end": 3220.22, "text": " It's a lot of data, especially for translation." }, { "start": 3220.22, "end": 3224.62, "text": " It's kind of a noisy translation because it's mined from the web, but still it's a lot of" }, { "start": 3224.62, "end": 3226.3799999999997, "text": " data." }, { "start": 3226.3799999999997, "end": 3227.98, "text": " They have baselines." }, { "start": 3227.98, "end": 3234.34, "text": " So the baselines are first of all, in order to form our baselines, we trained separate" }, { "start": 3234.34, "end": 3238.34, "text": " bilingual neural machine translation models for each language pair." }, { "start": 3238.34, "end": 3243.9, "text": " So that means a single model for each language to English, depending on the available training" }, { "start": 3243.9, "end": 3247.58, "text": " data per language." }, { "start": 3247.58, "end": 3255.9, "text": " And then they also have a baseline where they try open AI style to build as deep as single" }, { "start": 3255.9, "end": 3257.82, "text": " transformer as possible." }, { "start": 3257.82, "end": 3264.94, "text": " And by that, they mean we also include a variant of a dense 96 layer transformer encoder decoder" }, { "start": 3264.94, "end": 3274.1600000000003, "text": " network trained with G pipe pipeline parallelism on the same data set as another baseline." }, { "start": 3274.1600000000003, "end": 3279.5800000000004, "text": " So the difference again here is that this 96 layer is a dense transformer, which means" }, { "start": 3279.5800000000004, "end": 3284.98, "text": " that all of the tokens go through the same computation and we don't shard the computation" }, { "start": 3284.98, "end": 3286.8, "text": " out to these experts, right?" }, { "start": 3286.8, "end": 3292.78, "text": " We do shard according to the batch, but all of them go through the same parameters." }, { "start": 3292.78, "end": 3298.78, "text": " And that means we can we can only scale up the number of layers and that severely limits" }, { "start": 3298.78, "end": 3304.54, "text": " the that severely limits the computational efficiency." }, { "start": 3304.54, "end": 3310.9, "text": " Even if we have, you know, your pipeline parallelism and so on that hurts." }, { "start": 3310.9, "end": 3319.6600000000003, "text": " They say training to convergence took over six weeks on 2000 TPU course." }, { "start": 3319.6600000000003, "end": 3323.02, "text": " That's crazy." }, { "start": 3323.02, "end": 3332.94, "text": " But I guess, yeah, you know, I was saying earlier that that I always thought we were happy." }, { "start": 3332.94, "end": 3337.42, "text": " I always thought we were happy in machine learning because kind of the hip science fields" }, { "start": 3337.42, "end": 3341.66, "text": " being biology, like genetics and machine learning." }, { "start": 3341.66, "end": 3346.02, "text": " I was thought like, oh, but these biology people, they always need like million dollar" }, { "start": 3346.02, "end": 3348.88, "text": " grants from government to run their experiments." }, { "start": 3348.88, "end": 3350.98, "text": " And we can just sit down with a laptop." }, { "start": 3350.98, "end": 3352.7400000000002, "text": " This time is over." }, { "start": 3352.7400000000002, "end": 3357.5, "text": " If you start a PhD now start applying for money to get TPUs." }, { "start": 3357.5, "end": 3358.5, "text": " Yeah." }, { "start": 3358.5, "end": 3359.5, "text": " Okay." }, { "start": 3359.5, "end": 3362.12, "text": " In any case, here you can see what this does." }, { "start": 3362.12, "end": 3365.2200000000003, "text": " So they compare a bunch of models right here." }, { "start": 3365.22, "end": 3371.06, "text": " So this T, this is this big dense transformer that's going to be one of our baselines and" }, { "start": 3371.06, "end": 3374.3399999999997, "text": " the other baseline here is going to be the zero axis." }, { "start": 3374.3399999999997, "end": 3381.3799999999997, "text": " The zero axis means this is the single model for that language pair." }, { "start": 3381.3799999999997, "end": 3390.1, "text": " So only so for each language, they trained one model only on data from that language." }, { "start": 3390.1, "end": 3396.7799999999997, "text": " And that's going to be the worst thing here because this multi language translation in" }, { "start": 3396.7799999999997, "end": 3400.02, "text": " one model will generally help you if you have enough parameters." }, { "start": 3400.02, "end": 3405.2599999999998, "text": " You can see all the models here have enough parameters such that the difference here," }, { "start": 3405.2599999999998, "end": 3413.08, "text": " this is difference in blue is positive including this baseline model right here." }, { "start": 3413.08, "end": 3418.54, "text": " So the baseline model, as you can see, has 2.3 billion parameters, even though it takes" }, { "start": 3418.54, "end": 3423, "text": " that much longer to train and that's, as we said, a function of the fact that it's dense" }, { "start": 3423, "end": 3427.62, "text": " and deep, so that hurts in training efficiency." }, { "start": 3427.62, "end": 3430.64, "text": " And then you have these mixture of expert models." }, { "start": 3430.64, "end": 3432.42, "text": " They always consider two things." }, { "start": 3432.42, "end": 3434.62, "text": " They consider different numbers of experts." }, { "start": 3434.62, "end": 3439.9, "text": " You can see it goes from 128 to 2048 experts." }, { "start": 3439.9, "end": 3447.2599999999998, "text": " And they consider a number, different number of layers from 12 layers to 36 layers, 36" }, { "start": 3447.26, "end": 3452.7400000000002, "text": " layers still being way smaller than the 96 layer transformer here." }, { "start": 3452.7400000000002, "end": 3455.34, "text": " And that's the reason why it trains faster." }, { "start": 3455.34, "end": 3460.6200000000003, "text": " So it doesn't train faster." }, { "start": 3460.6200000000003, "end": 3466.0600000000004, "text": " So the reason it trains faster is because it has less layers." }, { "start": 3466.0600000000004, "end": 3472.82, "text": " And then the reason it has more parameters is because it has a lot of these experts." }, { "start": 3472.82, "end": 3479.96, "text": " And the art here is to constrain how much these more experts hurt you." }, { "start": 3479.96, "end": 3484.5, "text": " So you know, you could run into the same problem where if you scale up the experts, in fact," }, { "start": 3484.5, "end": 3487.6600000000003, "text": " you do, it doesn't fit into memory anymore." }, { "start": 3487.6600000000003, "end": 3492.36, "text": " And it's going to hurt you a lot in training efficiency, kind of like if you increase the" }, { "start": 3492.36, "end": 3493.84, "text": " number of layers." }, { "start": 3493.84, "end": 3500.7000000000003, "text": " But the G shard system prevents that it lets you up the number of experts without incurring" }, { "start": 3500.7000000000003, "end": 3501.7000000000003, "text": " the cost." }, { "start": 3501.7, "end": 3505.8999999999996, "text": " That being said, it does not let you up the number of layers, you're going to incur the" }, { "start": 3505.8999999999996, "end": 3512.7, "text": " same cost if you up the number of layers as you have with the dense transformers." }, { "start": 3512.7, "end": 3513.98, "text": " So does this help?" }, { "start": 3513.98, "end": 3515.06, "text": " It helps a lot." }, { "start": 3515.06, "end": 3517.8999999999996, "text": " As you can see right here, there's a general trend upwards." }, { "start": 3517.8999999999996, "end": 3522.22, "text": " And what's the x axis, the x axis is low resource languages." }, { "start": 3522.22, "end": 3530.7799999999997, "text": " So you can see that as we as we go to lower and lower resource languages, this multi task" }, { "start": 3530.78, "end": 3537.34, "text": " training, this multilingual translation improves significantly over the baseline where we only" }, { "start": 3537.34, "end": 3540.6400000000003, "text": " train a system for that language specifically." }, { "start": 3540.6400000000003, "end": 3544.78, "text": " And these 10k examples, it's it's it's quite a bit, but it's not that much, especially" }, { "start": 3544.78, "end": 3548.1400000000003, "text": " since it's noisy data." }, { "start": 3548.1400000000003, "end": 3551.94, "text": " So this is specifically good for low resource languages." }, { "start": 3551.94, "end": 3558.28, "text": " But you can see also the high resource languages here benefit from the multilingual translation." }, { "start": 3558.28, "end": 3562.6200000000003, "text": " And that's a function of the fact that we have, you know, large enough models." }, { "start": 3562.6200000000003, "end": 3569.1400000000003, "text": " In fact, you can see the larger the models, the more the difference in blue is, and there's" }, { "start": 3569.1400000000003, "end": 3570.5, "text": " not really an end in sight." }, { "start": 3570.5, "end": 3574.42, "text": " And they also see it say that they haven't seen convergence in training." }, { "start": 3574.42, "end": 3578.3, "text": " So you can technically train this forever." }, { "start": 3578.3, "end": 3587.38, "text": " Yeah, you can also see that the the lowest mixture of experts right here is almost on" }, { "start": 3587.38, "end": 3593.46, "text": " par with their big dense transformer that took so much longer to train." }, { "start": 3593.46, "end": 3594.46, "text": " Right." }, { "start": 3594.46, "end": 3600.7400000000002, "text": " So this lowest model right here, I believe it took I don't want to go back, but it took" }, { "start": 3600.7400000000002, "end": 3608.1, "text": " it took hours or so or few hours to train, whereas this 96 layer dense transformer took" }, { "start": 3608.1, "end": 3612.5, "text": " these six weeks to train." }, { "start": 3612.5, "end": 3618.26, "text": " So has to be said, the number of TPUs is not to be neglected, but if you're Google, you" }, { "start": 3618.26, "end": 3622.1, "text": " know, you just have them laying around." }, { "start": 3622.1, "end": 3627.9, "text": " What's also interesting here, and you can start seeing this two things." }, { "start": 3627.9, "end": 3635.3, "text": " First of all, you can see that the difference between here in between the dense transformer" }, { "start": 3635.3, "end": 3642.98, "text": " and this baseline model is very low for high resource languages, but gets larger for low" }, { "start": 3642.98, "end": 3646.0800000000004, "text": " resource languages." }, { "start": 3646.0800000000004, "end": 3652.1000000000004, "text": " This is an indication that the dense transformer, it does more to share parameters between the" }, { "start": 3652.1000000000004, "end": 3656.5, "text": " languages because it shares parameters between all the things because all the tokens go through" }, { "start": 3656.5, "end": 3658.7000000000003, "text": " the same computation." }, { "start": 3658.7000000000003, "end": 3664.38, "text": " So it is going to be a bit better in low resource languages, but still the general trend upwards" }, { "start": 3664.38, "end": 3667.42, "text": " holds even for the mixture of experts." }, { "start": 3667.42, "end": 3674.6600000000003, "text": " The second thing is that you see there is a crossover here in these in these big in" }, { "start": 3674.6600000000003, "end": 3676.42, "text": " these biggest models." }, { "start": 3676.42, "end": 3677.7400000000002, "text": " And what are the big models?" }, { "start": 3677.7400000000002, "end": 3686.3, "text": " One, the blue one is the one with 2048 experts and the green one is the one with 500 experts." }, { "start": 3686.3, "end": 3689.7400000000002, "text": " They're both as deep models." }, { "start": 3689.74, "end": 3695.3799999999997, "text": " But all of a sudden, over here for the high resource languages, it's still true that if" }, { "start": 3695.3799999999997, "end": 3698.3399999999997, "text": " you up the number of parameters, you get a benefit." }, { "start": 3698.3399999999997, "end": 3701.56, "text": " So up the number of experts as well, you get a benefit." }, { "start": 3701.56, "end": 3707.3799999999997, "text": " But over here for the low resource languages, it's it you see, it actually hurts you to" }, { "start": 3707.3799999999997, "end": 3709.02, "text": " up the number of experts." }, { "start": 3709.02, "end": 3712.7799999999997, "text": " And that's the phenomenon exactly we talked about before." }, { "start": 3712.7799999999997, "end": 3718.12, "text": " If you have too many of these experts, and you do a hard routing, that means all the" }, { "start": 3718.12, "end": 3720.38, "text": " tokens go a different way." }, { "start": 3720.38, "end": 3725.9, "text": " And that means you don't get any sharing benefit from the multilingual translation." }, { "start": 3725.9, "end": 3727.66, "text": " And they investigate a lot." }, { "start": 3727.66, "end": 3732.98, "text": " And they basically claim that their sweet spot of expert in their particular task appears" }, { "start": 3732.98, "end": 3742.38, "text": " to be somewhere in between these 2000 and this 500 expert number, where you can see" }, { "start": 3742.38, "end": 3746.94, "text": " it doesn't always help you to scale up the model." }, { "start": 3746.94, "end": 3753.16, "text": " So I have to say maybe the transformers, maybe they need a ResNet moment." }, { "start": 3753.16, "end": 3758.4, "text": " So I believe in computer vision, it was sort of the same problem that we try to build deeper" }, { "start": 3758.4, "end": 3761.98, "text": " models and why like, okay, this, this is more width." }, { "start": 3761.98, "end": 3769.28, "text": " But yeah, I think there might be some breakthrough on the horizon where someone just figures" }, { "start": 3769.28, "end": 3774.6, "text": " out how to train these giant models, even more giant transformer models with deeper" }, { "start": 3774.6, "end": 3776.1, "text": " layers." }, { "start": 3776.1, "end": 3780.66, "text": " And then there's a new era of transformers." }, { "start": 3780.66, "end": 3782.06, "text": " However, this is not that effect." }, { "start": 3782.06, "end": 3785.14, "text": " I'm sorry, I said this at the wrong place." }, { "start": 3785.14, "end": 3786.14, "text": " This is not that effect." }, { "start": 3786.14, "end": 3794.2, "text": " This is to show that in this case, we do benefit for the high resource languages because we" }, { "start": 3794.2, "end": 3795.64, "text": " increase capacity." }, { "start": 3795.64, "end": 3800.8399999999997, "text": " But for the low resource languages, we suffer if we up the number of experts too much, because" }, { "start": 3800.84, "end": 3806.38, "text": " they don't share any parameters anymore between the languages or between the different parts." }, { "start": 3806.38, "end": 3812.58, "text": " Like it's not a necessity that the different languages are going to be routed to different" }, { "start": 3812.58, "end": 3814.46, "text": " experts." }, { "start": 3814.46, "end": 3816.42, "text": " But it's probably going to happen, right?" }, { "start": 3816.42, "end": 3821.02, "text": " There's no hard coded thing that says if it's this language, it needs to go there." }, { "start": 3821.02, "end": 3825.7200000000003, "text": " It just probably is going to happen this way because the different languages are going" }, { "start": 3825.72, "end": 3830.6, "text": " to be needed to be treated differently and therefore the system learns to route first" }, { "start": 3830.6, "end": 3834.3599999999997, "text": " and foremost, those two different experts." }, { "start": 3834.3599999999997, "end": 3841.12, "text": " Here you can see the model sizes, including this 60 layer models model with 2000 experts" }, { "start": 3841.12, "end": 3843.48, "text": " that they didn't manage to train." }, { "start": 3843.48, "end": 3848.02, "text": " They said they had numerical instability, but that had one trillion parameters." }, { "start": 3848.02, "end": 3850.52, "text": " And I'm pretty sure they're, they're cool." }, { "start": 3850.52, "end": 3853.2, "text": " They must be quite mad about this, right?" }, { "start": 3853.2, "end": 3858.24, "text": " Like you have the trillion parameters, even though it's not that much bigger than the" }, { "start": 3858.24, "end": 3863.2, "text": " 600 billion, that the trillion, it would be cool to write a paper like a trillion parameter" }, { "start": 3863.2, "end": 3865.3999999999996, "text": " model." }, { "start": 3865.3999999999996, "end": 3871.08, "text": " But for now they are at the 600 billion mark and they simply want to tell you that they" }, { "start": 3871.08, "end": 3876.4199999999996, "text": " have actually compiled a model that's that big, just didn't manage to train it." }, { "start": 3876.4199999999996, "end": 3877.6, "text": " And yeah, that's here." }, { "start": 3877.6, "end": 3882.48, "text": " Here is where I wanted to say that maybe we're waiting for the ResNet moment where all of" }, { "start": 3882.48, "end": 3888.84, "text": " a sudden someone figures something out that makes the training of basically infinitely" }, { "start": 3888.84, "end": 3891.16, "text": " deep transformers possible." }, { "start": 3891.16, "end": 3899.72, "text": " Like we made the training for almost infinitely deep CNNs possible with ResNet." }, { "start": 3899.72, "end": 3910.16, "text": " Okay, so they conclude this and so they, that's the investigation of what the number of experts" }, { "start": 3910.16, "end": 3911.64, "text": " and so on gives you." }, { "start": 3911.64, "end": 3918.06, "text": " And here is a bit of a different investigation where they more care about training efficiency." }, { "start": 3918.06, "end": 3926.3199999999997, "text": " So they ask themselves, how many billion tokens of input do we need to reach a given cross" }, { "start": 3926.3199999999997, "end": 3927.3199999999997, "text": " entropy?" }, { "start": 3927.3199999999997, "end": 3933.08, "text": " So here, the more tokens you need, the lower your efficiency is, right?" }, { "start": 3933.08, "end": 3939.16, "text": " You can see that the general trend is the following." }, { "start": 3939.16, "end": 3945.7599999999998, "text": " If you up the number of layers, you get more efficient, you can see and just look at this" }, { "start": 3945.7599999999998, "end": 3951.24, "text": " column for now, this point seven column, you can see it already pretty clearly." }, { "start": 3951.24, "end": 3958.22, "text": " So here you go from 12 layers to 36, you gain efficiency, here you gain here you gain pretty" }, { "start": 3958.22, "end": 3959.22, "text": " predictable." }, { "start": 3959.22, "end": 3964.98, "text": " If you up the number of layers, you need to see fewer tokens to get to the same cross" }, { "start": 3964.98, "end": 3971.8, "text": " entropy. And in fact, you can get to a lower cross entropy altogether at the end." }, { "start": 3971.8, "end": 3976.12, "text": " We've known this for language models already." }, { "start": 3976.12, "end": 3981.36, "text": " The other effect is of course, what happens if we go not deeper, but wider, if we increase" }, { "start": 3981.36, "end": 3986.14, "text": " these number of experts, if we increase this sparse computation." }, { "start": 3986.14, "end": 3990.62, "text": " So here you can see, let's just look at the 12 layers for now." }, { "start": 3990.62, "end": 3993.86, "text": " Let's look at all the rows where there's 12 layers." }, { "start": 3993.86, "end": 4002.1200000000003, "text": " So here you get a significant advantage by upping the number of experts from 100 to 500." }, { "start": 4002.1200000000003, "end": 4009.1800000000003, "text": " But then you hurt upping the number of experts to 2000, right?" }, { "start": 4009.1800000000003, "end": 4016.4, "text": " So that's that's sort of your you're hurting efficiency by upping the number of experts" }, { "start": 4016.4, "end": 4017.48, "text": " too much." }, { "start": 4017.48, "end": 4022.84, "text": " And the same if we look at the 36 layer, so you gain massive efficiency by upping the" }, { "start": 4022.84, "end": 4028.6400000000003, "text": " number of experts, but you lose that a fish part of that efficiency again, by increasing" }, { "start": 4028.6400000000003, "end": 4030.6800000000003, "text": " it even more." }, { "start": 4030.6800000000003, "end": 4037.84, "text": " Now we saw that the this model is still the best model, but it's not as efficient as that" }, { "start": 4037.84, "end": 4038.84, "text": " model." }, { "start": 4038.84, "end": 4043.6000000000004, "text": " And that gives you another indication that there is sort of a sweet spot between these" }, { "start": 4043.6000000000004, "end": 4050.48, "text": " two things between the positive transfer and the bottleneck capacity that appears to be" }, { "start": 4050.48, "end": 4055.36, "text": " somewhere in between right here." }, { "start": 4055.36, "end": 4057.48, "text": " So that's pretty interesting." }, { "start": 4057.48, "end": 4062, "text": " Because we know about depth that you can basically up and up and up and get more efficient, but" }, { "start": 4062, "end": 4065.32, "text": " with not that much." }, { "start": 4065.32, "end": 4072.6, "text": " Yeah, the largest model can be trained in under four days to achieving the best quality." }, { "start": 4072.6, "end": 4081.38, "text": " Yes, yes, yes, but this is just a yeah." }, { "start": 4081.38, "end": 4091.74, "text": " So here, oh, you can see the batch size in in tokens is quite, quite a bit." }, { "start": 4091.74, "end": 4097.5, "text": " So yeah, if you have a 1000, if you have a context window of 1000, that means the batch" }, { "start": 4097.5, "end": 4101.28, "text": " size here was about 4000." }, { "start": 4101.28, "end": 4104.12, "text": " So as as expected." }, { "start": 4104.12, "end": 4110.36, "text": " Yeah, this is just easy peasy 22 TPU core years." }, { "start": 4110.36, "end": 4115.2, "text": " I've seen someone on Twitter saying this, this is the new measure for computer." }, { "start": 4115.2, "end": 4117.04, "text": " It's no longer like flops." }, { "start": 4117.04, "end": 4120.759999999999, "text": " It's TPU core years." }, { "start": 4120.759999999999, "end": 4123, "text": " Just mad, mad." }, { "start": 4123, "end": 4125.5, "text": " And yeah." }, { "start": 4125.5, "end": 4128.5199999999995, "text": " So 42 days to train this thing right here." }, { "start": 4128.52, "end": 4131.72, "text": " Crazy, crazy, crazy." }, { "start": 4131.72, "end": 4133.1, "text": " All right." }, { "start": 4133.1, "end": 4138.42, "text": " They also have a number of investigations in other parts of efficiency, like per device" }, { "start": 4138.42, "end": 4140.820000000001, "text": " memory consumption." }, { "start": 4140.820000000001, "end": 4149.56, "text": " You can see here that as you up the as you up the number of experts, you can see here," }, { "start": 4149.56, "end": 4155.64, "text": " here, here, your weights don't go up because as you up the number of experts, you can just" }, { "start": 4155.64, "end": 4161.72, "text": " up the number of machines and the per machine weight usage will be the same, right?" }, { "start": 4161.72, "end": 4168.9800000000005, "text": " Because the experts are independent of each other, each one has their own weight matrix." }, { "start": 4168.9800000000005, "end": 4173.88, "text": " So you can just add machines and you keep your weight requirements the same." }, { "start": 4173.88, "end": 4179.5, "text": " However, if you go deeper, then your weights increase because you're now deeper, you have" }, { "start": 4179.5, "end": 4181.14, "text": " more layers." }, { "start": 4181.14, "end": 4187.76, "text": " You have your so also your transformer weights will be higher and so on." }, { "start": 4187.76, "end": 4190.360000000001, "text": " So you go deeper right here." }, { "start": 4190.360000000001, "end": 4196.9800000000005, "text": " You see 3660 layers, your memory consumption increases for the weight." }, { "start": 4196.9800000000005, "end": 4201.820000000001, "text": " And also, this is the other big part in transformers, right?" }, { "start": 4201.820000000001, "end": 4207.400000000001, "text": " The activations that you have to save, because as we said, if you have a transformer and" }, { "start": 4207.4, "end": 4213.679999999999, "text": " I have layer, layer, layer, layer, I basically have to keep around each of these signals" }, { "start": 4213.679999999999, "end": 4217.16, "text": " in order to do back propagation." }, { "start": 4217.16, "end": 4222.839999999999, "text": " And that's why also the activation here increases as I go deeper." }, { "start": 4222.839999999999, "end": 4226.679999999999, "text": " Now you can see percentually, it decreases again here." }, { "start": 4226.679999999999, "end": 4228.4, "text": " So what's happening?" }, { "start": 4228.4, "end": 4231.759999999999, "text": " Technically, you don't have to keep these things around." }, { "start": 4231.759999999999, "end": 4236.62, "text": " You can also once the signal comes back, you can recompute them from the beginning or from" }, { "start": 4236.62, "end": 4238.04, "text": " an intermediate point." }, { "start": 4238.04, "end": 4243.68, "text": " Now this increases computation, but saves the need to store the activations." }, { "start": 4243.68, "end": 4252.28, "text": " And apparently G shard, yet another thing it does is it will recompute as necessary" }, { "start": 4252.28, "end": 4257.62, "text": " the activations if it realizes that you don't have enough memory to store them." }, { "start": 4257.62, "end": 4262.24, "text": " So all of this is pretty crazy, honestly." }, { "start": 4262.24, "end": 4270.8, "text": " And they look at where the different computations go." }, { "start": 4270.8, "end": 4274.5199999999995, "text": " And I don't want to go into this." }, { "start": 4274.5199999999995, "end": 4280.76, "text": " And they have these micro benchmarks where they really show that the increase in complexity" }, { "start": 4280.76, "end": 4288.92, "text": " is really according to square root of n, because that's how long it takes to distribute along" }, { "start": 4288.92, "end": 4292.68, "text": " these actors, sorry, along these experts." }, { "start": 4292.68, "end": 4295.04, "text": " There's a lot to this paper." }, { "start": 4295.04, "end": 4297.6, "text": " And there's no time to go through all of it." }, { "start": 4297.6, "end": 4299.8, "text": " I think this video is already way too long." }, { "start": 4299.8, "end": 4305.04, "text": " I hope I have given you an impression of what's possible with this system." }, { "start": 4305.04, "end": 4309.78, "text": " And as I said, I'm excited what people can come up with." }, { "start": 4309.78, "end": 4315.28, "text": " Just to say that in the appendix here, they detail that they have done this for all the" }, { "start": 4315.28, "end": 4317.04, "text": " operations in XLA." }, { "start": 4317.04, "end": 4322.32, "text": " So for example, convolution, this is so ugly, how you have to implement the convolution" }, { "start": 4322.32, "end": 4327.76, "text": " because you have to padding must be correct across these expert across the the sharded" }, { "start": 4327.76, "end": 4328.76, "text": " machine." }, { "start": 4328.76, "end": 4330.16, "text": " So there are no experts anymore." }, { "start": 4330.16, "end": 4333.4, "text": " This is just G shard, the padding has to be correct." }, { "start": 4333.4, "end": 4335.84, "text": " The strides have to be correct." }, { "start": 4335.84, "end": 4340.2, "text": " Data needs to be exchanged according to the machines, the window size needs to be correct," }, { "start": 4340.2, "end": 4341.2, "text": " blah, blah, blah." }, { "start": 4341.2, "end": 4347.16, "text": " So just thank you for doing this and not having to do it myself." }, { "start": 4347.16, "end": 4354.08, "text": " Yeah, I'm excited as soon as as the codes out, if I get a hold of it, I'll you know," }, { "start": 4354.08, "end": 4357.04, "text": " link it or you'll find it once it's out." }, { "start": 4357.04, "end": 4360.08, "text": " If it's already out, I'm just too dumb to see it." }, { "start": 4360.08, "end": 4362.42, "text": " I enjoyed reading this." }, { "start": 4362.42, "end": 4364.4, "text": " It's different than a machine learning paper." }, { "start": 4364.4, "end": 4370.84, "text": " It kind of shows you what goes into engineering a system like this, and how easy it can be" }, { "start": 4370.84, "end": 4373.72, "text": " if it's engineered well to then apply it." }, { "start": 4373.72, "end": 4377.64, "text": " I think this is going to be extremely helpful to the community." }, { "start": 4377.64, "end": 4382.52, "text": " And with that said, 23 pages later, see you next time." }, { "start": 4382.52, "end": 4403.4800000000005, "text": " Bye bye." } ]
DYBmD88vpiA
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Object-Centric Learning with Slot Attention (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "google", "ethz", "vision", "objects", "slots", "attention mechanism", "gru", "lstm", "routing", "capsules", "permutation invariant", "encoder", "set", "detr", "embeddings", "transformer", "weight sharing", "disentanglement", "render", "tetris", "clevr", "cnn", "convolutional neural network", "attention" ]
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 Kipf and others of Google Brain, ETH Zurich and MPI. On a high level this paper recognizes scenes of objects from single pixels and it's best I show you a picture of what's going on. So you have scenes like this where there is some sort of an arrangement of objects and there are multiple tasks you can do here. Specifically they consider the task of unsupervised recognition of objects which they call object discovery and supervised classification of objects. The difficulty being that these are sets of objects so there is no ordering to the sets. They do this via a thing they call slot attention that basically is a permutation invariant attention mechanism over these objects in both the supervised and unsupervised domain and they do this in a fashion where they iteratively route the attention in order to make the different slots compete for attention over these objects. So that's the sort of high level. If you are in this field you probably know right now what's going on. If you're not we'll dive into it together so stay tuned. If you like content like this consider sharing it out, leaving a like or tell me what you think about it in the comments. 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 square, not sorry, this gray cube right here. There is a smaller green cube and then there is a yellow cylinder. Now in the task of object discovery what you're supposed to do is you're simply supposed to say that there is an object right here, there is an object about here and there is an object here. So basically you're supposed to point to the pixels where there are objects and you're supposed to segment the objects from each other. You can see right here that this model, we don't know how it works yet, but it separates the left cube here, the bottom cube here and the top right cylinder right here. In the task of set prediction you're supposed to say what objects there are. So you're supposed to say there is a gray cube right here, a green cube right here and there is a yellow cylinder right there. Actually you don't have to say where they are I guess. There are many different variants of this task but mainly you're supposed to classify them, meaning you have to say there is a gray cube there. I believe in this case it's with coordinates but you can do it without. The difficulty here of course being that these are sets so there is no natural order in it. So if you say there is a green cube and a yellow cylinder it's going to be the same as there is a yellow cylinder and a green cube. So you have to build an architecture that is somehow invariant with respect to the labels. We've seen a lot of the concepts in this video in this paper before. This video is sort of a kind of a mash together of different concepts of other places. So what you'll see is for example this property of the fact that here you see are the labels for these objects. This could be there is a green cube, there is a gray cube and you'll have to come up with an architecture that if here you predict that green cube you consider it correct even though the corresponding label isn't the one for the green cube. And we saw this for example in this DETR architecture by Facebook where they use a matching loss but we'll get into that. Okay so these are the tasks. The tasks are object discovery and set prediction. So how does this paper deal with this? They use this thing called a slot attention module. Now the slot attention module is in essence it's pretty simple. What it does is it has these different slots right here as you can see and it divides the input into features. So you can see there is a CNN encoder because we're working with pixels it's natural that we want to encode these into a CNN. This CNN will probably down sample the image a bit and divide subdivided into this grid right here. So you have a fairly coarse grid. The grid is actually not a bit finer than you see here. This is just for example but you'll have ultimately a number of features so each pixel right here is going to be a feature. Each feature will have not only this one channel as you see here but many many channels of information down here. So the CNN will encode each of these regions in the picture into a feature vector and then you have these slots. So what you'll want to do and 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. Three slots, four slots as in this case. 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 then 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 classify it right here because you can just take each slot and independently classify it. 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 that there's this thing called the Hungarian matching that basically what you're saying is you want to be as forthcoming as possible right so if you predict a gray cube somewhere and there is a gray cube somewhere here you want to match them you'll say okay I'm going to give you the benefit of the doubt and I'm going to do your model I'm going to assume with the gray cube you meant that gray cube right here and if there is the yellow rectangle and 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 oh 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 an a generator in GANs for example it takes a hidden representation as input now the hidden representation here is going to be these these slots and it's going to up sample it into an image if we train the whole if if we have a good slot assignment mechanism we can pretty easily train a decoder like this right with any method you want in this case I believe they use some yeah some sort of up sampling up convolution architecture right here and they use the L2 they minimize the reconstruction error between the end the output image and the input image so it's sort of like a variational 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 the same feature assigned to multiple slots so each slot takes in many features but the features should be this divided between the slots such that only one slot attends to a feature and by me saying attend you probably already know where this is going so if you have the features and you consider the slots right and we just look at a single feature for now what we'll do is we'll have an attention mechanism from the slots going into the features so if you don't know what an attention mechanism is I have this video called attention is all you need where I explained this but briefly the features they will emit something that's called a key which is a vector and then the slots will emit a query which are also vectors and the sir the the information is now routed by agreement of key and query in this case this thing this this feature right here would be routed to this slot now it would be routed to both slots but it wouldn't be routed as much to the bottom slot and we make sure that this happens by using a softmax assignment so if this is like 9 and this is 4 what we'll do is a softmax assignment such that after that so we have a proper distribution which would be something like after the softmax be something like 0.9 and 0.1 right here so you can see that the attention is fairly hard so this is basically it's a differentiable way to assign these things okay so an attention mechanism fulfills the property that we want to basically assign features to the slots in a way that the slots compete for the features as you can see right here if this slot here matches the feature the best it come it out competes the other slot because at the end this has to be normalized to one because of the softmax so this competition is the heart of the slot attention mechanism and this is this is how it works so this is the slot attention module as you can see so you'll take your inputs and they have lots of layer norms in here but disregard the the layer norms so what you'll do is you'll calculate the agreement between the inputs and the slots now you might wonder in a standard attention mechanism you'll have input signal coming from here which is like maybe these are the input signals and then you construct the keys and the queries for the next layer you construct all from that input signal right and also the values by the way you construct everything from that input signal but in this case will have many features and will only have a fixed amount of slots right here so where do these slots come from where do the the signal for the keys come from in the Facebook DETR paper we saw that these are learned embeddings however in this case right here these are not learned the slots are initialized randomly so at the beginning of each thing the slots are initialized randomly you can think of this as an attention mechanism where you have the attention module right here and then at the beginning you simply have randomly initialized positional embedding or randomly initialized slots and then the image is going to be encoded through a CNN right here giving you a bunch of these features and then you'll have cross attention between these features and the slots and that will give you the next layer right here okay all right so you want to calculate the routing between the inputs and the slots and then you want to perform a softmax over the slots which will give you this competitive nature between the slots so all the slots are going to compete for the 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 will have a weighted mean but it's basically such that you can have a different amount of slots and the kind of values will stay the same that's why you do the mean so you weight them up and the values are simply a function of the inputs this is like in a standard attention mechanism then what you'll do you can see that this is now called updates okay so you start with the slots randomly and then you use the slots to route the information you take the inputs and you use that information routing to calculate the updates now you put the updates through a GRU with the state being the previous slots and then you'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 you go again okay so you do this first of all you'll have the features and you'll just have random slots and then you do a bit of routing okay okay so now we have a bit of routing cool you update these slots to be the next set of slots and then you take the same features and route them again so you you route them again and this is supposed to be kind of this iterative procedure you might have seen this in capsule networks I've done a video on capsule networks where exactly this type of iterative routing you always have the same routing functions right these the functions for value and key and query are always the same but you do this iteratively many times in a row this is like a transformer with weight sharing it's exactly the same right so you have these slots you initialize them randomly you do your query times keys your soft max times the value right here and this the transformer even has this plus this MLP layer right here like this the transformer has that in there and then you simply do it again so up here you have the next transformer layer but instead of being its own layer you'll copy the so it's it's weight shared it's a transformer with weight sharing between the modules and the inputs they are also copied up here this these side inputs all right it's otherwise it's the it's the same thing except that these aren't produced by an encoder that is also a transformer they're actually produced by a CNN and the weights here are shared the only difference is that in between here they also have like this GRU this GRU thing but they do an ablation on it and it's actually not that important so you could might as well just leave it away bring it brings only very few benefits so this is how I want how I think of this model this is a multi layer a t layer transformer with weight sharing in for the individual layers where the inputs the input positional encoding are randomly initialized each time okay now they they really stress this random initialization because this differs from the DETR paper in that in the DETR paper these things here are learned and the DETR paper we have also this kind of object detection thing and it what will happen when you learn these is that for example this one right here might specialize in objects that are sort of on the top left of the image and this one might specialize in objects that are kind of long and in the middle and so on and this one might specialize to something else now I can't tell you what works better or 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 via the iterative routing via the weight sharing they will be sort of assigned correctly all right I hope you could follow this yeah if you 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 give me more of that and then in the next layer even more of that even more of that and you'll see in the in the investigations into what happens exactly this type of thing happening so if we skip ahead to the experiments where they show what happens through the iterations you can see this right here so the attention the attention maps of these slots you can see that in after the first step you can see that you know it's slot two right here is assigned kind of these both of these objects slot three is already pretty so the first step kind of learns to segment a little bit of the image but not you know too well slot four it also the attention map here is pretty pretty wonky but if you in the next step and this is kind of crucial basically the these slots they specialize there's a slot to realize as well I have a lot of these these blue pixels I'm gonna give me more of those right give me more of those so it gets all the blue pixel well slot four has a lot of these golden pixels says give me more of that of those golden stuff that's also regionally right next to that and since these two compete I'm pretty sure slot two would also ask for more of the golden pixels because it has a lot of golden pixels but it competes with slot four because of the softmax so all of the golden pixels are assigned to slot four and not slot two well all of the blue pixels that slot four surely asks for as well are assigned to slot two in the next iteration so I actually consider iteration one is for you take the randomly initialized slots and you kind of assign them stuff so this is mainly the this is now mainly the transformer layer learning to segment but then step two is where the magic really happens is where the slots they kind of realize what's assigned to them and they ask for more of it and through the competition you'll get this separation into objects right so the whole thing is trained end to end which basically means that these functions get really good at doing this kind of segmentation alright and then in subsequent iterations you can just see this effect multiplying even more and more right but I might even you might even be able to think that you might want to separate step one and the subsequent steps because step one is sort of seems fundamentally different from steps two three four and so on because step one is this kind of assignment process and then the other steps are refinement so if I were to take this model and make it better I would try to have a special like not way sharing 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 we 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 lot here gives me a picture with just the object that it is supposed to reconstruct now how do you know how to combine these pictures especially since they might be overlapping and so on so the way you do it is you actually output four channels so you output R G B and A so a being the alpha channel so each slot also has to decide where the object is that it reconstructs and so each so this this here might be okay everything here is alpha one and including the shadow maybe maybe there's a little shadow and everything else is alpha zero and then the alpha maps you combine also via a softmax to ensure that they sum up to one so you combine the pictures including their alpha maps but that means you can basically reconstruct from the slots where the where the objects are now you'll know you'll notice this is this thing here you'll notice that they often use for example here four different slots because even though the image has three different objects why is that because you need to reconstruct the entire image so you need at least one slot for the background and that's always what you can see right here so if you have the sorry the reconstruction you'll see that slot too with time with iterations it reconstructs this cube slot three reconstructs the 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 data sets so these kinds of data sets they come you know they they're produced by a generator and the generator specifically has these these objects right here and it sort of in it arranges them in an independent fashion the background is really clean right the objects themselves are really clean and geometric and so on and they're they're kind of arranged in a random fashion and then there's a render of that so this is like super super duper clean data set and I guess that has a lot to do with why these methods work so well because they can just assume okay an object is generally you know spatially something some geometric shape that I know it's close together it's pretty independent from its surrounding and it's trained with objects that are almost zero correlated like there is zero correlation between the objects in the training data set so I wouldn't yet apply this much to to real-world problems but is an interesting thought right here so that's the sort of idea behind the paper I hope you got that they do a lot of experiments and here is a bit where my quarrels start so they say that they compare for example with the with these in the unsupervised object discovery experiments they have this data set called clever and this data set has these images with sort of I believe clever six has all up to six different objects now this is already one of the things this is not a specifically quarrel with this model but if your data set has six things they all they give like they give seven slots because they know that the data set has at most six things which means they can always cover all the things now it works when there's less objects but I think the knowledge of how many objects there's gonna be is also a big part of why these models work and why maybe it's not entirely ready yet for the real world but anyway they compare to these two baselines they're called iodine which also employs kind of a recurrent architecture but not with an attention mechanism and Monet and they say yada yada yada this replaces lot of them no that's not it for the Monet iodine DSP and baselines we compare with the published numbers as we use the same experimental setup so they say they use the same experimental setup and that's why they don't 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 you know it's a lot to to run these things however here I'm a bit skeptical first yes because it is it is Google so they do have a lot of resources available to technically run these things I've seen at least Monet has an implementation by the author or I've seen one of them the other one also there is an implementation and there's eight authors on this particular paper so I yeah I this would be okay they say as we use the same experimental setup so 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 moon using the atom optimizer with a learning rate and 60 so on they use a single GPU we further make use of learning rate warm-up to prevent early saturation of the attention mechanism and an exponential decay decay schedule in the learning rate which we found to reduce variance so I've checked these other models and none of them talks about learning rate warm-up and nowhere in their code is there a learning rate warm-up now you might you might argue okay this is specific to this model it might need this but if you look at the results right here for example you see that they don't outperform these other models by too much so you can see right here this is on par this here outperforms this one a little bit but then also the star here means that they have left out one of the denotes that one outlier was excluded from evaluation I guess which is valid if it's a super outlier but in this case I would categorize this model as a different way of doing doing things and not necessarily outperforming the others so this also if you look at the ablations the differences here are miniscule and in these ablations that they show every single thing they do like gives them a little bit of a boost and you just make it kind of across the line to reach state-of-the-art I'd rather have research move in a direction where we just show cool ideas and that they work and that's what this paper does to to be fair what I do have more of a problem with a little bit is this here on clever six we can use a batch size of up to 64 on a single V 100 GPU as opposed to four in this iodine baseline right compared to ion and our model is significantly more efficient in terms of both memory consumption and runtime which is you know something I believe but this characterization that they use a batch size of four and here in this paper they can use a size up to 64 on a single V 100 GPU I've read the iodine paper and the iodine paper says yes they do use a batch size of four on one GPU so they also use one GPU but they say their GPU has a RAM of 12 gigabytes and 12 gigabyte RAM GPUs that points to something like TI either I guess a 1080 or a 20 2080 or something like this this is not a V 100 the V 100 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 V 100 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 I don't know it seems sort of overstating what you can do now maybe I'm wrong maybe they have actually tested this other model and concluded also on their GPUs it can only run to a batch size of in a bat as a batch size of four but I highly doubt it because in their here the paper is cited and in their paper they explicitly named that they use for a batch size of four for their 12 gigabyte GPUs so yeah in this that that just kind of pulls through so there's the there's the miniscule 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 wordsmithy a bit which gives a bit of a bitter taste to what I think is actually a very very cool method because how why is this method so cool because for example these slots here they are trained to also absorb the background right so you can technically at inference time increase the number of slots even though you've trained with just with a few slots right you can you can increase the number of slots and the model can just handle it and they show it right here in these results here you can this data set has six objects and this data set has ten objects now the model has only been trained ever on six objects and they can just up the number of slots at inference time and it'll work also very well also they can now up the number of iterations since these are all weight shared these iterations right we've looked at it there's there's weight sharing between the iterations there is nothing stopping you from just piling on here because it's weight shared you don't need any more weights you can just refine this iteration and since the iteration themselves are refining these attention masks anyway you might as well at inference time refine them some more they have an ablation where they show that technically like three two or three iterations at training time gives them the best result I guess just because of gradient propagation because more layers means you have to propagate the gradient back more but at inference time you can just up these iterations and as you can see right here you get better and better so this these results are are pretty cool and they respect the property that sets should be permutation invariant and and so on this routing view of the transformer is pretty cool even though it's you can look at it as a transformer with weight sharing or an iterative routing protocol like in capsules so all of this I I find to be very very cool idea and I think that's how we should look at this this paper so before I am too critical of this paper I want to say that I really like the idea and the algorithm here the implementation yeah so that was the paper at last I actually want to look at the broader impact statement just because I've I've complained about brought the need for broader impact statements so I just want to kind of go just read them and just like look how how the different companies 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 says the slot detention module allows to learn object centric representation from perceptual input okay as such it is a general module that can be used in a wide range of domains and applications in our paper we only consider artificially generated data set under well controlled settings where slots are expected to specialize to objects however the specializations of our model is implicit and fully driven by the downstream task we remark that as a concrete measure to assess whether the module is specialized in unwanted ways one can visualize the attention masks to understand how the input features are distributed across the slots while more work is required to properly address the usefulness of the attention coefficients in explaining the overall predictions of the network especially if the input features are not human interpretable we argued that they may serve as a step towards more transparent and interpretable predictions this is a I mean it's a fine statement but it's not a broader impact statement right if you followed a bit what the broader impact statement is supposed to be this is not one okay the closest this comes to a broader impact statement is said as such it is a general model that can be used in a wide range of domains and applications and maybe a little bit that you can visualize the attention masks to understand how the input features are distributed but the broader impact statement is supposed to give you a preview of how this might affect society at large while this here just kind of lists properties of the model for the research community and sort of for this for the application of this model as as you know the introspection of the model itself this says nothing about society as such so maybe you know maybe that's I think that the smarter people will turn the broader impact statement into more of an introduction section because that's something you usually put in a conclusion or in an introduction where you say look here are some things our model can do and this is what it might be useful for and this is how you could introspect it and so on and since the broader impact statement especially at NURIPS 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 without what people are gonna start to do is simply put more of their paper into the broader impact section kind of cloaked in the veneer of a broader impact statement but I this is this is clearly not what what the broader impact statement was originally supposed to be now I don't know if this is good or bad I just think these authors are you know they're doing I think the a good thing here by simply telling us actually something useful about the model but that's just my opinion I do thank you for being with me here I know this was a bit ranty flip-flopping back and forth between the different things we haven't looked at set prediction at all we've only looked at these kind of masks but I invite you to go through the paper yourself and check it out it's pretty cool and they do describe a lot of things in pretty detail the appendix is very long and has very many ablations and this is something I do appreciate and with that bye bye and see you next time
[ { "start": 0, "end": 4.44, "text": " Hi there! Today we'll look at object-centric learning with slot attention" }, { "start": 4.44, "end": 9.36, "text": " by Francesco Locotello, Thomas Kipf and others of Google Brain, ETH Zurich and" }, { "start": 9.36, "end": 16.12, "text": " MPI. On a high level this paper recognizes scenes of objects from single" }, { "start": 16.12, "end": 20.76, "text": " pixels and it's best I show you a picture of what's going on. So you have" }, { "start": 20.76, "end": 25.560000000000002, "text": " scenes like this where there is some sort of an arrangement of objects and" }, { "start": 25.560000000000002, "end": 29.6, "text": " there are multiple tasks you can do here. Specifically they consider the task of" }, { "start": 29.6, "end": 34.24, "text": " unsupervised recognition of objects which they call object discovery and" }, { "start": 34.24, "end": 38.96, "text": " supervised classification of objects. The difficulty being that these are sets of" }, { "start": 38.96, "end": 45.32, "text": " objects so there is no ordering to the sets. They do this via a thing they call" }, { "start": 45.32, "end": 51.84, "text": " slot attention that basically is a permutation invariant attention mechanism" }, { "start": 51.84, "end": 56.8, "text": " over these objects in both the supervised and unsupervised domain and" }, { "start": 56.8, "end": 62.4, "text": " they do this in a fashion where they iteratively route the attention in order" }, { "start": 62.4, "end": 68.72, "text": " to make the different slots compete for attention over these objects. So that's" }, { "start": 68.72, "end": 73.52, "text": " the sort of high level. If you are in this field you probably know right now" }, { "start": 73.52, "end": 80.34, "text": " what's going on. If you're not we'll dive into it together so stay tuned. If you" }, { "start": 80.34, "end": 85.12, "text": " like content like this consider sharing it out, leaving a like or tell me what" }, { "start": 85.12, "end": 89.64, "text": " you think about it in the comments. I appreciate any suggestion for making" }, { "start": 89.64, "end": 94.96000000000001, "text": " these videos better so people can learn more from it." }, { "start": 94.96000000000001, "end": 100.28, "text": " Alright so the problem I've already described the problem a little bit but" }, { "start": 100.28, "end": 104.92, "text": " let's go a bit deeper here. You have images like this and the images we're" }, { "start": 104.92, "end": 109.4, "text": " considering are going to be images that have some sort of arrangement of objects" }, { "start": 109.4, "end": 113.64, "text": " or what we humans would call objects. In this case you can see there is this gray" }, { "start": 113.64, "end": 120.2, "text": " square, not sorry, this gray cube right here. There is a smaller green cube and" }, { "start": 120.2, "end": 127.8, "text": " then there is a yellow cylinder. Now in the task of object discovery what you're" }, { "start": 127.8, "end": 132.76, "text": " supposed to do is you're simply supposed to say that there is an object right" }, { "start": 132.76, "end": 140.4, "text": " here, there is an object about here and there is an object here. So basically" }, { "start": 140.4, "end": 145.68, "text": " you're supposed to point to the pixels where there are objects and you're" }, { "start": 145.68, "end": 150.08, "text": " supposed to segment the objects from each other. You can see right here that" }, { "start": 150.08, "end": 156.32, "text": " this model, we don't know how it works yet, but it separates the left cube here," }, { "start": 156.32, "end": 163.92000000000002, "text": " the bottom cube here and the top right cylinder right here. In the task of set" }, { "start": 163.92, "end": 170.76, "text": " prediction you're supposed to say what objects there are. So you're supposed to" }, { "start": 170.76, "end": 176.11999999999998, "text": " say there is a gray cube right here, a green cube right here and there is a" }, { "start": 176.11999999999998, "end": 181.67999999999998, "text": " yellow cylinder right there. Actually you don't have to say where they are I guess." }, { "start": 181.67999999999998, "end": 186.79999999999998, "text": " There are many different variants of this task but mainly you're supposed to" }, { "start": 186.79999999999998, "end": 193.44, "text": " classify them, meaning you have to say there is a gray cube there. I believe in" }, { "start": 193.44, "end": 197.88, "text": " this case it's with coordinates but you can do it without. The difficulty here of" }, { "start": 197.88, "end": 202.88, "text": " course being that these are sets so there is no natural order in it. So if" }, { "start": 202.88, "end": 207.07999999999998, "text": " you say there is a green cube and a yellow cylinder it's going to be the" }, { "start": 207.07999999999998, "end": 214.16, "text": " same as there is a yellow cylinder and a green cube. So you have to build an" }, { "start": 214.16, "end": 220.32, "text": " architecture that is somehow invariant with respect to the labels. We've" }, { "start": 220.32, "end": 224.68, "text": " seen a lot of the concepts in this video in this paper before. This video is sort" }, { "start": 224.68, "end": 230.72, "text": " of a kind of a mash together of different concepts of other places. So" }, { "start": 230.72, "end": 236.6, "text": " what you'll see is for example this property of the fact that here you see" }, { "start": 236.6, "end": 241.72, "text": " are the labels for these objects. This could be there is a green cube, there is" }, { "start": 241.72, "end": 247.76, "text": " a gray cube and you'll have to come up with an architecture that if here you" }, { "start": 247.76, "end": 253, "text": " predict that green cube you consider it correct even though the corresponding" }, { "start": 253, "end": 258.44, "text": " label isn't the one for the green cube. And we saw this for example in this DETR" }, { "start": 258.44, "end": 262.71999999999997, "text": " architecture by Facebook where they use a matching loss but we'll get into that." }, { "start": 262.71999999999997, "end": 268, "text": " Okay so these are the tasks. The tasks are object discovery and set prediction." }, { "start": 268, "end": 274.71999999999997, "text": " So how does this paper deal with this? They use this thing called a slot" }, { "start": 274.72, "end": 281.24, "text": " attention module. Now the slot attention module is in essence it's pretty simple." }, { "start": 281.24, "end": 288.56, "text": " What it does is it has these different slots right here as you can see and it" }, { "start": 288.56, "end": 294.24, "text": " divides the input into features. So you can see there is a CNN encoder because" }, { "start": 294.24, "end": 298.6, "text": " we're working with pixels it's natural that we want to encode these into a CNN." }, { "start": 298.6, "end": 305.92, "text": " This CNN will probably down sample the image a bit and divide subdivided into" }, { "start": 305.92, "end": 310.24, "text": " this grid right here. So you have a fairly coarse grid. The grid is actually" }, { "start": 310.24, "end": 316.28000000000003, "text": " not a bit finer than you see here. This is just for example but you'll have" }, { "start": 316.28000000000003, "end": 321.08000000000004, "text": " ultimately a number of features so each pixel right here is going to be a" }, { "start": 321.08000000000004, "end": 326.04, "text": " feature. Each feature will have not only this one channel as you see here but" }, { "start": 326.04, "end": 331.96000000000004, "text": " many many channels of information down here. So the CNN will encode each of" }, { "start": 331.96000000000004, "end": 338, "text": " these regions in the picture into a feature vector and then you have these" }, { "start": 338, "end": 343.08000000000004, "text": " slots. So what you'll want to do and we maybe look at this so you'll have the" }, { "start": 343.08000000000004, "end": 350.6, "text": " features right here. These are your features and you'll have the slots and" }, { "start": 350.6, "end": 357.36, "text": " the slots let's say there are fewer slots than features. Three slots," }, { "start": 357.36, "end": 365.28000000000003, "text": " four slots as in this case. What you'll want to do is you'll want to" }, { "start": 365.28000000000003, "end": 372, "text": " assign the features to the slots. So you maybe say okay this feature right here" }, { "start": 372, "end": 378.32000000000005, "text": " and this feature right here they go to this slot and then these two features go" }, { "start": 378.32, "end": 382.88, "text": " to this slot and then these two go to this and that feature goes to that and" }, { "start": 382.88, "end": 387.4, "text": " that's equivalent to basically subdividing the picture into these" }, { "start": 387.4, "end": 392.24, "text": " slots. Ultimately your goal is going to be to say that these features right here" }, { "start": 392.24, "end": 398.6, "text": " these pixels right here are going maybe into that slot and then these ones" }, { "start": 398.6, "end": 404.24, "text": " right here are going into that slot and these ones here going into that slot and" }, { "start": 404.24, "end": 409.2, "text": " the rest so all of their background is going into that one. You can see that if" }, { "start": 409.2, "end": 413.84000000000003, "text": " you have a system like this if you can train it correctly then it becomes pretty" }, { "start": 413.84000000000003, "end": 419.24, "text": " easy to classify it right here because you can just take each" }, { "start": 419.24, "end": 424.6, "text": " slot and independently classify it. Because you already know you already" }, { "start": 424.6, "end": 429.68, "text": " have assigned all the pixels where the object appears into that slot you can" }, { "start": 429.68, "end": 436.16, "text": " just super easily predict a class from it. So we're almost at the end so you" }, { "start": 436.16, "end": 441.2, "text": " now predict for each slot a class or a description of the object whatever you" }, { "start": 441.2, "end": 446.24, "text": " want to predict and this is the exact same thing as in this Facebook paper now" }, { "start": 446.24, "end": 452.76, "text": " where for each of these slots we've predicted a bounding box. The" }, { "start": 452.76, "end": 457.72, "text": " question is how do you assign this to the labels and that's pretty easy that" }, { "start": 457.72, "end": 465.52000000000004, "text": " there's this thing called the Hungarian matching that basically what you're" }, { "start": 465.52000000000004, "end": 470.92, "text": " saying is you want to be as forthcoming as possible right so if you predict a" }, { "start": 470.92, "end": 475.72, "text": " gray cube somewhere and there is a gray cube somewhere here you want to match" }, { "start": 475.72, "end": 479.84000000000003, "text": " them you'll say okay I'm going to give you the benefit of the doubt and I'm" }, { "start": 479.84000000000003, "end": 485.40000000000003, "text": " going to do your model I'm going to assume with the gray cube you meant that" }, { "start": 485.4, "end": 492.08, "text": " gray cube right here and if there is the yellow rectangle and the yellow" }, { "start": 492.08, "end": 496.12, "text": " rectangle somewhere over there you don't incur any penalty as long as you" }, { "start": 496.12, "end": 501.84, "text": " predict the correct things. Now only whenever you predict like a second" }, { "start": 501.84, "end": 508.08, "text": " yellow rectangle so both of these slots now so this slot and this slot for some" }, { "start": 508.08, "end": 512.28, "text": " reason they predict a yellow rectangle this one correctly and this one was" }, { "start": 512.28, "end": 516.88, "text": " assigned this object and it incorrectly predicts a yellow rectangle oh sorry" }, { "start": 516.88, "end": 520.88, "text": " other way around this one incorrectly predicts a yellow rectangle where there" }, { "start": 520.88, "end": 525.24, "text": " is no second yellow rectangle in our label set there's only this maybe this" }, { "start": 525.24, "end": 531.88, "text": " green cube then this will be a mistake because it can't be matched it will be" }, { "start": 531.88, "end": 534.88, "text": " matched to the one where it has the least loss but it will be matched to" }, { "start": 534.88, "end": 538.68, "text": " something that's not a yellow rectangle and therefore that's going to be a" }, { "start": 538.68, "end": 542.8, "text": " mistake so this is how you calculate the loss function with this matching" }, { "start": 542.8, "end": 547.52, "text": " algorithm and you can calculate that matching in a deterministic fashion so" }, { "start": 547.52, "end": 553.28, "text": " you can back propagate through it so you can see if this slot assignment works" }, { "start": 553.28, "end": 559.68, "text": " we'll have a pretty easy time then calculating the classes coming up with a" }, { "start": 559.68, "end": 565.4, "text": " loss the same for the unsupervised object discovery what we'll do is we'll" }, { "start": 565.4, "end": 570.52, "text": " run these things through this slot decoder now this slot decoder is very" }, { "start": 570.52, "end": 577.76, "text": " similar to an a generator in GANs for example it takes a hidden representation" }, { "start": 577.76, "end": 582.64, "text": " as input now the hidden representation here is going to be these these slots" }, { "start": 582.64, "end": 589.64, "text": " and it's going to up sample it into an image if we train the whole if if we" }, { "start": 589.64, "end": 595.68, "text": " have a good slot assignment mechanism we can pretty easily train a decoder like" }, { "start": 595.68, "end": 600.6, "text": " this right with any method you want in this case I believe they use some yeah" }, { "start": 600.6, "end": 606.72, "text": " some sort of up sampling up convolution architecture right here and they use the" }, { "start": 606.72, "end": 613.68, "text": " L2 they minimize the reconstruction error between the end the output image" }, { "start": 613.68, "end": 619.16, "text": " and the input image so it's sort of like a variational autoencoder or just" }, { "start": 619.16, "end": 626.92, "text": " autoencoder objective in this case all right so we know how to encode a picture" }, { "start": 626.92, "end": 631.36, "text": " into hidden representation using a standard convolutional neural network" }, { "start": 631.36, "end": 637.0799999999999, "text": " and we know once our slot attention mechanism works we pretty much know how" }, { "start": 637.0799999999999, "end": 642.52, "text": " to go from there so the question is what is this slot attention mechanism now" }, { "start": 642.52, "end": 647.64, "text": " what we're supposed to do is we're supposed to again assign each one of the" }, { "start": 647.64, "end": 652.8, "text": " features into a slot and in a very specific fashion so if you think about" }, { "start": 652.8, "end": 657.84, "text": " the pixels right here there can be multiple of these pixels or multiple of" }, { "start": 657.84, "end": 663.28, "text": " the regions multiple features can be assigned to one slot but we'd rather not" }, { "start": 663.28, "end": 672.72, "text": " have the same feature assigned to multiple slots so each slot takes in" }, { "start": 672.72, "end": 679.8000000000001, "text": " many features but the features should be this divided between the slots such that" }, { "start": 679.8000000000001, "end": 684.6, "text": " only one slot attends to a feature and by me saying attend you probably already" }, { "start": 684.6, "end": 691.44, "text": " know where this is going so if you have the features and you consider the slots" }, { "start": 691.44, "end": 696.96, "text": " right and we just look at a single feature for now what we'll do is we'll" }, { "start": 696.96, "end": 702.76, "text": " have an attention mechanism from the slots going into the features so if you" }, { "start": 702.76, "end": 706.52, "text": " don't know what an attention mechanism is I have this video called attention is" }, { "start": 706.52, "end": 711.96, "text": " all you need where I explained this but briefly the features they will emit" }, { "start": 711.96, "end": 717.88, "text": " something that's called a key which is a vector and then the slots will emit a" }, { "start": 717.88, "end": 727.8, "text": " query which are also vectors and the sir the the information is now routed by" }, { "start": 727.8, "end": 733.8, "text": " agreement of key and query in this case this thing this this feature right here" }, { "start": 733.8, "end": 738.96, "text": " would be routed to this slot now it would be routed to both slots but it" }, { "start": 738.96, "end": 744.56, "text": " wouldn't be routed as much to the bottom slot and we make sure that this happens" }, { "start": 744.56, "end": 751.16, "text": " by using a softmax assignment so if this is like 9 and this is 4 what we'll do is" }, { "start": 751.16, "end": 756.4, "text": " a softmax assignment such that after that so we have a proper distribution" }, { "start": 756.4, "end": 762.1199999999999, "text": " which would be something like after the softmax be something like 0.9 and 0.1" }, { "start": 762.1199999999999, "end": 769.4799999999999, "text": " right here so you can see that the attention is fairly hard so this is" }, { "start": 769.48, "end": 775.6, "text": " basically it's a differentiable way to assign these things okay so an attention" }, { "start": 775.6, "end": 781.6800000000001, "text": " mechanism fulfills the property that we want to basically assign features to the" }, { "start": 781.6800000000001, "end": 786.6, "text": " slots in a way that the slots compete for the features as you can see right" }, { "start": 786.6, "end": 793.3000000000001, "text": " here if this slot here matches the feature the best it come it out" }, { "start": 793.3000000000001, "end": 798, "text": " competes the other slot because at the end this has to be normalized to one" }, { "start": 798, "end": 803.2, "text": " because of the softmax so this competition is the heart of the slot" }, { "start": 803.2, "end": 813.24, "text": " attention mechanism and this is this is how it works so this is the slot" }, { "start": 813.24, "end": 818.56, "text": " attention module as you can see so you'll take your inputs and they have" }, { "start": 818.56, "end": 823.6, "text": " lots of layer norms in here but disregard the the layer norms so what" }, { "start": 823.6, "end": 828.4, "text": " you'll do is you'll calculate the agreement between the inputs and the" }, { "start": 828.4, "end": 835.9200000000001, "text": " slots now you might wonder in a standard attention mechanism you'll have input" }, { "start": 835.9200000000001, "end": 839.8000000000001, "text": " signal coming from here which is like maybe these are the input signals and" }, { "start": 839.8000000000001, "end": 845.52, "text": " then you construct the keys and the queries for the next layer you" }, { "start": 845.52, "end": 851.3000000000001, "text": " construct all from that input signal right and also the values by the way you" }, { "start": 851.3, "end": 857.92, "text": " construct everything from that input signal but in this case will have many" }, { "start": 857.92, "end": 862.64, "text": " features and will only have a fixed amount of slots right here so where do" }, { "start": 862.64, "end": 867.76, "text": " these slots come from where do the the signal for the keys come from in the" }, { "start": 867.76, "end": 873.4, "text": " Facebook DETR paper we saw that these are learned embeddings however in this" }, { "start": 873.4, "end": 878.7199999999999, "text": " case right here these are not learned the slots are initialized randomly so at" }, { "start": 878.72, "end": 883.88, "text": " the beginning of each thing the slots are initialized randomly you can think" }, { "start": 883.88, "end": 889.2, "text": " of this as an attention mechanism where you have the attention module right here" }, { "start": 889.2, "end": 895.12, "text": " and then at the beginning you simply have randomly initialized positional" }, { "start": 895.12, "end": 900.94, "text": " embedding or randomly initialized slots and then the image is going to be" }, { "start": 900.94, "end": 908.6800000000001, "text": " encoded through a CNN right here giving you a bunch of these features and then" }, { "start": 908.68, "end": 913.5999999999999, "text": " you'll have cross attention between these features and the slots and that" }, { "start": 913.5999999999999, "end": 920.0799999999999, "text": " will give you the next layer right here okay" }, { "start": 920.0799999999999, "end": 926.8399999999999, "text": " all right so you want to calculate the routing between the inputs and the" }, { "start": 926.8399999999999, "end": 932.64, "text": " slots and then you want to perform a softmax over the slots which will give" }, { "start": 932.64, "end": 935.92, "text": " you this competitive nature between the slots so all the slots are going to" }, { "start": 935.92, "end": 943.24, "text": " compete for the features to be routed to them and then this is" }, { "start": 943.24, "end": 948.8399999999999, "text": " simply the second part of the attention mechanism and so you will have a weighted" }, { "start": 948.8399999999999, "end": 952.4399999999999, "text": " mean now this is a slightly different from an attention mechanism because in" }, { "start": 952.4399999999999, "end": 956.3199999999999, "text": " a real attention mechanism you'll have a weighted sum right here here you will" }, { "start": 956.3199999999999, "end": 960.4, "text": " have a weighted mean but it's basically such that you can have a different" }, { "start": 960.4, "end": 966.4, "text": " amount of slots and the kind of values will stay the same that's why you do the" }, { "start": 966.4, "end": 972.12, "text": " mean so you weight them up and the values are simply a function of the" }, { "start": 972.12, "end": 977.52, "text": " inputs this is like in a standard attention mechanism then what you'll do" }, { "start": 977.52, "end": 983.4399999999999, "text": " you can see that this is now called updates okay so you start with the" }, { "start": 983.44, "end": 990.6, "text": " slots randomly and then you use the slots to route the information" }, { "start": 990.6, "end": 996.8800000000001, "text": " you take the inputs and you use that information routing to calculate the" }, { "start": 996.8800000000001, "end": 1004.7600000000001, "text": " updates now you put the updates through a GRU with the state being the previous" }, { "start": 1004.76, "end": 1014.56, "text": " slots and then you'll add that to the slots either this says optional residual" }, { "start": 1014.56, "end": 1021.76, "text": " MLP so what you can do is you will have a residual MLP or not this is a fairly" }, { "start": 1021.76, "end": 1032.96, "text": " complicated thing but if you think of it it is just a transformer so what they" }, { "start": 1032.96, "end": 1038.96, "text": " describe here sorry the purpose of this GRU here of course is that the GRU is a" }, { "start": 1038.96, "end": 1044.28, "text": " recurrent unit and you can see right here that they do this multiple times so" }, { "start": 1044.28, "end": 1050.48, "text": " once you start with the random slots right but then you update the slots and" }, { "start": 1050.48, "end": 1057.04, "text": " you go you go again okay so you do this first of all you'll have the features" }, { "start": 1057.04, "end": 1063.32, "text": " and you'll just have random slots and then you do a bit of routing okay okay" }, { "start": 1063.32, "end": 1069.52, "text": " so now we have a bit of routing cool you update these slots to be the next set of" }, { "start": 1069.52, "end": 1079.08, "text": " slots and then you take the same features and route them again so you you" }, { "start": 1079.08, "end": 1083.44, "text": " route them again and this is supposed to be kind of this iterative procedure you" }, { "start": 1083.44, "end": 1087.04, "text": " might have seen this in capsule networks I've done a video on capsule networks" }, { "start": 1087.04, "end": 1090.88, "text": " where exactly this type of iterative routing you always have the same" }, { "start": 1090.88, "end": 1097.72, "text": " routing functions right these the functions for value and key and query" }, { "start": 1097.72, "end": 1104.76, "text": " are always the same but you do this iteratively many times in a row this is" }, { "start": 1104.76, "end": 1111.24, "text": " like a transformer with weight sharing it's exactly the same right so you have" }, { "start": 1111.24, "end": 1118.92, "text": " these slots you initialize them randomly you do your query times keys your soft" }, { "start": 1118.92, "end": 1125.56, "text": " max times the value right here and this the transformer even has this plus this" }, { "start": 1125.56, "end": 1131.68, "text": " MLP layer right here like this the transformer has that in there and then" }, { "start": 1131.68, "end": 1137.96, "text": " you simply do it again so up here you have the next transformer layer but" }, { "start": 1137.96, "end": 1145.04, "text": " instead of being its own layer you'll copy the so it's it's weight shared it's" }, { "start": 1145.04, "end": 1150.88, "text": " a transformer with weight sharing between the modules and the inputs they" }, { "start": 1150.88, "end": 1159.4, "text": " are also copied up here this these side inputs all right it's otherwise it's the" }, { "start": 1159.4, "end": 1163.32, "text": " it's the same thing except that these aren't produced by an encoder that is" }, { "start": 1163.32, "end": 1167.8799999999999, "text": " also a transformer they're actually produced by a CNN and the weights here" }, { "start": 1167.8799999999999, "end": 1172.84, "text": " are shared the only difference is that in between here they also have like this" }, { "start": 1172.84, "end": 1178.04, "text": " GRU this GRU thing but they do an ablation on it and it's actually not" }, { "start": 1178.04, "end": 1182.56, "text": " that important so you could might as well just leave it away bring it brings" }, { "start": 1182.56, "end": 1190.52, "text": " only very few benefits so this is how I want how I think of this model this is a" }, { "start": 1190.52, "end": 1197.48, "text": " multi layer a t layer transformer with weight sharing in for the individual" }, { "start": 1197.48, "end": 1204.76, "text": " layers where the inputs the input positional encoding are randomly" }, { "start": 1204.76, "end": 1211.04, "text": " initialized each time okay now they they really stress this random" }, { "start": 1211.04, "end": 1216.6399999999999, "text": " initialization because this differs from the DETR paper in that in the DETR paper" }, { "start": 1216.64, "end": 1221.24, "text": " these things here are learned and the DETR paper we have also this kind of" }, { "start": 1221.24, "end": 1226.68, "text": " object detection thing and it what will happen when you learn these is that for" }, { "start": 1226.68, "end": 1231.8400000000001, "text": " example this one right here might specialize in objects that are sort of" }, { "start": 1231.8400000000001, "end": 1236.68, "text": " on the top left of the image and this one might specialize in objects that are" }, { "start": 1236.68, "end": 1240.3000000000002, "text": " kind of long and in the middle and so on and this one might specialize to" }, { "start": 1240.3000000000002, "end": 1245.96, "text": " something else now I can't tell you what works better or what not it seems like" }, { "start": 1245.96, "end": 1251.4, "text": " you can if I were to implement something like this I might want to go with the" }, { "start": 1251.4, "end": 1256.4, "text": " Facebook one and then just have more right here in this paper they opt for" }, { "start": 1256.4, "end": 1261.4, "text": " having fewer but because they're fewer if you learn them they become I guess" }, { "start": 1261.4, "end": 1267.08, "text": " too specialized and you will need to keep them agnostic so you don't want to" }, { "start": 1267.08, "end": 1272.24, "text": " learn them you simply want to randomly initialize them each time and via via" }, { "start": 1272.24, "end": 1277.6, "text": " the iterative routing via the weight sharing they will be sort of assigned" }, { "start": 1277.6, "end": 1287.88, "text": " correctly all right I hope you could follow this yeah if you if you want to" }, { "start": 1287.88, "end": 1292.08, "text": " anthropomorphize this you could think if each of these slots starts out just" }, { "start": 1292.08, "end": 1296.6, "text": " randomly and then just by sheer coincidence through this attention" }, { "start": 1296.6, "end": 1302.06, "text": " mechanism they happen to be assigned a couple of these features now because we" }, { "start": 1302.06, "end": 1305.9199999999998, "text": " train the model to perform well because they're already assigned these features" }, { "start": 1305.9199999999998, "end": 1309.56, "text": " in the next layer they'll basically ask through the query function they'll ask" }, { "start": 1309.56, "end": 1314.48, "text": " for more of that they'll basically say oh I'm now responsible kind of for the" }, { "start": 1314.48, "end": 1318.1599999999999, "text": " gray pixels give me more of the gray pixels right give me give me more of" }, { "start": 1318.1599999999999, "end": 1321.3999999999999, "text": " that and then in the next layer even more of that even more of that and" }, { "start": 1321.3999999999999, "end": 1327.9199999999998, "text": " you'll see in the in the investigations into what happens exactly this type of" }, { "start": 1327.92, "end": 1333.2, "text": " thing happening so if we skip ahead to the experiments where they show what" }, { "start": 1333.2, "end": 1339.24, "text": " happens through the iterations you can see this right here so the attention" }, { "start": 1339.24, "end": 1346.8400000000001, "text": " the attention maps of these slots you can see that in after the first step you" }, { "start": 1346.8400000000001, "end": 1351.2, "text": " can see that you know it's slot two right here is assigned kind of these" }, { "start": 1351.2, "end": 1355.88, "text": " both of these objects slot three is already pretty so the first step kind of" }, { "start": 1355.88, "end": 1360.72, "text": " learns to segment a little bit of the image but not you know too well slot" }, { "start": 1360.72, "end": 1367.3600000000001, "text": " four it also the attention map here is pretty pretty wonky but if you in the" }, { "start": 1367.3600000000001, "end": 1373.5600000000002, "text": " next step and this is kind of crucial basically the these slots they" }, { "start": 1373.5600000000002, "end": 1378.2, "text": " specialize there's a slot to realize as well I have a lot of these these blue" }, { "start": 1378.2, "end": 1381.92, "text": " pixels I'm gonna give me more of those right give me more of those so it gets" }, { "start": 1381.92, "end": 1386.76, "text": " all the blue pixel well slot four has a lot of these golden pixels says give me" }, { "start": 1386.76, "end": 1391.04, "text": " more of that of those golden stuff that's also regionally right next to" }, { "start": 1391.04, "end": 1395.6000000000001, "text": " that and since these two compete I'm pretty sure slot two would also ask for" }, { "start": 1395.6000000000001, "end": 1400.88, "text": " more of the golden pixels because it has a lot of golden pixels but it competes" }, { "start": 1400.88, "end": 1405.72, "text": " with slot four because of the softmax so all of the golden pixels are assigned to" }, { "start": 1405.72, "end": 1411.3400000000001, "text": " slot four and not slot two well all of the blue pixels that slot four surely" }, { "start": 1411.34, "end": 1416.76, "text": " asks for as well are assigned to slot two in the next iteration so I actually" }, { "start": 1416.76, "end": 1423, "text": " consider iteration one is for you take the randomly initialized slots and you" }, { "start": 1423, "end": 1429, "text": " kind of assign them stuff so this is mainly the this is now mainly the" }, { "start": 1429, "end": 1435.52, "text": " transformer layer learning to segment but then step two is where the magic" }, { "start": 1435.52, "end": 1440.52, "text": " really happens is where the slots they kind of realize what's assigned to them" }, { "start": 1440.52, "end": 1445.36, "text": " and they ask for more of it and through the competition you'll get this" }, { "start": 1445.36, "end": 1450.56, "text": " separation into objects right so the whole thing is trained end to end which" }, { "start": 1450.56, "end": 1454.24, "text": " basically means that these functions get really good at doing this kind of" }, { "start": 1454.24, "end": 1458.68, "text": " segmentation alright and then in subsequent iterations you can just see" }, { "start": 1458.68, "end": 1466.12, "text": " this effect multiplying even more and more right but I might even you might" }, { "start": 1466.12, "end": 1470.4399999999998, "text": " even be able to think that you might want to separate step one and the" }, { "start": 1470.4399999999998, "end": 1474.9599999999998, "text": " subsequent steps because step one is sort of seems fundamentally different" }, { "start": 1474.9599999999998, "end": 1479.6, "text": " from steps two three four and so on because step one is this kind of" }, { "start": 1479.6, "end": 1484.2399999999998, "text": " assignment process and then the other steps are refinement so if I were to" }, { "start": 1484.2399999999998, "end": 1490.7199999999998, "text": " take this model and make it better I would try to have a special like not" }, { "start": 1490.72, "end": 1497.68, "text": " way sharing between steps the first step and the subsequent steps but what do I" }, { "start": 1497.68, "end": 1503.1200000000001, "text": " know this apparently it works okay you can also look at the reconstruction" }, { "start": 1503.1200000000001, "end": 1510.08, "text": " since their objective is to reconstruct so basically what each slot outputs each" }, { "start": 1510.08, "end": 1515.1200000000001, "text": " slot out if you reconstruct each slot here we these are the different slots" }, { "start": 1515.1200000000001, "end": 1520.52, "text": " each slot is supposed to output a picture of the reconstruction now if we" }, { "start": 1520.52, "end": 1525.08, "text": " consider that each slot is responsible for an object you might very well say" }, { "start": 1525.08, "end": 1529.56, "text": " okay this slot here gives me a picture with just the object in it that it's" }, { "start": 1529.56, "end": 1534.08, "text": " supposed to reconstruct and then this lot here gives me a picture with just" }, { "start": 1534.08, "end": 1537.92, "text": " the object that it is supposed to reconstruct now how do you know how to" }, { "start": 1537.92, "end": 1545, "text": " combine these pictures especially since they might be overlapping and so on so" }, { "start": 1545, "end": 1552.16, "text": " the way you do it is you actually output four channels so you output R G B and A" }, { "start": 1552.16, "end": 1558.56, "text": " so a being the alpha channel so each slot also has to decide where the object" }, { "start": 1558.56, "end": 1565.72, "text": " is that it reconstructs and so each so this this here might be okay everything" }, { "start": 1565.72, "end": 1572, "text": " here is alpha one and including the shadow maybe maybe there's a little" }, { "start": 1572, "end": 1579.36, "text": " shadow and everything else is alpha zero and then the alpha maps you combine also" }, { "start": 1579.36, "end": 1584.76, "text": " via a softmax to ensure that they sum up to one so you combine the pictures" }, { "start": 1584.76, "end": 1589.84, "text": " including their alpha maps but that means you can basically reconstruct from" }, { "start": 1589.84, "end": 1598.84, "text": " the slots where the where the objects are now you'll know you'll notice this" }, { "start": 1598.84, "end": 1603.56, "text": " is this thing here you'll notice that they often use for example here four" }, { "start": 1603.56, "end": 1608.1999999999998, "text": " different slots because even though the image has three different objects why is" }, { "start": 1608.1999999999998, "end": 1614.52, "text": " that because you need to reconstruct the entire image so you need at least one" }, { "start": 1614.52, "end": 1620.1999999999998, "text": " slot for the background and that's always what you can see right here so if" }, { "start": 1620.1999999999998, "end": 1626.6399999999999, "text": " you have the sorry the reconstruction you'll see that slot too with time with" }, { "start": 1626.64, "end": 1631.4, "text": " iterations it reconstructs this cube slot three reconstructs the ball slot" }, { "start": 1631.4, "end": 1636.76, "text": " four reconstructs the yellow cylinder and slot one reconstructs the background" }, { "start": 1636.76, "end": 1647.64, "text": " okay also here if you see the attention masks you see that the slot one will be" }, { "start": 1647.64, "end": 1651.64, "text": " responsible for the background here the background is significantly darker than" }, { "start": 1651.64, "end": 1656.0400000000002, "text": " in these others though they do say the background doesn't really tend to go to" }, { "start": 1656.04, "end": 1660.56, "text": " one slot in particular it tends to kind of spread out across all the slots and" }, { "start": 1660.56, "end": 1667.72, "text": " this might mean more investigation yeah so they have these different tasks right" }, { "start": 1667.72, "end": 1673.36, "text": " here for example to segment these Tetris blocks here and you can see the" }, { "start": 1673.36, "end": 1680.6399999999999, "text": " segmentations it works pretty pretty well now why does this work so well it's" }, { "start": 1680.64, "end": 1686.5600000000002, "text": " probably because of the data sets so these kinds of data sets they come you" }, { "start": 1686.5600000000002, "end": 1690.1200000000001, "text": " know they they're produced by a generator and the generator specifically" }, { "start": 1690.1200000000001, "end": 1696.0400000000002, "text": " has these these objects right here and it sort of in it arranges them in an" }, { "start": 1696.0400000000002, "end": 1699.8400000000001, "text": " independent fashion the background is really clean right the objects" }, { "start": 1699.8400000000001, "end": 1703.8400000000001, "text": " themselves are really clean and geometric and so on and they're they're" }, { "start": 1703.8400000000001, "end": 1710.2, "text": " kind of arranged in a random fashion and then there's a render of that so this is" }, { "start": 1710.2, "end": 1715.48, "text": " like super super duper clean data set and I guess that has a lot to do with" }, { "start": 1715.48, "end": 1721, "text": " why these methods work so well because they can just assume okay an object is" }, { "start": 1721, "end": 1725.92, "text": " generally you know spatially something some geometric shape that I know it's" }, { "start": 1725.92, "end": 1730.2, "text": " close together it's pretty independent from its surrounding and it's trained" }, { "start": 1730.2, "end": 1734.48, "text": " with objects that are almost zero correlated like there is zero" }, { "start": 1734.48, "end": 1740.32, "text": " correlation between the objects in the training data set so I wouldn't yet" }, { "start": 1740.32, "end": 1747.4, "text": " apply this much to to real-world problems but is an interesting thought" }, { "start": 1747.4, "end": 1754.4, "text": " right here so that's the sort of idea behind the paper I hope you got that" }, { "start": 1754.4, "end": 1763.44, "text": " they do a lot of experiments and here is a bit where my quarrels start so they" }, { "start": 1763.44, "end": 1772.0800000000002, "text": " say that they compare for example with the with these in the unsupervised" }, { "start": 1772.0800000000002, "end": 1777.3200000000002, "text": " object discovery experiments they have this data set called clever and this" }, { "start": 1777.3200000000002, "end": 1784.24, "text": " data set has these images with sort of I believe clever six has all up to six" }, { "start": 1784.24, "end": 1788.44, "text": " different objects now this is already one of the things this is not a" }, { "start": 1788.44, "end": 1793.2, "text": " specifically quarrel with this model but if your data set has six things they all" }, { "start": 1793.2, "end": 1799.02, "text": " they give like they give seven slots because they know that the data set has" }, { "start": 1799.02, "end": 1803.76, "text": " at most six things which means they can always cover all the things now it works" }, { "start": 1803.76, "end": 1807.8, "text": " when there's less objects but I think the knowledge of how many objects" }, { "start": 1807.8, "end": 1813.28, "text": " there's gonna be is also a big part of why these models work and why maybe it's" }, { "start": 1813.28, "end": 1821.28, "text": " not entirely ready yet for the real world but anyway they compare to these" }, { "start": 1821.28, "end": 1827.3799999999999, "text": " two baselines they're called iodine which also employs kind of a recurrent" }, { "start": 1827.3799999999999, "end": 1835.68, "text": " architecture but not with an attention mechanism and Monet and they say" }, { "start": 1836.24, "end": 1842.82, "text": " yada yada yada this replaces lot of them no that's not it for the Monet iodine" }, { "start": 1842.82, "end": 1848, "text": " DSP and baselines we compare with the published numbers as we use the same" }, { "start": 1848, "end": 1853.04, "text": " experimental setup so they say they use the same experimental setup and that's" }, { "start": 1853.04, "end": 1858.08, "text": " why they don't re-implement these models but they use the published numbers in" }, { "start": 1858.08, "end": 1864.2, "text": " their respective papers which is something you can do this is often I" }, { "start": 1864.2, "end": 1869.04, "text": " guess these machine translation papers and so on they do this just because you" }, { "start": 1869.04, "end": 1875.16, "text": " know it's a lot to to run these things however here I'm a bit skeptical first" }, { "start": 1875.16, "end": 1880.96, "text": " yes because it is it is Google so they do have a lot of resources available to" }, { "start": 1880.96, "end": 1887.64, "text": " technically run these things I've seen at least Monet has an implementation by" }, { "start": 1887.64, "end": 1891.68, "text": " the author or I've seen one of them the other one also there is an implementation" }, { "start": 1891.68, "end": 1899.3200000000002, "text": " and there's eight authors on this particular paper so I yeah I this would" }, { "start": 1899.3200000000002, "end": 1903.8400000000001, "text": " be okay they say as we use the same experimental setup so even in that case" }, { "start": 1903.84, "end": 1910.08, "text": " if you have the same setup it's more okay but it really depends on you" }, { "start": 1910.08, "end": 1918.6399999999999, "text": " really having the same setup and this is a bit where it kind of falls so for" }, { "start": 1918.6399999999999, "end": 1924.76, "text": " example one example right here is they say we train the moon using the atom" }, { "start": 1924.76, "end": 1930, "text": " optimizer with a learning rate and 60 so on they use a single GPU we further make" }, { "start": 1930, "end": 1934.1, "text": " use of learning rate warm-up to prevent early saturation of the attention" }, { "start": 1934.1, "end": 1939.88, "text": " mechanism and an exponential decay decay schedule in the learning rate which we" }, { "start": 1939.88, "end": 1944.72, "text": " found to reduce variance so I've checked these other models and none of them" }, { "start": 1944.72, "end": 1948.36, "text": " talks about learning rate warm-up and nowhere in their code is there a" }, { "start": 1948.36, "end": 1955.52, "text": " learning rate warm-up now you might you might argue okay this is specific to" }, { "start": 1955.52, "end": 1959.36, "text": " this model it might need this but if you look at the results right here for" }, { "start": 1959.36, "end": 1964.56, "text": " example you see that they don't outperform these other models by too" }, { "start": 1964.56, "end": 1970.9199999999998, "text": " much so you can see right here this is on par this here outperforms this one a" }, { "start": 1970.9199999999998, "end": 1977.4399999999998, "text": " little bit but then also the star here means that they have left out one of the" }, { "start": 1977.4399999999998, "end": 1982.3999999999999, "text": " denotes that one outlier was excluded from evaluation I guess which is valid" }, { "start": 1982.4, "end": 1990.8400000000001, "text": " if it's a super outlier but in this case I would categorize this model as a" }, { "start": 1990.8400000000001, "end": 1997.52, "text": " different way of doing doing things and not necessarily outperforming the others" }, { "start": 1997.52, "end": 2002.5600000000002, "text": " so this also if you look at the ablations the differences here are" }, { "start": 2002.5600000000002, "end": 2007.92, "text": " miniscule and in these ablations that they show every single thing they do" }, { "start": 2007.92, "end": 2013.88, "text": " like gives them a little bit of a boost and you just make it kind of across the" }, { "start": 2013.88, "end": 2018.44, "text": " line to reach state-of-the-art I'd rather have research move in a direction" }, { "start": 2018.44, "end": 2021.92, "text": " where we just show cool ideas and that they work and that's what this paper" }, { "start": 2021.92, "end": 2029.28, "text": " does to to be fair what I do have more of a problem with a little bit is this" }, { "start": 2029.28, "end": 2036.16, "text": " here on clever six we can use a batch size of up to 64 on a single V 100 GPU" }, { "start": 2036.16, "end": 2041.28, "text": " as opposed to four in this iodine baseline right compared to ion and our" }, { "start": 2041.28, "end": 2045, "text": " model is significantly more efficient in terms of both memory consumption and" }, { "start": 2045, "end": 2051.28, "text": " runtime which is you know something I believe but this characterization that" }, { "start": 2051.28, "end": 2057.48, "text": " they use a batch size of four and here in this paper they can use a size up to" }, { "start": 2057.48, "end": 2064.7200000000003, "text": " 64 on a single V 100 GPU I've read the iodine paper and the iodine paper says" }, { "start": 2064.72, "end": 2071.56, "text": " yes they do use a batch size of four on one GPU so they also use one GPU but they" }, { "start": 2071.56, "end": 2080.4399999999996, "text": " say their GPU has a RAM of 12 gigabytes and 12 gigabyte RAM GPUs that points to" }, { "start": 2080.4399999999996, "end": 2087.56, "text": " something like TI either I guess a 1080 or a 20 2080 or something like this this" }, { "start": 2087.56, "end": 2094.24, "text": " is not a V 100 the V 100 come in 16 or probably Google has the 32 gigabyte" }, { "start": 2094.24, "end": 2102.64, "text": " version so this is a 32 gigabyte GPU that is significantly better than the TI" }, { "start": 2102.64, "end": 2110.24, "text": " GPUs these V 100 they cost like five or ten times more than the TI GPUs and to" }, { "start": 2110.24, "end": 2115.8799999999997, "text": " simply say we have also one GPU and we can run up to a batch size of 64 and" }, { "start": 2115.8799999999997, "end": 2121.72, "text": " they can only run a batch size of four it seems I don't know it seems sort of" }, { "start": 2121.72, "end": 2126.3199999999997, "text": " overstating what you can do now maybe I'm wrong maybe they have actually tested" }, { "start": 2126.3199999999997, "end": 2131.16, "text": " this other model and concluded also on their GPUs it can only run to a batch" }, { "start": 2131.16, "end": 2136.16, "text": " size of in a bat as a batch size of four but I highly doubt it because in their" }, { "start": 2136.16, "end": 2140.8399999999997, "text": " here the paper is cited and in their paper they explicitly named that they" }, { "start": 2140.8399999999997, "end": 2151.2, "text": " use for a batch size of four for their 12 gigabyte GPUs so yeah in this that" }, { "start": 2151.2, "end": 2155.72, "text": " that just kind of pulls through so there's the there's the miniscule" }, { "start": 2155.72, "end": 2160.04, "text": " improvements and then there is the ablations of all these tricks where" }, { "start": 2160.04, "end": 2164.2799999999997, "text": " everyone just gives you a little bit and then there is this kind of very very" }, { "start": 2164.2799999999997, "end": 2174.72, "text": " very favorable comparison wordsmithy a bit which gives a bit of a bitter taste" }, { "start": 2174.72, "end": 2179.7599999999998, "text": " to what I think is actually a very very cool method because how why is this" }, { "start": 2179.76, "end": 2186.44, "text": " method so cool because for example these slots here they are trained to also" }, { "start": 2186.44, "end": 2192.28, "text": " absorb the background right so you can technically at inference time increase" }, { "start": 2192.28, "end": 2197.48, "text": " the number of slots even though you've trained with just with a few slots right" }, { "start": 2197.48, "end": 2202.4, "text": " you can you can increase the number of slots and the model can just handle it" }, { "start": 2202.4, "end": 2212.8, "text": " and they show it right here in these results here you can this data set has" }, { "start": 2212.8, "end": 2216.8, "text": " six objects and this data set has ten objects now the model has only been" }, { "start": 2216.8, "end": 2221, "text": " trained ever on six objects and they can just up the number of slots at inference" }, { "start": 2221, "end": 2226.76, "text": " time and it'll work also very well also they can now up the number of iterations" }, { "start": 2226.76, "end": 2230.12, "text": " since these are all weight shared these iterations right we've looked at it" }, { "start": 2230.12, "end": 2236.44, "text": " there's there's weight sharing between the iterations there is nothing stopping" }, { "start": 2236.44, "end": 2240.44, "text": " you from just piling on here because it's weight shared you don't need any" }, { "start": 2240.44, "end": 2244.88, "text": " more weights you can just refine this iteration and since the iteration" }, { "start": 2244.88, "end": 2250.2799999999997, "text": " themselves are refining these attention masks anyway you might as well at" }, { "start": 2250.2799999999997, "end": 2254.24, "text": " inference time refine them some more they have an ablation where they show" }, { "start": 2254.24, "end": 2259.04, "text": " that technically like three two or three iterations at training time gives them" }, { "start": 2259.04, "end": 2263.7599999999998, "text": " the best result I guess just because of gradient propagation because more layers" }, { "start": 2263.7599999999998, "end": 2268.48, "text": " means you have to propagate the gradient back more but at inference time you can" }, { "start": 2268.48, "end": 2271.8, "text": " just up these iterations and as you can see right here you get better and better" }, { "start": 2271.8, "end": 2278.2, "text": " so this these results are are pretty cool and they respect the property that" }, { "start": 2278.2, "end": 2284.48, "text": " sets should be permutation invariant and and so on this routing view of the" }, { "start": 2284.48, "end": 2288.6, "text": " transformer is pretty cool even though it's you can look at it as a" }, { "start": 2288.6, "end": 2292.92, "text": " transformer with weight sharing or an iterative routing protocol like in" }, { "start": 2292.92, "end": 2299.68, "text": " capsules so all of this I I find to be very very cool idea and I think that's" }, { "start": 2299.68, "end": 2306.12, "text": " how we should look at this this paper so before I am too critical of this paper I" }, { "start": 2306.12, "end": 2312.7999999999997, "text": " want to say that I really like the idea and the algorithm here the" }, { "start": 2312.8, "end": 2319.6400000000003, "text": " implementation yeah so that was the paper at last I actually want to look at" }, { "start": 2319.6400000000003, "end": 2323.96, "text": " the broader impact statement just because I've I've complained about" }, { "start": 2323.96, "end": 2328.36, "text": " brought the need for broader impact statements so I just want to kind of go" }, { "start": 2328.36, "end": 2333.88, "text": " just read them and just like look how how the different companies how the" }, { "start": 2333.88, "end": 2337.88, "text": " different institutions how the different people how the community reacts to them" }, { "start": 2337.88, "end": 2342.4, "text": " crafts them and so on so this one I find particularly interesting" }, { "start": 2342.4, "end": 2346.56, "text": " let's go through it says the slot detention module allows to learn object" }, { "start": 2346.56, "end": 2351.76, "text": " centric representation from perceptual input okay as such it is a general module" }, { "start": 2351.76, "end": 2356.56, "text": " that can be used in a wide range of domains and applications in our paper we" }, { "start": 2356.56, "end": 2360.1600000000003, "text": " only consider artificially generated data set under well controlled settings" }, { "start": 2360.1600000000003, "end": 2364.7200000000003, "text": " where slots are expected to specialize to objects however the specializations" }, { "start": 2364.7200000000003, "end": 2369, "text": " of our model is implicit and fully driven by the downstream task we remark" }, { "start": 2369, "end": 2373.4, "text": " that as a concrete measure to assess whether the module is specialized in" }, { "start": 2373.4, "end": 2377.28, "text": " unwanted ways one can visualize the attention masks to understand how the" }, { "start": 2377.28, "end": 2382.68, "text": " input features are distributed across the slots while more work is required to" }, { "start": 2382.68, "end": 2387.36, "text": " properly address the usefulness of the attention coefficients in explaining the" }, { "start": 2387.36, "end": 2391.48, "text": " overall predictions of the network especially if the input features are not" }, { "start": 2391.48, "end": 2395.56, "text": " human interpretable we argued that they may serve as a step towards more" }, { "start": 2395.56, "end": 2400.24, "text": " transparent and interpretable predictions this is a I mean it's a fine" }, { "start": 2400.24, "end": 2404.68, "text": " statement but it's not a broader impact statement right if you followed a bit" }, { "start": 2404.68, "end": 2409.2, "text": " what the broader impact statement is supposed to be this is not one okay the" }, { "start": 2409.2, "end": 2413.32, "text": " closest this comes to a broader impact statement is said as such it is a" }, { "start": 2413.32, "end": 2417, "text": " general model that can be used in a wide range of domains and applications and" }, { "start": 2417, "end": 2421.88, "text": " maybe a little bit that you can visualize the attention masks to" }, { "start": 2421.88, "end": 2425.88, "text": " understand how the input features are distributed but the broader impact" }, { "start": 2425.88, "end": 2431.28, "text": " statement is supposed to give you a preview of how this might affect society" }, { "start": 2431.28, "end": 2436.6, "text": " at large while this here just kind of lists properties of the model for the" }, { "start": 2436.6, "end": 2443.1600000000003, "text": " research community and sort of for this for the application of this model as as" }, { "start": 2443.1600000000003, "end": 2448.92, "text": " you know the introspection of the model itself this says nothing about society" }, { "start": 2448.92, "end": 2455.76, "text": " as such so maybe you know maybe that's I think that the smarter people will turn" }, { "start": 2455.76, "end": 2460.52, "text": " the broader impact statement into more of an introduction section because" }, { "start": 2460.52, "end": 2465.04, "text": " that's something you usually put in a conclusion or in an introduction where" }, { "start": 2465.04, "end": 2468.88, "text": " you say look here are some things our model can do and this is what it might" }, { "start": 2468.88, "end": 2475.04, "text": " be useful for and this is how you could introspect it and so on and since the" }, { "start": 2475.04, "end": 2479.36, "text": " broader impact statement especially at NURIPS you were allowed to put the" }, { "start": 2479.36, "end": 2483.72, "text": " broader impact statement on the main paper so not in the appendix but it" }, { "start": 2483.72, "end": 2488.88, "text": " wouldn't count towards your page limit it's I guess pretty foreseeable without" }, { "start": 2488.88, "end": 2494.16, "text": " what people are gonna start to do is simply put more of their paper into the" }, { "start": 2494.16, "end": 2500.24, "text": " broader impact section kind of cloaked in the veneer of a broader impact" }, { "start": 2500.24, "end": 2507.64, "text": " statement but I this is this is clearly not what what the broader impact" }, { "start": 2507.64, "end": 2511.9199999999996, "text": " statement was originally supposed to be now I don't know if this is good or bad" }, { "start": 2511.9199999999996, "end": 2517.2, "text": " I just think these authors are you know they're doing I think the a good thing" }, { "start": 2517.2, "end": 2522.24, "text": " here by simply telling us actually something useful about the model but" }, { "start": 2522.24, "end": 2528.64, "text": " that's just my opinion I do thank you for being with me here I know this was a" }, { "start": 2528.64, "end": 2532.72, "text": " bit ranty flip-flopping back and forth between the different things we haven't" }, { "start": 2532.72, "end": 2538.2799999999997, "text": " looked at set prediction at all we've only looked at these kind of masks but" }, { "start": 2538.2799999999997, "end": 2542.72, "text": " I invite you to go through the paper yourself and check it out it's pretty" }, { "start": 2542.72, "end": 2548.64, "text": " cool and they do describe a lot of things in pretty detail the appendix is" }, { "start": 2548.64, "end": 2554.3599999999997, "text": " very long and has very many ablations and this is something I do appreciate and" }, { "start": 2554.36, "end": 2559.48, "text": " with that bye bye and see you next time" } ]
V79rRI05Lj4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Set Distribution Networks: a Generative Model for Sets of Images (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "sets", "images", "cnn", "convolutional neural network", "gan", "generator", "encoder", "discriminator", "prior", "mean", "made", "latent", "binary", "conditional", "noise", "distribution", "probability", "energy-based", "energy", "apple", "research", "sdn", "variational", "elbo" ]
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 Xuangfei Chai, Walter Tablet, Miguel Angel Bautista, Carlos Gestrin and Josh M. Suskind of Apple. So this paper introduces a generative model for sets and it does so in an energy-based model fashion. It will have an encoder, a decoder in form of a generator, it will have a discriminator and it will have all kinds of math but the end result is a model that can generate sets of images and by sets we mean it can generate different kind of views on the same identity of image and you'll see what that means and it can generate even sets that it has never seen before which makes it different from a class conditional GAN or something like this. So 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. Alright so if you have a look at these samples right here these are examples of sets of images. Now without actually caring for top and bottom row they will have some meaning right here. Top row is always a row from the actual data set and the bottom row is the reconstruction of that set. Now you'll see that the images don't really have a correspondence so you see it's the same truck in the top and the bottom row but the orientation here isn't really shared or anything and that's because as we said this is a set network. So what you want to do in this problem setting is you want to take, you want to build a model that can take this set right here from the data set and it can encode it into a latent description that we call z. z simply describes the set as a whole. So z here would be, sorry, would be truck right? It would sort of be the 3D model so not the class truck but the 3D information of the truck without having any information of the different views okay? And then you want to build another model that can generate from this low level representation of the set, can generate the different views okay? Like each one of these by sort of rotating it. So we want to build a model that understands just from the pixels that here we have sets of things that they somehow always share a commonality and in this case they always share their 3D structure right? What they don't share is the view where they rendered from. So our model is supposed to kind of parse the two apart and encode that 3D structure just from the pixels in this z variable and then encode the fact that you can rotate it and look at it from different views into the generative model that then produces the different views okay? And the reason why there is no correspondence between the views is we simply regard these things as sets. So our final objective is simply going to be that the set on top is different views of that particular truck is going to be very similar to the set on the bottom which is also different views of that particular truck and that's what our model is supposed to do. Now you might know something like this from where you can simply say well this this looks like a class conditional GAN right? I simply have the class truck and I you know I feed this to my generator and my discriminator and my encoder and so on and it will produce the same truck and here that and here the bench and so on. The problem I guess becomes more apparent when you go to this different data set. So this is a face data set and again top row being the input and bottom row being the output. Now what is here what is supposed to be preserved you can kind of see in the images is sort of the identity of the person on the photo. Now you have to kind of 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 but you'll have to sort of gloss around this and you'll see that what is preserved or what is supposed to be preserved is something like the rough identity of the person on the picture and also a little bit of the image compositions. So you see here in the background you often have sort of these sports backgrounds right where there's kind of a washed out stadium or whatnot and you can see that this is also preserved here. I think it's kind of a glamour glamour shots of this must be some sort of glamour model and you'll see that this as well is preserved. What is different within each set is of course the different views on the same identity right? So you have the same person and you have pictures of them in different of different views, different lighting, different hairstyles and so on. Here you even see you have the black and white image and the set that is produced also contains some black and white images. So this model this is already the trained model here is doing a fairly good job. Here you can see that almost all the pictures have some sort of double like two people with one being sort of half in frame and it leads to a fairly strange thing. I'm gonna guess the model hasn't seen lots of that during training. I like it, particularly like this. This is pretty good. Also here we know that a lot of these face datasets they don't really have bald people all too often so you can see here this results in sort of kind of a weird Richard Branson type picture. In any case it does a fairly good job as you can see right here. And what's the problem with these faces? Can't we just do a class conditional again where we basically say here this is Ali and that's one class in our latent vector and then and so on. What we want to do is we want to train something like this where we can give in a new identity that we haven't seen during training. In fact we want to train something where we don't even know how many sets there are going to be in the end. We simply want to train it in a way where we say look I'm going to give you a set and the set will have 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 conserving the identity of the person and the rough style of the picture. So this is really different from a class conditional again as in we don't know how many classes there are and there can be new unseen ones during testing. So how do we go about something like this? And here is where the thing starts. So we're going to dive into a bit of the math here and then into a bit of the reasoning but ultimately what they're going to do is 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 a property be of the set representation? For example it should be independent of the ordering of these inputs. A set is simply a collection of objects, it's independent of the ordering, and it's also independent of the size in some way. Of course a bigger set gives you more information but the set identity, the fact that this is this particular car, is independent of how many views you have. So what they do is they build and they put each image through an encoder which is a convolutional neural network and I guess that gives them a hidden representation and encoding and embedding for each image and then they have this operation called pool and binarize. And so this does two things, namely first of all it pools, it simply averages these things. So it goes 1 over n C of XI, or C of XI I guess. So this simply averages 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. So this here now we have basically lost the information of the exact ordering and so on. This is simply an average of these images. It's a good representation for a set. This is now if we give enough images this will be independent of the particular rendering position and it will only depend on the fact that this is that particular car, if it's trained well of course. And then the second thing is binarize. And here you have to understand what exactly this set latent representation is. How do we encode a set in latent space? And as far as I understand it, what they do is they do the following. Since they don't know how many sets there are, they can't simply do the classic one-hot vector. So what you would do in a class conditional GAN is you would say I have a vector and maybe I have ten classes. So I'll make ten entries right here. Is that ten? I don't know. So if I have C classes I'll make C entries right and I'll put a zero in all of them and a one in where a one where my class is or something like this. So this would be a valid encoding for a class conditional GAN 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 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. This can be 10, this can be 4, 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 one one negative one and so on. So what does that give you? Now you can encode much more than ten classes. In fact you can with this you can encode two to the ten classes. So it's not that they can encode an unlimited set of set identities but they can encode in this manner they can encode a lot. They can encode this many sets using a representation like this. So this binarize operation it will take this output right here and basically clamp it to either one or negative one. So the set will be encoded by a binary vector like this and then the generator and the discriminator take that information. We'll go over what this architectural choice means but right now this you know see that this is a way to encode a large number of set identities in a low dimensional vector. So there are two things now. There are the discriminator and the generator. So first of all the generator is pretty easy. The generators task is to take this Z that we just saw which is the set identity and to generate different instances of that set. For that it needs this noise here. So if you know a generator from a from a GAN it always kind of needs input noise in order to produce different outputs and that's this thing on the right here. This Z' 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 view right here. So the generators task is simply take the set identity and combine each with some noise and produce some views of that set. Now the discriminators task right here is going to be to decide it's going to get a set of views of a set of pictures and it's going to have to decide is this set coming from the generator or is this set coming from the data set. Now you can't simply compare images to each other like you would do in a regular GAN because they don't correspond to each other right but what should correspond to each other is this identity this Z identity. So the discriminator is going to take also two inputs. It's going to take this set right here or you know from the data set and it's going to take this right here this Z. Now this Z is going to be the set identity and that you get from the encoder right it's the same as you get right here you get it from the encoder which set you should produce and the same goes here. So the discriminator knows the set discriminator knows for example I'm trying to produce that particular car and it gets a set of images that is supposedly of that particular car needs to decide does it come from the data set or from the generator. So it uses the same encoder pipeline here it's just a like a CNN giving you a latent representation and then it has two tasks the discriminator has two different tasks. First of all this here is the regular GAN path so it there's an there's an MLP there'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 reconstruct the images which seems kind of weird at the beginning but it you know they say it has helped in other GANs I'm not super familiar with GAN literature but it's just a another objective that you can add. So this is going to be the overview right here so if everything works well we should be able to take a set from the data set X right which is going to be you know 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 and now we don't if the encoder works really well we don't have to have seen that person before it will simply somehow encode the identity in that binary vector then we feed that to the generator together with some noise and we'll get out a set of pictures of different views of that same person or the person with a similar identity and pictures with similar kind of picture style and that if our discriminator works well will look very very similar to or will be images really of that same person and our discriminator if we plug that in right here will agree and we plug in the Z right here okay okay that's the overview now the math so they go about this in this sort of probabilistic framework what they say is we have we denote an image set of size n as X and that it comes from the space of sets of images so capital X right here is going to be a set of images as you see here and this here is the space of all sets of images okay so what they want to do is they want to build a probabilistic model of that so a model where you can input a set and it'll tell you how likely is that now you don't you don't actually have to have a number as an output right here what they often do is they start with a formulation like this and what they end up with is simply a model that allows you to sample from this distribution right from which you can estimate the probability but ultimately what we want is a generator that can sample from this okay so how do they build it they decompose this into two parts and this is just a you know a decomposition this is standard decomposition of probability where you'll say okay what's the probability of a set X the probability of a set X is the probability of the latent code of that set times the conditional probability of that set given the latent code so already we we have we ask ourselves what's the probability of X and what we might ask is huh well X you know if I look at X it has these different images of of this it has these different images of that thing whatever is on the image I can first ask what is the probability of that particular thing on the image and then conditioned on that what is the probability that I'll get these particular images right this is this simple decomposition already kind of builds up this model of encoding decoding so we'll go through that step this here is going to be a deterministic function our encoder and this here is going to be a probabilistic function the the decoder and it's probabilistic because every time you call it basically every time you call the generator it's going to give you a different output because you you're going to feed it different noise at the beginning okay so so this is going to be this is going to be our encoder here and this is going to be our decoder so they say here X is a Z is a deterministic function that maps a set X to an element in a discrete space Z okay this is a discrete space as opposed to maybe a regular autoencoder where you have a continuous space so here we want to discrete space and a lot of mathematical problems are going to arise from the fact that this Z is a discrete space and not a and not a continuous space so here P is a prior distribution with the support given by sub C which means all the Z vectors that have some sort of set associated with them which is a subset of all the Z so that basically means that if if we have a given encoder there not all of these binary vectors are going to be filled even you know with if we plug in all the world's faces into our encoder it might not fill all of the binary capabilities that we have so this prayer is only defined on this support of this and here you already kind of see what what kind of mathematical hurdles you have to go through if you do something like this and all the math here is going or most of the math here is going to deal with the fact that we have this discrete thing and so on and a bit of a bit of a little bit of a of a caveat here also is that this here they 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 your latent your latent code you'll have a prior on it and that prior can be you know some some continuous thing like a Gaussian and even in a regular GAN as I said you you have your your noise distribution and so on what is a prior on that thing now you can say oh a uniform prior but again we would like to learn this prior such that it matches the data set well now they use a prior from a paper that's called made and a DE 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 condition on that it will output the next condition on that it will output the next and this is such that the probability of this binary vector minus 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 consideration of mathematical consideration if you really want to go about really want to go about this sort of thing in a formal fashion so they define two things first of all this prior okay it's a prior distribution that they can learn from the data set and then there is this conditional distribution this what you might call a generator right if you're given a Z a one of these binary codes what's the probability of a given set so you're I tell you here it's a 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 young LeCun gave a talk about this at iClear I believe where he gives a lot of different examples of energy based models so I invite you to check this out I've also done a video on some of these energy based models and what you can do with them here it's simply to define this probabilistic model so what we need to do are two things we need to know what is this energy so what is this energy supposed to do this energy is going to be a function that gives you and now I have to think so its energy is going to be a function that gives you a high value if you are unhappy with the input and it gives you a low value if you are happy with the input okay so you see the negative exponential here which basically means if and also the energy is always positive so the best if you are super duper happy with what is what your input is into the function you'll output 0 so if you output 0 here you'll see that e to the exponential function of negative something is going to be quite small and no maybe I have it wrong maybe you output a really high number when you're really happy I'm not sure but it's one of the two so this comes this comes from from a physics from a physics background no no no I'm right so if you if you output if you're not happy you'll output a super high number here which will make this negative exponential be really close to zero and therefore the probability you say if I'm not happy the probability should be close to zero however if you're really happy you'll output a low number right here now the energy always has to be greater or equal to zero but the lower you go the higher this probability is going to be the bottom thing here is simply to normalize the distribution because in a probability distribution you always have to normalize because otherwise it's not a probability and this is what most of these models basically are fighting over how to normalize the distribution and what we're going to do is simply normalize it by sampling which is what most of these things do you can build energy-based models without this which GANs are a variant of that but okay so what we need to do is we need to come up with this energy function that is going to be a high number when we're not happy with the input now what is the input the input is X and Z X and Z what does it mean we're not happy with the input it means that the the image X and you see X here is one of the images of the set that particular image isn't really congruent with the Z with the identity so you either you say what this this isn't really a picture of scarlet 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 said 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 will basically ask how likely is this set how happy are you with this particular set right here compared to all the sets that could exist that would map to the same identity all right that's why these indicator functions are here and as you can see the part here is simply a normalization where you say I'm just going to produce other I'll consider all the other possible sets of images that map to the same person and I'll simply divide by the energy of those in fact if you do it correctly this particular X is also in that particular set but usually it's going to be a fairly small part but to properly normalize of course you have to consider it as well now this bottom part here as I already said is going to be the main problem of most of these probabilistic methods and as I already said again it's usually approximated by simply sampling a bunch of these sets and not sampling a bunch of these sets and not a by enumerating all the possible sets of images and this sampling is going to make some further problems as we'll see I guess down here so here is what we optimize ultimately we optimize or one of the things we optimize is or 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 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 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 want to train the discriminator to say I'm really really happy that this particular image comes together with this particular identity encoding now the in the in the if it comes from the generator of course you want to do the exact opposite you want to assign it a high value remember energy low means happy with the input okay and then the normalization down here is as I said the problem so you'll see it stated right here because it's under the the division it's going to get a pick up a negative sign which combines with this negative sign which gives you positive sign right here now this part right here is going to be intractable because it it's not going to be feasible to enumerate all the sets of images it's not even going to be feasible to enumerate all the sets of images that just correspond to that particular identity and in fact it's not even going to be feasible to sample from that because we have no clue right we can't simply generate out of the ether true other pictures of the of a particular person what we can do of course is we can use our we can use our model to produce more images right of that particular identity so what we'll do is we'll replace this distribution with a variational distribution and we'll sample from that now this isn't exactly the same this isn't this log probability anymore and that's why first of all we have a bound here and not an equality this is this is called a variational approximation so we bound this quantity and we can only bound this quantity if we down here introduce the entropy of the variational distribution this is a fairly standard trick in variational approximation methods if you want to look more into this look into kind of VAE explain variational autoencoders explained or anything like this will teach you how how these methods work and in case we replace the 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 parameterized in the form of a generator ok so the generators going to produce that distribution it's going to use this noise production so as you know the generator takes two things it takes the identity encoding and a bit of noise and is going to produce an output set or for each noise is 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 learned the prior on the z space so you see you have Z being this binary vectors they say we use a standard autoregressive model made with three fully connected layers mainly for its simplicity and robustness and so again maybe you like it took me a while to get what this prior does this prior is supposed to say it's so it's not in again you have the Z vectors always being some sort of from the standard noise but what you can also do is you can learn better noise distribution a better input distribution for your again by basically making again for your input distribution so what you'll do is you'll have a z zero right here and then you'll use a you learn again to learn better input distributions ok and this is what you do here with these with this prior on Z this is more standard in like VAE's than it is in GANs but it exists so encoder say as a necessary option encoder for a set needs to satisfy the permutation variant property we opt to use a simple architecture design where we let this be the average right here so as you can see this is the average and then they they use this binarize operation and the binarize operation here is clamping the values to one or negative one and it is a straight through estimator which means that you will you back prop through it as if you hadn't clamped but you forward prop through it with clamping this is kind of a trick to get through discretization things discriminators job is to assign low energy to observed images and high energy to generated images given a set code Z we use an auto encoder based energy function implementation 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 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 inputs to a real number either high energy I'm not happy low energy I'm very happy here they also include this thing right here which is a decoder so it's kind of a you can maybe think of it as a another little GAN another another another little generator or the the generator part of a VAE or of an autoencoder sorry not a VAE an autoencoder 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 against observe that this is now with respect to a particular image so here we're trying to reconstruct that particular image because we have its input thing right here and we're it's not the same as the generator that is just asked to produce a some view something that corresponds to this particular identity vector okay the generator generates a set conditioned on a set code by sampling and random variables each of which is concatenated with Z and generates an image independently cool so what the losses they they now introduce some margin losses on the things here but basically you can just translate the what we have on top where we formulated negative log likelihood into the losses right here they do have some simplifications for example this to train the prior you what you are to train to train the encoder I think you have to make a bit of an approximation in that the encoder is supposed to match this this Z vector right and that's not differentiable by itself so they have this sort of l1 approximation right here they leave away the entropy from the loss and they have found that to work well they introduced this margin losses right here I I don't want to go into that too much but basically they simply in a way with some approximations they approximate I hear it is the indicator function they approximate is this I was looking for that they they they optimize this log likelihood from above in the way where they always optimize they keep the generator constant and they optimize the rest of the pipeline so the encoder and the discriminator in the prior and then they keep that rest fixed and they encode the generator so what does that do before remember right here we had this this approximation right here where we said you know what comes out of this we were not really optimizing this we're optimizing we're minimizing a lower bound on it right so here's a quantity that we want to minimize but here's a lower bound and we'll just push that lower bound down by optimizing it 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 will adjust that whenever we adjust our whenever we adjust our our that particular loss our discriminator will adjust that energy function whenever we adjust our encoder we are going to adjust the part that generates the Z vectors right here so we'll push this down but whenever we optimize our generator that's when we make this gap here smaller okay so we always do two steps first we or first or second in one step we reduce this and in the other step we'll bring these two closer together and as a result of course we hope that it's not just the bottom one going to up down up down up down but we hope that both of them reduce with time because the top one is the one will actually want to reduce that's our actual loss or our log likelihood and that is I guess going to happen in practice so what does this do so as I as we already saw here on top you have a set and you feed that through the encoder feed that through the encoder that gives you a Z identity and then you feed that to the generator and the generator you can ask it you don't have to produce the same amount of images you can produce any amount of images you like they just chose to produce the same amount there's no correspondence but you see it's the same truck and here they manually align these so they just produce a bunch of images on the left is the data set and on the right I guess they just produced like a hundred images and then selected wherever the car looked like the closest to so they ordered them by by hand and that is to show that for example look at the the lighting on the car right here it's it's fairly similar I guess this one has red taillights and the other one hasn't but you can see that the the different views are pretty well captured by the generator and that just from all of these are created from one one binary encoding of this here so this is binary encoded to Z and then all of these different views are created there's no image correspondence so that's pretty cool and another problem 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 it 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 quant quantitatively estimate how well they're doing in the faces the the same thing you input the top row into the encoder and you get back the bottom row we've already looked at that but again to evaluate this 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 you can evaluate are these right here all the same people so you can have a a face detector kind of tell you whether or not these are the same people and the second thing is are these down here the same person as these up here right so those are the 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 images so these are curves curves from this face detector and of course for real images as you can see the this is simply the performance of the face detector so you do get some false positives if you if you want more true positives right so this is a standard curve right here because these face detectors are not perfect so in a given row right here in a given row even if that's from the real data set the face detector would sometimes fail and say no that's not the same person even though from the data set you know it is though the the to match the actual child photo from Ali with his adult photos is even like you can forgive the face detector so that's sort of the the gold standard we're trying to achieve and you can see within the reconstructed sets that that is achieved fairly fairly well so compared to uniform samples this is you know fairly fairly cool fairly close what is less close is this reckon and real and I believe that's when you compare the identity of the real row with the identity of the reconstructed row and that's here so that tells you already that it's the GAN or sorry the model doesn't always preserve the actual identity as seen by a face detector and I don't know what to say except yes that's what you see in the data right also you see that free samples I guess so you can do two things right you can give it a set like a row and encode that into the Z and then you can decode that again and basically reconstruct or you can just sample since you've learned a prior on the Z variable you can simply sample you can simply say give me some new identity maybe that I've never seen before right you have some binary vector and now generator please give me images of that identity and these two here are actually sampled like this and you can see again here it's remarkable that within the same row it's pretty much the the rough identity of the person is conserved right and these are these free samples right here I guess and they they do better than whenever you compare the reconstructed and real but they don't do as well as when you actually input a real data and then reconstruct this so this might be an indication that this prior isn't really working you know all too accurately and I do have my problems with this binary encoding right here because maybe I'm misunderstanding something but if you have these binary vectors as we said here the reason you know the reason why you do one hot encoding in class conditional GANs is you could you could simply say what am I doing a one hot encoding I'll simply say Z equals three for class three and Z equals four for class four like that it should be so easy why am I doing one hot and that's because these models see everything in a linear fashion so if you have class three and then I have class four and then I have class nine the model doesn't see that as three different classes the model sees this as these two are somehow closer together than this right so the reason why we do one hot vectors is that the model cannot do this the model has one independent dimension for each of the classes and whenever that particular dimension is high then it knows that that particular class is activated what this binary encoding here does is sort of it goes back to this thing right here where it says okay there are all of these different categories here it's like you have mini classes and the identity of whatever set you consider is now encoded in these mini classes so that I'm going to guess the first thing here might be something like does that person have a blonde hair and the second thing might be does the image look generally bright or the images image set as a whole look generally bright or dark and and so on so I'm gonna guess these things are encoded here and it'll sort of just end up being kind of a discrete GAN or a discrete autoencoder rather than what they believe but maybe that was their goal all along and I'm misunderstanding right here I just don't think this this binarization is gives you this sort of hoped expressiveness I think there's still a lot of dependence of whether or not a particular thing is on or off okay but enough ranting right here I want to look at the at some more of the samples because I've only shown you the reconstructions what I also find interesting is the free samples so here you can see uncurated shape net samples and on the left so here you can see this effect on from the learned order regressive prior and a uniform prior on the right and here you can see this effect of learning this prior so if I learn the prior it's going to give me back fairly okay objects if I don't learn the prior oh but if I learn the prior you know if I learn the prior really really well that basically means I'm only going to ever produce sets that were in the training data right if I learned like a perfect prior I'll see like wait this you know this particular identity here never shows up so I'm not going to output it and the uniform prior might actually output it and the generator is not going to be trained on that uniform prior so it's just going to give you kind of crap and here in the in the faces you see the same thing now again what I think I don't think that's happening what I think is happening is encoding these kind of micro characteristics not per se identity but it's encoding probably you know hair color what not head shape and so on things like this and in each of these dimensions and that's what is then going to produce so these each row here is an is one sample from that prior on the left is learned which you see is working pretty well in terms of the output and on the right you see it's from the uniform prior now you also see here first of all that approximately identity is preserved but not as much in this uniform prior that's first and second you see that the images are much worse which means that the generator doesn't have as much training on that particular thing because I guess it comes from a prior that it hasn't seen during training alright and here lastly they have reconstructions if you give different number of views so the top row I guess is the input the this row is when you just have four different views so I guess just the first four or something like this input and the bottom one is when you have the full eight views and you can I guess see or even more that this increases with number of views so the the accuracy of this identity increases the more views you input of the set and they have a bunch of other things right here in the appendix I I do invite you to look at this and I hope you sort of saw into a bit how you would go about something like this I I found it quite challenging the math because I'm mainly not used to this kind of variational math but I hope this gives you sort of an impression alright this was it from me tell me what you think and I'll see you next time bye bye
[ { "start": 0, "end": 5.1000000000000005, "text": " Hi there, today we're looking at set distribution networks, a generative model" }, { "start": 5.1000000000000005, "end": 10.88, "text": " for sets of images by Xuangfei Chai, Walter Tablet, Miguel Angel Bautista, Carlos" }, { "start": 10.88, "end": 17.080000000000002, "text": " Gestrin and Josh M. Suskind of Apple. So this paper introduces a generative model" }, { "start": 17.080000000000002, "end": 23.12, "text": " for sets and it does so in an energy-based model fashion. It will have" }, { "start": 23.12, "end": 28.7, "text": " an encoder, a decoder in form of a generator, it will have a discriminator" }, { "start": 28.7, "end": 34.6, "text": " and it will have all kinds of math but the end result is a model that can" }, { "start": 34.6, "end": 42.68, "text": " generate sets of images and by sets we mean it can generate different kind of" }, { "start": 42.68, "end": 48.92, "text": " views on the same identity of image and you'll see what that means and it can" }, { "start": 48.92, "end": 52.96, "text": " generate even sets that it has never seen before which makes it different" }, { "start": 52.96, "end": 59.6, "text": " from a class conditional GAN or something like this. So I can't really" }, { "start": 59.6, "end": 64.16, "text": " describe it on a high level in a very concise fashion, you'll just have to" }, { "start": 64.16, "end": 69.68, "text": " stick around and see what's going on right here. So if you like content" }, { "start": 69.68, "end": 74.48, "text": " like this feel also free to share it out and leave it a like, tell me in the" }, { "start": 74.48, "end": 78.44, "text": " comments what you like. This is going to be a fairly math heavy paper and I'll" }, { "start": 78.44, "end": 83.96, "text": " try my best to kind of distill it down to what's happening because ultimately" }, { "start": 83.96, "end": 89.12, "text": " it's not that difficult. Alright so if you have a look at these samples right" }, { "start": 89.12, "end": 93.8, "text": " here these are examples of sets of images. Now without actually caring for" }, { "start": 93.8, "end": 98.36, "text": " top and bottom row they will have some meaning right here. Top row is always a" }, { "start": 98.36, "end": 103.92, "text": " row from the actual data set and the bottom row is the reconstruction of that" }, { "start": 103.92, "end": 110.4, "text": " set. Now you'll see that the images don't really have a correspondence so" }, { "start": 110.4, "end": 115.32000000000001, "text": " you see it's the same truck in the top and the bottom row but the orientation" }, { "start": 115.32000000000001, "end": 119.56, "text": " here isn't really shared or anything and that's because as we said this is a set" }, { "start": 119.56, "end": 124.72, "text": " network. So what you want to do in this problem setting is you want to take, you" }, { "start": 124.72, "end": 129.84, "text": " want to build a model that can take this set right here from the data set and it" }, { "start": 129.84, "end": 137.96, "text": " can encode it into a latent description that we call z. z simply describes the" }, { "start": 137.96, "end": 146.56, "text": " set as a whole. So z here would be, sorry, would be truck right? It would sort of be" }, { "start": 146.56, "end": 153.72, "text": " the 3D model so not the class truck but the 3D information of the truck" }, { "start": 153.72, "end": 159.36, "text": " without having any information of the different views okay? And then you want" }, { "start": 159.36, "end": 165.12, "text": " to build another model that can generate from this low level representation of" }, { "start": 165.12, "end": 171.56, "text": " the set, can generate the different views okay? Like each one of these by sort of" }, { "start": 171.56, "end": 176.88000000000002, "text": " rotating it. So we want to build a model that understands just from the pixels" }, { "start": 176.88000000000002, "end": 182.96, "text": " that here we have sets of things that they somehow always share a commonality" }, { "start": 182.96, "end": 188.52, "text": " and in this case they always share their 3D structure right? What they don't share" }, { "start": 188.52, "end": 193.4, "text": " is the view where they rendered from. So our model is supposed to kind of parse" }, { "start": 193.4, "end": 198.44, "text": " the two apart and encode that 3D structure just from the pixels in this" }, { "start": 198.44, "end": 204.16000000000003, "text": " z variable and then encode the fact that you can rotate it and look at it from" }, { "start": 204.16000000000003, "end": 209.34, "text": " different views into the generative model that then produces the different" }, { "start": 209.34, "end": 215.72, "text": " views okay? And the reason why there is no correspondence between the views is" }, { "start": 215.72, "end": 221.44, "text": " we simply regard these things as sets. So our final objective is simply going" }, { "start": 221.44, "end": 228.64, "text": " to be that the set on top is different views of that particular truck is going" }, { "start": 228.64, "end": 233.56, "text": " to be very similar to the set on the bottom which is also different views of" }, { "start": 233.56, "end": 239.48, "text": " that particular truck and that's what our model is supposed to do. Now you" }, { "start": 239.48, "end": 243.76, "text": " might know something like this from where you can simply say well this this" }, { "start": 243.76, "end": 250.84, "text": " looks like a class conditional GAN right? I simply have the class truck and I you" }, { "start": 250.84, "end": 255.35999999999999, "text": " know I feed this to my generator and my discriminator and my encoder and so on" }, { "start": 255.35999999999999, "end": 260.76, "text": " and it will produce the same truck and here that and here the bench and so on." }, { "start": 260.76, "end": 265.3, "text": " The problem I guess becomes more apparent when you go to this different" }, { "start": 265.3, "end": 272.48, "text": " data set. So this is a face data set and again top row being the input and bottom" }, { "start": 272.48, "end": 278, "text": " row being the output. Now what is here what is supposed to be preserved you can" }, { "start": 278, "end": 284.08000000000004, "text": " kind of see in the images is sort of the identity of the person on the photo. Now" }, { "start": 284.08000000000004, "end": 288.84000000000003, "text": " you have to kind of gloss around your human bias here. You as a human" }, { "start": 288.84000000000003, "end": 295.32, "text": " can tell extremely tiny differences between faces and therefore none of the" }, { "start": 295.32, "end": 299.68, "text": " actual identities are going to be preserved right? So this on the top I" }, { "start": 299.68, "end": 308.56, "text": " believe is Ali and on on the bottom here it's not not Ali. So but you'll have to" }, { "start": 308.56, "end": 313.12, "text": " sort of gloss around this and you'll see that what is preserved or what is" }, { "start": 313.12, "end": 318.4, "text": " supposed to be preserved is something like the rough identity of the person on" }, { "start": 318.4, "end": 324.52, "text": " the picture and also a little bit of the image compositions. So you see here in" }, { "start": 324.52, "end": 330.79999999999995, "text": " the background you often have sort of these sports backgrounds right where" }, { "start": 330.79999999999995, "end": 335.12, "text": " there's kind of a washed out stadium or whatnot and you can see that this is" }, { "start": 335.12, "end": 340.26, "text": " also preserved here. I think it's kind of a glamour glamour shots of this must be" }, { "start": 340.26, "end": 345.96, "text": " some sort of glamour model and you'll see that this as well is preserved. What" }, { "start": 345.96, "end": 352.35999999999996, "text": " is different within each set is of course the different views on the same" }, { "start": 352.36, "end": 356.56, "text": " identity right? So you have the same person and you have pictures of them in" }, { "start": 356.56, "end": 360.72, "text": " different of different views, different lighting, different hairstyles and so on." }, { "start": 360.72, "end": 365.52000000000004, "text": " Here you even see you have the black and white image and the set that is produced" }, { "start": 365.52000000000004, "end": 370.04, "text": " also contains some black and white images. So this model this is already the" }, { "start": 370.04, "end": 376.08000000000004, "text": " trained model here is doing a fairly good job. Here you can see that almost" }, { "start": 376.08000000000004, "end": 381.08000000000004, "text": " all the pictures have some sort of double like two people with one being" }, { "start": 381.08, "end": 387.28, "text": " sort of half in frame and it leads to a fairly strange thing. I'm gonna" }, { "start": 387.28, "end": 391.64, "text": " guess the model hasn't seen lots of that during training. I like it, particularly" }, { "start": 391.64, "end": 399.15999999999997, "text": " like this. This is pretty good. Also here we know that a lot of these face" }, { "start": 399.15999999999997, "end": 405.36, "text": " datasets they don't really have bald people all too often so you can see here" }, { "start": 405.36, "end": 411.84000000000003, "text": " this results in sort of kind of a weird Richard Branson type picture. In any case" }, { "start": 411.84000000000003, "end": 421.36, "text": " it does a fairly good job as you can see right here. And what's" }, { "start": 421.36, "end": 426.32, "text": " the problem with these faces? Can't we just do a class conditional again where" }, { "start": 426.32, "end": 431.6, "text": " we basically say here this is Ali and that's one class in our latent" }, { "start": 431.6, "end": 437.12, "text": " vector and then and so on. What we want to do is we want to train something like" }, { "start": 437.12, "end": 441.6, "text": " this where we can give in a new identity that we haven't seen during" }, { "start": 441.6, "end": 445.6, "text": " training. In fact we want to train something where we don't even know how" }, { "start": 445.6, "end": 450.68, "text": " many sets there are going to be in the end. We simply want to train" }, { "start": 450.68, "end": 455.56, "text": " it in a way where we say look I'm going to give you a set and the set will have" }, { "start": 455.56, "end": 462.68, "text": " images of the same person and you're going to sort of reconstruct that in a" }, { "start": 462.68, "end": 467.36, "text": " way where you output a set of images of that person conserving the" }, { "start": 467.36, "end": 472.88, "text": " identity of the person and the rough style of the picture. So this is really" }, { "start": 472.88, "end": 477.48, "text": " different from a class conditional again as in we don't know how many classes" }, { "start": 477.48, "end": 484.74, "text": " there are and there can be new unseen ones during testing. So how do we go" }, { "start": 484.74, "end": 491.7, "text": " about something like this? And here is where the thing starts. So we're" }, { "start": 491.7, "end": 495.26, "text": " going to dive into a bit of the math here and then into a bit of the" }, { "start": 495.26, "end": 501.3, "text": " reasoning but ultimately what they're going to do is they're going to build" }, { "start": 501.3, "end": 512.04, "text": " three things. They're going to build an encoder, a discriminator, and a" }, { "start": 512.04, "end": 518.76, "text": " generator. So what does the encoder do? And remember our task here is going to" }, { "start": 518.76, "end": 525.48, "text": " be the way we train it is going to be by reconstruction, at least one way we train" }, { "start": 525.48, "end": 530.48, "text": " it. So the encoder is going to take this set of images that we give it, for" }, { "start": 530.48, "end": 536.12, "text": " example here different views of this car, and is going to produce this" }, { "start": 536.12, "end": 542.5600000000001, "text": " representation, this set representation. Now what should a" }, { "start": 542.5600000000001, "end": 547.6, "text": " property be of the set representation? For example it should be independent of" }, { "start": 547.6, "end": 552.68, "text": " the ordering of these inputs. A set is simply a collection of objects, it's" }, { "start": 552.68, "end": 558.12, "text": " independent of the ordering, and it's also independent of the size in some way." }, { "start": 558.12, "end": 562.28, "text": " Of course a bigger set gives you more information but the set identity, the" }, { "start": 562.28, "end": 567.4, "text": " fact that this is this particular car, is independent of how many views you have." }, { "start": 567.4, "end": 575.48, "text": " So what they do is they build and they put each image through an encoder which" }, { "start": 575.48, "end": 581.72, "text": " is a convolutional neural network and I guess that gives them a hidden" }, { "start": 581.72, "end": 586.5799999999999, "text": " representation and encoding and embedding for each image and then they" }, { "start": 586.5799999999999, "end": 591.12, "text": " have this operation called pool and binarize. And so this does two" }, { "start": 591.12, "end": 597.72, "text": " things, namely first of all it pools, it simply averages these things. So it goes" }, { "start": 597.72, "end": 612.52, "text": " 1 over n C of XI, or C of XI I guess. So this simply averages these" }, { "start": 612.52, "end": 618.6800000000001, "text": " encodings right here and this already fulfills our property. So this average is" }, { "start": 618.68, "end": 624.3599999999999, "text": " independent of the order of the images and also I can add more and I can add" }, { "start": 624.3599999999999, "end": 629.4799999999999, "text": " less in expectation the average will result in the same thing. So this" }, { "start": 629.4799999999999, "end": 635.76, "text": " here now we have basically lost the information of the exact" }, { "start": 635.76, "end": 640.4599999999999, "text": " ordering and so on. This is simply an average of these images. It's a good" }, { "start": 640.4599999999999, "end": 645.8, "text": " representation for a set. This is now if we give enough images this will be" }, { "start": 645.8, "end": 651.52, "text": " independent of the particular rendering position and it will only depend on the" }, { "start": 651.52, "end": 658.3599999999999, "text": " fact that this is that particular car, if it's trained well of course. And then the" }, { "start": 658.3599999999999, "end": 664, "text": " second thing is binarize. And here you have to understand what" }, { "start": 664, "end": 671.24, "text": " exactly this set latent representation is. How do we encode a set in latent" }, { "start": 671.24, "end": 678.32, "text": " space? And as far as I understand it, what they do is they do" }, { "start": 678.32, "end": 684.76, "text": " the following. Since they don't know how many sets there are, they can't simply" }, { "start": 684.76, "end": 688.8, "text": " do the classic one-hot vector. So what you would do in a class conditional" }, { "start": 688.8, "end": 694.04, "text": " GAN is you would say I have a vector and maybe I have ten classes. So I'll make ten" }, { "start": 694.04, "end": 700.32, "text": " entries right here. Is that ten? I don't know. So if I have C classes I'll" }, { "start": 700.32, "end": 710, "text": " make C entries right and I'll put a zero in all of them and a one in where a one" }, { "start": 710, "end": 714.84, "text": " where my class is or something like this. So this would be a valid encoding for a" }, { "start": 714.84, "end": 722.44, "text": " class conditional GAN to represent the identity of the class. Here however no we" }, { "start": 722.44, "end": 728.6600000000001, "text": " don't know. And also we can't really make this continuous because other if you" }, { "start": 728.66, "end": 734.88, "text": " make this continuous you wouldn't really encode the identity of the set." }, { "start": 734.88, "end": 741.88, "text": " You would encode more of a continuous latent space and then" }, { "start": 741.88, "end": 747.6, "text": " that becomes kind of different when you have new sets and so on. So what they" }, { "start": 747.6, "end": 753.4399999999999, "text": " really want to do is they want to make this representation here be a description" }, { "start": 753.44, "end": 759.0400000000001, "text": " of the set itself but not a one-hot. So what do we do? What they do is they do" }, { "start": 759.0400000000001, "end": 765.12, "text": " the same thing. They have a vector but not of size C because they don't know C" }, { "start": 765.12, "end": 771.72, "text": " but of some dimensionality D. This can be 10, this can be 4, this can be" }, { "start": 771.72, "end": 777.72, "text": " you know whatever. Just let's say it's 10 again but we don't know how many" }, { "start": 777.72, "end": 785.2, "text": " classes there are. What the model can do is it can encode each class as a binary" }, { "start": 785.2, "end": 790.96, "text": " vector, a binary combination of negative ones and ones. So it can put like a" }, { "start": 790.96, "end": 797.32, "text": " negative one here a one negative one negative one one one negative one and so" }, { "start": 797.32, "end": 804.8000000000001, "text": " on. So what does that give you? Now you can encode much more than ten" }, { "start": 804.8, "end": 809.5999999999999, "text": " classes. In fact you can with this you can encode two to the ten classes." }, { "start": 809.5999999999999, "end": 819.28, "text": " So it's not that they can encode an unlimited set of" }, { "start": 819.28, "end": 826.12, "text": " set identities but they can encode in this manner they can encode a lot." }, { "start": 826.12, "end": 831.3599999999999, "text": " They can encode this many sets using a representation like this. So this" }, { "start": 831.36, "end": 837.08, "text": " binarize operation it will take this output right here and basically clamp it" }, { "start": 837.08, "end": 843.24, "text": " to either one or negative one. So the set will be encoded by a binary vector like" }, { "start": 843.24, "end": 848.4, "text": " this and then the generator and the discriminator take that information." }, { "start": 848.4, "end": 854.8000000000001, "text": " We'll go over what this architectural choice means but right" }, { "start": 854.8, "end": 862.28, "text": " now this you know see that this is a way to encode a large number of" }, { "start": 862.28, "end": 872, "text": " set identities in a low dimensional vector. So there are two things now." }, { "start": 872, "end": 877.4799999999999, "text": " There are the discriminator and the generator. So first of all the generator" }, { "start": 877.48, "end": 885.04, "text": " is pretty easy. The generators task is to take this Z that we just saw which is" }, { "start": 885.04, "end": 894.6800000000001, "text": " the set identity and to generate different instances of that set." }, { "start": 894.6800000000001, "end": 899.9200000000001, "text": " For that it needs this noise here. So if you know a generator from a from a" }, { "start": 899.9200000000001, "end": 904.76, "text": " GAN it always kind of needs input noise in order to produce different" }, { "start": 904.76, "end": 908.4, "text": " outputs and that's this thing on the right here. This Z' they simply come" }, { "start": 908.4, "end": 915.28, "text": " from some sort of latent distribution. I think they call this P of psi which is" }, { "start": 915.28, "end": 918.8, "text": " some like a uniform or a Gaussian or something. You just sample some noise" }, { "start": 918.8, "end": 923.52, "text": " right and you combine it with this thing right here which is the set identity." }, { "start": 923.52, "end": 928.4, "text": " You concatenate it and then each one of these different Z will produce one" }, { "start": 928.4, "end": 937.92, "text": " different view right here. So the generators task is simply take" }, { "start": 937.92, "end": 946.76, "text": " the set identity and combine each with some noise and produce some views of" }, { "start": 946.76, "end": 953.92, "text": " that set. Now the discriminators task right here is going to be to decide it's" }, { "start": 953.92, "end": 961.28, "text": " going to get a set of views of a set of pictures and it's going to have to" }, { "start": 961.28, "end": 968.28, "text": " decide is this set coming from the generator or is this set coming from the" }, { "start": 968.28, "end": 973.4399999999999, "text": " data set. Now you can't simply compare images to each other like you" }, { "start": 973.4399999999999, "end": 977.8399999999999, "text": " would do in a regular GAN because they don't correspond to each other right but" }, { "start": 977.84, "end": 984.48, "text": " what should correspond to each other is this identity this Z identity. So the" }, { "start": 984.48, "end": 991.52, "text": " discriminator is going to take also two inputs. It's going to take this set right" }, { "start": 991.52, "end": 997.44, "text": " here or you know from the data set and it's going to take this right here this" }, { "start": 997.44, "end": 1005.88, "text": " Z. Now this Z is going to be the set identity and that you get from the" }, { "start": 1005.88, "end": 1010.84, "text": " encoder right it's the same as you get right here you get it from the encoder" }, { "start": 1010.84, "end": 1017.16, "text": " which set you should produce and the same goes here. So the discriminator knows" }, { "start": 1017.16, "end": 1021.72, "text": " the set discriminator knows for example I'm trying to produce that particular" }, { "start": 1021.72, "end": 1027.32, "text": " car and it gets a set of images that is supposedly of that particular car needs" }, { "start": 1027.32, "end": 1031.96, "text": " to decide does it come from the data set or from the generator. So it uses the" }, { "start": 1031.96, "end": 1036.92, "text": " same encoder pipeline here it's just a like a CNN giving you a latent" }, { "start": 1036.92, "end": 1042.76, "text": " representation and then it has two tasks the discriminator has two different" }, { "start": 1042.76, "end": 1051.6000000000001, "text": " tasks. First of all this here is the regular GAN path so it there's an" }, { "start": 1051.6000000000001, "end": 1056.1200000000001, "text": " there's an MLP there's simply a pipeline that outputs a number and the number is" }, { "start": 1056.1200000000001, "end": 1061.32, "text": " does this come from the data set or does this come from the generator but then" }, { "start": 1061.32, "end": 1066.2, "text": " there is an additional pipeline that they have found to be vital to train" }, { "start": 1066.2, "end": 1070.6799999999998, "text": " the objective which is a reconstruction pipeline. So this is more like a sort of" }, { "start": 1070.6799999999998, "end": 1075.6799999999998, "text": " like an auto encoder pipeline where they have a decoder they try to reconstruct" }, { "start": 1075.6799999999998, "end": 1082.9199999999998, "text": " the input set and they then compare it using mean squared error. Now here they" }, { "start": 1082.9199999999998, "end": 1088.56, "text": " try to reconstruct the input set really picture by picture not as a set but" }, { "start": 1088.56, "end": 1093.32, "text": " picture by picture so that's it's different from the set generator okay and" }, { "start": 1093.32, "end": 1098.24, "text": " this is this pipeline is just to stabilize the training but it also goes" }, { "start": 1098.24, "end": 1105.84, "text": " into this the output of the discriminator. So sort of the discriminator" }, { "start": 1105.84, "end": 1112.6, "text": " is happier the more it can reconstruct the images which seems" }, { "start": 1112.6, "end": 1117.8, "text": " kind of weird at the beginning but it you know they say it has helped in other" }, { "start": 1117.8, "end": 1122.3999999999999, "text": " GANs I'm not super familiar with GAN literature but it's just a another" }, { "start": 1122.3999999999999, "end": 1126.96, "text": " objective that you can add. So this is going to be the overview right here so" }, { "start": 1126.96, "end": 1134.6, "text": " if everything works well we should be able to take a set from the data set X" }, { "start": 1134.6, "end": 1140.36, "text": " right which is going to be you know images different images from the same" }, { "start": 1140.36, "end": 1145.68, "text": " person we should be able to feed that to the encoder get a latent representation" }, { "start": 1145.68, "end": 1151.2, "text": " Z for that set that somehow encodes here the identity of the person and now we" }, { "start": 1151.2, "end": 1156.6000000000001, "text": " don't if the encoder works really well we don't have to have seen that person" }, { "start": 1156.6000000000001, "end": 1162.3200000000002, "text": " before it will simply somehow encode the identity in that binary vector then we" }, { "start": 1162.3200000000002, "end": 1169.76, "text": " feed that to the generator together with some noise and we'll get out a set of" }, { "start": 1169.76, "end": 1175.28, "text": " pictures of different views of that same person or the person with a similar" }, { "start": 1175.28, "end": 1182.6, "text": " identity and pictures with similar kind of picture style and that if our" }, { "start": 1182.6, "end": 1189.68, "text": " discriminator works well will look very very similar to or will be images really" }, { "start": 1189.68, "end": 1193.44, "text": " of that same person and our discriminator if we plug that in right" }, { "start": 1193.44, "end": 1196.96, "text": " here will agree and we plug in the Z right here" }, { "start": 1196.96, "end": 1207.4, "text": " okay okay that's the overview now the math so they go about this in this sort" }, { "start": 1207.4, "end": 1214.08, "text": " of probabilistic framework what they say is we have we denote an image set of" }, { "start": 1214.08, "end": 1221.48, "text": " size n as X and that it comes from the space of sets of images so capital X" }, { "start": 1221.48, "end": 1228.8, "text": " right here is going to be a set of images as you see here and this here is" }, { "start": 1228.8, "end": 1233.88, "text": " the space of all sets of images okay so what they want to do is they want to" }, { "start": 1233.88, "end": 1240.64, "text": " build a probabilistic model of that so a model where you can input a set and" }, { "start": 1240.64, "end": 1245.4, "text": " it'll tell you how likely is that now you don't you don't actually have to" }, { "start": 1245.4, "end": 1250.48, "text": " have a number as an output right here what they often do is they start with a" }, { "start": 1250.48, "end": 1254.96, "text": " formulation like this and what they end up with is simply a model that allows" }, { "start": 1254.96, "end": 1260.04, "text": " you to sample from this distribution right from which you can estimate the" }, { "start": 1260.04, "end": 1266.24, "text": " probability but ultimately what we want is a generator that can sample from this" }, { "start": 1266.24, "end": 1272.48, "text": " okay so how do they build it they decompose this into two parts and this" }, { "start": 1272.48, "end": 1276.88, "text": " is just a you know a decomposition this is standard decomposition of probability" }, { "start": 1276.88, "end": 1284.5600000000002, "text": " where you'll say okay what's the probability of a set X the probability" }, { "start": 1284.5600000000002, "end": 1292.0400000000002, "text": " of a set X is the probability of the latent code of that set times the" }, { "start": 1292.0400000000002, "end": 1298.16, "text": " conditional probability of that set given the latent code so already we we" }, { "start": 1298.16, "end": 1303.2800000000002, "text": " have we ask ourselves what's the probability of X and what we might ask" }, { "start": 1303.28, "end": 1313.6399999999999, "text": " is huh well X you know if I look at X it has these different images of of this" }, { "start": 1313.6399999999999, "end": 1318.44, "text": " it has these different images of that thing whatever is on the image I can" }, { "start": 1318.44, "end": 1323.92, "text": " first ask what is the probability of that particular thing on the image and" }, { "start": 1323.92, "end": 1329.8799999999999, "text": " then conditioned on that what is the probability that I'll get these" }, { "start": 1329.88, "end": 1337, "text": " particular images right this is this simple decomposition already kind of" }, { "start": 1337, "end": 1344.5200000000002, "text": " builds up this model of encoding decoding so we'll go through that step" }, { "start": 1344.5200000000002, "end": 1349.5600000000002, "text": " this here is going to be a deterministic function our encoder and this here is" }, { "start": 1349.5600000000002, "end": 1353.8000000000002, "text": " going to be a probabilistic function the the decoder and it's probabilistic" }, { "start": 1353.8000000000002, "end": 1358.3600000000001, "text": " because every time you call it basically every time you call the generator it's" }, { "start": 1358.36, "end": 1361.4799999999998, "text": " going to give you a different output because you you're going to feed it" }, { "start": 1361.4799999999998, "end": 1370.36, "text": " different noise at the beginning okay so so this is going to be this is going to" }, { "start": 1370.36, "end": 1382.36, "text": " be our encoder here and this is going to be our decoder so they say here X is a" }, { "start": 1382.36, "end": 1388, "text": " Z is a deterministic function that maps a set X to an element in a discrete" }, { "start": 1388, "end": 1395.56, "text": " space Z okay this is a discrete space as opposed to maybe a regular autoencoder" }, { "start": 1395.56, "end": 1402.6, "text": " where you have a continuous space so here we want to discrete space and a lot" }, { "start": 1402.6, "end": 1406.8, "text": " of mathematical problems are going to arise from the fact that this Z is a" }, { "start": 1406.8, "end": 1416.24, "text": " discrete space and not a and not a continuous space so here P is a prior" }, { "start": 1416.24, "end": 1423.04, "text": " distribution with the support given by sub C which means all the Z vectors that" }, { "start": 1423.04, "end": 1430.4, "text": " have some sort of set associated with them which is a subset of all the Z so" }, { "start": 1430.4, "end": 1436.76, "text": " that basically means that if if we have a given encoder there not all of these" }, { "start": 1436.76, "end": 1442.94, "text": " binary vectors are going to be filled even you know with if we plug in all the" }, { "start": 1442.94, "end": 1449.96, "text": " world's faces into our encoder it might not fill all of the binary capabilities" }, { "start": 1449.96, "end": 1456.16, "text": " that we have so this prayer is only defined on this support of this and here" }, { "start": 1456.16, "end": 1460.52, "text": " you already kind of see what what kind of mathematical hurdles you have to go" }, { "start": 1460.52, "end": 1464.3600000000001, "text": " through if you do something like this and all the math here is going or most" }, { "start": 1464.3600000000001, "end": 1468.16, "text": " of the math here is going to deal with the fact that we have this discrete" }, { "start": 1468.16, "end": 1478.3600000000001, "text": " thing and so on and a bit of a bit of a little bit of a of a caveat here also is" }, { "start": 1478.3600000000001, "end": 1483.6000000000001, "text": " that this here they mentioned this here is a prior you need a prior" }, { "start": 1483.6000000000001, "end": 1493.1200000000001, "text": " distribution on your Z variables and this is also not easy so really quickly" }, { "start": 1493.12, "end": 1498.3999999999999, "text": " what does it mean to have a prior distribution on this kind of thing because" }, { "start": 1498.3999999999999, "end": 1502.7199999999998, "text": " usually in a regular like auto encoder variational auto encoder right your" }, { "start": 1502.7199999999998, "end": 1509.84, "text": " latent your latent code you'll have a prior on it and that prior can be you" }, { "start": 1509.84, "end": 1515.52, "text": " know some some continuous thing like a Gaussian and even in a regular GAN as I" }, { "start": 1515.52, "end": 1520.12, "text": " said you you have your your noise distribution and so on what is a prior" }, { "start": 1520.12, "end": 1526.8, "text": " on that thing now you can say oh a uniform prior but again we would like to" }, { "start": 1526.8, "end": 1532.9199999999998, "text": " learn this prior such that it matches the data set well now they use a prior" }, { "start": 1532.9199999999998, "end": 1538.4399999999998, "text": " from a paper that's called made and a DE and really quickly what it does is it" }, { "start": 1538.4399999999998, "end": 1545, "text": " sort of kind of decomposes this thing so what you'll have is a neural network" }, { "start": 1545, "end": 1550.24, "text": " that outputs binary vectors like this and it will sort of output them in a" }, { "start": 1550.24, "end": 1557.4, "text": " fashion auto regressively so it will output one of them and then condition on" }, { "start": 1557.4, "end": 1561.12, "text": " that it will output the next condition on that it will output the next and this" }, { "start": 1561.12, "end": 1566.36, "text": " is such that the probability of this binary vector minus 1 1 1 minus 1 and so" }, { "start": 1566.36, "end": 1571.44, "text": " on is going to be decomposed into the probability that there's a minus 1 here" }, { "start": 1571.44, "end": 1575.8, "text": " times the probability that there is a 1 here given that there is a minus 1 here" }, { "start": 1575.8, "end": 1581.16, "text": " and so on and in different order I don't really want to go into this but just to" }, { "start": 1581.16, "end": 1584.72, "text": " show you that there is a lot of consideration of mathematical" }, { "start": 1584.72, "end": 1589.52, "text": " consideration if you really want to go about really want to go about this sort" }, { "start": 1589.52, "end": 1595.72, "text": " of thing in a formal fashion so they define two things first of all this" }, { "start": 1595.72, "end": 1600.88, "text": " prior okay it's a prior distribution that they can learn from the data set" }, { "start": 1600.88, "end": 1607.1200000000001, "text": " and then there is this conditional distribution this what you might call a" }, { "start": 1607.1200000000001, "end": 1613.3200000000002, "text": " generator right if you're given a Z a one of these binary codes what's the" }, { "start": 1613.3200000000002, "end": 1621.3200000000002, "text": " probability of a given set so you're I tell you here it's a Scarlett Johansson" }, { "start": 1621.3200000000002, "end": 1626.6000000000001, "text": " what's the probability of these pictures being different views of Scarlett" }, { "start": 1626.6, "end": 1634.1999999999998, "text": " Johansson so that is going to be simply we're going to build this as an energy" }, { "start": 1634.1999999999998, "end": 1639.56, "text": " based model you can you can do this what you'll have to do is you'll have to" }, { "start": 1639.56, "end": 1644.9599999999998, "text": " define an energy and we'll just quickly discuss what that is and then you can" }, { "start": 1644.9599999999998, "end": 1650.84, "text": " build a construct like this where you'll say the probability of a given set is" }, { "start": 1650.84, "end": 1657.28, "text": " going to be the energy that assigned to that set divided by the energy that I'm" }, { "start": 1657.28, "end": 1663.56, "text": " going to assign to all of these other sets so this is it's a form of an energy" }, { "start": 1663.56, "end": 1668.1999999999998, "text": " based model you can phrase very many things in terms of these energy based" }, { "start": 1668.1999999999998, "end": 1674.28, "text": " models and young LeCun gave a talk about this at iClear I believe where he gives" }, { "start": 1674.28, "end": 1679.32, "text": " a lot of different examples of energy based models so I invite you to check" }, { "start": 1679.32, "end": 1684.6, "text": " this out I've also done a video on some of these energy based models and what" }, { "start": 1684.6, "end": 1692.72, "text": " you can do with them here it's simply to define this probabilistic model so what" }, { "start": 1692.72, "end": 1698.48, "text": " we need to do are two things we need to know what is this energy so what is this" }, { "start": 1698.48, "end": 1703.52, "text": " energy supposed to do this energy is going to be a function that gives you" }, { "start": 1703.52, "end": 1710.72, "text": " and now I have to think so its energy is going to be a function that gives you a" }, { "start": 1710.72, "end": 1717.92, "text": " high value if you are unhappy with the input and it gives you a low value if" }, { "start": 1717.92, "end": 1724.76, "text": " you are happy with the input okay so you see the negative exponential here which" }, { "start": 1724.76, "end": 1731.44, "text": " basically means if and also the energy is always positive so the best if you" }, { "start": 1731.44, "end": 1737.4, "text": " are super duper happy with what is what your input is into the function you'll" }, { "start": 1737.4, "end": 1745.56, "text": " output 0 so if you output 0 here you'll see that e to the exponential function" }, { "start": 1745.56, "end": 1754.3200000000002, "text": " of negative something is going to be quite small and no maybe I have it wrong" }, { "start": 1754.32, "end": 1761.76, "text": " maybe you output a really high number when you're really happy I'm not sure but" }, { "start": 1761.76, "end": 1769.72, "text": " it's one of the two so this comes this comes from from a physics from a physics" }, { "start": 1769.72, "end": 1776.2, "text": " background no no no I'm right so if you if you output if you're not happy you'll" }, { "start": 1776.2, "end": 1781.2, "text": " output a super high number here which will make this negative exponential be" }, { "start": 1781.2, "end": 1786.96, "text": " really close to zero and therefore the probability you say if I'm not happy the" }, { "start": 1786.96, "end": 1793.1200000000001, "text": " probability should be close to zero however if you're really happy you'll" }, { "start": 1793.1200000000001, "end": 1797.8400000000001, "text": " output a low number right here now the energy always has to be greater or equal" }, { "start": 1797.8400000000001, "end": 1803.16, "text": " to zero but the lower you go the higher this probability is going to be the" }, { "start": 1803.16, "end": 1808.04, "text": " bottom thing here is simply to normalize the distribution because in a probability" }, { "start": 1808.04, "end": 1813.48, "text": " distribution you always have to normalize because otherwise it's not a" }, { "start": 1813.48, "end": 1821.72, "text": " probability and this is what most of these models basically are fighting over" }, { "start": 1821.72, "end": 1825.6399999999999, "text": " how to normalize the distribution and what we're going to do is simply" }, { "start": 1825.6399999999999, "end": 1830.28, "text": " normalize it by sampling which is what most of these things do you can build" }, { "start": 1830.28, "end": 1837.44, "text": " energy-based models without this which GANs are a variant of that but" }, { "start": 1837.44, "end": 1842.16, "text": " okay so what we need to do is we need to come up with this energy function that" }, { "start": 1842.16, "end": 1846.96, "text": " is going to be a high number when we're not happy with the input now what is the" }, { "start": 1846.96, "end": 1853, "text": " input the input is X and Z X and Z what does it mean we're not happy with the" }, { "start": 1853, "end": 1859.68, "text": " input it means that the the image X and you see X here is one of the images of" }, { "start": 1859.68, "end": 1864.96, "text": " the set that particular image isn't really congruent with the Z with the" }, { "start": 1864.96, "end": 1871.16, "text": " identity so you either you say what this this isn't really a picture of scarlet" }, { "start": 1871.16, "end": 1876.96, "text": " Johansson so I'm going to assign this a high value however if you know if this" }, { "start": 1876.96, "end": 1882.72, "text": " is really any sort of picture of of that person then you're going to assign it a" }, { "start": 1882.72, "end": 1888.44, "text": " low value and how better to do this than to build a neural network to do that and" }, { "start": 1888.44, "end": 1894.76, "text": " this is going to be our discriminator so our discriminator is going to take the" }, { "start": 1894.76, "end": 1903.8, "text": " role of this energy function okay cool now I said you need to normalize and I" }, { "start": 1903.8, "end": 1909.32, "text": " kind of said it off the cuff and so on but the problem here is again we have" }, { "start": 1909.32, "end": 1915.48, "text": " this kind of sets and and so on so our probability as you'll notice is the" }, { "start": 1915.48, "end": 1923.8, "text": " probability of X given Z so we are already given the the identity of the" }, { "start": 1923.8, "end": 1929.48, "text": " person so what do we need to normalize by we can't simply normalize by all the" }, { "start": 1929.48, "end": 1934.24, "text": " sets of images in the world like here it's in the integral we need to" }, { "start": 1934.24, "end": 1943.12, "text": " normalize by all the sets of images that are mapped to that same identity okay so" }, { "start": 1943.12, "end": 1949, "text": " in order to normalize the distribution will basically ask how likely is this" }, { "start": 1949, "end": 1954.64, "text": " set how happy are you with this particular set right here compared to" }, { "start": 1954.64, "end": 1962.56, "text": " all the sets that could exist that would map to the same identity all right that's" }, { "start": 1962.56, "end": 1968.8, "text": " why these indicator functions are here and as you can see the part here is" }, { "start": 1968.8, "end": 1973.8, "text": " simply a normalization where you say I'm just going to produce other I'll" }, { "start": 1973.8, "end": 1978.24, "text": " consider all the other possible sets of images that map to the same person and" }, { "start": 1978.24, "end": 1985.4, "text": " I'll simply divide by the energy of those in fact if you do it correctly this" }, { "start": 1985.4, "end": 1991.6, "text": " particular X is also in that particular set but usually it's going to be a" }, { "start": 1991.6, "end": 1995.52, "text": " fairly small part but to properly normalize of course you have to" }, { "start": 1995.52, "end": 2000, "text": " consider it as well now this bottom part here as I already said is going to be" }, { "start": 2000, "end": 2004.92, "text": " the main problem of most of these probabilistic methods and as I already" }, { "start": 2004.92, "end": 2010.2, "text": " said again it's usually approximated by simply sampling a bunch of these sets" }, { "start": 2010.2, "end": 2017, "text": " and not sampling a bunch of these sets and not a by enumerating all the" }, { "start": 2017, "end": 2021.64, "text": " possible sets of images and this sampling is going to make some further" }, { "start": 2021.64, "end": 2034, "text": " problems as we'll see I guess down here so here is what we optimize ultimately" }, { "start": 2034, "end": 2045, "text": " we optimize or one of the things we optimize is or are we okay yeah so they" }, { "start": 2045, "end": 2049.12, "text": " say we apply maximum likelihood estimation to estimate the parameters of" }, { "start": 2049.12, "end": 2053.88, "text": " the thing we just defined where where the negative log likelihood loss for an" }, { "start": 2053.88, "end": 2059.36, "text": " observed set in the training split is this so this is simply the negative log" }, { "start": 2059.36, "end": 2065.7200000000003, "text": " likelihood the log decomposes into a sum so this is going to be your prior and" }, { "start": 2065.7200000000003, "end": 2072.84, "text": " this is going to be your generator discriminator combo okay it's the" }, { "start": 2072.84, "end": 2078.8, "text": " generator producing images from that binary code and then the discriminator" }, { "start": 2078.8, "end": 2084.44, "text": " assigning high or low values to that produced images and also to images from" }, { "start": 2084.44, "end": 2091.36, "text": " the data set and the thing over here is simply going to be the prior over the z" }, { "start": 2091.36, "end": 2098.08, "text": " distribution that we briefly discussed now again they have to they have to do" }, { "start": 2098.08, "end": 2104, "text": " some tricks here where they say okay we can get rid of this support by using a" }, { "start": 2104, "end": 2110.52, "text": " normalized distribution over Z which is a bound on that true prior and so on so" }, { "start": 2110.52, "end": 2118.24, "text": " they're going to replace the the P with a P bar which is over the entire space" }, { "start": 2118.24, "end": 2127.28, "text": " of Z and and that's going to be a bound but the interesting part I feel more is" }, { "start": 2127.28, "end": 2132.8, "text": " here where they consider the loss again of this conditional distribution on Z" }, { "start": 2132.8, "end": 2137.64, "text": " so you'll see the exact same quantity right here but now our loss is going to" }, { "start": 2137.64, "end": 2143.4, "text": " be the negative log of that now since it's the negative log you can decompose" }, { "start": 2143.4, "end": 2150.6, "text": " the division into a sum and and this part up here you will see the indicator" }, { "start": 2150.6, "end": 2158.12, "text": " function here is a bit unnecessary because the the Z here is the Z that" }, { "start": 2158.12, "end": 2162.04, "text": " we're considering is going to be the Z of that particular set that we're" }, { "start": 2162.04, "end": 2167.4, "text": " considering and so this equality holds on the top so disregard this and this" }, { "start": 2167.4, "end": 2172.6800000000003, "text": " down here as I said is simply a filter to filter the space of all sets to the" }, { "start": 2172.6800000000003, "end": 2178.8, "text": " ones that correspond to the Z that we have in the energy function so this goes" }, { "start": 2178.8, "end": 2184.32, "text": " here because it's simply a log of an exponential and the negative signs" }, { "start": 2184.32, "end": 2189.88, "text": " cancel so you'll end up with this what does it mean you want to minimize this" }, { "start": 2189.88, "end": 2194.56, "text": " loss right here and part of that is going to be you want to minimize the" }, { "start": 2194.56, "end": 2202.12, "text": " energy function of these inputs okay you want you want to and this is now the" }, { "start": 2202.12, "end": 2208.16, "text": " case when it comes to from the data set right so when X and Z come from the" }, { "start": 2208.16, "end": 2214.36, "text": " data set and E is your discriminator then you want to make the output of the" }, { "start": 2214.36, "end": 2218.44, "text": " discriminator really small which means that you want to train the" }, { "start": 2218.44, "end": 2223.6, "text": " discriminator to say I'm really really happy that this particular image comes" }, { "start": 2223.6, "end": 2229.7599999999998, "text": " together with this particular identity encoding now the in the in the if it" }, { "start": 2229.7599999999998, "end": 2234, "text": " comes from the generator of course you want to do the exact opposite you want" }, { "start": 2234, "end": 2238.88, "text": " to assign it a high value remember energy low means happy with the input" }, { "start": 2238.88, "end": 2246.96, "text": " okay and then the normalization down here is as I said the problem so you'll" }, { "start": 2246.96, "end": 2254.16, "text": " see it stated right here because it's under the the division it's going to" }, { "start": 2254.16, "end": 2257.28, "text": " get a pick up a negative sign which combines with this negative sign which" }, { "start": 2257.28, "end": 2262.68, "text": " gives you positive sign right here now this part right here is going to be" }, { "start": 2262.68, "end": 2268.56, "text": " intractable because it it's not going to be feasible to enumerate all the sets of" }, { "start": 2268.56, "end": 2272.44, "text": " images it's not even going to be feasible to enumerate all the sets of" }, { "start": 2272.44, "end": 2279.2400000000002, "text": " images that just correspond to that particular identity and in fact it's not" }, { "start": 2279.2400000000002, "end": 2284.48, "text": " even going to be feasible to sample from that because we have no clue right we" }, { "start": 2284.48, "end": 2290.6, "text": " can't simply generate out of the ether true other pictures of the of a" }, { "start": 2290.6, "end": 2298.84, "text": " particular person what we can do of course is we can use our we can use our" }, { "start": 2298.84, "end": 2306.84, "text": " model to produce more images right of that particular identity so what we'll" }, { "start": 2306.84, "end": 2312.76, "text": " do is we'll replace this distribution with a variational distribution and" }, { "start": 2312.76, "end": 2320.08, "text": " we'll sample from that now this isn't exactly the same this isn't this log" }, { "start": 2320.08, "end": 2327, "text": " probability anymore and that's why first of all we have a bound here and not an" }, { "start": 2327, "end": 2333.28, "text": " equality this is this is called a variational approximation so we bound" }, { "start": 2333.28, "end": 2340.2, "text": " this quantity and we can only bound this quantity if we down here introduce the" }, { "start": 2340.2, "end": 2345.44, "text": " entropy of the variational distribution this is a fairly standard trick in" }, { "start": 2345.44, "end": 2350.08, "text": " variational approximation methods if you want to look more into this look into" }, { "start": 2350.08, "end": 2355.68, "text": " kind of VAE explain variational autoencoders explained or anything like" }, { "start": 2355.68, "end": 2361.3199999999997, "text": " this will teach you how how these methods work and in case we replace the" }, { "start": 2361.3199999999997, "end": 2366, "text": " distribution with a distribution we can actually produce and what is that" }, { "start": 2366, "end": 2372, "text": " distribution look what we're supposed to do is we're supposed to produce a set" }, { "start": 2372, "end": 2380.56, "text": " of image given so sets of images here given particular Z and we can do that" }, { "start": 2380.56, "end": 2385.3599999999997, "text": " that's our generator right so we can use our generator to produce those samples" }, { "start": 2385.36, "end": 2391.4, "text": " and that's what they say here here we have derived a lower bound by" }, { "start": 2391.4, "end": 2395.6400000000003, "text": " introducing a variational distribution which we parameterized in the form of a" }, { "start": 2395.6400000000003, "end": 2402.36, "text": " generator ok so the generators going to produce that distribution it's going to" }, { "start": 2402.36, "end": 2409.28, "text": " use this noise production so as you know the generator takes two things it takes" }, { "start": 2409.28, "end": 2415, "text": " the identity encoding and a bit of noise and is going to produce an output" }, { "start": 2415, "end": 2423.56, "text": " set or for each noise is going to produce an output image very cool so" }, { "start": 2423.56, "end": 2431.56, "text": " that's that's the the kind of math formulation behind this model now they" }, { "start": 2431.56, "end": 2436.12, "text": " have a model architectures right here but this is all fairly standard except" }, { "start": 2436.12, "end": 2440.64, "text": " for so for the prior they learned the prior on the z space so you see you have" }, { "start": 2440.64, "end": 2447.92, "text": " Z being this binary vectors they say we use a standard autoregressive model made" }, { "start": 2447.92, "end": 2453.04, "text": " with three fully connected layers mainly for its simplicity and robustness and so" }, { "start": 2453.04, "end": 2457.64, "text": " again maybe you like it took me a while to get what this prior does this prior" }, { "start": 2457.64, "end": 2463.7599999999998, "text": " is supposed to say it's so it's not in again you have the Z vectors always" }, { "start": 2463.7599999999998, "end": 2469.12, "text": " being some sort of from the standard noise but what you can also do is you" }, { "start": 2469.12, "end": 2474.8399999999997, "text": " can learn better noise distribution a better input distribution for your again" }, { "start": 2474.8399999999997, "end": 2481.2799999999997, "text": " by basically making again for your input distribution so what you'll do is you'll" }, { "start": 2481.2799999999997, "end": 2488.7599999999998, "text": " have a z zero right here and then you'll use a you learn again to learn better" }, { "start": 2488.7599999999998, "end": 2497.56, "text": " input distributions ok and this is what you do here with these with this prior on" }, { "start": 2497.56, "end": 2506.12, "text": " Z this is more standard in like VAE's than it is in GANs but it exists so" }, { "start": 2506.12, "end": 2511.6, "text": " encoder say as a necessary option encoder for a set needs to satisfy the" }, { "start": 2511.6, "end": 2515.92, "text": " permutation variant property we opt to use a simple architecture design where" }, { "start": 2515.92, "end": 2522.96, "text": " we let this be the average right here so as you can see this is the average and" }, { "start": 2522.96, "end": 2529.64, "text": " then they they use this binarize operation and the binarize operation" }, { "start": 2529.64, "end": 2534.2400000000002, "text": " here is clamping the values to one or negative one and it is a straight" }, { "start": 2534.2400000000002, "end": 2538.38, "text": " through estimator which means that you will you back prop through it as if you" }, { "start": 2538.38, "end": 2543.44, "text": " hadn't clamped but you forward prop through it with clamping this is kind of" }, { "start": 2543.44, "end": 2551.44, "text": " a trick to get through discretization things discriminators job is to assign" }, { "start": 2551.44, "end": 2556.08, "text": " low energy to observed images and high energy to generated images given a set" }, { "start": 2556.08, "end": 2559.96, "text": " code Z we use an auto encoder based energy function implementation similar" }, { "start": 2559.96, "end": 2564.6, "text": " to 25 and here they say we have found that this choice is important as it" }, { "start": 2564.6, "end": 2570.96, "text": " enables effective learning in early stages of training so that's why they" }, { "start": 2570.96, "end": 2575.32, "text": " do usually a discriminator would be the energy would be equal to this thing" }, { "start": 2575.32, "end": 2584.36, "text": " right here which is a small MLP that maps a the input to a real sorry you" }, { "start": 2584.36, "end": 2589.2000000000003, "text": " can't see that that maps the inputs to a real number either high energy I'm not" }, { "start": 2589.2000000000003, "end": 2594.8, "text": " happy low energy I'm very happy here they also include this thing right here" }, { "start": 2594.8, "end": 2601.6800000000003, "text": " which is a decoder so it's kind of a you can maybe think of it as a another" }, { "start": 2601.68, "end": 2608.7599999999998, "text": " little GAN another another another little generator or the the generator" }, { "start": 2608.7599999999998, "end": 2615, "text": " part of a VAE or of an autoencoder sorry not a VAE an autoencoder that takes as" }, { "start": 2615, "end": 2621.3999999999996, "text": " input the encoding of the particular image and the identity and produces is" }, { "start": 2621.3999999999996, "end": 2627.12, "text": " going to produce something that's close to the output against observe that this" }, { "start": 2627.12, "end": 2631.2, "text": " is now with respect to a particular image so here we're trying to reconstruct" }, { "start": 2631.2, "end": 2635.64, "text": " that particular image because we have its input thing right here and we're" }, { "start": 2635.64, "end": 2642.7999999999997, "text": " it's not the same as the generator that is just asked to produce a some view" }, { "start": 2642.7999999999997, "end": 2649.3199999999997, "text": " something that corresponds to this particular identity vector okay the" }, { "start": 2649.3199999999997, "end": 2654.3599999999997, "text": " generator generates a set conditioned on a set code by sampling and random" }, { "start": 2654.3599999999997, "end": 2658.5, "text": " variables each of which is concatenated with Z and generates an image" }, { "start": 2658.5, "end": 2668.12, "text": " independently cool so what the losses they they now introduce some margin" }, { "start": 2668.12, "end": 2674.56, "text": " losses on the things here but basically you can just translate the what we have" }, { "start": 2674.56, "end": 2679.56, "text": " on top where we formulated negative log likelihood into the losses right here" }, { "start": 2679.56, "end": 2686.32, "text": " they do have some simplifications for example this to train the prior you what" }, { "start": 2686.32, "end": 2696.28, "text": " you are to train to train the encoder I think you have to make a bit of an" }, { "start": 2696.28, "end": 2702.96, "text": " approximation in that the encoder is supposed to match this this Z vector" }, { "start": 2702.96, "end": 2709.6400000000003, "text": " right and that's not differentiable by itself so they have this sort of l1" }, { "start": 2709.6400000000003, "end": 2714.6000000000004, "text": " approximation right here they leave away the entropy from the loss and they have" }, { "start": 2714.6, "end": 2720.3199999999997, "text": " found that to work well they introduced this margin losses right here I I don't" }, { "start": 2720.3199999999997, "end": 2726.16, "text": " want to go into that too much but basically they simply in a way with some" }, { "start": 2726.16, "end": 2730.48, "text": " approximations they approximate I hear it is the indicator function they" }, { "start": 2730.48, "end": 2735.92, "text": " approximate is this I was looking for that they they they optimize this log" }, { "start": 2735.92, "end": 2740, "text": " likelihood from above in the way where they always optimize they keep the" }, { "start": 2740, "end": 2744.56, "text": " generator constant and they optimize the rest of the pipeline so the encoder and" }, { "start": 2744.56, "end": 2751.04, "text": " the discriminator in the prior and then they keep that rest fixed and they encode" }, { "start": 2751.04, "end": 2757.68, "text": " the generator so what does that do before remember right here we had this" }, { "start": 2757.68, "end": 2764.12, "text": " this approximation right here where we said you know what comes out of this we" }, { "start": 2764.12, "end": 2767.6, "text": " were not really optimizing this we're optimizing we're minimizing a lower" }, { "start": 2767.6, "end": 2772.2799999999997, "text": " bound on it right so here's a quantity that we want to minimize but here's a" }, { "start": 2772.28, "end": 2776.7200000000003, "text": " lower bound and we'll just push that lower bound down by optimizing it now" }, { "start": 2776.7200000000003, "end": 2781.4, "text": " that doesn't tell us anything about this thing right here but there is actually" }, { "start": 2781.4, "end": 2788.1200000000003, "text": " more to it so by optimizing the discriminator and the encoder and so on" }, { "start": 2788.1200000000003, "end": 2793.4, "text": " we do minimize this lower bound so that this this loss right here you see this" }, { "start": 2793.4, "end": 2801.6000000000004, "text": " energy function will adjust that whenever we adjust our whenever we adjust our" }, { "start": 2801.6, "end": 2806.3399999999997, "text": " our that particular loss our discriminator will adjust that energy" }, { "start": 2806.3399999999997, "end": 2813.4, "text": " function whenever we adjust our encoder we are going to adjust the part that" }, { "start": 2813.4, "end": 2820.68, "text": " generates the Z vectors right here so we'll push this down but whenever we" }, { "start": 2820.68, "end": 2826.54, "text": " optimize our generator that's when we make this gap here smaller okay so we" }, { "start": 2826.54, "end": 2833.92, "text": " always do two steps first we or first or second in one step we reduce this and in" }, { "start": 2833.92, "end": 2838.3, "text": " the other step we'll bring these two closer together and as a result of" }, { "start": 2838.3, "end": 2842.2799999999997, "text": " course we hope that it's not just the bottom one going to up down up down up" }, { "start": 2842.2799999999997, "end": 2847.72, "text": " down but we hope that both of them reduce with time because the top one is" }, { "start": 2847.72, "end": 2852.02, "text": " the one will actually want to reduce that's our actual loss or our log" }, { "start": 2852.02, "end": 2859.7, "text": " likelihood and that is I guess going to happen in practice so what does this do" }, { "start": 2859.7, "end": 2866.88, "text": " so as I as we already saw here on top you have a set and you feed that through" }, { "start": 2866.88, "end": 2873.04, "text": " the encoder feed that through the encoder that gives you a Z identity and" }, { "start": 2873.04, "end": 2878.6, "text": " then you feed that to the generator and the generator you can ask it you don't" }, { "start": 2878.6, "end": 2882.4, "text": " have to produce the same amount of images you can produce any amount of images you" }, { "start": 2882.4, "end": 2886.44, "text": " like they just chose to produce the same amount there's no correspondence but you" }, { "start": 2886.44, "end": 2892.2799999999997, "text": " see it's the same truck and here they manually align these so they just" }, { "start": 2892.2799999999997, "end": 2896.08, "text": " produce a bunch of images on the left is the data set and on the right I guess" }, { "start": 2896.08, "end": 2900.08, "text": " they just produced like a hundred images and then selected wherever the car" }, { "start": 2900.08, "end": 2906.3199999999997, "text": " looked like the closest to so they ordered them by by hand and that is to" }, { "start": 2906.32, "end": 2912.88, "text": " show that for example look at the the lighting on the car right here it's it's" }, { "start": 2912.88, "end": 2918.84, "text": " fairly similar I guess this one has red taillights and the other one hasn't but" }, { "start": 2918.84, "end": 2923.84, "text": " you can see that the the different views are pretty well captured by the" }, { "start": 2923.84, "end": 2930.76, "text": " generator and that just from all of these are created from one one binary" }, { "start": 2930.76, "end": 2935.28, "text": " encoding of this here so this is binary encoded to Z and then all of these" }, { "start": 2935.28, "end": 2941.36, "text": " different views are created there's no image correspondence so that's pretty" }, { "start": 2941.36, "end": 2946.84, "text": " cool and another problem you have with sets is how do you evaluate sets you" }, { "start": 2946.84, "end": 2953.32, "text": " can't you can't go and check for images or image closeness and so on so they" }, { "start": 2953.32, "end": 2959.6800000000003, "text": " have to do some 3d modeling they actually take it now they take these" }, { "start": 2959.6800000000003, "end": 2963.76, "text": " images right here and they have to approximate their 3d shape and then" }, { "start": 2963.76, "end": 2970, "text": " compare that 3d shape with the 3d shape of the original thing in order to just" }, { "start": 2970, "end": 2977.5200000000004, "text": " quant quantitatively estimate how well they're doing in the faces the the same" }, { "start": 2977.5200000000004, "end": 2983.32, "text": " thing you input the top row into the encoder and you get back the bottom row" }, { "start": 2983.32, "end": 2989.28, "text": " we've already looked at that but again to evaluate this they you actually have" }, { "start": 2989.28, "end": 2994.6000000000004, "text": " to go and use some sort of a face detector to recognize is that even is" }, { "start": 2994.6000000000004, "end": 3000.6800000000003, "text": " that the same person always and is it so you can evaluate two things you can" }, { "start": 3000.6800000000003, "end": 3007.8, "text": " evaluate are these right here all the same people so you can have a a face" }, { "start": 3007.8, "end": 3013.4, "text": " detector kind of tell you whether or not these are the same people and the" }, { "start": 3013.4, "end": 3019.7200000000003, "text": " second thing is are these down here the same person as these up here right so" }, { "start": 3019.7200000000003, "end": 3024.32, "text": " those are the the kind of things how you can evaluate this and they've done this" }, { "start": 3024.32, "end": 3029.1600000000003, "text": " and it's a fairly interesting and the results here are not surprising when you" }, { "start": 3029.1600000000003, "end": 3035.2400000000002, "text": " look at the images so these are curves curves from this face detector and of" }, { "start": 3035.2400000000002, "end": 3039.8, "text": " course for real images as you can see the this is simply the performance of" }, { "start": 3039.8, "end": 3047.6400000000003, "text": " the face detector so you do get some false positives if you if you want more" }, { "start": 3047.6400000000003, "end": 3052, "text": " true positives right so this is a standard curve right here because these" }, { "start": 3052, "end": 3059.76, "text": " face detectors are not perfect so in a given row right here in a given row even" }, { "start": 3059.76, "end": 3063.6800000000003, "text": " if that's from the real data set the face detector would sometimes fail and" }, { "start": 3063.6800000000003, "end": 3067.6000000000004, "text": " say no that's not the same person even though from the data set you know it is" }, { "start": 3067.6, "end": 3074.48, "text": " though the the to match the actual child photo from Ali with his adult photos is" }, { "start": 3074.48, "end": 3080.8399999999997, "text": " even like you can forgive the face detector so that's sort of the the gold" }, { "start": 3080.8399999999997, "end": 3085.96, "text": " standard we're trying to achieve and you can see within the reconstructed sets" }, { "start": 3085.96, "end": 3092.4, "text": " that that is achieved fairly fairly well so compared to uniform samples this is" }, { "start": 3092.4, "end": 3102.4, "text": " you know fairly fairly cool fairly close what is less close is this reckon and" }, { "start": 3102.4, "end": 3108.4, "text": " real and I believe that's when you compare the identity of the real row" }, { "start": 3108.4, "end": 3113.76, "text": " with the identity of the reconstructed row and that's here so that tells you" }, { "start": 3113.76, "end": 3120.6, "text": " already that it's the GAN or sorry the model doesn't always preserve the actual" }, { "start": 3120.6, "end": 3127.2, "text": " identity as seen by a face detector and I don't know what to say except yes" }, { "start": 3127.2, "end": 3133.56, "text": " that's what you see in the data right also you see that free samples I guess" }, { "start": 3133.56, "end": 3139.2, "text": " so you can do two things right you can give it a set like a row and encode that" }, { "start": 3139.2, "end": 3146.3199999999997, "text": " into the Z and then you can decode that again and basically reconstruct or you" }, { "start": 3146.32, "end": 3151.6000000000004, "text": " can just sample since you've learned a prior on the Z variable you can simply" }, { "start": 3151.6000000000004, "end": 3157.6000000000004, "text": " sample you can simply say give me some new identity maybe that I've never seen" }, { "start": 3157.6000000000004, "end": 3163.88, "text": " before right you have some binary vector and now generator please give me" }, { "start": 3163.88, "end": 3169.44, "text": " images of that identity and these two here are actually sampled like this and" }, { "start": 3169.44, "end": 3174.88, "text": " you can see again here it's remarkable that within the same row it's pretty" }, { "start": 3174.88, "end": 3181.84, "text": " much the the rough identity of the person is conserved right and these are these" }, { "start": 3181.84, "end": 3188.1600000000003, "text": " free samples right here I guess and they they do better than whenever you compare" }, { "start": 3188.1600000000003, "end": 3193.12, "text": " the reconstructed and real but they don't do as well as when you actually" }, { "start": 3193.12, "end": 3201.48, "text": " input a real data and then reconstruct this so this might be an indication that" }, { "start": 3201.48, "end": 3209.76, "text": " this prior isn't really working you know all too accurately and I do have my" }, { "start": 3209.76, "end": 3216.2400000000002, "text": " problems with this binary encoding right here because maybe I'm" }, { "start": 3216.2400000000002, "end": 3220.32, "text": " misunderstanding something but if you have these binary vectors as we said" }, { "start": 3220.32, "end": 3225.68, "text": " here the reason you know the reason why you do one hot encoding in class" }, { "start": 3225.68, "end": 3229.2400000000002, "text": " conditional GANs is you could you could simply say what am I doing a one hot" }, { "start": 3229.24, "end": 3234.7999999999997, "text": " encoding I'll simply say Z equals three for class three and Z equals four for" }, { "start": 3234.7999999999997, "end": 3239.16, "text": " class four like that it should be so easy why am I doing one hot and that's" }, { "start": 3239.16, "end": 3244.64, "text": " because these models see everything in a linear fashion so if you have class" }, { "start": 3244.64, "end": 3252.4399999999996, "text": " three and then I have class four and then I have class nine the model doesn't" }, { "start": 3252.4399999999996, "end": 3257.68, "text": " see that as three different classes the model sees this as these two are somehow" }, { "start": 3257.68, "end": 3265.72, "text": " closer together than this right so the reason why we do one hot vectors is that" }, { "start": 3265.72, "end": 3270.16, "text": " the model cannot do this the model has one independent dimension for each of" }, { "start": 3270.16, "end": 3275.7599999999998, "text": " the classes and whenever that particular dimension is high then it knows that" }, { "start": 3275.7599999999998, "end": 3281.8799999999997, "text": " that particular class is activated what this binary encoding here does is sort" }, { "start": 3281.8799999999997, "end": 3287.52, "text": " of it goes back to this thing right here where it says okay there are all of these" }, { "start": 3287.52, "end": 3293.68, "text": " different categories here it's like you have mini classes and the identity of" }, { "start": 3293.68, "end": 3299.72, "text": " whatever set you consider is now encoded in these mini classes so that I'm going" }, { "start": 3299.72, "end": 3304.48, "text": " to guess the first thing here might be something like does that person have a" }, { "start": 3304.48, "end": 3309.8, "text": " blonde hair and the second thing might be does the image look generally bright" }, { "start": 3309.8, "end": 3315.7599999999998, "text": " or the images image set as a whole look generally bright or dark and and so on" }, { "start": 3315.76, "end": 3320.84, "text": " so I'm gonna guess these things are encoded here and it'll sort of just end" }, { "start": 3320.84, "end": 3329.76, "text": " up being kind of a discrete GAN or a discrete autoencoder rather than what" }, { "start": 3329.76, "end": 3334.44, "text": " they believe but maybe that was their goal all along and I'm misunderstanding" }, { "start": 3334.44, "end": 3340.6400000000003, "text": " right here I just don't think this this binarization is gives you this sort of" }, { "start": 3340.64, "end": 3347, "text": " hoped expressiveness I think there's still a lot of dependence of whether or" }, { "start": 3347, "end": 3355.72, "text": " not a particular thing is on or off okay but enough ranting right here I want to" }, { "start": 3355.72, "end": 3360.3599999999997, "text": " look at the at some more of the samples because I've only shown you the" }, { "start": 3360.3599999999997, "end": 3365.12, "text": " reconstructions what I also find interesting is the free samples so here" }, { "start": 3365.12, "end": 3371.68, "text": " you can see uncurated shape net samples and on the left so here you can see this" }, { "start": 3371.68, "end": 3377.04, "text": " effect on from the learned order regressive prior and a uniform prior on" }, { "start": 3377.04, "end": 3381.52, "text": " the right and here you can see this effect of learning this prior so if I" }, { "start": 3381.52, "end": 3386.44, "text": " learn the prior it's going to give me back fairly okay objects if I don't" }, { "start": 3386.44, "end": 3394.24, "text": " learn the prior oh but if I learn the prior you know if I learn the prior" }, { "start": 3394.24, "end": 3400.16, "text": " really really well that basically means I'm only going to ever produce sets" }, { "start": 3400.16, "end": 3405.2, "text": " that were in the training data right if I learned like a perfect prior I'll see" }, { "start": 3405.2, "end": 3409.3199999999997, "text": " like wait this you know this particular identity here never shows up so I'm not" }, { "start": 3409.3199999999997, "end": 3414.06, "text": " going to output it and the uniform prior might actually output it and the" }, { "start": 3414.06, "end": 3419.3999999999996, "text": " generator is not going to be trained on that uniform prior so it's just going to" }, { "start": 3419.4, "end": 3427.92, "text": " give you kind of crap and here in the in the faces you see the same thing now" }, { "start": 3427.92, "end": 3431.88, "text": " again what I think I don't think that's happening what I think is happening is" }, { "start": 3431.88, "end": 3436.8, "text": " encoding these kind of micro characteristics not per se identity but" }, { "start": 3436.8, "end": 3441.6800000000003, "text": " it's encoding probably you know hair color what not head shape and so on" }, { "start": 3441.6800000000003, "end": 3447.84, "text": " things like this and in each of these dimensions and that's what is then going" }, { "start": 3447.84, "end": 3454.1600000000003, "text": " to produce so these each row here is an is one sample from that prior on the" }, { "start": 3454.1600000000003, "end": 3460.32, "text": " left is learned which you see is working pretty well in terms of the output and" }, { "start": 3460.32, "end": 3467.84, "text": " on the right you see it's from the uniform prior now you also see here first" }, { "start": 3467.84, "end": 3474.44, "text": " of all that approximately identity is preserved but not as much in this" }, { "start": 3474.44, "end": 3479.48, "text": " uniform prior that's first and second you see that the images are much worse" }, { "start": 3479.48, "end": 3484.8, "text": " which means that the generator doesn't have as much training on that particular" }, { "start": 3484.8, "end": 3489.56, "text": " thing because I guess it comes from a prior that it hasn't seen during" }, { "start": 3489.56, "end": 3495.44, "text": " training alright and here lastly they have reconstructions if you give" }, { "start": 3495.44, "end": 3501.68, "text": " different number of views so the top row I guess is the input the this row is" }, { "start": 3501.68, "end": 3505, "text": " when you just have four different views so I guess just the first four or" }, { "start": 3505, "end": 3508.72, "text": " something like this input and the bottom one is when you have the full eight" }, { "start": 3508.72, "end": 3518.24, "text": " views and you can I guess see or even more that this increases with number of" }, { "start": 3518.24, "end": 3523.9199999999996, "text": " views so the the accuracy of this identity increases the more views you" }, { "start": 3523.9199999999996, "end": 3529.56, "text": " input of the set and they have a bunch of other things right here in the" }, { "start": 3529.56, "end": 3537.7599999999998, "text": " appendix I I do invite you to look at this and I hope you sort of saw into a" }, { "start": 3537.7599999999998, "end": 3544.04, "text": " bit how you would go about something like this I I found it quite challenging" }, { "start": 3544.04, "end": 3549.56, "text": " the math because I'm mainly not used to this kind of variational math but I hope" }, { "start": 3549.56, "end": 3554.6, "text": " this gives you sort of an impression alright this was it from me tell me" }, { "start": 3554.6, "end": 3562, "text": " what you think and I'll see you next time bye bye" } ]
eI8xTdcZ6VY
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Context R-CNN: Long Term Temporal Context for Per-Camera Object Detection (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "vision", "cnn", "convolutional neural network", "coco", "object detection", "region of interest", "rcnn", "r-cnn", "attention", "attention mechanism", "google", "caltech", "gazelle", "wildlife", "wild trap", "traffic", "object", "car", "bus", "vehicle", "lighting", "time", "sampling", "frames", "memory", "long-term", "query" ]
Object detection often does not occur in a vacuum. Static cameras, such as wildlife traps, collect lots of irregularly sampled data over a large time frame and often capture repeating or similar events. This model learns to dynamically incorporate other frames taken by the same camera into its object detection pipeline. OUTLINE: 0:00 - Intro & Overview 1:10 - Problem Formulation 2:10 - Static Camera Data 6:45 - Architecture Overview 10:00 - Short-Term Memory 15:40 - Long-Term Memory 20:10 - Quantitative Results 22:30 - Qualitative Results 30:10 - False Positives 32:50 - Appendix & Conclusion Paper: https://arxiv.org/abs/1912.03538 My Video On Attention Is All You Need: https://youtu.be/iDulhoQ2pro Abstract: In static monitoring cameras, useful contextual information can stretch far beyond the few seconds typical video understanding models might see: subjects may exhibit similar behavior over multiple days, and background objects remain static. Due to power and storage constraints, sampling frequencies are low, often no faster than one frame per second, and sometimes are irregular due to the use of a motion trigger. In order to perform well in this setting, models must be robust to irregular sampling rates. In this paper we propose a method that leverages temporal context from the unlabeled frames of a novel camera to improve performance at that camera. Specifically, we propose an attention-based approach that allows our model, Context R-CNN, to index into a long term memory bank constructed on a per-camera basis and aggregate contextual features from other frames to boost object detection performance on the current frame. We apply Context R-CNN to two settings: (1) species detection using camera traps, and (2) vehicle detection in traffic cameras, showing in both settings that Context R-CNN leads to performance gains over strong baselines. Moreover, we show that increasing the contextual time horizon leads to improved results. When applied to camera trap data from the Snapshot Serengeti dataset, Context R-CNN with context from up to a month of images outperforms a single-frame baseline by 17.9% mAP, and outperforms S3D (a 3d convolution based baseline) by 11.2% mAP. Authors: Sara Beery, Guanhang Wu, Vivek Rathod, Ronny Votel, Jonathan Huang Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at context R-CNN, long-term temporal context for per-camera object detection by Sarah Beery, Guan Hong Wu, Vivek Rathod, 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 yeah, stick around if you want to know. As always, if you enjoy content like this, then consider sharing it out, telling your friends about it. Subscribe if you haven't and tell me what you think in the comments. So, the paper starts off and describes the problem. And the problem is fairly simple. You want to do object detection in images. Object detection is the task of basically, if I give you an image, you should tell me what is on the image and where. So in this case, here you would have to draw me this bounding box and say, this is a deer. On the bottom, you would have to draw bounding boxes. Maybe they have to be rectangular, maybe not. And say, this is a bus. And here is a truck. And here is another truck. And here is a car. And so on. So, there can be many objects in an image. There can be one object. There can be objects of different classes or there can be no objects at all. So this is just object detection. And there have been many papers on this. And specifically, there has been this RCNN. And this is the model that we're going to extend. So the RCNN model or specifically the faster RCNN model that we're going to build on is a model that simply detects these bounding boxes in single 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. Or a very similar thing. It's probably that bus's regular route. So in order to classify whether or not this here is a bus, it might be very helpful to also look at this picture right here and see, ah, you know, it's about at the same location. It looks the same and also it looks like a bus. So you know, that 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, ah, maybe you know this is the same thing. So it's not a car. So this is not the same than simply adding training data. We really consider the fact here that these images, they come from the same camera that is in the same location or maybe, you know, that is filming the same thing. So this, all of this is going to be within the same camera, not just adding, adding 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 we'll look into other images from the same camera in a dynamic way and we'll learn how to address those other images from a memory bank. So the architecture is described right here. Now as you can see, we are still in the business of doing object detection. So what we'll do is we'll sort of hijack a existing object detector and the object detector we're going to hijack is going to be this FRCNN, this faster RCNN object detector. That's an object detector for a single frame problem. So that means you have one image and you're supposed to detect what's on it. It has two stages, as you can see. So stage one, if you have an image and let's say there's some stuff on it, stuff, stuff, stuff, there's stuff. What stage one is supposed to do is it's supposed to extract regions of interest. This could be, okay, all of these are regions of interest. So it simply says, well, there is something, there might be something right here in these regions of interest. And then it describes each of these regions of interest using features. 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 describing it that these are just a vector of features for each region of interest. So each region of interest is going to be associated with one vector of features that this model extracts. Okay. And the next region of interest also has a vector and the next region of interest also has a vector and so on. Stage two then takes each one of these, takes each one of these vectors and assigns a class to it. So this would be deer right here. Okay, so stage one proposes regions of interest along with features. Then stage two takes each of these regions of interest and classifies them basically. And I guess there's many in between stages. Like this is massively simplified. There's non-maximum suppression. There is kind of an alignment stage where you can refine the bounding box and so on. But in essence, these are two stages. And you can see that this system here, it goes in between the two stages. So all of this right here, we shove in between the two stages. So we'll still use the stage one and we'll still use the stage two, but in between in this thing right here, we'll try to sort of pimp these features such that the stage two detector has an easier time classifying. Okay. So now 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're going to add two 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 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 123 and two is the key frame, maybe in the next frame, the deer moves a bit and you see its nose. And that this particular region of interest here is relevant. So how do you know how do you now get from this entire memory, this feature vector that would be helpful? And the answer is you get it through an attention mechanism. You can see that right here, the way the short term memory is added is through this attention block. They describe the attention block right here. It is a fairly standard attention mechanism. So I've done a video on attention is all you need. If you don't know what an attention mechanism is, go check it out. But you can see it's it's very, very standard. So you have these input features, which are the features that come from the key frame. And you have the context features, which are all the features in your memory bank, you encode the input features with into a query using a fully connected layers and the context features into keys. And then you match the queries with the keys and the softmax in order to get a weighting over the context features. And then you aggregate the values from the context features. So this is a standard attention mechanism. What does it mean? It basically means that each of these vectors right here, they will emit a key that kind of describes what kind of information is contained in that vector. The vector over here will emit a query that describes what sort of information it is looking for to in order to describe what's in the region of interest as well as possible. And then you simply match the query with the keys to determine which key fits best to that query and whichever one fits best, let's say this one here, then you take that vector from the memory bank and incorporate it together with your current information that you already have. So that's how you address things that from other frames using an attention mechanism. Okay, now if this were all, you know, we could train this right now. We could train all of this because all of this is differentiable, right? This stage one detector right here is differentiable. It goes here and here, you know, the information, the attention mechanism is differentiable. The stage two detector is differentiable, all differentiable. Cool. We can train this end to end. Now what's the problem? The problem is this long term memory right here. So in this memory, ideally, we would want to fit, let's say an entire day, an entire week or even an entire month of data from one of these cameras. And it's just not feasible that we expand this current window here to an entire month or an entire week for many of those of those cameras, because even though they have a low frame rate and so on, it's still too much in order to then be all differentiable, all backpropagatable and so on. So we can't really backprop in for these long term memory. In essence, what we want to do is exactly the same. We want to build up a memory of all of the regions of interest or maybe selected regions or all of the best regions of interest, whatever heuristic strategy we have of the past, whatever this camera has seen, let's say in the last month or in the current week or something like this, we want to build all of this up and then use an attention mechanism, just the same in order to incorporate it. But we have to come up with these things right here in some other way than a way where we can backprop. So we can't really use this stage one detector right here because this is the one we're training and so we have to backprop through it. Now an easy proposal is to simply use it anyway, but do like a stop gradient on it so we don't backprop through it. That is one way but this the paper decides on a different way. The paper decides that 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 a pre-trained one that was pre-trained either on something like Cocoa, which is an object detection data set, or you can pre-train it on Cocoa and then fine tune it on a task you're interested in, in a single frame fashion. For whatever way, we'll take a pre-trained object detector or region of interest extractor and that will give us for each frame in the past will give us also the regions of interest along with the features. And these are the features that we then go and 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 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 built the memory and so on, how they built the features. I didn't, I kind of glossed over this right now. There's a lot of consideration in building these things and you have to look at the paper how they exactly do this. I'm more interested in the high level architecture and the sort of ideas behind it. So when they do this, they do outperform the, they do outperform the current or the single frame baselines by quite a bit. So this SS and this CCT are these wildlife data sets, whereas this CC, I think this is the city something city cam, these are this street data set. As you can see, they do outperform the single frame baseline by quite a bit. Now interesting, as you can see right here, as they increase the time horizon of this long term memory, so they, they can, they can now choose how much information do they want to put in that long term memory. As they increase the time horizon for one minute, one hour, one day and so on, the performance goes up and up and up, which is a strong indication that these features actually help 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, this is actually due to the fact that you have more information in that memory bank. Couldn't really guess any other explanation right here. So they, they do, 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 across regions of interest. That's interesting if you have like a herd of animals and so on, and they all help. But as you can see, the long term attention tends to help the most in this data set. And the short term attention help helps a lot in this data set. If you just compare to the other owner, these are two different metrics, not data sets. Sorry about that. But in essence, it helps the most when you combine the two and that's, you know, that's pretty cool to see. So they do some qualitative results, which I find very interesting. For example, they can visualize what the attention weights of their models are. So here, you always have a very long timeframe, I think an entire month in this, in this memory bank of the long term memory. Now in the top classification, you see the large thing here, the large frame is the one you actually want to classify. And the other frames are the frames where the top attention score is so that the attention weights are the highest. So here in order to classify this, what does the model pay attention to? Or which other frames does the model pay attention to? And you can see right here, they are all spread across the entire month. Here is the timeline. The most attended to pictures are spread across the entire month. And almost all of them actually have that work on in here. So this must be like its regular route. And the model recognizes that and pulls in information from all these other images in order to correctly classify it here. On the other hand, on the next example, this gazelle and tablet crashed right here. It also puts all the weight on top of images of that same gazelle. But you can see maybe that gazelle was only there for this one particular moment. And all the pictures this camera has of it is, you know, in the very few moments that the gazelle was around. You can see they all come here from the same point in time, or very, very close points in time. And you can see that it puts a lot of weight on wherever the gazelle is. So you know, that's a pretty strong indication that it actually learns to pull in the correct information be that from long time horizon, or from a short time horizon if necessary. You can also see right here, they visualize the top attention, where the top attention weights go, in terms of how long the frames where the attention goes to is away from the frame that they're trying to classify. So these graphics are somewhat kind of weird to interpret. This here always means how much is the total time of the buffer. So the memory buffer here contains always pictures from the total from one hour before until one hour after the 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 not real time, right? You go back to your through your footage and you try to classify. You can also pull out images from the future. You can see there's most attention is on the current frame, which makes sense. You're trying to classify the current frame and it kind of falls off as you go further and further away. This is across the entire data set. So this is not a specific example, which also makes sense. Probably in most of the time, the relevant information is closer in time rather than farther away. But also you can see that the distribution is pretty spread out. So it makes the model makes use of the entire range of time. And you can see that throughout, even if you have an entire day in the buffer or two days, even if you have entire week before and week after in the buffer, and even if you have an entire month here. And especially if you look at when you have an entire week in the buffer, you can see the periodicity through the days. So that means the model tends to pay attention to images that are from the same time of day. Compared to the current 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 is an object that's moving out of frame. And the single frame detector wasn't able to recognize this probably because it's moving out of frame. Whereas this new this context rcnn is able to detect it probably because it looked at the frame just before it where the car was somewhere back here and it could correctly classify it. Well, that's well, I just disregard my drawings. Here it managed to recognize this animal in the back, whereas this old model, the single frame model hasn't also probably by looking either at frames next to it or by looking at other frames of herds of animals and realizing that usually when there's two elephants, there's more. Here you can see that the object highly occluded. So we're talking about the object like at the very edge of the frame object poorly lit. This is particularly impressive. And also an example where the animals are often in herds. And if you see one deer, the likelihood that there's other deer is very high in this particular camera. And by aggregating information from different frames, you can see that maybe it's always the same patch of the air that comes by. And here, the single frame detector detects this patch here as a vehicle where it shouldn't. And of course, the new model, the context RCNN is able to recognize that this is present in all of the frames. And in most frames, the single object detector doesn't detect it as a vehicle. And so it can kind of carry over that information. Now you can already see sort of what the downsides might be if the single object detector is like very, very, very sure that this is in a single frame that this is a car. It could carry over that information to the other frame. So even though the single frame detector might have failed in that particular frame, if it fails super hard, it might, you know, shout that to all the other frames basically dominate the memory saying like, look, this is a car, I'm like pretty sure. And it will carry over that information to all of the other frames. And they say in one of these high confidence mistakes, it basically detected the same tree as a giraffe over and over again. What I find particularly interesting is they do look at, so here they have this curve of on the bottom, you have confidence threshold, so how confident the model is. And on the y-axis, you have the number of false positives. And you can see that in the low confidence regime, the context RCNN has lower false positives than the single frame detector. And the green line here is when you only have positive boxes. So when you only include regions of interest where there is an actual object, which in this case is sort of hurtful, you also want the regions of interest where there is nothing because that helps you avoid false positives in other frames. That's why the orange line is below the green line. But strangely here in the high confidence regime, you can see that the single frame model has fewer false positives than the context RCNN. And I like the text that they have to this. In figure 7, 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 RCNN and found that in almost all of them, in 97 out of 100, the model had correctly found and classified animals that were missed by human annotators. So basically these graphs are even underestimating how good that model is because the model appears to be better than the human annotators of the test set. I find that to be pretty, pretty impressive. And here you can see failure modes where they say, for example, when exploring the confident false positives on the snapshot Serengeti data set, the three out of 100 images, so whatever was not a human failure, where context RCNN erroneously detected an animal, where all of the same tree highly confidently predicted to be a giraffe. So this is a failure mode when the model is highly confident it might spill that over to other frames because we now aggregate the information within the same camera across the frames. To be said, of course, their train test split is such that there's not the same camera in the training data as in the testing data. They have entirely different cameras in the testing data than in the training data, just so there is no information leakage. So that's the model right here, how it works. It's pretty cool. It kind of wedges itself in between any single frame object detector that has these two stages. And it's a pretty neat idea to bring in context from the past or even the future of the same camera. Just a quick glance at the appendix, they have lots of different examples right here. In one example, their camera kind of fell over and they say, well, it still worked. The system was still able to kind of do attention across this failure, this kind of tipping over of the camera. They have more examples right here, which I find pretty impressive, like these super low light things where it correctly detects like the possum. And yeah, I invite you to check out the paper, the code they say should be out soon. And I'll see you next time. Bye bye.
[ { "start": 0, "end": 6.16, "text": " Hi there, today we'll look at context R-CNN, long-term temporal context for per-camera" }, { "start": 6.16, "end": 11.96, "text": " object detection by Sarah Beery, Guan Hong Wu, Vivek Rathod, Ronnie Votel, and Jonathan" }, { "start": 11.96, "end": 12.96, "text": " Huang." }, { "start": 12.96, "end": 19.84, "text": " So, on a high level, this paper tries to do object detection for cameras where the camera" }, { "start": 19.84, "end": 22.04, "text": " is in the same place for a long time." }, { "start": 22.04, "end": 27, "text": " For example, these wild trap cameras or traffic cameras right here." }, { "start": 27, "end": 34.2, "text": " It proposes to do object detection by incorporating data from the images that the camera has seen" }, { "start": 34.2, "end": 39.08, "text": " in the past to help the detection in the current frame." }, { "start": 39.08, "end": 47.32, "text": " And it does so via an attention mechanism that it runs over a memory of past data." }, { "start": 47.32, "end": 51.400000000000006, "text": " So we're going to take a look at how this is done and how well it works." }, { "start": 51.400000000000006, "end": 54.84, "text": " And yeah, stick around if you want to know." }, { "start": 54.84, "end": 59.900000000000006, "text": " As always, if you enjoy content like this, then consider sharing it out, telling your" }, { "start": 59.900000000000006, "end": 61.52, "text": " friends about it." }, { "start": 61.52, "end": 65.72, "text": " Subscribe if you haven't and tell me what you think in the comments." }, { "start": 65.72, "end": 70.4, "text": " So, the paper starts off and describes the problem." }, { "start": 70.4, "end": 72.36, "text": " And the problem is fairly simple." }, { "start": 72.36, "end": 75.16, "text": " You want to do object detection in images." }, { "start": 75.16, "end": 79.80000000000001, "text": " Object detection is the task of basically, if I give you an image, you should tell me" }, { "start": 79.80000000000001, "end": 81.92, "text": " what is on the image and where." }, { "start": 81.92, "end": 88.76, "text": " So in this case, here you would have to draw me this bounding box and say, this is a deer." }, { "start": 88.76, "end": 92.56, "text": " On the bottom, you would have to draw bounding boxes." }, { "start": 92.56, "end": 94.44, "text": " Maybe they have to be rectangular, maybe not." }, { "start": 94.44, "end": 96.44, "text": " And say, this is a bus." }, { "start": 96.44, "end": 98.18, "text": " And here is a truck." }, { "start": 98.18, "end": 99.74000000000001, "text": " And here is another truck." }, { "start": 99.74000000000001, "end": 102.44, "text": " And here is a car." }, { "start": 102.44, "end": 103.44, "text": " And so on." }, { "start": 103.44, "end": 106.36, "text": " So, there can be many objects in an image." }, { "start": 106.36, "end": 107.68, "text": " There can be one object." }, { "start": 107.68, "end": 113.52000000000001, "text": " There can be objects of different classes or there can be no objects at all." }, { "start": 113.52000000000001, "end": 115.48, "text": " So this is just object detection." }, { "start": 115.48, "end": 117.82000000000001, "text": " And there have been many papers on this." }, { "start": 117.82000000000001, "end": 121.56, "text": " And specifically, there has been this RCNN." }, { "start": 121.56, "end": 123.96000000000001, "text": " And this is the model that we're going to extend." }, { "start": 123.96000000000001, "end": 130.56, "text": " So the RCNN model or specifically the faster RCNN model that we're going to build on is" }, { "start": 130.56, "end": 138.18, "text": " a model that simply detects these bounding boxes in single images." }, { "start": 138.18, "end": 144.28, "text": " But now we consider the situation where we have a camera that records images for a long," }, { "start": 144.28, "end": 145.84, "text": " long time." }, { "start": 145.84, "end": 151.8, "text": " So in these wild trap cameras, they often sit there for months." }, { "start": 151.8, "end": 157.84, "text": " And it's not that easy to make use of them because in addition to there being a lot of" }, { "start": 157.84, "end": 160.96, "text": " data, they have motion triggers." }, { "start": 160.96, "end": 164.14000000000001, "text": " So that could be there is no nothing for a long time." }, { "start": 164.14000000000001, "end": 167.46, "text": " And then there's the animal walks in the trap." }, { "start": 167.46, "end": 173.4, "text": " And then you have a bunch of images, like one per second for 10 seconds." }, { "start": 173.4, "end": 176.32, "text": " And then you have nothing again for like a day or two days." }, { "start": 176.32, "end": 181.08, "text": " And then you have 10 images again because another animal walks in or maybe doesn't." }, { "start": 181.08, "end": 182.72, "text": " And so on and another." }, { "start": 182.72, "end": 185.76, "text": " So you have irregular sampling frequencies." }, { "start": 185.76, "end": 190.88, "text": " You have very, very different distance between the frames." }, { "start": 190.88, "end": 198.29999999999998, "text": " All of this makes it very, very not suited for models like temporal convolutions or things" }, { "start": 198.29999999999998, "end": 202.92, "text": " like LSTMs because they don't work super well with data like this." }, { "start": 202.92, "end": 210.28, "text": " Now I know there are formulations where LSTMs can do this, but they don't work very well" }, { "start": 210.28, "end": 215.32, "text": " with these super long contexts and irregular sampling frequencies and so on." }, { "start": 215.32, "end": 222.07999999999998, "text": " So the idea is if we have a frame right here, like this one, and we want to detect what's" }, { "start": 222.07999999999998, "end": 228.4, "text": " on it, we should be able to pull information from other frames that the same camera has" }, { "start": 228.4, "end": 234.64, "text": " seen like from this one or from this one or from this one right here." }, { "start": 234.64, "end": 236.95999999999998, "text": " And we should be able to do so in a dynamic way." }, { "start": 236.95999999999998, "end": 238.56, "text": " Now why could that help?" }, { "start": 238.56, "end": 242.6, "text": " If you look at, for example, down here, these images have been taken." }, { "start": 242.6, "end": 246.84, "text": " They say images were taken on separate days." }, { "start": 246.84, "end": 251.24, "text": " But you can see this thing right here is in both images." }, { "start": 251.24, "end": 253.32, "text": " Or a very similar thing." }, { "start": 253.32, "end": 256.6, "text": " It's probably that bus's regular route." }, { "start": 256.6, "end": 263.9, "text": " So in order to classify whether or not this here is a bus, it might be very helpful to" }, { "start": 263.9, "end": 269.32, "text": " also look at this picture right here and see, ah, you know, it's about at the same location." }, { "start": 269.32, "end": 272.52, "text": " It looks the same and also it looks like a bus." }, { "start": 272.52, "end": 277.85999999999996, "text": " So you know, that kind of gives evidence that this could be, this other thing could also" }, { "start": 277.85999999999996, "end": 279.34, "text": " be a bus." }, { "start": 279.34, "end": 282.03999999999996, "text": " Then also there are background objects." }, { "start": 282.03999999999996, "end": 286.88, "text": " So sometimes the single frame detectors get confused." }, { "start": 286.88, "end": 292.2, "text": " It might be labeling this here as a car because just the lighting, the exact lighting in this" }, { "start": 292.2, "end": 297.12, "text": " picture is just off by the correct amount that it is confused." }, { "start": 297.12, "end": 302.28, "text": " But considering this picture over here, maybe it recognizes here, no, that's not a car." }, { "start": 302.28, "end": 310.79999999999995, "text": " And it can bring over this evidence to that frame and consider, ah, maybe you know this" }, { "start": 310.79999999999995, "end": 312.53999999999996, "text": " is the same thing." }, { "start": 312.53999999999996, "end": 314.64, "text": " So it's not a car." }, { "start": 314.64, "end": 318, "text": " So this is not the same than simply adding training data." }, { "start": 318, "end": 323.64, "text": " We really consider the fact here that these images, they come from the same camera that" }, { "start": 323.64, "end": 330.76, "text": " is in the same location or maybe, you know, that is filming the same thing." }, { "start": 330.76, "end": 337.88, "text": " So this, all of this is going to be within the same camera, not just adding, adding IID" }, { "start": 337.88, "end": 339, "text": " training data." }, { "start": 339, "end": 345.44, "text": " And with animals as well, like often the same animal has like its regular route or within" }, { "start": 345.44, "end": 352.56, "text": " these 10, these burst of tens, the same animal will kind of walk around a bit and maybe," }, { "start": 352.56, "end": 357.7, "text": " you know, here it's half occluded, but maybe in a different image you see, ah, here I see" }, { "start": 357.7, "end": 358.8, "text": " the nose." }, { "start": 358.8, "end": 363.92, "text": " So it helps you make a better prediction." }, { "start": 363.92, "end": 370.8, "text": " Also animals are often in kind of crowds and that helps if you see that there are other" }, { "start": 370.8, "end": 377.48, "text": " deer around, the probability that this is a deer increases rapidly." }, { "start": 377.48, "end": 380.36, "text": " So how are we going to do this?" }, { "start": 380.36, "end": 386.04, "text": " What we're going to do is we're going to build an attention mechanism that can do these kinds" }, { "start": 386.04, "end": 394.40000000000003, "text": " of look into the past and some, also a little bit of the future as we will see, but mainly" }, { "start": 394.40000000000003, "end": 400.26000000000005, "text": " we'll look into other images from the same camera in a dynamic way and we'll learn how" }, { "start": 400.26000000000005, "end": 405.46000000000004, "text": " to address those other images from a memory bank." }, { "start": 405.46000000000004, "end": 410.64000000000004, "text": " So the architecture is described right here." }, { "start": 410.64, "end": 416.36, "text": " Now as you can see, we are still in the business of doing object detection." }, { "start": 416.36, "end": 422.68, "text": " So what we'll do is we'll sort of hijack a existing object detector and the object detector" }, { "start": 422.68, "end": 429.76, "text": " we're going to hijack is going to be this FRCNN, this faster RCNN object detector." }, { "start": 429.76, "end": 435.41999999999996, "text": " That's an object detector for a single frame problem." }, { "start": 435.41999999999996, "end": 439.96, "text": " So that means you have one image and you're supposed to detect what's on it." }, { "start": 439.96, "end": 442.15999999999997, "text": " It has two stages, as you can see." }, { "start": 442.15999999999997, "end": 448.08, "text": " So stage one, if you have an image and let's say there's some stuff on it, stuff, stuff," }, { "start": 448.08, "end": 450.76, "text": " stuff, there's stuff." }, { "start": 450.76, "end": 456.2, "text": " What stage one is supposed to do is it's supposed to extract regions of interest." }, { "start": 456.2, "end": 460.03999999999996, "text": " This could be, okay, all of these are regions of interest." }, { "start": 460.03999999999996, "end": 465.58, "text": " So it simply says, well, there is something, there might be something right here in these" }, { "start": 465.58, "end": 467.47999999999996, "text": " regions of interest." }, { "start": 467.48, "end": 473.92, "text": " And then it describes each of these regions of interest using features." }, { "start": 473.92, "end": 479.40000000000003, "text": " So it extracts these regions of interest and each region of interest gets features assigned" }, { "start": 479.40000000000003, "end": 480.40000000000003, "text": " to it." }, { "start": 480.40000000000003, "end": 487.84000000000003, "text": " So, well, these are, I think these are like seven by seven by 2048 features, but let's" }, { "start": 487.84000000000003, "end": 495.46000000000004, "text": " just say for the sake of describing it that these are just a vector of features for each" }, { "start": 495.46000000000004, "end": 496.46000000000004, "text": " region of interest." }, { "start": 496.46, "end": 502.35999999999996, "text": " So each region of interest is going to be associated with one vector of features that" }, { "start": 502.35999999999996, "end": 504.4, "text": " this model extracts." }, { "start": 504.4, "end": 505.4, "text": " Okay." }, { "start": 505.4, "end": 510.2, "text": " And the next region of interest also has a vector and the next region of interest also" }, { "start": 510.2, "end": 513.12, "text": " has a vector and so on." }, { "start": 513.12, "end": 521.9, "text": " Stage two then takes each one of these, takes each one of these vectors and assigns a class" }, { "start": 521.9, "end": 522.9, "text": " to it." }, { "start": 522.9, "end": 524.8, "text": " So this would be deer right here." }, { "start": 524.8, "end": 528.92, "text": " Okay, so stage one proposes regions of interest along with features." }, { "start": 528.92, "end": 536.56, "text": " Then stage two takes each of these regions of interest and classifies them basically." }, { "start": 536.56, "end": 539.16, "text": " And I guess there's many in between stages." }, { "start": 539.16, "end": 540.68, "text": " Like this is massively simplified." }, { "start": 540.68, "end": 542.16, "text": " There's non-maximum suppression." }, { "start": 542.16, "end": 549.16, "text": " There is kind of an alignment stage where you can refine the bounding box and so on." }, { "start": 549.16, "end": 551.3599999999999, "text": " But in essence, these are two stages." }, { "start": 551.36, "end": 556.4, "text": " And you can see that this system here, it goes in between the two stages." }, { "start": 556.4, "end": 562.2, "text": " So all of this right here, we shove in between the two stages." }, { "start": 562.2, "end": 568.36, "text": " So we'll still use the stage one and we'll still use the stage two, but in between in" }, { "start": 568.36, "end": 574.48, "text": " this thing right here, we'll try to sort of pimp these features such that the stage two" }, { "start": 574.48, "end": 577.5600000000001, "text": " detector has an easier time classifying." }, { "start": 577.5600000000001, "end": 578.5600000000001, "text": " Okay." }, { "start": 578.56, "end": 583.4, "text": " So now we're going to pimp these features by incorporating in because these features" }, { "start": 583.4, "end": 588.76, "text": " right now, if we just do it vanilla, these are just from the current frame." }, { "start": 588.76, "end": 594.8399999999999, "text": " And we're going to add to them information from other frames of the same camera." }, { "start": 594.8399999999999, "end": 598.3599999999999, "text": " And we're going to do it in two different ways." }, { "start": 598.3599999999999, "end": 603.8399999999999, "text": " So the first way, as you can see here, the first way is this short term memory." }, { "start": 603.8399999999999, "end": 607.76, "text": " And the second way is the long term memory." }, { "start": 607.76, "end": 610.4, "text": " Now the two are slightly different." }, { "start": 610.4, "end": 615.56, "text": " As you can guess, the short term memory is going to be only over a short time period" }, { "start": 615.56, "end": 617.52, "text": " around the current frame." }, { "start": 617.52, "end": 625.02, "text": " And the long term memory is going to be basically across a very long time horizon into the past." }, { "start": 625.02, "end": 631.2, "text": " You can see we're trying to classify this blue frame right here, what we call the key" }, { "start": 631.2, "end": 632.2, "text": " frame." }, { "start": 632.2, "end": 633.92, "text": " So what we'll do is we'll run it through stage one." }, { "start": 633.92, "end": 634.92, "text": " Cool." }, { "start": 634.92, "end": 638, "text": " So we're going to add two features for each region of interest." }, { "start": 638, "end": 643.24, "text": " And then you can see this goes here and through these residual connections, this goes into" }, { "start": 643.24, "end": 645.5999999999999, "text": " stage two over here." }, { "start": 645.5999999999999, "end": 651.66, "text": " So basically, stage two still receives the same input, it receives whatever stage one" }, { "start": 651.66, "end": 653.8, "text": " outputs for the key frame." }, { "start": 653.8, "end": 656.8, "text": " But we're going to add to that twice." }, { "start": 656.8, "end": 660.8199999999999, "text": " So we're going to add two things as I said." }, { "start": 660.82, "end": 665, "text": " So the short term memory is added right here." }, { "start": 665, "end": 668.2800000000001, "text": " Now how do we build the short term memory?" }, { "start": 668.2800000000001, "end": 673.74, "text": " We build the short term memory simply by considering all the frames around the key frame." }, { "start": 673.74, "end": 677.9200000000001, "text": " And this you can see right here, the current window around the key frame, which can be" }, { "start": 677.9200000000001, "end": 684, "text": " like one frame around it or two frames or three frames, just a few frames around the" }, { "start": 684, "end": 685.32, "text": " current frame." }, { "start": 685.32, "end": 686.9200000000001, "text": " And this can be fairly helpful." }, { "start": 686.92, "end": 692.86, "text": " As we said, for example, if the deer moves a bit, the car moves a bit, you know, it gets" }, { "start": 692.86, "end": 695.88, "text": " into a slightly different lighting and so on." }, { "start": 695.88, "end": 703.42, "text": " This can help us very much to classify the current key frame if we also have features" }, { "start": 703.42, "end": 705.4799999999999, "text": " from the surrounding frames." }, { "start": 705.4799999999999, "end": 713.16, "text": " So for each of these surrounding frames, we also run them through the stage one detector" }, { "start": 713.16, "end": 716.56, "text": " to also extract regions of interest." }, { "start": 716.56, "end": 723.78, "text": " And that all of these features go into this memory short term memory bank right here." }, { "start": 723.78, "end": 728.16, "text": " There's different strategies, you don't always have to extract all of the regions of interest." }, { "start": 728.16, "end": 734.2399999999999, "text": " You can also extract just the top one and so on, or you can extract the mean, since" }, { "start": 734.2399999999999, "end": 737.8199999999999, "text": " these are fairly, you know, consistent, the cameras at the same place." }, { "start": 737.8199999999999, "end": 739.3599999999999, "text": " There are many ways you can do this." }, { "start": 739.3599999999999, "end": 746.0799999999999, "text": " But what you ultimately end up with is a short term memory bank that kind of is so you'll" }, { "start": 746.08, "end": 754.9000000000001, "text": " have a bank and you have lots of these feature vectors in here for your region, your regions" }, { "start": 754.9000000000001, "end": 757.9200000000001, "text": " of interest of the surrounding frames." }, { "start": 757.9200000000001, "end": 763.62, "text": " Now if this here, if this here is your half occluded deer, right, so this is the half" }, { "start": 763.62, "end": 771.8000000000001, "text": " occluded deer, and you want to consider information from the surrounding frames, maybe in the" }, { "start": 771.8, "end": 777.9599999999999, "text": " next frame, so maybe this is three frames, like 123 and two is the key frame, maybe in" }, { "start": 777.9599999999999, "end": 781.4399999999999, "text": " the next frame, the deer moves a bit and you see its nose." }, { "start": 781.4399999999999, "end": 785.8599999999999, "text": " And that this particular region of interest here is relevant." }, { "start": 785.8599999999999, "end": 794.24, "text": " So how do you know how do you now get from this entire memory, this feature vector that" }, { "start": 794.24, "end": 796.04, "text": " would be helpful?" }, { "start": 796.04, "end": 799.9599999999999, "text": " And the answer is you get it through an attention mechanism." }, { "start": 799.96, "end": 804.4000000000001, "text": " You can see that right here, the way the short term memory is added is through this attention" }, { "start": 804.4000000000001, "end": 805.5400000000001, "text": " block." }, { "start": 805.5400000000001, "end": 807.76, "text": " They describe the attention block right here." }, { "start": 807.76, "end": 810.6800000000001, "text": " It is a fairly standard attention mechanism." }, { "start": 810.6800000000001, "end": 813.2800000000001, "text": " So I've done a video on attention is all you need." }, { "start": 813.2800000000001, "end": 818.6800000000001, "text": " If you don't know what an attention mechanism is, go check it out." }, { "start": 818.6800000000001, "end": 821.88, "text": " But you can see it's it's very, very standard." }, { "start": 821.88, "end": 827.2, "text": " So you have these input features, which are the features that come from the key frame." }, { "start": 827.2, "end": 832.2800000000001, "text": " And you have the context features, which are all the features in your memory bank, you" }, { "start": 832.2800000000001, "end": 838.36, "text": " encode the input features with into a query using a fully connected layers and the context" }, { "start": 838.36, "end": 840.1600000000001, "text": " features into keys." }, { "start": 840.1600000000001, "end": 846.24, "text": " And then you match the queries with the keys and the softmax in order to get a weighting" }, { "start": 846.24, "end": 848.2800000000001, "text": " over the context features." }, { "start": 848.2800000000001, "end": 852.4000000000001, "text": " And then you aggregate the values from the context features." }, { "start": 852.4000000000001, "end": 855.4200000000001, "text": " So this is a standard attention mechanism." }, { "start": 855.4200000000001, "end": 856.4200000000001, "text": " What does it mean?" }, { "start": 856.42, "end": 863.68, "text": " It basically means that each of these vectors right here, they will emit a key that kind" }, { "start": 863.68, "end": 868.9, "text": " of describes what kind of information is contained in that vector." }, { "start": 868.9, "end": 876.04, "text": " The vector over here will emit a query that describes what sort of information it is looking" }, { "start": 876.04, "end": 882.1999999999999, "text": " for to in order to describe what's in the region of interest as well as possible." }, { "start": 882.2, "end": 888.5200000000001, "text": " And then you simply match the query with the keys to determine which key fits best to that" }, { "start": 888.5200000000001, "end": 895.24, "text": " query and whichever one fits best, let's say this one here, then you take that vector from" }, { "start": 895.24, "end": 902.9200000000001, "text": " the memory bank and incorporate it together with your current information that you already" }, { "start": 902.9200000000001, "end": 903.9200000000001, "text": " have." }, { "start": 903.9200000000001, "end": 910.32, "text": " So that's how you address things that from other frames using an attention mechanism." }, { "start": 910.32, "end": 916.08, "text": " Okay, now if this were all, you know, we could train this right now." }, { "start": 916.08, "end": 921.72, "text": " We could train all of this because all of this is differentiable, right?" }, { "start": 921.72, "end": 924.8000000000001, "text": " This stage one detector right here is differentiable." }, { "start": 924.8000000000001, "end": 932, "text": " It goes here and here, you know, the information, the attention mechanism is differentiable." }, { "start": 932, "end": 935.5200000000001, "text": " The stage two detector is differentiable, all differentiable." }, { "start": 935.5200000000001, "end": 936.5200000000001, "text": " Cool." }, { "start": 936.5200000000001, "end": 938.5600000000001, "text": " We can train this end to end." }, { "start": 938.5600000000001, "end": 939.5600000000001, "text": " Now what's the problem?" }, { "start": 939.56, "end": 942.7399999999999, "text": " The problem is this long term memory right here." }, { "start": 942.7399999999999, "end": 948.76, "text": " So in this memory, ideally, we would want to fit, let's say an entire day, an entire" }, { "start": 948.76, "end": 953.64, "text": " week or even an entire month of data from one of these cameras." }, { "start": 953.64, "end": 960.8, "text": " And it's just not feasible that we expand this current window here to an entire month" }, { "start": 960.8, "end": 966.2199999999999, "text": " or an entire week for many of those of those cameras, because even though they have a low" }, { "start": 966.22, "end": 973.1600000000001, "text": " frame rate and so on, it's still too much in order to then be all differentiable, all" }, { "start": 973.1600000000001, "end": 976.22, "text": " backpropagatable and so on." }, { "start": 976.22, "end": 982.24, "text": " So we can't really backprop in for these long term memory." }, { "start": 982.24, "end": 984.76, "text": " In essence, what we want to do is exactly the same." }, { "start": 984.76, "end": 992.44, "text": " We want to build up a memory of all of the regions of interest or maybe selected regions" }, { "start": 992.44, "end": 999.0400000000001, "text": " or all of the best regions of interest, whatever heuristic strategy we have of the past, whatever" }, { "start": 999.0400000000001, "end": 1003.96, "text": " this camera has seen, let's say in the last month or in the current week or something" }, { "start": 1003.96, "end": 1009.1600000000001, "text": " like this, we want to build all of this up and then use an attention mechanism, just" }, { "start": 1009.1600000000001, "end": 1011.7600000000001, "text": " the same in order to incorporate it." }, { "start": 1011.7600000000001, "end": 1019.2800000000001, "text": " But we have to come up with these things right here in some other way than a way where we" }, { "start": 1019.2800000000001, "end": 1020.2800000000001, "text": " can backprop." }, { "start": 1020.28, "end": 1028.68, "text": " So we can't really use this stage one detector right here because this is the one we're training" }, { "start": 1028.68, "end": 1030.76, "text": " and so we have to backprop through it." }, { "start": 1030.76, "end": 1037.12, "text": " Now an easy proposal is to simply use it anyway, but do like a stop gradient on it so we don't" }, { "start": 1037.12, "end": 1038.68, "text": " backprop through it." }, { "start": 1038.68, "end": 1042.96, "text": " That is one way but this the paper decides on a different way." }, { "start": 1042.96, "end": 1051.92, "text": " The paper decides that all of the past basically right here, right here and so on, we'll take" }, { "start": 1051.92, "end": 1054.8400000000001, "text": " a pre-trained object detector." }, { "start": 1054.8400000000001, "end": 1061.08, "text": " So not the one we're training currently, but we'll take a pre-trained one that was pre-trained" }, { "start": 1061.08, "end": 1067.96, "text": " either on something like Cocoa, which is an object detection data set, or you can pre-train" }, { "start": 1067.96, "end": 1074.52, "text": " it on Cocoa and then fine tune it on a task you're interested in, in a single frame fashion." }, { "start": 1074.52, "end": 1082.16, "text": " For whatever way, we'll take a pre-trained object detector or region of interest extractor" }, { "start": 1082.16, "end": 1088.68, "text": " and that will give us for each frame in the past will give us also the regions of interest" }, { "start": 1088.68, "end": 1093.56, "text": " along with the features." }, { "start": 1093.56, "end": 1100.52, "text": " And these are the features that we then go and put into the memory bank." }, { "start": 1100.52, "end": 1103.52, "text": " Sorry, my tablet just crashed a bit." }, { "start": 1103.52, "end": 1105.52, "text": " There we go." }, { "start": 1105.52, "end": 1111.32, "text": " Okay, so we'll take a pre-trained extractor right here." }, { "start": 1111.32, "end": 1115.6399999999999, "text": " That will give us features for regions of interest, we'll put that into the memory bank," }, { "start": 1115.6399999999999, "end": 1119.28, "text": " and then we will use an attention mechanism to incorporate it." }, { "start": 1119.28, "end": 1126.32, "text": " Now the attention mechanism we can train, but we cannot train the extractor for the" }, { "start": 1126.32, "end": 1127.32, "text": " features." }, { "start": 1127.32, "end": 1131.84, "text": " And this is the difference to the short term memory where we can actually train the feature" }, { "start": 1131.84, "end": 1137.12, "text": " extractor in order to help us with building the memory." }, { "start": 1137.12, "end": 1141.72, "text": " Now the memory is simply built without a goal in mind basically." }, { "start": 1141.72, "end": 1148.2, "text": " And the attention mechanism basically has to learn that it doesn't work with features" }, { "start": 1148.2, "end": 1150.16, "text": " that are meant for its task." }, { "start": 1150.16, "end": 1155.04, "text": " It works with features that have been originally created for a different tasks and they're" }, { "start": 1155.04, "end": 1156.6000000000001, "text": " not going to change." }, { "start": 1156.6000000000001, "end": 1160.6000000000001, "text": " But as we'll see, this, you know, can be handled." }, { "start": 1160.6000000000001, "end": 1162.44, "text": " So that's what they do." }, { "start": 1162.44, "end": 1168.4, "text": " They incorporate short term and long term memory into their stage two prediction and" }, { "start": 1168.4, "end": 1173.16, "text": " then the stage two prediction simply takes in all of those features and classifies the" }, { "start": 1173.16, "end": 1176.1200000000001, "text": " class of the object." }, { "start": 1176.12, "end": 1179.8, "text": " And that's the architecture of context rcnn." }, { "start": 1179.8, "end": 1185.56, "text": " It's rcnn with long and short term context." }, { "start": 1185.56, "end": 1191.1, "text": " So they describe very different ways of you know, how they built the memory and so on," }, { "start": 1191.1, "end": 1192.6, "text": " how they built the features." }, { "start": 1192.6, "end": 1195.8799999999999, "text": " I didn't, I kind of glossed over this right now." }, { "start": 1195.8799999999999, "end": 1201.4399999999998, "text": " There's a lot of consideration in building these things and you have to look at the paper" }, { "start": 1201.4399999999998, "end": 1204.2399999999998, "text": " how they exactly do this." }, { "start": 1204.24, "end": 1209.96, "text": " I'm more interested in the high level architecture and the sort of ideas behind it." }, { "start": 1209.96, "end": 1218.8, "text": " So when they do this, they do outperform the, they do outperform the current or the single" }, { "start": 1218.8, "end": 1220.98, "text": " frame baselines by quite a bit." }, { "start": 1220.98, "end": 1227.32, "text": " So this SS and this CCT are these wildlife data sets, whereas this CC, I think this is" }, { "start": 1227.32, "end": 1233.44, "text": " the city something city cam, these are this street data set." }, { "start": 1233.44, "end": 1239.52, "text": " As you can see, they do outperform the single frame baseline by quite a bit." }, { "start": 1239.52, "end": 1244.88, "text": " Now interesting, as you can see right here, as they increase the time horizon of this" }, { "start": 1244.88, "end": 1250.28, "text": " long term memory, so they, they can, they can now choose how much information do they" }, { "start": 1250.28, "end": 1252.76, "text": " want to put in that long term memory." }, { "start": 1252.76, "end": 1259.4, "text": " As they increase the time horizon for one minute, one hour, one day and so on, the performance" }, { "start": 1259.4, "end": 1267.64, "text": " goes up and up and up, which is a strong indication that these features actually help from the" }, { "start": 1267.64, "end": 1271.1000000000001, "text": " time horizon, because you don't have more parameters." }, { "start": 1271.1000000000001, "end": 1277.0400000000002, "text": " You simply increase the amount of information in the memory bank." }, { "start": 1277.0400000000002, "end": 1284.16, "text": " And if the performance goes up, you can make a very strong claim that these, this is actually" }, { "start": 1284.16, "end": 1288.52, "text": " due to the fact that you have more information in that memory bank." }, { "start": 1288.52, "end": 1293.36, "text": " Couldn't really guess any other explanation right here." }, { "start": 1293.36, "end": 1298.6399999999999, "text": " So they, they do, they do investigate different memory strategies." }, { "start": 1298.6399999999999, "end": 1303.72, "text": " They do a lot of ablations right here, where they also say, okay, what if we only have" }, { "start": 1303.72, "end": 1305.86, "text": " the short term attention?" }, { "start": 1305.86, "end": 1307.96, "text": " What if we only have the long term attention?" }, { "start": 1307.96, "end": 1312.84, "text": " What to only, if we only have self attention, that means attention only into the current" }, { "start": 1312.84, "end": 1316.72, "text": " frame, but of across regions of interest." }, { "start": 1316.72, "end": 1321.04, "text": " That's interesting if you have like a herd of animals and so on, and they all help." }, { "start": 1321.04, "end": 1328.24, "text": " But as you can see, the long term attention tends to help the most in this data set." }, { "start": 1328.24, "end": 1332.18, "text": " And the short term attention help helps a lot in this data set." }, { "start": 1332.18, "end": 1337.84, "text": " If you just compare to the other owner, these are two different metrics, not data sets." }, { "start": 1337.84, "end": 1339.32, "text": " Sorry about that." }, { "start": 1339.32, "end": 1347.32, "text": " But in essence, it helps the most when you combine the two and that's, you know, that's" }, { "start": 1347.32, "end": 1351.86, "text": " pretty cool to see." }, { "start": 1351.86, "end": 1356.7, "text": " So they do some qualitative results, which I find very interesting." }, { "start": 1356.7, "end": 1363.2, "text": " For example, they can visualize what the attention weights of their models are." }, { "start": 1363.2, "end": 1371.1000000000001, "text": " So here, you always have a very long timeframe, I think an entire month in this, in this memory" }, { "start": 1371.1000000000001, "end": 1374.48, "text": " bank of the long term memory." }, { "start": 1374.48, "end": 1379.16, "text": " Now in the top classification, you see the large thing here, the large frame is the one" }, { "start": 1379.16, "end": 1382.18, "text": " you actually want to classify." }, { "start": 1382.18, "end": 1389.42, "text": " And the other frames are the frames where the top attention score is so that the attention" }, { "start": 1389.42, "end": 1393.72, "text": " weights are the highest." }, { "start": 1393.72, "end": 1398.28, "text": " So here in order to classify this, what does the model pay attention to?" }, { "start": 1398.28, "end": 1401.44, "text": " Or which other frames does the model pay attention to?" }, { "start": 1401.44, "end": 1406.74, "text": " And you can see right here, they are all spread across the entire month." }, { "start": 1406.74, "end": 1408.8200000000002, "text": " Here is the timeline." }, { "start": 1408.8200000000002, "end": 1412.98, "text": " The most attended to pictures are spread across the entire month." }, { "start": 1412.98, "end": 1419.14, "text": " And almost all of them actually have that work on in here." }, { "start": 1419.14, "end": 1422.22, "text": " So this must be like its regular route." }, { "start": 1422.22, "end": 1428.5800000000002, "text": " And the model recognizes that and pulls in information from all these other images in" }, { "start": 1428.5800000000002, "end": 1432.96, "text": " order to correctly classify it here." }, { "start": 1432.96, "end": 1444.3200000000002, "text": " On the other hand, on the next example, this gazelle and tablet crashed right here." }, { "start": 1444.32, "end": 1450.6799999999998, "text": " It also puts all the weight on top of images of that same gazelle." }, { "start": 1450.6799999999998, "end": 1456.26, "text": " But you can see maybe that gazelle was only there for this one particular moment." }, { "start": 1456.26, "end": 1462.32, "text": " And all the pictures this camera has of it is, you know, in the very few moments that" }, { "start": 1462.32, "end": 1463.7, "text": " the gazelle was around." }, { "start": 1463.7, "end": 1469.54, "text": " You can see they all come here from the same point in time, or very, very close points" }, { "start": 1469.54, "end": 1470.54, "text": " in time." }, { "start": 1470.54, "end": 1477.22, "text": " And you can see that it puts a lot of weight on wherever the gazelle is." }, { "start": 1477.22, "end": 1481.74, "text": " So you know, that's a pretty strong indication that it actually learns to pull in the correct" }, { "start": 1481.74, "end": 1489, "text": " information be that from long time horizon, or from a short time horizon if necessary." }, { "start": 1489, "end": 1497.28, "text": " You can also see right here, they visualize the top attention, where the top attention" }, { "start": 1497.28, "end": 1505.96, "text": " weights go, in terms of how long the frames where the attention goes to is away from the" }, { "start": 1505.96, "end": 1508.96, "text": " frame that they're trying to classify." }, { "start": 1508.96, "end": 1514.54, "text": " So these graphics are somewhat kind of weird to interpret." }, { "start": 1514.54, "end": 1519.3999999999999, "text": " This here always means how much is the total time of the buffer." }, { "start": 1519.3999999999999, "end": 1526.18, "text": " So the memory buffer here contains always pictures from the total from one hour before" }, { "start": 1526.18, "end": 1529.68, "text": " until one hour after the key frame you want to classify." }, { "start": 1529.68, "end": 1533.5, "text": " So this is the frame you want to classify at minute zero." }, { "start": 1533.5, "end": 1540.18, "text": " And the memory buffer contains images from 60 minutes before to 60 minutes after." }, { "start": 1540.18, "end": 1541.74, "text": " So it's not real time, right?" }, { "start": 1541.74, "end": 1545.14, "text": " You go back to your through your footage and you try to classify." }, { "start": 1545.14, "end": 1549.7, "text": " You can also pull out images from the future." }, { "start": 1549.7, "end": 1554.18, "text": " You can see there's most attention is on the current frame, which makes sense." }, { "start": 1554.18, "end": 1558.9, "text": " You're trying to classify the current frame and it kind of falls off as you go further" }, { "start": 1558.9, "end": 1560.74, "text": " and further away." }, { "start": 1560.74, "end": 1562.5800000000002, "text": " This is across the entire data set." }, { "start": 1562.5800000000002, "end": 1565.74, "text": " So this is not a specific example, which also makes sense." }, { "start": 1565.74, "end": 1572.7, "text": " Probably in most of the time, the relevant information is closer in time rather than" }, { "start": 1572.7, "end": 1573.96, "text": " farther away." }, { "start": 1573.96, "end": 1577.54, "text": " But also you can see that the distribution is pretty spread out." }, { "start": 1577.54, "end": 1582.18, "text": " So it makes the model makes use of the entire range of time." }, { "start": 1582.18, "end": 1587.3400000000001, "text": " And you can see that throughout, even if you have an entire day in the buffer or two days," }, { "start": 1587.3400000000001, "end": 1592.18, "text": " even if you have entire week before and week after in the buffer, and even if you have" }, { "start": 1592.18, "end": 1595.0800000000002, "text": " an entire month here." }, { "start": 1595.0800000000002, "end": 1600.5, "text": " And especially if you look at when you have an entire week in the buffer, you can see" }, { "start": 1600.5, "end": 1605.24, "text": " the periodicity through the days." }, { "start": 1605.24, "end": 1612.14, "text": " So that means the model tends to pay attention to images that are from the same time of day." }, { "start": 1612.14, "end": 1615.7800000000002, "text": " Compared to the current key frame." }, { "start": 1615.7800000000002, "end": 1621.66, "text": " That's fairly, fairly good indication that the model has actually learned to address" }, { "start": 1621.66, "end": 1625.0200000000002, "text": " these this memory by its content, right?" }, { "start": 1625.0200000000002, "end": 1630.1000000000001, "text": " Now night and day isn't super difficult because you can just go on the brightness and so on." }, { "start": 1630.1000000000001, "end": 1635.14, "text": " But still, it's pretty cool to see that this is actually happening." }, { "start": 1635.14, "end": 1641.66, "text": " They do have some failure cases of the single frame model that their model is able to handle" }, { "start": 1641.66, "end": 1643.5800000000002, "text": " up here." }, { "start": 1643.5800000000002, "end": 1646.8400000000001, "text": " And they make a lot of sense." }, { "start": 1646.8400000000001, "end": 1652.74, "text": " So here you can see that there is an object that's moving out of frame." }, { "start": 1652.74, "end": 1659.7, "text": " And the single frame detector wasn't able to recognize this probably because it's moving" }, { "start": 1659.7, "end": 1660.8600000000001, "text": " out of frame." }, { "start": 1660.8600000000001, "end": 1666.02, "text": " Whereas this new this context rcnn is able to detect it probably because it looked at" }, { "start": 1666.02, "end": 1673.22, "text": " the frame just before it where the car was somewhere back here and it could correctly" }, { "start": 1673.22, "end": 1674.22, "text": " classify it." }, { "start": 1674.22, "end": 1679.42, "text": " Well, that's well, I just disregard my drawings." }, { "start": 1679.42, "end": 1686.54, "text": " Here it managed to recognize this animal in the back, whereas this old model, the single" }, { "start": 1686.54, "end": 1693.66, "text": " frame model hasn't also probably by looking either at frames next to it or by looking" }, { "start": 1693.66, "end": 1700.0600000000002, "text": " at other frames of herds of animals and realizing that usually when there's two elephants, there's" }, { "start": 1700.0600000000002, "end": 1703.3000000000002, "text": " more." }, { "start": 1703.3000000000002, "end": 1706.26, "text": " Here you can see that the object highly occluded." }, { "start": 1706.26, "end": 1713.14, "text": " So we're talking about the object like at the very edge of the frame object poorly lit." }, { "start": 1713.14, "end": 1716.14, "text": " This is particularly impressive." }, { "start": 1716.14, "end": 1721.26, "text": " And also an example where the animals are often in herds." }, { "start": 1721.26, "end": 1726.54, "text": " And if you see one deer, the likelihood that there's other deer is very high in this particular" }, { "start": 1726.54, "end": 1729.06, "text": " camera." }, { "start": 1729.06, "end": 1734.58, "text": " And by aggregating information from different frames, you can see that maybe it's always" }, { "start": 1734.58, "end": 1737.58, "text": " the same patch of the air that comes by." }, { "start": 1737.58, "end": 1746.06, "text": " And here, the single frame detector detects this patch here as a vehicle where it shouldn't." }, { "start": 1746.06, "end": 1751.7, "text": " And of course, the new model, the context RCNN is able to recognize that this is present" }, { "start": 1751.7, "end": 1753.94, "text": " in all of the frames." }, { "start": 1753.94, "end": 1761.94, "text": " And in most frames, the single object detector doesn't detect it as a vehicle." }, { "start": 1761.94, "end": 1765.3, "text": " And so it can kind of carry over that information." }, { "start": 1765.3, "end": 1770.58, "text": " Now you can already see sort of what the downsides might be if the single object detector is like" }, { "start": 1770.58, "end": 1777.6599999999999, "text": " very, very, very sure that this is in a single frame that this is a car." }, { "start": 1777.6599999999999, "end": 1780.8799999999999, "text": " It could carry over that information to the other frame." }, { "start": 1780.8799999999999, "end": 1786.78, "text": " So even though the single frame detector might have failed in that particular frame, if it" }, { "start": 1786.78, "end": 1791.46, "text": " fails super hard, it might, you know, shout that to all the other frames basically dominate" }, { "start": 1791.46, "end": 1796.34, "text": " the memory saying like, look, this is a car, I'm like pretty sure." }, { "start": 1796.34, "end": 1801.34, "text": " And it will carry over that information to all of the other frames." }, { "start": 1801.34, "end": 1808.8999999999999, "text": " And they say in one of these high confidence mistakes, it basically detected the same tree" }, { "start": 1808.8999999999999, "end": 1813.34, "text": " as a giraffe over and over again." }, { "start": 1813.34, "end": 1822.98, "text": " What I find particularly interesting is they do look at, so here they have this curve of" }, { "start": 1822.98, "end": 1828.06, "text": " on the bottom, you have confidence threshold, so how confident the model is." }, { "start": 1828.06, "end": 1832.92, "text": " And on the y-axis, you have the number of false positives." }, { "start": 1832.92, "end": 1842.14, "text": " And you can see that in the low confidence regime, the context RCNN has lower false positives" }, { "start": 1842.14, "end": 1846.04, "text": " than the single frame detector." }, { "start": 1846.04, "end": 1849.3600000000001, "text": " And the green line here is when you only have positive boxes." }, { "start": 1849.36, "end": 1856.4199999999998, "text": " So when you only include regions of interest where there is an actual object, which in" }, { "start": 1856.4199999999998, "end": 1862.26, "text": " this case is sort of hurtful, you also want the regions of interest where there is nothing" }, { "start": 1862.26, "end": 1867.34, "text": " because that helps you avoid false positives in other frames." }, { "start": 1867.34, "end": 1869.1799999999998, "text": " That's why the orange line is below the green line." }, { "start": 1869.1799999999998, "end": 1874.5, "text": " But strangely here in the high confidence regime, you can see that the single frame" }, { "start": 1874.5, "end": 1878.7199999999998, "text": " model has fewer false positives than the context RCNN." }, { "start": 1878.72, "end": 1885.18, "text": " And I like the text that they have to this." }, { "start": 1885.18, "end": 1889.42, "text": " In figure 7, we can see that adding empty representations reduces the number of false" }, { "start": 1889.42, "end": 1894.26, "text": " positives across all confidence threshold compared to the same model with only positive" }, { "start": 1894.26, "end": 1895.82, "text": " representations." }, { "start": 1895.82, "end": 1901.66, "text": " We investigated the 100 highest confidence false positives from context RCNN and found" }, { "start": 1901.66, "end": 1908.18, "text": " that in almost all of them, in 97 out of 100, the model had correctly found and classified" }, { "start": 1908.18, "end": 1912.3400000000001, "text": " animals that were missed by human annotators." }, { "start": 1912.3400000000001, "end": 1923.46, "text": " So basically these graphs are even underestimating how good that model is because the model appears" }, { "start": 1923.46, "end": 1928.02, "text": " to be better than the human annotators of the test set." }, { "start": 1928.02, "end": 1933.8200000000002, "text": " I find that to be pretty, pretty impressive." }, { "start": 1933.82, "end": 1939.6799999999998, "text": " And here you can see failure modes where they say, for example, when exploring the confident" }, { "start": 1939.6799999999998, "end": 1946.86, "text": " false positives on the snapshot Serengeti data set, the three out of 100 images, so" }, { "start": 1946.86, "end": 1955.82, "text": " whatever was not a human failure, where context RCNN erroneously detected an animal, where" }, { "start": 1955.82, "end": 1961.06, "text": " all of the same tree highly confidently predicted to be a giraffe." }, { "start": 1961.06, "end": 1966.94, "text": " So this is a failure mode when the model is highly confident it might spill that over" }, { "start": 1966.94, "end": 1974.06, "text": " to other frames because we now aggregate the information within the same camera across" }, { "start": 1974.06, "end": 1976.1399999999999, "text": " the frames." }, { "start": 1976.1399999999999, "end": 1983.06, "text": " To be said, of course, their train test split is such that there's not the same camera in" }, { "start": 1983.06, "end": 1985.06, "text": " the training data as in the testing data." }, { "start": 1985.06, "end": 1992.62, "text": " They have entirely different cameras in the testing data than in the training data, just" }, { "start": 1992.62, "end": 1996.54, "text": " so there is no information leakage." }, { "start": 1996.54, "end": 2001.4199999999998, "text": " So that's the model right here, how it works." }, { "start": 2001.4199999999998, "end": 2002.5, "text": " It's pretty cool." }, { "start": 2002.5, "end": 2009.3799999999999, "text": " It kind of wedges itself in between any single frame object detector that has these two stages." }, { "start": 2009.38, "end": 2018.3400000000001, "text": " And it's a pretty neat idea to bring in context from the past or even the future of the same" }, { "start": 2018.3400000000001, "end": 2019.5200000000002, "text": " camera." }, { "start": 2019.5200000000002, "end": 2023.8200000000002, "text": " Just a quick glance at the appendix, they have lots of different examples right here." }, { "start": 2023.8200000000002, "end": 2028.46, "text": " In one example, their camera kind of fell over and they say, well, it still worked." }, { "start": 2028.46, "end": 2036.3000000000002, "text": " The system was still able to kind of do attention across this failure, this kind of tipping" }, { "start": 2036.3000000000002, "end": 2039.3000000000002, "text": " over of the camera." }, { "start": 2039.3, "end": 2044.46, "text": " They have more examples right here, which I find pretty impressive, like these super" }, { "start": 2044.46, "end": 2052.14, "text": " low light things where it correctly detects like the possum." }, { "start": 2052.14, "end": 2059.22, "text": " And yeah, I invite you to check out the paper, the code they say should be out soon." }, { "start": 2059.22, "end": 2061.22, "text": " And I'll see you next time." }, { "start": 2061.22, "end": 2069.8999999999996, "text": " Bye bye." } ]
Hdo81GtLC_4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Direct Feedback Alignment Scales to Modern Deep Learning Tasks and Architectures (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "gnn", "transformer", "graph", "biology", "neurons", "axon", "dendrites", "plausible", "biologically plausible", "backprop", "backpropagation", "dfa", "feedback alignment", "random projections" ]
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 Alonet, Jacopo Poli, François Boniface and Florian Krzakala. 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 backprop on modern deep learning tasks. This paper as I understand it is the first one to demonstrate that it can do that. So this is very much an engineering paper, an applied paper and we're going to mostly go into direct feedback alignment as such and I don't think we're going to go too much into what the actual empirical findings are because they even though they're impressive and it's a good piece of engineering I think they can be summarized pretty much by it 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 that is you know essential otherwise how are we gonna hear from me in the future? Okay let's dive in. They say despite being the workhorse 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 our 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 it's basic back propagation but you have an input to a neural network and the neural network has a bunch of layers so the input will travel layer by layer and at the end you'll get some output and your output y hat, let's call it here what the neural network thinks the let's say it's a classifier, thinks that the class of this particular X should be. Now in the data set you have your true label and then you compare that to your output label and you can compute a loss function. Now the whole question of the 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 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 dendrites, your inputs and 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 information flowing in the opposite direction but 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 arrows to the front right here they use the weight matrices and these arrows to the back they use the transposes of the weight matrices. So the transposes of the weight matrices sort of relay the information of what needs to change that would be the loss. What needs to change to make the losses small as possible. They relay this information down to the other layers and we don't know of any biological 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 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 non-linearity. 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 DFA updates. So well they're not going to replace the layers but they're going to replace the back propagation part of it with DFA updates. It remains to say that they still use back propagation at some places where they can't replace the updates with DFA and that means where the layer isn't you know a fully connected layer or I guess it's too big. They somehow have to make it work so often they will not update for example the embedding layers and things like this. Okay so what they're saying is they go away from computer vision tasks because if you go to computer vision and CNNs rule that world right you can only do for feet-forward layers fully connected layers you're gonna lose already. So yeah it's kind of an unfair fight in that sense but even in absence of that they say we apply this to neural view synthesis, recommender systems, geometric learning and natural language processing. So these are quite diverse tasks and they're going to be quite diverse architectures that they 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 there your algorithm can shine. Okay so that's it and they're basically going to show that this is performance is close to fine-tuned back propagation. 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 Arl Noecklund sorry Noecklund 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 a direct feedback alignment. In feedback alignment you simply say well I won't back prop using these transposes because I can't because that's not biologically possible. What I'll do is I'll use other matrices and these other matrices are going to be random matrices and by random matrices we really mean a matrix that is of you know the correct shape the same shape as this W transpose but each entry is going to be sampled from a like a random Gaussian right now I don't mean like the distribution of Gaussians but you fix this matrix once at the beginning of training by sampling from Gaussian and then you leave it there and that's going to be the matrix that you use for relaying the signal back through the layers. Now you might protest and say wait that's not 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 direct feedback alignment and direct feedback alignment goes a step further because in feedback alignment you still do this in a sequential manner direct feedback alignment simply takes whatever the top change should be the change to the top layer so how do I need to change the top layer and it back propagates that in a this global fashion to all the layers directly using random matrices okay and then this IFA we're not 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 scroll okay so here is the mathematical formulation of all of this and it pays to look at it to understand what's going on so they characterize a neural network right here as having n layers each neural network is the following each neural each layer takes whatever is the output of the last layer multiplies it by a weight matrix and that's going to be your a quantity you put a through a non-linearity to obtain the next layers input okay so the H is the output of this layer and the input of the next layer at the very end your last output is going to be your estimation of the labels so your last non-linearity is probably going to be something like a a softmax or something like this okay so how can we how can we have this as a concept in our heads if you have the neural network right here what you want to do is you want to forward prop always using your weight matrix W and then your non-linearity of that particular layer and then the last in the last layer you get your y hat as we saw before now the question is how can we adjust how can we adjust this W right here to make y hat more into the direction of y and here it's in here it's useful to think of the last layer as a vector output like usually we think of the loss function but in all of these algorithms they always start with the derivative of the loss function with respect to the last layer output so ay and ay is here right before the non-linearity if you remember this was f of ay and this here I guess is the softmax so if this is a classifier the ay here those are the logits and that's the output of your last layer so it instead of having y and y hat right sorry y hat right here it pays to maybe think of the output as a vector and the desired output as another vector and the desired output is of course going to be one hot vector in the case of in the case of a classification but it you know if you think of it like this then you'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 now becomes how do I tell the lower layers about this change right here this is the change that I want to make in the lower layers how do I get the lower layers such that they provide me with that signal with with the green signal instead of the red signal so I need to propagate this blue difference in the back propagation algorithm you can simply ask the system right so we've built entire frameworks on being able to back propagate tensorflow pytorch jacks whatever because with back propagation we can simply ask the system this question so here is how should I change the weights of my layer to make the loss smaller you can just ask that you can say what's the gradient of the loss with respect to the to my weights and the night 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 layers output this right here as you can see over here is going to be this is going to be whatever comes back from the back propagation so in back propagation you always have to think of if you want to update these weights you need two quantities you need whatever comes from the bottom or came from the bottom during the forward pass and whatever comes from the top during the backward pass and this quantity here is going to be the one that came from the top and it's basically how you need to change the next layer in order to make the loss happier and by using this right here you pull it back to this layer so how do I need to change this layer and here you see that dreaded transpose of that weight matrix this is what we can't do in biology but this is what back propagation does so it pulls back how you need to change the next layer it pulls it back to this layer so this quantity right here is basically how do I need to change the output of this particular layer in order to make the loss happier and then you multiply it by the signal that comes from the bottom and that will give you how you need to change your weights okay so the green part is how does the output of the layer need to change and the multiplied by the blue part it's how do the weights need to change and of course the non-linearity is in there as well but let's let's just leave the non-linearity away because it's really not important for this particular thing so this is what backprop does what does DFA do DFA here again asks how should I change the weights of layer I and DFA says well first you need to compute this thing right here this is you see the derivative of the loss with respect to a y now a y is the output of the last layer these are in in our case for example your log it's okay note that this is still a gradient so it's not like we can't differentiate anymore we simply can't do back propagation from layer to layer okay so this is the quantity how do we need to change the last 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 you have to compare this to backprop so what's actually changing is this green part right here right we agree that this is the thing that's changing and what do we say does the green part mean the green part basically tells you how do you how should the output of this layer change okay by adjusting the weights in the direction of the thing on the right side of the equality sign you're going to change the output of the layer into the direction of that green part now in backpropagation the green part basically tells you how should the output of this layer change in order to make the 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 logits layer right what does it actually do let's say we have that's a three-dimensional last layer which means you have three classes right if your last layer is three-dimensional you have three classes each axis represents one class because you encode the classes as one hot vectors so this might be C the class label equals zero this might be C equals one this might be C equals two if you have something that you forward propagate through your neural network and let's say it comes out to be like this what would you classify that as now you classify that as the whatever class has the the biggest inner product with that vector which would be the C equals zero class right here and what is this quantity going to be how should you update this output in order to make the loss happier now that depends on your true label but let's say your true label is actually the zero label now what you want to do is you want to update that thing into the direction here right such that it is more aligned with the axis so what happens if you pull that back through a random matrix now the thing you have to know about random matrices like this is that they do approximately preserve distances and angles so technically if you pull this back what you're going to induce is another coordinate system in that other space now this can be a higher or a lower dimensional space I frankly I don't care but what you're going to induce is a coordinate system and what do you pull through that B matrix so this is the BI matrix you fix it right this is really important you fix it at the beginning of training it's always the same it preserves distances and angles approximately you pull back that quantity which is the okay my colors are all screwed which is the green arrow over here you pull back this green arrow here so what does it mean what so the output right here the output vector that came from the lower layers right that's 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 a random matrix we don't know we know that the angle is approximately preserved okay but you know that and these 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 input this one vector we input a whole bunch of data now let's consider two other vectors so first I want to consider this this blue vector right here now the blue vector is also going to have a label of zero so what does the blue vectors update look like the blue vector is going to be pulled into this direction and I also want to consider this red vector right here the red vector is of class one so what does the red vectors update going to look like like this 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 let's draw the blue somewhere here and the red somewhere here what I do know is that the angles and distances are preserved so what is the green thing going to look like the update for the blue vector is going to be something like this and the update for the red vector is going to maybe be something like this you know away from from those so what is happening in that lower space you'll notice that the two vectors that are supposed to be in the same class this and this they are going to be pulled together now the direction they're pulled in that's determined by this random matrix but we know they're going to be pulled together because they are pulled together in this space in the final space okay and they're going to be pulled apart from the red vector okay because that red vector is going to 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 the non-linearity they might you know intertwine a bit again but there's 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 going to have a really easy job separating those classes and performing good classification so that's what I think is happening in this algorithm so even though the layers don't know how to change to help the last layer by the fact that these random matrices and induce a clustering together you know by back propagating these updates here it helps the last layer make it makes its job really easy and you know that's all the classifier needs and I want to I want to show again this is my opinion this is not anything of value it's just my hypothesis of why something like this could work I want to show you in this paper that I've shown you before right here they do actually do these experiments with DFA and they show that you can see top row shows feature obtained with back propagation bottom row shows features obtained with DFA I think these are input and features I'm not sure where exactly they are in the network but you can see that this clustering clearly emerges so oh yeah here from left to right input images first hidden layer second hidden layer third hidden layer so you can see that the clustering from layer to layer in backprop and also in DFA is better and better so the reason why backprop is good maybe it's just that because it also really induces clusterings like this I don't know maybe backprop does even does something on top of that because I mean backprop has all the properties of this and more right but still this this is congruent with my hypothesis of what's happening so what do they do with it they take this algorithm and they apply it to these architectures now let's for example look at one of them this neural view synthesis with neural radiance fields so neural radiance fields is a type of model to do this task of where you get a bunch of views of an object in 3d or you know a bunch of views around an object and you're supposed to render a new view and you can see that the DFA parameter or the DFA updated nerve neural radiance field model is pretty close to the 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 level that hasn't been seen before so here if you consider these results higher is better on the synthetic data set here even you see that if you have the same model with backprop it performs better than with DFA but the DFA for that model performs better than these other baseline models that have themselves been trained with 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 macro they just use it DFA for the individual blocks and micro they use it for each layer and already told you that you still in the attention mechanism you still have to use backprop within the attention mechanism but it is much more of a plausible algorithm than the 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 performant 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 backprop or very close to it so I do invite you to go and look at the experiments they have a lot of lot of details on how they did it and exactly how you have to change the architectures to make DFA work and the hyper parameters and so on so that's really cool and they have some more outputs right here of the view synthesis and so on yeah if you are interested in that thing I again I don't want to disrespect it it's just I don't think there is much point in me going over it it's the results are always sort of the same that DFA it it's not there yet but it's a good direction yeah I hope this was informative let me know if you disagree about my assessment of DFA I could be completely wrong or you know I yeah or or this could be like well known to people already so yeah see you next time
[ { "start": 0, "end": 4.84, "text": " Hi there, today we'll look at direct feedback alignment scales to modern deep" }, { "start": 4.84, "end": 10.66, "text": " learning tasks and architectures by Julia Alonet, Jacopo Poli, François Boniface" }, { "start": 10.66, "end": 16.8, "text": " and Florian Krzakala. So this paper on a high level it replaces the back" }, { "start": 16.8, "end": 21.52, "text": " propagation algorithm in deep learning architectures with this algorithm called" }, { "start": 21.52, "end": 27.240000000000002, "text": " direct feedback alignment which is more biologically plausible. The algorithm has" }, { "start": 27.24, "end": 31.439999999999998, "text": " been around for a while but it hasn't yet been shown to be applicable to" }, { "start": 31.439999999999998, "end": 36.92, "text": " really modern big deep learning architectures and then perform on par" }, { "start": 36.92, "end": 42.04, "text": " with backprop on modern deep learning tasks. This paper as I understand it is" }, { "start": 42.04, "end": 46.879999999999995, "text": " the first one to demonstrate that it can do that. So this is very much an" }, { "start": 46.879999999999995, "end": 54.72, "text": " engineering paper, an applied paper and we're going to mostly go into direct" }, { "start": 54.72, "end": 58.92, "text": " feedback alignment as such and I don't think we're going to go too much into" }, { "start": 58.92, "end": 64.16, "text": " what the actual empirical findings are because they even though they're" }, { "start": 64.16, "end": 67.56, "text": " impressive and it's a good piece of engineering I think they can be" }, { "start": 67.56, "end": 74, "text": " summarized pretty much by it works not yet on par with back propagation but" }, { "start": 74, "end": 80.4, "text": " into a promising direction. Alright as always if you like content like this" }, { "start": 80.4, "end": 85.60000000000001, "text": " consider sharing it out and leaving a like and tell me in the comments what" }, { "start": 85.60000000000001, "end": 91.36000000000001, "text": " you like. Of course subscribe if you aren't yet that that is you know" }, { "start": 91.36000000000001, "end": 97.60000000000001, "text": " essential otherwise how are we gonna hear from me in the future? Okay let's" }, { "start": 97.60000000000001, "end": 101.64000000000001, "text": " dive in. They say despite being the workhorse of deep learning the back" }, { "start": 101.64000000000001, "end": 106.60000000000001, "text": " propagation algorithm is no panacea. It enforces sequential layer updates thus" }, { "start": 106.6, "end": 111.28, "text": " preventing efficient parallelization of the training process. Furthermore its" }, { "start": 111.28, "end": 116.47999999999999, "text": " biological plausibility is being challenged. Alternative schemes have been" }, { "start": 116.47999999999999, "end": 121.88, "text": " devised yet under the constraints of synaptic asymmetry. None have scaled to" }, { "start": 121.88, "end": 126.24, "text": " modern deep learning tasks and architectures. Here we challenge this" }, { "start": 126.24, "end": 131.35999999999999, "text": " perspective and study the applicability of direct feedback alignment to neural" }, { "start": 131.35999999999999, "end": 136.4, "text": " view synthesis, recommender systems, geometric learning and natural language" }, { "start": 136.4, "end": 142.72, "text": " processing. In contrast with previous studies limited to computer vision tasks" }, { "start": 142.72, "end": 146.4, "text": " our findings show that it successfully trains a large range of state-of-the-art" }, { "start": 146.4, "end": 150.72, "text": " deep learning architectures with performance close to fine-tuned back" }, { "start": 150.72, "end": 156.12, "text": " propagation. At variance with common beliefs our work supports that" }, { "start": 156.12, "end": 160.72, "text": " challenging tasks can be tackled in the absence of weight transport. So there's a" }, { "start": 160.72, "end": 167.68, "text": " lot to unpack in this particular abstract right here. So first of all what's the" }, { "start": 167.68, "end": 172.28, "text": " problem with back propagation? Back propagation they have they have two" }, { "start": 172.28, "end": 177.48, "text": " corals right here. First of all it's preventing efficient parallelization of" }, { "start": 177.48, "end": 183.32, "text": " the training process. So what does that mean? So in back propagation I'm pretty" }, { "start": 183.32, "end": 187.8, "text": " sure you all know it's basic back propagation but you have an input to a" }, { "start": 187.8, "end": 191.16000000000003, "text": " neural network and the neural network has a bunch of layers so the input will" }, { "start": 191.16000000000003, "end": 196.4, "text": " travel layer by layer and at the end you'll get some output and your output" }, { "start": 196.4, "end": 201.4, "text": " y hat, let's call it here what the neural network thinks the let's say it's a" }, { "start": 201.4, "end": 206.36, "text": " classifier, thinks that the class of this particular X should be. Now in the" }, { "start": 206.36, "end": 212.96, "text": " data set you have your true label and then you compare that to your output" }, { "start": 212.96, "end": 218.32000000000002, "text": " label and you can compute a loss function. Now the whole question of the" }, { "start": 218.32000000000002, "end": 222.56, "text": " back propagation algorithm is how do I need to change my layers of the neural" }, { "start": 222.56, "end": 227.60000000000002, "text": " network in order to make the loss as small as possible? And for that you can" }, { "start": 227.60000000000002, "end": 231.08, "text": " use back propagation that means you can take that loss and you can back" }, { "start": 231.08, "end": 238.12, "text": " propagate it down the layers in order to update each layer individually. So the" }, { "start": 238.12, "end": 241.68, "text": " first problem they have here with the back propagation algorithm and it's not" }, { "start": 241.68, "end": 247.08, "text": " I mean it's kind of a secondary problem but it is that is sequential. So in order" }, { "start": 247.08, "end": 252.48000000000002, "text": " to update this layer right here you need to have already back propagated to this" }, { "start": 252.48000000000002, "end": 256.56, "text": " layer and then you need to back propagate further to this and to this" }, { "start": 256.56, "end": 261.08, "text": " layer so it's a sequential task you need to back propagate down the layers again" }, { "start": 261.08, "end": 267.44, "text": " whereas what is more plausible but what would be more efficient if we could" }, { "start": 267.44, "end": 272.36, "text": " somehow update all the layers in parallel but this is a minor quarrel. The" }, { "start": 272.36, "end": 277.52, "text": " bigger one is that back propagation isn't biologically plausible. We know" }, { "start": 277.52, "end": 283.04, "text": " that in real neurons you have your dendrites, your inputs and your" }, { "start": 283.04, "end": 289.64, "text": " axon and the signal only travels in one direction. We don't know of a feedback" }, { "start": 289.64, "end": 295.32, "text": " mechanism in true neurons in the brain that would allow for information sort of" }, { "start": 295.32, "end": 299.92, "text": " to flow in the opposite direction. There is information flowing in the" }, { "start": 299.92, "end": 305.59999999999997, "text": " opposite direction but I think it's too slow and it's so it's not" }, { "start": 305.59999999999997, "end": 312.44, "text": " really it can't be there's no analogous way of back propagation. There's no" }, { "start": 312.44, "end": 318.36, "text": " nothing in the brain that would take the role of the back propagation algorithm." }, { "start": 318.36, "end": 325.40000000000003, "text": " Specifically if each layer is characterized by a weight matrix right here" }, { "start": 325.40000000000003, "end": 332.76, "text": " what back propagation does is it uses the transpose of that weight matrix to" }, { "start": 332.76, "end": 339.92, "text": " back propagate. So these arrows to the front right here they use the" }, { "start": 339.92, "end": 345.44, "text": " weight matrices and these arrows to the back they use the transposes of the" }, { "start": 345.44, "end": 351.48, "text": " weight matrices. So the transposes of the weight matrices sort of relay the" }, { "start": 351.48, "end": 355.8, "text": " information of what needs to change that would be the loss. What needs to change" }, { "start": 355.8, "end": 361.64, "text": " to make the losses small as possible. They relay this information down to the" }, { "start": 361.64, "end": 367.6, "text": " other layers and we don't know of any biological analogy to this" }, { "start": 367.6, "end": 372.92, "text": " mechanism right here. This transpose it acts as sort of a layer inverse and that" }, { "start": 372.92, "end": 379.6, "text": " is called weight transport. So weight transport means that you can you can do" }, { "start": 379.6, "end": 384.52000000000004, "text": " something like the transpose of the weights basically to carry to bring" }, { "start": 384.52000000000004, "end": 390.84000000000003, "text": " information from the next layer back to this layer. And in biology we don't have" }, { "start": 390.84000000000003, "end": 395.72, "text": " this and in direct feedback alignment we don't have this either. So direct" }, { "start": 395.72, "end": 401.32, "text": " feedback alignment the next thing here in this abstract is the algorithm that" }, { "start": 401.32, "end": 405.88, "text": " they are going to apply here. Direct feedback alignment and we'll go into" }, { "start": 405.88, "end": 410.36, "text": " what it is but it is more biologically plausible in that what it does is it" }, { "start": 410.36, "end": 416.08, "text": " takes the loss somehow and it distributes it globally to all of these" }, { "start": 416.08, "end": 423.64, "text": " layers like this. And it does so without requiring these transposes and also" }, { "start": 423.64, "end": 429.56, "text": " without requiring these sequential steps. So both of their proposed problems here" }, { "start": 429.56, "end": 440.08, "text": " would be solved by this. They say that in contrast with previous studies" }, { "start": 440.08, "end": 445.36, "text": " limited to computer vision tasks. So what people have tried to do is they have" }, { "start": 445.36, "end": 452.32, "text": " tried to apply this DFA algorithm to computer vision tasks. But in computer" }, { "start": 452.32, "end": 457.32, "text": " vision most architectures are CNNs and as I understand it as far as I" }, { "start": 457.32, "end": 464.04, "text": " understand it DFA can only right now be applied to linear layers. So something" }, { "start": 464.04, "end": 470.68, "text": " that is WX plus B and then a non-linearity. It cannot even though you" }, { "start": 470.68, "end": 476.84, "text": " can write the CNN as like a linear layer with constraints as I read this paper I" }, { "start": 476.84, "end": 482.4, "text": " think to interpret that you can only apply DFA to fully connected layers or" }, { "start": 482.4, "end": 487.03999999999996, "text": " things that look kind of like fully connected layers. So what they're going to" }, { "start": 487.04, "end": 490, "text": " do in their experiments is they're going to take these big architectures like" }, { "start": 490, "end": 495.92, "text": " transformers and replace parts of them with the parts that act as fully" }, { "start": 495.92, "end": 501.20000000000005, "text": " connected layers with DFA updates. So well they're not going to replace" }, { "start": 501.20000000000005, "end": 505.16, "text": " the layers but they're going to replace the back propagation part of it with DFA" }, { "start": 505.16, "end": 509.68, "text": " updates. It remains to say that they still use back propagation at some" }, { "start": 509.68, "end": 515.28, "text": " places where they can't replace the updates with DFA and that means where" }, { "start": 515.28, "end": 519.8399999999999, "text": " the layer isn't you know a fully connected layer or I guess it's too big." }, { "start": 519.8399999999999, "end": 522.9599999999999, "text": " They somehow have to make it work so often they will not update for example" }, { "start": 522.9599999999999, "end": 529.24, "text": " the embedding layers and things like this. Okay so what they're saying is they" }, { "start": 529.24, "end": 533.6, "text": " go away from computer vision tasks because if you go to computer vision and" }, { "start": 533.6, "end": 540.3, "text": " CNNs rule that world right you can only do for feet-forward layers fully" }, { "start": 540.3, "end": 547.1999999999999, "text": " connected layers you're gonna lose already. So yeah it's kind of an" }, { "start": 547.1999999999999, "end": 553.0799999999999, "text": " unfair fight in that sense but even in absence of that they say we" }, { "start": 553.0799999999999, "end": 558.04, "text": " apply this to neural view synthesis, recommender systems, geometric learning" }, { "start": 558.04, "end": 561.76, "text": " and natural language processing. So these are quite diverse tasks and they're" }, { "start": 561.76, "end": 565.68, "text": " going to be quite diverse architectures that they are applying it to. For example" }, { "start": 565.68, "end": 571, "text": " in geometric learning I believe they do graph neural networks and there" }, { "start": 571, "end": 576.88, "text": " they replace the usually in graph neural networks there are fully connected" }, { "start": 576.88, "end": 582.2399999999999, "text": " layers that connect the two the vertices and the edges together and compute" }, { "start": 582.2399999999999, "end": 587.8, "text": " properties of them. So that's a pretty good point for using DFA right because" }, { "start": 587.8, "end": 591.76, "text": " what you're looking for is state-of-the-art tasks and architectures" }, { "start": 591.76, "end": 597.96, "text": " that still employ fully connected layers because there your algorithm can shine." }, { "start": 597.96, "end": 604.56, "text": " Okay so that's it and they're basically going to show that this is performance" }, { "start": 604.56, "end": 612.04, "text": " is close to fine-tuned back propagation. Alright so what is DFA? What is this" }, { "start": 612.04, "end": 617.3199999999999, "text": " direct feedback alignment? And for that I actually want to jump papers right here" }, { "start": 617.32, "end": 623.4000000000001, "text": " and go to this other paper that describes DFA in a bit in a bit not" }, { "start": 623.4000000000001, "end": 628.5200000000001, "text": " more detail but in a graphic fashion. So this paper right here direct feedback" }, { "start": 628.5200000000001, "end": 633.2800000000001, "text": " alignment provides learning in deep neural networks by Arl Noecklund" }, { "start": 633.2800000000001, "end": 641.0400000000001, "text": " sorry Noecklund shows some theoretical properties about DFA. Now I don't want to" }, { "start": 641.0400000000001, "end": 645.9200000000001, "text": " go into the theory right here or in the math but I mainly like this paper for" }, { "start": 645.92, "end": 651.1999999999999, "text": " this particular graphic right here. So in the back propagation algorithm as you" }, { "start": 651.1999999999999, "end": 655.92, "text": " can see you forward propagate using these weight matrices and then you back" }, { "start": 655.92, "end": 662.12, "text": " propagate using the transposes of the weight matrices. Now one step after that" }, { "start": 662.12, "end": 666.4599999999999, "text": " is this thing right here it's called feedback alignment. It's not the same" }, { "start": 666.4599999999999, "end": 671.48, "text": " thing as a direct feedback alignment. In feedback alignment you simply say well I" }, { "start": 671.48, "end": 675.4, "text": " won't back prop using these transposes because I can't because that's not" }, { "start": 675.4, "end": 682.12, "text": " biologically possible. What I'll do is I'll use other matrices and these other" }, { "start": 682.12, "end": 688.28, "text": " matrices are going to be random matrices and by random matrices we really mean a" }, { "start": 688.28, "end": 693.76, "text": " matrix that is of you know the correct shape the same shape as this W transpose" }, { "start": 693.76, "end": 701.12, "text": " but each entry is going to be sampled from a like a random Gaussian right now" }, { "start": 701.12, "end": 706.8, "text": " I don't mean like the distribution of Gaussians but you fix this matrix once" }, { "start": 706.8, "end": 712.4, "text": " at the beginning of training by sampling from Gaussian and then you leave it" }, { "start": 712.4, "end": 717, "text": " there and that's going to be the matrix that you use for relaying the signal" }, { "start": 717, "end": 722.44, "text": " back through the layers. Now you might protest and say wait that's not gonna" }, { "start": 722.44, "end": 728.16, "text": " work because specifically this thing right here it you know that you need to" }, { "start": 728.16, "end": 732.6, "text": " know the weights here to know what you need to change in the lower layers you" }, { "start": 732.6, "end": 737.48, "text": " need to somehow have that information in there how are you gonna know what to" }, { "start": 737.48, "end": 743.04, "text": " change and that's a valid question and I will give my opinion of why this works" }, { "start": 743.04, "end": 750, "text": " okay in a second in two seconds first this is feedback alignment so simply use" }, { "start": 750, "end": 755.92, "text": " random matrices to back propagate so to say and then you have direct feedback" }, { "start": 755.92, "end": 760, "text": " alignment and direct feedback alignment goes a step further because in feedback" }, { "start": 760, "end": 764.24, "text": " alignment you still do this in a sequential manner direct feedback" }, { "start": 764.24, "end": 770.9599999999999, "text": " alignment simply takes whatever the top change should be the change to the top" }, { "start": 770.9599999999999, "end": 776.88, "text": " layer so how do I need to change the top layer and it back propagates that in a" }, { "start": 776.88, "end": 783.4, "text": " this global fashion to all the layers directly using random matrices okay and" }, { "start": 783.4, "end": 788.24, "text": " then this IFA we're not gonna look at today because that's not relevant for" }, { "start": 788.24, "end": 795.8, "text": " this other paper but I hope you can sort of see the overview here so let's go back" }, { "start": 797.4399999999999, "end": 802.16, "text": " scroll scroll scroll scroll scroll scroll scroll okay so here is the" }, { "start": 802.16, "end": 807.6, "text": " mathematical formulation of all of this and it pays to look at it to understand" }, { "start": 807.6, "end": 811.88, "text": " what's going on so they characterize a neural network right here as having n" }, { "start": 811.88, "end": 817.88, "text": " layers each neural network is the following each neural each layer takes" }, { "start": 817.88, "end": 823, "text": " whatever is the output of the last layer multiplies it by a weight matrix and" }, { "start": 823, "end": 830.56, "text": " that's going to be your a quantity you put a through a non-linearity to obtain" }, { "start": 830.56, "end": 836.2, "text": " the next layers input okay so the H is the output of this layer and the input" }, { "start": 836.2, "end": 843.24, "text": " of the next layer at the very end your last output is going to be your" }, { "start": 843.24, "end": 848.72, "text": " estimation of the labels so your last non-linearity is probably going to be" }, { "start": 848.72, "end": 857.32, "text": " something like a a softmax or something like this okay so how can we how can we" }, { "start": 857.32, "end": 863.72, "text": " have this as a concept in our heads if you have the neural network right here" }, { "start": 863.72, "end": 868.76, "text": " what you want to do is you want to forward prop always using your weight" }, { "start": 868.76, "end": 876.5600000000001, "text": " matrix W and then your non-linearity of that particular layer and then the last" }, { "start": 876.5600000000001, "end": 883.84, "text": " in the last layer you get your y hat as we saw before now the question is how can" }, { "start": 883.84, "end": 891.9200000000001, "text": " we adjust how can we adjust this W right here to make y hat more into the" }, { "start": 891.92, "end": 898.16, "text": " direction of y and here it's in here it's useful to think of the last layer" }, { "start": 898.16, "end": 905.4, "text": " as a vector output like usually we think of the loss function but in all of these" }, { "start": 905.4, "end": 910.4, "text": " algorithms they always start with the derivative of the loss function with" }, { "start": 910.4, "end": 918.3199999999999, "text": " respect to the last layer output so ay and ay is here right before the" }, { "start": 918.32, "end": 926.32, "text": " non-linearity if you remember this was f of ay and this here I guess is the softmax" }, { "start": 926.32, "end": 932.08, "text": " so if this is a classifier the ay here those are the logits and that's the" }, { "start": 932.08, "end": 942.08, "text": " output of your last layer so it instead of having y and y hat right sorry y hat" }, { "start": 942.08, "end": 951.0400000000001, "text": " right here it pays to maybe think of the output as a vector and the desired" }, { "start": 951.0400000000001, "end": 956.32, "text": " output as another vector and the desired output is of course going to be one hot" }, { "start": 956.32, "end": 963.36, "text": " vector in the case of in the case of a classification but it you know if you" }, { "start": 963.36, "end": 970.88, "text": " think of it like this then you'll recognize okay I need to change if this" }, { "start": 970.88, "end": 975.84, "text": " is my estimated output and I want to achieve this output I need to change it" }, { "start": 975.84, "end": 981.36, "text": " into this direction right to get more into the same direction as the output I" }, { "start": 981.36, "end": 988.04, "text": " want the entire question now becomes how do I tell the lower layers about this" }, { "start": 988.04, "end": 993.2, "text": " change right here this is the change that I want to make in the lower layers" }, { "start": 993.2, "end": 1000.12, "text": " how do I get the lower layers such that they provide me with that signal" }, { "start": 1000.12, "end": 1005.12, "text": " with with the green signal instead of the red signal so I need to propagate" }, { "start": 1005.12, "end": 1011.28, "text": " this blue difference in the back propagation algorithm you can simply ask" }, { "start": 1011.28, "end": 1016.76, "text": " the system right so we've built entire frameworks on being able to back" }, { "start": 1016.76, "end": 1022.64, "text": " propagate tensorflow pytorch jacks whatever because with back propagation" }, { "start": 1022.64, "end": 1028.08, "text": " we can simply ask the system this question so here is how should I change" }, { "start": 1028.08, "end": 1034.12, "text": " the weights of my layer to make the loss smaller you can just ask that you can" }, { "start": 1034.12, "end": 1040.74, "text": " say what's the gradient of the loss with respect to the to my weights and the" }, { "start": 1040.74, "end": 1046.12, "text": " night negative sign here is because you want to make the loss smaller okay and" }, { "start": 1046.12, "end": 1051.8, "text": " that is going to be a straightforward calculation how does that calculation go" }, { "start": 1051.8, "end": 1062.6399999999999, "text": " it's going to involve this right here is the last layers output this right here" }, { "start": 1062.6399999999999, "end": 1071.36, "text": " as you can see over here is going to be this is going to be whatever comes back" }, { "start": 1071.36, "end": 1075.84, "text": " from the back propagation so in back propagation you always have to think of" }, { "start": 1075.84, "end": 1080.04, "text": " if you want to update these weights you need two quantities you need whatever" }, { "start": 1080.04, "end": 1084.12, "text": " comes from the bottom or came from the bottom during the forward pass and" }, { "start": 1084.12, "end": 1092.1599999999999, "text": " whatever comes from the top during the backward pass and this quantity here is" }, { "start": 1092.1599999999999, "end": 1098.92, "text": " going to be the one that came from the top and it's basically how you need to" }, { "start": 1098.92, "end": 1104.76, "text": " change the next layer in order to make the loss happier and by using this right" }, { "start": 1104.76, "end": 1109.8799999999999, "text": " here you pull it back to this layer so how do I need to change this layer and" }, { "start": 1109.88, "end": 1115.24, "text": " here you see that dreaded transpose of that weight matrix this is what we can't" }, { "start": 1115.24, "end": 1120.4, "text": " do in biology but this is what back propagation does so it pulls back how you" }, { "start": 1120.4, "end": 1126.1200000000001, "text": " need to change the next layer it pulls it back to this layer so this quantity" }, { "start": 1126.1200000000001, "end": 1131.9, "text": " right here is basically how do I need to change the output of this particular" }, { "start": 1131.9, "end": 1138.0200000000002, "text": " layer in order to make the loss happier and then you multiply it by the signal" }, { "start": 1138.02, "end": 1142.6399999999999, "text": " that comes from the bottom and that will give you how you need to change your" }, { "start": 1142.6399999999999, "end": 1148.16, "text": " weights okay so the green part is how does the output of the layer need to" }, { "start": 1148.16, "end": 1153.2, "text": " change and the multiplied by the blue part it's how do the weights need to" }, { "start": 1153.2, "end": 1158.56, "text": " change and of course the non-linearity is in there as well but let's let's just" }, { "start": 1158.56, "end": 1162.52, "text": " leave the non-linearity away because it's really not important for this" }, { "start": 1162.52, "end": 1170.8, "text": " particular thing so this is what backprop does what does DFA do DFA here" }, { "start": 1170.8, "end": 1178.12, "text": " again asks how should I change the weights of layer I and DFA says well" }, { "start": 1178.12, "end": 1183.68, "text": " first you need to compute this thing right here this is you see the derivative" }, { "start": 1183.68, "end": 1189.8, "text": " of the loss with respect to a y now a y is the output of the last layer these" }, { "start": 1189.8, "end": 1195.68, "text": " are in in our case for example your log it's okay note that this is still a" }, { "start": 1195.68, "end": 1200.72, "text": " gradient so it's not like we can't differentiate anymore we simply can't do" }, { "start": 1200.72, "end": 1206.8, "text": " back propagation from layer to layer okay so this is the quantity how do we" }, { "start": 1206.8, "end": 1213.44, "text": " need to change the last layers output and we're going to take that and simply" }, { "start": 1213.44, "end": 1218.84, "text": " feed it through this random matrix and then multiply again let's leave this" }, { "start": 1218.84, "end": 1225.08, "text": " away multiply it by the by this thing right here so if I get my colors" }, { "start": 1225.08, "end": 1229.84, "text": " correct like this again you have your neural network you want to update these" }, { "start": 1229.84, "end": 1236.12, "text": " weights the green is what comes from the top now it doesn't come from the next" }, { "start": 1236.12, "end": 1242.36, "text": " layer but the green actually comes from all the way at the end sorry you can't" }, { "start": 1242.36, "end": 1247.84, "text": " see that I still have to get used to that new frame of view so the green" }, { "start": 1247.84, "end": 1256, "text": " comes all the way from the end and the blue comes from down here okay so this" }, { "start": 1256, "end": 1260.72, "text": " is weird right because especially because this is just modulated by a" }, { "start": 1260.72, "end": 1268.84, "text": " random matrix so how can this possibly work that's the question and I you know" }, { "start": 1268.84, "end": 1271.9199999999998, "text": " I had some thoughts but I haven't read too much about it so I might be" }, { "start": 1271.9199999999998, "end": 1276.72, "text": " completely wrong or this might be completely known in the community I have" }, { "start": 1276.72, "end": 1283.8, "text": " no idea I'll just give my opinion right here so first of all you have to see you" }, { "start": 1283.8, "end": 1289.2, "text": " have to compare this to backprop so what's actually changing is this green" }, { "start": 1289.2, "end": 1293.96, "text": " part right here right we agree that this is the thing that's changing and what" }, { "start": 1293.96, "end": 1299.68, "text": " do we say does the green part mean the green part basically tells you how do" }, { "start": 1299.68, "end": 1306.68, "text": " you how should the output of this layer change okay by adjusting the weights" }, { "start": 1306.68, "end": 1310.3600000000001, "text": " in the direction of the thing on the right side of the equality sign you're" }, { "start": 1310.3600000000001, "end": 1314.6000000000001, "text": " going to change the output of the layer into the direction of that green part" }, { "start": 1314.6000000000001, "end": 1320.24, "text": " now in backpropagation the green part basically tells you how should the" }, { "start": 1320.24, "end": 1326.52, "text": " output of this layer change in order to make the loss as happy as possible now" }, { "start": 1326.52, "end": 1331.76, "text": " we don't have that anymore here we simply change the output of the layer" }, { "start": 1331.76, "end": 1339.68, "text": " into the into the direction of a random transformation of the of the change we" }, { "start": 1339.68, "end": 1344.96, "text": " would like to have in the output now okay that's the the first thing is we" }, { "start": 1344.96, "end": 1349, "text": " understand what's different and we understand what the green quantity means" }, { "start": 1349, "end": 1354.24, "text": " green quantity means how should the output of our layer change okay second" }, { "start": 1354.24, "end": 1360.96, "text": " thing if you look at the last layer of a neural network that that logits layer" }, { "start": 1360.96, "end": 1366.2, "text": " right what does it actually do let's say we have that's a three-dimensional last" }, { "start": 1366.2, "end": 1370.72, "text": " layer which means you have three classes right if your last layer is" }, { "start": 1370.72, "end": 1376.64, "text": " three-dimensional you have three classes each axis represents one class because" }, { "start": 1376.64, "end": 1381.44, "text": " you encode the classes as one hot vectors so this might be C the class" }, { "start": 1381.44, "end": 1388.92, "text": " label equals zero this might be C equals one this might be C equals two if you" }, { "start": 1388.92, "end": 1392.8400000000001, "text": " have something that you forward propagate through your neural network" }, { "start": 1392.8400000000001, "end": 1399.8000000000002, "text": " and let's say it comes out to be like this what would you classify that as now" }, { "start": 1399.8000000000002, "end": 1408.64, "text": " you classify that as the whatever class has the the biggest inner product with" }, { "start": 1408.64, "end": 1415.92, "text": " that vector which would be the C equals zero class right here and what is this" }, { "start": 1415.92, "end": 1421.6000000000001, "text": " quantity going to be how should you update this output in order to make the" }, { "start": 1421.6000000000001, "end": 1426.1200000000001, "text": " loss happier now that depends on your true label but let's say your true label" }, { "start": 1426.1200000000001, "end": 1431.8400000000001, "text": " is actually the zero label now what you want to do is you want to update that" }, { "start": 1431.8400000000001, "end": 1438.72, "text": " thing into the direction here right such that it is more aligned with the axis so" }, { "start": 1438.72, "end": 1444.2, "text": " what happens if you pull that back through a random matrix now the thing" }, { "start": 1444.2, "end": 1448.32, "text": " you have to know about random matrices like this is that they do approximately" }, { "start": 1448.32, "end": 1456.72, "text": " preserve distances and angles so technically if you pull this back what" }, { "start": 1456.72, "end": 1461.32, "text": " you're going to induce is another coordinate system in that other space now" }, { "start": 1461.32, "end": 1467.0800000000002, "text": " this can be a higher or a lower dimensional space I frankly I don't care" }, { "start": 1467.08, "end": 1474.6399999999999, "text": " but what you're going to induce is a coordinate system and what do you pull" }, { "start": 1474.6399999999999, "end": 1479.4399999999998, "text": " through that B matrix so this is the BI matrix you fix it right this is really" }, { "start": 1479.4399999999998, "end": 1482.76, "text": " important you fix it at the beginning of training it's always the same it" }, { "start": 1482.76, "end": 1488.76, "text": " preserves distances and angles approximately you pull back that quantity" }, { "start": 1488.76, "end": 1493.76, "text": " which is the okay my colors are all screwed which is the green arrow over" }, { "start": 1493.76, "end": 1503.4, "text": " here you pull back this green arrow here so what does it mean what so the output" }, { "start": 1503.4, "end": 1508.76, "text": " right here the output vector that came from the lower layers right that's you" }, { "start": 1508.76, "end": 1512.6, "text": " forward propagated that through your network so maybe in this layer it" }, { "start": 1512.6, "end": 1519.24, "text": " actually pointed here we don't know but let's say it pointed here if we pull" }, { "start": 1519.24, "end": 1526.28, "text": " back the green thing it might point here okay now this is since it's a random" }, { "start": 1526.28, "end": 1530.16, "text": " matrix we don't know we know that the angle is approximately preserved okay" }, { "start": 1530.16, "end": 1534.44, "text": " but you know that and these lengths are approximately preserved with relative to" }, { "start": 1534.44, "end": 1543.2, "text": " each other but it doesn't really tell you too much so why is this useful and" }, { "start": 1543.2, "end": 1549.28, "text": " to see why it's useful you need to consider other inputs we don't just in" }, { "start": 1549.28, "end": 1554.88, "text": " input this one vector we input a whole bunch of data now let's consider two" }, { "start": 1554.88, "end": 1563.0800000000002, "text": " other vectors so first I want to consider this this blue vector right here now the" }, { "start": 1563.0800000000002, "end": 1568.04, "text": " blue vector is also going to have a label of zero so what does the blue" }, { "start": 1568.04, "end": 1572.68, "text": " vectors update look like the blue vector is going to be pulled into this" }, { "start": 1572.68, "end": 1578.48, "text": " direction and I also want to consider this red vector right here the red" }, { "start": 1578.48, "end": 1584.2, "text": " vector is of class one so what does the red vectors update going to look like" }, { "start": 1584.2, "end": 1593.0800000000002, "text": " like this and if I consider now the red and the blue vector in this space right" }, { "start": 1593.0800000000002, "end": 1601.1200000000001, "text": " let's I just draw them at random like so okay what I do know actually that's" }, { "start": 1601.12, "end": 1605.86, "text": " that's for consistent let's draw the blue somewhere here and the red" }, { "start": 1605.86, "end": 1611.4399999999998, "text": " somewhere here what I do know is that the angles and distances are preserved" }, { "start": 1611.4399999999998, "end": 1615.9599999999998, "text": " so what is the green thing going to look like the update for the blue vector is" }, { "start": 1615.9599999999998, "end": 1620.56, "text": " going to be something like this and the update for the red vector is going to" }, { "start": 1620.56, "end": 1627.8, "text": " maybe be something like this you know away from from those so what is" }, { "start": 1627.8, "end": 1632.04, "text": " happening in that lower space you'll notice that the two vectors that are" }, { "start": 1632.04, "end": 1637.08, "text": " supposed to be in the same class this and this they are going to be pulled" }, { "start": 1637.08, "end": 1642.84, "text": " together now the direction they're pulled in that's determined by this" }, { "start": 1642.84, "end": 1647.68, "text": " random matrix but we know they're going to be pulled together because they are" }, { "start": 1647.68, "end": 1654.24, "text": " pulled together in this space in the final space okay and they're going to" }, { "start": 1654.24, "end": 1661.92, "text": " be pulled apart from the red vector okay because that red vector is going to to" }, { "start": 1661.92, "end": 1666.8, "text": " be pulled towards a different class in the in the last space and since the" }, { "start": 1666.8, "end": 1670.8, "text": " distances and angles are approximately preserved it's going to be pulled away" }, { "start": 1670.8, "end": 1679.76, "text": " from these in in this space so what this induces in my opinion is some sort of it" }, { "start": 1679.76, "end": 1687.72, "text": " induces this coordinate system where if you make the last layer axis aligned" }, { "start": 1687.72, "end": 1693.36, "text": " because you want to classify it it kind of clusters things that belong in the" }, { "start": 1693.36, "end": 1700.16, "text": " same class in these previous weight spaces right and because and if you do" }, { "start": 1700.16, "end": 1707.84, "text": " this layer by layer so if you do this in layer K and then you make the job easier" }, { "start": 1707.84, "end": 1712.8, "text": " for any layer K plus one that's in between here right because they are now" }, { "start": 1712.8, "end": 1717.32, "text": " the things in the same class are already together pretty okay now you map it" }, { "start": 1717.32, "end": 1721.32, "text": " through a weight and the non-linearity they might you know intertwine a bit" }, { "start": 1721.32, "end": 1727.1599999999999, "text": " again but there's they're more together than they would be otherwise so you make" }, { "start": 1727.1599999999999, "end": 1733.32, "text": " the job for the next layer easier which means that the next layer can also can" }, { "start": 1733.32, "end": 1739.36, "text": " even better cluster things and what you'll end up with in this last layer is" }, { "start": 1739.36, "end": 1745.8799999999999, "text": " the is a basically a class or next to last layer is basically a clustering" }, { "start": 1745.8799999999999, "end": 1751, "text": " where everything that's supposed to be in the same class is together and far" }, { "start": 1751, "end": 1756.8, "text": " apart from each other and since the last layer is the classification layer it's" }, { "start": 1756.8, "end": 1761.24, "text": " going to have a really easy job separating those classes and performing" }, { "start": 1761.24, "end": 1767.28, "text": " good classification so that's what I think is happening in this algorithm so" }, { "start": 1767.28, "end": 1773.32, "text": " even though the layers don't know how to change to help the last layer by the" }, { "start": 1773.32, "end": 1779.84, "text": " fact that these random matrices and induce a clustering together you know by" }, { "start": 1779.84, "end": 1786.28, "text": " back propagating these updates here it helps the last layer make it makes its" }, { "start": 1786.28, "end": 1792.76, "text": " job really easy and you know that's all the classifier needs and I want to I" }, { "start": 1792.76, "end": 1799.16, "text": " want to show again this is my opinion this is not anything of value it's just" }, { "start": 1799.16, "end": 1803.28, "text": " my hypothesis of why something like this could work I want to show you in this" }, { "start": 1803.28, "end": 1806.84, "text": " paper that I've shown you before right here they do actually do these" }, { "start": 1806.84, "end": 1814.28, "text": " experiments with DFA and they show that you can see top row shows feature" }, { "start": 1814.28, "end": 1819.48, "text": " obtained with back propagation bottom row shows features obtained with DFA I" }, { "start": 1819.48, "end": 1825.96, "text": " think these are input and features I'm not sure where exactly they are in the" }, { "start": 1825.96, "end": 1832.36, "text": " network but you can see that this clustering clearly emerges so oh yeah" }, { "start": 1832.36, "end": 1836.72, "text": " here from left to right input images first hidden layer second hidden layer" }, { "start": 1836.72, "end": 1841.24, "text": " third hidden layer so you can see that the clustering from layer to layer in" }, { "start": 1841.24, "end": 1848.56, "text": " backprop and also in DFA is better and better so the reason why backprop is" }, { "start": 1848.56, "end": 1853.88, "text": " good maybe it's just that because it also really induces clusterings like" }, { "start": 1853.88, "end": 1857.76, "text": " this I don't know maybe backprop does even does something on top of that" }, { "start": 1857.76, "end": 1864, "text": " because I mean backprop has all the properties of this and more right but" }, { "start": 1864, "end": 1871.04, "text": " still this this is congruent with my hypothesis of what's happening so what" }, { "start": 1871.04, "end": 1877.44, "text": " do they do with it they take this algorithm and they apply it to these" }, { "start": 1877.44, "end": 1883.08, "text": " architectures now let's for example look at one of them this neural view" }, { "start": 1883.08, "end": 1889.3999999999999, "text": " synthesis with neural radiance fields so neural radiance fields is a type of" }, { "start": 1889.3999999999999, "end": 1897.24, "text": " model to do this task of where you get a bunch of views of an object in 3d or you" }, { "start": 1897.24, "end": 1902.2, "text": " know a bunch of views around an object and you're supposed to render a new view" }, { "start": 1902.2, "end": 1910.92, "text": " and you can see that the DFA parameter or the DFA updated nerve neural radiance" }, { "start": 1910.92, "end": 1917.68, "text": " field model is pretty close to the back propagation updated one you can see it's" }, { "start": 1917.68, "end": 1922.92, "text": " a bit more blurry but it it works right and I think the this paper is really" }, { "start": 1922.92, "end": 1929.1200000000001, "text": " trying to show that look this works it doesn't work you know extremely well but" }, { "start": 1929.1200000000001, "end": 1935.68, "text": " it works and it works on a level that hasn't been seen before so here if you" }, { "start": 1935.68, "end": 1940.3600000000001, "text": " consider these results higher is better on the synthetic data set here even you" }, { "start": 1940.3600000000001, "end": 1944.76, "text": " see that if you have the same model with backprop it performs better than with" }, { "start": 1944.76, "end": 1952.5600000000002, "text": " DFA but the DFA for that model performs better than these other baseline models" }, { "start": 1952.56, "end": 1958.36, "text": " that have themselves been trained with back propagation so it's definitely in" }, { "start": 1958.36, "end": 1965.76, "text": " the direction of being competitive and that's the same thing they show with all" }, { "start": 1965.76, "end": 1970.12, "text": " of these experiments so they apply this to graph networks apply this to" }, { "start": 1970.12, "end": 1975.32, "text": " transformers and as I said it's it's not there yet you see that so in the" }, { "start": 1975.32, "end": 1979.6799999999998, "text": " transformers they have these settings where macro they just use it DFA for the" }, { "start": 1979.68, "end": 1984.88, "text": " individual blocks and micro they use it for each layer and already told you that" }, { "start": 1984.88, "end": 1989.48, "text": " you still in the attention mechanism you still have to use backprop within the" }, { "start": 1989.48, "end": 1996.8, "text": " attention mechanism but it is much more of a plausible algorithm than the back" }, { "start": 1996.8, "end": 2001.76, "text": " propagation through the entire network and they show that if they appropriately" }, { "start": 2001.76, "end": 2007.44, "text": " tweak the hyper parameters they do get into the direction of something that's" }, { "start": 2007.44, "end": 2012.64, "text": " performant at least with this macro strategy now this is nowhere close to" }, { "start": 2012.64, "end": 2018.52, "text": " this is nowhere close to what the to what the back propagation algorithm" }, { "start": 2018.52, "end": 2024.96, "text": " achieves but it's sort of it's sort of an indication that if the community could" }, { "start": 2024.96, "end": 2031.52, "text": " work as much on this as it has worked on back propagation then probably will make" }, { "start": 2031.52, "end": 2037.1200000000001, "text": " a lot of like we could we could push this to a place where it does perform on" }, { "start": 2037.12, "end": 2043.32, "text": " par with backprop or very close to it so I do invite you to go and look at the" }, { "start": 2043.32, "end": 2050.64, "text": " experiments they have a lot of lot of details on how they did it and exactly" }, { "start": 2050.64, "end": 2055.24, "text": " how you have to change the architectures to make DFA work and the hyper parameters" }, { "start": 2055.24, "end": 2060.3599999999997, "text": " and so on so that's really cool and they have some more outputs right here of the" }, { "start": 2060.3599999999997, "end": 2066.8399999999997, "text": " view synthesis and so on yeah if you are interested in that thing I again I don't" }, { "start": 2066.84, "end": 2071, "text": " want to disrespect it it's just I don't think there is much point in me going" }, { "start": 2071, "end": 2076.6000000000004, "text": " over it it's the results are always sort of the same that DFA it it's not there" }, { "start": 2076.6000000000004, "end": 2083.8, "text": " yet but it's a good direction yeah I hope this was informative let me know if" }, { "start": 2083.8, "end": 2089.8, "text": " you disagree about my assessment of DFA I could be completely wrong or you know" }, { "start": 2089.8, "end": 2096.76, "text": " I yeah or or this could be like well known to people already so yeah see you" }, { "start": 2096.76, "end": 2123.0400000000004, "text": " next time" } ]
cuyM63ugsxI
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
On the Measure of Intelligence by François Chollet - Part 3: The Math (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "chollet", "keras", "google", "francois", "intelligence", "iq", "iq test", "deep neural networks", "prior", "skill", "performance", "measurement", "measure", "test", "number", "intelligent", "smart", "learning", "generalization", "ability", "experience", "humans", "evolution", "nature", "nurture", "psychometrics", "range", "adaptability", "arc", "kaggle", "difficulty", "entropy", "core knowledge", "objectness", "navigation", "contact", "agent", "goal" ]
In this part, we go over the formal definition of the measure of intelligence. In order to do this, we have to frame and quantify the notions of generalization difficulty, priors, and experience in terms of algorithmic complexity. OUTLINE: 0:00 - Intro & Recap 2:50 - Concept Schema 10:00 - Algorithmic Complexity 13:00 - Definitions 15:25 - Generalization Difficulty 18:55 - Developer Aware Generalization Difficulty 22:40 - Priors 25:10 - Experience 30:50 - The Measure Of Intelligence 38:00 - An Ideal Intelligence Benchmark 42:30 - Conclusion Paper: https://arxiv.org/abs/1911.01547 Part 1: https://youtu.be/3_qGrmD6iQY Part 2: https://youtu.be/THcuTJbeD34 Abstract: To make deliberate progress towards more intelligent and more human-like artificial systems, we need to be following an appropriate feedback signal: we need to be able to define and evaluate intelligence in a way that enables comparisons between two systems, as well as comparisons with humans. Over the past hundred years, there has been an abundance of attempts to define and measure intelligence, across both the fields of psychology and AI. We summarize and critically assess these definitions and evaluation approaches, while making apparent the two historical conceptions of intelligence that have implicitly guided them. We note that in practice, the contemporary AI community still gravitates towards benchmarking intelligence by comparing the skill exhibited by AIs and humans at specific tasks such as board games and video games. We argue that solely measuring skill at any given task falls short of measuring intelligence, because skill is heavily modulated by prior knowledge and experience: unlimited priors or unlimited training data allow experimenters to "buy" arbitrary levels of skills for a system, in a way that masks the system's own generalization power. We then articulate a new formal definition of intelligence based on Algorithmic Information Theory, describing intelligence as skill-acquisition efficiency and highlighting the concepts of scope, generalization difficulty, priors, and experience. Using this definition, we propose a set of guidelines for what a general AI benchmark should look like. Finally, we present a benchmark closely following these guidelines, the Abstraction and Reasoning Corpus (ARC), built upon an explicit set of priors designed to be as close as possible to innate human priors. We argue that ARC can be used to measure a human-like form of general fluid intelligence and that it enables fair general intelligence comparisons between AI systems and humans. Authors: François Chollet Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hello and welcome to the third part on On the Measure of Intelligence by François Chollet. Now this is a multi-part series. If you haven't seen the first two parts I recommend to watch at least one of them. They're somewhat overlapping but we've basically gone over the history of intelligence measurement and the foundations of what a measurement for intelligence for an AI system should look like. Today we're going to get into the formal definition of the intelligence that Chollet proposes right here. So this sentence here pretty much sums up what 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 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 scope of tasks that humans can solve and are sort of different at. 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 it's very difficult if the task itself is very difficult then achieving good score at it should count as having higher intelligence if all other things are equal. So this is going to be the basis and today we're going to watch Shirley define these things into a 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. 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 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 like a ResNet plus SGD. That is an intelligent system and if it is output 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, 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 sever 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 it's 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. 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 is curriculum it's slightly more intricate but just the notion here makes sense right the intelligent system produces the skill program. So there's a lot of formalisms right here like okay the task has 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 François Cholet 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 its own state so it takes the internal state of the intelligent system and outputs another internal state and this is the you know where I said the internal the intelligent system at each training step it can observe what happens and basically react accordingly so it takes the situation the response and the feedback and its own internal state as an input now what do we have here it takes the situation which would be in our case the training sample the response or the the logits that the 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 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 blah lots of definitions all right quantifying generalization difficulty experience and priors using algorithmic information theory so these things that at the beginning we said that we want to define intelligence with respect to we are now going to quantify using algorithmic information theory algorithmic information theory in this case right here that we're using it's not very complicated the main quantity is this H the algorithmic complexity it the H of s is the length of the shortest description of the string in a fixed universal language okay so it's the length of the shortest program that outputs the string when running on a fixed universal Turing 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 so so in the worst case that's the the string itself but if the string is like 0 1 0 1 0 1 0 1 all the way you can just say 0 1 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 to produce a given output okay 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 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 0 1 0 0 1 okay and s1 is 0 1 0 0 1 0 1 0 0 1 okay so it's just twice that so you could you could sort of output that string here we could write a program that just outputs this or you could write a program just that just says two times s2 okay so that the 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 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 solve t theta is the shortest of all possible solutions of t so task t has a solution of threshold theta which the threshold theta is just this is like the minimum score we need to achieve in a task we don't we consider tasks according to thresholds like you know you need to get a I don't know what a score of 9000 in Pong or so so the shortest 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 and the other quantity is this train soul opt TC this has a lot of quantity right here you can see the task we want to be optimal but with respect to a curriculum okay the curriculum is the training data so this quantity is the shortest optimal training time solution given a curriculum so it's the shortest scale program that achieves optimal training time performance over the situation in the curriculum so this 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 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 the one neural network that is best at disturb determining cats from dogs in this particular training data set this curriculum see 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 see 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 entirety of data or you can also guess on the test data set right so if if this is really easy so if the training data set already perfectly captures all of the data there is that this quantity is zero like the out the program I don't need to write a program I already have the solution right and you can see here we divide by the age of salty but however if the training data has no information whatsoever about about the about the solution to the general task or if I just so horribly overfit on the training data such that it doesn't help me at all for the general task then this quantity is zero so this quantity is in zero one with with sorry the quantity is one of course yes because the shortest this thing up here will be equal to just h of salt e because this doesn't help me in that case and then this ratio will be one so generalization difficulty of one basically means that the training data solution doesn't help me at all this this particular training curriculum is useless because I'll just overfit so horribly that I will not learn anything about the task or I can't learn anything at all and generalization difficulty of zero oh that's yeah no yes generalization difficulty of zero basically means that all of the solution is already contained in the training solution and I require no work to get to the to the test set solution okay this is I mean I do this train test that this is all a bit more general as it is written here but I think it's a good a good way to think about it okay so the point here he makes is that is that so yeah he makes this example right here where he has these two data points where x minus point seven five has a label false and x point one five has a label true and the shortest possible solution will not help you to generalize to the to the other things so the nearest neighbor program would be better prepared for future uncertainty but would take significantly more space to write down so there's there's a trade-off there's direct trade-off to how much you optimize on the training data and how much generalization capability you have okay so the next quantity we want to assess is developer aware generalization difficulty because so far we've only considered generalization difficulty with respect to the task itself and to the to the curriculum but what you could do is you could simply you know you producing this intelligent system you could simply build in the solution to the entire task into your intelligent system that means it could completely ignore the training data and still perform pretty well on this thing even though even though the training data itself the algorithmic complexity it tells you nothing about about this so the generalization difficulty would be very high in the measure up here but so you would think wow this intelligent system solves this task really well but it's because you've baked the solution to the task into the system and it just ignores the training data so the developer aware generalization difficulty is going to capture that and basically punish you for building the solution the final solution directly into the task so this is the intelligent system right here at time 0 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 resin that you know it has certain you know it has convolutional filters and so on that's a certain prior on the translational invariance if you build a an alpha go system that certainly has the rules of go built in to the system and it has this Monte Carlo tree search which biases it towards a certain kind of learning and so on so all of this is captured in this quantity right here this basically means that how if I am given the optimal training solution as before and also the initial state of the learning system how much more work is it to get to the solution of the task and here you can clearly see if I have already built the solution into this system so if I'm building a tic-tac-toe learning system I call it the learning system but I like build in the optimal strategy from the beginning into my system and it just ignores the training data then this thing here would be low because it takes me it takes me a lot of work to own we finally have the training data to get to the solution but it takes me very little work if I also have the initial state of the system because the solution would be encoded into the initial state already right so any prior you put in there will be captured by this okay so otherwise it's the same the same metric zero means it's very easy to generalize to the entire solution one means it's even like it's given the training data solution and the system you give me that it is very hard for that system now consider here this quantity actually depends on the system you put in all right then we need two more things which are priors and experience so this was the difficulty this was how difficult is the task as such if for a given system and a curriculum now what we want we want to characterize priors and experience now priors are pretty easy what are what is a prior a prior we can capture by simply looking at the difference between how complex is the solution minus how complex is the solution if I'm given the initial state this is almost the same as before but it now only considers what you built into the system right there's no training data anymore it simply says if I have you know if you give me your the source code of your learning system can I if I can already read out the solution then this quantity right here will be zero there is zero complexity to get from your initial state of the learning system to the solution of the task and therefore this entire quantity would be one that means the prior all the information is in the prior however if your learning system is a very general learning system like it's a it's like a standard reinforcement learning algorithm with almost no assumption about the data then this quantity right here would be very low sorry it would be very high of course because the initial system doesn't tell you too much so it's still a lot of work if you if I gave you the source code it's 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 dissolution of the task and therefore the quantity up here would be very low and therefore this would be close to zero so that means there are no priors in this intelligent system for that given task okay and the quantity is always of how to reach the threshold the solution is always with respect to a threshold in skill so you must reach like this many points okay the the important thing that shall I notes here is that the priors captured not not the amount of information in the program in the intelligent system but the amount of relevant information for that task you can make a super duper complex intelligent system it 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 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 is inverse proportional to that so a system that had all else being equal that has less training data but is performing as well on a task as a system that had more training data that system that had less training data we consider to be a more intelligent system because it can generalize more efficiently so we need to quantify experience and experience now in the same kind of in the same train of thought is going to be the difference between two quantities so the first quantity is this so here we consider at each time step T okay 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 okay 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 that's and the and then we were 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 that's going to be your experience over the course of training which and 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 are 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 right 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 it's like you makes 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 okay now the important thing here is that it is it is different if we we could have just written here minus H of you know Sol theta T given the intelligent system at time step T plus 1 right because the intelligent system at times that people's one has had that data point at time step T and incorporated it but that's not that's not the same thing here we in in this step right here when we say how difficult is it we assume that you know God or Vapnik himself tells us how like the optimal way to use that information 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 solution and how difficult is it to get from the intelligent system and the data point at time T if you could make optimal use of that data point to the solution all right so this this is going to be an assessment of how much experience you've had in the in the sense of had you been able to incorporate the experience properly at each time step because yeah because otherwise you know you you couldn't compare the experience if two systems had had the the same experience in the same task it should mean they had had the same you know data points in the same order or in in a simplistic sense all right so this is all we need intelligence boom this is it so there's a lot of stuff here okay intelligence of an intelligent system with respect to a scope and there are two definitions right here one is for optimal skill at each task and one is for threshold of skill now we're going to focus on the threshold as we said we at each task we require something like you must achieve 8,000 points and we're going to consider the shortest programs that will get to at least 8,000 points now there's a bit of confusion in the notation here as this I'm pretty sure this quantity right here you know should be called something different because it's you know it's the T is here and then there's this here this refers to this and this shouldn't be out of here this should be meaning something like Thresh I'm pretty sure this is just a name like here the name opt so yeah in any case the 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 9,000 points at Pong and another task might be you need to achieve point 2 and that's really good a point 2 is really good so this W for each task is simply going to map it to a like a uniform coordinate space of of of points of skill level of that particular task okay so but we're going to average over tasks now you can I guess disregard this this is not super this is just scaling we're going to average over tasks now in each task we're going to consider all curriculums that get you to this threshold so all curriculums that get you to the threshold T for theta T for task T which means sort of means all the possible permutations of training data sets for that task right it's more general than this but we yeah we want to assess all the all the different ones and as you can see here there's P of C so this is an expectation this is the probability of that particular curriculum this is this is the expectation over data right here this is the expectation over the training data distribution okay in the classical machine learning sense so we're going to take the average across all tasks over the expectation under the training data distribution so we're good so far and usually right here we would put something like the empirical risk right the minimum minimum loss min loss function min theta loss function over my term over my see over my training data set okay but not in this case because we now want to consider the priors and the experience and discount that from the difficulty and that's what's written here so this is the developer aware generalization difficulty this here is the amount of information that's already contained in the priors and this here is the amount of information that's contained in the experience in that curriculum as you can see here the experience is in that curriculum so basically a system is more intelligent if the task is harder for that given system and that given curriculum okay so that makes intelligence up a system is more intelligent if it gets to a certain threshold with lower priors okay if the priors are low this 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 it down values actors that in the same curriculum like in the same training data they if if an actor learns faster like it learns earlier to reach the threshold it would assign more intelligence to that actor and so on it's kind of sometimes it's hidden over the it's hidden in the definitions for example these curricula are not all the same at 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 here that's why it's not exactly an expectation let's call it an expectation in quotation marks but in the general sense that's it so in sis the intelligence of a system is over a scope of tasks the expectation in quotation marks under the training distribution of the generalization difficulty account 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 he 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 like it it makes a lot of sense right so schematically the contribution of each task is the expectation over skill times generalization divided by priors plus experience that's kind of in words what we looked at so it goes over a number of key observations and at last he goes over consequences or basically a recommendation for what a benchmark should look like if we regard it in this light now of course these complexities and so on they're not exactly computable right so it's like how much exactly the shortest the length of the shortest program is is not exactly computable but it can inform our notion of how we should test intelligence okay so what to expect of an ideal intelligence benchmark first of all it should describe its scope of application its own predictiveness with regard to this scope so that means the validity it should be wreck replicable it should be reproducible it should measure broad abilities and developer aware generalization sorry it should it should set out to measure broad abilities and developer aware generalization okay so that means it should not be solely measuring skill or potential it should not feature in its evaluation set any tasks that are known in advance either to the test taking system itself or to the developers of the system and that of course refers directly to the developer aware generalization and it should seek to quantify the generalization difficulty it measures or at least provide qualitative guidelines with regards to its generalization difficulty it should at least be made clear whether the benchmark seeks to measure local generalization broad generalization or extreme generalization so we've 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 hey says it should control for the amount of experience leveraged by test taking systems during training it should not be possible to buy performance on the benchmark by sampling unlimited training data so this this already rules out sort of any let's say image recognition or NLP benchmarks because there we can always just feed in more data the more unlabeled data from the internet or even labeled data like if there's a benchmark that you know is on computer vision I can just pay more humans to label more data and then I will be better at that benchmark the benchmark should avoid tasks for which new data can be generated at will it should be in effect a game for which it is not possible to practice in advance of the evaluation session that's going to be hard right it should be it should explicitly and exhaustively decide 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 dataset and the ARC Kaggle challenge but that's a story for next time I hope you enjoyed this and at least got some bits of it it's very abstract this measure of intelligence of course it can never be computed exactly but the fact that someone is trying to formalize and it's not the first time this has been trying to formalize but this I feel it's quite understandable and it makes sort of sense and I'm I'm interested to see if people come up with exp like actual approximations to this quantity that you could actually compute sort of all right that was it thank you for watching and bye bye see you next time
[ { "start": 0, "end": 5.66, "text": " Hello and welcome to the third part on On the Measure of Intelligence by" }, { "start": 5.66, "end": 11.08, "text": " François Chollet. Now this is a multi-part series. If you haven't seen the" }, { "start": 11.08, "end": 14.86, "text": " first two parts I recommend to watch at least one of them. They're somewhat" }, { "start": 14.86, "end": 20.28, "text": " overlapping but we've basically gone over the history of intelligence" }, { "start": 20.28, "end": 26.32, "text": " measurement and the foundations of what a measurement for intelligence for an AI" }, { "start": 26.32, "end": 31.92, "text": " system should look like. Today we're going to get into the formal" }, { "start": 31.92, "end": 37.08, "text": " definition of the intelligence that Chollet proposes right here. So this" }, { "start": 37.08, "end": 42.64, "text": " sentence here pretty much sums up what we're interested in." }, { "start": 42.64, "end": 48.879999999999995, "text": " The intelligence of a system is a measure of its skill acquisition" }, { "start": 48.879999999999995, "end": 54.2, "text": " efficiency over a scope of tasks with respect to priors, experience and" }, { "start": 54.2, "end": 58.720000000000006, "text": " generalization difficulty. So these are the things that we've established so far" }, { "start": 58.720000000000006, "end": 63.160000000000004, "text": " basically. The intelligence of a system that's the thing we want to measure" }, { "start": 63.160000000000004, "end": 69.04, "text": " is a measure of its skill acquisition efficiency. So how fast does it" }, { "start": 69.04, "end": 74.32000000000001, "text": " acquire new skills? Important here is that we are measuring it over a scope of" }, { "start": 74.32000000000001, "end": 78.68, "text": " tasks. So it's not arbitrary skills it is a scope that we define and this is going" }, { "start": 78.68, "end": 84.64, "text": " to be mostly the human scope, the scope of tasks that humans" }, { "start": 84.64, "end": 92.60000000000001, "text": " can solve and are sort of different at. What we need to factor in are priors" }, { "start": 92.60000000000001, "end": 98.80000000000001, "text": " which is what is already built into a system because that doesn't count as" }, { "start": 98.80000000000001, "end": 103.92000000000002, "text": " intelligence that's already built in. If your ability to solve a problem is" }, { "start": 103.92000000000002, "end": 107.88000000000001, "text": " already built into you you don't have to use intelligence to solve the problem." }, { "start": 107.88, "end": 113.39999999999999, "text": " Second, experience. If you have had lots and lots and lots of experience at the" }, { "start": 113.39999999999999, "end": 117.39999999999999, "text": " particular task you're asked to solve you don't have to use intelligence you" }, { "start": 117.39999999999999, "end": 122.84, "text": " can simply rely on your experience. And the third is generalization difficulty" }, { "start": 122.84, "end": 128.64, "text": " and that's a property of the task. So if the task is very difficult to generalize" }, { "start": 128.64, "end": 135.68, "text": " so if it's very difficult if the task itself is very difficult then achieving" }, { "start": 135.68, "end": 140.56, "text": " good score at it should count as having higher intelligence if all other things" }, { "start": 140.56, "end": 145.92000000000002, "text": " are equal. So this is going to be the basis and today we're going to" }, { "start": 145.92000000000002, "end": 153.12, "text": " watch Shirley define these things into a number that can give us" }, { "start": 153.12, "end": 159.48000000000002, "text": " the intelligence of any system with respect to these things. So that's" }, { "start": 159.48000000000002, "end": 164.60000000000002, "text": " the program for today. If you like content like this share it out and tell" }, { "start": 164.6, "end": 169.76, "text": " all your friends and leave a like so that YouTube knows that you do like it." }, { "start": 169.76, "end": 176.6, "text": " So the conceptualization of the entire system is like this. There is a" }, { "start": 176.6, "end": 182.2, "text": " task and we're going to consider a series of tasks of course but if we just" }, { "start": 182.2, "end": 188.6, "text": " look at one task in our scope there is the task and the task outputs these" }, { "start": 188.6, "end": 193.64, "text": " situations. In a machine learning term these are like your training" }, { "start": 193.64, "end": 199, "text": " examples. And on the other side there is the intelligent system. Now the" }, { "start": 199, "end": 203.04, "text": " intelligent system in a pure machine learning side you would factor this as" }, { "start": 203.04, "end": 208.83999999999997, "text": " the task gives the intelligent system something like a training sample or in" }, { "start": 208.83999999999997, "end": 213, "text": " reinforcement learning it would be something like an observation and the" }, { "start": 213, "end": 218.27999999999997, "text": " intelligent system gives something back like a response. Here we have a" }, { "start": 218.28, "end": 224, "text": " kind of a in-between step. The intelligent system doesn't actually give back the" }, { "start": 224, "end": 228.52, "text": " response to the situation. The intelligent system generates a skill" }, { "start": 228.52, "end": 234.68, "text": " program. So the intelligent system will generate a program that can map the" }, { "start": 234.68, "end": 240.92000000000002, "text": " situation to a response and that skill program should be able to run on its own." }, { "start": 240.92000000000002, "end": 247.08, "text": " So in the classic machine learning sense if we look at supervised" }, { "start": 247.08, "end": 253.84, "text": " learning for example the intelligent system would be like a" }, { "start": 253.84, "end": 263.6, "text": " ResNet plus SGD. That is an intelligent system and if it is output" }, { "start": 263.6, "end": 269.76, "text": " it is able to generate a skill program. So during training what happens" }, { "start": 269.76, "end": 274.56, "text": " during training? During training the intelligent system is able to intervene" }, { "start": 274.56, "end": 280.92, "text": " in the skill program at each step. So the situation comes in and then the skill" }, { "start": 280.92, "end": 284.28000000000003, "text": " program does something but the intelligent system can at any point it" }, { "start": 284.28000000000003, "end": 289.44, "text": " can kind of intervene and update the skill program and generate a new skill" }, { "start": 289.44, "end": 294.92, "text": " program for the next step. So there's a situation the skill program" }, { "start": 294.92, "end": 300.96, "text": " gives a response and the task gives feedback in form of a score. In machine" }, { "start": 300.96, "end": 305.08, "text": " learning terms this would be your training sample. Your training sample" }, { "start": 305.08, "end": 309.35999999999996, "text": " comes in, your neural network gives a response which are the logits of the" }, { "start": 309.35999999999996, "end": 315.47999999999996, "text": " classes, then the task gives a score to that which in the supervised" }, { "start": 315.47999999999996, "end": 321.28, "text": " learning case is the label or the loss function as a feedback to the intelligent" }, { "start": 321.28, "end": 328.15999999999997, "text": " system and the intelligent system using SGD would update the skill program for" }, { "start": 328.16, "end": 331.96000000000004, "text": " the next step. So at each step the intelligent system can update the skill" }, { "start": 331.96000000000004, "end": 336.72, "text": " program. That's why the intelligent system in this case is the architecture" }, { "start": 336.72, "end": 340.92, "text": " of the neural network and the procedure to update the weights. Not the weights" }, { "start": 340.92, "end": 346.32000000000005, "text": " themselves but the procedure to update the weights and the skill program here" }, { "start": 346.32000000000005, "end": 351.52000000000004, "text": " those would be the actual weights of the neural network or like the" }, { "start": 351.52000000000004, "end": 357.56, "text": " instantiation of the ResNet with these particular weights. Now at test time" }, { "start": 357.56, "end": 363.8, "text": " we sever this connection right here. So this is now severed at test time. At" }, { "start": 363.8, "end": 368.52, "text": " some point the training is done. The task says okay now training is done and then" }, { "start": 368.52, "end": 373.4, "text": " the intelligent system will produce one last skill program and then this" }, { "start": 373.4, "end": 379.76, "text": " connection is cut and the skill program must by itself answer to these" }, { "start": 379.76, "end": 386.32, "text": " situations. The intelligent system cannot intervene anymore and in this" }, { "start": 386.32, "end": 391.59999999999997, "text": " loop here it's situation response situation response this goes over for a" }, { "start": 391.59999999999997, "end": 397.2, "text": " number of steps and all the scores during that time are counted and tallied" }, { "start": 397.2, "end": 401.92, "text": " up and at the end you know the higher the score the better. So the intelligent" }, { "start": 401.92, "end": 408.12, "text": " system must at this end step produce a skill program that by itself can achieve" }, { "start": 408.12, "end": 413.76, "text": " a high score. So there's always this training phase first and then there is" }, { "start": 413.76, "end": 419.88, "text": " the test phase. Now the training phase these situations that we get in a" }, { "start": 419.88, "end": 427.24, "text": " training phase they are called a curriculum in this in this world. In" }, { "start": 427.24, "end": 433.08, "text": " our world this would be something like a training data set but this is" }, { "start": 433.08, "end": 438.96, "text": " curriculum it's slightly more intricate but just the notion here makes sense" }, { "start": 438.96, "end": 446.79999999999995, "text": " right the intelligent system produces the skill program. So there's a lot" }, { "start": 446.79999999999995, "end": 452.64, "text": " of formalisms right here like okay the task has a situation generator" }, { "start": 452.64, "end": 456.82, "text": " and that maps the task state to a situation so the task can have a state" }, { "start": 456.82, "end": 459.84, "text": " and the skill program can have a state and the intelligent system can have a" }, { "start": 459.84, "end": 464.94, "text": " state and I don't like this is all a bit too formal you don't really need to" }, { "start": 464.94, "end": 471.18, "text": " understand it except if François Cholet is watching this I think I have" }, { "start": 471.18, "end": 478.72, "text": " found I'm not sure if it's a mistake but you say the intelligent system here" }, { "start": 478.72, "end": 483.8, "text": " consists of three objects so it generates the skill program according" }, { "start": 483.8, "end": 488.32, "text": " to its internal state okay and it generates the skill program and when it" }, { "start": 488.32, "end": 494.12, "text": " learns when it learns it updates the internal state internal state according" }, { "start": 494.12, "end": 504.2, "text": " to let me if I can find it right here a self update function so this is how the" }, { "start": 504.2, "end": 510.08, "text": " intelligent system can update itself so its own state so it takes the internal" }, { "start": 510.08, "end": 514.44, "text": " state of the intelligent system and outputs another internal state and this" }, { "start": 514.44, "end": 517.96, "text": " is the you know where I said the internal the intelligent system at each" }, { "start": 517.96, "end": 522.84, "text": " training step it can observe what happens and basically react accordingly" }, { "start": 522.84, "end": 528.4, "text": " so it takes the situation the response and the feedback and its own internal" }, { "start": 528.4, "end": 533.6, "text": " state as an input now what do we have here it takes the situation which would" }, { "start": 533.6, "end": 538.96, "text": " be in our case the training sample the response or the the logits that the" }, { "start": 538.96, "end": 544.4, "text": " neural network has produced the feedback which is the loss and its internal state" }, { "start": 544.4, "end": 552.24, "text": " okay now what I argue is basically that it should also get the internal state of" }, { "start": 552.24, "end": 557.12, "text": " the skill program as an input right here because the skill program can have an" }, { "start": 557.12, "end": 560.44, "text": " internal state all of this like the response can be a stochastic procedure" }, { "start": 560.44, "end": 566.6800000000001, "text": " of the skill program and I guess it's not necessary because you can sort of" }, { "start": 566.6800000000001, "end": 573.08, "text": " infer it but I think the framework would be more complete if the internal state" }, { "start": 573.08, "end": 578.3, "text": " of the skill program at that time were part of the intelligent system update" }, { "start": 578.3, "end": 585.4399999999999, "text": " procedure just you don't okay this is not relevant this is just me bickering" }, { "start": 585.4399999999999, "end": 595.12, "text": " cool let's actually jump all of this this is boring this is very boring okay" }, { "start": 595.12, "end": 600.4399999999999, "text": " blah blah blah blah blah lots of definitions all right quantifying" }, { "start": 600.4399999999999, "end": 604.04, "text": " generalization difficulty experience and priors using algorithmic information" }, { "start": 604.04, "end": 608.5999999999999, "text": " theory so these things that at the beginning we said that we want to define" }, { "start": 608.5999999999999, "end": 614.76, "text": " intelligence with respect to we are now going to quantify using algorithmic" }, { "start": 614.76, "end": 620.12, "text": " information theory algorithmic information theory in this case right" }, { "start": 620.12, "end": 624.7199999999999, "text": " here that we're using it's not very complicated the main quantity is this H" }, { "start": 624.7199999999999, "end": 632.7199999999999, "text": " the algorithmic complexity it the H of s is the length of the shortest" }, { "start": 632.72, "end": 638.96, "text": " description of the string in a fixed universal language okay so it's the" }, { "start": 638.96, "end": 643.6, "text": " length of the shortest program that outputs the string when running on a" }, { "start": 643.6, "end": 648.5600000000001, "text": " fixed universal Turing machine so basically if if you have this string s" }, { "start": 648.5600000000001, "end": 653.96, "text": " right here as is a bit string the shortest program that can compute s or" }, { "start": 653.96, "end": 660.28, "text": " you know so so in the worst case that's the the string itself but if the string" }, { "start": 660.28, "end": 666.52, "text": " is like 0 1 0 1 0 1 0 1 all the way you can just say 0 1 times 50 and that's" }, { "start": 666.52, "end": 670.12, "text": " that would be like the shortest program to produce that it isn't it is an" }, { "start": 670.12, "end": 676.8399999999999, "text": " information theoretic concept here but in essence you can just think of it as a" }, { "start": 676.8399999999999, "end": 682.4399999999999, "text": " measure of how long is the program that I would need to write to output a given" }, { "start": 682.4399999999999, "end": 687.64, "text": " to to produce a given output okay so that's the algorithmic complexity and" }, { "start": 687.64, "end": 692.4, "text": " then the second quantity right here is the relative algorithmic complexity" }, { "start": 692.4, "end": 699.88, "text": " which is almost the same thing it's how long is the program that I have to write" }, { "start": 699.88, "end": 703.64, "text": " so the shortest we're always talking about how long is the shortest program" }, { "start": 703.64, "end": 711.76, "text": " that I have to write that produces s1 but is allowed to take s2 as an input" }, { "start": 711.76, "end": 718.72, "text": " okay so it can never it it can always ignore s2 that's always a possibility so" }, { "start": 718.72, "end": 725.24, "text": " if s1 is like a super easy string you can just output that but if s1 let's say" }, { "start": 725.24, "end": 740.4399999999999, "text": " s2 here is 0 1 0 0 1 okay and s1 is 0 1 0 0 1 0 1 0 0 1 okay so it's just twice" }, { "start": 740.44, "end": 744.44, "text": " that so you could you could sort of output that string here we could write a" }, { "start": 744.44, "end": 748.24, "text": " program that just outputs this or you could write a program just that just" }, { "start": 748.24, "end": 757.8800000000001, "text": " says two times s2 okay so that the the length of this is not part of the" }, { "start": 757.8800000000001, "end": 762.6, "text": " program the program is just two times s2 because it's allowed to take s2 as an" }, { "start": 762.6, "end": 767.96, "text": " input okay so this is the algorithmic the relative algorithmic complexity is" }, { "start": 767.96, "end": 776.4000000000001, "text": " how how much how long is the how complex is the program to get from s2 to s1 so" }, { "start": 776.4000000000001, "end": 783.9200000000001, "text": " you can almost already see how that will relate now to to generalization okay so" }, { "start": 783.9200000000001, "end": 788.9200000000001, "text": " a few quantities that we need to consider are a task called t here then" }, { "start": 788.9200000000001, "end": 796.6, "text": " solve t theta is the shortest of all possible solutions of t so task t has a" }, { "start": 796.6, "end": 802.0400000000001, "text": " solution of threshold theta which the threshold theta is just this is like the" }, { "start": 802.0400000000001, "end": 807.88, "text": " minimum score we need to achieve in a task we don't we consider tasks according" }, { "start": 807.88, "end": 814.76, "text": " to thresholds like you know you need to get a I don't know what a score of 9000" }, { "start": 814.76, "end": 824.96, "text": " in Pong or so so the shortest of all programs that will will optimize that" }, { "start": 824.96, "end": 832.9200000000001, "text": " will solve the task to a threshold t sorry theta which is the shortest scale" }, { "start": 832.9200000000001, "end": 838.08, "text": " program that achieves at least theta during evaluation and the other quantity" }, { "start": 838.08, "end": 844.12, "text": " is this train soul opt TC this has a lot of quantity right here you can see the" }, { "start": 844.12, "end": 852.32, "text": " task we want to be optimal but with respect to a curriculum okay the" }, { "start": 852.32, "end": 857.44, "text": " curriculum is the training data so this quantity is the shortest optimal" }, { "start": 857.44, "end": 862.5600000000001, "text": " training time solution given a curriculum so it's the shortest scale" }, { "start": 862.5600000000001, "end": 866.24, "text": " program that achieves optimal training time performance over the situation in" }, { "start": 866.24, "end": 877.24, "text": " the curriculum so this this right here is if we could if we had an oracle that" }, { "start": 877.24, "end": 883.92, "text": " told us here is how to solve the task in general like the task of the task of of" }, { "start": 883.92, "end": 889, "text": " determining cats from dogs and images this this is this is this would be the" }, { "start": 889, "end": 895.24, "text": " program that does it okay you know overall over the entire the entirety of" }, { "start": 895.24, "end": 900.64, "text": " the task all cats and dog images there there are that's the solution now this" }, { "start": 900.64, "end": 908.24, "text": " quantity right here means sort of the the one neural network that is best at" }, { "start": 908.24, "end": 914.28, "text": " disturb determining cats from dogs in this particular training data set this" }, { "start": 914.28, "end": 919.1999999999999, "text": " curriculum see okay so this is the the one neural network that is hyper" }, { "start": 919.1999999999999, "end": 925.52, "text": " optimized in this particular training data set and now we assess the" }, { "start": 925.52, "end": 930.08, "text": " generalization difficulty so the generalization difficulty is going to be" }, { "start": 930.08, "end": 937.5200000000001, "text": " a measure of how hard is it to in a particular task to generalize to the" }, { "start": 937.5200000000001, "end": 942.1600000000001, "text": " whole task from the curriculum see and that's going to be the relative" }, { "start": 942.1600000000001, "end": 947.48, "text": " algorithmic complexity to go from this quantity to this quantity both quantities" }, { "start": 947.48, "end": 953.24, "text": " we've just explained so it basically means if if I had the perfect solution" }, { "start": 953.24, "end": 960.84, "text": " on the training data set how much how much more complex is it to get from that" }, { "start": 960.84, "end": 966.76, "text": " to the perfect solution on the entirety of data or you can also guess on the" }, { "start": 966.76, "end": 975.36, "text": " test data set right so if if this is really easy so if the training data set" }, { "start": 975.36, "end": 980.6800000000001, "text": " already perfectly captures all of the data there is that this quantity is zero" }, { "start": 980.68, "end": 986.5999999999999, "text": " like the out the program I don't need to write a program I already have the" }, { "start": 986.5999999999999, "end": 992.92, "text": " solution right and you can see here we divide by the age of salty but however" }, { "start": 992.92, "end": 999.7199999999999, "text": " if the training data has no information whatsoever about about the about the" }, { "start": 999.7199999999999, "end": 1004.92, "text": " solution to the general task or if I just so horribly overfit on the training" }, { "start": 1004.92, "end": 1011.64, "text": " data such that it doesn't help me at all for the general task then this quantity" }, { "start": 1011.64, "end": 1019.3199999999999, "text": " is zero so this quantity is in zero one with with sorry the quantity is one of" }, { "start": 1019.3199999999999, "end": 1026.92, "text": " course yes because the shortest this thing up here will be equal to just h of" }, { "start": 1026.92, "end": 1033.76, "text": " salt e because this doesn't help me in that case and then this ratio will be" }, { "start": 1033.76, "end": 1039.08, "text": " one so generalization difficulty of one basically means that the training data" }, { "start": 1039.08, "end": 1046.4, "text": " solution doesn't help me at all this this particular training curriculum is" }, { "start": 1046.4, "end": 1052.36, "text": " useless because I'll just overfit so horribly that I will not learn anything" }, { "start": 1052.36, "end": 1057.8, "text": " about the task or I can't learn anything at all and generalization difficulty of" }, { "start": 1057.8, "end": 1064.84, "text": " zero oh that's yeah no yes generalization difficulty of zero basically" }, { "start": 1064.84, "end": 1068.6, "text": " means that all of the solution is already contained in the training" }, { "start": 1068.6, "end": 1077.2, "text": " solution and I require no work to get to the to the test set solution okay this" }, { "start": 1077.2, "end": 1081.72, "text": " is I mean I do this train test that this is all a bit more general as it is" }, { "start": 1081.72, "end": 1089, "text": " written here but I think it's a good a good way to think about it okay so the" }, { "start": 1089, "end": 1099.44, "text": " point here he makes is that is that so yeah he makes this example right here" }, { "start": 1099.44, "end": 1106.56, "text": " where he has these two data points where x minus point seven five has a label" }, { "start": 1106.56, "end": 1113.8, "text": " false and x point one five has a label true and the shortest possible solution" }, { "start": 1113.8, "end": 1121.52, "text": " will not help you to generalize to the to the other things so the nearest" }, { "start": 1121.52, "end": 1125.6799999999998, "text": " neighbor program would be better prepared for future uncertainty but would" }, { "start": 1125.6799999999998, "end": 1128.6399999999999, "text": " take significantly more space to write down so there's there's a trade-off" }, { "start": 1128.6399999999999, "end": 1132.8, "text": " there's direct trade-off to how much you optimize on the training data and how" }, { "start": 1132.8, "end": 1141.32, "text": " much generalization capability you have okay so the next quantity we want to" }, { "start": 1141.32, "end": 1146.6399999999999, "text": " assess is developer aware generalization difficulty because so far" }, { "start": 1146.6399999999999, "end": 1150.44, "text": " we've only considered generalization difficulty with respect to the task" }, { "start": 1150.44, "end": 1154.76, "text": " itself and to the to the curriculum but what you could do is you could simply" }, { "start": 1154.76, "end": 1159.96, "text": " you know you producing this intelligent system you could simply build in the" }, { "start": 1159.96, "end": 1165.52, "text": " solution to the entire task into your intelligent system that means it could" }, { "start": 1165.52, "end": 1170.28, "text": " completely ignore the training data and still perform pretty well on this thing" }, { "start": 1170.28, "end": 1175.68, "text": " even though even though the training data itself the algorithmic complexity" }, { "start": 1175.68, "end": 1181.68, "text": " it tells you nothing about about this so the generalization difficulty would be" }, { "start": 1181.68, "end": 1188.76, "text": " very high in the measure up here but so you would think wow this intelligent" }, { "start": 1188.76, "end": 1193.24, "text": " system solves this task really well but it's because you've baked the solution" }, { "start": 1193.24, "end": 1199.68, "text": " to the task into the system and it just ignores the training data so the" }, { "start": 1199.68, "end": 1204.6, "text": " developer aware generalization difficulty is going to capture that and" }, { "start": 1204.6, "end": 1210.24, "text": " basically punish you for building the solution the final solution directly" }, { "start": 1210.24, "end": 1214.72, "text": " into the task so this is the intelligent system right here at time 0 this is" }, { "start": 1214.72, "end": 1221.16, "text": " basically whatever you pre build into the intelligent system this is it hasn't" }, { "start": 1221.16, "end": 1224.88, "text": " interacted with the training data yet this is simply the state at the very" }, { "start": 1224.88, "end": 1230.3600000000001, "text": " beginning so this is all the priors you build in if you build a resin that you" }, { "start": 1230.3600000000001, "end": 1234.56, "text": " know it has certain you know it has convolutional filters and so on that's a" }, { "start": 1234.56, "end": 1240.48, "text": " certain prior on the translational invariance if you build a an alpha go" }, { "start": 1240.48, "end": 1246.1200000000001, "text": " system that certainly has the rules of go built in to the system and it has" }, { "start": 1246.1200000000001, "end": 1249.68, "text": " this Monte Carlo tree search which biases it towards a certain kind of" }, { "start": 1249.68, "end": 1254.88, "text": " learning and so on so all of this is captured in this quantity right here" }, { "start": 1254.88, "end": 1263.56, "text": " this basically means that how if I am given the optimal training solution as" }, { "start": 1263.56, "end": 1270.32, "text": " before and also the initial state of the learning system how much more work" }, { "start": 1270.32, "end": 1276.6399999999999, "text": " is it to get to the solution of the task and here you can clearly see if I have" }, { "start": 1276.6399999999999, "end": 1282.76, "text": " already built the solution into this system so if I'm building a tic-tac-toe" }, { "start": 1283.56, "end": 1289.84, "text": " learning system I call it the learning system but I like build in the optimal" }, { "start": 1289.84, "end": 1294, "text": " strategy from the beginning into my system and it just ignores the training" }, { "start": 1294, "end": 1300.76, "text": " data then this thing here would be low because it takes me it takes me a lot of" }, { "start": 1300.76, "end": 1306.44, "text": " work to own we finally have the training data to get to the solution but it takes" }, { "start": 1306.44, "end": 1311.56, "text": " me very little work if I also have the initial state of the system because the" }, { "start": 1311.56, "end": 1318.16, "text": " solution would be encoded into the initial state already right so any prior" }, { "start": 1318.16, "end": 1323.48, "text": " you put in there will be captured by this okay so otherwise it's the same the" }, { "start": 1323.48, "end": 1329.32, "text": " same metric zero means it's very easy to generalize to the entire solution one" }, { "start": 1329.32, "end": 1335.76, "text": " means it's even like it's given the training data solution and the system" }, { "start": 1335.76, "end": 1340.52, "text": " you give me that it is very hard for that system now consider here this" }, { "start": 1340.52, "end": 1348.16, "text": " quantity actually depends on the system you put in all right then we need two" }, { "start": 1348.16, "end": 1352.28, "text": " more things which are priors and experience so this was the difficulty" }, { "start": 1352.28, "end": 1359.3999999999999, "text": " this was how difficult is the task as such if for a given system and a" }, { "start": 1359.3999999999999, "end": 1366.08, "text": " curriculum now what we want we want to characterize priors and experience now" }, { "start": 1366.08, "end": 1372.44, "text": " priors are pretty easy what are what is a prior a prior we can capture by simply" }, { "start": 1372.44, "end": 1380.32, "text": " looking at the difference between how complex is the solution minus how" }, { "start": 1380.32, "end": 1385.48, "text": " complex is the solution if I'm given the initial state this is almost the same as" }, { "start": 1385.48, "end": 1390.84, "text": " before but it now only considers what you built into the system right there's" }, { "start": 1390.84, "end": 1395.4399999999998, "text": " no training data anymore it simply says if I have you know if you give me your" }, { "start": 1395.4399999999998, "end": 1402.36, "text": " the source code of your learning system can I if I can already read out the" }, { "start": 1402.36, "end": 1410.28, "text": " solution then this quantity right here will be zero there is zero complexity" }, { "start": 1410.28, "end": 1416.8799999999999, "text": " to get from your initial state of the learning system to the solution of the" }, { "start": 1416.8799999999999, "end": 1422.04, "text": " task and therefore this entire quantity would be one that means the prior all" }, { "start": 1422.04, "end": 1427.98, "text": " the information is in the prior however if your learning system is a very" }, { "start": 1427.98, "end": 1432.52, "text": " general learning system like it's a it's like a standard reinforcement learning" }, { "start": 1432.52, "end": 1438.56, "text": " algorithm with almost no assumption about the data then this quantity right" }, { "start": 1438.56, "end": 1446.24, "text": " here would be very low sorry it would be very high of course because the initial" }, { "start": 1446.24, "end": 1451.36, "text": " system doesn't tell you too much so it's still a lot of work if you if I gave you" }, { "start": 1451.36, "end": 1454.8, "text": " the source code it's that well this is very general this doesn't tell me" }, { "start": 1454.8, "end": 1459.08, "text": " anything about the task and it would require a lot of work to get the" }, { "start": 1459.08, "end": 1463.1599999999999, "text": " dissolution of the task and therefore the quantity up here would be very low" }, { "start": 1463.16, "end": 1468.68, "text": " and therefore this would be close to zero so that means there are no priors" }, { "start": 1468.68, "end": 1475.72, "text": " in this intelligent system for that given task okay and the quantity is" }, { "start": 1475.72, "end": 1480.48, "text": " always of how to reach the threshold the solution is always with respect to a" }, { "start": 1480.48, "end": 1488.1200000000001, "text": " threshold in skill so you must reach like this many points okay the the" }, { "start": 1488.12, "end": 1493.7199999999998, "text": " important thing that shall I notes here is that the priors captured not not the" }, { "start": 1493.7199999999998, "end": 1498.04, "text": " amount of information in the program in the intelligent system but the amount of" }, { "start": 1498.04, "end": 1503.3999999999999, "text": " relevant information for that task you can make a super duper complex" }, { "start": 1503.3999999999999, "end": 1507.4799999999998, "text": " intelligent system it the only thing that matters for this quantity is the" }, { "start": 1507.4799999999998, "end": 1515.06, "text": " amount of information that's irrelevant to get to the solution of the task T the" }, { "start": 1515.06, "end": 1519.52, "text": " last thing we need to capture is experience now experience basically" }, { "start": 1519.52, "end": 1525.12, "text": " means how how much during this learning phase from now we just talked about at" }, { "start": 1525.12, "end": 1532.6, "text": " the at the at the outset like the state at time zero for the priors now you" }, { "start": 1532.6, "end": 1540.04, "text": " remember we interact with the task for a number of time in this training phase" }, { "start": 1540.04, "end": 1547.24, "text": " right and the question is of course if we are given a longer training phase it" }, { "start": 1547.24, "end": 1552.6, "text": " is easier to generalize generally right in more training data makes it makes our" }, { "start": 1552.6, "end": 1557.72, "text": " life easier makes it easier to generalize and the intelligence is is" }, { "start": 1557.72, "end": 1564, "text": " inverse proportional to that so a system that had all else being equal that has" }, { "start": 1564, "end": 1568.72, "text": " less training data but is performing as well on a task as a system that had more" }, { "start": 1568.72, "end": 1573.64, "text": " training data that system that had less training data we consider to be a more" }, { "start": 1573.64, "end": 1578.24, "text": " intelligent system because it can generalize more efficiently so we need" }, { "start": 1578.24, "end": 1584.6000000000001, "text": " to quantify experience and experience now in the same kind of in the same train" }, { "start": 1584.6000000000001, "end": 1589.56, "text": " of thought is going to be the difference between two quantities so the first" }, { "start": 1589.56, "end": 1598.3600000000001, "text": " quantity is this so here we consider at each time step T okay so at each time" }, { "start": 1598.36, "end": 1604.3999999999999, "text": " step T we have the intelligent system and we have this thing here called data" }, { "start": 1604.3999999999999, "end": 1611.9199999999998, "text": " now data is everything that the intelligent system gets at that point" }, { "start": 1611.9199999999998, "end": 1617.28, "text": " in time so the intelligent system is here at time step T and then it outputs" }, { "start": 1617.28, "end": 1622.3999999999999, "text": " the skill program and that skill program gets a situation and gives a response and" }, { "start": 1622.3999999999999, "end": 1627.8799999999999, "text": " this gives a feedback and all of this data that's called data okay it's" }, { "start": 1627.88, "end": 1633.24, "text": " basically you can think of it as one additional training example right you're" }, { "start": 1633.24, "end": 1640.1200000000001, "text": " at time step T and you're given one additional training example the" }, { "start": 1640.1200000000001, "end": 1645.1200000000001, "text": " experience is going to quantify how much information is in that one additional" }, { "start": 1645.1200000000001, "end": 1650.92, "text": " example and that's and the and then we were going to sum this up over time down" }, { "start": 1650.92, "end": 1655.24, "text": " here which basically means over the entire course of training which is this" }, { "start": 1655.24, "end": 1662.2, "text": " curriculum see how much information did you get out of the training data at each" }, { "start": 1662.2, "end": 1668.44, "text": " step that's going to be your experience over the course of training which and" }, { "start": 1668.44, "end": 1672.6, "text": " this is the sum over the experience that you got at each step and the experience" }, { "start": 1672.6, "end": 1678.36, "text": " at each step is simply the following two things are going to assess is how" }, { "start": 1678.36, "end": 1684.72, "text": " difficult is it at time T so you've learned for T steps how difficult is it" }, { "start": 1684.72, "end": 1691.02, "text": " to go from that to the solution right so if you might have had some training" }, { "start": 1691.02, "end": 1695.88, "text": " data right and you you score a certain you score a certain you look score like" }, { "start": 1695.88, "end": 1704.64, "text": " 80% on the on the test set so that's basically how difficult it is it's it's" }, { "start": 1704.64, "end": 1709.76, "text": " like you makes you still make 20% of error that's your difficulty and then" }, { "start": 1709.76, "end": 1714.96, "text": " you get one more training sample this data here now you can ask again if I" }, { "start": 1714.96, "end": 1719.32, "text": " know everything I'm knowing my intelligence system but I also get one" }, { "start": 1719.32, "end": 1728.28, "text": " more training data point can I how easy is it now to arrive at the solution of" }, { "start": 1728.28, "end": 1733.44, "text": " the task and now you can say oh with this training data point I now can" }, { "start": 1733.44, "end": 1738.28, "text": " correct some of my mistakes and I only make like 18% of error okay so the" }, { "start": 1738.28, "end": 1742.3999999999999, "text": " difference here would be like 2% so that's going to be your experience is" }, { "start": 1742.3999999999999, "end": 1749.84, "text": " going to be worth of 2% of errors okay now the important thing here is that it" }, { "start": 1749.84, "end": 1755.24, "text": " is it is different if we we could have just written here minus H of you know" }, { "start": 1755.24, "end": 1763.96, "text": " Sol theta T given the intelligent system at time step T plus 1 right because the" }, { "start": 1763.96, "end": 1768.1200000000001, "text": " intelligent system at times that people's one has had that data point at" }, { "start": 1768.1200000000001, "end": 1773.08, "text": " time step T and incorporated it but that's not that's not the same thing" }, { "start": 1773.08, "end": 1779.76, "text": " here we in in this step right here when we say how difficult is it we assume" }, { "start": 1779.76, "end": 1789.3600000000001, "text": " that you know God or Vapnik himself tells us how like the optimal way to use" }, { "start": 1789.36, "end": 1795.12, "text": " that information okay whereas this thing here the it's not a given that the" }, { "start": 1795.12, "end": 1799.9599999999998, "text": " intelligent system will use that information in the most optimal way so" }, { "start": 1799.9599999999998, "end": 1804.08, "text": " this is basically the difference between how difficult is it to get from the" }, { "start": 1804.08, "end": 1809.12, "text": " intelligent system to the solution and how difficult is it to get from the" }, { "start": 1809.12, "end": 1815.04, "text": " intelligent system and the data point at time T if you could make optimal use of" }, { "start": 1815.04, "end": 1820.3999999999999, "text": " that data point to the solution all right so this this is going to be an" }, { "start": 1820.3999999999999, "end": 1827.32, "text": " assessment of how much experience you've had in the in the sense of had you been" }, { "start": 1827.32, "end": 1834.72, "text": " able to incorporate the experience properly at each time step because yeah" }, { "start": 1834.72, "end": 1840.24, "text": " because otherwise you know you you couldn't compare the experience if two" }, { "start": 1840.24, "end": 1844.62, "text": " systems had had the the same experience in the same task it should mean they" }, { "start": 1844.62, "end": 1850.08, "text": " had had the same you know data points in the same order or in in a simplistic" }, { "start": 1850.08, "end": 1857.32, "text": " sense all right so this is all we need intelligence boom this is it so there's" }, { "start": 1857.32, "end": 1864.7199999999998, "text": " a lot of stuff here okay intelligence of an intelligent system with respect to a" }, { "start": 1864.7199999999998, "end": 1870.2399999999998, "text": " scope and there are two definitions right here one is for optimal skill at" }, { "start": 1870.24, "end": 1874.92, "text": " each task and one is for threshold of skill now we're going to focus on the" }, { "start": 1874.92, "end": 1880.4, "text": " threshold as we said we at each task we require something like you must achieve" }, { "start": 1880.4, "end": 1886.16, "text": " 8,000 points and we're going to consider the shortest programs that will get to" }, { "start": 1886.16, "end": 1891.36, "text": " at least 8,000 points now there's a bit of confusion in the notation here as" }, { "start": 1891.36, "end": 1895.72, "text": " this I'm pretty sure this quantity right here you know should be called something" }, { "start": 1895.72, "end": 1900.28, "text": " different because it's you know it's the T is here and then there's this here this" }, { "start": 1900.28, "end": 1904.08, "text": " refers to this and this shouldn't be out of here this should be meaning" }, { "start": 1904.08, "end": 1908.9, "text": " something like Thresh I'm pretty sure this is just a name like here the name" }, { "start": 1908.9, "end": 1920.52, "text": " opt so yeah in any case the the intelligence is of an intelligent system" }, { "start": 1920.52, "end": 1927.08, "text": " with respect to a scope of tasks okay and the first thing we do is we're going" }, { "start": 1927.08, "end": 1931.8799999999999, "text": " to average over the tasks in the scope so we consider all the different tasks" }, { "start": 1931.8799999999999, "end": 1936.6399999999999, "text": " and each task has a weight associated with it this this is the threshold and" }, { "start": 1936.6399999999999, "end": 1942.32, "text": " skill that we want and this is sort of a mapping this is a conversion rate" }, { "start": 1942.32, "end": 1948.08, "text": " because this might be you know 9,000 points at Pong and another task might be" }, { "start": 1948.08, "end": 1953.6799999999998, "text": " you need to achieve point 2 and that's really good a point 2 is really good so" }, { "start": 1953.6799999999998, "end": 1958.1999999999998, "text": " this W for each task is simply going to map it to a like a uniform coordinate" }, { "start": 1958.1999999999998, "end": 1967.84, "text": " space of of of points of skill level of that particular task okay so but we're" }, { "start": 1967.84, "end": 1972.74, "text": " going to average over tasks now you can I guess disregard this this is not super" }, { "start": 1972.74, "end": 1978.04, "text": " this is just scaling we're going to average over tasks now in each task we're" }, { "start": 1978.04, "end": 1987.84, "text": " going to consider all curriculums that get you to this threshold so all" }, { "start": 1987.84, "end": 1993.96, "text": " curriculums that get you to the threshold T for theta T for task T which" }, { "start": 1993.96, "end": 1999.64, "text": " means sort of means all the possible permutations of training data sets for" }, { "start": 1999.64, "end": 2005.6000000000001, "text": " that task right it's more general than this but we yeah we want to assess all" }, { "start": 2005.6000000000001, "end": 2013.1000000000001, "text": " the all the different ones and as you can see here there's P of C so this is" }, { "start": 2013.1000000000001, "end": 2017.22, "text": " an expectation this is the probability of that particular curriculum this is" }, { "start": 2017.22, "end": 2022.68, "text": " this is the expectation over data right here this is the expectation over the" }, { "start": 2022.68, "end": 2027.94, "text": " training data distribution okay in the classical machine learning sense so" }, { "start": 2027.94, "end": 2033.72, "text": " we're going to take the average across all tasks over the expectation under the" }, { "start": 2033.72, "end": 2040.66, "text": " training data distribution so we're good so far and usually right here we would" }, { "start": 2040.66, "end": 2049, "text": " put something like the empirical risk right the minimum minimum loss min loss" }, { "start": 2049, "end": 2055.8, "text": " function min theta loss function over my term over my see over my training data" }, { "start": 2055.8, "end": 2064.7200000000003, "text": " set okay but not in this case because we now want to consider the priors and the" }, { "start": 2064.7200000000003, "end": 2068.28, "text": " experience and discount that from the difficulty and that's what's written" }, { "start": 2068.28, "end": 2075.52, "text": " here so this is the developer aware generalization difficulty this here is" }, { "start": 2075.52, "end": 2080.52, "text": " the amount of information that's already contained in the priors and this here is" }, { "start": 2080.52, "end": 2085.3, "text": " the amount of information that's contained in the experience in that" }, { "start": 2085.3, "end": 2089, "text": " curriculum as you can see here the experience is in that curriculum so" }, { "start": 2089, "end": 2097.52, "text": " basically a system is more intelligent if the task is harder for that given" }, { "start": 2097.52, "end": 2103.1200000000003, "text": " system and that given curriculum okay so that makes intelligence up a system is" }, { "start": 2103.1200000000003, "end": 2110.32, "text": " more intelligent if it gets to a certain threshold with lower priors okay if the" }, { "start": 2110.32, "end": 2115.04, "text": " priors are low this the whole quantity is high and the system is also more" }, { "start": 2115.04, "end": 2124.2400000000002, "text": " intelligent if it gets to the threshold with less experience okay so if the" }, { "start": 2124.2400000000002, "end": 2133.2400000000002, "text": " experience here is lower it is counts as more intelligent all right in this in" }, { "start": 2133.2400000000002, "end": 2137.56, "text": " this quantity and this is written all in the text here it has some properties in" }, { "start": 2137.56, "end": 2145.22, "text": " that it for example it it down values actors that in the same curriculum like" }, { "start": 2145.22, "end": 2149.96, "text": " in the same training data they if if an actor learns faster like it learns" }, { "start": 2149.96, "end": 2154.96, "text": " earlier to reach the threshold it would assign more intelligence to that actor" }, { "start": 2154.96, "end": 2160.82, "text": " and so on it's kind of sometimes it's hidden over the it's hidden in the" }, { "start": 2160.82, "end": 2165.24, "text": " definitions for example these curricula are not all the same at the curricula" }, { "start": 2165.24, "end": 2169.64, "text": " are specific the curricula that you need to reach this certain threshold so it's" }, { "start": 2169.64, "end": 2173.9199999999996, "text": " not always doesn't always sum up to one with this probability here that's why" }, { "start": 2173.9199999999996, "end": 2178.3399999999997, "text": " it's not exactly an expectation let's call it an expectation in quotation" }, { "start": 2178.3399999999997, "end": 2185.2799999999997, "text": " marks but in the general sense that's it so in sis the intelligence of a system" }, { "start": 2185.2799999999997, "end": 2193.9399999999996, "text": " is over a scope of tasks the expectation in quotation marks under the training" }, { "start": 2193.94, "end": 2201.32, "text": " distribution of the generalization difficulty account but accounted for" }, { "start": 2201.32, "end": 2207.36, "text": " discount we discount the prior knowledge of the system and the experience that" }, { "start": 2207.36, "end": 2219.2000000000003, "text": " the system has had okay and that's it he says p plus e prior suppose experience" }, { "start": 2219.2000000000003, "end": 2223.7200000000003, "text": " represents the total exposure of the system to information about the problem" }, { "start": 2223.72, "end": 2228.9199999999996, "text": " including the information it starts with at the beginning of training okay so if" }, { "start": 2228.9199999999996, "end": 2236.68, "text": " this is high then the system is not very intelligent or is not if a system that" }, { "start": 2236.68, "end": 2241.4399999999996, "text": " has more of this but generalizes to the same level as another system is" }, { "start": 2241.4399999999996, "end": 2245.48, "text": " considered less intelligent than the other system because it has had more" }, { "start": 2245.48, "end": 2253.3199999999997, "text": " exposure to information about the problem like it it makes a lot of sense" }, { "start": 2253.32, "end": 2260.32, "text": " right so schematically the contribution of each task is the expectation over" }, { "start": 2260.32, "end": 2266.6800000000003, "text": " skill times generalization divided by priors plus experience that's kind of" }, { "start": 2266.6800000000003, "end": 2275.8, "text": " in words what we looked at so it goes over a number of key observations and at" }, { "start": 2275.8, "end": 2282.4, "text": " last he goes over consequences or basically a recommendation for what a" }, { "start": 2282.4, "end": 2287.2400000000002, "text": " benchmark should look like if we regard it in this light now of course these" }, { "start": 2287.2400000000002, "end": 2293.2000000000003, "text": " complexities and so on they're not exactly computable right so it's like" }, { "start": 2293.2000000000003, "end": 2297.7200000000003, "text": " how much exactly the shortest the length of the shortest program is is not exactly" }, { "start": 2297.7200000000003, "end": 2305.12, "text": " computable but it can inform our notion of how we should test intelligence okay" }, { "start": 2305.12, "end": 2310.08, "text": " so what to expect of an ideal intelligence benchmark first of all it" }, { "start": 2310.08, "end": 2314.16, "text": " should describe its scope of application its own predictiveness with regard to" }, { "start": 2314.16, "end": 2319.44, "text": " this scope so that means the validity it should be wreck replicable it should be" }, { "start": 2319.44, "end": 2325.08, "text": " reproducible it should measure broad abilities and developer aware" }, { "start": 2325.08, "end": 2330.56, "text": " generalization sorry it should it should set out to measure broad abilities and" }, { "start": 2330.56, "end": 2336.56, "text": " developer aware generalization okay so that means it should not be solely" }, { "start": 2336.56, "end": 2343, "text": " measuring skill or potential it should not feature in its evaluation set any" }, { "start": 2343, "end": 2348.52, "text": " tasks that are known in advance either to the test taking system itself or to" }, { "start": 2348.52, "end": 2353.12, "text": " the developers of the system and that of course refers directly to the developer" }, { "start": 2353.12, "end": 2359.84, "text": " aware generalization and it should seek to quantify the generalization difficulty" }, { "start": 2359.84, "end": 2364.84, "text": " it measures or at least provide qualitative guidelines with regards to" }, { "start": 2364.84, "end": 2369.88, "text": " its generalization difficulty it should at least be made clear whether the" }, { "start": 2369.88, "end": 2374.8, "text": " benchmark seeks to measure local generalization broad generalization or" }, { "start": 2374.8, "end": 2382.44, "text": " extreme generalization so we've we've seen this in part one taking into" }, { "start": 2382.44, "end": 2386.1800000000003, "text": " account generalization difficulty minimizes the possibility that a given" }, { "start": 2386.1800000000003, "end": 2391.2200000000003, "text": " benchmark could be hacked by solvers that take undesired shortcuts that" }, { "start": 2391.22, "end": 2398.9199999999996, "text": " bypass broad abilities hey says it should control for the amount of" }, { "start": 2398.9199999999996, "end": 2403.16, "text": " experience leveraged by test taking systems during training it should not" }, { "start": 2403.16, "end": 2407.9599999999996, "text": " be possible to buy performance on the benchmark by sampling unlimited training" }, { "start": 2407.9599999999996, "end": 2413.8399999999997, "text": " data so this this already rules out sort of any let's say image recognition or" }, { "start": 2413.8399999999997, "end": 2418.9199999999996, "text": " NLP benchmarks because there we can always just feed in more data the more" }, { "start": 2418.92, "end": 2423.44, "text": " unlabeled data from the internet or even labeled data like if there's a" }, { "start": 2423.44, "end": 2429.36, "text": " benchmark that you know is on computer vision I can just pay more humans to" }, { "start": 2429.36, "end": 2434.96, "text": " label more data and then I will be better at that benchmark the benchmark" }, { "start": 2434.96, "end": 2439.44, "text": " should avoid tasks for which new data can be generated at will it should be in" }, { "start": 2439.44, "end": 2443.62, "text": " effect a game for which it is not possible to practice in advance of the" }, { "start": 2443.62, "end": 2448.2000000000003, "text": " evaluation session that's going to be hard right it should be it should" }, { "start": 2448.2, "end": 2453.72, "text": " explicitly and exhaustively decide describe the set of priors it assumes any" }, { "start": 2453.72, "end": 2459.3599999999997, "text": " task is going to involve priors but in many tasks used for a evaluation today" }, { "start": 2459.3599999999997, "end": 2464.96, "text": " priors stay implicit and the existence of implicit hidden priors may often give" }, { "start": 2464.96, "end": 2469.9199999999996, "text": " an unfair advantage to either humans or machines so this is for example if the" }, { "start": 2469.9199999999996, "end": 2475.68, "text": " test is like a speed test a lot of times machines are going to be way faster than" }, { "start": 2475.68, "end": 2480.24, "text": " humans because the hidden assumption in a speed test is that kind of your nerve" }, { "start": 2480.24, "end": 2486.7999999999997, "text": " conductivity is the same across all test takers and the last one it should work" }, { "start": 2486.7999999999997, "end": 2492.16, "text": " for both humans and machines fairly by only assessing the same priors as" }, { "start": 2492.16, "end": 2497.16, "text": " possessed by humans and it refers to core knowledge which we saw in the last" }, { "start": 2497.16, "end": 2502.7999999999997, "text": " part and only requiring a human sized amount of practice time or training" }, { "start": 2502.8, "end": 2506.5600000000004, "text": " data so this means if we want to compare humans and machines machines can often" }, { "start": 2506.5600000000004, "end": 2513.7200000000003, "text": " incorporate way more data than humans so the tasks in the benchmark should only" }, { "start": 2513.7200000000003, "end": 2520.4, "text": " like the amount of data should be such that a human could process that data now" }, { "start": 2520.4, "end": 2526.8, "text": " of course that that sort of also means that any task where basically you" }, { "start": 2526.8, "end": 2532.6000000000004, "text": " collect data during your life is all also sort of ruled out a bit so that" }, { "start": 2532.6, "end": 2537.92, "text": " means the AI benchmark task can't be like cook a pan of spaghetti or" }, { "start": 2537.92, "end": 2544.7999999999997, "text": " something like this yeah and in the end he says these recommendations for" }, { "start": 2544.7999999999997, "end": 2549.7, "text": " general AI evaluation wouldn't be complete without a concrete effort to" }, { "start": 2549.7, "end": 2554.48, "text": " implement them in part three we present our initial attempt which is going to be" }, { "start": 2554.48, "end": 2561.6, "text": " the ARC dataset and the ARC Kaggle challenge but that's a story for next" }, { "start": 2561.6, "end": 2568.4, "text": " time I hope you enjoyed this and at least got some bits of it it's very" }, { "start": 2568.4, "end": 2572.64, "text": " abstract this measure of intelligence of course it can never be computed exactly" }, { "start": 2572.64, "end": 2577.2799999999997, "text": " but the fact that someone is trying to formalize and it's not the first time" }, { "start": 2577.2799999999997, "end": 2582.7999999999997, "text": " this has been trying to formalize but this I feel it's quite understandable and" }, { "start": 2582.7999999999997, "end": 2590.88, "text": " it makes sort of sense and I'm I'm interested to see if people come up with" }, { "start": 2590.88, "end": 2596.48, "text": " exp like actual approximations to this quantity that you could actually compute" }, { "start": 2596.48, "end": 2624.12, "text": " sort of all right that was it thank you for watching and bye bye see you next time" } ]
LMb5tvW-UoQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Discovering Symbolic Models from Deep Learning with Inductive Biases (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "graph networks", "graph neural networks", "gnn", "physics", "newtonian", "hamiltonian", "dynamics", "cosmology", "dark matter", "symbolic regression", "edge", "vertex", "regularization" ]
Neural networks are very good at predicting systems' numerical outputs, but not very good at deriving the discrete symbolic equations that govern many physical systems. This paper combines Graph Networks with symbolic regression and shows that the strong inductive biases of these models can be used to derive accurate symbolic equations from observation data. OUTLINE: 0:00 - Intro & Outline 1:10 - Problem Statement 4:25 - Symbolic Regression 6:40 - Graph Neural Networks 12:05 - Inductive Biases for Physics 15:15 - How Graph Networks compute outputs 23:10 - Loss Backpropagation 24:30 - Graph Network Recap 26:10 - Analogies of GN to Newtonian Mechanics 28:40 - From Graph Network to Equation 33:50 - L1 Regularization of Edge Messages 40:10 - Newtonian Dynamics Example 43:10 - Cosmology Example 44:45 - Conclusions & Appendix Paper: https://arxiv.org/abs/2006.11287 Code: https://github.com/MilesCranmer/symbolic_deep_learning Abstract: We develop a general approach to distill symbolic representations of a learned deep model by introducing strong inductive biases. We focus on Graph Neural Networks (GNNs). The technique works as follows: we first encourage sparse latent representations when we train a GNN in a supervised setting, then we apply symbolic regression to components of the learned model to extract explicit physical relations. We find the correct known equations, including force laws and Hamiltonians, can be extracted from the neural network. We then apply our method to a non-trivial cosmology example-a detailed dark matter simulation-and discover a new analytic formula which can predict the concentration of dark matter from the mass distribution of nearby cosmic structures. The symbolic expressions extracted from the GNN using our technique also generalized to out-of-distribution data better than the GNN itself. Our approach offers alternative directions for interpreting neural networks and discovering novel physical principles from the representations they learn. Authors: Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Battaglia, Rui Xu, Kyle Cranmer, David Spergel, Shirley Ho Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at discovering symbolic models from deep learning with inductive biases by Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Pitalia, Rui Xu, Kyle Cranmer, David Spurgill and Shirley Ho. So this paper on a high level, it uses graph neural networks to fit a dataset of observations of a physical system. And then it uses symbolic regression in order to parse out equations, symbolic equations from the graph neural network. And the symbolic equations that will are found such they describe the physical system. And they do find, they do recover some known equations and they do find a new one in the field of cosmology. So we'll go through how they do it, what these two steps are and why this might work better than previous approaches. So yeah, join me. If you like content like this, as always, feel free to share it, subscribe if you haven't, if you want more content like this, and tell me what you think in the comments. All right, so they claim we develop a general approach to distill symbolic representation of a learned deep model by introducing strong inductive biases. And this, it doesn't really 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 force proportional to something like the mass of the first times the mass of the second divided by the radius that they are a part squared. Something like this times like this gravitational constant. 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 m1, m2 divided by r squared that governs this behavior. Now previous approaches have resorted to symbolic regression, I think 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, it can include the x and the y position of the things, it can include the delta x and delta y, which basically means the speed of the objects. It can include any constant a and b that you want. It can include the symbols plus, minus, division, multiplication, square, maybe exponential function and so on. So you give it a bunch of options of what it could potentially use in an equation. And then you simply let it make equations and you see how well these equations describe the data set. And the way you do that is you can do it naively by just searching and trying out, or you can be a little bit smarter about it and use evolutionary methods. So you start with some equations like this, okay, I'm going to x plus delta x minus a squared. You see how that describes the data set, you'll find not very well. And then you go on and you say, okay, maybe I'll make a small mutation, I'll mutate this to a minus and so on. And if you do this with an entire population, as is common in these evolutionary methods, you'll end up with something better at the end. Now this works until a point. So whenever the space of things to explore, like this one here, gets larger, and it doesn't have to be super large to already exhaust the capabilities of these methods. So these methods are very limited in the space they can search and have proven not really effective so far for this type of problem. This paper right here goes a different route. It uses graph neural networks in order to describe the data set. So in between this step of collecting a data set and making the equation, it fits another step. So it says in between here, we fit another step and that other step is going to be we have a graph neural network and you don't know yet, you don't have to know yet what that exactly is. But it's technique. It's like a type of neural network. And we're going to have that neural network learn the data set. Now as you know from neural networks, they can't do symbolic regression, they can't give you an equation, they can simply predict numbers. So what the network will do is it will simply predict like the motions or the accelerations, whatever you're interested in, it will predict those things as numbers, not as equations as just you can plug in this situation right here, and it will tell you how the things will move. Neural networks are pretty good at that. And once you have a graph neural network that can describe the system in a numeric fashion, then you parse out the equations from this graph neural network. And we're going to go over why that is going to be much, much easier than parsing out the equations directly from the physical system. It's going to be because you engineer the graph neural network in a way that makes it very congruent with physical reality that makes it very adapt to parse out equations like this that makes the job of this evolutionary method much easier. All right, so that's 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. This is like, it's like any data set that you have in machine learning. They predict the dynamics, which means in a numeric fashion with a graph neural network, and then from the graph neural network, they extract the symbolic equation, as you can see right here. And this here is going to be the equation that they figure out that was previously unknown. They even say 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 like a big expert on graph neural networks. But they come in all shapes and forms. In this particular paper, they use what they call a type of interaction network that's called a graph network. So graph network is something different than graph neural network. I think graph network is a type of graph neural network. And specifically here, they use a network that... So a graph neural network has these things called vertices, and then it has edges, and edges connect vertices, like in a graph. Now we're going to build this graph neural network such that the number of vertices is exactly equal to the number of particles in our system. So in this paper, they consider systems with, I believe, four or eight particles. That's already a lot for if you want to derive equations and things. But of course, the physical world is made of many more particles. In any case, they consider four, let's say four particles right here. So what they're going to do, they're going to build a graph neural network that has four vertices, one for each of the particles. And in a graph neural network, every vertex can have properties. So the properties of each vertex here are going to be the properties of that particle. That means the x coordinate, for example, the y coordinate, and we're going to, let's say we're in two dimensions, right? It's a two dimensional problem. The x coordinate, the y coordinate, the delta x, the delta y, the mass, the, I don't know what else can we put here. There's a lot of stuff that we can put here, the charge, right? So all of these things are properties of the vertex. Then the other component of a graph are, of course, the edges. So the edges connect each two of all of the, so each edge connects two vertices like this. And 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. And why does that represent a physical system really well? So the reason is going to be the following. What we're going to try to do is we're going to try to say that in physical systems, if I want to, for example, consider this node up here, and consider how it is pulled by gravity by the other nodes, it's going to be pulled in this direction a little bit because of this particle right here, it's going to be pulled in this direction a little bit because of that one, and in this direction because of that one. Now note that these three things are independent. So if I want to describe the total force of gravity, I can do so as a sum over i equals 1, 2, 1, 2, 3 of the force that the particle i pulls. So if this is j right here, how i pulls on j, right? This is an independent sum across all of the neighbors of that particle. Now you might say, wait a minute, it's not independent, because it's being, you know, it's not being strictly pulled in this direction, it's also pulled in this direction. Yes, but with independent, we mean that the force, this force right here, is only dependent on this particle, and the force diagonally is only dependent on that particle. There is no part of the particle up here that modulates this force right here. 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 current approaches that directly try to go about finding an equation using evolutionary methods from the data set itself don't really work, because the space is just too high of equations. But this right here, this is a massive constraint. And it's lucky, first of all, that physical systems, they say, most physical systems actually obey that constraint. Most physical systems can be described as an independent sum over contributions of interactions between just two things, right? So we simply can sum over interactions between two things. And that's 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. OK, here it's 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. OK? So like this, like this, like this. OK, considering all the interactions between the particles, just tell me, where does it go in the very next time frame? 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 nonlinear, complicated function. And we know how to compute nonlinear, complicated functions with neural networks. We're in deep learning right here. So the edge here is going to compute what's called this edge function. And this edge function takes in two vertices, v1 and v2 right here. Maybe this is v2, this is v1. It takes in the features, these features of the two vertices, and it will compute a so-called edge message. I think they call this ek for the edge k. It will compute an edge message. And this is supposed to represent the force that pulls between these two particles. And we're going to approximate this function right here using a neural network. Since we don't know the equation yet, right? We assume we don't know the gravitational equation, but we can learn it, right? Because we have data. So we take this and we simply make it into a neural network. So the features go in here, both. We can concatenate them. And then out comes this edge message. Now, this edge message here is simply going to be a vector, a numerical vector describing some intermediate hidden state, right? That is going to describe the force, but for now it's just describing intermediate hidden state. OK, so we do this for each edge. So each edge is going to be, maybe this is e1, this is e2, e3, e4. Each edge in parallel is going to aggregate information of its endpoints into that edge. And then that's step one. So step one, compute the edge messages. Step two is going to be to compute the vertex messages or the vertex outputs. So we said we're not actually interested in the edges. We're interested that each vertex ends up with an acceleration, with an output. So how are we going to do this? So consider again our graph. If we want to compute the output for this node right here, what we'll do is we'll simply aggregate all of the edges, all of the edge messages that connect to that vertex. So we've computed previously the edge messages by integrating the information from all of the attached endpoints. Now we're going to go backwards and distribute the information from the edges back to the vertices that are attached. And you can see already by this two-step process, it's kind of a message passing process if you've ever studied graphical models. This means that in the two-step process, this vertex here aggregates information from the other vertices, via these edges. So in this case, this vertex here is going to take in all the edge messages right here, and it is going to aggregate all these edge messages in a function that computes the acceleration. So our estimate of the acceleration is going to be a function, let's call that nu, of the edges that are attached to it. So e1, e2, and e3. And here is where we're going to make our next physical assumption, namely the one we said before, that the way that these edges, the way that they influence the vertex, is going to be in a form of an independent sum. So this simplification means that this function should somehow be not of the edges, but of the sum of the edges, right? Sum of ei. Okay, so this sum here, this is the simplification that we make to make it in accordance with the physical system. With this graph network, we could do any sort of complicated thing right here. We could put a transformer on these things and 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 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 as you know that force is mass times acceleration, that means acceleration is equal to force divided by mass. So this here is going to be this sum over the edges, I guess. Yes. So you still need to divide it by force. And technically, you still can do much more complicated things right here. We only say that the edges should only come in in form of a sum. So of course, we're going to say that this function right here, since it can be any complicated function of its input, it should also be a neural network. So we're going to take that sum of the edge messages and we're going to put that into a second neural network, and then out comes our estimate of the acceleration. And now that we can use together from the data set, we know the true acceleration, right? Since we have a data set, we have the observations and the labels. The labels are the true accelerations of that system that we observed. And we can compute a loss function right here. 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. It was a fairly lengthy way, but it's important that you kind of understand what's happening. So you build the graph network according to the physical system. In the graph network, there are two kinds of things. First there are deterministic things, like we're always going to aggregate in a sum. And then there are things that you learn. Namely, there are two neural networks. The first one computes the edge messages from the features of the vertices. And the second one computes the output of each vertex according to the sum of the edge messages that are attached to that vertex. Now you can say, wait a minute, there are more than just two neural networks. Like each edge here has a neural network, technically, right? This edge has a neural network, this edge has a neural network, and each vertex has a neural network. But in this case, these neural networks are shared. So the neural network that computes the edge message for that edge is the same as the neural network that computes the edge message for any of the edges. You can think of it like weight sharing, or you can think that it is actually the same neural network, it's equivalent. 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 is 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, sorry, sum of independent forces without interaction effects. Then concatenate with node, I guess this I left this out. But whenever you compute, whenever you compute the vertex properties, right here, I guess, what you want to do is not only input the edge messages, but you know, each vertex has these features that we said, and these could also be fairly important. It's like you technically have that information in the edge messages because it started out from these. But you can also just input that again into this neural network together with the edge properties. And that will just make its job a bit easier since, for example, right here, we have to divide by the mass in this function. And it's just easier if you provide that mass as a as the property. So that's a little detail I left out before. So that you concatenate the edge mess, the aggregated edge messages with the node, then you compute the node model, which in this case is the computation is simply the you take this sum right here, and you divide it by the mass. And then optionally, you can update the nodes, which is compute the next time step, which we don't do right here, because we simply want to output the acceleration. I guess I mean, it should be equivalent to output the next time step and then compare with the data set what the next time step was. In any case, you have to have some kind of loss function. And here you can see all the black squares right here are going to be neural networks. So now we have learned a graph network that can describe a system. How do we make this into an equation? And again, here, our our physical reality comes in that these of the like the independence assumptions of these realities comes in. Because in physics, you know, the the acceleration here is going to be a function of the sum and so on. So 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 the 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 get a low error, right, 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 governs the whole system. We just need to find two equations, one governing the edge model and one governing the vertex model and that's way, way easier than the whole system. And by finding those two equations, we and our given our physical assumptions, we can now find the equation to the whole system by simply composing them. Alright, so that's the entire system. I believe I've told you the entire paper right here without actually going into the paper. Let's just skim 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 C, they make use of three separate and interpretable internal functions, the edge, the node and the global model. Now the global model here isn't really used in the cases we're going to look at. So it's just going to be two different neural networks. Which are targets for the symbolic regression? Graph networks can also be embedded with additional symmetries, as in 23, 24, but we don't implement these. Okay, and then they say symbolic regression. So they use this Eureka package to perform symbolic regressions and fit compact closed form analytical expressions to these neural networks. Eureka works by using a genetic algorithm to combine algebraic expressions 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, if, as well as real constants. Alright, so if we look at the examples, they have three different examples. First of all, they have Newtonian dynamics, which is, for example, this gravitational force we looked at. They have Hamiltonian dynamics, which describes the same systems, but in a different way in terms of the Hamiltonian. And I don't want to go into this too much, because I think that the Newtonian dynamics already demonstrate really well what the system can do. And then they have dark matter halos for cosmology, which is a problem where you have universe simulators and you try to predict where the dark matter is, depending on where other dark matter is, and that's where they find a new unknown equation. Okay, here is the system in a nutshell. This is the path that you know. You have the data set, you learn a graph network, and then you get out an equation. But in between, you can put even more constraints to make the network really learn a physical equation. So, as I said, you're going to compute these edge functions right here. And the output of the edge functions is going to be this edge message, which is just going to be a vector of some sort. And that vector can be pretty large. You know, this is a hidden dimension that you can choose as an implementer. All you need to make sure is that the output of the vertex is the same dimension as, you know, what your output should be. Everything internal, you can choose. Now, we know that, for example, in a 2D system, the 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's really no reason why it should have a higher dimension since all the relevant information can be described in two dimensions. So one thing you can do is you can simply say, all right, I will choose the hidden dimension to be two. And therefore, I will force my neural network to just use two dimensions. This however, they noticed doesn't work super well. I think it works, but not that well. They call this the bottleneck model. And the reason why it doesn't work super well is that if you have like this constraint of neural networks, they don't tend to learn very well. And that's what they hypothesize in the paper as well. They don't tend to really come, you know, be good friends with the fact that they only have two floating point numbers to learn anything. And this is probably more a property of the optimization procedure than the problem itself. It's property of, you know, us training neural networks with SGD. So what they do instead is they put an L1 penalty on these edge messages. So they say we apply L1 regularization. And what that will do is that will induce sparsity in whatever you apply it to. So L1 regularization simply means that you constrain. So the edge message, if you take the absolute value in each entry and the sum of that, that should be small. So you can just add this to the loss function, and that will induce sparsity in these edge messages. And so now the network still has these whatever 100 latent dimensions, but it is encouraged to use as few as possible. That means it can use a lot during the beginning when it's really benefits from the lot of dimensions when it learns the system. But then as it gets better and better, it might shift a lot of the information into very, very few dimensions. Okay, so once we do, if we do that, we can then run a check, right? If it is really the case that this graph network has learned the physical dynamics of the system, then we can simply look at the top two dimensions, and we start by largest standard deviation. So whichever two dimensions are the least sparse, have the largest standard deviation, we can look at those two and we say, well, even though we didn't constrain the model, those two should describe our force pretty well. And since in Newtonian dynamics, we know what the force is, so this is we know what the force is, we can simply check whether or not that holds, we can check whether we can read out the force from these two components. And here it's made such that you 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 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've I'm not a big physics person, this R hat, I think this is the vector of the delta x delta y, right? So delta x delta y is in this R hat. So we already see that delta x and delta y here, this already looks like some sort of this already looks okay. No, actually, if we go down, it gets even clearer. So here they have the outputs of that. 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 l one regularization, what we expect is this equation, this is we know that this equation holds in this spring system. And what the neural network combined with the symbolic regression gives us is this equation. So right here, you can see there's this delta vector, and it's a product, it's an inner product dot product with this a, which is a numerical constants. And you can see that there is this form of product with numerical constants. What you can also see, so for example, here, the delta y here is 1.36 and 1.37. That's, you know, the same number and here it's point 6.6. Okay, but here you see, for example, r minus one, 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 one over r, no, times one minus one 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. And 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. So that's, that's fairly cool, right? But to me 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 that. I don't understand this, but in essence, it is the same kind of problem, right? You want to figure out the dark matter properties from the surrounding dark matter or properties of other things. And again, here you can see pretty well that this is the equation they get out. So the equation they get out is going to be a sum right here over, so here the output for node i is going to be a sum over all the other nodes j and then some function of that sum. So this right here is the equation that came out of our edge model, of our edge neural network. And this here that includes this one, it was the equation that came out of our vertex model. As you know, the same here in this spring law, this came out of our edge model, this came out of our vertex model. Again, this rests on the fact that physical systems can actually be described often as these sums of independent interactions. And that's why all of this works. So they do give very, very detailed instructions on how they did everything. I think the most unclear things in this paper are the physics things that are assumed sort of that you know. I don't, I didn't. Yeah, but other than that, it's pretty straightforward. Their appendix is also pretty detailed in how they do all the representations and so on. They have different formulations other than this L1 regularization. As I said, they have bottleneck, they have like a KL formulation. They really describe how the graph neural network works here and so on. So all in all, I enjoyed reading this paper. Here is a bunch of examples of these particle systems. And yeah, and here is a bunch of examples of where you'd have a linear relationship that where you can say, oh, look, this really describes that force or a nonlinear relationship where you can make the claim this doesn't really describe the force well, because it's not linear relationship indicates that what the network found is a rotation of what you really want. And that's good because it's equivalent nonlinear basically means that you can't really it doesn't really describe what you want really well. Yeah, and I'm going to leave you with that. I absolutely invite you to check out the code and the video they made about it and I'll see you next time. Bye bye.
[ { "start": 0, "end": 5.28, "text": " Hi there, today we're looking at discovering symbolic models from deep learning with inductive" }, { "start": 5.28, "end": 11.98, "text": " biases by Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Pitalia, Rui Xu, Kyle Cranmer, David" }, { "start": 11.98, "end": 14.5, "text": " Spurgill and Shirley Ho." }, { "start": 14.5, "end": 21.62, "text": " So this paper on a high level, it uses graph neural networks to fit a dataset of observations" }, { "start": 21.62, "end": 23.76, "text": " of a physical system." }, { "start": 23.76, "end": 30.64, "text": " And then it uses symbolic regression in order to parse out equations, symbolic equations" }, { "start": 30.64, "end": 32.620000000000005, "text": " from the graph neural network." }, { "start": 32.620000000000005, "end": 39.08, "text": " And the symbolic equations that will are found such they describe the physical system." }, { "start": 39.08, "end": 45.68000000000001, "text": " And they do find, they do recover some known equations and they do find a new one in the" }, { "start": 45.68000000000001, "end": 48.3, "text": " field of cosmology." }, { "start": 48.3, "end": 54.82, "text": " So we'll go through how they do it, what these two steps are and why this might work better" }, { "start": 54.82, "end": 56.72, "text": " than previous approaches." }, { "start": 56.72, "end": 59.4, "text": " So yeah, join me." }, { "start": 59.4, "end": 65.16, "text": " If you like content like this, as always, feel free to share it, subscribe if you haven't," }, { "start": 65.16, "end": 70.67999999999999, "text": " if you want more content like this, and tell me what you think in the comments." }, { "start": 70.68, "end": 78.4, "text": " All right, so they claim we develop a general approach to distill symbolic representation" }, { "start": 78.4, "end": 82.32000000000001, "text": " of a learned deep model by introducing strong inductive biases." }, { "start": 82.32000000000001, "end": 90.36000000000001, "text": " And this, it doesn't really say a whole lot, but I think the abstract doesn't say a whole" }, { "start": 90.36000000000001, "end": 91.36000000000001, "text": " lot." }, { "start": 91.36000000000001, "end": 93.04, "text": " So let me give you an example." }, { "start": 93.04, "end": 98.96000000000001, "text": " If you have three different, let's say planets or stars, right?" }, { "start": 98.96, "end": 105.39999999999999, "text": " This is a, this three body problem is a unsolved problem, I think still." }, { "start": 105.39999999999999, "end": 110.75999999999999, "text": " So if you have these three stars, and you just let the simulation run, they have gravity," }, { "start": 110.75999999999999, "end": 111.96, "text": " they attract each other, right?" }, { "start": 111.96, "end": 114.38, "text": " So they are going to move around somehow." }, { "start": 114.38, "end": 117.6, "text": " So this one's going to move here, this one's going to move like this, this one's going" }, { "start": 117.6, "end": 122.13999999999999, "text": " to move like this, and then it turns around and this one turns around and so on." }, { "start": 122.14, "end": 129.56, "text": " So there is a fairly complex motions in already three different things that are somehow in" }, { "start": 129.56, "end": 131.96, "text": " a physical system together." }, { "start": 131.96, "end": 134.66, "text": " This is a bigger problem than just stars." }, { "start": 134.66, "end": 140.42000000000002, "text": " So you have these systems, for example, when these are atoms and there is like an electromagnetic" }, { "start": 140.42000000000002, "end": 143.96, "text": " force between them or the strong force." }, { "start": 143.96, "end": 148.44, "text": " There can be, these can be things where springs are attached to them and so on." }, { "start": 148.44, "end": 154.66, "text": " So our goal is to derive equations that govern this behavior, right?" }, { "start": 154.66, "end": 161.32, "text": " In the case of gravity, we know that these objects sort of pull on each other with the" }, { "start": 161.32, "end": 166.44, "text": " force proportional to something like the mass of the first times the mass of the second" }, { "start": 166.44, "end": 172.32, "text": " divided by the radius that they are a part squared." }, { "start": 172.32, "end": 176.36, "text": " Something like this times like this gravitational constant." }, { "start": 176.36, "end": 178.88000000000002, "text": " We know the equation that governs these interactions." }, { "start": 178.88000000000002, "end": 182.92000000000002, "text": " We don't know the symbolic solution to the whole problem, but we know the equation that" }, { "start": 182.92000000000002, "end": 186.44000000000003, "text": " governs the interaction, right?" }, { "start": 186.44000000000003, "end": 189.96, "text": " Now imagine if we didn't know the equation, what do we have to do?" }, { "start": 189.96, "end": 191.8, "text": " Well, what did Newton do?" }, { "start": 191.8, "end": 199.22000000000003, "text": " Ultimately, he sat down and just came up with an equation that seemed okay to him and then" }, { "start": 199.22, "end": 207.84, "text": " found out that the equation actually does predict very accurately how the things move." }, { "start": 207.84, "end": 214.38, "text": " So we're going to try to replicate that process in an AI system, the process of coming up" }, { "start": 214.38, "end": 217.42, "text": " with an equation that governs this behavior." }, { "start": 217.42, "end": 219.68, "text": " So what we have is a data set." }, { "start": 219.68, "end": 221.52, "text": " As I said, we let this stuff run." }, { "start": 221.52, "end": 225.62, "text": " So we let it run for one time step and then this is here, maybe this is here and this" }, { "start": 225.62, "end": 227.24, "text": " is here, okay?" }, { "start": 227.24, "end": 229.42000000000002, "text": " And then we let it run for the next time step." }, { "start": 229.42000000000002, "end": 233.52, "text": " This goes here, this goes here, this goes here and so on." }, { "start": 233.52, "end": 240.68, "text": " So that will give us, basically it will give us frame by frame how this system evolves." }, { "start": 240.68, "end": 242.52, "text": " Frame by frame." }, { "start": 242.52, "end": 244.62, "text": " And that will give us a data set." }, { "start": 244.62, "end": 250, "text": " So this right here, if we let it run and maybe we restarted a couple of times with different" }, { "start": 250, "end": 253.68, "text": " initializations, we let it run, we get a data set." }, { "start": 253.68, "end": 255.78, "text": " So now we have a data set, right?" }, { "start": 255.78, "end": 263.08, "text": " So our goal is to be to take that data set and come up with an equation like m1, m2 divided" }, { "start": 263.08, "end": 267.92, "text": " by r squared that governs this behavior." }, { "start": 267.92, "end": 274.5, "text": " Now previous approaches have resorted to symbolic regression, I think they call this." }, { "start": 274.5, "end": 277.28, "text": " And that is basically, it's pretty simple." }, { "start": 277.28, "end": 282.3, "text": " Namely, what you do is you simply provide the system with a bunch of options." }, { "start": 282.3, "end": 287.72, "text": " You tell it, I have a list and the list can include the mass of the first, it can include" }, { "start": 287.72, "end": 293.12, "text": " the mass of the second, it can include the x and the y position of the things, it can" }, { "start": 293.12, "end": 299.88, "text": " include the delta x and delta y, which basically means the speed of the objects." }, { "start": 299.88, "end": 305.16, "text": " It can include any constant a and b that you want." }, { "start": 305.16, "end": 316.16, "text": " It can include the symbols plus, minus, division, multiplication, square, maybe exponential" }, { "start": 316.16, "end": 317.16, "text": " function and so on." }, { "start": 317.16, "end": 323, "text": " So you give it a bunch of options of what it could potentially use in an equation." }, { "start": 323, "end": 329.18, "text": " And then you simply let it make equations and you see how well these equations describe" }, { "start": 329.18, "end": 331, "text": " the data set." }, { "start": 331, "end": 335.8, "text": " And the way you do that is you can do it naively by just searching and trying out, or you can" }, { "start": 335.8, "end": 339.44, "text": " be a little bit smarter about it and use evolutionary methods." }, { "start": 339.44, "end": 349, "text": " So you start with some equations like this, okay, I'm going to x plus delta x minus a" }, { "start": 349, "end": 350.56, "text": " squared." }, { "start": 350.56, "end": 355, "text": " You see how that describes the data set, you'll find not very well." }, { "start": 355, "end": 360.34, "text": " And then you go on and you say, okay, maybe I'll make a small mutation, I'll mutate this" }, { "start": 360.34, "end": 362.11999999999995, "text": " to a minus and so on." }, { "start": 362.11999999999995, "end": 369.44, "text": " And if you do this with an entire population, as is common in these evolutionary methods," }, { "start": 369.44, "end": 373.2, "text": " you'll end up with something better at the end." }, { "start": 373.2, "end": 377.03999999999996, "text": " Now this works until a point." }, { "start": 377.03999999999996, "end": 382.91999999999996, "text": " So whenever the space of things to explore, like this one here, gets larger, and it doesn't" }, { "start": 382.91999999999996, "end": 389.08, "text": " have to be super large to already exhaust the capabilities of these methods." }, { "start": 389.08, "end": 394.46, "text": " So these methods are very limited in the space they can search and have proven not really" }, { "start": 394.46, "end": 399.02, "text": " effective so far for this type of problem." }, { "start": 399.02, "end": 402.4, "text": " This paper right here goes a different route." }, { "start": 402.4, "end": 407.76, "text": " It uses graph neural networks in order to describe the data set." }, { "start": 407.76, "end": 414.71999999999997, "text": " So in between this step of collecting a data set and making the equation, it fits another" }, { "start": 414.71999999999997, "end": 415.97999999999996, "text": " step." }, { "start": 415.98, "end": 422.24, "text": " So it says in between here, we fit another step and that other step is going to be we" }, { "start": 422.24, "end": 427.20000000000005, "text": " have a graph neural network and you don't know yet, you don't have to know yet what" }, { "start": 427.20000000000005, "end": 428.44, "text": " that exactly is." }, { "start": 428.44, "end": 429.44, "text": " But it's technique." }, { "start": 429.44, "end": 431.64000000000004, "text": " It's like a type of neural network." }, { "start": 431.64000000000004, "end": 436.6, "text": " And we're going to have that neural network learn the data set." }, { "start": 436.6, "end": 441.56, "text": " Now as you know from neural networks, they can't do symbolic regression, they can't give" }, { "start": 441.56, "end": 445.28000000000003, "text": " you an equation, they can simply predict numbers." }, { "start": 445.28, "end": 453, "text": " So what the network will do is it will simply predict like the motions or the accelerations," }, { "start": 453, "end": 458.15999999999997, "text": " whatever you're interested in, it will predict those things as numbers, not as equations" }, { "start": 458.15999999999997, "end": 463.88, "text": " as just you can plug in this situation right here, and it will tell you how the things" }, { "start": 463.88, "end": 465.53999999999996, "text": " will move." }, { "start": 465.53999999999996, "end": 468.91999999999996, "text": " Neural networks are pretty good at that." }, { "start": 468.91999999999996, "end": 474.88, "text": " And once you have a graph neural network that can describe the system in a numeric fashion," }, { "start": 474.88, "end": 480.12, "text": " then you parse out the equations from this graph neural network." }, { "start": 480.12, "end": 485.12, "text": " And we're going to go over why that is going to be much, much easier than parsing out the" }, { "start": 485.12, "end": 488, "text": " equations directly from the physical system." }, { "start": 488, "end": 493.44, "text": " It's going to be because you engineer the graph neural network in a way that makes it" }, { "start": 493.44, "end": 501.2, "text": " very congruent with physical reality that makes it very adapt to parse out equations" }, { "start": 501.2, "end": 505.47999999999996, "text": " like this that makes the job of this evolutionary method much easier." }, { "start": 505.47999999999996, "end": 510.2, "text": " All right, so that's basically the two-step process here." }, { "start": 510.2, "end": 516.08, "text": " First step is to numerically regress a neural network to describe the system, and then second" }, { "start": 516.08, "end": 521.4399999999999, "text": " step is going to be from that neural network parse out the equations." }, { "start": 521.4399999999999, "end": 524.46, "text": " So we have to talk about graph neural networks." }, { "start": 524.46, "end": 528.88, "text": " So here you see the entire process as they describe it." }, { "start": 528.88, "end": 535.2, "text": " So they have this data set right here of observations of these physical systems." }, { "start": 535.2, "end": 539.96, "text": " This is like, it's like any data set that you have in machine learning." }, { "start": 539.96, "end": 547.08, "text": " They predict the dynamics, which means in a numeric fashion with a graph neural network," }, { "start": 547.08, "end": 551.88, "text": " and then from the graph neural network, they extract the symbolic equation, as you can" }, { "start": 551.88, "end": 554.48, "text": " see right here." }, { "start": 554.48, "end": 561.6, "text": " And this here is going to be the equation that they figure out that was previously unknown." }, { "start": 561.6, "end": 566.12, "text": " They even say unknown dark matter over density equation." }, { "start": 566.12, "end": 567.44, "text": " Cool." }, { "start": 567.44, "end": 570, "text": " So we have to talk about graph neural networks." }, { "start": 570, "end": 572.46, "text": " We haven't really done this on this channel so far." }, { "start": 572.46, "end": 575.82, "text": " And I'm not like a big expert on graph neural networks." }, { "start": 575.82, "end": 579.16, "text": " But they come in all shapes and forms." }, { "start": 579.16, "end": 584.32, "text": " In this particular paper, they use what they call a type of interaction network that's" }, { "start": 584.32, "end": 585.84, "text": " called a graph network." }, { "start": 585.84, "end": 590.12, "text": " So graph network is something different than graph neural network." }, { "start": 590.12, "end": 593.7600000000001, "text": " I think graph network is a type of graph neural network." }, { "start": 593.7600000000001, "end": 599.32, "text": " And specifically here, they use a network that..." }, { "start": 599.32, "end": 604.0400000000001, "text": " So a graph neural network has these things called vertices, and then it has edges, and" }, { "start": 604.0400000000001, "end": 607.44, "text": " edges connect vertices, like in a graph." }, { "start": 607.44, "end": 613.2, "text": " Now we're going to build this graph neural network such that the number of vertices is" }, { "start": 613.2, "end": 617.0400000000001, "text": " exactly equal to the number of particles in our system." }, { "start": 617.0400000000001, "end": 623.0400000000001, "text": " So in this paper, they consider systems with, I believe, four or eight particles." }, { "start": 623.0400000000001, "end": 627.5200000000001, "text": " That's already a lot for if you want to derive equations and things." }, { "start": 627.5200000000001, "end": 632.86, "text": " But of course, the physical world is made of many more particles." }, { "start": 632.86, "end": 637.0200000000001, "text": " In any case, they consider four, let's say four particles right here." }, { "start": 637.0200000000001, "end": 640.6400000000001, "text": " So what they're going to do, they're going to build a graph neural network that has four" }, { "start": 640.64, "end": 645.04, "text": " vertices, one for each of the particles." }, { "start": 645.04, "end": 650.4399999999999, "text": " And in a graph neural network, every vertex can have properties." }, { "start": 650.4399999999999, "end": 655.72, "text": " So the properties of each vertex here are going to be the properties of that particle." }, { "start": 655.72, "end": 660.3199999999999, "text": " That means the x coordinate, for example, the y coordinate, and we're going to, let's" }, { "start": 660.3199999999999, "end": 663.16, "text": " say we're in two dimensions, right?" }, { "start": 663.16, "end": 664.84, "text": " It's a two dimensional problem." }, { "start": 664.84, "end": 671.2800000000001, "text": " The x coordinate, the y coordinate, the delta x, the delta y, the mass, the, I don't know" }, { "start": 671.2800000000001, "end": 673.36, "text": " what else can we put here." }, { "start": 673.36, "end": 676.6, "text": " There's a lot of stuff that we can put here, the charge, right?" }, { "start": 676.6, "end": 681.0400000000001, "text": " So all of these things are properties of the vertex." }, { "start": 681.0400000000001, "end": 684.44, "text": " Then the other component of a graph are, of course, the edges." }, { "start": 684.44, "end": 692.2, "text": " So the edges connect each two of all of the, so each edge connects two vertices like this." }, { "start": 692.2, "end": 698.32, "text": " And in this particular type of graph network, we're going to consider graphs where all the" }, { "start": 698.32, "end": 701.76, "text": " particles are connected to all the other particles like this." }, { "start": 701.76, "end": 709.0400000000001, "text": " So it's not like a sparse, it's not a sparse graph, except I think in the cosmology example" }, { "start": 709.0400000000001, "end": 715.1600000000001, "text": " here you can see that always there is a node that's connected to all its neighbors." }, { "start": 715.1600000000001, "end": 720.2, "text": " But in the Newtonian dynamics graph networks, you can see right here, everything is connected" }, { "start": 720.2, "end": 727.12, "text": " to everything, like this." }, { "start": 727.12, "end": 732.84, "text": " And why does that represent a physical system really well?" }, { "start": 732.84, "end": 737.76, "text": " So the reason is going to be the following." }, { "start": 737.76, "end": 743.48, "text": " What we're going to try to do is we're going to try to say that in physical systems, if" }, { "start": 743.48, "end": 750.16, "text": " I want to, for example, consider this node up here, and consider how it is pulled by" }, { "start": 750.16, "end": 756.48, "text": " gravity by the other nodes, it's going to be pulled in this direction a little bit because" }, { "start": 756.48, "end": 760.5600000000001, "text": " of this particle right here, it's going to be pulled in this direction a little bit because" }, { "start": 760.5600000000001, "end": 764.32, "text": " of that one, and in this direction because of that one." }, { "start": 764.32, "end": 768.2, "text": " Now note that these three things are independent." }, { "start": 768.2, "end": 775.0400000000001, "text": " So if I want to describe the total force of gravity, I can do so as a sum over i equals" }, { "start": 775.0400000000001, "end": 783.08, "text": " 1, 2, 1, 2, 3 of the force that the particle i pulls." }, { "start": 783.08, "end": 788.1600000000001, "text": " So if this is j right here, how i pulls on j, right?" }, { "start": 788.1600000000001, "end": 795.36, "text": " This is an independent sum across all of the neighbors of that particle." }, { "start": 795.36, "end": 800.8000000000001, "text": " Now you might say, wait a minute, it's not independent, because it's being, you know," }, { "start": 800.8000000000001, "end": 804.64, "text": " it's not being strictly pulled in this direction, it's also pulled in this direction." }, { "start": 804.64, "end": 814.08, "text": " Yes, but with independent, we mean that the force, this force right here, is only dependent" }, { "start": 814.08, "end": 819.0600000000001, "text": " on this particle, and the force diagonally is only dependent on that particle." }, { "start": 819.06, "end": 825.92, "text": " There is no part of the particle up here that modulates this force right here." }, { "start": 825.92, "end": 833.0999999999999, "text": " So you can calculate the total force as an independent sum across the individual forces." }, { "start": 833.0999999999999, "end": 835.1199999999999, "text": " And that's the simplification here." }, { "start": 835.1199999999999, "end": 841.52, "text": " And that's a part, they claim, why current approaches that directly try to go about finding" }, { "start": 841.52, "end": 848.16, "text": " an equation using evolutionary methods from the data set itself don't really work, because" }, { "start": 848.16, "end": 851.12, "text": " the space is just too high of equations." }, { "start": 851.12, "end": 856.1999999999999, "text": " But this right here, this is a massive constraint." }, { "start": 856.1999999999999, "end": 861.52, "text": " And it's lucky, first of all, that physical systems, they say, most physical systems actually" }, { "start": 861.52, "end": 863.28, "text": " obey that constraint." }, { "start": 863.28, "end": 869.6999999999999, "text": " Most physical systems can be described as an independent sum over contributions of interactions" }, { "start": 869.6999999999999, "end": 872.56, "text": " between just two things, right?" }, { "start": 872.56, "end": 878.16, "text": " So we simply can sum over interactions between two things." }, { "start": 878.16, "end": 883.0799999999999, "text": " And that's way simpler than considering everything at once." }, { "start": 883.0799999999999, "end": 888.8399999999999, "text": " And second of all, it's lucky because these graph networks describe exactly this." }, { "start": 888.8399999999999, "end": 895.0799999999999, "text": " So each edge in the graph network is coincidentally connecting two things, right?" }, { "start": 895.0799999999999, "end": 896.0799999999999, "text": " And not more." }, { "start": 896.0799999999999, "end": 898.64, "text": " So the edges, they don't know about each other." }, { "start": 898.64, "end": 900.5, "text": " No edge knows about the other edge." }, { "start": 900.5, "end": 906.52, "text": " They only consider whatever particles are at their respective ends." }, { "start": 906.52, "end": 911, "text": " And that is exactly the same as this physical constraint on the physical system." }, { "start": 911, "end": 918.56, "text": " And that's why the graph networks are so adapted or are so useful in describing these systems." }, { "start": 918.56, "end": 923.44, "text": " So how does a graph network like this do anything, basically?" }, { "start": 923.44, "end": 926.24, "text": " So for that, you have to consider the task." }, { "start": 926.24, "end": 933.32, "text": " If we want to describe a system like this, a task in that, if you frame it in a machine" }, { "start": 933.32, "end": 941.32, "text": " learning way, could be, I'm going to give you these particles right here." }, { "start": 941.32, "end": 943.5600000000001, "text": " OK, here it's five particles." }, { "start": 943.5600000000001, "end": 947.52, "text": " I'm going to give you, for each one, I'm going to give you all its features, like the x," }, { "start": 947.52, "end": 952.2, "text": " the y, the speed currently, and the mass." }, { "start": 952.2, "end": 957.9200000000001, "text": " And you're going to tell me what the acceleration is in the next frame." }, { "start": 957.9200000000001, "end": 959.0400000000001, "text": " OK?" }, { "start": 959.0400000000001, "end": 962, "text": " So like this, like this, like this." }, { "start": 962, "end": 967.7800000000001, "text": " OK, considering all the interactions between the particles, just tell me, where does it" }, { "start": 967.7800000000001, "end": 971, "text": " go in the very next time frame?" }, { "start": 971, "end": 973.48, "text": " That sounds like a machine learning problem, right?" }, { "start": 973.48, "end": 977, "text": " And the graph neural network can be made to predict this." }, { "start": 977, "end": 984.8, "text": " So what we want is, for each vertex here, an output of a number or a vector, the acceleration." }, { "start": 984.8, "end": 987.36, "text": " So we want to compute an output for each vertex." }, { "start": 987.36, "end": 988.48, "text": " How do we do this?" }, { "start": 988.48, "end": 992.84, "text": " In a graph neural network, there are three, or in this particular type, there are three" }, { "start": 992.84, "end": 993.84, "text": " steps." }, { "start": 993.84, "end": 999.7, "text": " We said each vertex, and we're just going to do it for one vertex, let's say the one" }, { "start": 999.7, "end": 1002.24, "text": " on the bottom right." }, { "start": 1002.24, "end": 1008.16, "text": " Let's say each vertex has these properties, like this x, y, and so on." }, { "start": 1008.16, "end": 1012.88, "text": " So first, what we do is we go over the edges." }, { "start": 1012.88, "end": 1017.6800000000001, "text": " So for each edge, in parallel and independent from each other, let's consider this edge" }, { "start": 1017.6800000000001, "end": 1018.88, "text": " right here." }, { "start": 1018.88, "end": 1028.68, "text": " What we'll do is we take the nodes that are attached to it, and we combine their features." }, { "start": 1028.68, "end": 1033.0800000000002, "text": " And we combine them, so x, y, this also has x, y." }, { "start": 1033.0800000000002, "end": 1035.96, "text": " So we want to combine these two." }, { "start": 1035.96, "end": 1040.4, "text": " We want to compute the edge right here." }, { "start": 1040.4, "end": 1043.8, "text": " Now, in a physical system, what does the edge represent?" }, { "start": 1043.8, "end": 1048.72, "text": " The edge represents the force between the two particles, right?" }, { "start": 1048.72, "end": 1051.68, "text": " And that's a fairly complex equation." }, { "start": 1051.68, "end": 1055.16, "text": " It's not like we can just add the features or something like this." }, { "start": 1055.16, "end": 1063.28, "text": " So the edge here already needs to compute some sort of nonlinear, complicated function." }, { "start": 1063.28, "end": 1067.8400000000001, "text": " And we know how to compute nonlinear, complicated functions with neural networks." }, { "start": 1067.8400000000001, "end": 1069.4, "text": " We're in deep learning right here." }, { "start": 1069.4, "end": 1076.18, "text": " So the edge here is going to compute what's called this edge function." }, { "start": 1076.18, "end": 1081.26, "text": " And this edge function takes in two vertices, v1 and v2 right here." }, { "start": 1081.26, "end": 1083.72, "text": " Maybe this is v2, this is v1." }, { "start": 1083.72, "end": 1089.6000000000001, "text": " It takes in the features, these features of the two vertices, and it will compute a so-called" }, { "start": 1089.6000000000001, "end": 1090.96, "text": " edge message." }, { "start": 1090.96, "end": 1095.08, "text": " I think they call this ek for the edge k." }, { "start": 1095.08, "end": 1096.44, "text": " It will compute an edge message." }, { "start": 1096.44, "end": 1102.2, "text": " And this is supposed to represent the force that pulls between these two particles." }, { "start": 1102.2, "end": 1106.76, "text": " And we're going to approximate this function right here using a neural network." }, { "start": 1106.76, "end": 1108.6000000000001, "text": " Since we don't know the equation yet, right?" }, { "start": 1108.6, "end": 1115.12, "text": " We assume we don't know the gravitational equation, but we can learn it, right?" }, { "start": 1115.12, "end": 1116.6399999999999, "text": " Because we have data." }, { "start": 1116.6399999999999, "end": 1121.08, "text": " So we take this and we simply make it into a neural network." }, { "start": 1121.08, "end": 1123.08, "text": " So the features go in here, both." }, { "start": 1123.08, "end": 1125.04, "text": " We can concatenate them." }, { "start": 1125.04, "end": 1127.24, "text": " And then out comes this edge message." }, { "start": 1127.24, "end": 1133.28, "text": " Now, this edge message here is simply going to be a vector, a numerical vector describing" }, { "start": 1133.28, "end": 1135.76, "text": " some intermediate hidden state, right?" }, { "start": 1135.76, "end": 1140.72, "text": " That is going to describe the force, but for now it's just describing intermediate hidden" }, { "start": 1140.72, "end": 1141.72, "text": " state." }, { "start": 1141.72, "end": 1143.82, "text": " OK, so we do this for each edge." }, { "start": 1143.82, "end": 1150.04, "text": " So each edge is going to be, maybe this is e1, this is e2, e3, e4." }, { "start": 1150.04, "end": 1156.44, "text": " Each edge in parallel is going to aggregate information of its endpoints into that edge." }, { "start": 1156.44, "end": 1158.8, "text": " And then that's step one." }, { "start": 1158.8, "end": 1161.44, "text": " So step one, compute the edge messages." }, { "start": 1161.44, "end": 1170.3600000000001, "text": " Step two is going to be to compute the vertex messages or the vertex outputs." }, { "start": 1170.3600000000001, "end": 1173.4, "text": " So we said we're not actually interested in the edges." }, { "start": 1173.4, "end": 1178.6000000000001, "text": " We're interested that each vertex ends up with an acceleration, with an output." }, { "start": 1178.6000000000001, "end": 1179.92, "text": " So how are we going to do this?" }, { "start": 1179.92, "end": 1182.96, "text": " So consider again our graph." }, { "start": 1182.96, "end": 1188.96, "text": " If we want to compute the output for this node right here, what we'll do is we'll simply" }, { "start": 1188.96, "end": 1196.16, "text": " aggregate all of the edges, all of the edge messages that connect to that vertex." }, { "start": 1196.16, "end": 1202.96, "text": " So we've computed previously the edge messages by integrating the information from all of" }, { "start": 1202.96, "end": 1205.76, "text": " the attached endpoints." }, { "start": 1205.76, "end": 1212.72, "text": " Now we're going to go backwards and distribute the information from the edges back to the" }, { "start": 1212.72, "end": 1214.6000000000001, "text": " vertices that are attached." }, { "start": 1214.6, "end": 1219.6799999999998, "text": " And you can see already by this two-step process, it's kind of a message passing process if" }, { "start": 1219.6799999999998, "end": 1226.3999999999999, "text": " you've ever studied graphical models." }, { "start": 1226.3999999999999, "end": 1231.76, "text": " This means that in the two-step process, this vertex here aggregates information from the" }, { "start": 1231.76, "end": 1235.34, "text": " other vertices, via these edges." }, { "start": 1235.34, "end": 1243.36, "text": " So in this case, this vertex here is going to take in all the edge messages right here," }, { "start": 1243.36, "end": 1250.5, "text": " and it is going to aggregate all these edge messages in a function that computes the acceleration." }, { "start": 1250.5, "end": 1259.5, "text": " So our estimate of the acceleration is going to be a function, let's call that nu, of the" }, { "start": 1259.5, "end": 1261.3, "text": " edges that are attached to it." }, { "start": 1261.3, "end": 1265.04, "text": " So e1, e2, and e3." }, { "start": 1265.04, "end": 1270.84, "text": " And here is where we're going to make our next physical assumption, namely the one we" }, { "start": 1270.84, "end": 1278.56, "text": " said before, that the way that these edges, the way that they influence the vertex, is" }, { "start": 1278.56, "end": 1282.24, "text": " going to be in a form of an independent sum." }, { "start": 1282.24, "end": 1292.24, "text": " So this simplification means that this function should somehow be not of the edges, but of" }, { "start": 1292.24, "end": 1295.4399999999998, "text": " the sum of the edges, right?" }, { "start": 1295.4399999999998, "end": 1297.72, "text": " Sum of ei." }, { "start": 1297.72, "end": 1305.8, "text": " Okay, so this sum here, this is the simplification that we make to make it in accordance with" }, { "start": 1305.8, "end": 1307.64, "text": " the physical system." }, { "start": 1307.64, "end": 1312.1000000000001, "text": " With this graph network, we could do any sort of complicated thing right here." }, { "start": 1312.1000000000001, "end": 1317.98, "text": " We could put a transformer on these things and compute 12 layers of interaction effects" }, { "start": 1317.98, "end": 1319.64, "text": " between these edges." }, { "start": 1319.64, "end": 1320.64, "text": " We're not going to do that." }, { "start": 1320.64, "end": 1327.54, "text": " We're simply going to sum them up and then come up and then run those through a function." }, { "start": 1327.54, "end": 1329.28, "text": " So we'll sum them up." }, { "start": 1329.28, "end": 1334.2, "text": " And of course, this function right here is still going to be a complex function because" }, { "start": 1334.2, "end": 1341.24, "text": " just because you sum up the forces, you don't have the acceleration yet." }, { "start": 1341.24, "end": 1349.08, "text": " So as you know that force is mass times acceleration, that means acceleration is equal to force" }, { "start": 1349.08, "end": 1350.8, "text": " divided by mass." }, { "start": 1350.8, "end": 1356.08, "text": " So this here is going to be this sum over the edges, I guess." }, { "start": 1356.08, "end": 1357.2, "text": " Yes." }, { "start": 1357.2, "end": 1358.92, "text": " So you still need to divide it by force." }, { "start": 1358.92, "end": 1363.1200000000001, "text": " And technically, you still can do much more complicated things right here." }, { "start": 1363.1200000000001, "end": 1368.48, "text": " We only say that the edges should only come in in form of a sum." }, { "start": 1368.48, "end": 1376.6000000000001, "text": " So of course, we're going to say that this function right here, since it can be any complicated" }, { "start": 1376.6000000000001, "end": 1379.96, "text": " function of its input, it should also be a neural network." }, { "start": 1379.96, "end": 1384.04, "text": " So we're going to take that sum of the edge messages and we're going to put that into" }, { "start": 1384.04, "end": 1390.56, "text": " a second neural network, and then out comes our estimate of the acceleration." }, { "start": 1390.56, "end": 1398.2, "text": " And now that we can use together from the data set, we know the true acceleration, right?" }, { "start": 1398.2, "end": 1402.96, "text": " Since we have a data set, we have the observations and the labels." }, { "start": 1402.96, "end": 1409.04, "text": " The labels are the true accelerations of that system that we observed." }, { "start": 1409.04, "end": 1414.36, "text": " And we can compute a loss function right here." }, { "start": 1414.36, "end": 1419.04, "text": " If you followed so far, everything we've done so far is differentiable." }, { "start": 1419.04, "end": 1425.56, "text": " So from this loss function that compares the output of the neural network for that vertex" }, { "start": 1425.56, "end": 1431.72, "text": " to the true acceleration that we observed in the data set, we can back propagate through" }, { "start": 1431.72, "end": 1436.04, "text": " this neural network that computes the vertex function." }, { "start": 1436.04, "end": 1442.2, "text": " We can back prop through the sum here to the edge messages, and we can back prop through" }, { "start": 1442.2, "end": 1447.72, "text": " the edge messages to that neural network that computed the edge messages from those features." }, { "start": 1447.72, "end": 1449.84, "text": " So everything is differentiable." }, { "start": 1449.84, "end": 1456.48, "text": " By having that loss at the end, we can train this neural network end to end to, from the" }, { "start": 1456.48, "end": 1465.76, "text": " observation right here, predict the numerical acceleration of the system right here." }, { "start": 1465.76, "end": 1473.68, "text": " It was a fairly lengthy way, but it's important that you kind of understand what's happening." }, { "start": 1473.68, "end": 1477.68, "text": " So you build the graph network according to the physical system." }, { "start": 1477.68, "end": 1480.56, "text": " In the graph network, there are two kinds of things." }, { "start": 1480.56, "end": 1485.96, "text": " First there are deterministic things, like we're always going to aggregate in a sum." }, { "start": 1485.96, "end": 1487.96, "text": " And then there are things that you learn." }, { "start": 1487.96, "end": 1490.18, "text": " Namely, there are two neural networks." }, { "start": 1490.18, "end": 1495.08, "text": " The first one computes the edge messages from the features of the vertices." }, { "start": 1495.08, "end": 1503.3999999999999, "text": " And the second one computes the output of each vertex according to the sum of the edge" }, { "start": 1503.3999999999999, "end": 1506.52, "text": " messages that are attached to that vertex." }, { "start": 1506.52, "end": 1510.4399999999998, "text": " Now you can say, wait a minute, there are more than just two neural networks." }, { "start": 1510.4399999999998, "end": 1513.76, "text": " Like each edge here has a neural network, technically, right?" }, { "start": 1513.76, "end": 1517.8, "text": " This edge has a neural network, this edge has a neural network, and each vertex has" }, { "start": 1517.8, "end": 1519.24, "text": " a neural network." }, { "start": 1519.24, "end": 1522.4399999999998, "text": " But in this case, these neural networks are shared." }, { "start": 1522.44, "end": 1527.2, "text": " So the neural network that computes the edge message for that edge is the same as the neural" }, { "start": 1527.2, "end": 1531.4, "text": " network that computes the edge message for any of the edges." }, { "start": 1531.4, "end": 1535.6200000000001, "text": " You can think of it like weight sharing, or you can think that it is actually the same" }, { "start": 1535.6200000000001, "end": 1538.04, "text": " neural network, it's equivalent." }, { "start": 1538.04, "end": 1539.3600000000001, "text": " And the same for the vertices." }, { "start": 1539.3600000000001, "end": 1545.72, "text": " There's only one neural network that in the same fashion computes the output for each" }, { "start": 1545.72, "end": 1546.72, "text": " vertex." }, { "start": 1546.72, "end": 1550.16, "text": " Of course, the incoming edge messages are going to be different, and that's why you" }, { "start": 1550.16, "end": 1551.56, "text": " have different outputs." }, { "start": 1551.56, "end": 1556.1599999999999, "text": " But the neural network itself is the same." }, { "start": 1556.1599999999999, "end": 1565.44, "text": " Okay, so we have a system that can describe this data set of physical observations really" }, { "start": 1565.44, "end": 1566.44, "text": " well." }, { "start": 1566.44, "end": 1568.6399999999999, "text": " It's this graph neural network." }, { "start": 1568.6399999999999, "end": 1570.36, "text": " So we train this end to end." }, { "start": 1570.36, "end": 1578.52, "text": " And here is a little bit of an analogy where they say, this is how you can analogize the" }, { "start": 1578.52, "end": 1581.24, "text": " neural network with a physical system." }, { "start": 1581.24, "end": 1583.56, "text": " So what are the analogies here?" }, { "start": 1583.56, "end": 1590.36, "text": " The nodes in the graph network correspond to the particles in Newtonian mechanics." }, { "start": 1590.36, "end": 1594.48, "text": " Pairs of nodes correspond to two interacting particles." }, { "start": 1594.48, "end": 1599.68, "text": " The edge model is the force between two particles." }, { "start": 1599.68, "end": 1606.24, "text": " Then the pooling operation, which is the summing up of the edge messages, right, that we found" }, { "start": 1606.24, "end": 1608.44, "text": " so important as a simplification." }, { "start": 1608.44, "end": 1613.92, "text": " This is the sum into the net force that is really given in the physical system." }, { "start": 1613.92, "end": 1622.96, "text": " So independent sum of, sorry, sum of independent forces without interaction effects." }, { "start": 1622.96, "end": 1626.44, "text": " Then concatenate with node, I guess this I left this out." }, { "start": 1626.44, "end": 1637.1000000000001, "text": " But whenever you compute, whenever you compute the vertex properties, right here, I guess," }, { "start": 1637.1, "end": 1641.84, "text": " what you want to do is not only input the edge messages, but you know, each vertex has" }, { "start": 1641.84, "end": 1646.36, "text": " these features that we said, and these could also be fairly important." }, { "start": 1646.36, "end": 1651.9199999999998, "text": " It's like you technically have that information in the edge messages because it started out" }, { "start": 1651.9199999999998, "end": 1652.9199999999998, "text": " from these." }, { "start": 1652.9199999999998, "end": 1658.76, "text": " But you can also just input that again into this neural network together with the edge" }, { "start": 1658.76, "end": 1660.84, "text": " properties." }, { "start": 1660.84, "end": 1664.52, "text": " And that will just make its job a bit easier since, for example, right here, we have to" }, { "start": 1664.52, "end": 1667.62, "text": " divide by the mass in this function." }, { "start": 1667.62, "end": 1672.52, "text": " And it's just easier if you provide that mass as a as the property." }, { "start": 1672.52, "end": 1675.84, "text": " So that's a little detail I left out before." }, { "start": 1675.84, "end": 1681.36, "text": " So that you concatenate the edge mess, the aggregated edge messages with the node, then" }, { "start": 1681.36, "end": 1687.6399999999999, "text": " you compute the node model, which in this case is the computation is simply the you" }, { "start": 1687.6399999999999, "end": 1693.48, "text": " take this sum right here, and you divide it by the mass." }, { "start": 1693.48, "end": 1697.8, "text": " And then optionally, you can update the nodes, which is compute the next time step, which" }, { "start": 1697.8, "end": 1704.16, "text": " we don't do right here, because we simply want to output the acceleration." }, { "start": 1704.16, "end": 1711.04, "text": " I guess I mean, it should be equivalent to output the next time step and then compare" }, { "start": 1711.04, "end": 1714.28, "text": " with the data set what the next time step was." }, { "start": 1714.28, "end": 1717.16, "text": " In any case, you have to have some kind of loss function." }, { "start": 1717.16, "end": 1723.3, "text": " And here you can see all the black squares right here are going to be neural networks." }, { "start": 1723.3, "end": 1729.76, "text": " So now we have learned a graph network that can describe a system." }, { "start": 1729.76, "end": 1732.54, "text": " How do we make this into an equation?" }, { "start": 1732.54, "end": 1740.28, "text": " And again, here, our our physical reality comes in that these of the like the independence" }, { "start": 1740.28, "end": 1743.12, "text": " assumptions of these realities comes in." }, { "start": 1743.12, "end": 1749.56, "text": " Because in physics, you know, the the acceleration here is going to be a function of the sum" }, { "start": 1749.56, "end": 1750.56, "text": " and so on." }, { "start": 1750.56, "end": 1756.28, "text": " So what we need to do is we don't need to develop an equation for the entire system," }, { "start": 1756.28, "end": 1757.28, "text": " right?" }, { "start": 1757.28, "end": 1762, "text": " What we need to do is simply we need to develop an equation for each vertex." }, { "start": 1762, "end": 1768.08, "text": " So each vertex, we need to have an equation acceleration equals something." }, { "start": 1768.08, "end": 1776.74, "text": " And that something should include some of the edges and then the edges again should" }, { "start": 1776.74, "end": 1778.62, "text": " be something right." }, { "start": 1778.62, "end": 1785.32, "text": " So we technically as we had two neural networks, we technically need two symbolic equations," }, { "start": 1785.32, "end": 1790, "text": " one that represents that first neural network that computes the edge functions and one that" }, { "start": 1790, "end": 1796.32, "text": " represents that second neural network that aggregates the sum of the edge functions or" }, { "start": 1796.32, "end": 1800.4799999999998, "text": " that computes the output from the sum of the edge functions." }, { "start": 1800.4799999999998, "end": 1803.1399999999999, "text": " And that you know, it's an exact correspondence." }, { "start": 1803.14, "end": 1809.64, "text": " So what we need to do is we need to take that first neural network up here and do symbolic" }, { "start": 1809.64, "end": 1816.0800000000002, "text": " regression on that and the second neural network do symbolic regression on that." }, { "start": 1816.0800000000002, "end": 1819.22, "text": " So what does it mean to do symbolic regression?" }, { "start": 1819.22, "end": 1826.64, "text": " It basically means that we want to find the symbolic equation that describes the neural" }, { "start": 1826.64, "end": 1828.72, "text": " network the best." }, { "start": 1828.72, "end": 1832.5800000000002, "text": " And we do that in the exact same fashion as we started right here." }, { "start": 1832.58, "end": 1838.32, "text": " So we give it a bunch of these options and then we let the system describe the neural" }, { "start": 1838.32, "end": 1841.1599999999999, "text": " network as best as possible." }, { "start": 1841.1599999999999, "end": 1848.76, "text": " The way we do that again is we try out equations and if they get a low error, right, so we" }, { "start": 1848.76, "end": 1852.32, "text": " let the neural network run on the data set and we let this run on the data set." }, { "start": 1852.32, "end": 1856.28, "text": " If it outputs the same thing, it describes the neural network well." }, { "start": 1856.28, "end": 1859.3799999999999, "text": " And we can iterate that until we find a good equation." }, { "start": 1859.38, "end": 1863.3200000000002, "text": " So the difference here is that we don't need to find an equation that governs the whole" }, { "start": 1863.3200000000002, "end": 1864.3200000000002, "text": " system." }, { "start": 1864.3200000000002, "end": 1870.6000000000001, "text": " We just need to find two equations, one governing the edge model and one governing the vertex" }, { "start": 1870.6000000000001, "end": 1875.2800000000002, "text": " model and that's way, way easier than the whole system." }, { "start": 1875.2800000000002, "end": 1881.7600000000002, "text": " And by finding those two equations, we and our given our physical assumptions, we can" }, { "start": 1881.7600000000002, "end": 1887.1200000000001, "text": " now find the equation to the whole system by simply composing them." }, { "start": 1887.12, "end": 1890.12, "text": " Alright, so that's the entire system." }, { "start": 1890.12, "end": 1898.8, "text": " I believe I've told you the entire paper right here without actually going into the paper." }, { "start": 1898.8, "end": 1906.3999999999999, "text": " Let's just skim the paper a bit to see that they actually tell us the same thing." }, { "start": 1906.3999999999999, "end": 1912.6799999999998, "text": " So, yeah, so the graph networks, they say, are ideal candidate for our approach due to" }, { "start": 1912.6799999999998, "end": 1916.2399999999998, "text": " their inductive biases shared by many physics problems." }, { "start": 1916.24, "end": 1919.4, "text": " A, they're equivalent under particle permutations." }, { "start": 1919.4, "end": 1923.52, "text": " B, they are differentiable end to end and can be trained efficiently using gradient" }, { "start": 1923.52, "end": 1924.6, "text": " descent." }, { "start": 1924.6, "end": 1930.2, "text": " And C, they make use of three separate and interpretable internal functions, the edge," }, { "start": 1930.2, "end": 1932.36, "text": " the node and the global model." }, { "start": 1932.36, "end": 1937.32, "text": " Now the global model here isn't really used in the cases we're going to look at." }, { "start": 1937.32, "end": 1941.48, "text": " So it's just going to be two different neural networks." }, { "start": 1941.48, "end": 1944.34, "text": " Which are targets for the symbolic regression?" }, { "start": 1944.34, "end": 1950.56, "text": " Graph networks can also be embedded with additional symmetries, as in 23, 24, but we don't implement" }, { "start": 1950.56, "end": 1951.56, "text": " these." }, { "start": 1951.56, "end": 1953.9599999999998, "text": " Okay, and then they say symbolic regression." }, { "start": 1953.9599999999998, "end": 1958.76, "text": " So they use this Eureka package to perform symbolic regressions and fit compact closed" }, { "start": 1958.76, "end": 1963.6799999999998, "text": " form analytical expressions to these neural networks." }, { "start": 1963.6799999999998, "end": 1969.32, "text": " Eureka works by using a genetic algorithm to combine algebraic expressions stochastically." }, { "start": 1969.32, "end": 1974, "text": " The technique is analogous to natural selection, where the fitness of each expression is defined" }, { "start": 1974, "end": 1976.36, "text": " in terms of simplicity and accuracy." }, { "start": 1976.36, "end": 1982, "text": " The operations considered in the fitting process are plus, minus, times, if, as well as real" }, { "start": 1982, "end": 1983.72, "text": " constants." }, { "start": 1983.72, "end": 1991.92, "text": " Alright, so if we look at the examples, they have three different examples." }, { "start": 1991.92, "end": 1997.32, "text": " First of all, they have Newtonian dynamics, which is, for example, this gravitational" }, { "start": 1997.32, "end": 1999.24, "text": " force we looked at." }, { "start": 1999.24, "end": 2005.1200000000001, "text": " They have Hamiltonian dynamics, which describes the same systems, but in a different way in" }, { "start": 2005.1200000000001, "end": 2006.64, "text": " terms of the Hamiltonian." }, { "start": 2006.64, "end": 2012.1200000000001, "text": " And I don't want to go into this too much, because I think that the Newtonian dynamics" }, { "start": 2012.1200000000001, "end": 2015.88, "text": " already demonstrate really well what the system can do." }, { "start": 2015.88, "end": 2022.44, "text": " And then they have dark matter halos for cosmology, which is a problem where you have universe" }, { "start": 2022.44, "end": 2027.64, "text": " simulators and you try to predict where the dark matter is, depending on where other dark" }, { "start": 2027.64, "end": 2032.8000000000002, "text": " matter is, and that's where they find a new unknown equation." }, { "start": 2032.8000000000002, "end": 2039.5200000000002, "text": " Okay, here is the system in a nutshell." }, { "start": 2039.5200000000002, "end": 2041.16, "text": " This is the path that you know." }, { "start": 2041.16, "end": 2047.48, "text": " You have the data set, you learn a graph network, and then you get out an equation." }, { "start": 2047.48, "end": 2056.6, "text": " But in between, you can put even more constraints to make the network really learn a physical" }, { "start": 2056.6, "end": 2057.6, "text": " equation." }, { "start": 2057.6, "end": 2062.3199999999997, "text": " So, as I said, you're going to compute these edge functions right here." }, { "start": 2062.3199999999997, "end": 2068, "text": " And the output of the edge functions is going to be this edge message, which is just going" }, { "start": 2068, "end": 2071.2, "text": " to be a vector of some sort." }, { "start": 2071.2, "end": 2073.2, "text": " And that vector can be pretty large." }, { "start": 2073.2, "end": 2076.48, "text": " You know, this is a hidden dimension that you can choose as an implementer." }, { "start": 2076.48, "end": 2081.68, "text": " All you need to make sure is that the output of the vertex is the same dimension as, you" }, { "start": 2081.68, "end": 2083.52, "text": " know, what your output should be." }, { "start": 2083.52, "end": 2085.96, "text": " Everything internal, you can choose." }, { "start": 2085.96, "end": 2096, "text": " Now, we know that, for example, in a 2D system, the actual informational content of that edge" }, { "start": 2096, "end": 2098.64, "text": " message should be two dimensional, right?" }, { "start": 2098.64, "end": 2106.76, "text": " If this really describes the force in two dimensions, it should be two dimensional." }, { "start": 2106.76, "end": 2111.36, "text": " There's really no reason why it should have a higher dimension since all the relevant" }, { "start": 2111.36, "end": 2114.28, "text": " information can be described in two dimensions." }, { "start": 2114.28, "end": 2119.8, "text": " So one thing you can do is you can simply say, all right, I will choose the hidden dimension" }, { "start": 2119.8, "end": 2121.36, "text": " to be two." }, { "start": 2121.36, "end": 2127.88, "text": " And therefore, I will force my neural network to just use two dimensions." }, { "start": 2127.88, "end": 2131.1600000000003, "text": " This however, they noticed doesn't work super well." }, { "start": 2131.1600000000003, "end": 2133.1600000000003, "text": " I think it works, but not that well." }, { "start": 2133.1600000000003, "end": 2135.7200000000003, "text": " They call this the bottleneck model." }, { "start": 2135.7200000000003, "end": 2141.2000000000003, "text": " And the reason why it doesn't work super well is that if you have like this constraint of" }, { "start": 2141.2, "end": 2147.3999999999996, "text": " neural networks, they don't tend to learn very well." }, { "start": 2147.3999999999996, "end": 2149.3999999999996, "text": " And that's what they hypothesize in the paper as well." }, { "start": 2149.3999999999996, "end": 2154.7599999999998, "text": " They don't tend to really come, you know, be good friends with the fact that they only" }, { "start": 2154.7599999999998, "end": 2158.8799999999997, "text": " have two floating point numbers to learn anything." }, { "start": 2158.8799999999997, "end": 2164.4399999999996, "text": " And this is probably more a property of the optimization procedure than the problem itself." }, { "start": 2164.4399999999996, "end": 2169.7999999999997, "text": " It's property of, you know, us training neural networks with SGD." }, { "start": 2169.8, "end": 2177.1200000000003, "text": " So what they do instead is they put an L1 penalty on these edge messages." }, { "start": 2177.1200000000003, "end": 2180.0800000000004, "text": " So they say we apply L1 regularization." }, { "start": 2180.0800000000004, "end": 2184.88, "text": " And what that will do is that will induce sparsity in whatever you apply it to." }, { "start": 2184.88, "end": 2189, "text": " So L1 regularization simply means that you constrain." }, { "start": 2189, "end": 2194.7200000000003, "text": " So the edge message, if you take the absolute value in each entry and the sum of that, that" }, { "start": 2194.7200000000003, "end": 2196.2000000000003, "text": " should be small." }, { "start": 2196.2, "end": 2201.52, "text": " So you can just add this to the loss function, and that will induce sparsity in these edge" }, { "start": 2201.52, "end": 2203.22, "text": " messages." }, { "start": 2203.22, "end": 2209.7999999999997, "text": " And so now the network still has these whatever 100 latent dimensions, but it is encouraged" }, { "start": 2209.7999999999997, "end": 2212.66, "text": " to use as few as possible." }, { "start": 2212.66, "end": 2218.72, "text": " That means it can use a lot during the beginning when it's really benefits from the lot of" }, { "start": 2218.72, "end": 2221.06, "text": " dimensions when it learns the system." }, { "start": 2221.06, "end": 2227.16, "text": " But then as it gets better and better, it might shift a lot of the information into" }, { "start": 2227.16, "end": 2230.44, "text": " very, very few dimensions." }, { "start": 2230.44, "end": 2237.04, "text": " Okay, so once we do, if we do that, we can then run a check, right?" }, { "start": 2237.04, "end": 2244.08, "text": " If it is really the case that this graph network has learned the physical dynamics of the system," }, { "start": 2244.08, "end": 2252.3199999999997, "text": " then we can simply look at the top two dimensions, and we start by largest standard deviation." }, { "start": 2252.3199999999997, "end": 2258.9, "text": " So whichever two dimensions are the least sparse, have the largest standard deviation," }, { "start": 2258.9, "end": 2263.16, "text": " we can look at those two and we say, well, even though we didn't constrain the model," }, { "start": 2263.16, "end": 2267.56, "text": " those two should describe our force pretty well." }, { "start": 2267.56, "end": 2272.4, "text": " And since in Newtonian dynamics, we know what the force is, so this is we know what the" }, { "start": 2272.4, "end": 2278.6800000000003, "text": " force is, we can simply check whether or not that holds, we can check whether we can read" }, { "start": 2278.6800000000003, "end": 2282.28, "text": " out the force from these two components." }, { "start": 2282.28, "end": 2290.64, "text": " And here it's made such that you can't guarantee that the force is, you know, this force right" }, { "start": 2290.64, "end": 2298.08, "text": " here is actually so there are many ways to state a physical equation, because there are" }, { "start": 2298.08, "end": 2304.52, "text": " many symmetries in physics, and we cannot really make the neural network describe the" }, { "start": 2304.52, "end": 2310.7, "text": " equation exactly as humans would, because there are infinite amount of equivalent formulations," }, { "start": 2310.7, "end": 2314.8199999999997, "text": " but in this case, they're all covered by rotations of each other." }, { "start": 2314.8199999999997, "end": 2321.7599999999998, "text": " And that means in these graphs, if you have these message elements right here, and the" }, { "start": 2321.7599999999998, "end": 2327.7999999999997, "text": " linear combination of forces right here, a linear relationship means basically that the" }, { "start": 2327.8, "end": 2332.6400000000003, "text": " information is there, whereas a nonlinear relationship would mean that these numbers" }, { "start": 2332.6400000000003, "end": 2335.2000000000003, "text": " don't really encode the force as is." }, { "start": 2335.2000000000003, "end": 2339.44, "text": " And here you can pretty clearly see that the linear relationship is given." }, { "start": 2339.44, "end": 2346.52, "text": " And that means that these first two dimensions right here really encode the force in the" }, { "start": 2346.52, "end": 2350.78, "text": " way that we know the equation is." }, { "start": 2350.78, "end": 2352.88, "text": " So that's when we know the equation, right?" }, { "start": 2352.88, "end": 2356.6800000000003, "text": " When we know the equation, we can simply say, okay, does this fit?" }, { "start": 2356.68, "end": 2360.9199999999996, "text": " And when we don't know the equation, we can use this symbolic regression." }, { "start": 2360.9199999999996, "end": 2366, "text": " And what turns out is exactly this thing right here." }, { "start": 2366, "end": 2373.62, "text": " Now you might you might object that this isn't really that force right here." }, { "start": 2373.62, "end": 2376.64, "text": " But as I said, there are many, many symmetries." }, { "start": 2376.64, "end": 2385.3999999999996, "text": " So for example, this, this R hat right here, I believe, and this is I've I'm not a big" }, { "start": 2385.4, "end": 2392.88, "text": " physics person, this R hat, I think this is the vector of the delta x delta y, right?" }, { "start": 2392.88, "end": 2395.84, "text": " So delta x delta y is in this R hat." }, { "start": 2395.84, "end": 2404, "text": " So we already see that delta x and delta y here, this already looks like some sort of" }, { "start": 2404, "end": 2405.8, "text": " this already looks okay." }, { "start": 2405.8, "end": 2410.9, "text": " No, actually, if we go down, it gets even clearer." }, { "start": 2410.9, "end": 2414.56, "text": " So here they have the outputs of that." }, { "start": 2414.56, "end": 2423.96, "text": " Alright, so in this first case, this is the same example right here." }, { "start": 2423.96, "end": 2429.38, "text": " So they say you in this spring example, so this is a system where the particles are connected" }, { "start": 2429.38, "end": 2434.64, "text": " by springs, and we do l one regularization, what we expect is this equation, this is we" }, { "start": 2434.64, "end": 2437.96, "text": " know that this equation holds in this spring system." }, { "start": 2437.96, "end": 2443.88, "text": " And what the neural network combined with the symbolic regression gives us is this equation." }, { "start": 2443.88, "end": 2449.96, "text": " So right here, you can see there's this delta vector, and it's a product, it's an inner" }, { "start": 2449.96, "end": 2455.1800000000003, "text": " product dot product with this a, which is a numerical constants." }, { "start": 2455.1800000000003, "end": 2462.48, "text": " And you can see that there is this form of product with numerical constants." }, { "start": 2462.48, "end": 2468.6400000000003, "text": " What you can also see, so for example, here, the delta y here is 1.36 and 1.37." }, { "start": 2468.6400000000003, "end": 2472.32, "text": " That's, you know, the same number and here it's point 6.6." }, { "start": 2472.32, "end": 2479.7200000000003, "text": " Okay, but here you see, for example, r minus one, and here it's something like this minus" }, { "start": 2479.7200000000003, "end": 2482.9, "text": " something divided by r doesn't seem the same." }, { "start": 2482.9, "end": 2491.6400000000003, "text": " But again, due to the due to the symmetries, you can, if you take this and you simply divide" }, { "start": 2491.6400000000003, "end": 2502.1200000000003, "text": " everything by r, you'll end up with this vector right here, a times delta x, delta y, times" }, { "start": 2502.12, "end": 2509.24, "text": " one over r, no, times one minus one over r plus b." }, { "start": 2509.24, "end": 2516.04, "text": " Right, and now you can see it already looks very much similar." }, { "start": 2516.04, "end": 2521.24, "text": " And it's only off by like, it's only a transformation away from what you want." }, { "start": 2521.24, "end": 2526, "text": " So that's why I said you can describe these equations in many different sort of equivalent" }, { "start": 2526, "end": 2527, "text": " ways." }, { "start": 2527, "end": 2532.44, "text": " And ask the neural network to really figure out, you know, the exact one we want." }, { "start": 2532.44, "end": 2537.24, "text": " As long as it figures out a one that is equivalent, we're happy." }, { "start": 2537.24, "end": 2541.06, "text": " And we're, I guess we're pretty happy here." }, { "start": 2541.06, "end": 2547.72, "text": " So also in this case right here, you can see that it correctly predicts this relationship" }, { "start": 2547.72, "end": 2553.4, "text": " that it should be divided by r to the third power." }, { "start": 2553.4, "end": 2560.1600000000003, "text": " And there is a delta x, delta y, delta z, if you simply consider, so delta z here, I" }, { "start": 2560.1600000000003, "end": 2565.96, "text": " guess is, has simply a factor of zero." }, { "start": 2565.96, "end": 2572.4, "text": " And it even has this discontinuous problem where the force breaks after a certain while," }, { "start": 2572.4, "end": 2577.12, "text": " it can even parse out this if condition right here." }, { "start": 2577.12, "end": 2580.44, "text": " So that's, that's fairly cool, right?" }, { "start": 2580.44, "end": 2587.4, "text": " But to me that is pretty, pretty cool result that you can actually parse out these equations" }, { "start": 2587.4, "end": 2591.44, "text": " with just these graph networks and then the symbolic regression." }, { "start": 2591.44, "end": 2598.3, "text": " So they do the same thing for this cosmology example, where they have these simulators" }, { "start": 2598.3, "end": 2605.38, "text": " of the universe and they let them run and these kind of distribute this dark matter." }, { "start": 2605.38, "end": 2611.6800000000003, "text": " And I guess your task is, if I give you a bunch of these points right here, tell me" }, { "start": 2611.6800000000003, "end": 2614.6800000000003, "text": " where the other dark matter is, something like that." }, { "start": 2614.6800000000003, "end": 2619.84, "text": " I don't understand this, but in essence, it is the same kind of problem, right?" }, { "start": 2619.84, "end": 2626.48, "text": " You want to figure out the dark matter properties from the surrounding dark matter or properties" }, { "start": 2626.48, "end": 2627.98, "text": " of other things." }, { "start": 2627.98, "end": 2633.76, "text": " And again, here you can see pretty well that this is the equation they get out." }, { "start": 2633.76, "end": 2640.0200000000004, "text": " So the equation they get out is going to be a sum right here over, so here the output" }, { "start": 2640.0200000000004, "end": 2650.1600000000003, "text": " for node i is going to be a sum over all the other nodes j and then some function of that" }, { "start": 2650.1600000000003, "end": 2651.5600000000004, "text": " sum." }, { "start": 2651.5600000000004, "end": 2657.36, "text": " So this right here is the equation that came out of our edge model, of our edge neural" }, { "start": 2657.36, "end": 2658.36, "text": " network." }, { "start": 2658.36, "end": 2666.1600000000003, "text": " And this here that includes this one, it was the equation that came out of our vertex model." }, { "start": 2666.1600000000003, "end": 2670.36, "text": " As you know, the same here in this spring law, this came out of our edge model, this" }, { "start": 2670.36, "end": 2672.92, "text": " came out of our vertex model." }, { "start": 2672.92, "end": 2679.4, "text": " Again, this rests on the fact that physical systems can actually be described often as" }, { "start": 2679.4, "end": 2682, "text": " these sums of independent interactions." }, { "start": 2682, "end": 2684.5, "text": " And that's why all of this works." }, { "start": 2684.5, "end": 2689.84, "text": " So they do give very, very detailed instructions on how they did everything." }, { "start": 2689.84, "end": 2695.52, "text": " I think the most unclear things in this paper are the physics things that are assumed sort" }, { "start": 2695.52, "end": 2697.44, "text": " of that you know." }, { "start": 2697.44, "end": 2699.36, "text": " I don't, I didn't." }, { "start": 2699.36, "end": 2703.08, "text": " Yeah, but other than that, it's pretty straightforward." }, { "start": 2703.08, "end": 2707.8, "text": " Their appendix is also pretty detailed in how they do all the representations and so" }, { "start": 2707.8, "end": 2708.8, "text": " on." }, { "start": 2708.8, "end": 2711.52, "text": " They have different formulations other than this L1 regularization." }, { "start": 2711.52, "end": 2714.86, "text": " As I said, they have bottleneck, they have like a KL formulation." }, { "start": 2714.86, "end": 2719.7599999999998, "text": " They really describe how the graph neural network works here and so on." }, { "start": 2719.7599999999998, "end": 2722.74, "text": " So all in all, I enjoyed reading this paper." }, { "start": 2722.74, "end": 2726.24, "text": " Here is a bunch of examples of these particle systems." }, { "start": 2726.24, "end": 2733.56, "text": " And yeah, and here is a bunch of examples of where you'd have a linear relationship" }, { "start": 2733.56, "end": 2739.7599999999998, "text": " that where you can say, oh, look, this really describes that force or a nonlinear relationship" }, { "start": 2739.76, "end": 2744.76, "text": " where you can make the claim this doesn't really describe the force well, because it's" }, { "start": 2744.76, "end": 2750.6000000000004, "text": " not linear relationship indicates that what the network found is a rotation of what you" }, { "start": 2750.6000000000004, "end": 2751.6000000000004, "text": " really want." }, { "start": 2751.6000000000004, "end": 2757.5600000000004, "text": " And that's good because it's equivalent nonlinear basically means that you can't really it doesn't" }, { "start": 2757.5600000000004, "end": 2761.0400000000004, "text": " really describe what you want really well." }, { "start": 2761.0400000000004, "end": 2764, "text": " Yeah, and I'm going to leave you with that." }, { "start": 2764, "end": 2770.04, "text": " I absolutely invite you to check out the code and the video they made about it and I'll" }, { "start": 2770.04, "end": 2771.04, "text": " see you next time." }, { "start": 2771.04, "end": 2795.12, "text": " Bye bye." } ]
Uumd2zOOz60
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
How I Read a Paper: Facebook's DETR (Video Tutorial)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ml", "reading", "papers", "understanding", "quickly", "quick", "fast", "ultralearning", "research", "facebook", "detr", "object detection", "transformers", "how to" ]
I retrace my first reading of Facebook AI's DETR paper and explain my process of understanding it. OUTLINE: 0:00 - Introduction 1:25 - Title 4:10 - Authors 5:55 - Affiliation 7:40 - Abstract 13:50 - Pictures 20:30 - Introduction 22:00 - Related Work 24:00 - Model 30:00 - Experiments 41:50 - Conclusions & Abstract 42:40 - Final Remarks Original Video about DETR: https://youtu.be/T35ba_VXkMY Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there people! So a lot of you have asked me how I read papers and honestly I don't think there is any super special method to it but you know I thought because people have asked me to make a video on it so I'll make a video on it and I'll try to share my method of reading papers and hopefully this is going to be somewhat of a mini series or a series where I every now and then discuss how I read one of the papers that I make videos about and I'll try to select them such that different things are highlighted. Now I've selected this one right here for really for no particular reason other than I sort of remembered it and I'm going to try to go with you through how I read this and how I encountered this and kind of try to honestly share what I thought at the first time when I read it and I hope this helps some of you. If it does help you and if you like content like this of course feel free to share this out and subscribe. If you haven't seen my original video on this paper it might be worth to go watch it. I'll link it and with that let's dive in. So again this might be not really something new but I'll just go through it. So first thing I do is of course read the title. So the title has three parts end to end object detection with transformers. So what I notice 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. So I see transformers so I know what transformers are. If you don't I've made a video, I've made lots of videos on transformers. Attention is all you need is the base paper for that. So I know what a transformer is. And I know that transformers are usually in NLP. They are usually used in NLP. There are things like 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 difference and I immediately try to assess what's the new idea in this paper. And in this case it might be applying transformers to object detection but then I also see end to end. And the only reason to put that in a title is because that's the novelty. Because usually in deep learning we're sort of used to systems being end to end. And even if most systems aren't end to end, a lot of people don't. It's like end to end image classification on ImageNet. 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 two competing hypotheses of why this paper matters. First of all because it does it with transformers and second because it does it end to end. And of course the true fear is that the combination of end to end transformers, all of that, is what makes this model. And I already form like a hypothesis of whether I like this or not. 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 for most papers actually that I have sort of a negative opinion at the beginning where I... Well, 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 papers that I read, I'm trying to find the positive things in there. But I do form an opinion pretty quickly usually. Alright, so the second thing. This part right here I don't even see. This is like advertisements on Twitter. I have always had issues with author names. People will come to me and be like, oh have you seen the new Vignoles paper? And I have no clue. And then when they say like, oh that's where they use this character level model to do that. And I'm like, oh that paper. So I do not care who the authors are of a paper. 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. If this would be like a like Joshua Benj or someone like really famous, then of course that would catch my eye. But I also know that you know, Joshua Benjo's paper, Joshua Benjo's lab is huge. So just because a big name is on the paper doesn't mean that the paper is going to be of any good or bad quality. Sometimes the authors give you an indication of what kind of research is there. Like if you see Jeff Klune or Kenneth O Stanley, you know that there's going to be this certain type of learning to explore 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 get more exposure in the press and so on. So whenever Google publishes a paper, all of these all these pop-sci magazines like Diverge and This and Lifehacker and Hacker News and whatnot, they like write a blurb about it. So often they get much more scrutinized for these papers. They get much more the public attention, but they also get much more scrutiny, which in turn means that there is a bit more pressure on them to do good experiments. So that biases me 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 these big name papers, often I find myself even without or disregarding the affiliation to be convinced more than of regular papers. My most often issue with papers is that I don't believe the experiments. I make no difference. Even if it's Facebook, my prior is the experiments are crap and I don't believe them and they have to convince me of the opposite. But 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 streamlines the detection, effectively removing the need for many hand-designed components like non-maximum suppression, yada yada yada. The main ingredients called detection transformer, a set-based global loss that forces unique prediction via bipartite matching, and the transformer encoder decoder architecture. So they make it clear here why it matters and that's 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-designed components like non-maximum suppression, which tells me that they are 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 are sort of two kinds of experimental results. The ones where you try to beat what came before you and the ones where you're trying to say look our thing works just as well as this other thing while being more advantageous in some other metric. So I would place this already in the sort of second category. And then they say what are the actual ingredients? It's a set-based global loss that forces unique predictions via bipartite matching. Now I at this point I know what these terms mean but at this point I actually don't have to know what the terms mean. What I need to recognize is that I simply have to go later and figure out what that is. And a transformer-based encoder decoder architecture, okay? So there are two things right here that I remember I need to pay attention to later. There's this loss which seems to be special and there is the transformer architecture which they say, okay, 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, there are reasons about the relations of the objects and the global image context to directly output the final set of predicted in parallel. That almost tells me nothing. Yeah, okay, the model reasons. Maybe this in parallel is something but... The model is conceptually simple and does not require specialized library unlike many other modern detectors. This sort of repeats, this enforces my hypothesis that they're going with the hey this is a much easier way of doing things approach. Dettor demonstrates accuracy and runtime performance on par with well-established that further confirms my hypothesis that this is on par, right? The runtime performance on par with the current state of the art. And at the end they say moreover, Dettor can easily be generalized to produce panoptic segmentation in a unified manner. We show that it significantly outperforms competitive baselines. Training code and preterm models are available. Okay. Now this last part when I first read it is like, okay, can easily be generalized to produce this panoptic segmentation. I didn't know yet whether this is like a central claim of their paper that it can do this segmentation or whether this is like an added benefit to their paper. Because you can read it in both ways and I'm just ready to find this out in the paper. Now after I've read the abstract and sort of already formed the hypothesis of what's going on. So here I already in my mind I already sort of have a model of how would I do that, right? How would I 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 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 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 new 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 awful 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 so so far so good. Then transformer encoder decoder then set of box predictions so all of them come out here and I already read they're in parallel and then bipartite matching loss. So here they I can see they color these in different ways and these color appear to match with these colors right here right in the green here and these they they also this is a very good graphic right from this I can already read that these here go to the no object. A lot of times the graphics aren't very good so this this is what I'm not saying in every paper you can learn by looking at the graphics like sometimes the graphics are terrible and you're like what's going on here I like I don't this this makes no sense. This happens a lot in this paper right here this happens to be very very good explanatory graphics so I'll take advantage of that and I do the same thing in the other papers right but then later when it doesn't match what I read in the text I'll have to you know update my belief and so on but here I see that these go to no object and this goes to no object so I don't know yet that this is the test set at the point where I read this I was sort of confused by this but I recognized that each of these boxes right here is going to be either resulting in a bounding box or in the no object prediction so from that I could conclude that these things here are maybe some sort of a fixed set right but I still thought that you know these that this would actually be the output of these image features so that in this case you'd have like six set of image features and then you'd have like BERT here even though that's not an encoder decoder I still this was still my running hypothesis that somehow you'd map these image features to these boxes right here so and I didn't know what to what to make of this this thing right here so then I went through some more and look for more pictures and 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 ah new picture cool so this picture is much more informative than the other picture now I believe with the other picture they were trying to showcase this loss how they do the matching and even though I could read a lot from that picture I did not get that part and therefore I felt when I saw this and I just glanced at it I'm like wait what's what's different than up here it seems like the same but okay let's look at this so again we see okay you have set of image features that comes out of the CNN so that conforms with my belief but then this here goes into a transformer encoder and this comes out so immediately I see oh this is not the same as these boxes here right that was my hypothesis that these things here would be the colored boxes so I I say okay obviously that's not what happens this thing here it 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 all of this and then back here in the appendix I find this here which I immediately mapped to the previous where this is the end and this is a decoder and I've already read the attention is all you need paper and that that point it clicked in me is like ah this is not a BERT transformer this is one of these transformers that has an encoder in the decoder even though they told me like 50 billion times already I was too stupid until this point so now I know okay okay I see what's going on so the image goes through here and then this goes as a side input like as an attention from the decoder to the encoder like I know in NLP right so in NLP this here would be a source sequence like maybe if you do translation and this here would be a target sequence so now whenever I see a transformer like this and it outputs something at this I I look at it as okay this here is sort of the input that goes as like a side input over here and usually here you have the target sequence but that's not the case right here right you have these these object queries so this is how far I get from the pictures now I go up so I have a sort of I have questions now I have questions and that's when I start reading the paper only now do I start reading the paper after I've looked through all the images 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'll usually have is a problem statement which is here like why what's what's wrong right now and then you have like a story of how their paper addresses the issue okay and that's that's here we streamline the training pipeline by viewing object prediction the other yada yada this is often formulates in words what the paper is about and what contribution the paper makes right this is like a this is like a longer abstract the abstract is often very very cryptic very dense this here is often much more informative of what the paper does so for understanding the paper and a high level the introduction is the best place but given that I've already looked at the images and so on I don't actually draw many new much new information from this thing then there's related work and honestly I I skip it like unless I'm the actual reviewer of a paper like when I'm the reviewer of a paper I read the related work but often the related work is just like you first of all you cite a bunch of your friends and then you cite the mandatory papers and then you cite every single person that you think could be a reviewer because or you've actually been rejected from a conference with a reviewer claiming that you're you haven't compared or you haven't cited that or that paper you can pretty much be sure that that's the if if it's not a glaring of 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 references oftentimes this is a good place but a lot of it is just blah blah blah blah blah okay I know I know disagree with me if you want oh yeah to maybe to reading quality so I tend to at this point I tend to not skim so at first I skim but at this point I tend to read every sentence and read it closely and understand it and when I realized like I'm tired or something I don't just skim the paper I've tried to skim papers and it doesn't doesn't work try to read every sentence understand every sentence and okay if you don't understand it don't stop reading because of that but try to not skim and be like oh yeah yeah yeah okay I gotta go to go to go to go that's is 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 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 on 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 Hungarian possible is this box loss that scores bounding boxes unlike many detectors that do box prediction with some initiality yada yada yada they say the most commonly used L1 loss will have different scales for a small so here they basically talk about how they mix the losses they see overall our box losses that defined as this and this now I haven't I don't know what these losses are I just assume there's some bounding box losses so when I it's not true when I say understand everything understand the things that are integral to the story of the paper right how exactly they compute bounding box losses at this point I don't care I just assume that there's some loss that I can back propagate right I what is important is that they do this Hungarian matching thing right as soon as I get that I'm like ah that was this you know this this thing no this thing up here this thing this with the matching thing now I get it now I know 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 under very closely read the things and understand the things that are necessary for the story if you find if you think something is not necessary for the story and then later end up not understanding that maybe come back and you know read it again in any case I would I would rather I would rather skip something and assume it's not necessary if I think so and then come back then trying to understand every everything but the things I do read I try to understand thoroughly okay then there's the architecture okay and that again I read closely and get backbone okay transformer encoder okay and now I understand much more closely decoder okay and here I get now finally I get what this is about decodes and objects in parallel yada yada yada these input embeddings are learned positional encodings that we refer to as object queries and similarly to the encoder we add them to the input at each attention layer so now they name I've already seen these object queries here and the only word I actually need from this sentence are learned the fact that they're positional encodings I just kind of ignore as soon as they say learned I know aha these things here are learned they have actually they're always the same for each of the images they're just overall learned okay so now I feel I understand the entire model and yeah so they then they say auxiliary decoding losses and this sometimes you have to pay attention to like auxiliary auxiliary things because those are the the things that here they say explicitly we found helpful to use auxiliary losses sometimes they they won't say why they did it they'll just say our loss consists of three things and you know if you look at the three things only one of the things is really a part of their story so far and that you should immediately conclude that they've put in the other things because they tried it and it didn't work right so you can also kind of get an estimate of the brittleness and so on of the system in that you see how many unnecessary things are there or how many things are not straightforward how many things are the easiest thing that you would do when you would go about and do what they did okay so then you this concludes this model or method usually this section is called like method or model or something like this and you go to experiments now the main question I have so far or I have maybe I have some more questions about the model itself that I haven't been able to pick up from this section which is not the case here but I simply keep those questions in mind and see whether they are resolved later right so I keep an awareness of what I don't understand but from here on my main issue is are they demonstrating that their story works right so they're here they're they're proposing a loss and a model and in my mind they now need to convince me that that works and that's that's it's not as easy as simply to show me some numbers that they are good at some benchmark they need to show me that they get those numbers because of what they claim so here they claim well okay they propose a new they propose a new architecture so what they need to convince me of is that the architecture itself makes sense right but in other papers when when you propose like and when you say like oh we for example in an LSTM when you build in an attention mechanism and you claim oh we you know the attention mechanism can look back at the source sequence in one step then you need to convince me that that actually happens right so you need to not only do you need to perform well you need to convince me that you perform well because of what you claim your model does right so and that's often difficult and I specifically look out in the experiments for usually the question is like where are they trying to bullshit me right where are they trying to are or are they trying to bullshit me are they trying to cover up the fact that something doesn't work and all the experiments are always in the best light possible of course and you have to keep that in mind but a lot of times you can also already see from the experiments that okay are they doing something weird are they not showing me some obvious experiment or and that's a lot of times I guess is there an easier explanation for why they get the results that they get other than their explanation right and it is it is their job to convince you that their explanation is the correct one for these numbers and especially if there is an easier one that they haven't excluded and then I don't believe the experiments if that's the case right if there is an easier explanation for the effect I'm I'm very skeptical but some papers have an easier job here than other papers so in this paper they basically show results on a on a on a task and since their paper is about hey our pipeline is just easier than other pipelines what they first of all need to do is they just need to like match the numbers of other pipelines and here I see that okay in these results often you have maybe a table or something here you see like this their model other models and their model is the best model in a lot of cases now if the best thing is of course if their model throughout is the best the worst thing is if it's like scattered like this even if their model is the best but in every single benchmark a different configuration of their model is the best that's that's sort of a bad sign unless they can explicitly explain why that is and it's also not that good of a sign if these things are spread out like this like sometimes 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 then after that I would expect you know an experiment in speed while these numbers are matched so but since they say it's 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 then into the baseline models right you 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 when egg whenever they get an improvement or whatever they get what is is due to the story that they want to sell me or could there be like an easier explanation or does something not fit is like are there are the experiments different than from what you would expect here okay so these are these are my main questions are they are they convincing me of their story it's not do they have state-of-the-art numbers I don't care I don't care even though like sometimes so there is a bit of a catch I I don't care about state of the art numbers now let's say you have a table like this and you have a computer vision model and one of the models is like on the C for 10 data set now if your baseline model has like a 91 92 percent accuracy on C for 10 when I know the state-of-the-art is 96 I don't care right I know like I've done C for 10 I know with like I don't know five six layers CNN you can reach these 91 92 93 percent accuracy and to get to the 96 97 you'd actually be like in the region of a wide resinette and whatnot so it I I know that even though you're a few points behind state-of-the-art I know you know this this is valid still so I don't care but if you were to be like at 80 percent accuracy on C for 10 then I then I get a bit like hmm 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 have to keep it in mind for later and then here I go on and there's this DETR for panoptic segmentation and they here they propose like a new model so I first look at it and I'm like okay they propose a new model they can do stuff like this now this is not object detection and again I'm not sure is this like a is this like a an add-on to the method or is was was this up here just an intermediate step to this and honestly after reading that I still wasn't sure it seems like something in between of course the paper is also a bit longer than other papers it just it seems it's too long for just being a side note but it's too short for being its own thing so that was just a bit weird and I treated is as just like a oh we can also do this with our model but I didn't pay like too much attention to that okay so at the end I you know look at conclusions now the conclusions of a paper are much much often they are not nearly as informative as the introduction the conclusions they all often tend to be very generic and kind of hedging a bit against criticisms saying what would be up for future work which is again hedging against criticism because you simply say well we didn't do this that's future work yes 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 your first couple of reads and riff just I don't even think about the paper I just kind of it's just in the subconscious it kind of brews right and I happen to think about the paper every now and then but I don't make a conscious effort to be like oh how am I 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 enjoyed this or if you would like to see any other explanation I don't exactly know if this is what you expected from a video like this so let me know maybe I have 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, "end": 7.74, "text": " Hi there people! So a lot of you have asked me how I read papers and honestly" }, { "start": 7.74, "end": 12.96, "text": " I don't think there is any super special method to it but you know I thought" }, { "start": 12.96, "end": 17.56, "text": " because people have asked me to make a video on it so I'll make a video on it" }, { "start": 17.56, "end": 23.76, "text": " and I'll try to share my method of reading papers and hopefully this is" }, { "start": 23.76, "end": 28.64, "text": " going to be somewhat of a mini series or a series where I every now and then" }, { "start": 28.64, "end": 33.8, "text": " discuss how I read one of the papers that I make videos about and I'll try to" }, { "start": 33.8, "end": 38.84, "text": " select them such that different things are highlighted. Now I've selected this" }, { "start": 38.84, "end": 43.56, "text": " one right here for really for no particular reason other than I sort of" }, { "start": 43.56, "end": 51.040000000000006, "text": " remembered it and I'm going to try to go with you through how I read this and how" }, { "start": 51.040000000000006, "end": 56.400000000000006, "text": " I encountered this and kind of try to honestly share what I thought at the" }, { "start": 56.4, "end": 62.879999999999995, "text": " first time when I read it and I hope this helps some of you. If it does help" }, { "start": 62.879999999999995, "end": 67.2, "text": " you and if you like content like this of course feel free to share this out and" }, { "start": 67.2, "end": 73.36, "text": " subscribe. If you haven't seen my original video on this paper it might" }, { "start": 73.36, "end": 81.2, "text": " be worth to go watch it. I'll link it and with that let's dive in. So again this" }, { "start": 81.2, "end": 87.04, "text": " might be not really something new but I'll just go through it. So first" }, { "start": 87.04, "end": 93.16, "text": " thing I do is of course read the title. So the title has three parts end to end" }, { "start": 93.16, "end": 99.04, "text": " object detection with transformers. So what I notice that I do myself is I like" }, { "start": 99.04, "end": 104.2, "text": " through reading a paper it's like read the paper with an open mind. I don't do" }, { "start": 104.2, "end": 109.24000000000001, "text": " that. I almost immediately form an opinion and a hypothesis of what's going" }, { "start": 109.24, "end": 114.52, "text": " on. So I see transformers so I know what transformers are. If you don't I've" }, { "start": 114.52, "end": 118, "text": " made a video, I've made lots of videos on transformers. Attention is all you need" }, { "start": 118, "end": 122.67999999999999, "text": " is the base paper for that. So I know what a transformer is. And I know" }, { "start": 122.67999999999999, "end": 128.95999999999998, "text": " that transformers are usually in NLP. They are usually used in NLP. There are" }, { "start": 128.95999999999998, "end": 135.04, "text": " things like other things with transformers but it's usually an NLP" }, { "start": 135.04, "end": 139.48, "text": " model. Then I read object detection and I know object detection is a computer" }, { "start": 139.48, "end": 145.95999999999998, "text": " vision task. So immediately this here is sort of a difference and I immediately" }, { "start": 145.95999999999998, "end": 151, "text": " try to assess what's the new idea in this paper. And in this case it might be" }, { "start": 151, "end": 154.23999999999998, "text": " applying transformers to object" }, { "start": 154.23999999999998, "end": 158.72, "text": " detection but then I also see end to end. And the only reason to put that in a" }, { "start": 158.72, "end": 163.07999999999998, "text": " title is because that's the novelty. Because usually in deep learning we're" }, { "start": 163.08, "end": 169.20000000000002, "text": " sort of used to systems being end to end. And even if most systems" }, { "start": 169.20000000000002, "end": 174.08, "text": " aren't end to end, a lot of people don't. It's like end to end image classification" }, { "start": 174.08, "end": 180.72000000000003, "text": " on ImageNet. Thanks. So I was guessing that the reason they put in end to" }, { "start": 180.72000000000003, "end": 185, "text": " end into the title was because that's actually something that's special about" }, { "start": 185, "end": 190.32000000000002, "text": " the model. So now I have like two competing hypotheses of why this paper" }, { "start": 190.32, "end": 194.4, "text": " matters. First of all because it does it with transformers and second because it" }, { "start": 194.4, "end": 199.76, "text": " does it end to end. And of course the true fear is that the combination of" }, { "start": 199.76, "end": 206.68, "text": " end to end transformers, all of that, is what makes this model. And I already" }, { "start": 206.68, "end": 211.28, "text": " form like a hypothesis of whether I like this or not. I have to be honest." }, { "start": 211.28, "end": 216.68, "text": " I have very quick judgment of papers of whether I like them or not and then I" }, { "start": 216.68, "end": 224.20000000000002, "text": " sort of catch myself each time and I still try to... So for most papers" }, { "start": 224.20000000000002, "end": 228.48000000000002, "text": " actually that I have sort of a negative opinion at the beginning where I..." }, { "start": 228.48000000000002, "end": 233.84, "text": " Well, negative. There are papers where I think like there is no way this is going to" }, { "start": 233.84, "end": 238.08, "text": " you know work or something like this. I'm actually positively convinced" }, { "start": 238.08, "end": 246.04000000000002, "text": " throughout the paper. So for most papers that I read, I'm trying" }, { "start": 246.04, "end": 250.6, "text": " to find the positive things in there. But I do form an opinion pretty quickly" }, { "start": 250.6, "end": 256.24, "text": " usually. Alright, so the second thing. This part right here I don't even" }, { "start": 256.24, "end": 263.24, "text": " see. This is like advertisements on Twitter. I have always had" }, { "start": 263.24, "end": 267.8, "text": " issues with author names. People will come to me and be like, oh have you seen" }, { "start": 267.8, "end": 274.28, "text": " the new Vignoles paper? And I have no clue. And then when they say like, oh that's" }, { "start": 274.28, "end": 277.35999999999996, "text": " where they use this character level model to do that. And I'm like, oh that" }, { "start": 277.35999999999996, "end": 283.59999999999997, "text": " paper. So I do not care who the authors are of a paper. I" }, { "start": 283.59999999999997, "end": 288.11999999999995, "text": " can't remember the papers by their author names. I've gotten better at it I" }, { "start": 288.11999999999995, "end": 292.79999999999995, "text": " have to say. But I've always had trouble with this. Now that's not to say that a" }, { "start": 292.79999999999995, "end": 298.47999999999996, "text": " name doesn't pop out to me. If this would be like a like Joshua Benj or" }, { "start": 298.48, "end": 304.72, "text": " someone like really famous, then of course that would catch my eye. But I" }, { "start": 304.72, "end": 310.96000000000004, "text": " also know that you know, Joshua Benjo's paper, Joshua Benjo's lab is huge. So just" }, { "start": 310.96000000000004, "end": 315.72, "text": " because a big name is on the paper doesn't mean that the paper is going to" }, { "start": 315.72, "end": 319.96000000000004, "text": " be of any good or bad quality. Sometimes the authors give you an indication of" }, { "start": 319.96000000000004, "end": 326.12, "text": " what kind of research is there. Like if you see Jeff Klune or Kenneth O" }, { "start": 326.12, "end": 331.8, "text": " Stanley, you know that there's going to be this certain type of" }, { "start": 331.8, "end": 338.44, "text": " learning to explore and kind of a bit more out-of-the-box thinking in" }, { "start": 338.44, "end": 343.52, "text": " their papers, which I really like. But it doesn't immediately give you clue. Maybe" }, { "start": 343.52, "end": 349.68, "text": " if you go by first authors, it's much more indicative if you have already read" }, { "start": 349.68, "end": 355.36, "text": " some of their papers. But most often I just ignore authors and go on. The" }, { "start": 355.36, "end": 361.72, "text": " affiliation sometimes matters in that it's a bit of a vicious cycle. If" }, { "start": 361.72, "end": 367.12, "text": " there's a big name affiliation like Facebook AI, Google AI and so on, these" }, { "start": 367.12, "end": 371.92, "text": " papers also get more exposure in the press and so on. So whenever" }, { "start": 371.92, "end": 376.32, "text": " Google publishes a paper, all of these all these pop-sci magazines like" }, { "start": 376.32, "end": 382.2, "text": " Diverge and This and Lifehacker and Hacker News and whatnot, they like" }, { "start": 382.2, "end": 389.24, "text": " write a blurb about it. So often they get much more scrutinized for these papers." }, { "start": 389.24, "end": 393.71999999999997, "text": " They get much more the public attention, but they also get" }, { "start": 393.71999999999997, "end": 398.88, "text": " much more scrutiny, which in turn means that there is a bit more pressure on" }, { "start": 398.88, "end": 405.48, "text": " them to do good experiments. So that biases me a little bit into the" }, { "start": 405.48, "end": 410.71999999999997, "text": " direction of believing their experimental evidence more. Now usually" }, { "start": 410.72, "end": 415.84000000000003, "text": " this is also backed up by the fact that I am actually convinced by their" }, { "start": 415.84000000000003, "end": 421.88000000000005, "text": " experiments. Usually these big name papers, often I find myself" }, { "start": 421.88000000000005, "end": 427.6, "text": " even without or disregarding the affiliation to be convinced more than of" }, { "start": 427.6, "end": 433.48, "text": " regular papers. My most often issue with papers is that I don't believe" }, { "start": 433.48, "end": 438.76000000000005, "text": " the experiments. I make no difference. Even if it's Facebook, my" }, { "start": 438.76, "end": 444.03999999999996, "text": " prior is the experiments are crap and I don't believe them and they have to" }, { "start": 444.03999999999996, "end": 449.52, "text": " convince me of the opposite. But I can't say that it doesn't affect me," }, { "start": 449.52, "end": 455.88, "text": " that it's like a big-name affiliation. Okay, so then the second thing is I" }, { "start": 455.88, "end": 462.8, "text": " sometimes I see the paper on archive and I skim the abstract. Sometimes the" }, { "start": 462.8, "end": 468.03999999999996, "text": " abstract is informative and sometimes not. So here it's like blah blah blah. A" }, { "start": 468.04, "end": 472, "text": " new method that views object detection as a direct set prediction problem. I'm" }, { "start": 472, "end": 477.32, "text": " like oh yeah okay. It streamlines the detection, effectively removing the need" }, { "start": 477.32, "end": 481.52000000000004, "text": " for many hand-designed components like non-maximum suppression, yada yada yada." }, { "start": 481.52000000000004, "end": 487.88, "text": " The main ingredients called detection transformer, a set-based global loss that" }, { "start": 487.88, "end": 491.48, "text": " forces unique prediction via bipartite matching, and the transformer encoder" }, { "start": 491.48, "end": 495.96000000000004, "text": " decoder architecture. So they make it clear here why it matters and that's" }, { "start": 495.96, "end": 499.71999999999997, "text": " what I want to get at is sort of what's the new thing in this" }, { "start": 499.71999999999997, "end": 505.71999999999997, "text": " paper. Most papers are, even though they're all very long and have lots of" }, { "start": 505.71999999999997, "end": 513.3, "text": " math and so on, they often have like one or maybe two new core things that they" }, { "start": 513.3, "end": 519.92, "text": " really tell you. Sometimes zero. But a lot of times it's like one thing that they" }, { "start": 519.92, "end": 524.76, "text": " really do and you sort of have to... But they're trying to cloak it often" }, { "start": 524.76, "end": 530.36, "text": " because they need to make their research as impactful as possible, right? But you" }, { "start": 530.36, "end": 534.8, "text": " need to sort of figure out what it is they're doing. Here they make it fairly" }, { "start": 534.8, "end": 540.76, "text": " easy for us in that they say okay. They remove the need for many hand-designed" }, { "start": 540.76, "end": 544.4, "text": " components like non-maximum suppression, which tells me that they are building" }, { "start": 544.4, "end": 548.6, "text": " something that's easier than what came before them. And that already tells me" }, { "start": 548.6, "end": 553.64, "text": " it's not necessarily going to be better. Their argument is more that it's going" }, { "start": 553.64, "end": 559.76, "text": " to be easier, right? There are sort of two kinds of experimental results. The" }, { "start": 559.76, "end": 563.6, "text": " ones where you try to beat what came before you and the ones where you're" }, { "start": 563.6, "end": 568.28, "text": " trying to say look our thing works just as well as this other thing while being" }, { "start": 568.28, "end": 573.88, "text": " more advantageous in some other metric. So I would place this already in the" }, { "start": 573.88, "end": 578.68, "text": " sort of second category. And then they say what are the actual ingredients? It's" }, { "start": 578.68, "end": 583.14, "text": " a set-based global loss that forces unique predictions via bipartite" }, { "start": 583.14, "end": 588.04, "text": " matching. Now I at this point I know what these terms mean but at this point I" }, { "start": 588.04, "end": 592.14, "text": " actually don't have to know what the terms mean. What I need to recognize is" }, { "start": 592.14, "end": 597.96, "text": " that I simply have to go later and figure out what that is. And a" }, { "start": 597.96, "end": 604.24, "text": " transformer-based encoder decoder architecture, okay? So there are two" }, { "start": 604.24, "end": 609.04, "text": " things right here that I remember I need to pay attention to later. There's this" }, { "start": 609.04, "end": 614.28, "text": " loss which seems to be special and there is the transformer architecture which" }, { "start": 614.28, "end": 618.4, "text": " they say, okay, the model basically consists of" }, { "start": 618.4, "end": 623.8399999999999, "text": " those two things. And then they have a short description of what it does. Given" }, { "start": 623.8399999999999, "end": 629.66, "text": " a fixed small set of learned object queries, there are reasons about the relations" }, { "start": 629.66, "end": 633.3399999999999, "text": " of the objects and the global image context to directly output the final set" }, { "start": 633.34, "end": 639.1600000000001, "text": " of predicted in parallel. That almost tells me nothing. Yeah, okay, the model" }, { "start": 639.1600000000001, "end": 645.4, "text": " reasons. Maybe this in parallel is something but... The model is conceptually" }, { "start": 645.4, "end": 649.2800000000001, "text": " simple and does not require specialized library unlike many other modern" }, { "start": 649.2800000000001, "end": 653.08, "text": " detectors. This sort of repeats, this enforces my hypothesis that they're" }, { "start": 653.08, "end": 658.2, "text": " going with the hey this is a much easier way of doing things approach. Dettor" }, { "start": 658.2, "end": 662.44, "text": " demonstrates accuracy and runtime performance on par with well-established" }, { "start": 662.44, "end": 669.36, "text": " that further confirms my hypothesis that this is on par, right? The runtime" }, { "start": 669.36, "end": 675.0400000000001, "text": " performance on par with the current state of the art. And at the end they say" }, { "start": 675.0400000000001, "end": 678.96, "text": " moreover, Dettor can easily be generalized to produce panoptic" }, { "start": 678.96, "end": 683.7600000000001, "text": " segmentation in a unified manner. We show that it significantly outperforms" }, { "start": 683.7600000000001, "end": 688.44, "text": " competitive baselines. Training code and preterm models are available. Okay. Now" }, { "start": 688.44, "end": 692.72, "text": " this last part when I first read it is like, okay, can easily be generalized to" }, { "start": 692.72, "end": 698.3800000000001, "text": " produce this panoptic segmentation. I didn't know yet whether this is" }, { "start": 698.3800000000001, "end": 702.32, "text": " like a central claim of their paper that it can do this segmentation or whether" }, { "start": 702.32, "end": 706.6800000000001, "text": " this is like an added benefit to their paper. Because you can read it in both" }, { "start": 706.6800000000001, "end": 712.74, "text": " ways and I'm just ready to find this out in the paper. Now after I've read the" }, { "start": 712.74, "end": 717.0400000000001, "text": " abstract and sort of already formed the hypothesis of what's going on. So here I" }, { "start": 717.04, "end": 722.8, "text": " already in my mind I already sort of have a model of how would I do that, right?" }, { "start": 722.8, "end": 730.56, "text": " How would I do that? And then what would I do? So right now what I" }, { "start": 730.56, "end": 735.0799999999999, "text": " might be thinking is if I have a transformer over images that directly" }, { "start": 735.0799999999999, "end": 744.4, "text": " outputs the predictions in parallel, I'm imagining like an image and the image" }, { "start": 744.4, "end": 748.8, "text": " somehow needs to go into a transformer. So maybe there's like an encoder, like a" }, { "start": 748.8, "end": 756.84, "text": " CNN encoder that gives me image features. And then it's so maybe you sample" }, { "start": 756.84, "end": 761.28, "text": " this down, this image. This is just me hypothesizing what could be going on," }, { "start": 761.28, "end": 767.12, "text": " right? And then I might be unrolling that, right? This image into a vector of these" }, { "start": 767.12, "end": 773.56, "text": " lower pixels. And then so in my mind what I would do right here without knowing" }, { "start": 773.56, "end": 778.28, "text": " anything more would be to do something like BERT span prediction. So I would" }, { "start": 778.28, "end": 784.28, "text": " have BERT right here and I so for I would input the sequence right here and" }, { "start": 784.28, "end": 792.1199999999999, "text": " then to detect an object I would sort of think that maybe the BERT, you know, BERT" }, { "start": 792.1199999999999, "end": 797.1199999999999, "text": " has an output that is the same length as the input, right? So it's it's very good" }, { "start": 797.12, "end": 803.84, "text": " at sequence tagging and things like this. So maybe how it detects an object is" }, { "start": 803.84, "end": 809.16, "text": " going to be that it sort of like tags the center location in the pixel of" }, { "start": 809.16, "end": 813.68, "text": " an object right here or it tags somehow the corners of the of the bounding box." }, { "start": 813.68, "end": 817.68, "text": " But then I don't know how this is going to be in parallel. Maybe BERT outputs" }, { "start": 817.68, "end": 823.04, "text": " like a score for each location and then you do some kind of matching right here." }, { "start": 823.04, "end": 829.04, "text": " So this is my initial hypothesis of what's going on. And then I scroll" }, { "start": 829.04, "end": 835.52, "text": " through and honestly the first thing I do is I go and find the pictures. And no" }, { "start": 835.52, "end": 840.24, "text": " no different in all like since since your first book you read that's what you do. I" }, { "start": 840.24, "end": 844.88, "text": " go and find the pictures because usually if someone proposes anything new that" }, { "start": 844.88, "end": 850.28, "text": " they're gonna try to make a picture of it. Luckily I don't do like super" }, { "start": 850.28, "end": 855.1999999999999, "text": " theoretical what not your Bayesian generalization bounds and I don't know." }, { "start": 855.1999999999999, "end": 862.36, "text": " So most often papers I read have some sort of picture and that's very awful to" }, { "start": 862.36, "end": 870.3199999999999, "text": " me. I know, I know, but yeah. So I find this picture and here I see okay you have" }, { "start": 870.3199999999999, "end": 877.12, "text": " image, you have CNN okay gives you set of image features so so far so good. Then" }, { "start": 877.12, "end": 882.28, "text": " transformer encoder decoder then set of box predictions so all of them come out" }, { "start": 882.28, "end": 886.64, "text": " here and I already read they're in parallel and then bipartite matching" }, { "start": 886.64, "end": 891.4, "text": " loss. So here they I can see they color these in different ways and these color" }, { "start": 891.4, "end": 896.4, "text": " appear to match with these colors right here right in the green here and these" }, { "start": 896.4, "end": 900.52, "text": " they they also this is a very good graphic right from this I can already" }, { "start": 900.52, "end": 906, "text": " read that these here go to the no object. A lot of times the graphics aren't very" }, { "start": 906, "end": 911.08, "text": " good so this this is what I'm not saying in every paper you can learn by looking" }, { "start": 911.08, "end": 915.28, "text": " at the graphics like sometimes the graphics are terrible and you're like" }, { "start": 915.28, "end": 920.36, "text": " what's going on here I like I don't this this makes no sense. This happens a lot" }, { "start": 920.36, "end": 925.44, "text": " in this paper right here this happens to be very very good explanatory graphics so" }, { "start": 925.44, "end": 931.32, "text": " I'll take advantage of that and I do the same thing in the other papers right but" }, { "start": 931.32, "end": 936.36, "text": " then later when it doesn't match what I read in the text I'll have to you know" }, { "start": 936.36, "end": 943.2800000000001, "text": " update my belief and so on but here I see that these go to no object and this" }, { "start": 943.2800000000001, "end": 949.5600000000001, "text": " goes to no object so I don't know yet that this is the test set at the point" }, { "start": 949.5600000000001, "end": 956.46, "text": " where I read this I was sort of confused by this but I recognized that each of" }, { "start": 956.46, "end": 961.96, "text": " these boxes right here is going to be either resulting in a bounding box or in" }, { "start": 961.96, "end": 967.6800000000001, "text": " the no object prediction so from that I could conclude that these things here are" }, { "start": 967.6800000000001, "end": 975.24, "text": " maybe some sort of a fixed set right but I still thought that you know these that" }, { "start": 975.24, "end": 978.96, "text": " this would actually be the output of these image features so that in this" }, { "start": 978.96, "end": 983.36, "text": " case you'd have like six set of image features and then you'd have like BERT" }, { "start": 983.36, "end": 988.84, "text": " here even though that's not an encoder decoder I still this was still my" }, { "start": 988.84, "end": 993.88, "text": " running hypothesis that somehow you'd map these image features to these boxes" }, { "start": 993.88, "end": 999.88, "text": " right here so and I didn't know what to what to make of this this thing right" }, { "start": 999.88, "end": 1007.48, "text": " here so then I went through some more and look for more pictures and there are" }, { "start": 1007.48, "end": 1011.84, "text": " not sometimes I also kind of glance at the formulas but okay when I ever I see" }, { "start": 1011.84, "end": 1015.9200000000001, "text": " this this is just I mean this is kind of useless like okay cool you minimize the" }, { "start": 1015.9200000000001, "end": 1023.84, "text": " loss thanks this okay didn't really pay attention to that ah new picture cool so" }, { "start": 1023.84, "end": 1028.6000000000001, "text": " this picture is much more informative than the other picture now I believe" }, { "start": 1028.6000000000001, "end": 1033.3400000000001, "text": " with the other picture they were trying to showcase this loss how they do the" }, { "start": 1033.3400000000001, "end": 1039.08, "text": " matching and even though I could read a lot from that picture I did not get that" }, { "start": 1039.08, "end": 1044, "text": " part and therefore I felt when I saw this and I just glanced at it I'm like" }, { "start": 1044, "end": 1048.3999999999999, "text": " wait what's what's different than up here it seems like the same but okay" }, { "start": 1048.3999999999999, "end": 1053.4399999999998, "text": " let's look at this so again we see okay you have set of image features that" }, { "start": 1053.4399999999998, "end": 1058.6399999999999, "text": " comes out of the CNN so that conforms with my belief but then this here goes" }, { "start": 1058.6399999999999, "end": 1067.34, "text": " into a transformer encoder and this comes out so immediately I see oh this" }, { "start": 1067.34, "end": 1071.6799999999998, "text": " is not the same as these boxes here right that was my hypothesis that these" }, { "start": 1071.6799999999998, "end": 1079.6, "text": " things here would be the colored boxes so I I say okay obviously that's not what" }, { "start": 1079.6, "end": 1086.1999999999998, "text": " happens this thing here it seems to be sort of the encoded image information" }, { "start": 1086.1999999999998, "end": 1093.9199999999998, "text": " then that's somehow fed into here and that then there are these object query" }, { "start": 1093.92, "end": 1101.3200000000002, "text": " things and they seem to correspond to this so I'm a bit more confused right" }, { "start": 1101.3200000000002, "end": 1107.8000000000002, "text": " now what I can see is that these then will result in these in these boxes okay" }, { "start": 1107.8000000000002, "end": 1114.72, "text": " so being confused by that I look for more pictures so I go look for more" }, { "start": 1114.72, "end": 1119.1200000000001, "text": " pictures and this here seems to be like of a visualization a lot of these papers" }, { "start": 1119.12, "end": 1124.36, "text": " have some sort of ablation experiments or so and so on this I just find really" }, { "start": 1124.36, "end": 1127.9599999999998, "text": " cool picture for now I don't know yet what it means this I don't know yet what" }, { "start": 1127.9599999999998, "end": 1135.32, "text": " it means and I go down skip all of this and then back here in the appendix I" }, { "start": 1135.32, "end": 1142.4799999999998, "text": " find this here which I immediately mapped to the previous where this is the" }, { "start": 1142.4799999999998, "end": 1145.3999999999999, "text": " end and this is a decoder and I've already read the attention is all you" }, { "start": 1145.3999999999999, "end": 1148.36, "text": " need paper and that that point it clicked in me is like ah this is not a" }, { "start": 1148.36, "end": 1152.52, "text": " BERT transformer this is one of these transformers that has an encoder in the" }, { "start": 1152.52, "end": 1156.3999999999999, "text": " decoder even though they told me like 50 billion times already I was too stupid" }, { "start": 1156.3999999999999, "end": 1162.6399999999999, "text": " until this point so now I know okay okay I see what's going on so the image goes" }, { "start": 1162.6399999999999, "end": 1169.32, "text": " through here and then this goes as a side input like as an attention from the" }, { "start": 1169.32, "end": 1174.8, "text": " decoder to the encoder like I know in NLP right so in NLP this here would be a" }, { "start": 1174.8, "end": 1178.96, "text": " source sequence like maybe if you do translation and this here would be a" }, { "start": 1178.96, "end": 1185.12, "text": " target sequence so now whenever I see a transformer like this and it outputs" }, { "start": 1185.12, "end": 1193.1599999999999, "text": " something at this I I look at it as okay this here is sort of the input that goes" }, { "start": 1193.1599999999999, "end": 1200.08, "text": " as like a side input over here and usually here you have the target" }, { "start": 1200.08, "end": 1203.68, "text": " sequence but that's not the case right here right you have these these object" }, { "start": 1203.68, "end": 1211.3200000000002, "text": " queries so this is how far I get from the pictures now I go up so I have a" }, { "start": 1211.3200000000002, "end": 1216.6000000000001, "text": " sort of I have questions now I have questions and that's when I start" }, { "start": 1216.6000000000001, "end": 1220.24, "text": " reading the paper only now do I start reading the paper after I've looked" }, { "start": 1220.24, "end": 1224.72, "text": " through all the images form the hypothesis and sort of have questions on" }, { "start": 1224.72, "end": 1230.6000000000001, "text": " how this works and we'll go a bit faster from now on to just not bore you with" }, { "start": 1230.6, "end": 1235.3999999999999, "text": " all the things so the introduction is often very important even though it's" }, { "start": 1235.3999999999999, "end": 1239.7199999999998, "text": " called introduction and maybe you know if you read a book like if there's like" }, { "start": 1239.7199999999998, "end": 1245.32, "text": " introduction or prologue or something like this it's often kind of pointless" }, { "start": 1245.32, "end": 1250.1999999999998, "text": " introduction in these research papers is one of the most important points" }, { "start": 1250.1999999999998, "end": 1255.52, "text": " because all of these papers they try basically all of them try to convince a" }, { "start": 1255.52, "end": 1260.8, "text": " reviewer to accept them and in order to do that they will set up their main" }, { "start": 1260.8, "end": 1265.24, "text": " points and their main story immediately in the introduction so what you'll" }, { "start": 1265.24, "end": 1270.7, "text": " usually have is a problem statement which is here like why what's what's" }, { "start": 1270.7, "end": 1277.4, "text": " wrong right now and then you have like a story of how their paper addresses the" }, { "start": 1277.4, "end": 1285.76, "text": " issue okay and that's that's here we streamline the training pipeline by" }, { "start": 1285.76, "end": 1290.76, "text": " viewing object prediction the other yada yada this is often formulates in words" }, { "start": 1290.76, "end": 1296.2, "text": " what the paper is about and what contribution the paper makes right this" }, { "start": 1296.2, "end": 1301.0800000000002, "text": " is like a this is like a longer abstract the abstract is often very very cryptic" }, { "start": 1301.0800000000002, "end": 1306.3200000000002, "text": " very dense this here is often much more informative of what the paper does so" }, { "start": 1306.32, "end": 1312.84, "text": " for understanding the paper and a high level the introduction is the best place" }, { "start": 1312.84, "end": 1317.6799999999998, "text": " but given that I've already looked at the images and so on I don't actually" }, { "start": 1317.6799999999998, "end": 1325.6, "text": " draw many new much new information from this thing then there's related work and" }, { "start": 1325.6, "end": 1331.4199999999998, "text": " honestly I I skip it like unless I'm the actual reviewer of a paper like when" }, { "start": 1331.4199999999998, "end": 1335.9199999999998, "text": " I'm the reviewer of a paper I read the related work but often the related work" }, { "start": 1335.92, "end": 1340.48, "text": " is just like you first of all you cite a bunch of your friends and then you cite" }, { "start": 1340.48, "end": 1345.3600000000001, "text": " the mandatory papers and then you cite every single person that you think" }, { "start": 1345.3600000000001, "end": 1350, "text": " could be a reviewer because or you've actually been rejected from a conference" }, { "start": 1350, "end": 1353.44, "text": " with a reviewer claiming that you're you haven't compared or you haven't cited" }, { "start": 1353.44, "end": 1358.44, "text": " that or that paper you can pretty much be sure that that's the if if it's not a" }, { "start": 1358.44, "end": 1362.96, "text": " glaring of omission if it's like a niche paper and you haven't cited it then" }, { "start": 1362.96, "end": 1367.48, "text": " you're like okay I'm gonna cite it just because the next conference you could be" }, { "start": 1367.48, "end": 1374.4, "text": " my reviewer again so I'm not I'm not sure that these related work sections" }, { "start": 1374.4, "end": 1379.28, "text": " they're necessary like if someone wants to write their thesis and they go and" }, { "start": 1379.28, "end": 1384.08, "text": " read this paper and they want references oftentimes this is a good place but a" }, { "start": 1384.08, "end": 1390.2, "text": " lot of it is just blah blah blah blah blah okay I know I know disagree with me" }, { "start": 1390.2, "end": 1396.88, "text": " if you want oh yeah to maybe to reading quality so I tend to at this point I" }, { "start": 1396.88, "end": 1403.68, "text": " tend to not skim so at first I skim but at this point I tend to read every" }, { "start": 1403.68, "end": 1409.4, "text": " sentence and read it closely and understand it and when I realized like" }, { "start": 1409.4, "end": 1414.96, "text": " I'm tired or something I don't just skim the paper I've tried to skim papers and" }, { "start": 1414.96, "end": 1420, "text": " it doesn't doesn't work try to read every sentence understand every sentence" }, { "start": 1420, "end": 1423.92, "text": " and okay if you don't understand it don't stop reading because of that but" }, { "start": 1423.92, "end": 1428.96, "text": " try to not skim and be like oh yeah yeah yeah okay I gotta go to go to go to go" }, { "start": 1428.96, "end": 1438.4, "text": " that's is not helpful except related work skip completely cool then a lot of" }, { "start": 1438.4, "end": 1442.56, "text": " times in this paper now is the the model and this is the section I'm actually" }, { "start": 1442.56, "end": 1448.56, "text": " interested in right so I read very very closely here and then I find out what" }, { "start": 1448.56, "end": 1455.04, "text": " their their loss is all about and again I stress read these things and" }, { "start": 1455.04, "end": 1463.84, "text": " understand them right sometimes it's hard but if you're if you're confused" }, { "start": 1463.84, "end": 1469.32, "text": " that means you either they've done a bad job or they made a mistake or that you" }, { "start": 1469.32, "end": 1473.44, "text": " haven't understood something if you can't understand the sentence try to" }, { "start": 1473.44, "end": 1479.24, "text": " read on maybe it's clarified later and then you know go back but again do not" }, { "start": 1479.24, "end": 1485.96, "text": " do not like just start a lot of times when I read paper previously like I" }, { "start": 1485.96, "end": 1490.2, "text": " wouldn't understand something quite well yet and then I would be like oh yeah" }, { "start": 1490.2, "end": 1494.96, "text": " yeah yeah and then I noticed that I start skipping and skimming more and" }, { "start": 1494.96, "end": 1499.4, "text": " more because that would you know pop up again and again and I wouldn't understand" }, { "start": 1499.4, "end": 1503.6000000000001, "text": " it again and again and then at the end I would just be kind of glancing at the" }, { "start": 1503.6000000000001, "end": 1507.64, "text": " paper and I don't want to do that right here so I want to read every sentence" }, { "start": 1507.64, "end": 1515.3200000000002, "text": " and understand it okay so here then I find out about the loss and then I if I" }, { "start": 1515.3200000000002, "end": 1521.1200000000001, "text": " don't know something here then I'll go and look it up on maybe on Wikipedia or" }, { "start": 1521.1200000000001, "end": 1525.4, "text": " something like this now I don't need to on actually I don't need to understand" }, { "start": 1525.4, "end": 1530.72, "text": " every single part of it right that's maybe I should correct myself so for" }, { "start": 1530.72, "end": 1536.64, "text": " example this bounding box loss here they talk about the second part of the max" }, { "start": 1536.64, "end": 1540.16, "text": " and question Hungarian possible is this box loss that scores bounding boxes" }, { "start": 1540.16, "end": 1543.96, "text": " unlike many detectors that do box prediction with some initiality yada yada" }, { "start": 1543.96, "end": 1548.4, "text": " yada they say the most commonly used L1 loss will have different scales for a" }, { "start": 1548.4, "end": 1553.24, "text": " small so here they basically talk about how they mix the losses they see overall" }, { "start": 1553.24, "end": 1558.76, "text": " our box losses that defined as this and this now I haven't I don't know what" }, { "start": 1558.76, "end": 1563.76, "text": " these losses are I just assume there's some bounding box losses so when I it's" }, { "start": 1563.76, "end": 1568.4, "text": " not true when I say understand everything understand the things that" }, { "start": 1568.4, "end": 1574.48, "text": " are integral to the story of the paper right how exactly they compute bounding" }, { "start": 1574.48, "end": 1578.8, "text": " box losses at this point I don't care I just assume that there's some loss that" }, { "start": 1578.8, "end": 1584.8, "text": " I can back propagate right I what is important is that they do this" }, { "start": 1584.8, "end": 1589.56, "text": " Hungarian matching thing right as soon as I get that I'm like ah that was this" }, { "start": 1589.56, "end": 1597.28, "text": " you know this this thing no this thing up here this thing this with the matching" }, { "start": 1597.28, "end": 1602.68, "text": " thing now I get it now I know there are always the same amount of boxes here and" }, { "start": 1602.68, "end": 1607.6, "text": " there are always the same amount of labels here and all we need to do is" }, { "start": 1607.6, "end": 1612.84, "text": " somehow match them and I immediately think why is that relevant oh because" }, { "start": 1612.84, "end": 1617.08, "text": " when something is already matched to an object some other thing cannot be" }, { "start": 1617.08, "end": 1621.6399999999999, "text": " matched to the same object and that's how we you know prevent the fact that" }, { "start": 1621.6399999999999, "end": 1628.12, "text": " all the things predict the same thing right and so that immediately becomes" }, { "start": 1628.12, "end": 1633.6, "text": " clear and as I said there is usually like one or two ideas in a paper I don't" }, { "start": 1633.6, "end": 1638.52, "text": " assume or I don't care what their exact loss function is because I've sort of" }, { "start": 1638.52, "end": 1644.28, "text": " gotten the idea up here of what the loss is about all right so I hope that's" }, { "start": 1644.28, "end": 1649.4399999999998, "text": " clear under very closely read the things and understand the things that are" }, { "start": 1649.4399999999998, "end": 1655.84, "text": " necessary for the story if you find if you think something is not necessary for" }, { "start": 1655.84, "end": 1659.12, "text": " the story and then later end up not understanding that maybe come back and" }, { "start": 1659.12, "end": 1666.12, "text": " you know read it again in any case I would I would rather I would rather skip" }, { "start": 1666.12, "end": 1671.12, "text": " something and assume it's not necessary if I think so and then come back then" }, { "start": 1671.12, "end": 1676.8799999999999, "text": " trying to understand every everything but the things I do read I try to" }, { "start": 1676.8799999999999, "end": 1685.4799999999998, "text": " understand thoroughly okay then there's the architecture okay and that again I" }, { "start": 1685.48, "end": 1691.08, "text": " read closely and get backbone okay transformer encoder okay and now I" }, { "start": 1691.08, "end": 1698.32, "text": " understand much more closely decoder okay and here I get now finally I get" }, { "start": 1698.32, "end": 1705.3600000000001, "text": " what this is about decodes and objects in parallel yada yada yada these input" }, { "start": 1705.3600000000001, "end": 1708.76, "text": " embeddings are learned positional encodings that we refer to as object" }, { "start": 1708.76, "end": 1713, "text": " queries and similarly to the encoder we add them to the input at each attention" }, { "start": 1713, "end": 1718.28, "text": " layer so now they name I've already seen these object queries here and the only" }, { "start": 1718.28, "end": 1723.16, "text": " word I actually need from this sentence are learned the fact that they're" }, { "start": 1723.16, "end": 1727.88, "text": " positional encodings I just kind of ignore as soon as they say learned I know" }, { "start": 1727.88, "end": 1733.44, "text": " aha these things here are learned they have actually they're always the same" }, { "start": 1733.44, "end": 1738.84, "text": " for each of the images they're just overall learned okay so now I feel I" }, { "start": 1738.84, "end": 1748.24, "text": " understand the entire model and yeah so they then they say auxiliary decoding" }, { "start": 1748.24, "end": 1752.84, "text": " losses and this sometimes you have to pay attention to like auxiliary auxiliary" }, { "start": 1752.84, "end": 1759.12, "text": " things because those are the the things that here they say explicitly we found" }, { "start": 1759.12, "end": 1765.6399999999999, "text": " helpful to use auxiliary losses sometimes they they won't say why they" }, { "start": 1765.64, "end": 1770.96, "text": " did it they'll just say our loss consists of three things and you know if" }, { "start": 1770.96, "end": 1774.2800000000002, "text": " you look at the three things only one of the things is really a part of their" }, { "start": 1774.2800000000002, "end": 1778.92, "text": " story so far and that you should immediately conclude that they've put in" }, { "start": 1778.92, "end": 1783.96, "text": " the other things because they tried it and it didn't work right so you can also" }, { "start": 1783.96, "end": 1787.96, "text": " kind of get an estimate of the brittleness and so on of the system in" }, { "start": 1787.96, "end": 1793, "text": " that you see how many unnecessary things are there or how many things are not" }, { "start": 1793, "end": 1798.12, "text": " straightforward how many things are the easiest thing that you would do when you" }, { "start": 1798.12, "end": 1805.32, "text": " would go about and do what they did okay so then you this concludes this model or" }, { "start": 1805.32, "end": 1809.24, "text": " method usually this section is called like method or model or something like" }, { "start": 1809.24, "end": 1815.6, "text": " this and you go to experiments now the main question I have so far or I have" }, { "start": 1815.6, "end": 1819.92, "text": " maybe I have some more questions about the model itself that I haven't been" }, { "start": 1819.92, "end": 1826.4, "text": " able to pick up from this section which is not the case here but I simply keep" }, { "start": 1826.4, "end": 1833.28, "text": " those questions in mind and see whether they are resolved later right so I keep" }, { "start": 1833.28, "end": 1838.96, "text": " an awareness of what I don't understand but from here on my main issue is are" }, { "start": 1838.96, "end": 1845.3200000000002, "text": " they demonstrating that their story works right so they're here they're" }, { "start": 1845.32, "end": 1852.72, "text": " they're proposing a loss and a model and in my mind they now need to convince me" }, { "start": 1852.72, "end": 1859.54, "text": " that that works and that's that's it's not as easy as simply to show me some" }, { "start": 1859.54, "end": 1864.82, "text": " numbers that they are good at some benchmark they need to show me that they" }, { "start": 1864.82, "end": 1872.48, "text": " get those numbers because of what they claim so here they claim well okay they" }, { "start": 1872.48, "end": 1876.32, "text": " propose a new they propose a new architecture so what they need to" }, { "start": 1876.32, "end": 1882.08, "text": " convince me of is that the architecture itself makes sense right but in other" }, { "start": 1882.08, "end": 1888.56, "text": " papers when when you propose like and when you say like oh we for example in" }, { "start": 1888.56, "end": 1894.3600000000001, "text": " an LSTM when you build in an attention mechanism and you claim oh we you know" }, { "start": 1894.3600000000001, "end": 1900.76, "text": " the attention mechanism can look back at the source sequence in one step then you" }, { "start": 1900.76, "end": 1905.36, "text": " need to convince me that that actually happens right so you need to not only do" }, { "start": 1905.36, "end": 1909.84, "text": " you need to perform well you need to convince me that you perform well because" }, { "start": 1909.84, "end": 1917, "text": " of what you claim your model does right so and that's often difficult and I" }, { "start": 1917, "end": 1922.36, "text": " specifically look out in the experiments for usually the question is like where" }, { "start": 1922.36, "end": 1928.96, "text": " are they trying to bullshit me right where are they trying to are or are they" }, { "start": 1928.96, "end": 1933.88, "text": " trying to bullshit me are they trying to cover up the fact that something doesn't" }, { "start": 1933.88, "end": 1938.3600000000001, "text": " work and all the experiments are always in the best light possible of course and" }, { "start": 1938.3600000000001, "end": 1943.44, "text": " you have to keep that in mind but a lot of times you can also already see from" }, { "start": 1943.44, "end": 1951.08, "text": " the experiments that okay are they doing something weird are they not showing me" }, { "start": 1951.08, "end": 1956.52, "text": " some obvious experiment or and that's a lot of times I guess is there an easier" }, { "start": 1956.52, "end": 1961.96, "text": " explanation for why they get the results that they get other than their" }, { "start": 1961.96, "end": 1967.08, "text": " explanation right and it is it is their job to convince you that their" }, { "start": 1967.08, "end": 1972.6, "text": " explanation is the correct one for these numbers and especially if there is an" }, { "start": 1972.6, "end": 1978.12, "text": " easier one that they haven't excluded and then I don't believe the experiments" }, { "start": 1978.12, "end": 1982.92, "text": " if that's the case right if there is an easier explanation for the effect I'm" }, { "start": 1982.92, "end": 1989.0800000000002, "text": " I'm very skeptical but some papers have an easier job here than other papers so" }, { "start": 1989.0800000000002, "end": 1995.92, "text": " in this paper they basically show results on a on a on a task and since" }, { "start": 1995.92, "end": 2001.72, "text": " their paper is about hey our pipeline is just easier than other pipelines what" }, { "start": 2001.72, "end": 2005.16, "text": " they first of all need to do is they just need to like match the numbers of" }, { "start": 2005.16, "end": 2010.5600000000002, "text": " other pipelines and here I see that okay in these results often you have maybe a" }, { "start": 2010.56, "end": 2015.8, "text": " table or something here you see like this their model other models and their" }, { "start": 2015.8, "end": 2022.44, "text": " model is the best model in a lot of cases now if the best thing is of course" }, { "start": 2022.44, "end": 2026.8, "text": " if their model throughout is the best the worst thing is if it's like" }, { "start": 2026.8, "end": 2032.04, "text": " scattered like this even if their model is the best but in every single" }, { "start": 2032.04, "end": 2037.48, "text": " benchmark a different configuration of their model is the best that's that's" }, { "start": 2037.48, "end": 2042.88, "text": " sort of a bad sign unless they can explicitly explain why that is and it's" }, { "start": 2042.88, "end": 2048.96, "text": " also not that good of a sign if these things are spread out like this like" }, { "start": 2048.96, "end": 2053.72, "text": " sometimes this baseline is good sometimes their model is better and so on" }, { "start": 2053.72, "end": 2057.68, "text": " so pay attention to that now in this paper it doesn't matter so much that's" }, { "start": 2057.68, "end": 2062.04, "text": " actually fine because what they're trying to show is that their model is on" }, { "start": 2062.04, "end": 2068.24, "text": " par and way easier and they've already made the case in what way it is easier" }, { "start": 2068.24, "end": 2072.64, "text": " it's easier in terms of architecture if they were to say it's much faster then" }, { "start": 2072.64, "end": 2078.92, "text": " after that I would expect you know an experiment in speed while these numbers" }, { "start": 2078.92, "end": 2082.96, "text": " are matched so but since they say it's it's easier I've already seen the" }, { "start": 2082.96, "end": 2087.7799999999997, "text": " architecture I'm convinced of that now that they show okay our numbers match" }, { "start": 2087.78, "end": 2093.6400000000003, "text": " or actually I'm surprised they even outperform a lot of times then I'm quite" }, { "start": 2093.6400000000003, "end": 2098.5600000000004, "text": " happy with these experiments so also look for differences between numbers and" }, { "start": 2098.5600000000004, "end": 2104.6400000000003, "text": " the spread of numbers now it's not easy to say what if like point one is a big" }, { "start": 2104.6400000000003, "end": 2108.7200000000003, "text": " or a small difference that depends on the task but if you know pay attention" }, { "start": 2108.7200000000003, "end": 2113.1200000000003, "text": " to these things pay attention to the fact that these results are noisy and" }, { "start": 2113.12, "end": 2117.8399999999997, "text": " oftentimes there is a lot more hyper parameter tuning going into the model of" }, { "start": 2117.8399999999997, "end": 2122.7599999999998, "text": " the paper then into the baseline models right you want to make your look your" }, { "start": 2122.7599999999998, "end": 2128.44, "text": " stuff look as good as possible and here is a little bit where the institutional" }, { "start": 2128.44, "end": 2133.8399999999997, "text": " credibility of someone like Facebook comes in in that I tend to believe their" }, { "start": 2133.8399999999997, "end": 2141.52, "text": " results a bit more than other results not mega but a bit more yeah also look at" }, { "start": 2141.52, "end": 2145.92, "text": " patterns that they don't point out in the text so if there is like a pattern" }, { "start": 2145.92, "end": 2149.7599999999998, "text": " if you see like an interaction between the number of parameters and the score" }, { "start": 2149.7599999999998, "end": 2155.68, "text": " or something like this just try to be on the lookout of that and see if you can" }, { "start": 2155.68, "end": 2161.88, "text": " spot something that you think or think about whether that makes sense or not in" }, { "start": 2161.88, "end": 2171.6400000000003, "text": " what your hypothesis would be so here we go on and okay then they go into" }, { "start": 2171.6400000000003, "end": 2176.6400000000003, "text": " ablations and a lot of a lot of these papers do ablations and I generally" }, { "start": 2176.6400000000003, "end": 2181.76, "text": " appreciate that so here they visualize that the attention mechanism in their" }, { "start": 2181.76, "end": 2187.56, "text": " model actually refers to different instances right encoder self-attentions" }, { "start": 2187.56, "end": 2191.4, "text": " for a set of reference points the encoder is able to separate individual" }, { "start": 2191.4, "end": 2198.08, "text": " instances and you can see that pretty clearly right here where and even here" }, { "start": 2198.08, "end": 2203.32, "text": " with the overlapping cows and this is the sort of experiment that I would" }, { "start": 2203.32, "end": 2207.36, "text": " expect that actually convinces me that their architecture does what it says" }, { "start": 2207.36, "end": 2213.6, "text": " that it does right and something like this where you see like totally" }, { "start": 2213.6, "end": 2218.28, "text": " overlapping things with the attention of the individual things visualized so" }, { "start": 2218.28, "end": 2223.1200000000003, "text": " telling me like especially this one right here the the foot of the back" }, { "start": 2223.1200000000003, "end": 2227.36, "text": " elephant actually being focused by the attention of the bounding box of the" }, { "start": 2227.36, "end": 2232.32, "text": " back elephant that's the sort of experiment that convinces me that their" }, { "start": 2232.32, "end": 2238.96, "text": " claims like that their numbers really come from what they claim it comes from" }, { "start": 2238.96, "end": 2244.96, "text": " okay so at the end of the experimental section you should always ask yourself" }, { "start": 2244.96, "end": 2251.28, "text": " have they really convinced me that their story is true right that the" }, { "start": 2251.28, "end": 2255.36, "text": " improvement or when egg whenever they get an improvement or whatever they get" }, { "start": 2255.36, "end": 2262.68, "text": " what is is due to the story that they want to sell me or could there be like" }, { "start": 2262.68, "end": 2268.48, "text": " an easier explanation or does something not fit is like are there are the" }, { "start": 2268.48, "end": 2273.7200000000003, "text": " experiments different than from what you would expect here okay so these are" }, { "start": 2273.72, "end": 2278.2799999999997, "text": " these are my main questions are they are they convincing me of their story it's" }, { "start": 2278.2799999999997, "end": 2284.3599999999997, "text": " not do they have state-of-the-art numbers I don't care I don't care even" }, { "start": 2284.3599999999997, "end": 2290.9599999999996, "text": " though like sometimes so there is a bit of a catch I I don't care about state" }, { "start": 2290.9599999999996, "end": 2297.2799999999997, "text": " of the art numbers now let's say you have a table like this and you have a" }, { "start": 2297.2799999999997, "end": 2301.6, "text": " computer vision model and one of the models is like on the C for 10 data set" }, { "start": 2301.6, "end": 2308.68, "text": " now if your baseline model has like a 91 92 percent accuracy on C for 10 when I" }, { "start": 2308.68, "end": 2314.56, "text": " know the state-of-the-art is 96 I don't care right I know like I've done C for 10" }, { "start": 2314.56, "end": 2321.4, "text": " I know with like I don't know five six layers CNN you can reach these 91 92 93" }, { "start": 2321.4, "end": 2326.48, "text": " percent accuracy and to get to the 96 97 you'd actually be like in the region of" }, { "start": 2326.48, "end": 2334.12, "text": " a wide resinette and whatnot so it I I know that even though you're a few" }, { "start": 2334.12, "end": 2340.2400000000002, "text": " points behind state-of-the-art I know you know this this is valid still so I" }, { "start": 2340.2400000000002, "end": 2348.4, "text": " don't care but if you were to be like at 80 percent accuracy on C for 10 then I" }, { "start": 2348.4, "end": 2354.16, "text": " then I get a bit like hmm I like it's pretty easy to get to 90 percent plus" }, { "start": 2354.16, "end": 2361.56, "text": " with like a standard CNN so there I immediately start to wonder why is there" }, { "start": 2361.56, "end": 2365.8399999999997, "text": " an explanation now this could be like a theoretical paper that says oh we" }, { "start": 2365.8399999999997, "end": 2371.52, "text": " investigate MLPs and that's why we only get that number so that's that would be" }, { "start": 2371.52, "end": 2377.12, "text": " fine but if something is out of the ordinary like this then I pay attention" }, { "start": 2377.12, "end": 2381.8799999999997, "text": " but never because something isn't like the latest and greatest state-of-the-art" }, { "start": 2381.88, "end": 2388.84, "text": " that's just dumb okay and also if only evaluate what the paper claims it does" }, { "start": 2388.84, "end": 2394.04, "text": " right if the paper says we want to show that we are on par with current models" }, { "start": 2394.04, "end": 2400.48, "text": " then don't be mad if the paper doesn't outperform these models they didn't" }, { "start": 2400.48, "end": 2406.48, "text": " claim that right so yeah so after these ablations I'm actually pretty happy" }, { "start": 2406.48, "end": 2413.28, "text": " right here with the results and this right here when I saw this I didn't I" }, { "start": 2413.28, "end": 2419, "text": " didn't expect that but I read the experiment description that these are" }, { "start": 2419, "end": 2423.44, "text": " these different learned object queries and what they do and that gave me an" }, { "start": 2423.44, "end": 2428.96, "text": " increased understanding of how these object queries actually work right so at" }, { "start": 2428.96, "end": 2433.44, "text": " that point I still had like a vague I knew that these are learned but reading" }, { "start": 2433.44, "end": 2438.08, "text": " this and sort of looking at it studying it a bit I was like oh okay then I" }, { "start": 2438.08, "end": 2443.64, "text": " understood even better what they are so again when I say understand everything" }, { "start": 2443.64, "end": 2450.2000000000003, "text": " in the method section you can still have questions and but you just have to keep" }, { "start": 2450.2000000000003, "end": 2456.88, "text": " it in mind for later and then here I go on and there's this DETR for panoptic" }, { "start": 2456.88, "end": 2463.2000000000003, "text": " segmentation and they here they propose like a new model so I first look at it" }, { "start": 2463.2, "end": 2467.2799999999997, "text": " and I'm like okay they propose a new model they can do stuff like this now" }, { "start": 2467.2799999999997, "end": 2472.56, "text": " this is not object detection and again I'm not sure is this like a is this like" }, { "start": 2472.56, "end": 2479.12, "text": " a an add-on to the method or is was was this up here just an intermediate step" }, { "start": 2479.12, "end": 2485.48, "text": " to this and honestly after reading that I still wasn't sure it seems like" }, { "start": 2485.48, "end": 2489.8399999999997, "text": " something in between of course the paper is also a bit longer than other papers" }, { "start": 2489.84, "end": 2496.92, "text": " it just it seems it's too long for just being a side note but it's too short for" }, { "start": 2496.92, "end": 2501.8, "text": " being its own thing so that was just a bit weird and I treated is as just like" }, { "start": 2501.8, "end": 2507.6400000000003, "text": " a oh we can also do this with our model but I didn't pay like too much attention" }, { "start": 2507.6400000000003, "end": 2516.36, "text": " to that okay so at the end I you know look at conclusions now the conclusions" }, { "start": 2516.36, "end": 2523.88, "text": " of a paper are much much often they are not nearly as informative as the" }, { "start": 2523.88, "end": 2529.28, "text": " introduction the conclusions they all often tend to be very generic and kind" }, { "start": 2529.28, "end": 2534.76, "text": " of hedging a bit against criticisms saying what would be up for future work" }, { "start": 2534.76, "end": 2541, "text": " which is again hedging against criticism because you simply say well we didn't do" }, { "start": 2541, "end": 2547.08, "text": " this that's future work yes so again I read it but I don't really pay attention" }, { "start": 2547.08, "end": 2553.32, "text": " to it and then I gloss over the abstract I just would kind of scroll through the" }, { "start": 2553.32, "end": 2558.8, "text": " abstract if there's something that catches my eye I would look at it and if" }, { "start": 2558.8, "end": 2565.32, "text": " not then not and then I basically go to the start and whenever I didn't" }, { "start": 2565.32, "end": 2570.68, "text": " understand something I go back I look at it again and I try to think are all my" }, { "start": 2570.68, "end": 2575, "text": " questions answered and have they sufficiently convinced me that their" }, { "start": 2575, "end": 2582.44, "text": " story is the thing that really has the effect right here and then if I now were" }, { "start": 2582.44, "end": 2588.8399999999997, "text": " to make a video of this I've often found it useful to just put the paper away for" }, { "start": 2588.8399999999997, "end": 2593.48, "text": " a while and it's I usually get the best results when I read the paper the day" }, { "start": 2593.48, "end": 2598.72, "text": " before and then make a video the day after or if not I'll just you know put" }, { "start": 2598.72, "end": 2603.7599999999998, "text": " it away do something else do some email responding programming going outside" }, { "start": 2603.7599999999998, "end": 2610.6, "text": " eating lunch just some kind of a break between first read or between your" }, { "start": 2610.6, "end": 2616.8399999999997, "text": " first couple of reads and riff just I don't even think about the paper I just" }, { "start": 2616.8399999999997, "end": 2623.4399999999996, "text": " kind of it's just in the subconscious it kind of brews right and I happen to" }, { "start": 2623.4399999999996, "end": 2626.52, "text": " think about the paper every now and then but I don't make a conscious effort to be" }, { "start": 2626.52, "end": 2630.7599999999998, "text": " like oh how am I gonna explain this and so on but I just found the the worst" }, { "start": 2630.7599999999998, "end": 2635.64, "text": " videos are the ones where I immediately make the video after reading a paper" }, { "start": 2635.64, "end": 2642.08, "text": " and I've just discovered that if I kind of take a break and then I look at it" }, { "start": 2642.08, "end": 2646.8, "text": " again right I look I don't read it fully again but I if I have if I have the" }, { "start": 2646.8, "end": 2650.16, "text": " feeling I've understood it I don't read it fully again but I just kind of look" }, { "start": 2650.16, "end": 2655.56, "text": " at it and go again through the story and I think that's even if you you know want" }, { "start": 2655.56, "end": 2660.16, "text": " to if you want to talk about a paper in a reading group or tell you know explain" }, { "start": 2660.16, "end": 2666.32, "text": " it to your friends or whatnot this is often very useful just put it away for" }, { "start": 2666.32, "end": 2673.68, "text": " a while let it mellow and I find that helps a lot okay that was my process of" }, { "start": 2673.68, "end": 2680, "text": " reading this particular paper now we again this this is a high quality paper" }, { "start": 2680, "end": 2685.2, "text": " so it's I find it's a pretty easy read in that I simply need to understand what" }, { "start": 2685.2, "end": 2690.8799999999997, "text": " they did and I'm pretty happy with their experiments I maybe next time I can find" }, { "start": 2690.8799999999997, "end": 2696.48, "text": " an experiment or a paper where I'm initially more skeptical and not as happy" }, { "start": 2696.48, "end": 2703.16, "text": " with what I find but yeah let me know if you enjoyed this or if you would like to" }, { "start": 2703.16, "end": 2708.3599999999997, "text": " see any other explanation I don't exactly know if this is what you expected" }, { "start": 2708.3599999999997, "end": 2714.18, "text": " from a video like this so let me know maybe I have misunderstood you" }, { "start": 2714.18, "end": 2720.08, "text": " completely or it's way too long way too detailed or way too undetailed yeah" }, { "start": 2720.08, "end": 2749.2, "text": " leave me a comment and I'll see you next time bye bye" } ]
qSArFEIoSbo
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
RepNet: Counting Out Time - Class Agnostic Video Repetition Counting in the Wild (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "vision", "counting", "self-similarity", "temporal", "frames", "video", "repeating", "lines", "transformer", "attention", "cnn", "convolutional neural network", "repetitions", "periodicity", "period", "repeat", "actions", "kinetics", "countix" ]
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 jumping jacks in a fairly regular pattern. In the middle it gets a bit more difficult because what you see is a tennis ball bouncing and it bounces faster and faster and faster as time goes on. On the right you see that there is a short intro sequence before the repeating action, the person shoveling the cement, is displayed. So the goal here is to build an AI that can detect that a repeating action is happening and if it detects so that it can count how often this repeating action is happening. You can already see the difficulties here is not only the recognition itself but the fact that the repeating actions can be different and can be of different length and cannot always look the same and so on. So this paper uses these temporal self-similarity matrices that you see at the bottom here to achieve this and we're going to explore how that's happening. So the paper we'll look at is called Counting Out Time Class Agnostic Video Repetition Counting in the Wild by Debidada Dwebidi, Yusuf Aitar, Jonathan Thompson, Pierre Sermonet and Andrew Zizerman of Google Research and DeepMind. So as I already said this paper detects repeating actions and is able to count them and on a high level what they do is they encode the video using convolutional networks then they build these temporal self-similarity matrices between the frames in order to detect the repetitions and they decode that into the predictions using another neural network. This is all trained end to end and they also make a new data set for this task. So that's the high level. If you want to find out how exactly that's done I invite you to stick around because we'll go into the paper. If you like content like this don't forget to share it out, 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 manyfold. 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 is 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 QUVA data set I believe has 100 data points and 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 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 binned 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 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 two 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 ResNet 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. If you consider the frame before it and maybe the frame before it is this and maybe the frame after it is that, you can clearly see that the hands or the arms are in an upward motion. So the next step of the encoder tries to integrate that temporal information into the embeddings and that is achieved via a 3D convolution. So once 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, 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 you have to pay attention here. This right this stack right here is the individual channels of one image so of one video frame. This stack right here that I'm drawing these are the video frames stacked. Now each of these stacked video frames can have multiple channels resulting from its 2D convolution or even just RGB. So I can't really draw in four dimensions but now we stack the video frames and now our kernel our filter will be also in the direction of the video frame. So I don't know if this is really recognizable if I draw it like this but as you can see the kernel is not only 2D but 3D and now the sliding so if we have actually more than that the sliding is not only done into the direction of height and width but also into the direction of depth so that each of the frames each of the video frames right here can incorporate information from its immediate neighbors in case of a 3x3x3 filter or even more neighbors but here we use a 3x3x3 filter. Okay so that's that's how we obtain these embeddings right here and at the end there is a dimension reduction like a max pooling or something but ultimately what you'll end up with is for each of the 64 video frames you get one vector and that vector mainly describes that particular video frame like if you consider the green one here but also contains information from the video frame before it and from the video frame after it. Okay so that's sort of and 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 64x64 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 is no skip connections that's all that's your information bottleneck and by having a bottleneck like this these the authors here force the model to basically do a good job at making this temporal self-similarity happen if it wants to achieve a low loss 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 it's 64x64 so frame i here is simply compared to each of the other frames j and depending on whether that embedding is very similar to the embedding of frame j this number is going to be high or low. Now there's also a after that you do a softmax across here such that this is going to be like a distribution and not just raw numbers but that's ultimately not that important so what you can see is that the diagonal is very prominent and that makes sense because technically the diagonal is always one right if for example if you use the inner product as a similarity the diagonal should always be one but here we have the softmax so it's not but ultimately we can say that any frame should be very similar to its is going to be very similar to itself so that's why but then you can see right here there's a pattern emerging and that pattern is these diagonal lines in this direction as you can see and what what does that mean they actually have a larger version of this down here so what does the diagonal pattern mean it means that so here the diagonal that's okay frame i is very similar to frame i cool but the other lines what do they mean so if i look at frame i right here it is also very similar to this frame j now this wouldn't be further you know frames are similar but the line means that if i have if i look 10 frames later i plus 10 that's very similar to j plus 10 and if i now look at i plus 20 frame that's very similar to j plus 20 so this is the this is here why the the pattern is emerging of a line because if i go 10 frames into the future it's similar to the other one 10 frames into the future and so on and that means the line indicates that this entire sequence starting from i 20 frames into the future is repeated starting from j actually j is earlier here so but you get the point and if i have a bunch of these lines that means that this subsequence 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 are basically done having this self-similarity matrix what we could do let's let's say we could train it we don't worry about how to train it we could simply take each row right here and we plot the intensities across that row and that's maybe you know like something like this and then there's the diagonal is a bit higher okay we could just use a heuristic to detect these bumps here basically calculate the length count the bumps and calculate the period length right that that should be pretty easy with like a simple heuristic but the authors here they want more they want to solve more problems so what are some of the problems we already saw some of the problems namely for example 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 you if you if you have this full thing right here that basically means all the frames are self similar to each other which basically means if you stop the video right that's if you have 10 frames in a row the same thing the ball is just lying on the ground all of these frames will be self similar so there's probably no bouncing happening down here you can see pretty well from the pattern what happens and here in this mixing concrete example that we saw at the beginning you can see that at the beginning at the end there's this intro and outro sequence and only in the middle is there a repeating action and that's indicated by this line pattern is only at in the middle of the videos only between here and here so it's it's going to be pretty difficult to just have a heuristic that reads out these periodic action periodicity and in a true deep learning fashion the the authors here oh sorry maybe you can't see that i've shifted my recording window so maybe sometimes something's out of frame and you have to yell at me if i do that please so i hope you you saw this that you have the ever the speeding up here and here they're visible in the pattern and then here you have the beginning sequence the end sequence that have no repeating pattern and the repeating pattern only merged in the middle so the authors want to do this through of course a deep learning network they want to read out the periodicities not through a heuristic but using a deep network you know respectable that's at the times we live in so what do they do first of all you have to see right here everything that happens from here as i understand it is per frame so they simply take a row of this matrix right here like this red line and that is independently pulled through to the end so there is no interaction happening anymore between the individual frame data the only interaction that happens is a little bit here at the temporal convolutions but the only real interaction between the frames is happening through the self-similarity matrix and again this is the information bottleneck that the authors force the information through everything happening from here 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 up sample that not up sample but we expand the channels to 32 channels now as i said it's pretty easy to think we can just go to the end here use a conv net to produce our final 512 by so 512 embeddings we have here again 64 by 64 that we then use to predict the final result but the authors here do something different they do transformer layers in the middle but only per frame so what does it mean so here you up sample to 32 channels and then that means that one of these blocks right here one of these blocks corresponds to one row in the self-similarity matrix which corresponds to one frame and from now on so from now on i want to say what i said before from now on it's all just this one block they are independent of each other okay so you take this one block and you feed it through a transformer to achieve at your final embedding of 512 and it's probably best if we read what they say about it okay so if we're given this self-similarity matrices matrix they consist of row each row is the per frame self-similarity representation and generates two outputs the per frame period length estimation and the per frame binary periodicity classification note that both l and p are vectors and their elements are per frame predictions okay the architecture of the period predictor module can be viewed in figure two note that the predictors share a common architecture and waits until the last classification phase the shared processing pipeline starts with starts with 32 2d convolutional filters of size three by three followed by a transformer layer which uses a multi-headed attention with trainable positional embeddings in the form of a 64 length variable that is learned by training okay it's i guess the transformers learned by training and the positional embeddings are also learned by training that's fairly common we use four heads with 512 dimension in the transformer by the way if you don't know what a transformer is watch the video on attention is all you need i made one it's very popular yeah so with each head being 128 dimensions in size after the shared pipeline we have two classifiers period length classifier and periodicity classifier tau sorry this is fine this is tau each of them consists of two fully connected layers of size 512 so i guess the the the pipeline here is pretty simple the question could be why do they use a transformer and not simply another convolutional network so here they up sample the image as we saw into 32 channels and then they simply want to take one of these one of these blocks here and that corresponds a little bit so we have for one frame right what does it mean we have basically we have 64 by 32 things so the 64 things it's this one frames temporal connection to each other frame given that you know comes from this self-similarity matrix so it kind of relates this frame that we're considering to each of the other frames and each of this each of these entries is a 32 size vector this is sort of a this is you can consider 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 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 back prop through everything everything here is differentiable so all of this is trained to achieve minimum possible loss and because you train everything to achieve minimal possible loss you make this encoder right here which is the crucial part because the encoder is must give you good embeddings which must give you a sensible self-similarity matrix right you train the encoder to encode things that are relevant for the task and that's what makes the whole thing work okay so we've gone through the architecture now the problem right here is the the data set so they also go into how they do inference they can actually do a bunch of things like play the video at different speeds and then look at what each of the predictions so if a double speed it predicts half the period length then you can be more sure and so on so that's pretty cool but they go into another point right here and that's the data set so they produce this countix data set but also on the other hand which is something I also find very cool is they produce a synthetic data set so here they say we train with synthetic repetitions and that can be sort of I didn't know what to think of it at first I was just like huh but then it's pretty cool so if you have a video with these these are the frames of the video right so the video goes in this temporal direction what you can do is simply go here go through these frames and just repeat these frames and repeat them and repeat them and at the end you have these frames right and then you have a data set and if you if you assume that most videos do not naturally contain repeating actions right most videos are just videos they're not videos of something repeating then you can safely assume that these parts here are non repeating so and these parts here are repeating this is one of the labels that you need right the problem with synthetic data set is always to have the labels and also you know how many there are because you can simply count the number of times that you go through it you can even make it faster slower and so on so this synthetic approach is pretty cool and especially the bottom right here because this might be kind of hacky because each time each time you jump from the end of one of those arrows to the beginning right you have kind of a hack in the indie video because you know it's not continuous so what you can do and this is the the bottom here you can do this reversal technique where you go to the end and then you play the frames backwards and then you play the frames forwards again backwards again forwards again and then you go out here and that gives you one continuous motion right if someone if it's simply a video of someone lifting their hand like it starts out down here and it goes here and it goes here and then if you do this technique it would go down again down again up again up again and so on so that's you know i think it's a fairly smart technique honestly now they tried this and it doesn't work super well so what they also have to do is they have to do manual camera motion augmentation so that's 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 rope training mountain climbers but you have also things like playing ukulele exercising arms slicing an onion and so on and you can see that the repetition count is fairly diverse as well so from one or two repetitions per video it goes to 50 or so and the period length is also between one and five seconds though as you as i already said you don't have to you don't have to count on that because you can always play the video slower or faster and then determine other periodicities so in their experiment first of all they perform pretty well and they show that if they train on their data set and on the synthetic data set they perform better than if they just train on the synthetic or they just train on their data set they also show pretty clearly that the addition of this temporal self-similarity matrix helps tremendously you can see right here in each of these boxes is the comparison and this obi I think is the off by one error so it kind of forgives you if you're off by one count but otherwise you get a zero if you're wrong and you can see that the self-similarity matrix helps tremendously they also compare with some other architectural choices instead of the transformer I guess yeah so I guess they just take it because it performs pretty well and they do a lot of lot of ablations but what I particularly appreciate is that they do something like this so what they do at the end went once they've trained the architectures they do a 1d PCA 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 1d PCA so a projection into one dimension of these features and you can already see at this one dimensional projection that the periodicity here is clearly clearly visible namely for example right here every time up here is when the legs are up and every time down here is when the legs are down right here so that is very very impressive and that kind of that really shows that the model is doing what you claim what you claim that it's doing like I'm almost more interested in experiments like this than in and in these numbers right here because the numbers could always be because you've just thrown more stuff at it right so they go over a bunch of possible applications of their model so first of all you can do something like as we can see repetition counting from videos you can do periodicity detection those were the things that the model is trained to do but there's also a bunch of things that the model can now implicitly do namely something like change inspection where they say look if someone's chopping this pineapple right here then at the end of each of the repetitions there is something that changed namely the number of slices of pineapple is it 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 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 in a purely visual sense in a pixel sense but it is at the same point in the repeating action and that's you know that's that's pretty cool so you can technically retrieve related things even though they visually they don't look similar that much yeah that that's the the kind of applications here are probably many many fold and I also think that so in this measure of intelligence paper by françois choulet he basically claims that this is one of the innate abilities of humans they can count you know they can count things this is something you're basically born with and maybe this thing right here will become sort of a staple staple component for many other things that we build AI on I would not be surprised but maybe it will just fade into history I think it's pretty cool project especially you know the the architectural choice here to pull everything through this self-similarity matrix and the you know just just looking at this matrix already makes you kind of know that this thing works alright 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 data set as well and yeah I'll see you next time bye bye
[ { "start": 0, "end": 7.68, "text": " Hi there! Check out these videos on the top. Each one kind of contains a repeating action." }, { "start": 7.68, "end": 12.92, "text": " So on the left you see someone doing jumping jacks in a fairly regular pattern. In the" }, { "start": 12.92, "end": 18.64, "text": " middle it gets a bit more difficult because what you see is a tennis ball bouncing and" }, { "start": 18.64, "end": 24.560000000000002, "text": " it bounces faster and faster and faster as time goes on. On the right you see that there" }, { "start": 24.56, "end": 31.279999999999998, "text": " is a short intro sequence before the repeating action, the person shoveling the cement, is" }, { "start": 31.279999999999998, "end": 38.72, "text": " displayed. So the goal here is to build an AI that can detect that a repeating action" }, { "start": 38.72, "end": 44.8, "text": " is happening and if it detects so that it can count how often this repeating action" }, { "start": 44.8, "end": 51.36, "text": " is happening. You can already see the difficulties here is not only the recognition itself but" }, { "start": 51.36, "end": 56.2, "text": " the fact that the repeating actions can be different and can be of different length and" }, { "start": 56.2, "end": 62.3, "text": " cannot always look the same and so on. So this paper uses these temporal self-similarity" }, { "start": 62.3, "end": 68.14, "text": " matrices that you see at the bottom here to achieve this and we're going to explore how" }, { "start": 68.14, "end": 74.7, "text": " that's happening. So the paper we'll look at is called Counting Out Time Class Agnostic" }, { "start": 74.7, "end": 84.08, "text": " Video Repetition Counting in the Wild by Debidada Dwebidi, Yusuf Aitar, Jonathan Thompson, Pierre" }, { "start": 84.08, "end": 92.32000000000001, "text": " Sermonet and Andrew Zizerman of Google Research and DeepMind. So as I already said this paper" }, { "start": 92.32000000000001, "end": 98.64, "text": " detects repeating actions and is able to count them and on a high level what they do is they" }, { "start": 98.64, "end": 104.82, "text": " encode the video using convolutional networks then they build these temporal self-similarity" }, { "start": 104.82, "end": 111.52, "text": " matrices between the frames in order to detect the repetitions and they decode that into" }, { "start": 111.52, "end": 118.56, "text": " the predictions using another neural network. This is all trained end to end and they also" }, { "start": 118.56, "end": 124.2, "text": " make a new data set for this task. So that's the high level. If you want to find out how" }, { "start": 124.2, "end": 130.28, "text": " exactly that's done I invite you to stick around because we'll go into the paper. If" }, { "start": 130.28, "end": 135.3, "text": " you like content like this don't forget to share it out, leave a like and tell me what" }, { "start": 135.3, "end": 141.66, "text": " you think of the paper in the comments. I do read the comments so yeah I'm very happy" }, { "start": 141.66, "end": 149.96, "text": " to read what you all think about it. Okay so as we already said they say we present" }, { "start": 149.96, "end": 155, "text": " an approach for estimating the period with which an action is repeated in a video and" }, { "start": 155, "end": 161.32, "text": " that's actually understating what the problem is here. The problem is many manyfold. As" }, { "start": 161.32, "end": 166.96, "text": " you can see on the right here even if you don't get what this self-similarity matrix" }, { "start": 166.96, "end": 174.64000000000001, "text": " is yet the outputs that you want are at the bottom. So what you want is first of all a" }, { "start": 174.64, "end": 181.39999999999998, "text": " per frame periodicity prediction. So that means that for each frame you want to know" }, { "start": 181.39999999999998, "end": 186.23999999999998, "text": " is there even a repeating action happening or not in that particular frame. You can see" }, { "start": 186.23999999999998, "end": 190.72, "text": " here at the beginning at the end of the video there is no repeating action and then in the" }, { "start": 190.72, "end": 195.44, "text": " middle there is a repeating action. So that's the first thing you want to know. The second" }, { "start": 195.44, "end": 202.72, "text": " thing is this per frame period length prediction. So for each frame that is part of a repeating" }, { "start": 202.72, "end": 208.52, "text": " action you want to know what is the period length of that repeating action and that can" }, { "start": 208.52, "end": 213.2, "text": " change throughout the video. So you need it per frame and once you have it per frame you" }, { "start": 213.2, "end": 221, "text": " can actually count the number of repetitions. So those are two problems already. The third" }, { "start": 221, "end": 227.32, "text": " problem that this paper solves is that there is no adequate data set to train a model like" }, { "start": 227.32, "end": 236, "text": " this it seems. For example this model right here this QUVA data set I believe has 100" }, { "start": 236, "end": 241.28, "text": " data points and these are meant for testing. So you would build your system somewhere and" }, { "start": 241.28, "end": 247.35999999999999, "text": " then you would test it on those 100 data points. But they claim not even those are large and" }, { "start": 247.35999999999999, "end": 254.26, "text": " diverse enough for these systems to be evaluated. So they build. We also collect a new challenging" }, { "start": 254.26, "end": 260.32, "text": " data set called Countix which is 90 times larger than existing data sets which captures" }, { "start": 260.32, "end": 265.36, "text": " the challenges of repetition counting in real world videos and that actually consists of" }, { "start": 265.36, "end": 273.64, "text": " a train and test split. So you can also train a system using it. Let's dive into the architecture." }, { "start": 273.64, "end": 280.68, "text": " I think this paper is a very very very cool example of even though we're in this deep" }, { "start": 280.68, "end": 286.28000000000003, "text": " learning paradigm where you just throw neural networks at a problem it's a very cool example" }, { "start": 286.28000000000003, "end": 294.16, "text": " that you can still achieve a lot by smartly constructing this because we used to achieve" }, { "start": 294.16, "end": 300.04, "text": " a lot by smartly constructing features and so on. In this case the goal is achieved by" }, { "start": 300.04, "end": 305.92, "text": " smartly constructing the architecture of the neural network itself to give you back a good" }, { "start": 305.92, "end": 313.44, "text": " performance on the particular task right here. Okay so if that tablet lets me actually scroll" }, { "start": 313.44, "end": 319.56, "text": " around let's go to the architecture. So figure two shows the architecture in more detail." }, { "start": 319.56, "end": 324.12, "text": " So we'll go through it from the beginning to the end. Actually let's go let's go to" }, { "start": 324.12, "end": 330.20000000000005, "text": " the end so you know what is supposed to happen. So for each frame in this video what we'll" }, { "start": 330.2, "end": 336.15999999999997, "text": " need is a period length and a periodicity. These are two so the bottom is a binary variable" }, { "start": 336.15999999999997, "end": 344.15999999999997, "text": " and the top is a it's actually a number but it is predicted in kind of binned as a classification" }, { "start": 344.15999999999997, "end": 349.15999999999997, "text": " task. It doesn't really matter we need two outputs that we can compare with the labels" }, { "start": 349.15999999999997, "end": 355.82, "text": " right. In this case the videos are of length 64 so there's 64 frames per video and for" }, { "start": 355.82, "end": 361.92, "text": " each of those frames we want a period length and for each of those frames we want a periodicity" }, { "start": 361.92, "end": 369.2, "text": " binary prediction. And that as I said we compare it with our labels and then we can calculate" }, { "start": 369.2, "end": 374.8, "text": " a loss. So this is the loss the loss is at the end comparing these two labels and then" }, { "start": 374.8, "end": 382.48, "text": " everything else is trained using back propagation on that loss. Okay so now with that in mind" }, { "start": 382.48, "end": 388.46000000000004, "text": " let's go to the beginning. So the video is taken and fed through an encoder in order" }, { "start": 388.46000000000004, "end": 394.6, "text": " to produce these per frame embeddings. So we want an embedding for each frame that means" }, { "start": 394.6, "end": 402.88, "text": " for each of the 64 frames we want to obtain one vector of length 512 that describes that" }, { "start": 402.88, "end": 407.94, "text": " particular frame in terms that the model can understand. And we do that using an encoder." }, { "start": 407.94, "end": 414.44, "text": " Now the encoder it has a bunch of parts to it. It's not just a blob as you see right" }, { "start": 414.44, "end": 421.64, "text": " here. So the encoder consists of three things. First of all there's this convolutional feature" }, { "start": 421.64, "end": 427.62, "text": " extractor which is a ResNet 50 architecture. It's simply a convolution and you let the" }, { "start": 427.62, "end": 433.88, "text": " convolutional neural network run on each frame independently. This is simply a feature extractor" }, { "start": 433.88, "end": 441.96, "text": " from images right like you know it from any other image processing task. But of course" }, { "start": 441.96, "end": 452.6, "text": " here we have a video. So it would be nice if the frames knew something about the other" }, { "start": 452.6, "end": 460.64, "text": " frames right. Especially if you think of something like a jumping jack. If you are in this position" }, { "start": 460.64, "end": 466.91999999999996, "text": " right here. It doesn't tell you everything about that video frame. If you consider the" }, { "start": 466.91999999999996, "end": 473, "text": " frame before it and maybe the frame before it is this and maybe the frame after it is" }, { "start": 473, "end": 482.91999999999996, "text": " that, you can clearly see that the hands or the arms are in an upward motion. So the next" }, { "start": 482.91999999999996, "end": 489.2, "text": " step of the encoder tries to integrate that temporal information into the embeddings and" }, { "start": 489.2, "end": 498.03999999999996, "text": " that is achieved via a 3D convolution. So once we process each frame individually then" }, { "start": 498.03999999999996, "end": 505.52, "text": " we feed it into one layer through a layer of 3D convolution to add local temporal information" }, { "start": 505.52, "end": 510.96, "text": " to the per frame features. So if you don't know what a 3D convolution is, this already" }, { "start": 510.96, "end": 517.68, "text": " drew. So in a 2D convolution what you want to do is you want to have this filter right" }, { "start": 517.68, "end": 524.3599999999999, "text": " here which is a 2D filter for each of the channels and you slide it across the image" }, { "start": 524.3599999999999, "end": 530.2399999999999, "text": " like this. And you can have multiple channels of the input image right here and you can" }, { "start": 530.2399999999999, "end": 535.4399999999999, "text": " actually do this multiple times which corresponds to multiple output channels of the filters" }, { "start": 535.4399999999999, "end": 540.8399999999999, "text": " but the actual convolution is happening in two dimensions. So the sliding is across the" }, { "start": 540.8399999999999, "end": 546.7199999999999, "text": " width and the height of the image. In contrast to that if you have a 3D convolution and you" }, { "start": 546.72, "end": 553, "text": " have the same input stack of images and now this we have to you have to pay attention" }, { "start": 553, "end": 560.36, "text": " here. This right this stack right here is the individual channels of one image so of" }, { "start": 560.36, "end": 568.6800000000001, "text": " one video frame. This stack right here that I'm drawing these are the video frames stacked." }, { "start": 568.6800000000001, "end": 573.32, "text": " Now each of these stacked video frames can have multiple channels resulting from its" }, { "start": 573.32, "end": 580.6400000000001, "text": " 2D convolution or even just RGB. So I can't really draw in four dimensions but now we" }, { "start": 580.6400000000001, "end": 588.96, "text": " stack the video frames and now our kernel our filter will be also in the direction of" }, { "start": 588.96, "end": 595.6800000000001, "text": " the video frame. So I don't know if this is really recognizable if I draw it like this" }, { "start": 595.6800000000001, "end": 602.5200000000001, "text": " but as you can see the kernel is not only 2D but 3D and now the sliding so if we have" }, { "start": 602.52, "end": 607.4, "text": " actually more than that the sliding is not only done into the direction of height and" }, { "start": 607.4, "end": 613.64, "text": " width but also into the direction of depth so that each of the frames each of the video" }, { "start": 613.64, "end": 619, "text": " frames right here can incorporate information from its immediate neighbors in case of a" }, { "start": 619, "end": 628.1999999999999, "text": " 3x3x3 filter or even more neighbors but here we use a 3x3x3 filter. Okay so that's that's" }, { "start": 628.2, "end": 632.5600000000001, "text": " how we obtain these embeddings right here and at the end there is a dimension reduction" }, { "start": 632.5600000000001, "end": 637.6400000000001, "text": " like a max pooling or something but ultimately what you'll end up with is for each of the" }, { "start": 637.6400000000001, "end": 644.96, "text": " 64 video frames you get one vector and that vector mainly describes that particular video" }, { "start": 644.96, "end": 651.5200000000001, "text": " frame like if you consider the green one here but also contains information from the video" }, { "start": 651.52, "end": 658.52, "text": " frame before it and from the video frame after it. Okay so that's sort of and and that's" }, { "start": 658.52, "end": 664, "text": " that's the so the temporal convolution is not to detect the periodic actions because" }, { "start": 664, "end": 668.8, "text": " it's just one frame into the future and into the past it is more like what we said here" }, { "start": 668.8, "end": 674.3, "text": " in order to give you extra information of what's happening in a particular frame because" }, { "start": 674.3, "end": 681, "text": " especially for periodicity it's actually important if the arms are going up or down. Cool so" }, { "start": 681, "end": 685.68, "text": " then comes the heart of the architecture. The heart of the architecture is this temporal" }, { "start": 685.68, "end": 692.88, "text": " self-similarity matrix. Now what does this do? This is relating the frames to each other" }, { "start": 692.88, "end": 699.96, "text": " and important to note here this is just a single channel image so there is no other" }, { "start": 699.96, "end": 708.32, "text": " ones of these. For the entire video frame sequence you have one 64x64 matrix and all" }, { "start": 708.32, "end": 714.8000000000001, "text": " the signal has to go through this matrix right everything from here is only through this" }, { "start": 714.8000000000001, "end": 720.2, "text": " matrix there's no residual connections there is no skip connections that's all that's" }, { "start": 720.2, "end": 725.72, "text": " your information bottleneck and by having a bottleneck like this these the authors here" }, { "start": 725.72, "end": 732.2, "text": " force the model to basically do a good job at making this temporal self-similarity happen" }, { "start": 732.2, "end": 738.3000000000001, "text": " if it wants to achieve a low loss and that's what I mean by you can achieve a lot by having" }, { "start": 738.3, "end": 744.24, "text": " a smart architecture. This temporal self-similarity matrix is actually not learned this can be" }, { "start": 744.24, "end": 750.88, "text": " computed deterministically from the embeddings right here so what you do is you each row" }, { "start": 750.88, "end": 757, "text": " here corresponds to one frame so you take each frame that corresponds to a row and you" }, { "start": 757, "end": 766.52, "text": " calculate simply the distance to or the similarity with each of the other frames so this is as" }, { "start": 766.52, "end": 773.68, "text": " you can see it's 64x64 so frame i here is simply compared to each of the other frames" }, { "start": 773.68, "end": 780.3199999999999, "text": " j and depending on whether that embedding is very similar to the embedding of frame" }, { "start": 780.3199999999999, "end": 787.92, "text": " j this number is going to be high or low. Now there's also a after that you do a softmax" }, { "start": 787.92, "end": 794.3199999999999, "text": " across here such that this is going to be like a distribution and not just raw numbers" }, { "start": 794.32, "end": 799.38, "text": " but that's ultimately not that important so what you can see is that the diagonal is very" }, { "start": 799.38, "end": 807.2800000000001, "text": " prominent and that makes sense because technically the diagonal is always one right if for example" }, { "start": 807.2800000000001, "end": 811.0600000000001, "text": " if you use the inner product as a similarity the diagonal should always be one but here" }, { "start": 811.0600000000001, "end": 816.12, "text": " we have the softmax so it's not but ultimately we can say that any frame should be very similar" }, { "start": 816.12, "end": 821.6800000000001, "text": " to its is going to be very similar to itself so that's why but then you can see right here" }, { "start": 821.68, "end": 827.8, "text": " there's a pattern emerging and that pattern is these diagonal lines in this direction" }, { "start": 827.8, "end": 834.26, "text": " as you can see and what what does that mean they actually have a larger version of this" }, { "start": 834.26, "end": 843.1999999999999, "text": " down here so what does the diagonal pattern mean it means that so here the diagonal that's" }, { "start": 843.2, "end": 851.9200000000001, "text": " okay frame i is very similar to frame i cool but the other lines what do they mean so if" }, { "start": 851.9200000000001, "end": 857.5600000000001, "text": " i look at frame i right here it is also very similar to this frame j now this wouldn't" }, { "start": 857.5600000000001, "end": 865.48, "text": " be further you know frames are similar but the line means that if i have if i look 10" }, { "start": 865.48, "end": 874.76, "text": " frames later i plus 10 that's very similar to j plus 10 and if i now look at i plus 20" }, { "start": 874.76, "end": 882.96, "text": " frame that's very similar to j plus 20 so this is the this is here why the the pattern" }, { "start": 882.96, "end": 888.16, "text": " is emerging of a line because if i go 10 frames into the future it's similar to the other" }, { "start": 888.16, "end": 895.32, "text": " one 10 frames into the future and so on and that means the line indicates that this entire" }, { "start": 895.32, "end": 902.88, "text": " sequence starting from i 20 frames into the future is repeated starting from j actually" }, { "start": 902.88, "end": 908.7600000000001, "text": " j is earlier here so but you get the point and if i have a bunch of these lines that" }, { "start": 908.7600000000001, "end": 914.5600000000001, "text": " means that this subsequence is repeated again and again and again throughout the video so" }, { "start": 914.5600000000001, "end": 920.96, "text": " each of these lines is basically one repetition of the sequence from the middle here at some" }, { "start": 920.96, "end": 929.9200000000001, "text": " other point in the video and that's pretty fascinating and that's these these self-similarity" }, { "start": 929.9200000000001, "end": 936.32, "text": " matrices that's what they're sort of showing now they don't use the inner product here" }, { "start": 936.32, "end": 941.76, "text": " as a self-similarity metric they actually use as you can see right here they use the" }, { "start": 941.76, "end": 947.08, "text": " negative square distance but the effect is the same so negative square distance followed" }, { "start": 947.08, "end": 955.1600000000001, "text": " by a row wise softmax operation so you could say hi we are basically done having this self-similarity" }, { "start": 955.1600000000001, "end": 959.2800000000001, "text": " matrix what we could do let's let's say we could train it we don't worry about how to" }, { "start": 959.2800000000001, "end": 966.6800000000001, "text": " train it we could simply take each row right here and we plot the intensities across that" }, { "start": 966.6800000000001, "end": 970.76, "text": " row and that's maybe you know like something like this and then there's the diagonal is" }, { "start": 970.76, "end": 978.36, "text": " a bit higher okay we could just use a heuristic to detect these bumps here basically calculate" }, { "start": 978.36, "end": 983.6, "text": " the length count the bumps and calculate the period length right that that should be pretty" }, { "start": 983.6, "end": 990.72, "text": " easy with like a simple heuristic but the authors here they want more they want to solve" }, { "start": 990.72, "end": 996.08, "text": " more problems so what are some of the problems we already saw some of the problems namely" }, { "start": 996.08, "end": 1002.2, "text": " for example here is the hammer throw so the hammer throw starts out slow and gets faster" }, { "start": 1002.2, "end": 1007.64, "text": " and faster and faster and you can see this pretty clearly at the lines right here namely" }, { "start": 1007.64, "end": 1014.48, "text": " if you go through time so you start off here and you go through time you can see that the" }, { "start": 1014.48, "end": 1021.6, "text": " distance to the next line here is fairly large but you go through time further the distance" }, { "start": 1021.6, "end": 1027, "text": " gets shorter you go through time further the distance gets even shorter so these pattern" }, { "start": 1027, "end": 1033.44, "text": " of lines here that's kind of converging towards that it indicates that this repeating action" }, { "start": 1033.44, "end": 1039.68, "text": " gets faster and faster and faster this is nice to see here at the bouncy ball example" }, { "start": 1039.68, "end": 1047.8, "text": " where you can see it starts out pretty slow but it gets faster and faster and here you" }, { "start": 1047.8, "end": 1052.9199999999998, "text": " if you if you have this full thing right here that basically means all the frames are self" }, { "start": 1052.9199999999998, "end": 1059.12, "text": " similar to each other which basically means if you stop the video right that's if you" }, { "start": 1059.12, "end": 1063.08, "text": " have 10 frames in a row the same thing the ball is just lying on the ground all of these" }, { "start": 1063.08, "end": 1069.72, "text": " frames will be self similar so there's probably no bouncing happening down here you can see" }, { "start": 1069.72, "end": 1075.68, "text": " pretty well from the pattern what happens and here in this mixing concrete example that" }, { "start": 1075.68, "end": 1081.1200000000001, "text": " we saw at the beginning you can see that at the beginning at the end there's this intro" }, { "start": 1081.1200000000001, "end": 1087.16, "text": " and outro sequence and only in the middle is there a repeating action and that's indicated" }, { "start": 1087.16, "end": 1095.0800000000002, "text": " by this line pattern is only at in the middle of the videos only between here and here so" }, { "start": 1095.0800000000002, "end": 1101.42, "text": " it's it's going to be pretty difficult to just have a heuristic that reads out these" }, { "start": 1101.42, "end": 1107.52, "text": " periodic action periodicity and in a true deep learning fashion the the authors here" }, { "start": 1107.52, "end": 1113.96, "text": " oh sorry maybe you can't see that i've shifted my recording window so maybe sometimes something's" }, { "start": 1113.96, "end": 1119.96, "text": " out of frame and you have to yell at me if i do that please so i hope you you saw this" }, { "start": 1119.96, "end": 1126.3600000000001, "text": " that you have the ever the speeding up here and here they're visible in the pattern and" }, { "start": 1126.36, "end": 1131.4799999999998, "text": " then here you have the beginning sequence the end sequence that have no repeating pattern" }, { "start": 1131.4799999999998, "end": 1137.4399999999998, "text": " and the repeating pattern only merged in the middle so the authors want to do this through" }, { "start": 1137.4399999999998, "end": 1143.28, "text": " of course a deep learning network they want to read out the periodicities not through" }, { "start": 1143.28, "end": 1148.9599999999998, "text": " a heuristic but using a deep network you know respectable that's at the times we live in" }, { "start": 1148.96, "end": 1156.8400000000001, "text": " so what do they do first of all you have to see right here everything that happens from" }, { "start": 1156.8400000000001, "end": 1164.68, "text": " here as i understand it is per frame so they simply take a row of this matrix right here" }, { "start": 1164.68, "end": 1173.28, "text": " like this red line and that is independently pulled through to the end so there is no interaction" }, { "start": 1173.28, "end": 1179.48, "text": " happening anymore between the individual frame data the only interaction that happens is" }, { "start": 1179.48, "end": 1184.8799999999999, "text": " a little bit here at the temporal convolutions but the only real interaction between the" }, { "start": 1184.8799999999999, "end": 1190.76, "text": " frames is happening through the self-similarity matrix and again this is the information bottleneck" }, { "start": 1190.76, "end": 1198.1399999999999, "text": " that the authors force the information through everything happening from here no that's actually" }, { "start": 1198.14, "end": 1203.3200000000002, "text": " not right there is this convolution right here but still this is the information bottleneck" }, { "start": 1203.3200000000002, "end": 1210.5600000000002, "text": " you have to go through so right here we process this image using a convolution so this is" }, { "start": 1210.5600000000002, "end": 1219.64, "text": " an image right and we can process it using a convolutional neural network so what we" }, { "start": 1219.64, "end": 1226.3200000000002, "text": " do is we have a 64 by 64 image in one channel we simply up sample that not up sample but" }, { "start": 1226.32, "end": 1232.2, "text": " we expand the channels to 32 channels now as i said it's pretty easy to think we can" }, { "start": 1232.2, "end": 1240.2, "text": " just go to the end here use a conv net to produce our final 512 by so 512 embeddings" }, { "start": 1240.2, "end": 1248.6, "text": " we have here again 64 by 64 that we then use to predict the final result but the authors" }, { "start": 1248.6, "end": 1255.8799999999999, "text": " here do something different they do transformer layers in the middle but only per frame so" }, { "start": 1255.88, "end": 1267.5600000000002, "text": " what does it mean so here you up sample to 32 channels and then that means that one of" }, { "start": 1267.5600000000002, "end": 1274.2800000000002, "text": " these blocks right here one of these blocks corresponds to one row in the self-similarity" }, { "start": 1274.2800000000002, "end": 1280.3600000000001, "text": " matrix which corresponds to one frame and from now on so from now on i want to say what" }, { "start": 1280.36, "end": 1288.6, "text": " i said before from now on it's all just this one block they are independent of each other" }, { "start": 1288.6, "end": 1295.6399999999999, "text": " okay so you take this one block and you feed it through a transformer to achieve at your" }, { "start": 1295.6399999999999, "end": 1307.08, "text": " final embedding of 512 and it's probably best if we read what they say about it okay so" }, { "start": 1307.08, "end": 1314.8799999999999, "text": " if we're given this self-similarity matrices matrix they consist of row each row is the" }, { "start": 1314.8799999999999, "end": 1320.4399999999998, "text": " per frame self-similarity representation and generates two outputs the per frame period" }, { "start": 1320.4399999999998, "end": 1325.98, "text": " length estimation and the per frame binary periodicity classification note that both" }, { "start": 1325.98, "end": 1334.9199999999998, "text": " l and p are vectors and their elements are per frame predictions okay the architecture" }, { "start": 1334.92, "end": 1339.2, "text": " of the period predictor module can be viewed in figure two note that the predictors share" }, { "start": 1339.2, "end": 1345.76, "text": " a common architecture and waits until the last classification phase the shared processing" }, { "start": 1345.76, "end": 1354.3600000000001, "text": " pipeline starts with starts with 32 2d convolutional filters of size three by three followed by" }, { "start": 1354.3600000000001, "end": 1360, "text": " a transformer layer which uses a multi-headed attention with trainable positional embeddings" }, { "start": 1360, "end": 1367.44, "text": " in the form of a 64 length variable that is learned by training okay it's i guess the" }, { "start": 1367.44, "end": 1373.18, "text": " transformers learned by training and the positional embeddings are also learned by training that's" }, { "start": 1373.18, "end": 1379.66, "text": " fairly common we use four heads with 512 dimension in the transformer by the way if you don't" }, { "start": 1379.66, "end": 1384.66, "text": " know what a transformer is watch the video on attention is all you need i made one it's" }, { "start": 1384.66, "end": 1392.8400000000001, "text": " very popular yeah so with each head being 128 dimensions in size after the shared pipeline" }, { "start": 1392.8400000000001, "end": 1400, "text": " we have two classifiers period length classifier and periodicity classifier tau sorry this" }, { "start": 1400, "end": 1404.8400000000001, "text": " is fine this is tau each of them consists of two fully connected layers of size 512" }, { "start": 1404.8400000000001, "end": 1410.88, "text": " so i guess the the the pipeline here is pretty simple the question could be why do they use" }, { "start": 1410.88, "end": 1418.4, "text": " a transformer and not simply another convolutional network so here they up sample the image as" }, { "start": 1418.4, "end": 1426.22, "text": " we saw into 32 channels and then they simply want to take one of these one of these blocks" }, { "start": 1426.22, "end": 1433.2600000000002, "text": " here and that corresponds a little bit so we have for one frame right what does it mean" }, { "start": 1433.26, "end": 1445.64, "text": " we have basically we have 64 by 32 things so the 64 things it's this one frames temporal" }, { "start": 1445.64, "end": 1451.16, "text": " connection to each other frame given that you know comes from this self-similarity matrix" }, { "start": 1451.16, "end": 1457.36, "text": " so it kind of relates this frame that we're considering to each of the other frames and" }, { "start": 1457.36, "end": 1464.28, "text": " each of this each of these entries is a 32 size vector this is sort of a this is you" }, { "start": 1464.28, "end": 1472.3999999999999, "text": " can consider like a sequence of 64 things 64 embeddings so to use a transformer here" }, { "start": 1472.3999999999999, "end": 1479.6799999999998, "text": " it's pretty natural if you think of this as like a sequence transformation task i i would" }, { "start": 1479.68, "end": 1488.5600000000002, "text": " guess so the transformer can if there are these peaks right here like we saw right here" }, { "start": 1488.5600000000002, "end": 1494.48, "text": " the transformer can make very good sense of that because of course the attention mechanism" }, { "start": 1494.48, "end": 1502.76, "text": " from a one peak it can attend to all the other peaks and can sort of relate the different" }, { "start": 1502.76, "end": 1507.72, "text": " peaks to each other and then determine the periodicity length whereas with a convolutional" }, { "start": 1507.72, "end": 1514.76, "text": " network i guess that's going to be a lot harder because of the sort of invariance built into" }, { "start": 1514.76, "end": 1520.08, "text": " the convolution i'm not sure maybe they also it just worked better but that's how i think" }, { "start": 1520.08, "end": 1527.24, "text": " about it it's that for a given frame you basically have a sequence classification or a set classification" }, { "start": 1527.24, "end": 1534.88, "text": " task and the attention mechanism allows you to in one single step connect each peak with" }, { "start": 1534.88, "end": 1541.96, "text": " each other peak or each information with each other information in this sequence all right" }, { "start": 1541.96, "end": 1547.6000000000001, "text": " so at the end you have just fully connected layers again only on a per frame basis and" }, { "start": 1547.6000000000001, "end": 1553.3600000000001, "text": " that will give you the output and again you compare this to the label and you back prop" }, { "start": 1553.3600000000001, "end": 1559.72, "text": " through everything everything here is differentiable so all of this is trained to achieve minimum" }, { "start": 1559.72, "end": 1565.88, "text": " possible loss and because you train everything to achieve minimal possible loss you make" }, { "start": 1565.88, "end": 1571.08, "text": " this encoder right here which is the crucial part because the encoder is must give you" }, { "start": 1571.08, "end": 1576.76, "text": " good embeddings which must give you a sensible self-similarity matrix right you train the" }, { "start": 1576.76, "end": 1583.84, "text": " encoder to encode things that are relevant for the task and that's what makes the whole" }, { "start": 1583.84, "end": 1594.9199999999998, "text": " thing work okay so we've gone through the architecture now the problem right here is" }, { "start": 1594.9199999999998, "end": 1603.9199999999998, "text": " the the data set so they also go into how they do inference they can actually do a bunch" }, { "start": 1603.9199999999998, "end": 1608.9399999999998, "text": " of things like play the video at different speeds and then look at what each of the predictions" }, { "start": 1608.94, "end": 1614, "text": " so if a double speed it predicts half the period length then you can be more sure and" }, { "start": 1614, "end": 1621.8400000000001, "text": " so on so that's pretty cool but they go into another point right here and that's the data" }, { "start": 1621.8400000000001, "end": 1629.04, "text": " set so they produce this countix data set but also on the other hand which is something" }, { "start": 1629.04, "end": 1636.8200000000002, "text": " I also find very cool is they produce a synthetic data set so here they say we train with synthetic" }, { "start": 1636.82, "end": 1645.3999999999999, "text": " repetitions and that can be sort of I didn't know what to think of it at first I was just" }, { "start": 1645.3999999999999, "end": 1651.8799999999999, "text": " like huh but then it's pretty cool so if you have a video with these these are the frames" }, { "start": 1651.8799999999999, "end": 1657.84, "text": " of the video right so the video goes in this temporal direction what you can do is simply" }, { "start": 1657.84, "end": 1664.8, "text": " go here go through these frames and just repeat these frames and repeat them and repeat them" }, { "start": 1664.8, "end": 1669.94, "text": " and at the end you have these frames right and then you have a data set and if you if" }, { "start": 1669.94, "end": 1676.1599999999999, "text": " you assume that most videos do not naturally contain repeating actions right most videos" }, { "start": 1676.1599999999999, "end": 1682.32, "text": " are just videos they're not videos of something repeating then you can safely assume that" }, { "start": 1682.32, "end": 1687.52, "text": " these parts here are non repeating so and these parts here are repeating this is one" }, { "start": 1687.52, "end": 1692, "text": " of the labels that you need right the problem with synthetic data set is always to have" }, { "start": 1692, "end": 1699.72, "text": " the labels and also you know how many there are because you can simply count the number" }, { "start": 1699.72, "end": 1705.8, "text": " of times that you go through it you can even make it faster slower and so on so this synthetic" }, { "start": 1705.8, "end": 1710.3, "text": " approach is pretty cool and especially the bottom right here because this might be kind" }, { "start": 1710.3, "end": 1715.7, "text": " of hacky because each time each time you jump from the end of one of those arrows to the" }, { "start": 1715.7, "end": 1722.1200000000001, "text": " beginning right you have kind of a hack in the indie video because you know it's not" }, { "start": 1722.1200000000001, "end": 1727.8600000000001, "text": " continuous so what you can do and this is the the bottom here you can do this reversal" }, { "start": 1727.8600000000001, "end": 1732.54, "text": " technique where you go to the end and then you play the frames backwards and then you" }, { "start": 1732.54, "end": 1737.88, "text": " play the frames forwards again backwards again forwards again and then you go out here and" }, { "start": 1737.88, "end": 1743.48, "text": " that gives you one continuous motion right if someone if it's simply a video of someone" }, { "start": 1743.48, "end": 1748.88, "text": " lifting their hand like it starts out down here and it goes here and it goes here and" }, { "start": 1748.88, "end": 1755.56, "text": " then if you do this technique it would go down again down again up again up again and" }, { "start": 1755.56, "end": 1763.96, "text": " so on so that's you know i think it's a fairly smart technique honestly now they tried this" }, { "start": 1763.96, "end": 1771.16, "text": " and it doesn't work super well so what they also have to do is they have to do manual" }, { "start": 1771.16, "end": 1777.4, "text": " camera motion augmentation so that's so camera motion augmentation it basically means that" }, { "start": 1777.4, "end": 1782.72, "text": " if you just do a repeating action like this it's sort of i guess it's too monotonic it" }, { "start": 1782.72, "end": 1791.64, "text": " doesn't really cover real videos with repeating actions so what they do is they kind of simulate" }, { "start": 1791.64, "end": 1798.0800000000002, "text": " a moving camera and you simulate that much like you would do image augmentation so you" }, { "start": 1798.08, "end": 1804.52, "text": " can rotate the camera over time you can translate it you can scale it differently and through" }, { "start": 1804.52, "end": 1809.04, "text": " if you do that throughout the video and you change it around how the camera moves then" }, { "start": 1809.04, "end": 1819.24, "text": " that appears to work fairly well so if they now compare this and their data set they perform" }, { "start": 1819.24, "end": 1824.72, "text": " pretty well so in their data set they take this kinetics data set and they crowdsource" }, { "start": 1824.72, "end": 1831.16, "text": " the label and the tasks in the data set they're pretty diverse as you can see right here so" }, { "start": 1831.16, "end": 1836.84, "text": " you have sports like rope training mountain climbers but you have also things like playing" }, { "start": 1836.84, "end": 1843.7, "text": " ukulele exercising arms slicing an onion and so on and you can see that the repetition" }, { "start": 1843.7, "end": 1849.04, "text": " count is fairly diverse as well so from one or two repetitions per video it goes to 50" }, { "start": 1849.04, "end": 1856.2, "text": " or so and the period length is also between one and five seconds though as you as i already" }, { "start": 1856.2, "end": 1862, "text": " said you don't have to you don't have to count on that because you can always play the video" }, { "start": 1862, "end": 1870.12, "text": " slower or faster and then determine other periodicities so in their experiment first" }, { "start": 1870.12, "end": 1878.24, "text": " of all they perform pretty well and they show that if they train on their data set and on" }, { "start": 1878.24, "end": 1884.84, "text": " the synthetic data set they perform better than if they just train on the synthetic or" }, { "start": 1884.84, "end": 1890.96, "text": " they just train on their data set they also show pretty clearly that the addition of this" }, { "start": 1890.96, "end": 1896.6, "text": " temporal self-similarity matrix helps tremendously you can see right here in each of these boxes" }, { "start": 1896.6, "end": 1903.6, "text": " is the comparison and this obi I think is the off by one error so it kind of forgives" }, { "start": 1903.6, "end": 1909.24, "text": " you if you're off by one count but otherwise you get a zero if you're wrong and you can" }, { "start": 1909.24, "end": 1914.84, "text": " see that the self-similarity matrix helps tremendously they also compare with some other" }, { "start": 1914.84, "end": 1920.4399999999998, "text": " architectural choices instead of the transformer I guess yeah so I guess they just take it" }, { "start": 1920.4399999999998, "end": 1929.6399999999999, "text": " because it performs pretty well and they do a lot of lot of ablations but what I particularly" }, { "start": 1929.64, "end": 1935.76, "text": " appreciate is that they do something like this so what they do at the end went once" }, { "start": 1935.76, "end": 1941.26, "text": " they've trained the architectures they do a 1d PCA protection of the encoder features" }, { "start": 1941.26, "end": 1948.76, "text": " over time now the encoder features they were 512 dimensional right this is the thing before" }, { "start": 1948.76, "end": 1955.5200000000002, "text": " it goes into the self-similarity matrix so those we said the encoder is the crucial part" }, { "start": 1955.52, "end": 1962.36, "text": " here because it needs to take the video and encode things that make them accessible to" }, { "start": 1962.36, "end": 1969.56, "text": " calculating the self-similarity now they do a 1d PCA so a projection into one dimension" }, { "start": 1969.56, "end": 1977.4, "text": " of these features and you can already see at this one dimensional projection that the" }, { "start": 1977.4, "end": 1985.5600000000002, "text": " periodicity here is clearly clearly visible namely for example right here every time up" }, { "start": 1985.5600000000002, "end": 1991.0400000000002, "text": " here is when the legs are up and every time down here is when the legs are down right" }, { "start": 1991.0400000000002, "end": 1999.0600000000002, "text": " here so that is very very impressive and that kind of that really shows that the model is" }, { "start": 1999.0600000000002, "end": 2004.48, "text": " doing what you claim what you claim that it's doing like I'm almost more interested in experiments" }, { "start": 2004.48, "end": 2009.16, "text": " like this than in and in these numbers right here because the numbers could always be because" }, { "start": 2009.16, "end": 2018.92, "text": " you've just thrown more stuff at it right so they go over a bunch of possible applications" }, { "start": 2018.92, "end": 2026.52, "text": " of their model so first of all you can do something like as we can see repetition counting" }, { "start": 2026.52, "end": 2032.14, "text": " from videos you can do periodicity detection those were the things that the model is trained" }, { "start": 2032.14, "end": 2037.8400000000001, "text": " to do but there's also a bunch of things that the model can now implicitly do namely something" }, { "start": 2037.8400000000001, "end": 2042.8400000000001, "text": " like change inspection where they say look if someone's chopping this pineapple right" }, { "start": 2042.8400000000001, "end": 2048.7400000000002, "text": " here then at the end of each of the repetitions there is something that changed namely the" }, { "start": 2048.7400000000002, "end": 2055.48, "text": " number of slices of pineapple is it bread is it I can't I think it's pineapple okay" }, { "start": 2055.48, "end": 2063.08, "text": " so the number of slices or pieces right here changes so in essence this could be the base" }, { "start": 2063.08, "end": 2070.44, "text": " for another model estimating whatever changed or training to recognize numbers of pieces" }, { "start": 2070.44, "end": 2078.36, "text": " and so on also you can detect the speed so the speed of a repeating action if you perform" }, { "start": 2078.36, "end": 2087, "text": " something slow or fast this model can implicitly do it and this they call cross-period retrieval" }, { "start": 2087, "end": 2094.84, "text": " so if you know when the repetitions are you know that okay maybe the first frame so always" }, { "start": 2094.84, "end": 2100.6400000000003, "text": " on the upswing right here these should all these should all be fairly similar visually" }, { "start": 2100.64, "end": 2109.3599999999997, "text": " right as with respect to the repeating action so you can see that even though this whenever" }, { "start": 2109.3599999999997, "end": 2115.08, "text": " the kid in the swing here is close it looks fairly different in in a purely visual sense" }, { "start": 2115.08, "end": 2121.3599999999997, "text": " in a pixel sense but it is at the same point in the repeating action and that's you know" }, { "start": 2121.3599999999997, "end": 2127.04, "text": " that's that's pretty cool so you can technically retrieve related things even though they visually" }, { "start": 2127.04, "end": 2134.88, "text": " they don't look similar that much yeah that that's the the kind of applications here are" }, { "start": 2134.88, "end": 2141.32, "text": " probably many many fold and I also think that so in this measure of intelligence paper by" }, { "start": 2141.32, "end": 2147.4, "text": " françois choulet he basically claims that this is one of the innate abilities of humans" }, { "start": 2147.4, "end": 2152.92, "text": " they can count you know they can count things this is something you're basically born with" }, { "start": 2152.92, "end": 2161.08, "text": " and maybe this thing right here will become sort of a staple staple component for many" }, { "start": 2161.08, "end": 2167.44, "text": " other things that we build AI on I would not be surprised but maybe it will just fade into" }, { "start": 2167.44, "end": 2173.4, "text": " history I think it's pretty cool project especially you know the the architectural choice here" }, { "start": 2173.4, "end": 2180.04, "text": " to pull everything through this self-similarity matrix and the you know just just looking" }, { "start": 2180.04, "end": 2187.44, "text": " at this matrix already makes you kind of know that this thing works alright this was it" }, { "start": 2187.44, "end": 2192.48, "text": " from me let me know in the comments what you think about the paper check out the website" }, { "start": 2192.48, "end": 2198.08, "text": " the website has a lot of video demo examples of what they're doing I think the data set" }, { "start": 2198.08, "end": 2210.56, "text": " as well and yeah I'll see you next time bye bye" } ]
n1SXlK5rhR8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Drama] Yann LeCun against Twitter on Dataset Bias
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ylc", "yann", "lecun", "convnet", "face", "pulse", "github", "colab", "jeff dean", "hardmaru", "charles sutton", "soumith", "meredith", "timnit", "bias", "noise", "dataset", "systems", "twitter", "mob" ]
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 Bomzy 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, it 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 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 Lacaan weighs in and says, ML systems are biased when data is biased. This face up sampling system makes everyone look white because the network was pre trained on flick face HQ, which mainly contains white people picks train the exact same system on a data set from Senegal, and everyone will look African. So this is pointing out why this happens namely because the data set is mainly Caucasian people. So the results of up sampling are going to be mainly Caucasian people. And this is like a straightforward explanation of why we're seeing what we're seeing. But of course, this was not okay. And here is where the piling starts. As an interjection, we have to talk about bias in machine learning. Technically, there's a statistical notion of bias, which has a very rigorous definition. And there is the societal definition of bias. And these two things, even though they're the same word, they're totally different. A machine learning system mainly consists of four different parts. There is a data set, the model, the loss function, and the optimization procedure. Statistical bias means whenever the model, the loss or the optimization procedure lead to a situation where the outcome doesn't reflect the distribution of the data that you input. This, for example, is achieved when you regularize your model, which means that you put some prior knowledge onto the model, you introduce bias, and therefore you choose to not accurately represent your data distribution, regularize it to a more biased distribution that in turn has lower variance. We know this as the bias variance trade off. It's actually very simple, right? You have the Ferraris and the Lamborghinis, and you want to make a model that predicts the accident probability. Now it just so happens that the Ferrari drivers are a bit more reckless, and they do slightly higher accidents. And now I train my logistic regression, and it tells me, okay, 60-40. Cool. But now I train my logistic regression with an L1 penalty, and I say, I want my model to be, you know, explainable. So I want it to be sparse. I want the least amount of variables to be contributing to it. What's the model going to say? The model is going to say, Ferrari drivers 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 Jan LeCun 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'd have to argue something like logistic regression itself has a preference for white people or something like this. Now there is a considerable interaction effect between the two, but as Jan LeCun points out, the actual societal bias of the final system is a direct result of the bias in the data set. And he is very correct. If you train that system on a different data set, it will exhibit different biases. Societal bias cannot be in the other parts of the machine learning pipeline. They can serve to exaggerate or mitigate that bias in the data set, but they themselves can only be statistically biased and not societally biased. But Jan LeCun make 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 he simply suggests a solution. Jonathan Peck says, well, yes, that's the point. ML researchers need to be more careful selecting their data so that they don't encode biases like this. And LeCun responds with not so much ML researchers, but ML engineers. The consequences of bias are considerably more dire in a deployed product than in an academic paper, which is also correct. This paper was about the method showing that this method works on this data set. Now, Sumit here makes 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 BERT or ResNet or YOLO from the internet, probably ignoring the license, read me and so on, which is a valid point, right? There are going to be people that take this and think, oh, this is a face up sampler. Cool. I can use that without noting that this is simply an example 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 Jan LeCun 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. Jan LeCun never says it doesn't, right? LeCun responds now saying, the most efficient way to do it though is to equalize the frequencies of the categories of samples during training. This forces the network to pay attention to all the relevant features for all the sample categories. And training with an 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 CycleGAN? And LeCun says, because people should be aware of this problem and know its cause so they can fix it. How terrible Jan, how terrible you dare pinpoint the exact cause of the problem so that people can fix it. The correct thing to do is to point out that everything is problematic. So Tim the Gibber says, Jan, I suggest you watch me and Emily's tutorial or a number of scholars who are experts in this area. You can't just reduce harms to data set bias. For once, listen to us people from marginalized communities and what we tell you. If not now during worldwide protests, not sure when. So again, I feel the argument here is that you can't simply point out that it's the data set bias. You must point out the bigger problems which Jan LeCun does not ever deny. He simply says this particular problem can be solved by switching the data set. Nicole Olleroux says, Jan 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 causes of the biases are numerous only pointing out data set bias deflects the attention away from the other more pervasive ones that make the whole field of bias in ML. Many people try to get your attention about these issues, but you kept focus on the data set because the data set is the problem right here. He doesn't dismiss any of the other things. He simply says here the data set is the problem if your problem is that it doesn't work as well for non-concassian people. Which was never the intent of this. The intent of this was to showcase the method. I mean ImageNet is like 60% dog species and still people train on it to showcase their image recognition techniques. No one training on ImageNet makes a claim that they have solved computer vision for all the classes in the world in a fair manner. Timnigibru goes on saying I'm sick of this framing, tired of it. Many people have tried to explain. Many scholars listen to us. You can't just reduce the harms caused by ML to data set bias. Doesn't do that. Doesn't do it. So someone asks her is he engaging in any ways with you? It's appalling to see that he answers to everybody but you. Yet maybe there is a conversation going on in private and I don't want to jeopardize it. Note that Yan LeCun's tweet has 500 retweets, 1.9k likes and comments as far as you can scroll. To what she responds to with yep but I'm used to white men refusing to engage with black and brown women even on issues of bias that mostly affect us. I mean he literally has ignored a whole body of work by people from that demographic hence the statement so not surprised. I mean in absence of the fact that an argument should be independent of the person making the argument that is a low blow. Hardmaru says I respectfully disagree with Yan here as long as progress is benchmarked on biased data such biases will also be reflected in the inductive biases of ML systems. Advancing ML with biased benchmarks and asking engineers to simply retrain models with unbiased data is not helpful. I don't disagree with you here. I don't think my tweet contradicts your statement which it doesn't. People are reading into this because he doesn't conform to the orthodoxy of pointing out that everything and everything is problematic and simply pinpoints a particular problem. He must be thinking all the wrong things. Jeff Dean says this is a clear example here is an illustration that seemingly minor choices in learning algorithms or loss can have significant effects so bias in ML systems is about much more than just avoid data bias. ML researchers and practitioners must pay attention to these issues and I think they are and Lacan doesn't say anything against that. He says as I point out in my comment to this tweet is much more efficient to correct this kind of bias. Note that Yan Lacan actually differentiates between the different kinds of biases by equalizing the frequencies of categories of samples during training than be hacking the loss function. Correct because if you hack the loss function you're trying to counter one kind of bias by another kind of bias. Meredith Whitaker says this is very racist and even if it recognized non-white people it would be very racist. This is cop tech. It's designed to allow those with power to surveil and control those with less power. Diverse training sets aren't going to fix it advocating that we should never build these systems and that's a discussion to be had but let me break this to you. This isn't going to help the cops. This isn't actually giving you the face of the person that was down pixeled. This is simply going to give you the most likely face associated with that down pixeled 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 sampled image it will give you back the most likely person given the data set. So with that I want to conclude this section. Please stop the witch hunting. Yann LeCun made a completely fine tweet here and there's no reason why people should pile on him this hard. He doesn't dismiss any of the other problems just because he doesn't mention them and while we all enjoy a good discussion where people disagree genuinely it's not helpful to accuse him of things he never said or meant. I mean where does this all lead? The result of this is going to be that small labs that don't have the resources to collect their own data sets or check for all the possible biases in their models that are reliant on the data sets that we do have even if they are biased and flawed will just be disincentivized from publishing their code or actually doing research at all. So this as every other additional constraint on research is going to help the large corporations with lots of money. And maybe that's just my opinion but we should be able to just talk about a problem and the solution to it without always having to make sure that we rabble down all the different things that are and might be wrong according to the canon. And big props to Yann LeCun here for holding his own. 90% of people by now would probably be like oh yes I'm so sorry I did a not thoughtful comment blah blah blah. Props to you Yann, keep going. And with that I conclude this section. Let me know what you think in the comments and I'll see you next time. Bye bye.
[ { "start": 0, "end": 6.32, "text": " Hi there! So you may have seen this already. There's a CVPR paper called Pulse. And what it" }, { "start": 6.32, "end": 12.88, "text": " does is it's a method to up sample a pixelated image in a way that makes it look realistic," }, { "start": 12.88, "end": 20.400000000000002, "text": " but also that the again down sampled variant matches the original down sampled image. So it's" }, { "start": 20.400000000000002, "end": 27.44, "text": " kind of a cycle consistency loss together with a GAN. And all in all, it's a method to demonstrate" }, { "start": 27.44, "end": 33.2, "text": " how you could do this. Now this has been trained on this face data set, among others. There was a" }, { "start": 33.2, "end": 41.760000000000005, "text": " user Bomzy that made this into a colab so people could try it out and tweeted this out. And as you" }, { "start": 41.760000000000005, "end": 48.24, "text": " can see, it works pretty nicely, it gives pretty nice results on this particular data set. But of" }, { "start": 48.24, "end": 56.56, "text": " course, people started playing around with it and gave fairly funny results like this, or that. That" }, { "start": 56.56, "end": 64.72, "text": " gets more into the horrible category. These. So you can see these ones I particularly like Trump" }, { "start": 65.44, "end": 72.88, "text": " being made into the little child. So you can see as soon as you get away from the original kind of" }, { "start": 72.88, "end": 80.72, "text": " data set modality, you are going to get these results that are off. And people started to notice" }, { "start": 80.72, "end": 87.92, "text": " that so here you input Barack Obama, and what comes out is a fairly standard Caucasian person," }, { "start": 87.92, "end": 94.08, "text": " someone tweeted out saying this image speaks volumes about the dangers of bias in AI, I guess" }, { "start": 94.08, "end": 101.84, "text": " here is where the entire story starts. So young Lacaan weighs in and says, ML systems are biased" }, { "start": 101.84, "end": 107.84, "text": " when data is biased. This face up sampling system makes everyone look white because the network was" }, { "start": 107.84, "end": 114.72, "text": " pre trained on flick face HQ, which mainly contains white people picks train the exact same system on" }, { "start": 114.72, "end": 120.72, "text": " a data set from Senegal, and everyone will look African. So this is pointing out why this happens" }, { "start": 120.72, "end": 126.16, "text": " namely because the data set is mainly Caucasian people. So the results of up sampling are going" }, { "start": 126.16, "end": 132.48000000000002, "text": " to be mainly Caucasian people. And this is like a straightforward explanation of why we're seeing" }, { "start": 132.48, "end": 139.28, "text": " what we're seeing. But of course, this was not okay. And here is where the piling starts. As an" }, { "start": 139.28, "end": 144.16, "text": " interjection, we have to talk about bias in machine learning. Technically, there's a statistical notion" }, { "start": 144.16, "end": 150.48, "text": " of bias, which has a very rigorous definition. And there is the societal definition of bias. And these" }, { "start": 150.48, "end": 154.79999999999998, "text": " two things, even though they're the same word, they're totally different. A machine learning" }, { "start": 154.79999999999998, "end": 160.48, "text": " system mainly consists of four different parts. There is a data set, the model, the loss function," }, { "start": 160.48, "end": 168.07999999999998, "text": " and the optimization procedure. Statistical bias means whenever the model, the loss or the optimization" }, { "start": 168.07999999999998, "end": 174.56, "text": " procedure lead to a situation where the outcome doesn't reflect the distribution of the data that" }, { "start": 174.56, "end": 180.07999999999998, "text": " you input. This, for example, is achieved when you regularize your model, which means that you put" }, { "start": 180.07999999999998, "end": 185.76, "text": " some prior knowledge onto the model, you introduce bias, and therefore you choose to not accurately" }, { "start": 185.76, "end": 192.32, "text": " represent your data distribution, regularize it to a more biased distribution that in turn has lower" }, { "start": 192.32, "end": 197.35999999999999, "text": " variance. We know this as the bias variance trade off. It's actually very simple, right? You have" }, { "start": 197.35999999999999, "end": 202.39999999999998, "text": " the Ferraris and the Lamborghinis, and you want to make a model that predicts the accident probability." }, { "start": 202.39999999999998, "end": 208.23999999999998, "text": " Now it just so happens that the Ferrari drivers are a bit more reckless, and they do slightly higher" }, { "start": 208.23999999999998, "end": 214.48, "text": " accidents. And now I train my logistic regression, and it tells me, okay, 60-40. Cool. But now I train" }, { "start": 214.48, "end": 219.6, "text": " my logistic regression with an L1 penalty, and I say, I want my model to be, you know, explainable." }, { "start": 219.6, "end": 224.32, "text": " So I want it to be sparse. I want the least amount of variables to be contributing to it. What's the" }, { "start": 224.32, "end": 228.95999999999998, "text": " model going to say? The model is going to say, Ferrari drivers add Lamborghini drivers good." }, { "start": 228.95999999999998, "end": 234.64, "text": " Societal bias in machine learning is way different. An example for this is when face detection systems" }, { "start": 234.64, "end": 240.39999999999998, "text": " work well on Caucasian people, but don't work so well faced with people from other heritages." }, { "start": 240.4, "end": 246.8, "text": " And these societal biases are in the data set. As Jan LeCun points out here, if you change the data" }, { "start": 246.8, "end": 252.96, "text": " set, you'll change these biases. Notably, these societal biases can only be in the data set." }, { "start": 252.96, "end": 257.76, "text": " Otherwise, you'd have to argue something like logistic regression itself has a preference for" }, { "start": 257.76, "end": 262.72, "text": " white people or something like this. Now there is a considerable interaction effect between the two," }, { "start": 262.72, "end": 270.32, "text": " but as Jan LeCun points out, the actual societal bias of the final system is a direct result of" }, { "start": 270.32, "end": 275.84, "text": " the bias in the data set. And he is very correct. If you train that system on a different data set," }, { "start": 275.84, "end": 281.59999999999997, "text": " it will exhibit different biases. Societal bias cannot be in the other parts of the machine" }, { "start": 281.59999999999997, "end": 288.24, "text": " learning pipeline. They can serve to exaggerate or mitigate that bias in the data set, but they" }, { "start": 288.24, "end": 293.36, "text": " themselves can only be statistically biased and not societally biased. But Jan LeCun make the" }, { "start": 293.36, "end": 299.68, "text": " terrible mistake of pinpointing the exact root cause of this problem and not addressing the" }, { "start": 299.68, "end": 306.32, "text": " I guess, wider ranging problems in the field as some people perceive it. And he shouldn't have to," }, { "start": 306.32, "end": 312.08, "text": " right? He pretty clearly says, this is why it happens. We can solve it by swapping the data" }, { "start": 312.08, "end": 317.44, "text": " set. He doesn't say anything about anything else. Namely, he doesn't say that general bias" }, { "start": 317.44, "end": 323.68, "text": " in the field is not a problem. He doesn't say that this doesn't harm anyone. None of that. He simply" }, { "start": 323.68, "end": 330.24, "text": " he simply suggests a solution. Jonathan Peck says, well, yes, that's the point. ML researchers need" }, { "start": 330.24, "end": 336.08, "text": " to be more careful selecting their data so that they don't encode biases like this. And LeCun" }, { "start": 336.08, "end": 342.08, "text": " responds with not so much ML researchers, but ML engineers. The consequences of bias are considerably" }, { "start": 342.08, "end": 348.56, "text": " more dire in a deployed product than in an academic paper, which is also correct. This paper was about" }, { "start": 348.56, "end": 356, "text": " the method showing that this method works on this data set. Now, Sumit here makes an interesting" }, { "start": 356, "end": 361.04, "text": " point, which I agree with, saying that today, ML researchers are inadvertently powering product" }, { "start": 361.04, "end": 366.4, "text": " of a lot of non-AI companies who ignorantly start with a pre-trained BERT or ResNet or YOLO from the" }, { "start": 366.4, "end": 371.12, "text": " internet, probably ignoring the license, read me and so on, which is a valid point, right?" }, { "start": 371.68, "end": 376.64, "text": " There are going to be people that take this and think, oh, this is a face up sampler. Cool. I can" }, { "start": 376.64, "end": 382.88, "text": " use that without noting that this is simply an example implementation on an example data set." }, { "start": 382.88, "end": 387.84, "text": " So you can argue that there might be some responsibility of the researchers right here." }, { "start": 387.84, "end": 392.88, "text": " That doesn't make Jan LeCun not correct, but I'd still consider this to be like a fruitful" }, { "start": 392.88, "end": 398.88, "text": " discussion between individuals right here. But now we go on. This person saying, train it on the whole" }, { "start": 398.88, "end": 404.64, "text": " American population with an L2 loss and almost everyone will look white or train it on the whole" }, { "start": 404.64, "end": 410.32, "text": " American population with an L1 loss and more people might look black. Stop pretending that bias does" }, { "start": 410.32, "end": 415.91999999999996, "text": " not also come from algorithmic choices. Jan LeCun never says it doesn't, right? LeCun responds now" }, { "start": 415.91999999999996, "end": 421.03999999999996, "text": " saying, the most efficient way to do it though is to equalize the frequencies of the categories of" }, { "start": 421.03999999999996, "end": 426.24, "text": " samples during training. This forces the network to pay attention to all the relevant features for" }, { "start": 426.24, "end": 431.59999999999997, "text": " all the sample categories. And training with an L1 instead of an L2 will not even begin to solve" }, { "start": 431.6, "end": 437.04, "text": " the problem. I would pretty much argue training with an L1 loss here would exacerbate the problem" }, { "start": 437.04, "end": 442.24, "text": " because the L2 loss is much more sensitive to outliers. Charles Sutton says, serious question," }, { "start": 442.24, "end": 446.40000000000003, "text": " why do you feel that it's important to make this point? Are you worried that people are going to" }, { "start": 446.40000000000003, "end": 453.12, "text": " start suing CycleGAN? And LeCun says, because people should be aware of this problem and know" }, { "start": 453.12, "end": 460.40000000000003, "text": " its cause so they can fix it. How terrible Jan, how terrible you dare pinpoint the exact cause of the" }, { "start": 460.4, "end": 466.08, "text": " problem so that people can fix it. The correct thing to do is to point out that everything is" }, { "start": 466.08, "end": 472.08, "text": " problematic. So Tim the Gibber says, Jan, I suggest you watch me and Emily's tutorial or a number of" }, { "start": 472.08, "end": 478.64, "text": " scholars who are experts in this area. You can't just reduce harms to data set bias. For once," }, { "start": 478.64, "end": 483.52, "text": " listen to us people from marginalized communities and what we tell you. If not now during worldwide" }, { "start": 483.52, "end": 489.52, "text": " protests, not sure when. So again, I feel the argument here is that you can't simply point out" }, { "start": 489.52, "end": 496.15999999999997, "text": " that it's the data set bias. You must point out the bigger problems which Jan LeCun does not ever" }, { "start": 496.15999999999997, "end": 502.32, "text": " deny. He simply says this particular problem can be solved by switching the data set. Nicole Olleroux" }, { "start": 502.32, "end": 508.15999999999997, "text": " says, Jan was in my PhD jury. I am indebted for him for everything he taught me, but this constant" }, { "start": 508.15999999999997, "end": 513.84, "text": " dismissal of the harms caused directly or indirectly by the ML community is highly problematic." }, { "start": 513.84, "end": 520.1600000000001, "text": " Where or when have I dismissed the harm caused by the ML community? I'm pointing out the cause of" }, { "start": 520.1600000000001, "end": 525.6800000000001, "text": " the harm so it can be fixed. You can't fix the harm unless you know what causes it. No. LeRoux says" }, { "start": 525.6800000000001, "end": 530.24, "text": " causes of the biases are numerous only pointing out data set bias deflects the attention away" }, { "start": 530.24, "end": 535.2, "text": " from the other more pervasive ones that make the whole field of bias in ML. Many people try to get" }, { "start": 535.2, "end": 540.8000000000001, "text": " your attention about these issues, but you kept focus on the data set because the data set is the" }, { "start": 540.8, "end": 547.5999999999999, "text": " problem right here. He doesn't dismiss any of the other things. He simply says here the data set is" }, { "start": 547.5999999999999, "end": 553.4399999999999, "text": " the problem if your problem is that it doesn't work as well for non-concassian people. Which was" }, { "start": 553.4399999999999, "end": 558.88, "text": " never the intent of this. The intent of this was to showcase the method. I mean ImageNet is like 60%" }, { "start": 558.88, "end": 565.5999999999999, "text": " dog species and still people train on it to showcase their image recognition techniques." }, { "start": 565.5999999999999, "end": 569.92, "text": " No one training on ImageNet makes a claim that they have solved computer vision for all the" }, { "start": 569.92, "end": 575.5999999999999, "text": " classes in the world in a fair manner. Timnigibru goes on saying I'm sick of this framing, tired of" }, { "start": 575.5999999999999, "end": 580.24, "text": " it. Many people have tried to explain. Many scholars listen to us. You can't just reduce the harms" }, { "start": 580.24, "end": 587.76, "text": " caused by ML to data set bias. Doesn't do that. Doesn't do it. So someone asks her is he engaging" }, { "start": 587.76, "end": 593.36, "text": " in any ways with you? It's appalling to see that he answers to everybody but you. Yet maybe there" }, { "start": 593.36, "end": 599.8399999999999, "text": " is a conversation going on in private and I don't want to jeopardize it. Note that Yan LeCun's tweet" }, { "start": 599.84, "end": 611.2800000000001, "text": " has 500 retweets, 1.9k likes and comments as far as you can scroll. To what she responds to with yep" }, { "start": 611.2800000000001, "end": 616.96, "text": " but I'm used to white men refusing to engage with black and brown women even on issues of bias that" }, { "start": 616.96, "end": 623.0400000000001, "text": " mostly affect us. I mean he literally has ignored a whole body of work by people from that demographic" }, { "start": 623.0400000000001, "end": 629.36, "text": " hence the statement so not surprised. I mean in absence of the fact that an argument should be" }, { "start": 629.36, "end": 638.4, "text": " independent of the person making the argument that is a low blow. Hardmaru says I respectfully" }, { "start": 638.4, "end": 643.76, "text": " disagree with Yan here as long as progress is benchmarked on biased data such biases will also" }, { "start": 643.76, "end": 650.32, "text": " be reflected in the inductive biases of ML systems. Advancing ML with biased benchmarks and asking" }, { "start": 650.32, "end": 655.84, "text": " engineers to simply retrain models with unbiased data is not helpful. I don't disagree with you" }, { "start": 655.84, "end": 660.72, "text": " here. I don't think my tweet contradicts your statement which it doesn't. People are reading" }, { "start": 660.72, "end": 665.6800000000001, "text": " into this because he doesn't conform to the orthodoxy of pointing out that everything and" }, { "start": 665.6800000000001, "end": 672.96, "text": " everything is problematic and simply pinpoints a particular problem. He must be thinking all the" }, { "start": 672.96, "end": 677.84, "text": " wrong things. Jeff Dean says this is a clear example here is an illustration that seemingly" }, { "start": 677.84, "end": 683.2800000000001, "text": " minor choices in learning algorithms or loss can have significant effects so bias in ML systems is" }, { "start": 683.28, "end": 689.12, "text": " about much more than just avoid data bias. ML researchers and practitioners must pay attention" }, { "start": 689.12, "end": 694.8, "text": " to these issues and I think they are and Lacan doesn't say anything against that. He says as I" }, { "start": 694.8, "end": 700.16, "text": " point out in my comment to this tweet is much more efficient to correct this kind of bias. Note that" }, { "start": 700.16, "end": 705.36, "text": " Yan Lacan actually differentiates between the different kinds of biases by equalizing the" }, { "start": 705.36, "end": 711.4399999999999, "text": " frequencies of categories of samples during training than be hacking the loss function." }, { "start": 711.44, "end": 716.6400000000001, "text": " Correct because if you hack the loss function you're trying to counter one kind of bias by" }, { "start": 716.6400000000001, "end": 723.36, "text": " another kind of bias. Meredith Whitaker says this is very racist and even if it recognized" }, { "start": 723.36, "end": 729.6, "text": " non-white people it would be very racist. This is cop tech. It's designed to allow those with power" }, { "start": 729.6, "end": 734.48, "text": " to surveil and control those with less power. Diverse training sets aren't going to fix it" }, { "start": 734.48, "end": 738.72, "text": " advocating that we should never build these systems and that's a discussion to be had" }, { "start": 738.72, "end": 744.5600000000001, "text": " but let me break this to you. This isn't going to help the cops. This isn't actually giving you the" }, { "start": 744.5600000000001, "end": 750.24, "text": " face of the person that was down pixeled. This is simply going to give you the most likely face" }, { "start": 750.24, "end": 756.4, "text": " associated with that down pixeled picture given the data set the algorithm was trained on. I don't" }, { "start": 756.4, "end": 762.48, "text": " see this whenever any machine learning algorithm does anything with faces at all. People jumping" }, { "start": 762.48, "end": 767.28, "text": " up going like this is cop technology. Well in line with all the broader impact statement advice" }, { "start": 767.28, "end": 773.8399999999999, "text": " can't it also be used to find lost children from very very bad security camera footage? And if I" }, { "start": 773.8399999999999, "end": 780, "text": " already mentioned that this doesn't actually give you back the person on the down sampled image" }, { "start": 781.04, "end": 787.04, "text": " it will give you back the most likely person given the data set. So with that I want to conclude this" }, { "start": 787.04, "end": 793.4399999999999, "text": " section. Please stop the witch hunting. Yann LeCun made a completely fine tweet here and there's no" }, { "start": 793.44, "end": 798.5600000000001, "text": " reason why people should pile on him this hard. He doesn't dismiss any of the other problems just" }, { "start": 798.5600000000001, "end": 803.44, "text": " because he doesn't mention them and while we all enjoy a good discussion where people disagree" }, { "start": 803.44, "end": 808.5600000000001, "text": " genuinely it's not helpful to accuse him of things he never said or meant. I mean where does this all" }, { "start": 808.5600000000001, "end": 813.6800000000001, "text": " lead? The result of this is going to be that small labs that don't have the resources to collect their" }, { "start": 813.6800000000001, "end": 819.9200000000001, "text": " own data sets or check for all the possible biases in their models that are reliant on the data sets" }, { "start": 819.92, "end": 825.92, "text": " that we do have even if they are biased and flawed will just be disincentivized from publishing their" }, { "start": 825.92, "end": 832.56, "text": " code or actually doing research at all. So this as every other additional constraint on research is" }, { "start": 832.56, "end": 837.4399999999999, "text": " going to help the large corporations with lots of money. And maybe that's just my opinion but we" }, { "start": 837.4399999999999, "end": 844.4, "text": " should be able to just talk about a problem and the solution to it without always having to make" }, { "start": 844.4, "end": 850.56, "text": " sure that we rabble down all the different things that are and might be wrong according to the canon." }, { "start": 850.56, "end": 856.24, "text": " And big props to Yann LeCun here for holding his own. 90% of people by now would probably be like" }, { "start": 856.24, "end": 861.68, "text": " oh yes I'm so sorry I did a not thoughtful comment blah blah blah. Props to you Yann," }, { "start": 861.68, "end": 865.84, "text": " keep going. And with that I conclude this section. Let me know what you think in the" }, { "start": 865.84, "end": 880.5600000000001, "text": " comments and I'll see you next time. Bye bye." } ]
Q5g3p9Zwjrk
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
SIREN: Implicit Neural Representations with Periodic Activation Functions (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "implicit", "nerf", "neural processes", "optimization", "curve fitting", "audio", "signal processing", "surfaces", "point clouds", "oriented", "signed distance function", "mlp", "layers", "hypernetworks", "representation", "function", "sin", "sinus", "sinusoid", "fourier", "initialization", "relu", "nonlinearity", "derivative", "gradient", "laplacian", "wave" ]
Implicit neural representations are created when a neural network is used to represent a signal as a function. SIRENs are a particular type of INR that can be applied to a variety of signals, such as images, sound, or 3D shapes. This is an interesting departure from regular machine learning and required me to think differently. OUTLINE: 0:00 - Intro & Overview 2:15 - Implicit Neural Representations 9:40 - Representing Images 14:30 - SIRENs 18:05 - Initialization 20:15 - Derivatives of SIRENs 23:05 - Poisson Image Reconstruction 28:20 - Poisson Image Editing 31:35 - Shapes with Signed Distance Functions 45:55 - Paper Website 48:55 - Other Applications 50:45 - Hypernetworks over SIRENs 54:30 - Broader Impact Paper: https://arxiv.org/abs/2006.09661 Website: https://vsitzmann.github.io/siren/ Abstract: Implicitly defined, continuous, differentiable signal representations parameterized by neural networks have emerged as a powerful paradigm, offering many possible benefits over conventional representations. However, current network architectures for such implicit neural representations are incapable of modeling signals with fine detail, and fail to represent a signal's spatial and temporal derivatives, despite the fact that these are essential to many physical signals defined implicitly as the solution to partial differential equations. We propose to leverage periodic activation functions for implicit neural representations and demonstrate that these networks, dubbed sinusoidal representation networks or Sirens, are ideally suited for representing complex natural signals and their derivatives. We analyze Siren activation statistics to propose a principled initialization scheme and demonstrate the representation of images, wavefields, video, sound, and their derivatives. Further, we show how Sirens can be leveraged to solve challenging boundary value problems, such as particular Eikonal equations (yielding signed distance functions), the Poisson equation, and the Helmholtz and wave equations. Lastly, we combine Sirens with hypernetworks to learn priors over the space of Siren functions. Authors: Vincent Sitzmann, Julien N. P. Martel, Alexander W. Bergman, David B. Lindell, Gordon Wetzstein Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're looking at implicit neural representations with periodic activation functions by Vincent Sitzman, Julian N. P. Martel, Alexander W. Bergman, David B. Landell and Gordon Wettstein. So this paper is a bit of a special paper. If you're like me coming from like classic machine learning or deep learning, things like this, this paper requires you to think around your notion of what it means to handle data and so on a bit and to think about data points and so on. Essentially what they're doing is they are representing signals such as images or sound or generally waves or point clouds. They're representing these signals as functions mapping, for example, from their coordinates to their values. We'll see what that entails. They're not the first ones to do this, but they managed to do this very well using these new models called sirens, which are basically neural networks that have sine waves as their nonlinearities instead of like relu or hyperbolic tangents and so on. It turns out that if you initialize these very carefully, those can be made to capture these signals very, very well. 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. This is not going to be like as in-depth or technical as usually because I myself am not super familiar with this kind of literature, with the neural representations and so on. If you go at this paper from a machine learning perspective, you're going to be ultimately super confused at the beginning. I'm going to try to clear up and retrace my steps of my confusion. I love that this paper starts out at, we're interested in a class of functions phi that satisfy equations of the form this right here. We are interested in a class of functions. I've never particularly had many dreams about functions like this. How can you look at this? We're interested in the relation between inputs and outputs. This here is the function as you can see. This maps input to output. We're also interested in its derivatives. Here you go first, second, third derivative and so on. This function right here is what we're going to call a neural representation or an implicit representation. It's called a neural representation if it's a neural network. So far so good. You've seen this, right? You've seen this could be a data point and then could map it to a label or something like this. Since we're going to represent images, you already know maybe a GANs, a generative adversarial network, where this here is the latent vector and then you have a neural network mapping this latent vector to an image. This is going to produce an image. This here is quite similar but not quite. 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 a GAN what we do, we learn this right here, this function phi. We learn this from data such that if I plug in one particular vector I get one particular image and if I plug in another vector I get another image and the function always stays the same. Here it's going to be one function per image. So each image, the function is the image. So how is a function an image? If I have an image and it's made of pixels, each pixel has an X and the Y coordinate. Let's call that X1 and X2 the coordinate of that and each pixel also has a color value, which is three-dimensional. So each pixel has a three-dimensional RGB color value. Technically an image is a function from coordinates to pixel values. If this is my image, it is represented by a function, then if I input any coordinates like 3, 4, 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. Now the goal is to have this right here be a neural network where I have a multi-layer perceptron and I think they always use a five layer MLPs, so really simple neural networks. 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. Now again this network here is, they now train this network to map input to output. To map coordinates to values and this of course is one particular image, so you're going to have one neural network per image. Now you might reasonably ask why do we do it like this? Why don't we just save the image as the pixel values? Why do we need a function mapping the coordinates to the pixels? That's a valid question I guess and the image is just one example of this, but one advantage that you immediately get is that now you have a continuous representation. So now you cannot, not only do you know, because if you store an image like this, you only know its value at each of the pixel locations. However if you store an image like this you know its value at any continuous in-between location, right? So you can ask the network what's the pixel value at 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 RGB. 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. 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. This is not a new idea and this has been around and they cite a lot of literature where this has been around before. So what their new thing is is that they say these other representations, so if you use a neural network in a classic sense like this and you do your training with the mini batches like this, what you'll end up with is a bad image. So if you then simply go, once you've trained the network, you can take it, 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 could certainly give me back the positions at the pixels. So you ask it what's the 0, 0, what's a 0, 1, what's a 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 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 I'd still see people who just use a GAN or something like this. So yes valid point but we are in the business right now of solving this particular problem and as we'll go on to see it's not just about images but images are a nice example of a natural signal. So the 10H networks you also see they I think they fail even harder they have these artifacts back here even and this here it gets better when you do ReLU networks with what is called a positional encoding. So not only do you have your X and your Y coordinates go through a ReLU network but you also have them go through a positional encoding and that's very much like you would have in a transformer. So if you watched my video about attention is all you need I explained how the positional encodings work there but basically what you do is you map these things to cosine and sine waves so you're going to be like the sine of X times 10 and then the sine wave of X times 100 and so on so which you'll end up and you do the same for Y and that ends you up with more features that sort of then the function can use to represent positions way better than just given the X and Y coordinates. If you do that you kind of recover some of the image but you see here they also analyze how so this is the ground truth and this is the gradient of the ground truth which is basically a a Sobel filter if you know that it's basically an edge detector color gradient thing and then this here is the second derivative the Laplacian of the image and ideally if your implicit representation models the signal very well it should also model the derivatives of the signal very well. So now we're kind of connecting it to what we saw at the beginning right these siren networks are specifically designed to not only match the signal right here but also match its derivatives and if you match maybe in an image it's not so it's not that important to match the derivatives even though it is because there are small things like you can see right here the grass isn't as well represented and here you mostly you get some artifacts that you see here in the in the gradient might not be as important for images in terms of human vision but for many signals it's also important to match the derivatives and here at the siren even though it's trained on the image itself you can see that its derivatives are very much in line with the original signal so simply by matching the signal you this architecture manages to also capture the derivatives of the signal and therefore have a more faithful representation. Okay so that was positional RBF relu's are simply the relu network and I think somewhere in here there is an RBF kernel if you young kids don't know what an RBF kernel is then yeah no I guess I guess I don't want to I don't want to dunk on anyone it's basically you how do I explain it you map it to an infinite dimensional space using Gaussian kernels yeah maybe Wikipedia is better at that than I am so sirens what what do they do in order to be able to capture a signal very well what do how does it sing a siren different from like an RBF network and the answer is pretty pretty pretty simple so the architecture of a siren network is the end does it already stand for network I'm not sure honestly maybe we'll find out yes it's the sinusoidal representation networks so the end is network so we don't say siren network we say siren and a siren is simply made of what is that here it's a multi-layer perceptron basically right so it is a this here is the network the network this is the final layer of the network which is a linear layer before that you have all these layers just not concatenate of it 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 mole 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 don't you 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 some good properties if you want to capture natural signals and they have some bad properties namely that the fact that they are periodic and go down again and the reason why they get around the bad properties is because or so they claim they initialize the network in a very particular fashion because I think at least I when I when I started in deep learning I had this idea so a lot of other people must have had this idea too of like hey what if I just replaced a non-linearity with like my sine function could I do something this and then tried it out and it didn't really work so I scrapped that now this here of course isn't simply replacing the neural network it's also using the neural network for something completely different than I would namely it's using the neural network to learn these implicit representations and not like I would to do simply for learning a data set but still it seems like you need to initialize them fairly with with very careful consideration and we'll go on onto that right now so actually they just describe it it's 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 6 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 sign 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 work grows only slowly finally we propose to initialize the first layer of the sine network with weights so that the sine function spans multiple periods over negative 1 to 1 we found W 0 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 to their credit because I guess most people like me would try out something like this and then after a while realize it doesn't work and to you know be so convinced to go and really figure out how do we need to initialize these to make it work and of course as you're doing this there's still like a 99% 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 what is the deal with all these derivatives now since this network right here has these sine waves in it right so it's a neural network with sine waves as derivatives as nonlinearities what now so we have a neural network what now is the first derivative of that neural network right with respect to its input so we have an input now what's the first derivative with respect to its input and the cool thing about this is what's the first derivative of a sine wave it's of course a sine wave that's shifted so it's a cosine which is a sine wave that's simply phase shifted and then the next derivative again is a shifted sine wave and so on so the derivative of a siren is a siren and that does not hold for any of these other nonlinearities so in relu's it's the derivative of a relu network is like a con so if you 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 becoming 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 we want to find a relationship between the input and its first derivative and not even have this as part of the let's say of the loss function and then we can see what comes out so that's what they do oh can I find it can I find it that's what they do right here 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 valid point but it's not about why can't we just it's about demonstrating the power of these networks so if you only match the gradients right what you'll find is if you then look at the function right you still find the function you don't you don't find the gradient you still train the function you still train the weights of the function itself but the loss function depends on the gradient of that function if you do that you'll find that if you then look at the function again you can ask the function to produce the image by simply cycling over each of the coordinates you'll find that look at that just by matching the gradient you'll match the image itself pretty pretty well right and that's pretty cool now of course you're not going to match the RGB values this is a grayscale image and you know there's a there's kind of a reason for that because since the gradient loses like constant bias information so what if you'd match an RGB image I'm gonna guess you're going to have like color very much color distortions but and here what you're going to have in this case is just distortions in luminosity like if you know that if you have a function if you have the derivative of a function and you will want to find the function itself and you integrate then the solution is always an entire space of functions because you will integrate the function this thing right here and so with the whatever its input is and you have to add a constant and you don't know what the constant was in the original function because when you derive the function the constant drops away so similarly here what we'd expect is that the image that we're getting back will be faithful with respect to like its its borders right since we're matching the gradient and the gradient is basically an edge detector will match the sort of edge information of the picture which you can clearly see but what we would expect is some difference in overall luminosity and I don't even know what how they exactly did this because they now have to choose a constant to add maybe they just chose it in some way or maybe they just let the network do but this is you know still pretty pretty impressive you can see there's some detail missing but not much and the same exact same thing you can do for matching the second derivative so now you match the Laplacian of the image and remember in the ReLU networks they don't even have a Laplacian it's a constant so this is something you could never do and you can see that the upcoming image is still pretty good right this are this is now missing the constant luminosity in the first and second derivative sorry in the in the zero with and first derivative and still the information is the the reconstruction is pretty good alright 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 does that buy you here is a thing you can do if you want to mix two images what do you do so if you want to mix this and this what you could do is linearly interpolate but that would be not very cool because right here you have a lot of like very bright pixels which probably have like values of one and here you'd have the dark pixels which probably have values like more close to zero and the if you simply mix them if you simply add them together and divide by two then you get kind of get a wash of the two and similarly here you kind of wash out the bear because you'd have some pixel values here that would come over and generally not not a good idea to mix images like this now you know with GANs we can do this but we have to have like a training data set and so on here what we'll say is we'll simply say we'll take the gradient of this and we'll take the gradient of this and then we'll add the two gradient maps now what this does is that as you can see right here on the left is the composite gradients and what this does is right here in the sky there is no gradient information in this image because it's just a flat patch of sky 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 bear head is and if you want to mix images like it can be a good idea to mix their gradients because generally the information in an image is where the gradients are so what we would expect the gradient to represent the gradient would carry over this portion 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 pixel value at each location and that's that okay so this is just a simple you know thing that you can play around with but they do they do other more interesting things right here for example this representing shapes with signed distance functions so if you go over the formulation the actual formulation of their loss function we haven't actually done this right quite yet it's here it's very complicatedly stated but ultimately what this means is so a component right here is are these CM which are constraints so this loss function operates on these constraints and the constraints are across a of X which basically 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 are fulfilled they equal zero and so the for example the L2 loss between the RGB values of the true image and the RGB values that you fit the RGB loss sorry the L2 loss would be a constraint like this and of course the more differentiable you make it the more the easier this network has at fitting it right so that's why there is 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 in the next interesting thing we can do as I said is representing shapes with signed distance functions so we're going to go slowly and this is yeah it's not that hard inspired by recent work on shape representation with differentiable signed distance functions as the F's we fit SDFs directly on oriented point clouds using both ReLU based implicit neural representations and sirens okay so what is an SDF a signed distance function that's pretty easy a signed distance function is simply a distance function with a sign like wow so 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 it simply means that each point also has a sign in front of it and that means all the things on one side of the boundary maybe have a plus and all the things on the other side maybe have a minus so even though two points could be the same distance from the boundary one is like plus five away and one is negative five away and you can do this this is useful for example when you fit point clouds as they do in this example so when they have point clouds and that's usually in 3d space but if you have point clouds you basically have points right here and you know that the points should represent some kind of shape maybe a wall or so they have these room interiors as you can see right here so this is a 3d scene but you only have a point cloud of the 3d scene and what that means is that maybe you were in this room and you put up a laser scanner right here laser scanner I don't know how a laser scanner looks and the laser scanner kind of shoots lasers at random locations and always measures the distance 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 a 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 an implicit representation so we're going to train a neural network that represents this shape right here basically by mapping coordinates to to 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 5 or at this location here what's the sign distance it's going to tell us it's 0 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 to more constraints so we know and this goes on this amounts to solving a particular iconal boundary value problem that constrains the norm of spatial gradients to be one almost everywhere so this iconal boundary value problem this is a property of signed distance function that the norm of the gradients with respect to the input is one almost everywhere almost everywhere means everywhere I guess except at the boundary itself where the distance is 0 though I could be wrong note that relu networks are seeming seemingly ideal for representing sdfs as their gradients are locally constant and their second derivatives are 0 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 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 0 is going to be that and then all the other points right here are going to be part of your omega without the omega 0 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'll have this this constraint of this gradient my tablet maybe I'll start monetizing just so I can get a new tablet okay so no okay the 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 our network maps any point in 3d space to assign distance function so most of these points aren't going to be on the boundary itself even though in the mini batch where we train where they train they sample points on and off the on and off the boundary at the at equal rates just to to have the network train more stably so this is a condition on all the points off of the boundary and they say here this function is this exponential function with alpha larger than 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 zero 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 will what we require first of all we require their value to be zero or close to zero right this is the loss function so we want to minimize this and this is simply the output value so the sign distance function of points on the surface you know the things we actually measure they should be zero 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 signed the network if we ask the network hey what do you think about this position right here the network should tell us first of all the sign distance function should be zero because it's on the boundary second of all the norm of the gradient of the sign distance function at that point should be one 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 want it to increase along the normal direction and not along any other direction so that's a pretty good pretty good constraint to have so you can see right here I mean you don't really have to understand exactly about 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 additionally say hey you should have a pretty high value and actually not a zero value but a pretty high value so and again we only fit one particular scene we only ever fit one scene with an entire network so the entire neural network this this this whole structure right here everything is captured by this neural network that we train on the point cloud and you can see that if you use a relu what you'll get is super super wobbly because if even if you train the relu with the same loss function these constraints on the gradients they're just not going to work out with the relu because the gradients are like constant and discontinuous right whereas the siren can basically fulfill all of these constraints on the different parts like on the values and on the gradients of that of the loss function and they have another example right here where they fit this shape yeah so you see all the details are preserved way better where the relu's they'll simply kind of flatten over everything and make it wobbly alright so I hope this sort of made sense and we'll go to the last thing right now 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 an 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 I think they use the atom optimizer it's just that the data set now comes all comes from this one ground truth image and you can see that the siren network on the right pretty quickly zeros in on the on the image and then gets the details subsequently right they also represent audio with this and you can watch that they represent video compare that to relu representations then here solving the possum 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 let's scroll down here a bit and on the right is a relu representation of the same thing so this is the same network with the same objective it just has relu instead of sine waves as activation functions so you can see how much of a difference that makes right here and the middle is a relu with the positional encodings still not good 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 these 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 coordinates so technically you could continue the picture to the bottom and just see what the siren thinks should be here at the bottom so all of these things would be pretty pretty cool to actually experiment with and they have the code available to do that and you can see the fitting process of the Helmholtz equation right here and related projects pretty cool website I definitely invite you to check it out and let's go back to the paper and we're back and my tablet crashed and let's continue so they're now going on to use sirens in order to solve PDEs and so in physics often you have these problems where you are given an equation but the equation doesn't necessarily involve a function itself but only involves derivatives of that function like or relates derivatives to the function and so on so one example here is this Helmholtz equation that's given as this where the I think the the F is a known function but this is the wave field we want to you want to get you want to figure out which is unknown and then this HM 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 ah 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 okay let's let's go to an example in this example what you'll have is you'll have an image like this one where a few pixels are masked actually most of the pixels are masked and you want to put this into a CNN and the CNN should output the parameters of the siren network so the parameters because the 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 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 upcoming 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 pixel 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 parameter ization 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 data set and now the only thing is that the output is a function given by its parameters and not the actual pixel values okay so let's let's look at the broader impact statement the proposed siren representation enables accurate representations of natural signals such as images audio and video in a deep learning framework this may be an enabler for downstream tasks involving such signals such as classification for images or speech to text systems for audio such applications may be leveraged for both positive and negative ends siren may in the future further enable novel approaches to the generation of such signals this has potential for misuse in impersonating actors without their consent for an in-depth discussion of so-called deep fakes we refer the reader to a recent review article in your neural rendering this has this has like no perplexity like no perplexity at all like is anyone benefited by this seriously okay but at least we made the authors think of the consequences of their research yeah so I invite you to check out this paper maybe with this right now you can follow a bit better what happens here this is a different paradigm of research it's a cool paradigm it's away from your usual machine learning framework and yeah so I'm excited what happens next in this I also invite you to check out the websites they have lots of videos and goodies and so on and with that bye bye
[ { "start": 0, "end": 5.8, "text": " Hi there! Today we're looking at implicit neural representations with periodic" }, { "start": 5.8, "end": 11.52, "text": " activation functions by Vincent Sitzman, Julian N. P. Martel, Alexander W. Bergman," }, { "start": 11.52, "end": 18.240000000000002, "text": " David B. Landell and Gordon Wettstein. So this paper is a bit of a special paper." }, { "start": 18.240000000000002, "end": 21.92, "text": " If you're like me coming from like classic machine learning or deep" }, { "start": 21.92, "end": 29.78, "text": " learning, things like this, this paper requires you to think around your notion" }, { "start": 29.78, "end": 34.4, "text": " of what it means to handle data and so on a bit and to think about data points" }, { "start": 34.4, "end": 40.52, "text": " and so on. Essentially what they're doing is they are representing signals such as" }, { "start": 40.52, "end": 46.84, "text": " images or sound or generally waves or point clouds. They're representing these" }, { "start": 46.84, "end": 53.56, "text": " signals as functions mapping, for example, from their coordinates to their values." }, { "start": 53.56, "end": 60.92, "text": " We'll see what that entails. They're not the first ones to do this, but" }, { "start": 60.92, "end": 66.52000000000001, "text": " they managed to do this very well using these new models called sirens, which" }, { "start": 66.52000000000001, "end": 75.68, "text": " are basically neural networks that have sine waves as" }, { "start": 75.68, "end": 81.96000000000001, "text": " their nonlinearities instead of like relu or hyperbolic tangents and so on." }, { "start": 81.96, "end": 87.83999999999999, "text": " It turns out that if you initialize these very carefully, those can be made to" }, { "start": 87.83999999999999, "end": 94.39999999999999, "text": " capture these signals very, very well. That's the kind of high-level overview" }, { "start": 94.39999999999999, "end": 101.24, "text": " and we'll go through the paper in a bit of a fashion of someone that is not in" }, { "start": 101.24, "end": 105.61999999999999, "text": " this particular literature. This is not going to be like as in-depth or" }, { "start": 105.62, "end": 114.2, "text": " technical as usually because I myself am not super familiar with this kind" }, { "start": 114.2, "end": 119.80000000000001, "text": " of literature, with the neural representations and so on. If you go" }, { "start": 119.80000000000001, "end": 123.80000000000001, "text": " at this paper from a machine learning perspective, you're going to" }, { "start": 123.80000000000001, "end": 129.56, "text": " be ultimately super confused at the beginning. I'm going to try to" }, { "start": 129.56, "end": 137.4, "text": " clear up and retrace my steps of my confusion. I love that this" }, { "start": 137.4, "end": 142.96, "text": " paper starts out at, we're interested in a class of functions phi that satisfy" }, { "start": 142.96, "end": 150.44, "text": " equations of the form this right here. We are interested in a class of" }, { "start": 150.44, "end": 157.84, "text": " functions. I've never particularly had many dreams about functions like" }, { "start": 157.84, "end": 164.20000000000002, "text": " this. How can you look at this? We're interested in the" }, { "start": 164.20000000000002, "end": 171.04, "text": " relation between inputs and outputs. This here is the function as you can see." }, { "start": 171.04, "end": 179.36, "text": " This maps input to output. We're also interested in its derivatives." }, { "start": 179.36, "end": 184, "text": " Here you go first, second, third derivative and so on. This function" }, { "start": 184, "end": 189.4, "text": " right here is what we're going to call a neural representation or an implicit" }, { "start": 189.4, "end": 195.04, "text": " representation. It's called a neural representation if it's a neural" }, { "start": 195.04, "end": 201.16, "text": " network. So far so good. You've seen this, right? You've seen this" }, { "start": 201.16, "end": 206.72, "text": " could be a data point and then could map it to a label or something like this." }, { "start": 206.72, "end": 212.52, "text": " Since we're going to represent images, you already know maybe a GANs, a" }, { "start": 212.52, "end": 217.28, "text": " generative adversarial network, where this here is the latent vector and then" }, { "start": 217.28, "end": 223.48000000000002, "text": " you have a neural network mapping this latent vector to an image. This" }, { "start": 223.48000000000002, "end": 231.28, "text": " is going to produce an image. This here is quite similar but not quite." }, { "start": 231.28, "end": 237.32000000000002, "text": " Again I guess this here would count as the representation, the continuous" }, { "start": 237.32000000000002, "end": 242.24, "text": " representation of this picture. However in this case right here the function" }, { "start": 242.24, "end": 250.16, "text": " itself is the representation. So in a GAN what we do, we learn this right here," }, { "start": 250.16, "end": 254.48000000000002, "text": " this function phi. We learn this from data such that if I plug in one" }, { "start": 254.48000000000002, "end": 258.92, "text": " particular vector I get one particular image and if I plug in another vector I" }, { "start": 258.92, "end": 263.24, "text": " get another image and the function always stays the same. Here it's going to" }, { "start": 263.24, "end": 270.04, "text": " be one function per image. So each image, the function is the image. So how is a" }, { "start": 270.04, "end": 276.48, "text": " function an image? If I have an image and it's made of pixels," }, { "start": 276.48, "end": 285.88, "text": " each pixel has an X and the Y coordinate. Let's call that X1 and X2" }, { "start": 285.88, "end": 292.88, "text": " the coordinate of that and each pixel also has a color value, which is" }, { "start": 292.88, "end": 299.16, "text": " three-dimensional. So each pixel has a three-dimensional RGB color value." }, { "start": 299.16, "end": 306.76000000000005, "text": " Technically an image is a function from coordinates to pixel values." }, { "start": 306.76000000000005, "end": 314.20000000000005, "text": " If this is my image, it is represented by a function, then if I input any" }, { "start": 314.20000000000005, "end": 321.24, "text": " coordinates like 3, 4, that function should return what are the RGB values at" }, { "start": 321.24, "end": 329.64, "text": " that. Maybe it's like 0.5, 0.7 and 0.1. Those are the RGB values at that." }, { "start": 329.64, "end": 337.48, "text": " Now the goal is to have this right here be a neural network where I have a" }, { "start": 337.48, "end": 342.24, "text": " multi-layer perceptron and I think they always use a five layer MLPs, so" }, { "start": 342.24, "end": 349, "text": " really simple neural networks. You simply input, so here you have two input" }, { "start": 349, "end": 354.48, "text": " neurons where this here goes, so one gets the three, one gets the four, then this" }, { "start": 354.48, "end": 359.8, "text": " travels through the network and at the end the network should output three" }, { "start": 359.8, "end": 366.76, "text": " output nodes and this should be like the 0.5, 0.7, 0.1." }, { "start": 366.76, "end": 376.6, "text": " Now again this network here is, they now train this network to map input to output." }, { "start": 376.6, "end": 384.16, "text": " To map coordinates to values and this of course is one particular image, so" }, { "start": 384.16, "end": 389.48, "text": " you're going to have one neural network per image. Now you might reasonably ask" }, { "start": 389.48, "end": 394.52000000000004, "text": " why do we do it like this? Why don't we just save the image as the pixel" }, { "start": 394.52000000000004, "end": 399.44, "text": " values? Why do we need a function mapping the coordinates to the pixels?" }, { "start": 399.44, "end": 405.40000000000003, "text": " That's a valid question I guess and the image is just one example of this, but" }, { "start": 405.4, "end": 410.15999999999997, "text": " one advantage that you immediately get is that now you have a continuous" }, { "start": 410.15999999999997, "end": 415.67999999999995, "text": " representation. So now you cannot, not only do you know, because if you store an" }, { "start": 415.67999999999995, "end": 422.03999999999996, "text": " image like this, you only know its value at each of the pixel locations. However" }, { "start": 422.03999999999996, "end": 427.35999999999996, "text": " if you store an image like this you know its value at any continuous in-between" }, { "start": 427.35999999999996, "end": 432.79999999999995, "text": " location, right? So you can ask the network what's the pixel value at 3.2" }, { "start": 432.8, "end": 438.68, "text": " and 4.1, right? It will give you an answer and if the network is trained well it" }, { "start": 438.68, "end": 443.36, "text": " will give you sort of an answer that makes sense. That is, what's the exact" }, { "start": 443.36, "end": 452.88, "text": " color at this sub pixel location right here? Now so far so good, right? So" }, { "start": 452.88, "end": 457.44, "text": " essentially this boils down to not really a machine learning problem in the" }, { "start": 457.44, "end": 463.4, "text": " classic sense, but an optimization problem. Because all you have to do is" }, { "start": 463.4, "end": 468.52, "text": " you have to make the neural network match all input to all output. There's" }, { "start": 468.52, "end": 472.92, "text": " not really a training and a test set right here. Namely your data set is going" }, { "start": 472.92, "end": 477.52, "text": " to be all the pixels in the image. So each pixel in the image is going to be" }, { "start": 477.52, "end": 486.52, "text": " one data point because it's one, so each pixel is x, y, 2 RGB. And the way they" }, { "start": 486.52, "end": 490.76, "text": " train these networks, now at the examples of pixels, the way they train it they" }, { "start": 490.76, "end": 496.96, "text": " simply sample a mini batch of pixels like this one, this one, this one, this one," }, { "start": 496.96, "end": 504.59999999999997, "text": " this one. They use that mini batch to train the network to do one step to" }, { "start": 504.59999999999997, "end": 507.84, "text": " train the network and then they sample another mini batch and so on. You might" }, { "start": 507.84, "end": 512.1999999999999, "text": " sample the same pixels multiple times, but ultimately what you want is sort of" }, { "start": 512.2, "end": 517.9200000000001, "text": " a continuous representation of the image. This is not a new idea and" }, { "start": 517.9200000000001, "end": 522.88, "text": " this has been around and they cite a lot of literature where this has been around" }, { "start": 522.88, "end": 531.4000000000001, "text": " before. So what their new thing is is that they say these other representations," }, { "start": 531.4000000000001, "end": 536.48, "text": " so if you use a neural network in a classic sense like this and you do your" }, { "start": 536.48, "end": 542.76, "text": " training with the mini batches like this, what you'll end up with is a bad image." }, { "start": 542.76, "end": 547.6, "text": " So if you then simply go, once you've trained the network, you" }, { "start": 547.6, "end": 552.8000000000001, "text": " can take it, take your network and you can simply output each pixel location. So" }, { "start": 552.8000000000001, "end": 559.16, "text": " you say okay now I'm going to reproduce this image using my network because if" }, { "start": 559.16, "end": 563.6, "text": " it's trained well it could certainly give me back the positions at the" }, { "start": 563.6, "end": 571.84, "text": " pixels. So you ask it what's the 0, 0, what's a 0, 1, what's a 0, 2, what's 0 at 0, 3" }, { "start": 571.84, "end": 577.12, "text": " and you can fill in the picture and that usually gives you very bad outcomes or" }, { "start": 577.12, "end": 581.72, "text": " so they claim. I mean I haven't checked it particularly, but you can see right" }, { "start": 581.72, "end": 588.0400000000001, "text": " here this is the ground truth and here you have a network that is" }, { "start": 588.04, "end": 593.88, "text": " parameterized with ReLU functions like with ReLU nonlinearities and as you can" }, { "start": 593.88, "end": 601.88, "text": " see the ReLU network misses a lot of the sort of higher definition things in the" }, { "start": 601.88, "end": 608.7199999999999, "text": " image and so it depends on the architecture that you use how well you" }, { "start": 608.7199999999999, "end": 613.42, "text": " can make a neural network represent those things. Again you kind of need to" }, { "start": 613.42, "end": 618.36, "text": " forget what you know about machine learning in the classic sense" }, { "start": 618.36, "end": 624.28, "text": " because I'd still see people who just use a GAN or something like this. So" }, { "start": 624.28, "end": 630.16, "text": " yes valid point but we are in the business right now of solving this" }, { "start": 630.16, "end": 636.4, "text": " particular problem and as we'll go on to see it's not just about images but" }, { "start": 636.4, "end": 641.36, "text": " images are a nice example of a natural signal. So the 10H networks you also see" }, { "start": 641.36, "end": 647.6, "text": " they I think they fail even harder they have these artifacts back here even and" }, { "start": 647.6, "end": 654.84, "text": " this here it gets better when you do ReLU networks with what is called a" }, { "start": 654.84, "end": 660.24, "text": " positional encoding. So not only do you have your X and your Y coordinates go" }, { "start": 660.24, "end": 664.72, "text": " through a ReLU network but you also have them go through a positional encoding" }, { "start": 664.72, "end": 669.28, "text": " and that's very much like you would have in a transformer. So if you" }, { "start": 669.28, "end": 673.8399999999999, "text": " watched my video about attention is all you need I explained how the positional" }, { "start": 673.8399999999999, "end": 680.64, "text": " encodings work there but basically what you do is you map these things to cosine" }, { "start": 680.64, "end": 688.64, "text": " and sine waves so you're going to be like the sine of X times 10 and then" }, { "start": 688.64, "end": 695.88, "text": " the sine wave of X times 100 and so on so which you'll end up and you do the" }, { "start": 695.88, "end": 702.36, "text": " same for Y and that ends you up with more features that sort of then the" }, { "start": 702.36, "end": 707.52, "text": " function can use to represent positions way better than just given the X and Y" }, { "start": 707.52, "end": 713.76, "text": " coordinates. If you do that you kind of recover some of the image but you see" }, { "start": 713.76, "end": 718.24, "text": " here they also analyze how so this is the ground truth and this is the" }, { "start": 718.24, "end": 723.08, "text": " gradient of the ground truth which is basically a a Sobel filter if you know" }, { "start": 723.08, "end": 728.32, "text": " that it's basically an edge detector color gradient thing and then this here" }, { "start": 728.32, "end": 735.36, "text": " is the second derivative the Laplacian of the image and ideally if your" }, { "start": 735.36, "end": 744.12, "text": " implicit representation models the signal very well it should also model" }, { "start": 744.12, "end": 748.24, "text": " the derivatives of the signal very well. So now we're kind of connecting it to" }, { "start": 748.24, "end": 754.16, "text": " what we saw at the beginning right these siren networks are specifically" }, { "start": 754.16, "end": 760.88, "text": " designed to not only match the signal right here but also match its" }, { "start": 760.88, "end": 767.4, "text": " derivatives and if you match maybe in an image it's not so it's not that" }, { "start": 767.4, "end": 774.28, "text": " important to match the derivatives even though it is because there are small" }, { "start": 774.28, "end": 783.64, "text": " things like you can see right here the grass isn't as well represented and here" }, { "start": 783.64, "end": 789.68, "text": " you mostly you get some artifacts that you see here in the in the gradient might" }, { "start": 789.68, "end": 793.8399999999999, "text": " not be as important for images in terms of human vision but for many signals" }, { "start": 793.8399999999999, "end": 798.04, "text": " it's also important to match the derivatives and here at the siren even" }, { "start": 798.04, "end": 802.8399999999999, "text": " though it's trained on the image itself you can see that its derivatives are" }, { "start": 802.84, "end": 808.2800000000001, "text": " very much in line with the original signal so simply by matching the signal" }, { "start": 808.2800000000001, "end": 817.9200000000001, "text": " you this architecture manages to also capture the derivatives of the signal" }, { "start": 817.9200000000001, "end": 823.12, "text": " and therefore have a more faithful representation. Okay so that was" }, { "start": 823.12, "end": 828.32, "text": " positional RBF relu's are simply the relu network and I think somewhere in" }, { "start": 828.32, "end": 834.2800000000001, "text": " here there is an RBF kernel if you young kids don't know what an RBF kernel is" }, { "start": 834.2800000000001, "end": 843.12, "text": " then yeah no I guess I guess I don't want to I don't want to dunk on anyone" }, { "start": 843.12, "end": 851.36, "text": " it's basically you how do I explain it you map it to an infinite dimensional" }, { "start": 851.36, "end": 863.12, "text": " space using Gaussian kernels yeah maybe Wikipedia is better at that than I am so" }, { "start": 863.12, "end": 869.24, "text": " sirens what what do they do in order to be able to capture a signal very well" }, { "start": 869.24, "end": 874, "text": " what do how does it sing a siren different from like an RBF network and" }, { "start": 874, "end": 878.5600000000001, "text": " the answer is pretty pretty pretty simple so the architecture of a siren" }, { "start": 878.56, "end": 885.88, "text": " network is the end does it already stand for network I'm not sure honestly maybe" }, { "start": 885.88, "end": 895.3599999999999, "text": " we'll find out yes it's the sinusoidal representation networks so the end is" }, { "start": 895.3599999999999, "end": 903.8399999999999, "text": " network so we don't say siren network we say siren and a siren is simply made of" }, { "start": 903.84, "end": 911.36, "text": " what is that here it's a multi-layer perceptron basically right so it is a" }, { "start": 911.36, "end": 916.88, "text": " this here is the network the network this is the final layer of the network" }, { "start": 916.88, "end": 924.4, "text": " which is a linear layer before that you have all these layers just not" }, { "start": 924.4, "end": 930.12, "text": " concatenate of it but following each other so it's a multi-layer perceptron" }, { "start": 930.12, "end": 935.2, "text": " pretty regular and each of the layers in the multi-layer perceptron is made up" }, { "start": 935.2, "end": 940.4, "text": " like this you have an input you multiply it by a weight matrix you add a bias and" }, { "start": 940.4, "end": 946.8, "text": " then you put it through a sine wave so the sine wave here is really that's" }, { "start": 946.8, "end": 953.04, "text": " that's the only change from a mole from an MLP otherwise so usually here you" }, { "start": 953.04, "end": 960.8399999999999, "text": " have something like a sigmoid or a relu function now you have a sine wave and" }, { "start": 960.8399999999999, "end": 967.68, "text": " the I mean it's a bit weird right because a relu function is like this so" }, { "start": 967.68, "end": 972.48, "text": " it has this center thing where it kind of switches but here it's linear and" }, { "start": 972.48, "end": 979.9599999999999, "text": " monotonic and here it's kind of constant and even a even a sigmoid so the" }, { "start": 979.96, "end": 987.48, "text": " sigmoid is don't you remember like this yes I guess so the sigmoid is like this" }, { "start": 987.48, "end": 991.84, "text": " so it's kind of constant here constant here monotonic and so on we're used to" }, { "start": 991.84, "end": 997.58, "text": " monotonic activation functions whereas a sine wave is really different the sine" }, { "start": 997.58, "end": 1005.2800000000001, "text": " wave of course is something like this right where it's not monotonic at all" }, { "start": 1005.28, "end": 1010.24, "text": " like if you if you want to increase your function value at any point and you're" }, { "start": 1010.24, "end": 1015.28, "text": " here and you go up the hill and you do a step that's too large you end up down" }, { "start": 1015.28, "end": 1022.36, "text": " the hill again but it turns out that these these networks have particularly" }, { "start": 1022.36, "end": 1029.84, "text": " have some good properties if you want to capture natural signals and they have" }, { "start": 1029.84, "end": 1034.52, "text": " some bad properties namely that the fact that they are periodic and go down again" }, { "start": 1034.52, "end": 1040.04, "text": " and the reason why they get around the bad properties is because or so they" }, { "start": 1040.04, "end": 1046.04, "text": " claim they initialize the network in a very particular fashion because I think" }, { "start": 1046.04, "end": 1051.28, "text": " at least I when I when I started in deep learning I had this idea so a lot of" }, { "start": 1051.28, "end": 1055.4, "text": " other people must have had this idea too of like hey what if I just replaced a" }, { "start": 1055.4, "end": 1061, "text": " non-linearity with like my sine function could I do something this and then tried" }, { "start": 1061, "end": 1065.96, "text": " it out and it didn't really work so I scrapped that now this here of course" }, { "start": 1065.96, "end": 1071.72, "text": " isn't simply replacing the neural network it's also using the neural" }, { "start": 1071.72, "end": 1075.24, "text": " network for something completely different than I would namely it's using" }, { "start": 1075.24, "end": 1079.4, "text": " the neural network to learn these implicit representations and not like I" }, { "start": 1079.4, "end": 1085.96, "text": " would to do simply for learning a data set but still it seems like you need to" }, { "start": 1085.96, "end": 1094.88, "text": " initialize them fairly with with very careful consideration and we'll go on" }, { "start": 1094.88, "end": 1102.44, "text": " onto that right now so actually they just describe it it's it's not like a" }, { "start": 1102.44, "end": 1110.3600000000001, "text": " it's not very interesting but you need to sample the weights uniformly from" }, { "start": 1110.36, "end": 1118.4399999999998, "text": " this uniform distribution where I think yeah and they have a proof in the" }, { "start": 1118.4399999999998, "end": 1124.9199999999998, "text": " supplementary material where they sort of show why that is so or not here we" }, { "start": 1124.9199999999998, "end": 1129.7199999999998, "text": " propose to draw weights with C equals 6 such that W is in this uniform" }, { "start": 1129.7199999999998, "end": 1137.8, "text": " distribution right here oh no it's different okay this ensures that the" }, { "start": 1137.8, "end": 1141.8, "text": " input to each of the sign activation is normal distributed with a standard" }, { "start": 1141.8, "end": 1145.6, "text": " deviation of one since only a few weights have magnitude larger than pi" }, { "start": 1145.6, "end": 1152.3999999999999, "text": " the frequency throughout the sine work grows only slowly finally we propose" }, { "start": 1152.3999999999999, "end": 1156.46, "text": " to initialize the first layer of the sine network with weights so that the" }, { "start": 1156.46, "end": 1163.56, "text": " sine function spans multiple periods over negative 1 to 1 we found W 0 to" }, { "start": 1163.56, "end": 1168.3999999999999, "text": " equal 30 to work well for all the applications in this work the proposed" }, { "start": 1168.3999999999999, "end": 1171.8999999999999, "text": " initialization scheme yielded fast and robust convergence using the atom" }, { "start": 1171.8999999999999, "end": 1176.32, "text": " optimizer for all experiments in this work so the initialization here takes a" }, { "start": 1176.32, "end": 1180.08, "text": " fairly prominent piece in that paper which tells me maybe that they have" }, { "start": 1180.08, "end": 1184.6399999999999, "text": " spent a lot of time working on this and this is I mean if this is the case this" }, { "start": 1184.6399999999999, "end": 1189.6799999999998, "text": " is to their credit because I guess most people like me would try out something" }, { "start": 1189.68, "end": 1194.3, "text": " like this and then after a while realize it doesn't work and to you know be so" }, { "start": 1194.3, "end": 1200.52, "text": " convinced to go and really figure out how do we need to initialize these to" }, { "start": 1200.52, "end": 1205.6000000000001, "text": " make it work and of course as you're doing this there's still like a 99%" }, { "start": 1205.6000000000001, "end": 1211.28, "text": " chance that it's not going to work once you've done that is quite respectable I" }, { "start": 1211.28, "end": 1214.3600000000001, "text": " find it might have been really different this might have been the first thing" }, { "start": 1214.36, "end": 1220.3999999999999, "text": " they thought about and just worked it out but yeah okay so what what is the" }, { "start": 1220.3999999999999, "end": 1225.86, "text": " deal with all these derivatives now since this network right here has these" }, { "start": 1225.86, "end": 1230.6399999999999, "text": " sine waves in it right so it's a neural network with sine waves as derivatives" }, { "start": 1230.6399999999999, "end": 1238.76, "text": " as nonlinearities what now so we have a neural network what now is the first" }, { "start": 1238.76, "end": 1244.72, "text": " derivative of that neural network right with respect to its input so we have an" }, { "start": 1244.72, "end": 1249.36, "text": " input now what's the first derivative with respect to its input and the cool" }, { "start": 1249.36, "end": 1254.4, "text": " thing about this is what's the first derivative of a sine wave it's of course" }, { "start": 1254.4, "end": 1260.08, "text": " a sine wave that's shifted so it's a cosine which is a sine wave that's" }, { "start": 1260.08, "end": 1265.8, "text": " simply phase shifted and then the next derivative again is a shifted sine wave" }, { "start": 1265.8, "end": 1276.68, "text": " and so on so the derivative of a siren is a siren and that does not hold for" }, { "start": 1276.68, "end": 1284.7, "text": " any of these other nonlinearities so in relu's it's the derivative of a relu" }, { "start": 1284.7, "end": 1289.82, "text": " network is like a con so if you if I take the derivative of this it's like a" }, { "start": 1289.82, "end": 1295.9199999999998, "text": " constant zero right here and then a constant one right here and if I then" }, { "start": 1295.9199999999998, "end": 1300.76, "text": " take the derivative again it's simply a constant zero function right and all" }, { "start": 1300.76, "end": 1305.52, "text": " these other nonlinearities their derivatives are different from" }, { "start": 1305.52, "end": 1312.2, "text": " themselves and here since we want to not only match a signal but also the signals" }, { "start": 1312.2, "end": 1319.4399999999998, "text": " derivatives these property of this siren becoming very very very handy so how do" }, { "start": 1319.44, "end": 1324.3600000000001, "text": " you train a siren we've already alluded to how you would do that in the in the" }, { "start": 1324.3600000000001, "end": 1330, "text": " kind of idea of matching an image where you simply train the pixel values to the" }, { "start": 1330, "end": 1336.42, "text": " RGB values but there's more that you can do with the sirens given that they" }, { "start": 1336.42, "end": 1343.6000000000001, "text": " basically given that their derivatives are also sirens what you can do so with" }, { "start": 1343.6000000000001, "end": 1349.3200000000002, "text": " the image part we've basically neglected all of this we simply said we want to" }, { "start": 1349.32, "end": 1357, "text": " find a relationship between the input X and the output like this what we can" }, { "start": 1357, "end": 1362.6799999999998, "text": " also do is we can say no no no no we want to find a relationship between the" }, { "start": 1362.6799999999998, "end": 1369.76, "text": " input and its first derivative and not even have this as part of the let's say" }, { "start": 1369.76, "end": 1377.24, "text": " of the loss function and then we can see what comes out so that's what they do" }, { "start": 1377.24, "end": 1388.08, "text": " oh can I find it can I find it that's what they do right here okay so here you" }, { "start": 1388.08, "end": 1395.68, "text": " see the the ground truth image and this is its gradients and this is its" }, { "start": 1395.68, "end": 1401.92, "text": " Laplacian okay now we've already seen that we can fit the image itself but" }, { "start": 1401.92, "end": 1409.4, "text": " what if we just fit the first derivative so we simply input this thing right here" }, { "start": 1409.4, "end": 1416.64, "text": " we input this into the siren we do the same thing right the siren is now it" }, { "start": 1416.64, "end": 1424.4, "text": " maps X and Y to RGB but our loss function isn't going to be mapping X and" }, { "start": 1424.4, "end": 1432.68, "text": " Y to RGB our loss function is going to to depend on the gradient of that so our" }, { "start": 1432.68, "end": 1440.76, "text": " loss function is going to be something like the gradient of the image let's" }, { "start": 1440.76, "end": 1449.3200000000002, "text": " call the image I minus the gradient of that function that maps X of this" }, { "start": 1449.32, "end": 1455.08, "text": " function right here okay because we have these auto differentiation tools right" }, { "start": 1455.08, "end": 1460.32, "text": " now we can easily make this into a loss function so here we are looking for the" }, { "start": 1460.32, "end": 1468.08, "text": " function whose gradient matches the gradient of the image right now again" }, { "start": 1468.08, "end": 1472.56, "text": " you can say why is this why can't we just match the image itself and I think" }, { "start": 1472.56, "end": 1478.3999999999999, "text": " valid point but it's not about why can't we just it's about demonstrating the" }, { "start": 1478.4, "end": 1484.44, "text": " power of these networks so if you only match the gradients right what you'll" }, { "start": 1484.44, "end": 1489.1200000000001, "text": " find is if you then look at the function right you still find the function you" }, { "start": 1489.1200000000001, "end": 1495.3200000000002, "text": " don't you don't find the gradient you still train the function you still" }, { "start": 1495.3200000000002, "end": 1500.16, "text": " train the weights of the function itself but the loss function depends on the" }, { "start": 1500.16, "end": 1506.0800000000002, "text": " gradient of that function if you do that you'll find that if you then look at the" }, { "start": 1506.08, "end": 1509.76, "text": " function again you can ask the function to produce the image by simply cycling" }, { "start": 1509.76, "end": 1516.52, "text": " over each of the coordinates you'll find that look at that just by matching the" }, { "start": 1516.52, "end": 1522.8, "text": " gradient you'll match the image itself pretty pretty well right and that's" }, { "start": 1522.8, "end": 1529.6799999999998, "text": " pretty cool now of course you're not going to match the RGB values this is a" }, { "start": 1529.6799999999998, "end": 1534.36, "text": " grayscale image and you know there's a there's kind of a reason for that" }, { "start": 1534.36, "end": 1542.4399999999998, "text": " because since the gradient loses like constant bias information so what if" }, { "start": 1542.4399999999998, "end": 1547.6399999999999, "text": " you'd match an RGB image I'm gonna guess you're going to have like color very" }, { "start": 1547.6399999999999, "end": 1553.24, "text": " much color distortions but and here what you're going to have in this case is" }, { "start": 1553.24, "end": 1562.12, "text": " just distortions in luminosity like if you know that if you have a function if" }, { "start": 1562.12, "end": 1567.28, "text": " you have the derivative of a function and you will want to find the function" }, { "start": 1567.28, "end": 1572.56, "text": " itself and you integrate then the solution is always an entire space of" }, { "start": 1572.56, "end": 1581.2399999999998, "text": " functions because you will integrate the function this thing right here and so" }, { "start": 1581.2399999999998, "end": 1587.56, "text": " with the whatever its input is and you have to add a constant and you don't" }, { "start": 1587.56, "end": 1590.4399999999998, "text": " know what the constant was in the original function because when you" }, { "start": 1590.44, "end": 1595.16, "text": " derive the function the constant drops away so similarly here what we'd expect" }, { "start": 1595.16, "end": 1600.96, "text": " is that the image that we're getting back will be faithful with respect to" }, { "start": 1600.96, "end": 1605.44, "text": " like its its borders right since we're matching the gradient and the gradient" }, { "start": 1605.44, "end": 1610.2, "text": " is basically an edge detector will match the sort of edge information of the" }, { "start": 1610.2, "end": 1614.44, "text": " picture which you can clearly see but what we would expect is some difference" }, { "start": 1614.44, "end": 1620.2, "text": " in overall luminosity and I don't even know what how they exactly did this" }, { "start": 1620.2, "end": 1624.64, "text": " because they now have to choose a constant to add maybe they just chose it" }, { "start": 1624.64, "end": 1628.92, "text": " in some way or maybe they just let the network do but this is you know still" }, { "start": 1628.92, "end": 1632.48, "text": " pretty pretty impressive you can see there's some detail missing but not much" }, { "start": 1632.48, "end": 1638.26, "text": " and the same exact same thing you can do for matching the second derivative so" }, { "start": 1638.26, "end": 1644.2, "text": " now you match the Laplacian of the image and remember in the ReLU networks they" }, { "start": 1644.2, "end": 1647.64, "text": " don't even have a Laplacian it's a constant so this is something you could" }, { "start": 1647.64, "end": 1653.72, "text": " never do and you can see that the upcoming image is still pretty good" }, { "start": 1653.72, "end": 1657.88, "text": " right this are this is now missing the constant luminosity in the first and" }, { "start": 1657.88, "end": 1663.88, "text": " second derivative sorry in the in the zero with and first derivative and still" }, { "start": 1663.88, "end": 1670.88, "text": " the information is the the reconstruction is pretty good alright so" }, { "start": 1670.88, "end": 1675.96, "text": " these demonstrates kind of the power of these networks again we're not having" }, { "start": 1675.96, "end": 1680.92, "text": " our data set our entire data set is just this image so if we fit something then" }, { "start": 1680.92, "end": 1687.4, "text": " this thing right here is our entire data set there's no there's no big data set" }, { "start": 1687.4, "end": 1692.1200000000001, "text": " and this is a test sample like this is the data set and the test sample at the" }, { "start": 1692.1200000000001, "end": 1696.1200000000001, "text": " same I guess you can consider the Laplacian here the data set and then" }, { "start": 1696.1200000000001, "end": 1703.44, "text": " the actual image is the test sample like the label or something like this so what" }, { "start": 1703.44, "end": 1708.96, "text": " does that buy you here is a thing you can do if you want to mix two images what" }, { "start": 1708.96, "end": 1713.92, "text": " do you do so if you want to mix this and this what you could do is linearly" }, { "start": 1713.92, "end": 1720.48, "text": " interpolate but that would be not very cool because right here you have a lot" }, { "start": 1720.48, "end": 1726.44, "text": " of like very bright pixels which probably have like values of one and here" }, { "start": 1726.44, "end": 1730.88, "text": " you'd have the dark pixels which probably have values like more close to" }, { "start": 1730.88, "end": 1736.1200000000001, "text": " zero and the if you simply mix them if you simply add them together and divide" }, { "start": 1736.1200000000001, "end": 1742.1200000000001, "text": " by two then you get kind of get a wash of the two and similarly here you kind" }, { "start": 1742.1200000000001, "end": 1746.3200000000002, "text": " of wash out the bear because you'd have some pixel values here that would come" }, { "start": 1746.3200000000002, "end": 1752.3200000000002, "text": " over and generally not not a good idea to mix images like this now you know" }, { "start": 1752.3200000000002, "end": 1758.0800000000002, "text": " with GANs we can do this but we have to have like a training data set and so on" }, { "start": 1758.08, "end": 1764.08, "text": " here what we'll say is we'll simply say we'll take the gradient of this and" }, { "start": 1764.08, "end": 1770, "text": " we'll take the gradient of this and then we'll add the two gradient maps now what" }, { "start": 1770, "end": 1774.56, "text": " this does is that as you can see right here on the left is the composite" }, { "start": 1774.56, "end": 1782.24, "text": " gradients and what this does is right here in the sky there is no gradient" }, { "start": 1782.24, "end": 1788.52, "text": " information in this image because it's just a flat patch of sky right so and" }, { "start": 1788.52, "end": 1793.4, "text": " down maybe down here there's not that much gradient information there is a bit" }, { "start": 1793.4, "end": 1798.84, "text": " right but not here so that's where this bear head is and if you want to mix" }, { "start": 1798.84, "end": 1805.32, "text": " images like it can be a good idea to mix their gradients because generally the" }, { "start": 1805.32, "end": 1810.68, "text": " information in an image is where the gradients are so what we would expect" }, { "start": 1810.68, "end": 1818.3600000000001, "text": " the gradient to represent the gradient would carry over this portion it would" }, { "start": 1818.3600000000001, "end": 1822, "text": " maybe carry over a bit of this portion it would carry over this portion and" }, { "start": 1822, "end": 1825.96, "text": " this portion so everything where the signal is not flat so here you can see" }, { "start": 1825.96, "end": 1834.5600000000002, "text": " the composite gradient and if we fit again we fit our function such that the" }, { "start": 1834.5600000000002, "end": 1840, "text": " gradient of the function that we fit matches this mixed gradient right here" }, { "start": 1840, "end": 1845.44, "text": " then this is the gradient of the function that we match and this is the" }, { "start": 1845.44, "end": 1852.92, "text": " actual function and you can see pretty pretty good right it basically mixed" }, { "start": 1852.92, "end": 1858.08, "text": " everywhere where there was gradient and this is now just reconstructed from this" }, { "start": 1858.08, "end": 1863.2, "text": " gradient there is no I think there is no as least as I understand it there is no" }, { "start": 1863.2, "end": 1867.68, "text": " pixel information carried over from either of those images they're simply" }, { "start": 1867.68, "end": 1874.8400000000001, "text": " added to this gradient the gradient is fit and then the function is asked to" }, { "start": 1874.8400000000001, "end": 1883.88, "text": " output pixel value at each location and that's that okay so this is just a simple" }, { "start": 1883.88, "end": 1890.92, "text": " you know thing that you can play around with but they do they do other more" }, { "start": 1890.92, "end": 1898.3200000000002, "text": " interesting things right here for example this representing shapes with" }, { "start": 1898.3200000000002, "end": 1904.3600000000001, "text": " signed distance functions so if you go over the formulation the actual" }, { "start": 1904.3600000000001, "end": 1908.16, "text": " formulation of their loss function we haven't actually done this right quite" }, { "start": 1908.16, "end": 1916.24, "text": " yet it's here it's very complicatedly stated but ultimately what this means" }, { "start": 1916.24, "end": 1925.28, "text": " is so a component right here is are these CM which are constraints so this" }, { "start": 1925.28, "end": 1929.2, "text": " loss function operates on these constraints and the constraints are" }, { "start": 1929.2, "end": 1935, "text": " across a of X which basically it's just X it's kind of a the anything depending" }, { "start": 1935, "end": 1941.24, "text": " on the input itself then the output of the function the gradient of the output" }, { "start": 1941.24, "end": 1946.92, "text": " of the function the second derivative third derivative and so on so this these" }, { "start": 1946.92, "end": 1953.28, "text": " sirens can fit anything that you can formulate as a set of constraints that" }, { "start": 1953.28, "end": 1960, "text": " relate the input of the function right here to its output or any of its" }, { "start": 1960, "end": 1964.96, "text": " derivatives and we've already seen that at once we if we fit an image our only" }, { "start": 1964.96, "end": 1971.3600000000001, "text": " constraint is that these things match right here with the original image that" }, { "start": 1971.3600000000001, "end": 1977.24, "text": " the coordinates are mapped to the RGB values then when we match the gradients" }, { "start": 1977.24, "end": 1982.3600000000001, "text": " we don't care about this we only care about the relation between this and so" }, { "start": 1982.3600000000001, "end": 1987.96, "text": " on so the loss function is literally just over the entire signal space which" }, { "start": 1987.96, "end": 1994.08, "text": " in our case was was over the entire image we want these constraints to hold" }, { "start": 1994.08, "end": 1998.28, "text": " or to be as small as possible or the constraints are always formulate such" }, { "start": 1998.28, "end": 2005.08, "text": " that if they are fulfilled they equal zero and so the for example the L2 loss" }, { "start": 2005.08, "end": 2011.52, "text": " between the RGB values of the true image and the RGB values that you fit the RGB" }, { "start": 2011.52, "end": 2016.6799999999998, "text": " loss sorry the L2 loss would be a constraint like this and of course the" }, { "start": 2016.6799999999998, "end": 2021.6, "text": " more differentiable you make it the more the easier this network has at fitting" }, { "start": 2021.6, "end": 2027.1999999999998, "text": " it right so that's why there is this norm right here but it's not that" }, { "start": 2027.1999999999998, "end": 2033.32, "text": " complicated it simply says whatever you can formulate as a constraint on" }, { "start": 2033.32, "end": 2039.32, "text": " relating the inputs to the outputs or any of the derivatives of this implicit" }, { "start": 2039.32, "end": 2046.1599999999999, "text": " representation that is the loss function all right so the in the next interesting" }, { "start": 2046.1599999999999, "end": 2050.36, "text": " thing we can do as I said is representing shapes with signed distance" }, { "start": 2050.36, "end": 2058.92, "text": " functions so we're going to go slowly and this is yeah it's not that hard" }, { "start": 2058.92, "end": 2063.2000000000003, "text": " inspired by recent work on shape representation with differentiable" }, { "start": 2063.2000000000003, "end": 2069.92, "text": " signed distance functions as the F's we fit SDFs directly on oriented point" }, { "start": 2069.92, "end": 2076.6, "text": " clouds using both ReLU based implicit neural representations and sirens okay" }, { "start": 2076.6, "end": 2082.92, "text": " so what is an SDF a signed distance function that's pretty easy a signed" }, { "start": 2082.92, "end": 2092.44, "text": " distance function is simply a distance function with a sign like wow so a a if" }, { "start": 2092.44, "end": 2096.6, "text": " you have a and it's usually done if you have like a boundary somewhere between" }, { "start": 2096.6, "end": 2103.52, "text": " things then of course any point here has a distance to the boundary but you if" }, { "start": 2103.52, "end": 2108.12, "text": " you have a signed distance function it simply means that each point also has a" }, { "start": 2108.12, "end": 2112.36, "text": " sign in front of it and that means all the things on one side of the boundary" }, { "start": 2112.36, "end": 2117.8, "text": " maybe have a plus and all the things on the other side maybe have a minus so" }, { "start": 2117.8, "end": 2122.72, "text": " even though two points could be the same distance from the boundary one is like" }, { "start": 2122.72, "end": 2130.64, "text": " plus five away and one is negative five away and you can do this this is useful" }, { "start": 2130.64, "end": 2135.6, "text": " for example when you fit point clouds as they do in this example so when they" }, { "start": 2135.6, "end": 2141.8399999999997, "text": " have point clouds and that's usually in 3d space but if you have point clouds" }, { "start": 2141.8399999999997, "end": 2147.8799999999997, "text": " you basically have points right here and you know that the points should" }, { "start": 2147.8799999999997, "end": 2153.96, "text": " represent some kind of shape maybe a wall or so they have these room" }, { "start": 2153.96, "end": 2160.76, "text": " interiors as you can see right here so this is a 3d scene but you only have a" }, { "start": 2160.76, "end": 2165.2, "text": " point cloud of the 3d scene and what that means is that maybe you were in" }, { "start": 2165.2, "end": 2170.4, "text": " this room and you put up a laser scanner right here laser scanner I don't know" }, { "start": 2170.4, "end": 2175.8, "text": " how a laser scanner looks and the laser scanner kind of shoots lasers at random" }, { "start": 2175.8, "end": 2180.32, "text": " locations and always measures the distance right and that's that's how you" }, { "start": 2180.32, "end": 2185.56, "text": " end up with a point cloud so you'll end up with like a point cloud where in 3d" }, { "start": 2185.56, "end": 2190.28, "text": " space you know where the laser hit something and a reasonable assumption to" }, { "start": 2190.28, "end": 2195.32, "text": " make if you have like a dense sampling of this is that you should be able to" }, { "start": 2195.32, "end": 2202.1600000000003, "text": " like connect those point clouds in some way to obtain the actual continuous" }, { "start": 2202.1600000000003, "end": 2208.32, "text": " shape of the thing that you measured and this is what we're going to try to do" }, { "start": 2208.32, "end": 2215.7200000000003, "text": " with these sirens right to go from point clouds to shape by training an implicit" }, { "start": 2215.7200000000003, "end": 2220.88, "text": " representation so we're going to train a neural network that represents this" }, { "start": 2220.88, "end": 2229.2000000000003, "text": " shape right here basically by mapping coordinates to to signed distance values" }, { "start": 2229.2000000000003, "end": 2237.1800000000003, "text": " so whenever we ask the neural network what at this location here what's the" }, { "start": 2237.18, "end": 2242.7999999999997, "text": " signed distance and it's going to tell us oh it's plus 5 or at this location" }, { "start": 2242.7999999999997, "end": 2247.12, "text": " here what's the sign distance it's going to tell us it's 0 right so we're going" }, { "start": 2247.12, "end": 2258.64, "text": " to we're going to train a neural network to do that and hello yes no okay so this" }, { "start": 2258.64, "end": 2264.2799999999997, "text": " is a bit more complicated and since we have these awesome power of these sirens" }, { "start": 2264.28, "end": 2275.28, "text": " we can also do to more constraints so we know and this goes on this amounts to" }, { "start": 2275.28, "end": 2281.2000000000003, "text": " solving a particular iconal boundary value problem that constrains the norm" }, { "start": 2281.2000000000003, "end": 2286.7200000000003, "text": " of spatial gradients to be one almost everywhere so this iconal boundary value" }, { "start": 2286.7200000000003, "end": 2293.2000000000003, "text": " problem this is a property of signed distance function that the norm of the" }, { "start": 2293.2, "end": 2298.48, "text": " gradients with respect to the input is one almost everywhere almost everywhere" }, { "start": 2298.48, "end": 2303.12, "text": " means everywhere I guess except at the boundary itself where the distance is 0" }, { "start": 2303.12, "end": 2306.12, "text": " though I could be wrong" }, { "start": 2306.12, "end": 2313.96, "text": " note that relu networks are seeming seemingly ideal for representing sdfs as" }, { "start": 2313.96, "end": 2318.72, "text": " their gradients are locally constant and their second derivatives are 0" }, { "start": 2318.72, "end": 2322.3999999999996, "text": " adequate training procedure for working directly with point clouds were" }, { "start": 2322.4, "end": 2328.2000000000003, "text": " described in prior work we fit a siren to an oriented point cloud using a loss" }, { "start": 2328.2000000000003, "end": 2333.36, "text": " of the form and now we look at the loss so the first thing you observe in the" }, { "start": 2333.36, "end": 2337.2400000000002, "text": " loss is that it is made of three different integrals and that simply means" }, { "start": 2337.2400000000002, "end": 2344.2400000000002, "text": " they now partition the space right here they partition it into two different" }, { "start": 2344.2400000000002, "end": 2351.44, "text": " they partition it into two different regions so to say so maybe go here" }, { "start": 2351.44, "end": 2357.96, "text": " no can I zoom here so the first region is going to be whatever is on the" }, { "start": 2357.96, "end": 2362.36, "text": " boundary itself right and that's basically wherever a point wherever a" }, { "start": 2362.36, "end": 2366.56, "text": " point hit right whenever you have a point or on the boundary itself that's" }, { "start": 2366.56, "end": 2373.7200000000003, "text": " going to be your omega 0 is going to be that and then all the other points right" }, { "start": 2373.7200000000003, "end": 2380.2400000000002, "text": " here are going to be part of your omega without the omega 0 so you're going to" }, { "start": 2380.24, "end": 2383.72, "text": " have different constraints for all of these things right here for example and" }, { "start": 2383.72, "end": 2389.4399999999996, "text": " I have to pay attention that I don't say anything wrong you'll have this this" }, { "start": 2389.4399999999996, "end": 2398.64, "text": " constraint of this gradient my tablet maybe I'll start monetizing just so I" }, { "start": 2398.64, "end": 2408.8799999999997, "text": " can get a new tablet okay so no okay the this this condition right here says that" }, { "start": 2408.88, "end": 2413.7200000000003, "text": " the gradient should be one and that's actually everywhere right so I was wrong" }, { "start": 2413.7200000000003, "end": 2423.8, "text": " that the gradient is only one outside the boundary then you can see right here" }, { "start": 2424.44, "end": 2431.6800000000003, "text": " the last part is all the points that are not on the boundary since our network" }, { "start": 2431.6800000000003, "end": 2436.84, "text": " maps any point in 3d space to assign distance function so most of these" }, { "start": 2436.84, "end": 2441.1200000000003, "text": " points aren't going to be on the boundary itself even though in the mini" }, { "start": 2441.1200000000003, "end": 2447.6800000000003, "text": " batch where we train where they train they sample points on and off the on and" }, { "start": 2447.6800000000003, "end": 2453.76, "text": " off the boundary at the at equal rates just to to have the network train more" }, { "start": 2453.76, "end": 2460.88, "text": " stably so this is a condition on all the points off of the boundary and they say" }, { "start": 2460.88, "end": 2468.36, "text": " here this function is this exponential function with alpha larger than 1 it" }, { "start": 2468.36, "end": 2475.44, "text": " penalizes off surface points for creating SDF values close to 0 so this" }, { "start": 2475.44, "end": 2482.1600000000003, "text": " is simply a regularizer that says whenever I input coordinates that are" }, { "start": 2482.1600000000003, "end": 2487.2000000000003, "text": " far away from the boundary from the surface then there should be a large" }, { "start": 2487.2, "end": 2492.3599999999997, "text": " sign distance function like it should not be close to zero because it's away" }, { "start": 2492.3599999999997, "end": 2496.96, "text": " from a boundary okay and in practice how you're going to train this is if you" }, { "start": 2496.96, "end": 2502.12, "text": " have a point cloud if your coordinates are far away from the next point then" }, { "start": 2502.12, "end": 2508.3199999999997, "text": " this this is going to be a high this should be a high value otherwise the" }, { "start": 2508.3199999999997, "end": 2513.96, "text": " network is penalized so we have this condition right here on the gradients" }, { "start": 2513.96, "end": 2518.28, "text": " which we know sign distance function should fulfill we have this thing right" }, { "start": 2518.28, "end": 2522.96, "text": " here which is a regularizer basically telling points far away from our data" }, { "start": 2522.96, "end": 2526.96, "text": " that they should have a high distance function and then we have this last" }, { "start": 2526.96, "end": 2533.68, "text": " thing right here which is for all the points on the surface itself here's what" }, { "start": 2533.68, "end": 2541.36, "text": " will what we require first of all we require their value to be zero or close" }, { "start": 2541.36, "end": 2545.2000000000003, "text": " to zero right this is the loss function so we want to minimize this and this is" }, { "start": 2545.2000000000003, "end": 2549.56, "text": " simply the output value so the sign distance function of points on the" }, { "start": 2549.56, "end": 2552.88, "text": " surface you know the things we actually measure they should be zero right" }, { "start": 2552.88, "end": 2556.96, "text": " because the sign distance function measures how far away from the surface" }, { "start": 2556.96, "end": 2565.6400000000003, "text": " you are so this is pretty intuitive but then also this right here it says that" }, { "start": 2565.64, "end": 2573.3199999999997, "text": " the gradient of the sign distance function and the normal vector of that" }, { "start": 2573.3199999999997, "end": 2580.12, "text": " point should align and that basically means and this is now I think this is" }, { "start": 2580.12, "end": 2586.7999999999997, "text": " because we have an oriented point cloud or no yes so what we can do is we can" }, { "start": 2586.7999999999997, "end": 2592.2799999999997, "text": " kind of connect points next to each other and then calculate the normal" }, { "start": 2592.28, "end": 2600.28, "text": " vectors of that right and the signed the network if we ask the network hey what" }, { "start": 2600.28, "end": 2604.76, "text": " do you think about this position right here the network should tell us first of" }, { "start": 2604.76, "end": 2609.52, "text": " all the sign distance function should be zero because it's on the boundary" }, { "start": 2609.52, "end": 2616.5600000000004, "text": " second of all the norm of the gradient of the sign distance function at that" }, { "start": 2616.5600000000004, "end": 2620.1600000000003, "text": " point should be one because that's a property of sign distance function and" }, { "start": 2620.16, "end": 2627.12, "text": " third and that's the thing right now the gradient of the sign distance function" }, { "start": 2627.12, "end": 2633.96, "text": " should align with this normal vector right and that's you know pretty" }, { "start": 2633.96, "end": 2638.72, "text": " intuitive because you want you want the sign distance function to increase in" }, { "start": 2638.72, "end": 2643.56, "text": " value the gradient basically tells you where the highest increase in value of" }, { "start": 2643.56, "end": 2648.16, "text": " the function is you want it to increase along the normal direction and not along" }, { "start": 2648.16, "end": 2653.56, "text": " any other direction so that's a pretty good pretty good constraint to have so" }, { "start": 2653.56, "end": 2658, "text": " you can see right here I mean you don't really have to understand exactly about" }, { "start": 2658, "end": 2661.72, "text": " sign distance functions and so on but these sirens are pretty good at" }, { "start": 2661.72, "end": 2665.24, "text": " capturing all of these different constraints and this was a point you" }, { "start": 2665.24, "end": 2670.24, "text": " know on the surface points off the surface you additionally say hey you" }, { "start": 2670.24, "end": 2674.2, "text": " should have a pretty high value and actually not a zero value but a pretty" }, { "start": 2674.2, "end": 2682.56, "text": " high value so and again we only fit one particular scene we only ever fit one" }, { "start": 2682.56, "end": 2688.2799999999997, "text": " scene with an entire network so the entire neural network this this this" }, { "start": 2688.2799999999997, "end": 2693.3599999999997, "text": " whole structure right here everything is captured by this neural network that we" }, { "start": 2693.3599999999997, "end": 2699.08, "text": " train on the point cloud and you can see that if you use a relu what you'll get" }, { "start": 2699.08, "end": 2706.56, "text": " is super super wobbly because if even if you train the relu with the same loss" }, { "start": 2706.56, "end": 2711.24, "text": " function these constraints on the gradients they're just not going to" }, { "start": 2711.24, "end": 2714.92, "text": " work out with the relu because the gradients are like constant and" }, { "start": 2714.92, "end": 2720.92, "text": " discontinuous right whereas the siren can basically fulfill all of these" }, { "start": 2720.92, "end": 2725.96, "text": " constraints on the different parts like on the values and on the gradients of" }, { "start": 2725.96, "end": 2731.32, "text": " that of the loss function and they have another example right here where they" }, { "start": 2731.32, "end": 2739.36, "text": " fit this shape yeah so you see all the details are preserved way better where" }, { "start": 2739.36, "end": 2744.28, "text": " the relu's they'll simply kind of flatten over everything and make it" }, { "start": 2744.28, "end": 2751.88, "text": " wobbly alright so I hope this sort of made sense and we'll go to the last" }, { "start": 2751.88, "end": 2755.56, "text": " thing right now" }, { "start": 2755.56, "end": 2759.52, "text": " it is restarting I wanted to show you the website right here they have for" }, { "start": 2759.52, "end": 2763.7599999999998, "text": " this it's a pretty cool website to go along with it and as you can see right" }, { "start": 2763.7599999999998, "end": 2769.7999999999997, "text": " here they have all these samples that they have in the paper but also in an" }, { "start": 2769.7999999999997, "end": 2774.56, "text": " animated format in as you can see right here this is the fitting process the" }, { "start": 2774.56, "end": 2781, "text": " learning process of how you represent these images so as I said there you want" }, { "start": 2781, "end": 2784.96, "text": " to fit these functions to the ground truth and that happens in steps so this" }, { "start": 2784.96, "end": 2788.98, "text": " is very much like you would learn a deep learning functions I think they use the" }, { "start": 2788.98, "end": 2793.84, "text": " atom optimizer it's just that the data set now comes all comes from this one" }, { "start": 2793.84, "end": 2798.64, "text": " ground truth image and you can see that the siren network on the right pretty" }, { "start": 2798.64, "end": 2805.6, "text": " quickly zeros in on the on the image and then gets the details subsequently right" }, { "start": 2805.6, "end": 2812.52, "text": " they also represent audio with this and you can watch that they represent video" }, { "start": 2812.52, "end": 2819.28, "text": " compare that to relu representations then here solving the possum equation is" }, { "start": 2819.28, "end": 2825.56, "text": " where you only fit the gradients or the laplacian of an image and still get out" }, { "start": 2825.56, "end": 2834.88, "text": " the good image that's pretty cool and here you can see that you can actually" }, { "start": 2834.88, "end": 2842.08, "text": " play around with these things so you can click on them and look at this" }, { "start": 2842.08, "end": 2847.04, "text": " look at this learned thing so on the left you can see what the siren network" }, { "start": 2847.04, "end": 2852.08, "text": " learned and let's scroll down here a bit and on the right is a relu" }, { "start": 2852.08, "end": 2856.64, "text": " representation of the same thing so this is the same network with the same" }, { "start": 2856.64, "end": 2861.56, "text": " objective it just has relu instead of sine waves as activation functions so" }, { "start": 2861.56, "end": 2865.96, "text": " you can see how much of a difference that makes right here and the middle is" }, { "start": 2865.96, "end": 2871.6, "text": " a relu with the positional encodings still not good right the only the only" }, { "start": 2871.6, "end": 2877, "text": " thing right here that you have to think of if you look at how big these sirens" }, { "start": 2877, "end": 2881.2, "text": " are how many parameters they have they're about at the order of magnitude" }, { "start": 2881.2, "end": 2889.2799999999997, "text": " of how many pixels there are in the image so I'm yeah it's certainly a cool" }, { "start": 2889.2799999999997, "end": 2896.7599999999998, "text": " method but to like these it's not like you're the implicit representation here" }, { "start": 2896.7599999999998, "end": 2900.08, "text": " is very very well at generalizing though it would be very cool to see what" }, { "start": 2900.08, "end": 2905.7599999999998, "text": " happens outside right if you because now you have you can input any XY coordinates" }, { "start": 2905.7599999999998, "end": 2910.56, "text": " so technically you could continue the picture to the bottom and just see what" }, { "start": 2910.56, "end": 2915.04, "text": " the siren thinks should be here at the bottom so all of these things would be" }, { "start": 2915.04, "end": 2919.4, "text": " pretty pretty cool to actually experiment with and they have the code" }, { "start": 2919.4, "end": 2924.64, "text": " available to do that and you can see the fitting process of the Helmholtz" }, { "start": 2924.64, "end": 2930.3599999999997, "text": " equation right here and related projects pretty cool website I definitely invite" }, { "start": 2930.3599999999997, "end": 2936.16, "text": " you to check it out and let's go back to the paper and we're back and my tablet" }, { "start": 2936.16, "end": 2941.8799999999997, "text": " crashed and let's continue so they're now going on to use sirens in order to" }, { "start": 2941.8799999999997, "end": 2948.92, "text": " solve PDEs and so in physics often you have these problems where you are given" }, { "start": 2948.92, "end": 2952.68, "text": " an equation but the equation doesn't necessarily involve a function itself" }, { "start": 2952.68, "end": 2957.8399999999997, "text": " but only involves derivatives of that function like or relates derivatives to" }, { "start": 2957.8399999999997, "end": 2963.04, "text": " the function and so on so one example here is this Helmholtz equation that's" }, { "start": 2963.04, "end": 2971.08, "text": " given as this where the I think the the F is a known function but this is the" }, { "start": 2971.08, "end": 2976.16, "text": " wave field we want to you want to get you want to figure out which is unknown" }, { "start": 2976.16, "end": 2983.2, "text": " and then this HM is including for example this right here which is the" }, { "start": 2983.2, "end": 2991.6, "text": " Laplace operator so you're given the relation between the function and a Laplace" }, { "start": 2991.6, "end": 2996.7599999999998, "text": " operator of the wave that you want to find out and your task is to recover the" }, { "start": 2996.7599999999998, "end": 3002.24, "text": " wave now I don't want to go very much into this right here but what you can do" }, { "start": 3002.24, "end": 3008.4799999999996, "text": " is basically you can measure you can have a room and you can have" }, { "start": 3008.4799999999996, "end": 3014.3599999999997, "text": " measurements of the wave or of its derivatives and so on and then you kind" }, { "start": 3014.3599999999997, "end": 3020, "text": " of calculate backwards from the measurements to what the actual wave" }, { "start": 3020, "end": 3027.52, "text": " was and these sirens turn out to be very very good at things like this and I" }, { "start": 3027.52, "end": 3032.92, "text": " guess that's in this solving for the wave field things but essentially what" }, { "start": 3032.92, "end": 3040.36, "text": " this amounts to is a numerical solution of these partial differential" }, { "start": 3040.36, "end": 3047.04, "text": " equations in physics using these sirens and that's pretty cool and the last" }, { "start": 3047.04, "end": 3052.48, "text": " thing they do is and this gets back to a more of the machine learning context" }, { "start": 3052.48, "end": 3058.12, "text": " where they say learning a space of implicit functions so now they go ahead" }, { "start": 3058.12, "end": 3065.28, "text": " and say yeah so we can represent images in terms of these of these functions" }, { "start": 3065.28, "end": 3069.32, "text": " right but each image is basically its own function so each image is basically" }, { "start": 3069.32, "end": 3076.12, "text": " an optimization a fitting problem can we somehow learn functions of functions so" }, { "start": 3076.12, "end": 3081.44, "text": " this goes this comes now back to more of a machine learning context where you say" }, { "start": 3081.44, "end": 3097.2200000000003, "text": " ah so I I have a network right here that I have a network that gives me the" }, { "start": 3097.2200000000003, "end": 3104.4, "text": " parameters of the siren so this right here is okay let's let's go to an" }, { "start": 3104.4, "end": 3112.6, "text": " example in this example what you'll have is you'll have an image like this one" }, { "start": 3112.6, "end": 3120, "text": " where a few pixels are masked actually most of the pixels are masked and you" }, { "start": 3120, "end": 3129.36, "text": " want to put this into a CNN and the CNN should output the parameters of the" }, { "start": 3129.36, "end": 3136.2400000000002, "text": " siren network so the parameters because the the siren network given its" }, { "start": 3136.2400000000002, "end": 3144.1200000000003, "text": " parameters is the image itself so that's the siren I said siren network the siren" }, { "start": 3144.1200000000003, "end": 3152.6400000000003, "text": " is the image if you know its parameters right so here you train a CNN to give" }, { "start": 3152.6400000000003, "end": 3158.6800000000003, "text": " you the parameters of the siren that's almost the same as training a CNN to" }, { "start": 3158.68, "end": 3165.3999999999996, "text": " give you the image directly but again we don't want to have the explicit" }, { "start": 3165.3999999999996, "end": 3168.8799999999997, "text": " representation of an image we want to have the implicit representation such" }, { "start": 3168.8799999999997, "end": 3174.2799999999997, "text": " that it's continuous and we can manipulate it and so on so the CNN is" }, { "start": 3174.2799999999997, "end": 3180.6, "text": " now trained on a data set so you take C for 10 and you construct a whole bunch" }, { "start": 3180.6, "end": 3188.3199999999997, "text": " of of images with only kind of a hundred pixels remaining and then you train a" }, { "start": 3188.32, "end": 3193.6400000000003, "text": " CNN to give you the parameters of the siren that would reconstruct the ground" }, { "start": 3193.6400000000003, "end": 3198.28, "text": " truth right and then you can test that on the test image and you can see right" }, { "start": 3198.28, "end": 3203.2000000000003, "text": " here the results are pretty good so these are test samples these are now" }, { "start": 3203.2000000000003, "end": 3210.2000000000003, "text": " these are now images that were not seen during training of this CNN and therefore" }, { "start": 3210.2000000000003, "end": 3216.4, "text": " the upcoming siren also hasn't seen that image it's the siren is simply" }, { "start": 3216.4, "end": 3220.84, "text": " parameterized by the CNN you can see this works pretty well so even if you" }, { "start": 3220.84, "end": 3227.96, "text": " only have 10 pixels you already get something out of it right and if you have" }, { "start": 3227.96, "end": 3232.6800000000003, "text": " a hundred pixel you already get fairly close to the to the ground truth right" }, { "start": 3232.6800000000003, "end": 3237.84, "text": " here now this is not gam quality images of course but it's pretty impressive to" }, { "start": 3237.84, "end": 3243.92, "text": " see that an implicit parameter ization an implicit representation of the images" }, { "start": 3243.92, "end": 3251.7200000000003, "text": " can be so powerful right yeah so this this is a pretty cool thing and again" }, { "start": 3251.7200000000003, "end": 3257.76, "text": " it's it's better than it's it's kind of more back to the machine learning" }, { "start": 3257.76, "end": 3261.44, "text": " framework that you're used to because there's a train and a test data set and" }, { "start": 3261.44, "end": 3267.12, "text": " now the only thing is that the output is a function given by its parameters and" }, { "start": 3267.12, "end": 3274.8399999999997, "text": " not the actual pixel values okay so let's let's look at the broader impact" }, { "start": 3274.8399999999997, "end": 3279.88, "text": " statement the proposed siren representation enables accurate" }, { "start": 3279.88, "end": 3285.24, "text": " representations of natural signals such as images audio and video in a deep" }, { "start": 3285.24, "end": 3290.52, "text": " learning framework this may be an enabler for downstream tasks involving" }, { "start": 3290.52, "end": 3295.04, "text": " such signals such as classification for images or speech to text systems for" }, { "start": 3295.04, "end": 3299.56, "text": " audio such applications may be leveraged for both positive and negative ends" }, { "start": 3299.56, "end": 3304.88, "text": " siren may in the future further enable novel approaches to the generation of" }, { "start": 3304.88, "end": 3309.7599999999998, "text": " such signals this has potential for misuse in impersonating actors without" }, { "start": 3309.7599999999998, "end": 3313.6, "text": " their consent for an in-depth discussion of so-called deep fakes we refer the" }, { "start": 3313.6, "end": 3319, "text": " reader to a recent review article in your neural rendering this has this has" }, { "start": 3319, "end": 3327.52, "text": " like no perplexity like no perplexity at all like is anyone benefited by this" }, { "start": 3327.52, "end": 3334.16, "text": " seriously okay but at least we made the authors think of the consequences of" }, { "start": 3334.16, "end": 3341.32, "text": " their research yeah so I invite you to check out this paper maybe with this" }, { "start": 3341.32, "end": 3346.84, "text": " right now you can follow a bit better what happens here this is a different" }, { "start": 3346.84, "end": 3350.7200000000003, "text": " paradigm of research it's a cool paradigm it's away from your usual" }, { "start": 3350.7200000000003, "end": 3358, "text": " machine learning framework and yeah so I'm excited what happens next in this I" }, { "start": 3358, "end": 3361.2000000000003, "text": " also invite you to check out the websites they have lots of videos and" }, { "start": 3361.2, "end": 3377.72, "text": " goodies and so on and with that bye bye" } ]
2lkUNDZld-4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Big Self-Supervised Models are Strong Semi-Supervised Learners (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "cnn", "resnet", "simclr", "simclr2", "simclrv2", "simclr v2", "v2", "hinton", "geoff", "brain", "wide", "deep", "convolutional", "convolutions", "self-supervised", "contrastive", "moco", "momentum", "projection", "semi-supervised", "unsupervised", "distillation", "teacher", "student" ]
This paper proposes SimCLRv2 and shows that semi-supervised learning benefits a lot from self-supervised pre-training. And stunningly, that effect gets larger the fewer labels are available and the more parameters the model has. OUTLINE: 0:00 - Intro & Overview 1:40 - Semi-Supervised Learning 3:50 - Pre-Training via Self-Supervision 5:45 - Contrastive Loss 10:50 - Retaining Projection Heads 13:10 - Supervised Fine-Tuning 13:45 - Unsupervised Distillation & Self-Training 18:45 - Architecture Recap 22:25 - Experiments 34:15 - Broader Impact Paper: https://arxiv.org/abs/2006.10029 Code: https://github.com/google-research/simclr Abstract: One paradigm for learning from few labeled examples while making best use of a large amount of unlabeled data is unsupervised pretraining followed by supervised fine-tuning. Although this paradigm uses unlabeled data in a task-agnostic way, in contrast to most previous approaches to semi-supervised learning for computer vision, we show that it is surprisingly effective for semi-supervised learning on ImageNet. A key ingredient of our approach is the use of a big (deep and wide) network during pretraining and fine-tuning. We find that, the fewer the labels, the more this approach (task-agnostic use of unlabeled data) benefits from a bigger network. After fine-tuning, the big network can be further improved and distilled into a much smaller one with little loss in classification accuracy by using the unlabeled examples for a second time, but in a task-specific way. The proposed semi-supervised learning algorithm can be summarized in three steps: unsupervised pretraining of a big ResNet model using SimCLRv2 (a modification of SimCLR), supervised fine-tuning on a few labeled examples, and distillation with unlabeled examples for refining and transferring the task-specific knowledge. This procedure achieves 73.9\% ImageNet top-1 accuracy with just 1\% of the labels (≤13 labeled images per class) using ResNet-50, a 10× improvement in label efficiency over the previous state-of-the-art. With 10\% of labels, ResNet-50 trained with our method achieves 77.5\% top-1 accuracy, outperforming standard supervised training with all of the labels. Authors: Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, Geoffrey Hinton Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at big self-supervised models are strong semi-supervised learners by Ting Chen, Simon Kornblith, Kevin Swirsky, Mohamed Nourouzi 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 this Sinclair v2, which is a modification of Sinclair, and we'll go over that, but they also try to make like a scientific claim, namely that 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. This basically means that you have a data set, and you only have labels for a part of that data set. So this could be like here, the bottom 10% or so, because labels might be expensive to get. And so you only have a few of them, but you have much more data that's unlabeled. Now sometimes this problem is formulated as this here is your data set, and then this here is like a different data set, but one that's close enough such that you can learn from it. And that's usually in NLP. You'll have your data set is like a sentiment classification task, but you have all of Wikipedia that is not labeled, but it's just text. So you can sort of pre-train on it. In this case, we'll be in a situation where we'll artificially construct a small data set. So this entire thing here is going to be the ImageNet data set, and this right here is going to be our labeled portion, like we have labels. Now usually one has labels for ImageNet as well, but we artificially restrict ourselves to simulate a situation where we have lots of data and we only have a fixed budget. So we can only, because to obtain labels, oftentimes you have to ask humans to label images. And let's say we are a company and we've collected this big data set, but we only have like maybe 500 bucks on Amazon Mechanical Turk, and we only managed to get a very like 1% of our data set labeled. Now we're in the regime of semi-supervised learning. This is slightly different from what NLP does. As I said, in NLP, usually assume you have different data sets, the large one being a 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 OpenAI's ImageGPT that kind of goes into the same direction as this work right here that basically says pre-training on unlabeled data, like this whole data set without the labels, can be a very good preconditioner for fine tuning later. And this paper says the same thing. So basically, in the good old days, what you would do is you would devise a method that somehow takes, you know, takes in a device, a method that takes in a mini batch. And in the mini batch, you'd have your data samples, and then some of them would be labeled, right here, you'd have 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 some sort of a consistency loss such that if they are very nearest near neighbors to these in the feature space, they should have similar labels or things like this. So these semi supervised methods, they basically try to solve the problem at once. But while taking data that is labeled and not labeled, this paper goes into a different direction. This paper says, first, we should, it's actually three stages right here, and they have a diagram, so I don't need to draw. They have a three stage approach. Three stages. The one on the left is unsupervised pre training. So they say, let's forget about the labels right now, even like your unlabeled data. So even the data where we have the labels, let's forget about the labels. And let's just do unsupervised pre training. Now unsupervised pre training in this kind of setting is also known as self supervised pre training. And this first stage is done using a contrastive loss, and that's very similar to sim clear to this contrastive loss. So what you'll do, and they describe it very, very well here. So what you'll do is given a randomly sampled mini batch of images, each image is augmented twice using random crop color distortion and Gaussian blur, creating two views of the same example. Okay, so you have an image in your mini batch. Each image you take and you make two versions of it. And each version you crop, you random crop somewhere. So version one could be random cropped here. Version two could be random cropped here. And then you put some Gaussian blur on it and so on. So a little bit of, as you can see, random crop color distortion, Gaussian blur. So what you'll want is two different versions of the same image. Each of these versions has been augmented in a different way, cropped in a different way, blurred in a different way. It's two slightly different versions of the same image. And now you want to enforce, you want to put this through your network. So ultimately, as you can see on the right side here, what you want to end up is a 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 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 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 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 part. So you can pull a lot of strings here to get like another percent of performance. But ultimately, they won't see the similarity of 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. And 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 for some reason. We still don't exactly know why combining augmentation with the self supervised loss with contrastive loss, for example, gives such good performance. There have been papers recently that modify the loss and so on. But it's not super well understood yet. But if you do it like this, the network here will give you already very, very good representation. And we know this because we can take a network like this and then simply train a linear classifier on top of that on a data set and achieve very, very good performance. And mind you, you have trained it with unlabeled data, right? So the network has never been trained to solve like ImageNet classification. It has simply been trained to look at the pictures and determine if two versions of a picture come from the same picture or from different pictures. And now, if you simply train a linear classifier on top of these representations, you're doing extremely well already. So we know these representations, they actually learn something about these images. So that's the first part. Then stage two, let's cancel all that. Stage two is you want to do supervised fine tuning. Now you already see that the arrow here coming out is not this task agnostic big CNN. The arrow is actually coming out of those yellow boxes. And the yellow boxes are these projection heads. So in the original SimClear paper, what they did was they wanted originally, they wanted to train this network right here. This is like a ResNet-50. It's pretty standard in these kind of self-supervised approaches and so on to train or these few label approaches to train a standardized network. And this is like a ResNet-50. So in the original SimClear paper, they said we want to make ResNet-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 these are just multi-layer perceptrons. These are just fully connected layers that compress the representation down to that. And once we're done with the unsupervised pre-training, we're going to throw those away, right? And this ResNet is the thing that we really care about. Now here they claim, OK, 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, 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 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 any case, they have this layer, additional layer right here compared to the old Sinclair. And then the representation of that goes into supervised fine tuning. Now, this is pretty easy. This is exactly what it sounds like. So now you use only only the data set that has labels. So the part of the data set that has labels, and you do the fine tuning and fine tuning is simply supervised learning. You train this network in a supervised fashion on that small fraction of data that has cloud 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? So you do that right here. If you distill, you put the image into both. Now the teacher is already trained. So its output will be a distribution over classes. It won't be a single label. It will be like, okay, 90% class one, 10% class two, 0% class three, something like this. And now you take this as like a pseudo label, this entire distribution, and you put it here and you compare the output of the student to that of the teacher and that's your loss function. So this kind of, the teacher might have learned to put some nuance into the classification to say, well, I'm pretty sure this is class one, but I'm not 100% sure. And it can transfer that knowledge to the student. And that makes the student better than had you just trained it from the beginning from, with just the labels. Right? So this is distillation and you can do this even what they call self distillation here or self training. So apparently this even helps if the teacher is, if the student model is the same as the teacher model. Now why does it help in this case? And I think it is not exactly the case in this case because they always say their teacher model has this extra projection layer. Right? And then the student model doesn't have that even if they do self training. But why does it help in this case? I mean, it's, it's kind of shocking and I'm pretty sure it helps in any case, but in this particular case it helps because now you're using the unlabeled data again. So you have a teacher model and the teacher model is trained first using unsupervised like this is the teacher model right here using unsupervised training. Then the teacher model is further fine tuned on the small data. Right? So it is now already pretty good at the task, but how can you get a student model that's even better than the teacher model? It's by using again this unlabeled data. You have this giant amount of data. So what you'll do is you take an image from the unlabeled data and you ask the teacher model, teacher model, what do you think about that image? Right? And the teacher model will give you a prediction. Like let's say again, this 90%, 10%, 0% and then you take the student model, you input that image and you compare its output to what the teacher said. So this combines the teacher model. You freeze the teacher model, right? The teacher model is only trained until here. You take it from here. The student model is now able to take basically the teacher. It takes everything that the teacher model knows, not only about this data, but about all the data. So it kind of gets to ask the teacher model, what do you think about this? What do you think about this? What do you think about this? And it 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. So distillation, I think also is still kind of a mystery of why you get a better model or, I mean, to make it smaller, if you make it a lot smaller, usually you don't end up with a better model, but you end up with a pretty good model that you couldn't have gotten by just training the small model. So that's already pretty cool. But why you get a better model when they're the same size, 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. Then in both cases, you would again use the unlabeled, all of the unlabeled data. And that's the three step approach. That's SEMCLEAR v2 in all of its form. 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 ResNet-50, where Sigma is a ReLU non-linearity and we ignore the bias term for brevity, blah, blah, blah, blah, blah. So they contrast this here. For fine tuning, SEMCLEAR uses this right here, which is just, it's basically just a classifier on top of the output of the ResNet-50. This is fine tuning from the input layer of the projection head. To fine tune from the first layer of the projection head, we have a new encoder function as this, which is ResNet followed by fully connected layers. And you see they take the ResNet-50 output and they ship it through the first projection layer and then there is a task specific classifier. Now, again, why, I don't even see why they make like this ginormous deal out of it, especially, especially since the last layer of the ResNet-50. I'm not, okay, here is, I'm not entirely sure, but are they taking the log? No, they're probably not taking the log. It's okay. But it's, yeah, it's just weird. Like is there even a non-linearity at the end right here? Or is this really just like two matrix multiplications in a row, which I'm going to guess there's a big chance that that's the case, that the last layer of this encoder is actually not even followed by non-linearity and therefore you'll just kind of make the dimension different. And I don't see why you can't just 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 just the cross entropy. But instead of having labels right here, Y, you have what the teacher model thinks Y is given X. Okay, that's cross entropy, but not with the true labels, but with the output of the teacher model. And you can even mix that. So you can, as you can see right here, you can mix this with an actual supervised loss. So this would be the supervised loss, whatever. Yeah, I guess that I was wrong. That wasn't, I guess P of Y is always one in that case. But they don't use this particular kind, I think, except in one of the ablations. So how does this work? It works pretty well. And so one of their experiments, as you see up here, it works pretty well in that if you have 1% of the labels, only 1% of ImageNet labels, which they say is smaller or equal than 13 images per class, so there's 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 ResNet 50, then you get, and you can see the dashed line here is a supervised baseline. You almost get to the supervised baseline with 1% of the labels. And if you actually have a larger ResNet, then you get to the supervised performance without 99% of the labels. And if you have, excuse me, 10% of the labels, you pass the supervised baseline. So the supervised baseline is on 100% of the labels, mind you, and you only have 10% and this outperforms the supervised baseline. Now of course, you could, here you could have another graphic where you show, 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, this now relates to the title. They say bigger models 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 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 ImageNet 1 top accuracy. So if you do this whole thing with 100% of the labels, right, I'm going to guess this here, this here is where they start out. And you can see as you grow your models, you grow the performance. And this, this is just by increasing the model size, right, you have the same data set, you have the same amount of labels, you have the same number of steps that you train for, and so on, just by the fact that you make your model bigger, you gain in performance. Okay, now you can see that these curves here are above one another. And these curves refer to getting small, less and less labels. Okay, so if you only have 10% of the labels, your relative gains are larger. That doesn't mean that you perform better with 10% of the labels than with 100% of the labels, that would be like ridiculous. Well, I guess in this day and age, nothing is ridiculous. But for now, we're still performing better by having more labels if we do the same procedure, right? It's not like here. So here, this baseline, the supervised baseline only does supervised training, right? So that's why we can outperform it with less of labels. But here, we do the same procedure. This is relative improvement, right? So this right here, the starting point would be if you had 10% of labels and a 25 million model, parameter model. And this right here, for example, is if you have the same amount of labels, but a 200 million parameter model. And this is relative improvement, okay? But what the graph says is that the relative improvement is larger, the relative improvement is higher, the more parameters you have, which is the more you go to the right. And that effect in itself is higher, the fewer labels you have, which is the different graphs. And you can see that right here. So if you have fewer and fewer labels, it becomes more and more important that you have bigger models. And that's really counterintuitive, right? Because you would expect that the bigger models, they can overfit much more easily to the fewer labels. But that doesn't seem the case. So this self supervision, it really seems to be sort of a counter to this notion of overfitting. And if you have larger and larger models, that's what they argue in the paper, you might be able to learn more and more features that might be useful for classification. So if you have a larger model, you might, you're going to learn more kinds of features, and then you're going to outperform because you have more chance that these features are going to be useful for classification. And I don't think they really make a statement as to why that happens more with the, if you have less labels. So let's think about this. If I have very few labels, very, very few labels, why does it help me even more if I have a big model? Well, with the same argumentation, we could say, and maybe they actually say this already. So I might be copying them involuntarily. Maybe with fewer and fewer labels, like let's say we have all the labels, that's probably too many, right? If we can learn a task with some accuracy, we probably had too many labels. Okay. It's like, 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 many, technically speaking, like learning theoretically speaking. So usually we have too many labels. And what does that mean? That probably means that there are multiple ways. Like if we have too many labels, there are multiple different features we can pick up to learn. There are multiple different paths to learn our goals. So if we have ImageNet, and like there's this weird task to recognize a three, and we get lots and lots and lots of examples of threes, right? We can decide on a feature. We can say, oh, all the threes that I see, they have this bow down here, or all the threes that I see, they have this bend here, and so on. But if I only have very few labels, there might only be like a single feature that is even theoretically possible to learn from the labels I'm given. And therefore, if I have a bigger model in cell in pre-training, because the pre-training happens with the same amount of data, right? If I have a bigger model that does the self-supervised pre-training, it's going to learn more features. And then there's a higher chance that that one feature 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 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 also do linear evaluation compared to supervised, compared to fine tuning 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. They investigate 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 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 natural, right? If you have the labels, you can actually mix that information in with the distillation loss and that will make you better. And here they drop 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, then it is to distill, including the label loss. And it's much easier to not include the label loss. So they don't do it, I guess. All right, so I think that was it. They compare, as I said, they compare like self distillation, where you distill into an equally sized model and down distillation, where you distill into a smaller model, maybe that's vice versa. And they do a lot of comparison to other methods. So this is a very thorough work, I feel. And yeah, if you want more about the exact experiments, I invite you to look at the paper. And let's just have a final look at the broader impact statement right here. So the broader, remember the broader impact statement is supposed to force you to think about how society might be impacted at large by your work. So it says, the finding described in this paper can potentially be harnessed to improve accuracy in any application or computer vision, where it is more expensive or difficult to label additional data than to train larger models. Such applications are clearly beneficial to society. For example, in medical applications where acquiring high quality labels requires careful annotation by clinicians, better semi supervised learning approaches can potentially help save lives. Application of computer vision to agriculture can increase crop yields, which may help to improve availability of food. However, we also recognize that our approach can become a potential component of harmful surveillance systems. Moreover, there is an entire industry built around human labeling services and technology that reduces the need for these services could lead to short term loss of income for some of those currently employed or contracted to provide labels. So ask yourself how much of that statement has to do with the actual novelty of this paper? And the answer is of course, zero, right? Like you can replace like our method in this thing with like machine learning or computer vision in general, like, oh, really SIMClear V2 specifically can increase crop yields? Like that specific invention of this paper will lead to higher crop yields, will lead to surveillance systems. So I'm, yeah, you know, I think like, I'm not gonna get too upset about these. I mean, this, I think it's quite funny. But just, again, I wonder whether the people advocating for these things are happy with these statements, because clearly, clearly, this is just a template that you copy paste from paper to paper, replacing like a few words. And if it's computer vision, you're like, oh, my deep fakes. And if it's an NLP, it's like, oh, I'm a 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. I even read the title of the paper, right, what the broader impact statement is going to be. In any case, rant too long, check out paper, share it out, leave a like, comment if you disagree or agree. And yeah, bye bye.
[ { "start": 0, "end": 6.72, "text": " Hi there, today we'll look at big self-supervised models are strong semi-supervised learners" }, { "start": 6.72, "end": 12.96, "text": " by Ting Chen, Simon Kornblith, Kevin Swirsky, Mohamed Nourouzi and Jeffrey Hinton of Google" }, { "start": 12.96, "end": 14.32, "text": " Brain." }, { "start": 14.32, "end": 21.42, "text": " So this paper on a high level, it's also known as Sinclair v2, demonstrates that if you want" }, { "start": 21.42, "end": 28.18, "text": " to do semi-supervised learning, that you're very well served by starting out with self-supervised" }, { "start": 28.18, "end": 34.92, "text": " learning, and then doing fine tuning much like NLP models do, rather than the kind of" }, { "start": 34.92, "end": 40.36, "text": " semi-supervised approach that image tasks had so far." }, { "start": 40.36, "end": 45.34, "text": " And they present this Sinclair v2, which is an improvement over the Sinclair approach" }, { "start": 45.34, "end": 51.96, "text": " to self-supervised pre-training, and they demonstrate it outperforms a lot of the baselines." }, { "start": 51.96, "end": 58.32, "text": " Alright, so if you like content like this, don't forget to share it out, and leave a" }, { "start": 58.32, "end": 62.08, "text": " like and tell me what you think in the comments." }, { "start": 62.08, "end": 70.44, "text": " So this paper, it sort of is kind of a club together thing of different things." }, { "start": 70.44, "end": 77.26, "text": " So they present this new method, like this Sinclair v2, which is a modification of Sinclair," }, { "start": 77.26, "end": 86.92, "text": " and we'll go over that, but they also try to make like a scientific claim, namely that" }, { "start": 86.92, "end": 93.80000000000001, "text": " somehow bigger models are better for this pathway of learning, and we'll try to untangle" }, { "start": 93.80000000000001, "end": 95.64, "text": " all of these things." }, { "start": 95.64, "end": 101.56, "text": " So first of all, we're in the semi-supervised learning regime right here." }, { "start": 101.56, "end": 108.16, "text": " This basically means that you have a data set, and you only have labels for a part of" }, { "start": 108.16, "end": 109.48, "text": " that data set." }, { "start": 109.48, "end": 115.4, "text": " So this could be like here, the bottom 10% or so, because labels might be expensive to" }, { "start": 115.4, "end": 116.4, "text": " get." }, { "start": 116.4, "end": 121.76, "text": " And so you only have a few of them, but you have much more data that's unlabeled." }, { "start": 121.76, "end": 127.76, "text": " Now sometimes this problem is formulated as this here is your data set, and then this" }, { "start": 127.76, "end": 132.56, "text": " here is like a different data set, but one that's close enough such that you can learn" }, { "start": 132.56, "end": 133.56, "text": " from it." }, { "start": 133.56, "end": 135.52, "text": " And that's usually in NLP." }, { "start": 135.52, "end": 141.44, "text": " You'll have your data set is like a sentiment classification task, but you have all of Wikipedia" }, { "start": 141.44, "end": 143.44, "text": " that is not labeled, but it's just text." }, { "start": 143.44, "end": 146.48000000000002, "text": " So you can sort of pre-train on it." }, { "start": 146.48000000000002, "end": 152.72, "text": " In this case, we'll be in a situation where we'll artificially construct a small data" }, { "start": 152.72, "end": 153.72, "text": " set." }, { "start": 153.72, "end": 159.84, "text": " So this entire thing here is going to be the ImageNet data set, and this right here is" }, { "start": 159.84, "end": 163.88, "text": " going to be our labeled portion, like we have labels." }, { "start": 163.88, "end": 170.36, "text": " Now usually one has labels for ImageNet as well, but we artificially restrict ourselves" }, { "start": 170.36, "end": 177.04, "text": " to simulate a situation where we have lots of data and we only have a fixed budget." }, { "start": 177.04, "end": 182.2, "text": " So we can only, because to obtain labels, oftentimes you have to ask humans to label" }, { "start": 182.2, "end": 183.2, "text": " images." }, { "start": 183.2, "end": 190.48, "text": " And let's say we are a company and we've collected this big data set, but we only have like maybe" }, { "start": 190.48, "end": 196.72, "text": " 500 bucks on Amazon Mechanical Turk, and we only managed to get a very like 1% of our" }, { "start": 196.72, "end": 198.44, "text": " data set labeled." }, { "start": 198.44, "end": 204.56, "text": " Now we're in the regime of semi-supervised learning." }, { "start": 204.56, "end": 208.2, "text": " This is slightly different from what NLP does." }, { "start": 208.2, "end": 212.44, "text": " As I said, in NLP, usually assume you have different data sets, the large one being a" }, { "start": 212.44, "end": 218.2, "text": " different distribution, and in the semi-supervised regime, you often assume that it is actually" }, { "start": 218.2, "end": 221.84, "text": " the same data distribution, but you only have labels for some of them." }, { "start": 221.84, "end": 226.56, "text": " But there should be a fair bit of overlap between the two things." }, { "start": 226.56, "end": 235.28, "text": " So I've recently made a video about OpenAI's ImageGPT that kind of goes into the same direction" }, { "start": 235.28, "end": 241.12, "text": " as this work right here that basically says pre-training on unlabeled data, like this" }, { "start": 241.12, "end": 248.68, "text": " whole data set without the labels, can be a very good preconditioner for fine tuning" }, { "start": 248.68, "end": 249.68, "text": " later." }, { "start": 249.68, "end": 251.44, "text": " And this paper says the same thing." }, { "start": 251.44, "end": 258.4, "text": " So basically, in the good old days, what you would do is you would devise a method that" }, { "start": 258.4, "end": 265.72, "text": " somehow takes, you know, takes in a device, a method that takes in a mini batch." }, { "start": 265.72, "end": 271.44000000000005, "text": " And in the mini batch, you'd have your data samples, and then some of them would be labeled," }, { "start": 271.44000000000005, "end": 276.56, "text": " right here, you'd have a Y and here you'd have a Y, but most of them would be not labeled." }, { "start": 276.56, "end": 281.92, "text": " And you'd have like some sort of loss function that would put special weight on the ones" }, { "start": 281.92, "end": 287.32000000000005, "text": " that are labeled or somehow handle these ones that are unlabeled in a way, you might be" }, { "start": 287.32000000000005, "end": 293.8, "text": " doing like some sort of a consistency loss such that if they are very nearest near neighbors" }, { "start": 293.8, "end": 298.76, "text": " to these in the feature space, they should have similar labels or things like this." }, { "start": 298.76, "end": 305.16, "text": " So these semi supervised methods, 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": 310.96000000000004, "text": " direction." }, { "start": 310.96000000000004, "end": 317.08000000000004, "text": " This paper says, first, we should, it's actually three stages right here, and they have a diagram," }, { "start": 317.08000000000004, "end": 319.32, "text": " so I don't need to draw." }, { "start": 319.32, "end": 322, "text": " They have a three stage approach." }, { "start": 322, "end": 323.12, "text": " Three stages." }, { "start": 323.12, "end": 327.08, "text": " The one on the left is unsupervised pre training." }, { "start": 327.08, "end": 333, "text": " So they say, let's forget about the labels right now, even like your unlabeled data." }, { "start": 333, "end": 337.62, "text": " So even the data where we have the labels, let's forget about the labels." }, { "start": 337.62, "end": 340.96, "text": " And let's just do unsupervised pre training." }, { "start": 340.96, "end": 346.28000000000003, "text": " Now unsupervised pre training in this kind of setting is also known as self supervised" }, { "start": 346.28000000000003, "end": 347.56, "text": " pre training." }, { "start": 347.56, "end": 355.84, "text": " And this first stage is done using a contrastive loss, and that's very similar to sim clear" }, { "start": 355.84, "end": 356.88, "text": " to this contrastive loss." }, { "start": 356.88, "end": 361.12, "text": " So what you'll do, and they describe it very, very well here." }, { "start": 361.12, "end": 367, "text": " So what you'll do is given a randomly sampled mini batch of images, each image is augmented" }, { "start": 367, "end": 373.04, "text": " twice using random crop color distortion and Gaussian blur, creating two views of the same" }, { "start": 373.04, "end": 374.04, "text": " example." }, { "start": 374.04, "end": 377.04, "text": " Okay, so you have an image in your mini batch." }, { "start": 377.04, "end": 380.56, "text": " Each image you take and you make two versions of it." }, { "start": 380.56, "end": 383.70000000000005, "text": " And each version you crop, you random crop somewhere." }, { "start": 383.70000000000005, "end": 385.84000000000003, "text": " So version one could be random cropped here." }, { "start": 385.84000000000003, "end": 388.78000000000003, "text": " Version two could be random cropped here." }, { "start": 388.78000000000003, "end": 392.56, "text": " And then you put some Gaussian blur on it and so on." }, { "start": 392.56, "end": 398.24, "text": " So a little bit of, as you can see, random crop color distortion, Gaussian blur." }, { "start": 398.24, "end": 402.84000000000003, "text": " So what you'll want is two different versions of the same image." }, { "start": 402.84, "end": 408.03999999999996, "text": " Each of these versions has been augmented in a different way, cropped in a different" }, { "start": 408.03999999999996, "end": 410.96, "text": " way, blurred in a different way." }, { "start": 410.96, "end": 414.44, "text": " It's two slightly different versions of the same image." }, { "start": 414.44, "end": 421.53999999999996, "text": " And now you want to enforce, you want to put this through your network." }, { "start": 421.53999999999996, "end": 428.59999999999997, "text": " So ultimately, as you can see on the right side here, what you want to end up is a network." }, { "start": 428.59999999999997, "end": 432.35999999999996, "text": " And then, okay, we'll forget about this right now." }, { "start": 432.36, "end": 437.44, "text": " What you want to train is this network right here, actually including these projection" }, { "start": 437.44, "end": 438.44, "text": " layers." }, { "start": 438.44, "end": 439.44, "text": " We'll get to them later." }, { "start": 439.44, "end": 441.28000000000003, "text": " This is the network that you want to train." }, { "start": 441.28000000000003, "end": 446.24, "text": " So you want to put, you take your unlabeled data, you take an image, you make two versions" }, { "start": 446.24, "end": 448.12, "text": " of it." }, { "start": 448.12, "end": 453.96000000000004, "text": " And you put those through the network, right, until the end right here." }, { "start": 453.96000000000004, "end": 457.24, "text": " So you'll get Z1, Z2." }, { "start": 457.24, "end": 461.92, "text": " These are the outputs of the network for the two images." }, { "start": 461.92, "end": 467.28000000000003, "text": " And then what you want to do is you want to take another image that's not this image," }, { "start": 467.28000000000003, "end": 471.04, "text": " and also put it through the network, maybe also augmented first." }, { "start": 471.04, "end": 473.36, "text": " And then you have Z3." }, { "start": 473.36, "end": 478.56, "text": " So now you have the outputs of two things that are supposed to come from the same image" }, { "start": 478.56, "end": 481.44, "text": " and one thing that's supposed to come from a different image." }, { "start": 481.44, "end": 489.16, "text": " And now your loss is simply going to be make those two things close together and push those" }, { "start": 489.16, "end": 493.56, "text": " two things apart, or those three actually." }, { "start": 493.56, "end": 499.76000000000005, "text": " So the loss, and this is the contrastive loss of self supervised learning." }, { "start": 499.76000000000005, "end": 502.72, "text": " As you know, you don't need any labels right here." }, { "start": 502.72, "end": 506.40000000000003, "text": " You simply say the things that come from the same image should be close together." }, { "start": 506.40000000000003, "end": 510.12, "text": " And the things that come from different images should be far apart." }, { "start": 510.12, "end": 516.4, "text": " And this relies heavily on these data augmentations that you do right here." }, { "start": 516.4, "end": 521.4399999999999, "text": " They also employ some other tricks like the momentum encoder from MoCo, from momentum" }, { "start": 521.4399999999999, "end": 523.4399999999999, "text": " contrast and so on." }, { "start": 523.4399999999999, "end": 525.64, "text": " But this is the main part." }, { "start": 525.64, "end": 531.84, "text": " So you can pull a lot of strings here to get like another percent of performance." }, { "start": 531.84, "end": 540.4, "text": " But ultimately, they won't see the similarity of ZI and ZJ, which are the outputs of the" }, { "start": 540.4, "end": 543.92, "text": " same image to be close together." }, { "start": 543.92, "end": 552.4399999999999, "text": " And then this down here, they want to be far apart, ZI with ZK, where K is all the other" }, { "start": 552.4399999999999, "end": 553.4399999999999, "text": " images." }, { "start": 553.4399999999999, "end": 554.4399999999999, "text": " Okay." }, { "start": 554.4399999999999, "end": 556.64, "text": " And you can do this in a mini batch fashion." }, { "start": 556.64, "end": 558.0799999999999, "text": " So this is self supervised learning." }, { "start": 558.0799999999999, "end": 561.88, "text": " And the reason why you do this is you don't need labels." }, { "start": 561.88, "end": 567.24, "text": " And it tends, we know it tends to give very, very good representations." }, { "start": 567.24, "end": 570.26, "text": " So I'm past that." }, { "start": 570.26, "end": 576.16, "text": " So what this network here will learn will be very good for some reason." }, { "start": 576.16, "end": 581.88, "text": " We still don't exactly know why combining augmentation with the self supervised loss" }, { "start": 581.88, "end": 587.52, "text": " with contrastive loss, for example, gives such good performance." }, { "start": 587.52, "end": 593, "text": " There have been papers recently that modify the loss and so on." }, { "start": 593, "end": 595, "text": " But it's not super well understood yet." }, { "start": 595, "end": 601.52, "text": " But if you do it like this, the network here will give you already very, very good representation." }, { "start": 601.52, "end": 607.54, "text": " And we know this because we can take a network like this and then simply train a linear classifier" }, { "start": 607.54, "end": 613.72, "text": " on top of that on a data set and achieve very, very good performance." }, { "start": 613.72, "end": 617.92, "text": " And mind you, you have trained it with unlabeled data, right?" }, { "start": 617.92, "end": 622.52, "text": " So the network has never been trained to solve like ImageNet classification." }, { "start": 622.52, "end": 627.6, "text": " It has simply been trained to look at the pictures and determine if two versions of" }, { "start": 627.6, "end": 630.4399999999999, "text": " a picture come from the same picture or from different pictures." }, { "start": 630.4399999999999, "end": 635.84, "text": " And now, if you simply train a linear classifier on top of these representations, you're doing" }, { "start": 635.84, "end": 637.64, "text": " extremely well already." }, { "start": 637.64, "end": 642.6999999999999, "text": " So we know these representations, they actually learn something about these images." }, { "start": 642.6999999999999, "end": 644.64, "text": " So that's the first part." }, { "start": 644.64, "end": 649.0799999999999, "text": " Then stage two, let's cancel all that." }, { "start": 649.08, "end": 653.5200000000001, "text": " Stage two is you want to do supervised fine tuning." }, { "start": 653.5200000000001, "end": 661.6800000000001, "text": " Now you already see that the arrow here coming out is not this task agnostic big CNN." }, { "start": 661.6800000000001, "end": 665.26, "text": " The arrow is actually coming out of those yellow boxes." }, { "start": 665.26, "end": 668.1600000000001, "text": " And the yellow boxes are these projection heads." }, { "start": 668.1600000000001, "end": 675.1, "text": " So in the original SimClear paper, what they did was they wanted originally, they wanted" }, { "start": 675.1, "end": 678.3000000000001, "text": " to train this network right here." }, { "start": 678.3, "end": 679.92, "text": " This is like a ResNet-50." }, { "start": 679.92, "end": 685.88, "text": " It's pretty standard in these kind of self-supervised approaches and so on to train or these few" }, { "start": 685.88, "end": 690.06, "text": " label approaches to train a standardized network." }, { "start": 690.06, "end": 692.28, "text": " And this is like a ResNet-50." }, { "start": 692.28, "end": 698.4399999999999, "text": " So in the original SimClear paper, they said we want to make ResNet-50 as strong as possible." }, { "start": 698.4399999999999, "end": 705.0799999999999, "text": " But in order to do this loss right here, we are going to attach this projection head just" }, { "start": 705.08, "end": 709.96, "text": " to because the dimensionality here I think is like 2048." }, { "start": 709.96, "end": 715.96, "text": " And we want to do this inner product in a lower dimension of like maybe 256 or so." }, { "start": 715.96, "end": 719.86, "text": " So these are just multi-layer perceptrons." }, { "start": 719.86, "end": 726.24, "text": " These are just fully connected layers that compress the representation down to that." }, { "start": 726.24, "end": 730.48, "text": " And once we're done with the unsupervised pre-training, we're going to throw those away," }, { "start": 730.48, "end": 731.48, "text": " right?" }, { "start": 731.48, "end": 734.8000000000001, "text": " And this ResNet is the thing that we really care about." }, { "start": 734.8, "end": 738.4799999999999, "text": " Now here they claim, OK, it actually works better." }, { "start": 738.4799999999999, "end": 744.88, "text": " And they have experiments to prove this or to show this if you use one, if you actually" }, { "start": 744.88, "end": 747.3399999999999, "text": " leave one of these layers here." }, { "start": 747.3399999999999, "end": 752.68, "text": " So in the end, I guess they converge on three projection head layers." }, { "start": 752.68, "end": 755.76, "text": " And then they only throw away the top two." }, { "start": 755.76, "end": 761.8399999999999, "text": " And like they make this big deal out of the fact where, you know, I can just call this" }, { "start": 761.84, "end": 765.52, "text": " part right here now the encoder." }, { "start": 765.52, "end": 771.72, "text": " And I don't so I don't know exactly like I don't see the giant deal here." }, { "start": 771.72, "end": 774.96, "text": " Like you just made your network one layer bigger." }, { "start": 774.96, "end": 778.32, "text": " And now you consider that to be your encoder." }, { "start": 778.32, "end": 780.76, "text": " And the projection head is now two layers." }, { "start": 780.76, "end": 784.52, "text": " And that will be much easier than calling the projection head three layers." }, { "start": 784.52, "end": 787.64, "text": " But we leave one layer and we train from the middle layer." }, { "start": 787.64, "end": 793.28, "text": " In any case, they have this layer, additional layer right here compared to the old Sinclair." }, { "start": 793.28, "end": 797.16, "text": " And then the representation of that goes into supervised fine tuning." }, { "start": 797.16, "end": 798.48, "text": " Now, this is pretty easy." }, { "start": 798.48, "end": 799.98, "text": " This is exactly what it sounds like." }, { "start": 799.98, "end": 805.22, "text": " So now you use only only the data set that has labels." }, { "start": 805.22, "end": 809.8, "text": " So the part of the data set that has labels, and you do the fine tuning and fine tuning" }, { "start": 809.8, "end": 811.92, "text": " is simply supervised learning." }, { "start": 811.92, "end": 817.6, "text": " You train this network in a supervised fashion on that small fraction of data that has cloud" }, { "start": 817.6, "end": 820.0400000000001, "text": " class labels." }, { "start": 820.0400000000001, "end": 822.28, "text": " And that already performs pretty well." }, { "start": 822.28, "end": 824.16, "text": " And they show this in experiments." }, { "start": 824.16, "end": 832.6800000000001, "text": " But then you can go a step further and do what's known as distillation or self training." }, { "start": 832.6800000000001, "end": 835.8000000000001, "text": " And what's distillation or self training?" }, { "start": 835.8000000000001, "end": 841.88, "text": " It's so distillation is when you have a network that you call the teacher network." }, { "start": 841.88, "end": 849.28, "text": " And that network has been trained to do some classification maybe into three classes pretty," }, { "start": 849.28, "end": 850.28, "text": " pretty well." }, { "start": 850.28, "end": 851.28, "text": " Okay." }, { "start": 851.28, "end": 855.32, "text": " But now this is very large and you want maybe a smaller model." }, { "start": 855.32, "end": 860.28, "text": " So you just want like this tiny model because you want to ship it on a mobile device, right?" }, { "start": 860.28, "end": 863.52, "text": " But it's also supposed to do this." }, { "start": 863.52, "end": 868.68, "text": " And you know that if you just directly train this, which is called the student model, it" }, { "start": 868.68, "end": 871.14, "text": " doesn't perform as well as the teacher model." }, { "start": 871.14, "end": 872.3199999999999, "text": " There is a better way." }, { "start": 872.3199999999999, "end": 877.68, "text": " If you have the teacher model, you can sort of transfer the knowledge to the student model." }, { "start": 877.68, "end": 879, "text": " You can distill the knowledge." }, { "start": 879, "end": 880.4399999999999, "text": " And how do you do that?" }, { "start": 880.4399999999999, "end": 884.4399999999999, "text": " You do that by, so what would you do in supervised training?" }, { "start": 884.4399999999999, "end": 890.04, "text": " In supervised training, you would take an image, put it in, and then put the label that" }, { "start": 890.04, "end": 891.68, "text": " comes along with the image." }, { "start": 891.68, "end": 896.84, "text": " You put it up here and you compare the output to the label and that gives you the loss function." }, { "start": 896.84, "end": 897.84, "text": " Right?" }, { "start": 897.84, "end": 901.4, "text": " So you do that right here." }, { "start": 901.4, "end": 904.9200000000001, "text": " If you distill, you put the image into both." }, { "start": 904.9200000000001, "end": 907.2, "text": " Now the teacher is already trained." }, { "start": 907.2, "end": 910.76, "text": " So its output will be a distribution over classes." }, { "start": 910.76, "end": 912.2800000000001, "text": " It won't be a single label." }, { "start": 912.2800000000001, "end": 918.6, "text": " It will be like, okay, 90% class one, 10% class two, 0% class three, something like" }, { "start": 918.6, "end": 919.6, "text": " this." }, { "start": 919.6, "end": 925.6800000000001, "text": " And now you take this as like a pseudo label, this entire distribution, and you put it here" }, { "start": 925.68, "end": 930.16, "text": " and you compare the output of the student to that of the teacher and that's your loss" }, { "start": 930.16, "end": 931.1999999999999, "text": " function." }, { "start": 931.1999999999999, "end": 936.56, "text": " So this kind of, the teacher might have learned to put some nuance into the classification" }, { "start": 936.56, "end": 941.78, "text": " to say, well, I'm pretty sure this is class one, but I'm not 100% sure." }, { "start": 941.78, "end": 945.0999999999999, "text": " And it can transfer that knowledge to the student." }, { "start": 945.0999999999999, "end": 951.64, "text": " And that makes the student better than had you just trained it from the beginning from," }, { "start": 951.64, "end": 953.0799999999999, "text": " with just the labels." }, { "start": 953.0799999999999, "end": 954.0799999999999, "text": " Right?" }, { "start": 954.08, "end": 960, "text": " So this is distillation and you can do this even what they call self distillation here" }, { "start": 960, "end": 961.64, "text": " or self training." }, { "start": 961.64, "end": 968.76, "text": " So apparently this even helps if the teacher is, if the student model is the same as the" }, { "start": 968.76, "end": 970.08, "text": " teacher model." }, { "start": 970.08, "end": 972, "text": " Now why does it help in this case?" }, { "start": 972, "end": 976.74, "text": " And I think it is not exactly the case in this case because they always say their teacher" }, { "start": 976.74, "end": 979.08, "text": " model has this extra projection layer." }, { "start": 979.08, "end": 980.08, "text": " Right?" }, { "start": 980.08, "end": 983.96, "text": " And then the student model doesn't have that even if they do self training." }, { "start": 983.96, "end": 985.9200000000001, "text": " But why does it help in this case?" }, { "start": 985.9200000000001, "end": 990.44, "text": " I mean, it's, it's kind of shocking and I'm pretty sure it helps in any case, but in this" }, { "start": 990.44, "end": 997.76, "text": " particular case it helps because now you're using the unlabeled data again." }, { "start": 997.76, "end": 1004.46, "text": " So you have a teacher model and the teacher model is trained first using unsupervised" }, { "start": 1004.46, "end": 1009.1600000000001, "text": " like this is the teacher model right here using unsupervised training." }, { "start": 1009.1600000000001, "end": 1013.24, "text": " Then the teacher model is further fine tuned on the small data." }, { "start": 1013.24, "end": 1014.24, "text": " Right?" }, { "start": 1014.24, "end": 1020.72, "text": " So it is now already pretty good at the task, but how can you get a student model that's" }, { "start": 1020.72, "end": 1022.88, "text": " even better than the teacher model?" }, { "start": 1022.88, "end": 1025.2, "text": " It's by using again this unlabeled data." }, { "start": 1025.2, "end": 1027.16, "text": " You have this giant amount of data." }, { "start": 1027.16, "end": 1031.88, "text": " So what you'll do is you take an image from the unlabeled data and you ask the teacher" }, { "start": 1031.88, "end": 1035.04, "text": " model, teacher model, what do you think about that image?" }, { "start": 1035.04, "end": 1036.04, "text": " Right?" }, { "start": 1036.04, "end": 1039.6, "text": " And the teacher model will give you a prediction." }, { "start": 1039.6, "end": 1045.8799999999999, "text": " Like let's say again, this 90%, 10%, 0% and then you take the student model, you input" }, { "start": 1045.8799999999999, "end": 1051.1, "text": " that image and you compare its output to what the teacher said." }, { "start": 1051.1, "end": 1054.1799999999998, "text": " So this combines the teacher model." }, { "start": 1054.1799999999998, "end": 1055.76, "text": " You freeze the teacher model, right?" }, { "start": 1055.76, "end": 1058.9599999999998, "text": " The teacher model is only trained until here." }, { "start": 1058.9599999999998, "end": 1060.6799999999998, "text": " You take it from here." }, { "start": 1060.6799999999998, "end": 1065.3, "text": " The student model is now able to take basically the teacher." }, { "start": 1065.3, "end": 1073.36, "text": " It takes everything that the teacher model knows, not only about this data, but about" }, { "start": 1073.36, "end": 1074.36, "text": " all the data." }, { "start": 1074.36, "end": 1077.68, "text": " So it kind of gets to ask the teacher model, what do you think about this?" }, { "start": 1077.68, "end": 1078.68, "text": " What do you think about this?" }, { "start": 1078.68, "end": 1079.76, "text": " What do you think about this?" }, { "start": 1079.76, "end": 1084.8799999999999, "text": " And it can incorporate all that knowledge about all of this unlabeled data." }, { "start": 1084.8799999999999, "end": 1091.6, "text": " And that's why the student model here in the end, if it's the same size, will probably" }, { "start": 1091.6, "end": 1094.96, "text": " end up even better than the teacher model." }, { "start": 1094.96, "end": 1100, "text": " So distillation, I think also is still kind of a mystery of why you get a better model" }, { "start": 1100, "end": 1106.44, "text": " or, I mean, to make it smaller, if you make it a lot smaller, usually you don't end up" }, { "start": 1106.44, "end": 1109.92, "text": " with a better model, but you end up with a pretty good model that you couldn't have gotten" }, { "start": 1109.92, "end": 1114.4, "text": " by just training the small model." }, { "start": 1114.4, "end": 1115.8400000000001, "text": " So that's already pretty cool." }, { "start": 1115.8400000000001, "end": 1123, "text": " But why you get a better model when they're the same size, I don't think that's well understood" }, { "start": 1123, "end": 1124.3600000000001, "text": " yet." }, { "start": 1124.36, "end": 1127.3799999999999, "text": " So that's the three stage approach." }, { "start": 1127.3799999999999, "end": 1133.9599999999998, "text": " So recap, first, use all of the data without labels to do unsupervised or self supervised" }, { "start": 1133.9599999999998, "end": 1135.9199999999998, "text": " contrastive pre-training." }, { "start": 1135.9199999999998, "end": 1141.4399999999998, "text": " Second, use only the data that has labels to do fine tuning." }, { "start": 1141.4399999999998, "end": 1150.76, "text": " Third, either distill the learned classifier to a smaller model or distill it to a model" }, { "start": 1150.76, "end": 1152.1599999999999, "text": " of the same size." }, { "start": 1152.16, "end": 1160.8400000000001, "text": " Then in both cases, you would again use the unlabeled, all of the unlabeled data." }, { "start": 1160.8400000000001, "end": 1162.3200000000002, "text": " And that's the three step approach." }, { "start": 1162.3200000000002, "end": 1168.72, "text": " That's SEMCLEAR v2 in all of its form." }, { "start": 1168.72, "end": 1172.76, "text": " So they go into fine tuning right here." }, { "start": 1172.76, "end": 1180.68, "text": " And yeah, so they say again, we elaborate with a three layer projection head." }, { "start": 1180.68, "end": 1182.48, "text": " So that's the three layer projection head." }, { "start": 1182.48, "end": 1190.04, "text": " This here is the output of ResNet-50, where Sigma is a ReLU non-linearity and we ignore" }, { "start": 1190.04, "end": 1193.2, "text": " the bias term for brevity, blah, blah, blah, blah, blah." }, { "start": 1193.2, "end": 1194.52, "text": " So they contrast this here." }, { "start": 1194.52, "end": 1200.68, "text": " For fine tuning, SEMCLEAR uses this right here, which is just, it's basically just a" }, { "start": 1200.68, "end": 1210.28, "text": " classifier on top of the output of the ResNet-50." }, { "start": 1210.28, "end": 1214.28, "text": " This is fine tuning from the input layer of the projection head." }, { "start": 1214.28, "end": 1220.52, "text": " To fine tune from the first layer of the projection head, we have a new encoder function as this," }, { "start": 1220.52, "end": 1223.94, "text": " which is ResNet followed by fully connected layers." }, { "start": 1223.94, "end": 1229.76, "text": " And you see they take the ResNet-50 output and they ship it through the first projection" }, { "start": 1229.76, "end": 1233.16, "text": " layer and then there is a task specific classifier." }, { "start": 1233.16, "end": 1239.6399999999999, "text": " Now, again, why, I don't even see why they make like this ginormous deal out of it, especially," }, { "start": 1239.64, "end": 1242.5600000000002, "text": " especially since the last layer of the ResNet-50." }, { "start": 1242.5600000000002, "end": 1248.68, "text": " I'm not, okay, here is, I'm not entirely sure, but are they taking the log?" }, { "start": 1248.68, "end": 1250.3200000000002, "text": " No, they're probably not taking the log." }, { "start": 1250.3200000000002, "end": 1251.72, "text": " It's okay." }, { "start": 1251.72, "end": 1255.68, "text": " But it's, yeah, it's just weird." }, { "start": 1255.68, "end": 1259.5600000000002, "text": " Like is there even a non-linearity at the end right here?" }, { "start": 1259.5600000000002, "end": 1264.76, "text": " Or is this really just like two matrix multiplications in a row, which I'm going to guess there's" }, { "start": 1264.76, "end": 1269.24, "text": " a big chance that that's the case, that the last layer of this encoder is actually not" }, { "start": 1269.24, "end": 1274.52, "text": " even followed by non-linearity and therefore you'll just kind of make the dimension different." }, { "start": 1274.52, "end": 1279.8, "text": " And I don't see why you can't just incorporate this into the model and have to like say it" }, { "start": 1279.8, "end": 1283.44, "text": " over and over again that this is a new special thing, right?" }, { "start": 1283.44, "end": 1287.28, "text": " Again, this is equivalent of tuning from a middle layer of the projection head instead" }, { "start": 1287.28, "end": 1288.76, "text": " of the output layer." }, { "start": 1288.76, "end": 1291.84, "text": " Okay, you just make your model a bit bigger." }, { "start": 1291.84, "end": 1292.84, "text": " Yeah." }, { "start": 1292.84, "end": 1297.24, "text": " So the third step is self-training or knowledge distillation." }, { "start": 1297.24, "end": 1298.96, "text": " And they give two variants right here." }, { "start": 1298.96, "end": 1304.04, "text": " This variant, as you can see here, this is just the cross entropy." }, { "start": 1304.04, "end": 1313.24, "text": " But instead of having labels right here, Y, you have what the teacher model thinks Y is" }, { "start": 1313.24, "end": 1314.24, "text": " given X." }, { "start": 1314.24, "end": 1321.16, "text": " Okay, that's cross entropy, but not with the true labels, but with the output of the teacher" }, { "start": 1321.16, "end": 1322.16, "text": " model." }, { "start": 1322.16, "end": 1323.66, "text": " And you can even mix that." }, { "start": 1323.66, "end": 1330.88, "text": " So you can, as you can see right here, you can mix this with an actual supervised loss." }, { "start": 1330.88, "end": 1333.1200000000001, "text": " So this would be the supervised loss, whatever." }, { "start": 1333.1200000000001, "end": 1335.1200000000001, "text": " Yeah, I guess that I was wrong." }, { "start": 1335.1200000000001, "end": 1340.5800000000002, "text": " That wasn't, I guess P of Y is always one in that case." }, { "start": 1340.5800000000002, "end": 1347.68, "text": " But they don't use this particular kind, I think, except in one of the ablations." }, { "start": 1347.68, "end": 1349.0400000000002, "text": " So how does this work?" }, { "start": 1349.0400000000002, "end": 1352.28, "text": " It works pretty well." }, { "start": 1352.28, "end": 1359.68, "text": " And so one of their experiments, as you see up here, it works pretty well in that if you" }, { "start": 1359.68, "end": 1368.44, "text": " have 1% of the labels, only 1% of ImageNet labels, which they say is smaller or equal" }, { "start": 1368.44, "end": 1375.28, "text": " than 13 images per class, so there's a thousand classes and you only have 13 labels per class" }, { "start": 1375.28, "end": 1377.28, "text": " or less." }, { "start": 1377.28, "end": 1388.32, "text": " If you, and they differentiate, if your encoder that you train is a ResNet 50, then you get," }, { "start": 1388.32, "end": 1391.8999999999999, "text": " and you can see the dashed line here is a supervised baseline." }, { "start": 1391.8999999999999, "end": 1396, "text": " You almost get to the supervised baseline with 1% of the labels." }, { "start": 1396, "end": 1401.52, "text": " And if you actually have a larger ResNet, then you get to the supervised performance" }, { "start": 1401.52, "end": 1405.3799999999999, "text": " without 99% of the labels." }, { "start": 1405.38, "end": 1413.24, "text": " And if you have, excuse me, 10% of the labels, you pass the supervised baseline." }, { "start": 1413.24, "end": 1419.72, "text": " So the supervised baseline is on 100% of the labels, mind you, and you only have 10% and" }, { "start": 1419.72, "end": 1421.88, "text": " this outperforms the supervised baseline." }, { "start": 1421.88, "end": 1427.5200000000002, "text": " Now of course, you could, here you could have another graphic where you show, oh, 100%." }, { "start": 1427.5200000000002, "end": 1431.5200000000002, "text": " What if we, you know, what if we do the whole procedure with 100% of the labels?" }, { "start": 1431.52, "end": 1438.52, "text": " So first we don't label the data, we do supervised, self-supervision, then we fine tune on a 100%" }, { "start": 1438.52, "end": 1439.52, "text": " of the data." }, { "start": 1439.52, "end": 1443.44, "text": " And then we do this distillation again, you would of course be even better." }, { "start": 1443.44, "end": 1448, "text": " And I think they have this somewhere in a table, but this is already pretty, pretty" }, { "start": 1448, "end": 1451.2, "text": " impressive." }, { "start": 1451.2, "end": 1456.24, "text": " And another claim they make right here is about the model sizes." }, { "start": 1456.24, "end": 1463.64, "text": " So and this figure is description, this now relates to the title." }, { "start": 1463.64, "end": 1470.44, "text": " They say bigger models yield larger gains when fine tuning with fewer labeled examples." }, { "start": 1470.44, "end": 1475.72, "text": " So there are three comparative statement words in one sentence." }, { "start": 1475.72, "end": 1479, "text": " Let's unpack this." }, { "start": 1479, "end": 1482.4, "text": " Bigger models yield larger gains." }, { "start": 1482.4, "end": 1491.52, "text": " So the bigger the model, the better the good, let's say, when fine tuning with fewer labeled" }, { "start": 1491.52, "end": 1492.52, "text": " examples." }, { "start": 1492.52, "end": 1493.52, "text": " Let's just look at the graph." }, { "start": 1493.52, "end": 1494.68, "text": " It's pretty, it's really clear." }, { "start": 1494.68, "end": 1497.88, "text": " So here we have number of parameters going over." }, { "start": 1497.88, "end": 1502.72, "text": " So these are the different models they look at, how many parameters they have to do this" }, { "start": 1502.72, "end": 1504.0800000000002, "text": " whole procedure." }, { "start": 1504.0800000000002, "end": 1511.2, "text": " And here is the relative improvement in percent over the top ImageNet 1 top accuracy." }, { "start": 1511.2, "end": 1518.8, "text": " So if you do this whole thing with 100% of the labels, right, I'm going to guess this" }, { "start": 1518.8, "end": 1521.8400000000001, "text": " here, this here is where they start out." }, { "start": 1521.8400000000001, "end": 1528.04, "text": " And you can see as you grow your models, you grow the performance." }, { "start": 1528.04, "end": 1534.24, "text": " And this, this is just by increasing the model size, right, you have the same data set, you" }, { "start": 1534.24, "end": 1538.76, "text": " have the same amount of labels, you have the same number of steps that you train for, and" }, { "start": 1538.76, "end": 1546.52, "text": " so on, just by the fact that you make your model bigger, you gain in performance." }, { "start": 1546.52, "end": 1553.4, "text": " Okay, now you can see that these curves here are above one another." }, { "start": 1553.4, "end": 1558.28, "text": " And these curves refer to getting small, less and less labels." }, { "start": 1558.28, "end": 1564.4, "text": " Okay, so if you only have 10% of the labels, your relative gains are larger." }, { "start": 1564.4, "end": 1569.76, "text": " That doesn't mean that you perform better with 10% of the labels than with 100% of the" }, { "start": 1569.76, "end": 1572.68, "text": " labels, that would be like ridiculous." }, { "start": 1572.68, "end": 1575.9, "text": " Well, I guess in this day and age, nothing is ridiculous." }, { "start": 1575.9, "end": 1582.5600000000002, "text": " But for now, we're still performing better by having more labels if we do the same procedure," }, { "start": 1582.5600000000002, "end": 1583.5600000000002, "text": " right?" }, { "start": 1583.5600000000002, "end": 1585.4, "text": " It's not like here." }, { "start": 1585.4, "end": 1591.4, "text": " So here, this baseline, the supervised baseline only does supervised training, right?" }, { "start": 1591.4, "end": 1595.3200000000002, "text": " So that's why we can outperform it with less of labels." }, { "start": 1595.3200000000002, "end": 1597.6000000000001, "text": " But here, we do the same procedure." }, { "start": 1597.6000000000001, "end": 1599.76, "text": " This is relative improvement, right?" }, { "start": 1599.76, "end": 1608.72, "text": " So this right here, the starting point would be if you had 10% of labels and a 25 million" }, { "start": 1608.72, "end": 1611.5600000000002, "text": " model, parameter model." }, { "start": 1611.5600000000002, "end": 1617.44, "text": " And this right here, for example, is if you have the same amount of labels, but a 200" }, { "start": 1617.44, "end": 1618.76, "text": " million parameter model." }, { "start": 1618.76, "end": 1622.66, "text": " And this is relative improvement, okay?" }, { "start": 1622.66, "end": 1631.64, "text": " But what the graph says is that the relative improvement is larger, the relative improvement" }, { "start": 1631.64, "end": 1639.12, "text": " is higher, the more parameters you have, which is the more you go to the right." }, { "start": 1639.12, "end": 1645.92, "text": " And that effect in itself is higher, the fewer labels you have, which is the different graphs." }, { "start": 1645.92, "end": 1647.6, "text": " And you can see that right here." }, { "start": 1647.6, "end": 1652.74, "text": " So if you have fewer and fewer labels, it becomes more and more important that you have" }, { "start": 1652.74, "end": 1654.24, "text": " bigger models." }, { "start": 1654.24, "end": 1656.78, "text": " And that's really counterintuitive, right?" }, { "start": 1656.78, "end": 1663.76, "text": " Because you would expect that the bigger models, they can overfit much more easily to the fewer" }, { "start": 1663.76, "end": 1664.76, "text": " labels." }, { "start": 1664.76, "end": 1665.76, "text": " But that doesn't seem the case." }, { "start": 1665.76, "end": 1671.9199999999998, "text": " So this self supervision, it really seems to be sort of a counter to this notion of" }, { "start": 1671.9199999999998, "end": 1673.6, "text": " overfitting." }, { "start": 1673.6, "end": 1677.8, "text": " And if you have larger and larger models, that's what they argue in the paper, you might" }, { "start": 1677.8, "end": 1683.4199999999998, "text": " be able to learn more and more features that might be useful for classification." }, { "start": 1683.4199999999998, "end": 1688.48, "text": " So if you have a larger model, you might, you're going to learn more kinds of features," }, { "start": 1688.48, "end": 1692.9199999999998, "text": " and then you're going to outperform because you have more chance that these features are" }, { "start": 1692.9199999999998, "end": 1695.4599999999998, "text": " going to be useful for classification." }, { "start": 1695.4599999999998, "end": 1701.1999999999998, "text": " And I don't think they really make a statement as to why that happens more with the, if you" }, { "start": 1701.1999999999998, "end": 1703.4399999999998, "text": " have less labels." }, { "start": 1703.44, "end": 1704.8, "text": " So let's think about this." }, { "start": 1704.8, "end": 1712, "text": " If I have very few labels, very, very few labels, why does it help me even more if I" }, { "start": 1712, "end": 1713, "text": " have a big model?" }, { "start": 1713, "end": 1717.28, "text": " Well, with the same argumentation, we could say, and maybe they actually say this already." }, { "start": 1717.28, "end": 1722.3200000000002, "text": " So I might be copying them involuntarily." }, { "start": 1722.3200000000002, "end": 1729.4, "text": " Maybe with fewer and fewer labels, like let's say we have all the labels, that's probably" }, { "start": 1729.4, "end": 1731.0800000000002, "text": " too many, right?" }, { "start": 1731.08, "end": 1736.6, "text": " If we can learn a task with some accuracy, we probably had too many labels." }, { "start": 1736.6, "end": 1737.6, "text": " Okay." }, { "start": 1737.6, "end": 1740.9199999999998, "text": " It's like, if we can't learn a task, we know we have too few." }, { "start": 1740.9199999999998, "end": 1745.32, "text": " Somewhere there is a border where we have enough, but that's like kind of one number." }, { "start": 1745.32, "end": 1751.54, "text": " And everything else is too many, technically speaking, like learning theoretically speaking." }, { "start": 1751.54, "end": 1755.36, "text": " So usually we have too many labels." }, { "start": 1755.36, "end": 1756.6399999999999, "text": " And what does that mean?" }, { "start": 1756.6399999999999, "end": 1759, "text": " That probably means that there are multiple ways." }, { "start": 1759, "end": 1763.84, "text": " Like if we have too many labels, there are multiple different features we can pick up" }, { "start": 1763.84, "end": 1764.84, "text": " to learn." }, { "start": 1764.84, "end": 1767.76, "text": " There are multiple different paths to learn our goals." }, { "start": 1767.76, "end": 1773.88, "text": " So if we have ImageNet, and like there's this weird task to recognize a three, and we get" }, { "start": 1773.88, "end": 1778.72, "text": " lots and lots and lots of examples of threes, right?" }, { "start": 1778.72, "end": 1780.2, "text": " We can decide on a feature." }, { "start": 1780.2, "end": 1784.62, "text": " We can say, oh, all the threes that I see, they have this bow down here, or all the threes" }, { "start": 1784.62, "end": 1787.68, "text": " that I see, they have this bend here, and so on." }, { "start": 1787.68, "end": 1793.5600000000002, "text": " But if I only have very few labels, there might only be like a single feature that is" }, { "start": 1793.5600000000002, "end": 1798, "text": " even theoretically possible to learn from the labels I'm given." }, { "start": 1798, "end": 1802.98, "text": " And therefore, if I have a bigger model in cell in pre-training, because the pre-training" }, { "start": 1802.98, "end": 1806.8, "text": " happens with the same amount of data, right?" }, { "start": 1806.8, "end": 1813.44, "text": " If I have a bigger model that does the self-supervised pre-training, it's going to learn more features." }, { "start": 1813.44, "end": 1820.72, "text": " And then there's a higher chance that that one feature that these very few labels that" }, { "start": 1820.72, "end": 1825.46, "text": " I am able to learn something from is going to be in these features." }, { "start": 1825.46, "end": 1831.4, "text": " So that's kind of how I make sense of it in combination with what they're saying right" }, { "start": 1831.4, "end": 1832.72, "text": " here." }, { "start": 1832.72, "end": 1836.9, "text": " Okay, so this was the main points." }, { "start": 1836.9, "end": 1841.56, "text": " They do a lot of empirical studies showing the effects of these sizes." }, { "start": 1841.56, "end": 1848.52, "text": " They stress that it's important to have both deep and wide networks." }, { "start": 1848.52, "end": 1853.06, "text": " And they also do this additional attention mechanism over the convolution filters." }, { "start": 1853.06, "end": 1856.8799999999999, "text": " I don't want to go into that particularly." }, { "start": 1856.8799999999999, "end": 1864.96, "text": " But they also do linear evaluation compared to supervised, compared to fine tuning with" }, { "start": 1864.96, "end": 1866.6799999999998, "text": " 100% of the labels." }, { "start": 1866.68, "end": 1872.88, "text": " So they do a very thorough empirical investigation." }, { "start": 1872.88, "end": 1876.48, "text": " And yeah, I do appreciate that." }, { "start": 1876.48, "end": 1880.16, "text": " And they kind of show the same things." }, { "start": 1880.16, "end": 1883.92, "text": " And here they show the number of layers in the projection head." }, { "start": 1883.92, "end": 1890.3, "text": " So as you increase the number of layers in the projection head and train from the optimal" }, { "start": 1890.3, "end": 1893.94, "text": " layer in the middle, your performance goes up, as you can see." }, { "start": 1893.94, "end": 1899.72, "text": " But it also this effect is stronger when you have fewer labels, right?" }, { "start": 1899.72, "end": 1904.26, "text": " You can see the differences here are greater than the differences here or even here when" }, { "start": 1904.26, "end": 1906.6000000000001, "text": " you have 100% of the labels." }, { "start": 1906.6000000000001, "end": 1913.3400000000001, "text": " So the fewer labels, the fewer the labels, the more benefit you have from the architecture" }, { "start": 1913.3400000000001, "end": 1914.3400000000001, "text": " right here." }, { "start": 1914.3400000000001, "end": 1919.0800000000002, "text": " And here they show that it's not always optimal to train from the last projection layer, but" }, { "start": 1919.0800000000002, "end": 1920.3200000000002, "text": " here the first one." }, { "start": 1920.32, "end": 1925.12, "text": " So I guess they converge on three projection layers, and you always want to keep the first" }, { "start": 1925.12, "end": 1932.1599999999999, "text": " one around after self supervised training, as we mentioned before." }, { "start": 1932.1599999999999, "end": 1938.08, "text": " They investigate different distillation losses and show that it is actually important that" }, { "start": 1938.08, "end": 1944.12, "text": " you do the distillation loss on labeled and unlabeled sets." }, { "start": 1944.12, "end": 1952.7199999999998, "text": " You can see here if you only train with the labels after fine tuning, you get poor performance." }, { "start": 1952.7199999999998, "end": 1959.32, "text": " If you do the label and distillation loss, but only do it on the data set where you have" }, { "start": 1959.32, "end": 1962.5, "text": " labels, then you get more performance." }, { "start": 1962.5, "end": 1967.82, "text": " If you do label and distillation loss, but also include your unlabeled data, you get" }, { "start": 1967.82, "end": 1969.8, "text": " even more performance." }, { "start": 1969.8, "end": 1974.56, "text": " And then if you do that, but you don't do the label loss." }, { "start": 1974.56, "end": 1980.82, "text": " So before we've seen you can mix the distillation loss with the label loss, if you have lots" }, { "start": 1980.82, "end": 1984.32, "text": " of labels, then you drop in performance again." }, { "start": 1984.32, "end": 1988.8799999999999, "text": " And you can see right here, the drop in performance is proportional to how many labeled examples" }, { "start": 1988.8799999999999, "end": 1989.8799999999999, "text": " you have." }, { "start": 1989.8799999999999, "end": 1991.3999999999999, "text": " And that's natural, right?" }, { "start": 1991.3999999999999, "end": 1996.84, "text": " If you have the labels, you can actually mix that information in with the distillation" }, { "start": 1996.84, "end": 1999, "text": " loss and that will make you better." }, { "start": 1999, "end": 2006.96, "text": " And here they drop 0.1% and here they drop less than 1% by leaving away the label." }, { "start": 2006.96, "end": 2014.48, "text": " But their point basically is that it is more important to distill using also unlabeled" }, { "start": 2014.48, "end": 2020.44, "text": " data, then it is to distill, including the label loss." }, { "start": 2020.44, "end": 2022.64, "text": " And it's much easier to not include the label loss." }, { "start": 2022.64, "end": 2026.56, "text": " So they don't do it, I guess." }, { "start": 2026.56, "end": 2030.44, "text": " All right, so I think that was it." }, { "start": 2030.44, "end": 2035.6799999999998, "text": " They compare, as I said, they compare like self distillation, where you distill into" }, { "start": 2035.6799999999998, "end": 2042.6799999999998, "text": " an equally sized model and down distillation, where you distill into a smaller model, maybe" }, { "start": 2042.6799999999998, "end": 2044.36, "text": " that's vice versa." }, { "start": 2044.36, "end": 2047.12, "text": " And they do a lot of comparison to other methods." }, { "start": 2047.12, "end": 2050.52, "text": " So this is a very thorough work, I feel." }, { "start": 2050.52, "end": 2057.68, "text": " And yeah, if you want more about the exact experiments, I invite you to look at the paper." }, { "start": 2057.68, "end": 2063.96, "text": " And let's just have a final look at the broader impact statement right here." }, { "start": 2063.96, "end": 2071.84, "text": " So the broader, remember the broader impact statement is supposed to force you to think" }, { "start": 2071.84, "end": 2078.88, "text": " about how society might be impacted at large by your work." }, { "start": 2078.88, "end": 2082.48, "text": " So it says, the finding described in this paper can potentially be harnessed to improve" }, { "start": 2082.48, "end": 2087.56, "text": " accuracy in any application or computer vision, where it is more expensive or difficult to" }, { "start": 2087.56, "end": 2090.96, "text": " label additional data than to train larger models." }, { "start": 2090.96, "end": 2094.44, "text": " Such applications are clearly beneficial to society." }, { "start": 2094.44, "end": 2099.12, "text": " For example, in medical applications where acquiring high quality labels requires careful" }, { "start": 2099.12, "end": 2103.88, "text": " annotation by clinicians, better semi supervised learning approaches can potentially help save" }, { "start": 2103.88, "end": 2105.32, "text": " lives." }, { "start": 2105.32, "end": 2109.2400000000002, "text": " Application of computer vision to agriculture can increase crop yields, which may help to" }, { "start": 2109.2400000000002, "end": 2111.6000000000004, "text": " improve availability of food." }, { "start": 2111.6000000000004, "end": 2115.92, "text": " However, we also recognize that our approach can become a potential component of harmful" }, { "start": 2115.92, "end": 2118.04, "text": " surveillance systems." }, { "start": 2118.04, "end": 2123.76, "text": " Moreover, there is an entire industry built around human labeling services and technology" }, { "start": 2123.76, "end": 2128, "text": " that reduces the need for these services could lead to short term loss of income for some" }, { "start": 2128, "end": 2131.7200000000003, "text": " of those currently employed or contracted to provide labels." }, { "start": 2131.72, "end": 2139.68, "text": " So ask yourself how much of that statement has to do with the actual novelty of this" }, { "start": 2139.68, "end": 2141.52, "text": " paper?" }, { "start": 2141.52, "end": 2144.24, "text": " And the answer is of course, zero, right?" }, { "start": 2144.24, "end": 2150.6, "text": " Like you can replace like our method in this thing with like machine learning or computer" }, { "start": 2150.6, "end": 2157.9599999999996, "text": " vision in general, like, oh, really SIMClear V2 specifically can increase crop yields?" }, { "start": 2157.96, "end": 2164.68, "text": " Like that specific invention of this paper will lead to higher crop yields, will lead" }, { "start": 2164.68, "end": 2167.12, "text": " to surveillance systems." }, { "start": 2167.12, "end": 2174.56, "text": " So I'm, yeah, you know, I think like, I'm not gonna get too upset about these." }, { "start": 2174.56, "end": 2178.76, "text": " I mean, this, I think it's quite funny." }, { "start": 2178.76, "end": 2188.84, "text": " But just, again, I wonder whether the people advocating for these things are happy with" }, { "start": 2188.84, "end": 2195.5600000000004, "text": " these statements, because clearly, clearly, this is just a template that you copy paste" }, { "start": 2195.5600000000004, "end": 2199.48, "text": " from paper to paper, replacing like a few words." }, { "start": 2199.48, "end": 2202.76, "text": " And if it's computer vision, you're like, oh, my deep fakes." }, { "start": 2202.76, "end": 2206.7200000000003, "text": " And if it's an NLP, it's like, oh, I'm a fake news." }, { "start": 2206.72, "end": 2217.4399999999996, "text": " And yeah, I wonder if really anything like particularly is has I wonder whether these" }, { "start": 2217.4399999999996, "end": 2218.7599999999998, "text": " people are happy now." }, { "start": 2218.7599999999998, "end": 2220.64, "text": " Yeah, I just I wonder." }, { "start": 2220.64, "end": 2227.04, "text": " And if, if they are, I wonder whether it's really for the reason that they claim that," }, { "start": 2227.04, "end": 2232.9599999999996, "text": " oh, now we have a statement here of how it impacts society, because I could have told" }, { "start": 2232.9599999999996, "end": 2233.9599999999996, "text": " you that before." }, { "start": 2233.96, "end": 2237.6, "text": " I even read the title of the paper, right, what the broader impact statement is going" }, { "start": 2237.6, "end": 2238.6, "text": " to be." }, { "start": 2238.6, "end": 2244.6, "text": " In any case, rant too long, check out paper, share it out, leave a like, comment if you" }, { "start": 2244.6, "end": 2247.6, "text": " disagree or agree." }, { "start": 2247.6, "end": 2264.44, "text": " And yeah, bye bye." } ]
THcuTJbeD34
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
On the Measure of Intelligence by François Chollet - Part 2: Human Priors (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "chollet", "keras", "google", "francois", "intelligence", "iq", "iq test", "deep neural networks", "prior", "skill", "performance", "measurement", "measure", "test", "number", "intelligent", "smart", "learning", "generalization", "ability", "experience", "humans", "evolution", "nature", "nurture", "psychometrics", "range", "adaptability", "arc", "kaggle", "difficulty", "entropy", "core knowledge", "objectness", "navigation", "contact", "agent", "goal" ]
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 Chollet. Now if you remember last time, if you haven't seen last time, go watch part 1 if you're interested. This is a multi-part series on this paper. Why? Because the paper itself is very long. It's 40 pages, the main part, and it's a big wall of text. So I've opted to basically pull out notes and show you the notes that I have pulled out and to divide this into multiple parts. So last time we went over sort of the history of assessing intelligence and the basics. And I know I said this time I'm going to get into the math, but I lied. So I realized that there's still a lot that comes up in part 2 of the paper before we get into the actual math. So this part is going to be about the prerequisites to that and then next time math. I'm sorry to disappoint anyone. You might just skip this one if you want. I do have to shout out Tim 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, you know, know the end of the story or, you know, have a different take on the paper, definitely can recommend his video. I do make a guest appearance there, so yeah, that's a given. And I will still finish the paper on this channel just in my regular in this style right here. So all the options are available to you. Let's dive into part 2. So if you remember part 1, we sort of went over what it means to be intelligent and we differentiated basically two things, which are skills and abilities. So a skill is how well you achieve a given task or how well you can do in a given task. So this could be chess or, you know, Go or something very, very measurable. An IQ test is a specific task. So these things right here, they're all tasks. But these tasks aren't the thing we're interested in. Just because a machine is good at chess doesn't mean it's intelligent. And what we want is sort of a generalizable skill. So we want to assess how generalizable is an ability. So can I throw a computer at a new problem that it has never seen before and it can solve that. And that's going to be this generalizability, this notion of can you solve things that you have never encountered before and weren't prepared for. That is going to be the basis for us to measure intelligence. So Chollet says you have to optimize directly for generality and flexibility rather than task performance if you want to build an intelligent agent. You have to sort of build something that is not just good at a thing. It is good at getting good at things. That's almost a quote worthy thing. So if you just give it a single task, the learner will just take any available shortcut. So if you just say you have to be good at chess, the developer of a system can exploit all the tricks that make you good at chess. And you don't have to be smart. You just know basically if you had enough memory you could just memorize all the moves of all chess games ever. That's why we say hard-coded chatbots are not intelligent. So hard-coded chatbots, they simply match your input to a database of reg exes and then they answer. And we're not very impressed because as soon as I give them something that is not covered by their reg exes, they fail. They just say I don't know or something like this. In fact what is intelligent is the engineer in that case. So the engineer that makes the program is intelligent. So he has this drawing, I think I've shown it last time, where you have the environment and there is this agent. And if the agent is really good with the environment, you might consider that intelligent, but in Sholeh's mind you have to also consider here the developer of the agent. It could be that the developer is very intelligent and just builds the agent to interact with the environment in a matter that it gets a lot of reward. It's very good at a skill, but the agent itself might not be intelligent. So it says intelligence, the intelligence of a process is not encoded by the performance of a system, but by the fact that the same process can be applied to different tasks. So in this case if I have a new task, a new environment, so E2 right here, the question is could I throw the same agent at that even if it hasn't seen it before? Or would I be able to take the same developer that develops me a new agent, agent 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, Chollet says, not intelligent if you simply add more training data. So a machine learning system that sort of learns to how to interact with these environments. If you can imagine that you have lots of environments, environment, environment, environment, environment, and so on, that give you a dense sampling of the environment space. So you have all of these environments, you build all of them, and you train this agent to interact well with all of them. So you give it lots of compute, lots of data, and the environments are really a dense sampling of the environment space. It will be able, even though it has never seen environment 2, 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 comes up a lot in this paper. So Suley says there are two ways to buy a skill, and by buying he basically means you don't buy as opposed to intelligently solving the skill. So whenever you buy a skill, that's not intelligent, Suley says, and you can buy a skill by either hard coding the solution or giving lots of data. And there is like this spectrum where you hard code, completely hard code a solution, and here is where you completely only feed data. So here would be something like GPT-3. There are almost no priors there, it's just a transformer, big transformer, and you just throw in data, lots and lots and lots and lots and lots of data. So in this measure, last time I've had lots of people, when GPT-3 came out, I've had people commenting on the part one of this paper saying, isn't GPT-3 intelligent? Because it can sort of generalize to these tasks that it hasn't been trained on. By the way, if you haven't seen the GPT-3 video, you should go watch it. Something tells me this video is popular, it might be five times as many views as any other video. So at least it's not a terrible video. But in essence, GPT-3 can solve these tasks that it wasn't trained for, 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 Shirley says, maybe you have just bought that skill with lots and lots of data. Now I actually don't know what to say to this because I mean it really seems like GPT-3 generalizes to tasks it has never seen before, but also it has had a lot of data. And so as of right now it is not really clear where the line is here. When are we going to argue that GPT-3 is actually... It could be that it has had lots of data, but also it is intelligent. How are we going to make that distinction? And I guess we're going to get into the math part, but I can tell you right now the math part is so abstract as it is not really practical. It is like a theoretical framework that you might be able to approximate. But you know there is like a wishy-washy thing going on. But he basically says, okay there's this spectrum of hard coding over here and then fully learning from data and with all of these methods and you know in between methods. Like a CNN would be here because it has like considerable priors because of its architecture and so on. And over here would be something like an A star search with like a learned heuristic or things like this. You can get good with any of these things, but the intelligence is orthogonal to that. So orthogonal to that is the intelligence axis. It has nothing... Sholay says this has nothing to do with this dimension. You can buy skill with this, but it's basically like it's like a triangle almost sort of where you have hard coding, data and then intelligence. And it's like its own axis. So the hard coding refers to the priors of a system that the developer has basically built in. And the learning from data refers to its experience. So basically the more experience a system has had, the more it can generalize to a new skill. That doesn't mean it's intelligent, it just means had more experience or respectively more priors. So the example gives a locality-sensitive hashing which is basically like a nearest neighbor method with enough data can solve any task. Like nearest neighbor enough data can solve any task. I think it's a famous theorem 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 gonna come up later. We should also pay attention to generalization difficulty. So generally how difficult is the task to solve given the experience we had. Because if the task is more difficult in a generalization sense, so if it's harder to from what we know get to the point where we can solve the task, then that would display higher intelligence. Yeah it says solving tasks via experience and priors has nothing to do with intelligence. It's just more experience, more priors. So goes back to human intelligence. It says how universal is actually human intelligence. And it gets to the to the point where he says it's not very universal. Because first of all there's no free lunch theorem where it says any two optimization algorithms will perform the same if you integrate across all possible problems. So it's even questionable whether something like general intelligence could even like universal intelligence could even exist. But if we look at the 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 humans 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't solve them, a couple of humans can't solve them. They're going to be you know 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 of physical fitness where it's not really one skill. So you can measure humans in how fast they run, how high they jump, 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. 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 a 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 routings. But it's probably like the your fitness is not very much affected by you being able to calculate the longest path unless you want to really avoid something. And just yeah 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. 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. Or to a degree like what can make the argument it's general biological life on earth but we measure intelligence with a human scope intelligence test and that's the thing we have. We don't have anything else. So we ask ourselves what are priors of humans? What has evolution built into humans? And Chollet decides on three levels of priors. The low level priors which are like reflexes. So if I 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 Chollet says it's not very interesting because there's nothing to do like we feel that it has nothing to do with intelligence. And then there are, I'm gonna 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 directedness. Humans generally view the world in terms of agents and in terms of agents having a goal. Like chasing after something. He makes this example and if we observe something we often want to frame it in terms of agents that pursue goals. And as soon as we can do that, that allows us to some degree to predict the world. And that's probably why this evolved. So very valuable skill. Social intuition and things like counting, like basic arithmetic, are built into humans. And Choulet says if we measure intelligence this is what we must account for. So these things should not count towards intelligence because they're already built into humans if we measure human intelligence. So you wouldn't test human intelligence by making them count because that's built into the humans. Now the third kind of priors that human have are meta learning priors. And the meta learning priors is basically your ability to learn something. This is your meta learning prior. It's 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 built into you. Among these are assumptions that the world is a hierarchical and causal place. That's how you see the world. And because you see the world like this, you can pick up these new skills very very quickly. You can explain through explaining the world. You can pick up new skills. And that is usually what we mean by intelligence. If someone sees a new unencountered before situation, thinks about it, which basically interprets the world in the hierarchical and causal way, and then is able to come up with a skill that solves the problem. And we generally view that as intelligence. So if we want to measure intelligence, we should measure this, basically how good you are picking up new skills, while accounting for these things. When we compare to humans. So Chollet says tests of intelligence should be founded on human-like knowledge priors. It basically makes the case that these should, if we build machines and compare them to humans in, let's say in terms of intelligence, we should build into the machines these things right here. These we should give them, like we should give them a counting module that they can use, like a calculator app. We should just build that in and make that available for the agent to use, like basic arithmetic. You shouldn't have to learn this. We should build in the notion that there are objects. We should build in the basic navigation module and so on that the agent can use. You can almost think of it like, you know, there'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, you know, 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 you know, it has access to a navigation prior. Let's draw a little world map right here. This is Google Maps. It can do that. It can query that sort of. And we shouldn't, if we want to build something that's intelligent, just compared to humans, we shouldn't, we should build in the navigation. We shouldn't, at least as much as human can do it. I mean, it's cool to have a machine learning system learn navigation, but that makes it less comparable. So it says either we should match the humans or we should account for the difference. So we should kind of let the difference be in, 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 language, the better you score at these tests. And therefore the tests are more like a measure of language ability than intelligence. So there, this is a lot much informed by, so I think the 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 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 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 a parent goes to the toilet, they really think the parent doesn't exist anymore and only later they learn object persistence. But I would question whether or not that's actually a learned thing or simply a built-in module that gets switched on at that particular point because probably evolution deems it not necessary to waste resources on that module before that. So I would, you know, 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 object persistence, I think that's, you can almost pinpoint the month of a human's life when that's switched on. That will be so accurate. And if this is really learned, then, you know, you'd have to assume like a very regular structure of the training data distribution that a baby gets to experience. So I'm not sure here. But, you know, it's not my opinion, it's a show-lease. 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-ness and goal-directedness, and we have already discussed that. Then natural numbers and elementary arithmetic. In, you know, you can small numbers, you can add, subtract, compare, sort, that sort of thing. And elementary geometry and topology, where in there would be orientation and navigation, and then distance orientation if it's something is inside or outside of a room and so on. Now I have heard, and this might be a myth, that there are languages where left and right, like relative directions, have no meaning, like doesn't exist in the language, but they always use absolute directions, and then these people automatically have a much, much better orientation at all time. Like if they get into a building, they can always tell you where north is. I don't know, maybe that's a myth, but I would guess that's pretty cool, and just shows you the flexibility of something like orientation. Sure, we can all orient, but it seems like by simply learning a different language, you can sort of supercharge that drive for orientation. So again, 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 in to learn objectness and physics and so on, but then also probably a lot of it might be learned in addition, or you might just be able to supercharge one of these modules that's inside of you. I think there's 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 the notion that we can ever explicitly list the priors that humans have, to me seems a bit ridiculous. So I guess we can sort of approximate this at first, but we will never exhaustively exactly describe what the priors are, what is learned. We've seen this with the orientation, like how much of that is learned and prior. And then secondly, even if we could list them pretty exactly, what says that we can exactly program them into an agent such that it can make use of it. That's an entirely, that's even harder challenge. So I'm not so sure a bit this AI systems should hard code core knowledge. He's gonna 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 tests should only involve core knowledge. And we're going to see how valid that claim is for his own ARC challenge. Now luckily in the math part that's gonna 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 one's more intelligent. Alright, so that was part two of this series. You know, it's already been a while now and this is only part two. And I do promise next time we're gonna 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, "end": 5.04, "text": " Hi there! Today we're going to continue with On the Measure of Intelligence by" }, { "start": 5.04, "end": 9.92, "text": " François Chollet. Now if you remember last time, if you haven't seen last time," }, { "start": 9.92, "end": 15.36, "text": " go watch part 1 if you're interested. This is a multi-part series on this" }, { "start": 15.36, "end": 20.36, "text": " paper. Why? Because the paper itself is very long. It's 40 pages, the main part," }, { "start": 20.36, "end": 25.44, "text": " and it's a big wall of text. So I've opted to basically pull out notes and" }, { "start": 25.44, "end": 30.96, "text": " show you the notes that I have pulled out and to divide this into multiple parts." }, { "start": 30.96, "end": 34.92, "text": " So last time we went over sort of the history of assessing intelligence and" }, { "start": 34.92, "end": 40.72, "text": " the basics. And I know I said this time I'm going to get into the math, but I" }, { "start": 40.72, "end": 46.84, "text": " lied. So I realized that there's still a lot that comes up in part 2 of the paper" }, { "start": 46.84, "end": 51.78, "text": " before we get into the actual math. So this part is going to be about the" }, { "start": 51.78, "end": 57.800000000000004, "text": " prerequisites to that and then next time math. I'm sorry to disappoint anyone." }, { "start": 57.800000000000004, "end": 64, "text": " You might just skip this one if you want. I do have to shout out Tim Scarf who of" }, { "start": 64, "end": 69.28, "text": " course runs the Machine Learning Street Talk channel podcast with me and Connor" }, { "start": 69.28, "end": 74.4, "text": " Shorten together. Tim has just made an entire video about this paper, about On" }, { "start": 74.4, "end": 79, "text": " the Measure of Intelligence, and his videos are usually like super high" }, { "start": 79, "end": 85.4, "text": " quality, like higher than mine, and it's the entire paper. So if you want to, you" }, { "start": 85.4, "end": 89.2, "text": " know, know the end of the story or, you know, have a different take on the paper," }, { "start": 89.2, "end": 96.8, "text": " definitely can recommend his video. I do make a guest appearance there, so yeah," }, { "start": 96.8, "end": 102.92, "text": " that's a given. And I will still finish the paper on this channel just in my" }, { "start": 102.92, "end": 109.72, "text": " regular in this style right here. So all the options are available to you. Let's" }, { "start": 109.72, "end": 116.2, "text": " dive into part 2. So if you remember part 1, we sort of went over what it" }, { "start": 116.2, "end": 121, "text": " means to be intelligent and we differentiated basically two things, which" }, { "start": 121, "end": 130.44, "text": " are skills and abilities. So a skill is how well you achieve a given task or how" }, { "start": 130.44, "end": 137.16, "text": " well you can do in a given task. So this could be chess or, you know, Go or" }, { "start": 137.16, "end": 142, "text": " something very, very measurable. An IQ test is a specific task. So these" }, { "start": 142, "end": 146.72, "text": " things right here, they're all tasks. But these tasks aren't the thing we're" }, { "start": 146.72, "end": 150.12, "text": " interested in. Just because a machine is good at chess doesn't mean it's" }, { "start": 150.12, "end": 157.48, "text": " intelligent. And what we want is sort of a generalizable skill. So we want to" }, { "start": 157.48, "end": 163.79999999999998, "text": " assess how generalizable is an ability. So can I throw a computer at a new" }, { "start": 163.79999999999998, "end": 167.83999999999997, "text": " problem that it has never seen before and it can solve that. And that's going" }, { "start": 167.83999999999997, "end": 172.48, "text": " to be this generalizability, this notion of can you solve things that you have" }, { "start": 172.48, "end": 176.88, "text": " never encountered before and weren't prepared for. That is going to be the" }, { "start": 176.88, "end": 183.95999999999998, "text": " basis for us to measure intelligence. So Chollet says you have to optimize" }, { "start": 183.96, "end": 189.96, "text": " directly for generality and flexibility rather than task performance if you want" }, { "start": 189.96, "end": 195.48000000000002, "text": " to build an intelligent agent. You have to sort of build something that is" }, { "start": 195.48000000000002, "end": 202.12, "text": " not just good at a thing. It is good at getting good at things. That's almost" }, { "start": 202.12, "end": 210.16, "text": " a quote worthy thing. So if you just give it a single task, the learner" }, { "start": 210.16, "end": 214.2, "text": " will just take any available shortcut. So if you just say you have to be" }, { "start": 214.2, "end": 219.56, "text": " good at chess, the developer of a system can exploit all the tricks" }, { "start": 219.56, "end": 223.84, "text": " that make you good at chess. And you don't have to be smart. You just know" }, { "start": 223.84, "end": 227.51999999999998, "text": " basically if you had enough memory you could just memorize all the moves of all" }, { "start": 227.51999999999998, "end": 232.96, "text": " chess games ever. That's why we say hard-coded chatbots are not" }, { "start": 232.96, "end": 238.44, "text": " intelligent. So hard-coded chatbots, they simply match your input to a database" }, { "start": 238.44, "end": 243.44, "text": " of reg exes and then they answer. And we're not very impressed because as soon" }, { "start": 243.44, "end": 249.12, "text": " as I give them something that is not covered by their reg exes, they" }, { "start": 249.12, "end": 254.04, "text": " fail. They just say I don't know or something like this. In fact what is" }, { "start": 254.04, "end": 260.44, "text": " intelligent is the engineer in that case. So the engineer that makes the program" }, { "start": 260.44, "end": 266.15999999999997, "text": " is intelligent. So he has this drawing, I think I've shown it last time, where" }, { "start": 266.16, "end": 274.08000000000004, "text": " you have the environment and there is this agent. And if the agent" }, { "start": 274.08000000000004, "end": 280.12, "text": " is really good with the environment, you might consider that intelligent, but in" }, { "start": 280.12, "end": 285.8, "text": " Sholeh's mind you have to also consider here the developer of the agent. It could" }, { "start": 285.8, "end": 290.72, "text": " be that the developer is very intelligent and just builds the agent to" }, { "start": 290.72, "end": 294.68, "text": " interact with the environment in a matter that it gets a lot of reward. It's" }, { "start": 294.68, "end": 301.04, "text": " very good at a skill, but the agent itself might not be intelligent. So it" }, { "start": 301.04, "end": 307.32, "text": " says intelligence, the intelligence of a process is not encoded by the performance" }, { "start": 307.32, "end": 311.96000000000004, "text": " of a system, but by the fact that the same process can be applied to different" }, { "start": 311.96000000000004, "end": 317.72, "text": " tasks. So in this case if I have a new task, a new environment, so E2 right here," }, { "start": 317.72, "end": 322.76, "text": " the question is could I throw the same agent at that even if it hasn't seen it" }, { "start": 322.76, "end": 328.59999999999997, "text": " before? Or would I be able to take the same developer that develops me a new" }, { "start": 328.59999999999997, "end": 334.44, "text": " agent, agent 2, that then can solve the task? In the case where I can throw" }, { "start": 334.44, "end": 338.59999999999997, "text": " over the agent, that would make an argument that the agent is intelligent," }, { "start": 338.59999999999997, "end": 343.08, "text": " but if I can't you'd have to make the argument that the developer is the" }, { "start": 343.08, "end": 347.64, "text": " intelligent part here, which of course is the point of what he's saying right" }, { "start": 347.64, "end": 354.8, "text": " here. So hard-coded programs themselves are not intelligent, but, and this is the" }, { "start": 354.8, "end": 360.3, "text": " case, the same counts for adding more training data. So not only is the hard" }, { "start": 360.3, "end": 366.52, "text": " coding not intelligent, it's also, Chollet says, not intelligent if you simply add" }, { "start": 366.52, "end": 371.12, "text": " more training data. So a machine learning system that sort of learns to how to" }, { "start": 371.12, "end": 377.32, "text": " interact with these environments. If you can imagine that you have lots" }, { "start": 377.32, "end": 382.52, "text": " of environments, environment, environment, environment, environment, and so on, that" }, { "start": 382.52, "end": 387.2, "text": " give you a dense sampling of the environment space. So you have all of" }, { "start": 387.2, "end": 391.68, "text": " these environments, you build all of them, and you train this agent to interact" }, { "start": 391.68, "end": 396.15999999999997, "text": " well with all of them. So you give it lots of compute, lots of data, and the" }, { "start": 396.15999999999997, "end": 401.32, "text": " environments are really a dense sampling of the environment space. It will be able," }, { "start": 401.32, "end": 405, "text": " even though it has never seen environment 2, this environment right" }, { "start": 405, "end": 409.76, "text": " here, it might be just able to generalize to this environment, given that it has" }, { "start": 409.76, "end": 415.12, "text": " been trained on all the environments here, like it has been trained on every" }, { "start": 415.12, "end": 418.8, "text": " possible environment around this environment that is similar to this" }, { "start": 418.8, "end": 425.36, "text": " environment, it could generally generalize to environment 2, but also we" }, { "start": 425.36, "end": 429.64, "text": " wouldn't view that as intelligent, because in a sense this skill has been" }, { "start": 429.64, "end": 436.08, "text": " bought with data. And this notion of buying skill comes up a lot in" }, { "start": 436.08, "end": 442.03999999999996, "text": " this paper. So Suley says there are two ways to buy a skill, and by buying he" }, { "start": 442.03999999999996, "end": 448.53999999999996, "text": " basically means you don't buy as opposed to intelligently solving the" }, { "start": 448.53999999999996, "end": 453.76, "text": " skill. So whenever you buy a skill, that's not intelligent, Suley says, and you can" }, { "start": 453.76, "end": 458.2, "text": " buy a skill by either hard coding the solution or giving lots of data. And" }, { "start": 458.2, "end": 463.24, "text": " there is like this spectrum where you hard code, completely hard code a" }, { "start": 463.24, "end": 469.03999999999996, "text": " solution, and here is where you completely only feed data. So here would" }, { "start": 469.03999999999996, "end": 474.91999999999996, "text": " be something like GPT-3. There are almost no priors there, it's just a" }, { "start": 474.91999999999996, "end": 480.52, "text": " transformer, big transformer, and you just throw in data, lots and" }, { "start": 480.52, "end": 484.08, "text": " lots and lots and lots and lots of data. So in this measure, last time I've had" }, { "start": 484.08, "end": 489.15999999999997, "text": " lots of people, when GPT-3 came out, I've had people commenting on the part one of" }, { "start": 489.15999999999997, "end": 495.68, "text": " this paper saying, isn't GPT-3 intelligent? Because it can sort of" }, { "start": 495.68, "end": 499.38, "text": " generalize to these tasks that it hasn't been trained on. By the way, if you" }, { "start": 499.38, "end": 505.88, "text": " haven't seen the GPT-3 video, you should go watch it. Something tells me this" }, { "start": 505.88, "end": 510.76, "text": " video is popular, it might be five times as many views as any other video." }, { "start": 510.76, "end": 518.52, "text": " So at least it's not a terrible video. But in essence, GPT-3 can solve these" }, { "start": 518.52, "end": 523.08, "text": " tasks that it wasn't trained for, right? And therefore you might argue in this" }, { "start": 523.08, "end": 526.84, "text": " definition right here, it could be intelligent because it can generalize." }, { "start": 526.84, "end": 532.48, "text": " But there is this counteraction where Shirley says, maybe you have just bought" }, { "start": 532.48, "end": 537.68, "text": " that skill with lots and lots of data. Now I actually don't know what to say to" }, { "start": 537.68, "end": 543.4799999999999, "text": " this because I mean it really seems like GPT-3 generalizes to tasks it has" }, { "start": 543.4799999999999, "end": 550.4799999999999, "text": " never seen before, but also it has had a lot of data. And so as of right now it is" }, { "start": 550.4799999999999, "end": 555.88, "text": " not really clear where the line is here. When are we going to argue" }, { "start": 555.88, "end": 560.5999999999999, "text": " that GPT-3 is actually... It could be that it has had lots of data, but also" }, { "start": 560.5999999999999, "end": 565.7199999999999, "text": " it is intelligent. How are we going to make that distinction? And I guess we're" }, { "start": 565.72, "end": 570.5600000000001, "text": " going to get into the math part, but I can tell you right now the math part is" }, { "start": 570.5600000000001, "end": 577.64, "text": " so abstract as it is not really practical. It is like a theoretical" }, { "start": 577.64, "end": 583.12, "text": " framework that you might be able to approximate. But you know there is" }, { "start": 583.12, "end": 587.96, "text": " like a wishy-washy thing going on. But he basically says, okay there's this" }, { "start": 587.96, "end": 593.72, "text": " spectrum of hard coding over here and then fully learning from data and with" }, { "start": 593.72, "end": 597.28, "text": " all of these methods and you know in between methods. Like a CNN would be" }, { "start": 597.28, "end": 601.08, "text": " here because it has like considerable priors because of its architecture and" }, { "start": 601.08, "end": 605.96, "text": " so on. And over here would be something like an A star search with like a" }, { "start": 605.96, "end": 612.52, "text": " learned heuristic or things like this. You can get good with any of" }, { "start": 612.52, "end": 617.88, "text": " these things, but the intelligence is orthogonal to that. So orthogonal to that" }, { "start": 617.88, "end": 624.84, "text": " is the intelligence axis. It has nothing... Sholay says this has nothing to do with" }, { "start": 624.84, "end": 629.36, "text": " this dimension. You can buy skill with this, but it's basically like it's like a" }, { "start": 629.36, "end": 636.04, "text": " triangle almost sort of where you have hard coding, data and then intelligence." }, { "start": 636.04, "end": 646.68, "text": " And it's like its own axis. So the hard coding refers to the priors of a system" }, { "start": 646.68, "end": 653.52, "text": " that the developer has basically built in. And the learning from data refers to" }, { "start": 653.52, "end": 658.2399999999999, "text": " its experience. So basically the more experience a system has had, the more" }, { "start": 658.2399999999999, "end": 662.7199999999999, "text": " it can generalize to a new skill. That doesn't mean it's intelligent, it just" }, { "start": 662.7199999999999, "end": 669.52, "text": " means had more experience or respectively more priors. So the example" }, { "start": 669.52, "end": 672.8, "text": " gives a locality-sensitive hashing which is basically like a nearest neighbor" }, { "start": 672.8, "end": 678.7199999999999, "text": " method with enough data can solve any task. Like nearest neighbor enough" }, { "start": 678.7199999999999, "end": 684.4399999999999, "text": " data can solve any task. I think it's a famous theorem that" }, { "start": 684.4399999999999, "end": 689.56, "text": " establishes that. So keep that in mind. That is why we basically need to" }, { "start": 689.56, "end": 695.4399999999999, "text": " pay attention to how much data went into this algorithm and sort of" }, { "start": 695.44, "end": 703.6800000000001, "text": " subtract that from our notion of how good, how intelligent it is. Yeah that's" }, { "start": 703.6800000000001, "end": 706.96, "text": " what he says. When we measure intelligence via skill, and this is" }, { "start": 706.96, "end": 710.6800000000001, "text": " really the only thing we can measure, we can only measure how good an agent is at" }, { "start": 710.6800000000001, "end": 715.5200000000001, "text": " a given skill. Anything higher than that we can't measure. So we must measure a" }, { "start": 715.5200000000001, "end": 721.96, "text": " skill, but we should factor out priors and experience. And that's gonna come up" }, { "start": 721.96, "end": 725.8000000000001, "text": " later. We should also pay attention to generalization difficulty. So generally" }, { "start": 725.8000000000001, "end": 732.6, "text": " how difficult is the task to solve given the experience we had. Because if the" }, { "start": 732.6, "end": 738.2, "text": " task is more difficult in a generalization sense, so if it's harder to" }, { "start": 738.2, "end": 743.52, "text": " from what we know get to the point where we can solve the task, then that would" }, { "start": 743.52, "end": 751, "text": " display higher intelligence. Yeah it says solving tasks via experience and priors" }, { "start": 751, "end": 757.12, "text": " has nothing to do with intelligence. It's just more experience, more priors. So" }, { "start": 757.12, "end": 762.88, "text": " goes back to human intelligence. It says how universal is actually human" }, { "start": 762.88, "end": 767.2, "text": " intelligence. And it gets to the to the point where he says it's not very" }, { "start": 767.2, "end": 772.04, "text": " universal. Because first of all there's no free lunch theorem where it says" }, { "start": 772.04, "end": 777.56, "text": " any two optimization algorithms will perform the same if you integrate across" }, { "start": 777.56, "end": 782.04, "text": " all possible problems. So it's even questionable whether something like" }, { "start": 782.04, "end": 786.16, "text": " general intelligence could even like universal intelligence could even exist." }, { "start": 786.16, "end": 792.1199999999999, "text": " But if we look at the DG factor which is used sometimes to assess human" }, { "start": 792.1199999999999, "end": 796.8399999999999, "text": " intelligence, or is the measure for human intelligence that is established" }, { "start": 796.8399999999999, "end": 802.52, "text": " right now, then they only encompass tasks that humans can perform and" }, { "start": 802.52, "end": 807.4799999999999, "text": " understand. Of course and I would say they only encompass tasks where human" }, { "start": 807.48, "end": 811.5600000000001, "text": " actually differ with respect to each other. Because if you're making these" }, { "start": 811.5600000000001, "end": 815.64, "text": " tests and you have a human for 40 minutes or so, you're not going to give" }, { "start": 815.64, "end": 820.44, "text": " the humans tasks where they don't differentiate from one another. So it's" }, { "start": 820.44, "end": 825.8000000000001, "text": " going to be a range like a very very small subset of tasks that are exactly" }, { "start": 825.8000000000001, "end": 829.96, "text": " hard enough such that a couple of humans can't solve them, a couple of humans" }, { "start": 829.96, "end": 836.64, "text": " can't solve them. They're going to be you know understandable by humans, and" }, { "start": 836.64, "end": 841.8, "text": " understandable ideally by any human. You don't have to have special" }, { "start": 841.8, "end": 846.92, "text": " pre-knowledge, not have studied biology in order to answer the questions, or not" }, { "start": 846.92, "end": 853.48, "text": " have a higher degree in math or something. So the reference for the" }, { "start": 853.48, "end": 860.76, "text": " G factor is very much a reference frame of human values. And he compares this to" }, { "start": 860.76, "end": 866.52, "text": " physical fitness. So if we call someone physically fit, what do we mean?" }, { "start": 866.52, "end": 872.4, "text": " We mean this general abstract concept of physical fitness where it's" }, { "start": 872.4, "end": 877.6, "text": " not really one skill. So you can measure humans in how fast they run, how high" }, { "start": 877.6, "end": 883.76, "text": " they jump, how fast they swim and so on, and how much they can lift. And" }, { "start": 883.76, "end": 888.96, "text": " across that you'll find generally that all of these things correlate and the" }, { "start": 888.96, "end": 894.72, "text": " result we call physical fitness. But it's not like physical fitness is a universal" }, { "start": 894.72, "end": 900.64, "text": " measure. So we only measure humans at tasks that humans can solve and are" }, { "start": 900.64, "end": 906.84, "text": " different at. So the physical fitness is very human centric and so is" }, { "start": 906.84, "end": 913.1600000000001, "text": " intelligence. So that's the analogy. I think it's a very good one. He" }, { "start": 913.1600000000001, "end": 918.6, "text": " says he gives this example where humans are for example very very good at" }, { "start": 918.6, "end": 923.88, "text": " shortest path traveling salesman problems. Give up to a certain number of" }, { "start": 923.88, "end": 929.52, "text": " nodes in the graph. Humans can solve them extremely well to like very good degree." }, { "start": 929.52, "end": 934.68, "text": " But as soon as you go to a longest path problem, which shouldn't be that much" }, { "start": 934.68, "end": 939.6, "text": " harder if you just look at it from an algorithmic perspective, but" }, { "start": 939.6, "end": 944.4399999999999, "text": " humans are terrible at it. Absolutely terrible. And that probably has to do" }, { "start": 944.4399999999999, "end": 951.68, "text": " with the fact that we have a prior. And the prior is much much more adapt to" }, { "start": 951.68, "end": 956.64, "text": " shortest path problems than longest path problems. Because in our history, in our" }, { "start": 956.64, "end": 961.4, "text": " evolutionary history, it made a lot of sense to build in a navigational unit in" }, { "start": 961.4, "end": 967.52, "text": " the brain that calculates shortest routings. But it's probably like the" }, { "start": 967.52, "end": 972.1999999999999, "text": " your fitness is not very much affected by you being able to calculate the" }, { "start": 972.1999999999999, "end": 978.92, "text": " longest path unless you want to really avoid something. And just" }, { "start": 978.92, "end": 985.16, "text": " yeah I don't know. You really want to walk in these shoes. So that should be" }, { "start": 985.16, "end": 990.4799999999999, "text": " taken into effect and it shows that intelligence is a very human centric" }, { "start": 990.4799999999999, "end": 997.52, "text": " concept. So when we talk about general artificial intelligence, what we" }, { "start": 997.52, "end": 1001.92, "text": " mean is it's tied to a scope of problems. And that's going to be important" }, { "start": 1001.92, "end": 1006.68, "text": " that we can only measure intelligence in this framework with respect to a scope" }, { "start": 1006.68, "end": 1017.2399999999999, "text": " of problems and the scope that we consider is the human scope. So why human" }, { "start": 1017.2399999999999, "end": 1022.1999999999999, "text": " centric? Because we must have a scope and the human scope is the only meaningful" }, { "start": 1022.1999999999999, "end": 1028.08, "text": " scope. It's the only one we know that you know there is one thing in the universe" }, { "start": 1028.08, "end": 1033.24, "text": " that we think is intelligent that we know of and that's humans. Or to a" }, { "start": 1033.24, "end": 1038.04, "text": " degree like what can make the argument it's general biological life on earth" }, { "start": 1038.04, "end": 1045.04, "text": " but we measure intelligence with a human scope intelligence test and that's the" }, { "start": 1045.04, "end": 1052.88, "text": " thing we have. We don't have anything else. So we ask ourselves what are" }, { "start": 1052.88, "end": 1061.56, "text": " priors of humans? What has evolution built into humans? And Chollet decides on" }, { "start": 1061.56, "end": 1067.8, "text": " three levels of priors. The low level priors which are like reflexes. So if I" }, { "start": 1067.8, "end": 1074.6399999999999, "text": " pinch you, you flick like if I flick you, you move back and if I shine a" }, { "start": 1074.6399999999999, "end": 1080.84, "text": " bright light at your eyes you close them and so on. So this Chollet says it's not" }, { "start": 1080.84, "end": 1085.08, "text": " very interesting because there's nothing to do like we feel that it has" }, { "start": 1085.08, "end": 1090.84, "text": " nothing to do with intelligence. And then there are, I'm gonna skip this one," }, { "start": 1090.84, "end": 1096.6399999999999, "text": " say there are knowledge priors. So the knowledge priors are you know things" }, { "start": 1096.6399999999999, "end": 1103.6799999999998, "text": " like the fact that there are objects in this world. That's a knowledge prior that" }, { "start": 1103.6799999999998, "end": 1108.1999999999998, "text": " the human have. That's built into you. The notion that the world consists of" }, { "start": 1108.1999999999998, "end": 1114.12, "text": " objects and you can interact with these objects. The" }, { "start": 1114.12, "end": 1120.82, "text": " navigation capability. We say okay navigate there. Humans can do it very" }, { "start": 1120.82, "end": 1125.4399999999998, "text": " very well as I already said. They're very good at shortest path problems and so on." }, { "start": 1125.4399999999998, "end": 1133, "text": " Intuitive navigation. That's built into you by evolution. That's a prior. Goal" }, { "start": 1133, "end": 1139.2, "text": " directedness. Humans generally view the world in terms of agents and in terms of" }, { "start": 1139.2, "end": 1145.72, "text": " agents having a goal. Like chasing after something. He makes this example and if" }, { "start": 1145.72, "end": 1150.32, "text": " we observe something we often want to frame it in terms of agents that pursue" }, { "start": 1150.32, "end": 1155.4199999999998, "text": " goals. And as soon as we can do that, that allows us to some degree to predict the" }, { "start": 1155.4199999999998, "end": 1161.2, "text": " world. And that's probably why this evolved. So very valuable skill. Social" }, { "start": 1161.2, "end": 1167.6, "text": " intuition and things like counting, like basic arithmetic, are built into humans." }, { "start": 1167.6, "end": 1172.28, "text": " And Choulet says if we measure intelligence this is what we must account" }, { "start": 1172.28, "end": 1177.96, "text": " for. So these things should not count towards intelligence because" }, { "start": 1177.96, "end": 1182.52, "text": " they're already built into humans if we measure human intelligence. So you" }, { "start": 1182.52, "end": 1188.32, "text": " wouldn't test human intelligence by making them count because" }, { "start": 1188.32, "end": 1194.08, "text": " that's built into the humans. Now the third kind of priors that human have are" }, { "start": 1194.08, "end": 1199.76, "text": " meta learning priors. And the meta learning priors is basically your" }, { "start": 1199.76, "end": 1204.32, "text": " ability to learn something. This is your meta learning prior. It's just your" }, { "start": 1204.32, "end": 1209.24, "text": " ability to learn something that is not learned. No one has to teach you how to" }, { "start": 1209.24, "end": 1214.28, "text": " learn something. I guess they're like learning strategies and so on. But you as" }, { "start": 1214.28, "end": 1220.56, "text": " a human are incredibly good at picking up new skills. And the skill of picking" }, { "start": 1220.56, "end": 1226.6799999999998, "text": " up new skills, that's built into you. Among these are assumptions" }, { "start": 1226.6799999999998, "end": 1232.08, "text": " that the world is a hierarchical and causal place. That's how you see the" }, { "start": 1232.08, "end": 1237.08, "text": " world. And because you see the world like this, you can pick up these new skills" }, { "start": 1237.08, "end": 1241.08, "text": " very very quickly. You can explain through explaining the world. You can" }, { "start": 1241.08, "end": 1246.96, "text": " pick up new skills. And that is usually what we mean by intelligence. If someone" }, { "start": 1246.96, "end": 1252.52, "text": " sees a new unencountered before situation, thinks about it, which" }, { "start": 1252.52, "end": 1257.1999999999998, "text": " basically interprets the world in the hierarchical and causal way, and then is" }, { "start": 1257.2, "end": 1263.24, "text": " able to come up with a skill that solves the problem. And we generally view that" }, { "start": 1263.24, "end": 1267.68, "text": " as intelligence. So if we want to measure intelligence, we should measure this," }, { "start": 1267.68, "end": 1272.28, "text": " basically how good you are picking up new skills, while accounting for these" }, { "start": 1272.28, "end": 1280.96, "text": " things. When we compare to humans. So Chollet says tests of intelligence" }, { "start": 1280.96, "end": 1285.8400000000001, "text": " should be founded on human-like knowledge priors. It basically makes the case that" }, { "start": 1285.84, "end": 1293.4399999999998, "text": " these should, if we build machines and compare them to humans in, let's say in" }, { "start": 1293.4399999999998, "end": 1299.52, "text": " terms of intelligence, we should build into the machines these things right" }, { "start": 1299.52, "end": 1304.1599999999999, "text": " here. These we should give them, like we should give them a counting module that" }, { "start": 1304.1599999999999, "end": 1308.52, "text": " they can use, like a calculator app. We should just build that in and make that" }, { "start": 1308.52, "end": 1312.6399999999999, "text": " available for the agent to use, like basic arithmetic. You shouldn't have to" }, { "start": 1312.64, "end": 1317.5600000000002, "text": " learn this. We should build in the notion that there are objects. We should build" }, { "start": 1317.5600000000002, "end": 1322.2800000000002, "text": " in the basic navigation module and so on that the agent can use. You can almost" }, { "start": 1322.2800000000002, "end": 1326.0400000000002, "text": " think of it like, you know, there's whatever your reinforcement learning" }, { "start": 1326.0400000000002, "end": 1331.0800000000002, "text": " agent, A, it consists of like this, maybe this big neural network with lots of" }, { "start": 1331.0800000000002, "end": 1336.3200000000002, "text": " layers, but then each layer maybe has access to, you know, the calculator app" }, { "start": 1336.32, "end": 1343, "text": " right here, and each layer has access to maybe also memory. I would guess" }, { "start": 1343, "end": 1347.96, "text": " memory is one of those priors as well. Or you know, it has access to a navigation" }, { "start": 1347.96, "end": 1352.72, "text": " prior. Let's draw a little world map right here. This is Google Maps. It can do" }, { "start": 1352.72, "end": 1359.3999999999999, "text": " that. It can query that sort of. And we shouldn't, if we want to build something" }, { "start": 1359.3999999999999, "end": 1364.28, "text": " that's intelligent, just compared to humans, we shouldn't, we should build in" }, { "start": 1364.28, "end": 1369.96, "text": " the navigation. We shouldn't, at least as much as human can do it. I mean, it's cool" }, { "start": 1369.96, "end": 1374.3999999999999, "text": " to have a machine learning system learn navigation, but that makes it less" }, { "start": 1374.3999999999999, "end": 1379.16, "text": " comparable. So it says either we should match the humans or we should account" }, { "start": 1379.16, "end": 1384.56, "text": " for the difference. So we should kind of let the difference be in, let the" }, { "start": 1384.56, "end": 1388.56, "text": " difference between the humans and the machines into the measure of our" }, { "start": 1388.56, "end": 1394.8, "text": " intelligence. Further, if you test intelligence, all of these priors" }, { "start": 1394.8, "end": 1400.8, "text": " should be explicitly described and not rely on additional priors. So that's" }, { "start": 1400.8, "end": 1407.36, "text": " often the case in IQ tests. There are so many priors that are not explicitly" }, { "start": 1407.36, "end": 1412.24, "text": " described because we just, you know, we just think, yeah, every human can count. We" }, { "start": 1412.24, "end": 1417.76, "text": " don't need to write down that our prior assumptions are that the humans can" }, { "start": 1417.76, "end": 1423.44, "text": " count or understand language. And that's, I hear sometimes a problem in IQ tests" }, { "start": 1423.44, "end": 1428, "text": " that basically the better you understand language, the better you score at these" }, { "start": 1428, "end": 1433.52, "text": " tests. And therefore the tests are more like a measure of language ability than" }, { "start": 1433.52, "end": 1440.32, "text": " intelligence. So there, this is a lot much informed by, so I think the" }, { "start": 1440.32, "end": 1448.4399999999998, "text": " psychometrics community is on the same path right here. Yeah, he goes into this" }, { "start": 1448.4399999999998, "end": 1452.62, "text": " theory of human core knowledge where he basically expands on what the human" }, { "start": 1452.62, "end": 1459.56, "text": " priors are. So this core knowledge theory takes on four" }, { "start": 1459.56, "end": 1464.1599999999999, "text": " different categories. So the first one is object-ness and elementary physics, which" }, { "start": 1464.1599999999999, "end": 1467.96, "text": " means you as a human have an inherent knowledge that there are objects, as I" }, { "start": 1467.96, "end": 1473.1200000000001, "text": " said, but also of elementary physics, that stuff sticks together, persistence of" }, { "start": 1473.1200000000001, "end": 1477.72, "text": " objects. And some people say, you know, this is learned. So children, young" }, { "start": 1477.72, "end": 1482.28, "text": " children, they do not know object persistence and that's why peekaboo is" }, { "start": 1482.28, "end": 1488.2, "text": " so interesting. But because they think you're gone, right? They think, you know," }, { "start": 1488.2, "end": 1493.24, "text": " if a parent goes to the toilet, they really think the parent doesn't" }, { "start": 1493.24, "end": 1499.4, "text": " exist anymore and only later they learn object persistence. But I would question" }, { "start": 1499.4, "end": 1503.4, "text": " whether or not that's actually a learned thing or simply a built-in module that" }, { "start": 1503.4, "end": 1508.96, "text": " gets switched on at that particular point because probably evolution deems it not" }, { "start": 1508.96, "end": 1515.2, "text": " necessary to waste resources on that module before that. So I would, you know," }, { "start": 1515.2, "end": 1520.36, "text": " I would be cautionary saying that object persistence and all of these" }, { "start": 1520.36, "end": 1526.04, "text": " things, in fact, are learned. I would argue more that they are built in and are" }, { "start": 1526.04, "end": 1532.28, "text": " simply switched on at a given time during development. Because we also know" }, { "start": 1532.28, "end": 1536.24, "text": " these things like object persistence, I think that's, you can almost" }, { "start": 1536.24, "end": 1541.9199999999998, "text": " pinpoint the month of a human's life when that's switched on. That will be so" }, { "start": 1541.9199999999998, "end": 1548.24, "text": " accurate. And if this is really learned, then, you know, you'd have to assume like" }, { "start": 1548.24, "end": 1553.92, "text": " a very regular structure of the training data distribution that a baby gets to" }, { "start": 1553.92, "end": 1560, "text": " experience. So I'm not sure here. But, you know, it's not my opinion, it's" }, { "start": 1560, "end": 1564.84, "text": " a show-lease. Yeah, contact interaction, the fact that you can interact with" }, { "start": 1564.84, "end": 1569.68, "text": " objects by contacting them, or that objects can interact with each other by" }, { "start": 1569.68, "end": 1574.2, "text": " being next to each other. That's built into you as well. You don't have to" }, { "start": 1574.2, "end": 1578.44, "text": " learn that. If you compare this to like an RL agent that has to learn all of this" }, { "start": 1578.44, "end": 1586.24, "text": " from pixels, basically, you can see why Sholei has a problem with the current" }, { "start": 1586.24, "end": 1591.76, "text": " direction of deep learning and claiming that things are intelligent there" }, { "start": 1591.76, "end": 1599.56, "text": " because the comparison is just very invalid. So the second core knowledge you" }, { "start": 1599.56, "end": 1604.18, "text": " have is agent-ness and goal-directedness, and we have already discussed that. Then" }, { "start": 1604.18, "end": 1608.72, "text": " natural numbers and elementary arithmetic. In, you know, you can small numbers, you" }, { "start": 1608.72, "end": 1613.92, "text": " can add, subtract, compare, sort, that sort of thing. And elementary geometry and" }, { "start": 1613.92, "end": 1619.1200000000001, "text": " topology, where in there would be orientation and navigation, and then" }, { "start": 1619.1200000000001, "end": 1624.48, "text": " distance orientation if it's something is inside or outside of a room and so on." }, { "start": 1624.48, "end": 1631.8400000000001, "text": " Now I have heard, and this might be a myth, that there are languages where left" }, { "start": 1631.84, "end": 1636.8799999999999, "text": " and right, like relative directions, have no meaning, like doesn't exist in the" }, { "start": 1636.8799999999999, "end": 1641.6799999999998, "text": " language, but they always use absolute directions, and then these people" }, { "start": 1641.6799999999998, "end": 1646.8, "text": " automatically have a much, much better orientation at all time. Like if they" }, { "start": 1646.8, "end": 1651.4399999999998, "text": " get into a building, they can always tell you where north is. I don't know," }, { "start": 1651.4399999999998, "end": 1656.74, "text": " maybe that's a myth, but I would guess that's pretty cool, and just shows you" }, { "start": 1656.74, "end": 1661.04, "text": " the flexibility of something like orientation. Sure, we can all orient, but" }, { "start": 1661.04, "end": 1664.24, "text": " it seems like by simply learning a different language, you can sort of" }, { "start": 1664.24, "end": 1671.84, "text": " supercharge that drive for orientation. So again, it sort of feels like" }, { "start": 1671.84, "end": 1676.44, "text": " there is a lot of nature versus nurture going on in here, in that all of these" }, { "start": 1676.44, "end": 1682.28, "text": " things, yes, you probably have a tendency built in to learn objectness and physics" }, { "start": 1682.28, "end": 1688.8799999999999, "text": " and so on, but then also probably a lot of it might be learned in addition, or" }, { "start": 1688.88, "end": 1693.16, "text": " you might just be able to supercharge one of these modules that's" }, { "start": 1693.16, "end": 1700.48, "text": " inside of you. I think there's lots of room for discussion here." }, { "start": 1700.48, "end": 1708.1200000000001, "text": " So he says tests for intelligence should only involve core knowledge, and the AI" }, { "start": 1708.1200000000001, "end": 1712.4, "text": " systems taking these tests should hard code that core knowledge. So basically" }, { "start": 1712.4, "end": 1718.16, "text": " what he said before, we should build in these things right here, these core" }, { "start": 1718.16, "end": 1722.64, "text": " knowledge things, we should build these into the AI systems if we want to" }, { "start": 1722.64, "end": 1727.76, "text": " compare them to humans. Because if they have these things and only these things" }, { "start": 1727.76, "end": 1733.0800000000002, "text": " built in, then they sort of have the same starting point as a human. Now in this" }, { "start": 1733.0800000000002, "end": 1738.88, "text": " case, this is where I sort of disagree, because the notion that we can" }, { "start": 1738.88, "end": 1743.52, "text": " ever explicitly list the priors that humans have, to me seems a bit" }, { "start": 1743.52, "end": 1749.92, "text": " ridiculous. So I guess we can sort of approximate this at first, but we" }, { "start": 1749.92, "end": 1754.56, "text": " will never exhaustively exactly describe what the priors are, what is learned." }, { "start": 1754.56, "end": 1758.2, "text": " We've seen this with the orientation, like how much of that is learned and" }, { "start": 1758.2, "end": 1764.96, "text": " prior. And then secondly, even if we could list them pretty exactly, what says" }, { "start": 1764.96, "end": 1771.76, "text": " that we can exactly program them into an agent such that it can make use" }, { "start": 1771.76, "end": 1777.16, "text": " of it. That's an entirely, that's even harder challenge. So I'm not so sure a" }, { "start": 1777.16, "end": 1782.68, "text": " bit this AI systems should hard code core knowledge. He's gonna try that with" }, { "start": 1782.68, "end": 1786, "text": " this ARC challenge that we're going to look at in like the last part of this" }, { "start": 1786, "end": 1792.56, "text": " series. But it's a cool test for intelligence, I admit that, but I doubt" }, { "start": 1792.56, "end": 1798.36, "text": " that anyone really manages to hard code the core knowledge. And he says tests" }, { "start": 1798.36, "end": 1803.08, "text": " should only involve core knowledge. And we're going to see how" }, { "start": 1803.08, "end": 1809.4799999999998, "text": " valid that claim is for his own ARC challenge. Now luckily in the math part" }, { "start": 1809.4799999999998, "end": 1816, "text": " that's gonna come up, he doesn't strictly rely on these things. So he" }, { "start": 1816, "end": 1820.9599999999998, "text": " gives us a way how we can compare, even if the priors of two systems are" }, { "start": 1820.9599999999998, "end": 1825.84, "text": " different, we can compare which one's more intelligent. Alright, so that was" }, { "start": 1825.84, "end": 1831.04, "text": " part two of this series. You know, it's already been a while now and this is" }, { "start": 1831.04, "end": 1836.4399999999998, "text": " only part two. And I do promise next time we're gonna get into the math. I hope" }, { "start": 1836.4399999999998, "end": 1843.76, "text": " you like this and go check out Tim Scarves video on the same topic. Yeah, as" }, { "start": 1843.76, "end": 1848.28, "text": " I said, usually much higher quality videos than mine. And I'll see you next" }, { "start": 1848.28, "end": 1856.16, "text": " time. Bye bye." } ]
YBlNQK0Ao6g
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Image GPT: Generative Pretraining from Pixels (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "openai", "gpt2", "gpt3", "bert", "transformer", "attention is all you need", "attention mechanism", "multi-head attention", "pixel rnn", "pixel cnn", "pretraining", "representation", "linear probe", "fine-tuning", "cifar10", "cifar100", "imagenet", "cnn", "convolutional neural network", "autoregressive" ]
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 so on. So it is basically 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 wider 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. Now this is a pixel. Now this idea of one pixel by pixel isn't new. This has been around before but the investigation here is basically how much can we how far can we push these generative models for pre-training. Hi there this is Janek from Post Production. I've realized that I've forgotten to even read the name of the paper. So it's called generative pre-training from pixels by Mark Chen, Alec Radford, Rowan Child, Jeff Wu, Hewon Ju, Prafula Dariwal, David Luan and Ilya Sotskyver. And since Henry AI Labs has already made a video on this, this video is going to be more of kind of a rumble rant about what I find interesting about the paper and some thoughts about it rather than like a classic explanation. I hope you still enjoy that. So what you saw on the right wasn't even the this isn't the final result the supposed result this is simply the pre-training task. It's fun to look at it but the actual object objective of the paper is the following. What if we train we pre-train on a large data set to generate what good images like these or we to complete images like these and then we fine-tune on a classification task. And the answer is here they say on C410 we achieve 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. An even larger model trained on a mixture of ImageNet and web images is competitive with self supervised benchmarks on ImageNet 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 ImageNet it's a thousand. 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 first want to take the large data set, train this network right here and then in a second step fine-tune the network on this smaller data set and you sort of hope that what you learn from the large data set right here transfers over a little bit of knowledge. You already have a little bit of knowledge and you can make better use of the data that you have right here. Now the question is how do you do this pre-training and of course this has a long tradition, well long for maybe two or three years right now in the language community where people they pre-train these large models like we've just seen GPT-3 or BERT was one of them. They pre-train these large transformer models on text and then to fine-tune them on classification tasks for text and that's what this paper is doing right here. They pre-train a transformer that is a GPT-2 scale model, they pre-train it on image generation and then they fine-tune it or transfer learn it to classification tasks. And the point of the paper is to say that like in text data, in text data we have made pretty good experiences with doing this, with pre-training a generative model and then fine-tuning on a classification task. While so far in images all we've ever done is we've pre-trained these pre-training tasks which 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 entirely new but they show that if you throw a lot of computers at it and lots of data and a model then that can work equally well to these 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 ImageNet has 224 squared pixels and that times three right because you have three color channels. That's too large even for an open AI supercomputer. So what they do is first they downscale the image. So they downscale it's not as drastic as here where you just get a three by three image but they do downscale it to like a 32 by 32 or a 64 by 64. Then they unroll it which simply means they go through the image like this and make a sequence out of it because their models are naturally made for text sequences. They simply put the image into a text sequence. They further simplify this by reducing the three color channels to a single one. So they have their own color representation and basically yeah they reduce the three color channels to one channel that simply indexes the color in their color representation. And they say it's still pretty good. It's pretty faithful. So ultimately they end up with like a 32 squared length representation of their image. And then they do one of two things. They either do autoregressive generative pre-training which is the sort of GPT-2 style pre-training. And the 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 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 only in one direction. So you train all of these in parallel. And when you predict this pixel right here, you only want information from whatever was before that pixel. Otherwise the model could cheat, right? Otherwise the model could simply learn to copy over the value. But the attention pattern here is simply to show you that this is autoregressive and it's in one direction. So you always want to predict the next pixel. And then from all of this you want to predict the next pixel. And then from all of this you want to predict the next pixel. This is in contrast to this objective here that comes from BERT. And I've also made a video on BERT. What you do in BERT is you simply take that image and you cross the block out two of the pixels, or many of the pixels, and you simply ask your network to reconstruct those pixels. And now you can see the attention flows in all directions. BERT, the B stands actually for bidirectional. So this is the contrast to the autoregressive pre-training framework. Now these two things have been applied in text both. The autoregressive is usually easier to actually make it produce something, like we saw producing these images, because you can always just predict the next pixel and then the next and then the next and then the next. Whereas in BERT it's a bit more unclear how you would produce things in a consistent manner. Because the predictions of these two pixels right here, they are independent. It's one forward pass and then both of these are predicted. But other papers have tried to solve this like this, not XLNet. I forget its name. It's something with an X. 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, 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. That's all like you do with text. And in BERT you simply input an image, cross out pixels and then predict them. So you don't need labels for this. And that's why you can do it with this big data set. And you can do it in an unsupervised fashion. So you can just crawl the internet for images and just feed this into there. And it will sort of learn to produce these images. Now the question is, if you learn to produce these images, does that help you for classification? And they have two methods of assessing this. The bottom one here is the fine-tuning method. So this is supposed to be the representation you learn in the different layers of the network. So this is supposed to be this thing right here. What you'll do is you'll simply fine-tune. That means you on top of this representation you add a classification head that has two outputs, cat or dog, and you train this entire network on your small data set that we discussed before. So you train the entire network, all of the parameters. This is called fine-tuning. In contrast to that, what you can do is you can simply add this classification head with two outputs and then only train this classification head. And that 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 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. So these are the two things they assess. So as for datasets, for C410 they use like C410 and C4100 as datasets and the STL10. And there you have to keep in mind the pre-training is done on ImageNet for those. So you pre-train on ImageNet without the labels and then you transfer learn or fine-tune or linear probe on these small datasets. 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 96% on C410. I mean current state-of-the-art is like 99%, but still 96% is pretty good. And this is the entire network. There is this big giant network that you input your image into and then there is this one linear layer that does the classification. And all of this right here has not been trained with classification in mind. It simply has been trained to reproduce images. It hasn't even been trained on C410 as far as I understand. It's been trained on ImageNet. So this is to stress how cool or how significant this result is basically. That just a linear probe on top of that will give you such a good accuracy. And the second thing that is obvious right here is this bottom axis is the layer. So this is the layer where they attach the linear probe. And usually if you pre-train a network with a classification task in mind, so you pre-train it with the labels or maybe even without the labels in a self supervised way or something like this, usually the last layer has the best representation for classification. But here the special thing is that the intermediate layers in the middle have the best representation. You can see that the representation quality in terms of linear probing falls off as they sort of it falls off as they go into higher layers. And this is consistent across the datasets 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've blocked part of it, so you've blocked this and this, wrong way around this, so you've generated everything and now your task is to predict the next pixel. So you're trained 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, if you'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, 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 of 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 interesting findings of this paper. I mean it's cool that they can reach a good accuracy, but to recognize that maybe in these generative models they have some intermediate stage where they represent the global information, and that will actually make the best representation. The second cool thing right here is that you can see they have different sizes of models. So the IGPT-L I believe is something like 60 layers, then this is like 48 layers, and this is 32 layers. So these are all on the scale of GPT-2, either a little bigger or a little smaller. It's not like a GPT-3 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 exascale. What's interesting right here is that you can see the larger models, they reach a lower validation loss. So here is the validation loss. The larger model, if you train them on, so these checkpoints here are always after the same amount of steps. The larger models do reach a lower validation loss right here, as you can see. So this is the large, this is the medium, this is the small. And also you can see that on this axis the linear probe accuracy. So this is whenever you go and you find the best intermediate layer for linear probing, you probe it and you record the accuracy. So you can see a general trend as your validation loss goes down, the linear probe accuracy goes up. So there is a connection like it is in text models. In text models there's a connection of the perplexity of your language model and the quality 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. 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 to estimate what's going on also since image pixels. Humans don't have a super good model on image pixels in their head as we have about text. As you can see if you then fine-tune, so for now we've just do linear probing, if you fine-tune these architectures then you reach like a 99% accuracy on C410 which is on par with the best models that we have. So G-Pipe is supervised, pre-trained on ImageNet but also I guess uses a bunch of data augmentation while these image GPT it uses minimal data augmentation I think. They simply random crop a little bit and that's about it. So they also experiment around with this BERT objective. So until now this was all this autoregressive objective and I feel that OpenAI people are a bit more of a fan of the autoregressive objective just given what they've done so far in their papers. And you can see here comparison of the two objectives on C410 and on ImageNet. Again C410 is pre-trained with ImageNet and ImageNet itself is pre-trained with like a larger collection of images from the web. All the pre-training is done without labels. Now the blue is what you can reach with a linear probe and the orange is then on top of that what you can reach by fine-tuning. So no linear probe but fine-tuning. I have to say that the fine-tuning is always done at the end. So even though the linear probe 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 from in-between but it always worked out best whenever you fine-tune. Whenever you fine-tune you take actually the last layer. So that kind of gives you an idea that the model is then... What seems to be important is this coming up with the higher level representation and then once you fine-tune you're probably able to push that representation through to the end because of your training signal. But if you hadn't done the pre-training you wouldn't even have that higher level representation and then the signal I guess is not strong enough to back propagate through the whole model. It would be very interesting if they investigate, if they do this linear probe analysis again after they fine-tune the model. 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 gonna 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-train. 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 autoregressive objective, they sort of trade off. So the BERT it tends to do poorly in the linear probe setting but then it catches up during fine-tuning. In C410 almost being at the level of the autoregressive and in in ImageNet actually outperforming it. This darker thing here it simply means that you average across different maskings of BERT because I guess even in classification it's not entirely clear how to get a signal out of BERT because they don't do this CLS vector with BERT. What they do for classification and linear probing and that's written up here, they simply take the 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 fine-tune, while fine-tuning the classification loss yields reasonable downstream performance, we find empirically that the joint objective, the generative objective and the classification objective works even better. 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 learned position encodings. And yeah, check it out, that was it from me. Bye bye.
[ { "start": 0, "end": 5.78, "text": " Okay, I'm sure many of you have already seen this because it was rather widely" }, { "start": 5.78, "end": 12.5, "text": " announced but the OpenAI team has announced a new model that produces" }, { "start": 12.5, "end": 17.84, "text": " pictures instead of text. So as you can see right here on the left you'll always" }, { "start": 17.84, "end": 23.98, "text": " see like a half a picture and on the right is the ground truth. So they took" }, { "start": 23.98, "end": 29.54, "text": " this picture, they simply cut the bottom half right here and then they let the" }, { "start": 29.54, "end": 35.16, "text": " model sort of imagine what they cut away and what it comes up with is pretty cool" }, { "start": 35.16, "end": 42.96, "text": " I have to say. Like look at the birds, like this is just awesome. But the special" }, { "start": 42.96, "end": 47.14, "text": " thing about this isn't that it simply completes pictures, the special thing" }, { "start": 47.14, "end": 54.28, "text": " about it is it does it one pixel by pixel. So basically it goes at this pixel" }, { "start": 54.28, "end": 59.08, "text": " right here and asks okay what's that pixel and then what's that pixel and" }, { "start": 59.08, "end": 67.36, "text": " so on. So it is basically like a language model but for pixels in that it" }, { "start": 67.36, "end": 74.36, "text": " goes over the images in order basically like this or like always from left to" }, { "start": 74.36, "end": 81.64, "text": " right, left to right, left to right and it has no clue of the spatial relations" }, { "start": 81.64, "end": 85, "text": " between the pixels. It needs to learn that by itself as opposed to a" }, { "start": 85, "end": 90.88, "text": " convolutional neural network which is specifically designed such that if you" }, { "start": 90.88, "end": 95.48, "text": " want to predict this pixel right here then it's specifically designed to say" }, { "start": 95.48, "end": 101.24000000000001, "text": " okay the most important information is probably around that pixel and then some" }, { "start": 101.24000000000001, "end": 106.76, "text": " like other important information is wider around that pixel. So CNNs are" }, { "start": 106.76, "end": 111.32, "text": " built with this in mind whereas this model right here which is also known as" }, { "start": 111.32, "end": 118.44, "text": " image GPT doesn't have any of that. It's simply a transformer model that" }, { "start": 118.44, "end": 123.88, "text": " goes over these pixels one by one and we'll see how that's done. There are some" }, { "start": 123.88, "end": 128.84, "text": " more examples right here. Particularly cool is the cat and you see that there" }, { "start": 128.84, "end": 135.79999999999998, "text": " is the beginning of this little white thing right here which is this card and" }, { "start": 135.8, "end": 148.68, "text": " the completions of the model. Yes very interesting. The model can of course as a" }, { "start": 148.68, "end": 154.84, "text": " language model can also sample by itself just random images. You sample them once" }, { "start": 154.84, "end": 159.8, "text": " through and this is what it comes up with. So these are pretty good quality" }, { "start": 159.8, "end": 165.24, "text": " images for a model that just produces one pixel by one pixel. Now this is a" }, { "start": 165.24, "end": 169.88, "text": " pixel. Now this idea of one pixel by pixel isn't new. This has been around" }, { "start": 169.88, "end": 177.32000000000002, "text": " before but the investigation here is basically how much can we how far can we" }, { "start": 177.32000000000002, "end": 182.84, "text": " push these generative models for pre-training. Hi there this is Janek" }, { "start": 182.84, "end": 188.20000000000002, "text": " from Post Production. I've realized that I've forgotten to even read the name of" }, { "start": 188.20000000000002, "end": 192.12, "text": " the paper. So it's called generative pre-training from pixels by Mark Chen," }, { "start": 192.12, "end": 199.8, "text": " Alec Radford, Rowan Child, Jeff Wu, Hewon Ju, Prafula Dariwal, David Luan and" }, { "start": 199.8, "end": 206.36, "text": " Ilya Sotskyver. And since Henry AI Labs has already made a video on this, this" }, { "start": 206.36, "end": 210.76, "text": " video is going to be more of kind of a rumble rant about what I find" }, { "start": 210.76, "end": 215.32, "text": " interesting about the paper and some thoughts about it rather than like a" }, { "start": 215.32, "end": 219.96, "text": " classic explanation. I hope you still enjoy that. So what you saw on the right" }, { "start": 219.96, "end": 224.28, "text": " wasn't even the this isn't the final result the supposed result this is" }, { "start": 224.28, "end": 229.56, "text": " simply the pre-training task. It's fun to look at it but the actual object" }, { "start": 229.56, "end": 237, "text": " objective of the paper is the following. What if we train we pre-train on a large" }, { "start": 237, "end": 245.96, "text": " data set to generate what good images like these or we to complete images like" }, { "start": 245.96, "end": 253.72, "text": " these and then we fine-tune on a classification task. And the answer is" }, { "start": 253.72, "end": 262.28000000000003, "text": " here they say on C410 we achieve the 96.3% accuracy with a linear probe" }, { "start": 262.28000000000003, "end": 269.08, "text": " outperforming a supervised wide resonant and a 99% accuracy with full" }, { "start": 269.08, "end": 275.64, "text": " fine-tuning matching the top supervised pre-trained models. An even larger model" }, { "start": 275.64, "end": 280.76, "text": " trained on a mixture of ImageNet and web images is competitive with self" }, { "start": 280.76, "end": 286.28, "text": " supervised benchmarks on ImageNet achieving 72 top one accuracy on a" }, { "start": 286.28, "end": 294.12, "text": " linear probe of our features. So the goal here is that you have a data set that" }, { "start": 294.12, "end": 300.59999999999997, "text": " you want to train a classifier on. So usually you have a data set and the" }, { "start": 300.6, "end": 306.04, "text": " data set has images and you put them through like a convolutional neural" }, { "start": 306.04, "end": 311.16, "text": " network and then you have to classify the image into one of I don't know how" }, { "start": 311.16, "end": 315.88, "text": " many classes on C410 that's 10 classes on ImageNet it's a thousand. And the" }, { "start": 315.88, "end": 321.88, "text": " data set is these images together with these labels. Now the idea of pre-training" }, { "start": 321.88, "end": 328.52000000000004, "text": " is that you somewhere have a bigger data set that is sort of similar to the small" }, { "start": 328.52, "end": 333.4, "text": " data set but yeah it's similar enough such that the network could learn" }, { "start": 333.4, "end": 337.32, "text": " something. So what you want to do first is you first want to take the large data" }, { "start": 337.32, "end": 343.4, "text": " set, train this network right here and then in a second step fine-tune the" }, { "start": 343.4, "end": 347.47999999999996, "text": " network on this smaller data set and you sort of hope that what you learn from" }, { "start": 347.47999999999996, "end": 352.68, "text": " the large data set right here transfers over a little bit of knowledge. You" }, { "start": 352.68, "end": 356.59999999999997, "text": " already have a little bit of knowledge and you can make better use of the data" }, { "start": 356.6, "end": 361.96000000000004, "text": " that you have right here. Now the question is how do you do this pre-training" }, { "start": 361.96000000000004, "end": 367.48, "text": " and of course this has a long tradition, well long for maybe two or three years" }, { "start": 367.48, "end": 373.48, "text": " right now in the language community where people they pre-train these large" }, { "start": 373.48, "end": 380.52000000000004, "text": " models like we've just seen GPT-3 or BERT was one of them. They pre-train these" }, { "start": 380.52, "end": 386.59999999999997, "text": " large transformer models on text and then to fine-tune them on classification" }, { "start": 386.59999999999997, "end": 391.15999999999997, "text": " tasks for text and that's what this paper is doing right here. They pre-train a" }, { "start": 391.15999999999997, "end": 401.15999999999997, "text": " transformer that is a GPT-2 scale model, they pre-train it on image generation" }, { "start": 401.15999999999997, "end": 407.56, "text": " and then they fine-tune it or transfer learn it to classification tasks. And the" }, { "start": 407.56, "end": 413.88, "text": " point of the paper is to say that like in text data, in text data we have made" }, { "start": 413.88, "end": 421.88, "text": " pretty good experiences with doing this, with pre-training a generative" }, { "start": 421.88, "end": 426.44, "text": " model and then fine-tuning on a classification task. While so far in" }, { "start": 426.44, "end": 431.96, "text": " images all we've ever done is we've pre-trained these pre-training tasks" }, { "start": 431.96, "end": 437.88, "text": " which usually is a classification task or like a self-supervised task with a" }, { "start": 437.88, "end": 443.56, "text": " contrastive loss or something like this. What they're doing new is the" }, { "start": 443.56, "end": 450.2, "text": " generative modeling as a pre-training. And again this isn't entirely new but" }, { "start": 450.2, "end": 457.4, "text": " they show that if you throw a lot of computers at it and lots of data and a" }, { "start": 457.4, "end": 462.52, "text": " model then that can work equally well to these self-supervised tasks. So their" }, { "start": 462.52, "end": 467.64, "text": " model as I said is pretty pretty simple. They take an image and they unroll the" }, { "start": 467.64, "end": 475.23999999999995, "text": " image. Now a fully unrolled image on let's say ImageNet has 224 squared" }, { "start": 475.23999999999995, "end": 479.64, "text": " pixels and that times three right because you have three color channels." }, { "start": 479.64, "end": 486.91999999999996, "text": " That's too large even for an open AI supercomputer. So what they do is first" }, { "start": 486.92, "end": 492.04, "text": " they downscale the image. So they downscale it's not as drastic as here" }, { "start": 492.04, "end": 496.68, "text": " where you just get a three by three image but they do downscale it to like a 32 by" }, { "start": 496.68, "end": 503.48, "text": " 32 or a 64 by 64. Then they unroll it which simply means they go through the" }, { "start": 503.48, "end": 508.84000000000003, "text": " image like this and make a sequence out of it because their models are naturally" }, { "start": 508.84000000000003, "end": 515.32, "text": " made for text sequences. They simply put the image into a text sequence. They" }, { "start": 515.32, "end": 521.88, "text": " further simplify this by reducing the three color channels to a single one. So" }, { "start": 521.88, "end": 527.5600000000001, "text": " they have their own color representation and basically yeah they reduce the" }, { "start": 527.5600000000001, "end": 532.9200000000001, "text": " three color channels to one channel that simply indexes the color in their color" }, { "start": 532.9200000000001, "end": 539.5600000000001, "text": " representation. And they say it's still pretty good. It's pretty faithful. So" }, { "start": 539.56, "end": 546.8399999999999, "text": " ultimately they end up with like a 32 squared length representation of their" }, { "start": 546.8399999999999, "end": 552.7199999999999, "text": " image. And then they do one of two things. They either do autoregressive" }, { "start": 552.7199999999999, "end": 559.1999999999999, "text": " generative pre-training which is the sort of GPT-2 style pre-training. And the" }, { "start": 559.1999999999999, "end": 565.3399999999999, "text": " idea here is that you always want to predict the next pixel of a sequence. So" }, { "start": 565.34, "end": 571.9200000000001, "text": " you can see right here that's the sequence that you input." }, { "start": 571.9200000000001, "end": 579.6800000000001, "text": " And you always want to predict what is the next pixel. And in this case you" }, { "start": 579.6800000000001, "end": 583.6, "text": " see that we've already predicted everything. Here we've already predicted" }, { "start": 583.6, "end": 588.96, "text": " everything up to this red pixel. So you want to know what's this next pixel, this" }, { "start": 588.96, "end": 596.08, "text": " thing right here. What's this going to be? And the diagram here basically shows" }, { "start": 596.08, "end": 600.6600000000001, "text": " you how the attention flows. So every position in this transformer, and if you" }, { "start": 600.6600000000001, "end": 604.58, "text": " don't know what a transformer is, I haven't made a video about attention is" }, { "start": 604.58, "end": 610, "text": " all you need where these are explained. But briefly every position here can sort" }, { "start": 610, "end": 618.48, "text": " of send information only in one direction. So you train all" }, { "start": 618.48, "end": 623.44, "text": " of these in parallel. And when you predict this pixel right here, you only" }, { "start": 623.44, "end": 629.24, "text": " want information from whatever was before that pixel. Otherwise the model" }, { "start": 629.24, "end": 634.72, "text": " could cheat, right? Otherwise the model could simply learn to copy over the" }, { "start": 634.72, "end": 640, "text": " value. But the attention pattern here is simply to show you that this is" }, { "start": 640, "end": 643.24, "text": " autoregressive and it's in one direction. So you always want to predict" }, { "start": 643.24, "end": 647.16, "text": " the next pixel. And then from all of this you want to predict the next pixel. And" }, { "start": 647.16, "end": 650.36, "text": " then from all of this you want to predict the next pixel. This is in" }, { "start": 650.36, "end": 655.24, "text": " contrast to this objective here that comes from BERT. And I've also made a" }, { "start": 655.24, "end": 660.12, "text": " video on BERT. What you do in BERT is you simply take that image and you cross" }, { "start": 660.12, "end": 666.6, "text": " the block out two of the pixels, or many of the pixels, and you simply ask your" }, { "start": 666.6, "end": 671.76, "text": " network to reconstruct those pixels. And now you can see the attention flows" }, { "start": 671.76, "end": 677.48, "text": " in all directions. BERT, the B stands actually for bidirectional. So this is the" }, { "start": 677.48, "end": 683.48, "text": " contrast to the autoregressive pre-training framework. Now these two" }, { "start": 683.48, "end": 689.04, "text": " things have been applied in text both. The autoregressive is usually easier" }, { "start": 689.04, "end": 694.08, "text": " to actually make it produce something, like we saw producing these images," }, { "start": 694.08, "end": 698.08, "text": " because you can always just predict the next pixel and then the next and then" }, { "start": 698.08, "end": 702.5600000000001, "text": " the next and then the next. Whereas in BERT it's a bit more unclear how you" }, { "start": 702.5600000000001, "end": 706.96, "text": " would produce things in a consistent manner. Because the predictions of these" }, { "start": 706.96, "end": 712.76, "text": " two pixels right here, they are independent. It's one forward pass and" }, { "start": 712.76, "end": 718.4000000000001, "text": " then both of these are predicted. But other papers have tried to solve this" }, { "start": 718.4000000000001, "end": 727.0400000000001, "text": " like this, not XLNet. I forget its name. It's something with an X." }, { "start": 727.04, "end": 733.92, "text": " But these are the two objectives they look at. And it turns out they" }, { "start": 733.92, "end": 739.56, "text": " sort of trade off a bit. They work equally well, or a bit better and a bit worse," }, { "start": 739.56, "end": 744.68, "text": " depending on the task. So once they have done this, they simply feed images." }, { "start": 744.68, "end": 749.76, "text": " And you'll notice that you don't need any labels for this. So what you'll do is" }, { "start": 749.76, "end": 755.98, "text": " simply input an image and then simply take away half of it like this, and then" }, { "start": 755.98, "end": 761.64, "text": " predict that pixel. And then you want to predict that pixel and then you want to" }, { "start": 761.64, "end": 766.32, "text": " predict that pixel. That's all like you do with text. And in BERT you simply" }, { "start": 766.32, "end": 772.08, "text": " input an image, cross out pixels and then predict them. So you don't need labels" }, { "start": 772.08, "end": 776.8000000000001, "text": " for this. And that's why you can do it with this big data set. And you can do it" }, { "start": 776.8000000000001, "end": 781.4, "text": " in an unsupervised fashion. So you can just crawl the internet for images and" }, { "start": 781.4, "end": 786.92, "text": " just feed this into there. And it will sort of learn to produce these images." }, { "start": 786.92, "end": 793.12, "text": " Now the question is, if you learn to produce these images, does that" }, { "start": 793.12, "end": 800.52, "text": " help you for classification? And they have two methods of assessing" }, { "start": 800.52, "end": 805.3199999999999, "text": " this. The bottom one here is the fine-tuning method. So this is" }, { "start": 805.3199999999999, "end": 810.56, "text": " supposed to be the representation you learn in the different layers of the" }, { "start": 810.56, "end": 815.1199999999999, "text": " network. So this is supposed to be this thing right here. What you'll do is" }, { "start": 815.1199999999999, "end": 820.5999999999999, "text": " you'll simply fine-tune. That means you on top of this representation you add a" }, { "start": 820.5999999999999, "end": 827.7199999999999, "text": " classification head that has two outputs, cat or dog, and you train this entire" }, { "start": 827.7199999999999, "end": 832.2399999999999, "text": " network on your small data set that we discussed before. So you train the" }, { "start": 832.2399999999999, "end": 837.1199999999999, "text": " entire network, all of the parameters. This is called fine-tuning. In contrast" }, { "start": 837.12, "end": 843.28, "text": " to that, what you can do is you can simply add this" }, { "start": 843.28, "end": 848.4, "text": " classification head with two outputs and then only train this classification head." }, { "start": 848.4, "end": 853.76, "text": " And that won't perform as well, but it gives you sort of a better idea of" }, { "start": 853.76, "end": 860.88, "text": " how good is the representation that this network right here learned. And on top of" }, { "start": 860.88, "end": 866.5600000000001, "text": " that, so if you spin this idea further, you can actually go and do this at any" }, { "start": 866.56, "end": 871.7199999999999, "text": " intermediate layer right here. So you can forward propagate until layer two" }, { "start": 871.7199999999999, "end": 878.0799999999999, "text": " right here, and then here you add your classification head into the two" }, { "start": 878.0799999999999, "end": 882.64, "text": " classes and you only train the classification head. That being said, you" }, { "start": 882.64, "end": 888.64, "text": " can also do this with fine-tuning, but in this case this is called a linear probe." }, { "start": 888.64, "end": 894.8, "text": " And it is often used to assess how good the A representation in intermediate" }, { "start": 894.8, "end": 900.5999999999999, "text": " layers is. Whereas what it actually does is assessing how linearly classifiable a" }, { "start": 900.5999999999999, "end": 905.52, "text": " representation is, which isn't the same as how useful or how informative, but it" }, { "start": 905.52, "end": 913, "text": " is one way to assess these things. So these are the two things they" }, { "start": 913, "end": 921.24, "text": " assess. So as for datasets, for C410 they use like C410 and C4100 as" }, { "start": 921.24, "end": 926.4, "text": " datasets and the STL10. And there you have to keep in mind the pre-training" }, { "start": 926.4, "end": 931.2, "text": " is done on ImageNet for those. So you pre-train on ImageNet without the" }, { "start": 931.2, "end": 939.96, "text": " labels and then you transfer learn or fine-tune or linear probe on these" }, { "start": 939.96, "end": 945.2, "text": " small datasets. Whereas later we're going to look at ImageNet and there the" }, { "start": 945.2, "end": 950.48, "text": " pre-training as I understand it is done on ImageNet itself, but also a wider" }, { "start": 950.48, "end": 958.08, "text": " collection of a hundred million or so images from the web, from the internet." }, { "start": 958.08, "end": 966.08, "text": " Okay, so as you can see right here this is what happens if you do this linear" }, { "start": 966.08, "end": 974.48, "text": " probing. And you can see it works pretty well. So you get like a 95-96% accuracy" }, { "start": 974.48, "end": 980.6, "text": " with linear probes. This is very powerful. So it's not easy to get 96% on" }, { "start": 980.6, "end": 988.5600000000001, "text": " C410. I mean current state-of-the-art is like 99%, but still 96% is pretty" }, { "start": 988.5600000000001, "end": 995.8000000000001, "text": " good. And this is the entire network. There is this big giant network that you" }, { "start": 995.8000000000001, "end": 1000.84, "text": " input your image into and then there is this one linear layer that does the" }, { "start": 1000.84, "end": 1006.36, "text": " classification. And all of this right here has not been trained with" }, { "start": 1006.36, "end": 1012.52, "text": " classification in mind. It simply has been trained to reproduce images. It" }, { "start": 1012.52, "end": 1016.6800000000001, "text": " hasn't even been trained on C410 as far as I understand. It's been trained on" }, { "start": 1016.6800000000001, "end": 1026.4, "text": " ImageNet. So this is to stress how cool or how significant this result is" }, { "start": 1026.4, "end": 1030.56, "text": " basically. That just a linear probe on top of that will give you such a good" }, { "start": 1030.56, "end": 1037.72, "text": " accuracy. And the second thing that is obvious right here is this bottom axis" }, { "start": 1037.72, "end": 1045.1599999999999, "text": " is the layer. So this is the layer where they attach the linear probe. And usually" }, { "start": 1045.1599999999999, "end": 1049.8, "text": " if you pre-train a network with a classification task in mind, so you" }, { "start": 1049.8, "end": 1053.44, "text": " pre-train it with the labels or maybe even without the labels in a self" }, { "start": 1053.44, "end": 1058.6, "text": " supervised way or something like this, usually the last layer has the best" }, { "start": 1058.6, "end": 1064.12, "text": " representation for classification. But here the special thing is that the" }, { "start": 1064.12, "end": 1069.48, "text": " intermediate layers in the middle have the best representation. You can see that" }, { "start": 1069.48, "end": 1076, "text": " the representation quality in terms of linear probing falls off as they sort of" }, { "start": 1076, "end": 1083.84, "text": " it falls off as they go into higher layers. And this is consistent across the" }, { "start": 1083.84, "end": 1090.8799999999999, "text": " datasets as you can see. And the idea here is or the way they interpret it" }, { "start": 1090.8799999999999, "end": 1099.6399999999999, "text": " is that if you have an image right here and you've blocked part of it," }, { "start": 1099.6399999999999, "end": 1111, "text": " so you've blocked this and this, wrong way around this, so you've generated" }, { "start": 1111, "end": 1118.76, "text": " everything and now your task is to predict the next pixel. So you're" }, { "start": 1118.76, "end": 1127.16, "text": " trained to predict this next pixel right here. And the idea is that as you put" }, { "start": 1127.16, "end": 1133.68, "text": " the image through the network, what it will do is sort of, since the first" }, { "start": 1133.68, "end": 1138.12, "text": " layers they're going to be, if you're going to be similar to a CNN, they're" }, { "start": 1138.12, "end": 1143.6799999999998, "text": " going to be doing some low-level feature transformation thing. But also the" }, { "start": 1143.6799999999998, "end": 1149.12, "text": " last layers, they're going to really care about what's the exact pixel that goes" }, { "start": 1149.12, "end": 1154.36, "text": " here. Since it's their job to do that, they're going to care what color" }, { "start": 1154.36, "end": 1159.84, "text": " does it need to have, what exact luminosity and so on, how does it fit in" }, { "start": 1159.84, "end": 1166.9599999999998, "text": " with the previous pixels and so on. So that's also good. But it's not" }, { "start": 1166.96, "end": 1171.72, "text": " just low-level information and consistency with other pixels or" }, { "start": 1171.72, "end": 1177.44, "text": " something like this. At some point if you want to generate consistent images, and" }, { "start": 1177.44, "end": 1183.16, "text": " we saw that this model can generate consistent images, at some point there" }, { "start": 1183.16, "end": 1187.68, "text": " needs to be some kind of a notion of the global information in the picture," }, { "start": 1187.68, "end": 1194, "text": " because the images are consistent throughout. So there needs to be some" }, { "start": 1194, "end": 1198.92, "text": " notion of what is in that image as a whole. And that's the exact" }, { "start": 1198.92, "end": 1203.36, "text": " information that we need for classification. And the only way that" }, { "start": 1203.36, "end": 1208.6, "text": " could actually be is here in the middle, since you know that's the place. So the" }, { "start": 1208.6, "end": 1213.72, "text": " hypothesis is that these models somehow learn a higher level of" }, { "start": 1213.72, "end": 1218.44, "text": " representation of global information somewhere in the middle before they then" }, { "start": 1218.44, "end": 1224.4, "text": " specify that information again down to predict the actual pixel. And that's why" }, { "start": 1224.4, "end": 1228.88, "text": " the best representations for classification are in the middle. So this" }, { "start": 1228.88, "end": 1234.96, "text": " is one of the interesting findings of" }, { "start": 1234.96, "end": 1239.44, "text": " this paper. I mean it's cool that they can reach a good accuracy, but to recognize" }, { "start": 1239.44, "end": 1247.0800000000002, "text": " that maybe in these generative models they have some intermediate stage" }, { "start": 1247.08, "end": 1250.24, "text": " where they represent the global information, and that will actually make" }, { "start": 1250.24, "end": 1256.9199999999998, "text": " the best representation. The second cool thing right here is that you can" }, { "start": 1256.9199999999998, "end": 1264.96, "text": " see they have different sizes of models. So the IGPT-L I believe is something" }, { "start": 1264.96, "end": 1272.56, "text": " like 60 layers, then this is like 48 layers, and this is 32 layers. So" }, { "start": 1272.56, "end": 1278.04, "text": " these are all on the scale of GPT-2, either a little bigger or a" }, { "start": 1278.04, "end": 1282, "text": " little smaller. It's not like a GPT-3 scale where you need a ginormous" }, { "start": 1282, "end": 1290.2, "text": " supercomputer, though they do do a lot of computation. But this still sort of fits" }, { "start": 1290.2, "end": 1298.3999999999999, "text": " within hardware of a standard size and not like exascale. What's interesting" }, { "start": 1298.4, "end": 1303.44, "text": " right here is that you can see the larger models, they reach a lower" }, { "start": 1303.44, "end": 1307.68, "text": " validation loss. So here is the validation loss. The larger model, if you train them" }, { "start": 1307.68, "end": 1311.96, "text": " on, so these checkpoints here are always after the same amount of steps. The" }, { "start": 1311.96, "end": 1317, "text": " larger models do reach a lower validation loss right here, as you can see." }, { "start": 1317, "end": 1324.96, "text": " So this is the large, this is the medium, this is the small. And also you can see" }, { "start": 1324.96, "end": 1329.56, "text": " that on this axis the linear probe accuracy. So this is whenever you go" }, { "start": 1329.56, "end": 1334.32, "text": " and you find the best intermediate layer for linear probing, you probe it and you" }, { "start": 1334.32, "end": 1339, "text": " record the accuracy. So you can see a general trend as your validation loss" }, { "start": 1339, "end": 1345.56, "text": " goes down, the linear probe accuracy goes up. So there is a connection like it is" }, { "start": 1345.56, "end": 1349.68, "text": " in text models. In text models there's a connection of the perplexity of your" }, { "start": 1349.68, "end": 1355.44, "text": " language model and the quality of the representation you get for downstream" }, { "start": 1355.44, "end": 1359.92, "text": " tasks. In this model it seems to be the exact same thing. There is a connection" }, { "start": 1359.92, "end": 1366.24, "text": " between reaching lower validation loss and reaching a higher performance on" }, { "start": 1366.24, "end": 1373.48, "text": " classification. So that's one interesting thing, the general trend to up to the" }, { "start": 1373.48, "end": 1378.68, "text": " upper right corner. The other interesting and even arguably even more" }, { "start": 1378.68, "end": 1383.88, "text": " interesting thing is that if you look at the same validation loss. So at this" }, { "start": 1383.88, "end": 1388.96, "text": " point all of these models have the same validation loss, yet still the bigger" }, { "start": 1388.96, "end": 1394.28, "text": " model is better. You can see right here the bigger model outperforms the" }, { "start": 1394.28, "end": 1399.8400000000001, "text": " smaller model even though they have the same validation loss on the image" }, { "start": 1399.8400000000001, "end": 1405.68, "text": " modeling task. And this is also something that OpenAI in their text" }, { "start": 1405.68, "end": 1410.68, "text": " papers has stressed, that the larger models they seem to be somehow more" }, { "start": 1410.68, "end": 1415.76, "text": " capable of forming good representations even if they have the" }, { "start": 1415.76, "end": 1424.1200000000001, "text": " same loss. So again this could just be sort of a training data," }, { "start": 1424.1200000000001, "end": 1429.8, "text": " better training data remembering thing. And when I said that in GPT-3 I didn't" }, { "start": 1429.8, "end": 1434.8, "text": " actually mean explicit remembering of training data. I meant kind of a fuzzy" }, { "start": 1434.8, "end": 1439.36, "text": " remembering of training data. I formulate that in the comments but" }, { "start": 1439.36, "end": 1445.68, "text": " I feel a lot of people have misunderstood me there. Here I think it's" }, { "start": 1445.68, "end": 1451.3999999999999, "text": " a much harder to estimate what's going on also since image pixels. Humans" }, { "start": 1451.3999999999999, "end": 1456.36, "text": " don't have a super good model on image pixels in their head as we have about" }, { "start": 1456.36, "end": 1461.3999999999999, "text": " text. As you can see if you then fine-tune, so for now we've just do" }, { "start": 1461.4, "end": 1467.96, "text": " linear probing, if you fine-tune these architectures then you reach like a 99%" }, { "start": 1467.96, "end": 1476.92, "text": " accuracy on C410 which is on par with the best models that we have. So G-Pipe" }, { "start": 1476.92, "end": 1483.0800000000002, "text": " is supervised, pre-trained on ImageNet but also I guess uses a bunch of data" }, { "start": 1483.0800000000002, "end": 1489.48, "text": " augmentation while these image GPT it uses minimal data augmentation I think." }, { "start": 1489.48, "end": 1501.72, "text": " They simply random crop a little bit and that's about it. So they also experiment" }, { "start": 1501.72, "end": 1508.3600000000001, "text": " around with this BERT objective. So until now this was all this" }, { "start": 1508.3600000000001, "end": 1513.08, "text": " autoregressive objective and I feel that OpenAI people are a bit more of a fan of" }, { "start": 1513.08, "end": 1518.3600000000001, "text": " the autoregressive objective just given what they've done so far in their papers." }, { "start": 1518.36, "end": 1527.8, "text": " And you can see here comparison of the two objectives on C410 and on ImageNet." }, { "start": 1527.8, "end": 1533.3999999999999, "text": " Again C410 is pre-trained with ImageNet and ImageNet itself is pre-trained" }, { "start": 1533.3999999999999, "end": 1537.6, "text": " with like a larger collection of images from the web. All the pre-training is" }, { "start": 1537.6, "end": 1544.8799999999999, "text": " done without labels. Now the blue is what you can reach with a linear probe and" }, { "start": 1544.88, "end": 1551.24, "text": " the orange is then on top of that what you can reach by fine-tuning. So no" }, { "start": 1551.24, "end": 1555.2800000000002, "text": " linear probe but fine-tuning. I have to say that the fine-tuning is always done" }, { "start": 1555.2800000000002, "end": 1562.88, "text": " at the end. So even though the linear probe can be attached" }, { "start": 1562.88, "end": 1567.3200000000002, "text": " anywhere in between and it's often useful to do that as we saw because the" }, { "start": 1567.3200000000002, "end": 1573.1200000000001, "text": " in-between layers are the best. They say they tried fine-tuning also from" }, { "start": 1573.12, "end": 1578.32, "text": " in-between but it always worked out best whenever you fine-tune. Whenever you" }, { "start": 1578.32, "end": 1583.4399999999998, "text": " fine-tune you take actually the last layer. So that kind of gives you an idea" }, { "start": 1583.4399999999998, "end": 1591.2399999999998, "text": " that the model is then... What seems to be important is this coming up" }, { "start": 1591.2399999999998, "end": 1596.3999999999999, "text": " with the higher level representation and then once you fine-tune you're probably" }, { "start": 1596.3999999999999, "end": 1602.8, "text": " able to push that representation through to the end because of your training" }, { "start": 1602.8, "end": 1607.6399999999999, "text": " signal. But if you hadn't done the pre-training you wouldn't even have" }, { "start": 1607.6399999999999, "end": 1612.28, "text": " that higher level representation and then the signal I guess is not strong" }, { "start": 1612.28, "end": 1616.56, "text": " enough to back propagate through the whole model. It would be very interesting" }, { "start": 1616.56, "end": 1621.8799999999999, "text": " if they investigate, if they do this linear probe analysis again after they" }, { "start": 1621.8799999999999, "end": 1628.08, "text": " fine-tune the model. And to see if then still it is the intermediate layers" }, { "start": 1628.08, "end": 1634.8, "text": " that have the best representation or if now the best representation in a linear" }, { "start": 1634.8, "end": 1640.1999999999998, "text": " probe sense shifted towards the end. I'm gonna guess it's shifted towards the end" }, { "start": 1640.1999999999998, "end": 1645.6399999999999, "text": " but I sort of want to even see if the accuracy of the linear probe in the" }, { "start": 1645.6399999999999, "end": 1651.96, "text": " middle, does it keep the same? So does the curve go like this? This is the" }, { "start": 1651.96, "end": 1658.56, "text": " linear probe when you simply pre-train. This is linear probe accuracy. The" }, { "start": 1658.56, "end": 1665.92, "text": " question would be does it change to be like this or does it change to be like" }, { "start": 1665.92, "end": 1672.08, "text": " this? This is supposed to be the same at the end. So basically does it stay as" }, { "start": 1672.08, "end": 1677.32, "text": " good as it is but simply get better at the end or does the representation like" }, { "start": 1677.32, "end": 1680.92, "text": " in this curve, does the good representation now shift towards the" }, { "start": 1680.92, "end": 1685.68, "text": " end and leave the lower layer with even more capacity to do some low-level" }, { "start": 1685.68, "end": 1693.3200000000002, "text": " stuff? Yeah, maybe they've done this. I haven't seen it. And as you can see" }, { "start": 1693.3200000000002, "end": 1699, "text": " these BERT and autoregressive objective, they sort of trade off. So the BERT it" }, { "start": 1699, "end": 1704.5600000000002, "text": " tends to do poorly in the linear probe setting but then it catches up during" }, { "start": 1704.5600000000002, "end": 1710.6000000000001, "text": " fine-tuning. In C410 almost being at the level of the autoregressive and in" }, { "start": 1710.6, "end": 1717.4399999999998, "text": " in ImageNet actually outperforming it. This darker thing here it" }, { "start": 1717.4399999999998, "end": 1722.32, "text": " simply means that you average across different maskings of BERT because I" }, { "start": 1722.32, "end": 1728.36, "text": " guess even in classification it's not entirely clear how to get a signal out" }, { "start": 1728.36, "end": 1733.6399999999999, "text": " of BERT because they don't do this CLS vector with BERT. What they do for" }, { "start": 1733.6399999999999, "end": 1740.24, "text": " classification and linear probing and that's written up here, they simply take" }, { "start": 1740.24, "end": 1746.28, "text": " the average pooling of" }, { "start": 1746.28, "end": 1752.92, "text": " all the representations of the sequence. And the last thing that I've" }, { "start": 1752.92, "end": 1762.84, "text": " also forgotten, there's a lot of stuff, when they fine-tune, while fine-tuning" }, { "start": 1762.84, "end": 1769.52, "text": " the classification loss yields reasonable" }, { "start": 1769.52, "end": 1774.04, "text": " downstream performance, we find empirically that the joint objective, the" }, { "start": 1774.04, "end": 1778.58, "text": " generative objective and the classification objective works even" }, { "start": 1778.58, "end": 1784.52, "text": " better. So even when you fine-tune with this model you have to keep the" }, { "start": 1784.52, "end": 1790.8, "text": " generative modeling part, the generative loss around and then it performs even" }, { "start": 1790.8, "end": 1799.4, "text": " more better, more well, whatever that word is. So that's also something to think" }, { "start": 1799.4, "end": 1805.44, "text": " about. I think this paper right here it kind of lays down a lot of cool" }, { "start": 1805.44, "end": 1811.64, "text": " things that you can think about and it gives rise to a lot of hypotheses of how" }, { "start": 1811.64, "end": 1816.6000000000001, "text": " does this stuff work, why does this stuff work. I don't even think that the" }, { "start": 1816.6000000000001, "end": 1822.0400000000002, "text": " numbers are the most important thing, it's mostly the fact of the effects and" }, { "start": 1822.04, "end": 1831.24, "text": " what does it mean. Okay, so this was my take on it. It's more kind of a my" }, { "start": 1831.24, "end": 1837.36, "text": " rant of what I find special about this paper than about the actual paper. You" }, { "start": 1837.36, "end": 1841.28, "text": " can look at the paper, their numbers are pretty good. On ImageNet they do not" }, { "start": 1841.28, "end": 1847.8, "text": " reach the same like super-duper performance as they do on C410 and I" }, { "start": 1847.8, "end": 1852.72, "text": " guess that's probably because they have to downscale the ImageNet images way" }, { "start": 1852.72, "end": 1856.2, "text": " more than they have to downscale the C410 images because those are of course" }, { "start": 1856.2, "end": 1863.46, "text": " only 32 by 32. So because they have to downscale so much they lose probably a" }, { "start": 1863.46, "end": 1869.12, "text": " lot of information and I would be interested to see if there is a way to" }, { "start": 1869.12, "end": 1876.72, "text": " involve convolutions in all of this. So to do the downscaling that in a" }, { "start": 1876.72, "end": 1880.72, "text": " learned manner with convolutions or something. I'm sure this has all been" }, { "start": 1880.72, "end": 1886.08, "text": " done already, I'm just lazy to look it up. Yeah, so I invite you to look at their" }, { "start": 1886.08, "end": 1891.96, "text": " blog post where they have these samples. They look pretty funny and these" }, { "start": 1891.96, "end": 1897.8, "text": " full samples up here look fairly cool for what it's trained to do" }, { "start": 1897.8, "end": 1901.44, "text": " and that it has no spatial awareness whatsoever. It simply uses learned" }, { "start": 1901.44, "end": 1907.8400000000001, "text": " position encodings. And yeah, check it out, that was it from me. Bye bye." } ]
YPfUiOMYOEE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
BYOL: Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "deepmind", "ucl", "representation", "moco", "momentum contrast", "simclr", "encoder", "augmentation", "mixup", "randaugment", "crop", "random crop", "jitter", "flip", "unsupervised", "self-supervised", "cnn", "resnet", "latent", "contrastive", "online", "target", "exponential moving average", "negatives" ]
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. They basically combine momentum contrast and same clear and then remove the negative samples. 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, 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 B.O.L. a new approach to self-supervised image representation learning. Image representation learning is the simple task of taking an image and then feeding it through a function which is usually like a neural network. Let's just say this is a neural network and in fact all of these, the community has sort of standardized this to be, most of the time it's something like a ResNet-50. So what you want to do is you want to train a neural network like a ResNet-50 to give you a good representation of the image. So this would be like H and H is a vector and H is a representation of this image and the representation should be such that you can then take this representation and solve many tasks with it, which either can be like linear, you can put a linear classifier on top of the H or you can fine-tune the entire architecture to solve some other tasks. The idea is if you have a large data set here you may use this data set to train these good representations of these images and then you can transfer this to a task where you might not have as much data. 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. That usually 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. The goal is to learn a good representation. The self-supervised here is also important because representation learning can be as easy as if this here is ImageNet. The ImageNet data set contains like a million images all with labels. You can simply train your ResNet-50 to predict the class. This is 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 there are many ways to do self-supervision but what we'll see in this particular paper is that you will take an image and you'll make different variants of that same image. You'll take the image and you'll make many many variants of it. Let's just say two. 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. 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. Once you send them through your encoder the representations of the two images they should be fairly close. Now let's actually read on right here. Bjoll relies on two neural networks referred to as online and target networks that interact and learn from each other. From an augmented view of an image we train the online network to predict the target representation of the same image under a different augmented view. That's sort of what we saw. We have the same image under a different augmented view. What does it mean? You make two versions of the same image. One that are slightly different and then their representation should be close. Until this point we have always thought that this would degenerate. If you think of this neural network that does this encoding to the hidden space, this ResNet-50 right here, if you simply want to make the two representations close, what's the best thing it can do? It can simply map all 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. 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. What people have done is they have included so-called negative samples where you'll say I'll take a different image from this data set but it's a different image than this image. I also do some data augmentation with that image and then I send this through the same encoder to also give me an h. This is the h, let's call 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. Now the task is let's make those two very similar to each other but let's distance them from this other one. 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. It needs to actually do something to make these be close together and this be far apart. 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. A lot of papers have alluded to the fact that this is... The negative samples are to not have these degeneracy, so to not have the simple solutions. But the fact that the representation then is actually good, like is good for image tasks down the line, probably comes from the fact of these augmentations right here. 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. So here this is the same image twice, right? Let's say we take a random crop here and one up here. Maybe there's an overlap here in the middle, right? So it sort of needs to understand that these random crops sort of needs to communicate between these two places in these random crops. So the representation has to somehow make sure that the object that is overlapping here is somehow represented, but it can't represent it just as a pixel value, because it doesn't know where the crops come from. So there's a lot of evidence that these representations are the thing that's responsible for making the representation so good. Okay, now this paper simply says do we really need these negative samples right here? Let's just get rid of them. And with a couple of tricks this seems to work. And this is what seems like magic to me, because as we go forward, think of it, 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, oh, where do you get these negative samples from? Right? Should they be uniformly sampled? Should we keep a buffer? Should we order them? There is this task of hard negative mining where you say, oh, any old negative won't do. 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 would be best to actually just get rid of these negative things. So that's why we want to get rid of them. So that's the approach. BYOL. Bootstrap your own latent. There is the input image. 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 representations powerful. 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 if we have the target to be not the same as the the online parameters, but actually a kind of a stable version of the past of the online parameters, then that tends to work well. Again, it's kind of the same principle as with the augmentations. With the augmentations, we have two different versions of the same image. And now with this procedure here, we sort of have two different versions of the same neural network, but they're slightly different, right. This idea has been around for much longer, like the first queue, deep queue networks, and so on. They had the same principles where they had the the network that they actually learned and then the target network that is copied over every such and such episodes, and so on. So this, this seems to work seems to be a fundamental principle that seems to work. All right, so we take our two slightly different augmented versions of the same image, and we run them through our two slightly different encoders to obtain two representations. Now this thing right here, that's going to be our representer. So after this procedure, we discard the entire thing right here, except that. So this here is your whatever your ResNet 50. Okay, after that follows a projection. And the projection is is here to reduce the dimensionality. And honestly, I'm actually not sure why it is here. Because you can do it without, like technically, the algorithm doesn't require this projection. So you can imagine the algorithm without the projection. But just really quickly, the projection simply brings down the representation, which is like 2048 dimensional that comes out of the ResNet 50. It has, it is a two layer neural network that first pumps this up to like 4092, and then compresses it down to 256 dimensions. Okay, so that's the projection network. Again, there is a part that's learned and then the target projector is simply the exponential moving average of the online projector. But again, this is why exactly this is here, probably simply because it works, right? But probably because there is no distinction because you don't have different losses, you simply back propagate through everything and then train everything. So there is no logical distinction between the projection and the representation other than you have a different dimensionality. But maybe that's the point here that you make a different dimensionality, even though you could you could do the rest in this 2048 space. Yeah, so for now, just this doesn't exist. Let's just say this doesn't exist. And we just work with this representation here. Let's call this Z, Z prime. Okay, so what happens is we take the representation. And now we have one neural network, the predictor right here, that takes the representation of one of the image versions. And it simply tries to predict the representation of the other image version. So what you want is that q of z equals z prime. Okay, and if we expand that is that q of f of z is equal to f target of z prime. And if we expand that even further, you can see that q, I'll just write q and f for now q of f of a, which is an augmentation at an augmentation of z should be one bracket two bracket three bracket should be f of a of z sorry not see that's the image x. Alright, 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 queue simply tries to somehow negate this augmentation and this difference between the target and the online parameters. But you don't tell the queue which augmentation was used. And you don't tell the queue what are the exact parameters of that network. So what the queue has to do is it has to somehow it's like it's like it has to take its best guess, right? So basically the queue 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-segmented information. So non-semantic information. And random cropping is one of those methods. Horizontal flipping is one of those methods, because we say, well, whether an image goes left to right or right to left, most of the time the semantics are the same. The pixels are different, but the semantics are the same. So by putting an augmentation in there, we learn to ignore that augmentation, because our representation now needs to be predictable. 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. 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 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 this representation be close to the Q of that representation. So the Q simply tries to predict the other representation. And you do that for both ways. So you once stick the image in here and try to predict the other one, and you do it vice versa. So you get two loss components each time. It's a symmetric loss. And that's it. That's the method. And they beat all the other self-supervised methods, and they get pretty close to the supervised representation learning method. As you can see right here, as the number of parameters goes up in their model, so one of them is ResNet-50, but I'm gonna guess this one right here. But you can also get two higher architectures, and then it appears to work even better and come even closer to this supervised baseline. This could be because 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. All they show is that their numbers are good, which is cool, right? And it's cool that you don't need the negative samples anymore, and it actually doesn't collapse when you do that kind of stuff. But there's a lot of, I don't know, there's a lot of things here. For example, we use a batch size of 4096 split over 512 TPUv3 cores. With this setup, training takes approximately eight hours for ResNet-50. So they train eight hours on 512 TPUs. Just imagine that! So that's sort of crazy amount of computation, again, going into these models. And then the second thing here is that you can see that there are some things missing right here, and there are 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 given. Or almost never, unless they release the exact code, and even then there are still going to be differences. 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 SimClear baseline. So you can see right here that they have a own implementation of SimClear, and they actually compare this to the numbers that they find in the SimClear paper. And you can see, for example, here there's like four percentage points that their implementation of SimClear gains above this implementation. And if you look at this supervised baseline, that's also from that paper. And there is a graph further down where they also implement their own version of the... their own version of the supervised baseline. I forget... 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 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 achieves, you know, good performance. And there is more. They make... they have like experiments right here that show that their method, the BYOL, is much more resistant to like changes in hyperparameters. So here you can see that it falls off much later when you reduce the batch size, which makes sense, right? Because SimClear is one of these methods that uses negative samples. And for negative samples, it uses the other samples in the mini batch. Now if you have less samples in the mini batch, that means you have a less representative distribution of your entire data set as negative samples. And therefore, if you increase... 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 two or one points 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... you can say it works at least as well as other methods. And it is a lot easier because you don't have this negative sample things. Now the last quarrel I have with the paper, and where is it? Where is it? Somewhere they say that we release the code... they release the pseudo code. They don't release the code. They release the pseudo code in the appendix. So I mean, there are reasons why you sometimes want to release pseudo code. And that's if an algorithm is so high level and so simple in its high levelity and so modular to be fleshed out that you can't... like it makes more sense. But here it's like pseudo code in jacks. And come on... is it really that competitively advantageous to retain your code? It's just not reproducible with this. You know that they have like 50 billion hacks in their code. And yeah, so DeepMind has this history of just not releasing... like publishing behind paywalls and just giving pseudo code that has lots of mistakes in them. Like the new zero pseudo code, you can't even like run it in its basic form if you fill in the things. It's a bit annoying. In any way, the method itself seems promising for representation learning, as I said, especially because it's pretty simple. It still heavily relies on these augmentation methods. So and that's what they say right here. Nevertheless, BYOL remains dependent on existing sets of augmentations that are specific to vision applications. To generalize BOL to other modalities, it is necessary to obtain similarly suitable augmentations for each of them. Designing such augmentations may require significant effort and expertise. Therefore automating the search for these augmentations would be an important next step to generalize BOL to other modalities. And I'm not sure if you can do this automating the search for these augmentations. I guess you can do it if you have like a supervised data set and then you can search and then you can use those augmentations for the unsupervised. But it seems a bit bootstrap-y, no pun intended right here. I think the power of these representations again comes from the fact that we have these augmentations carefully constructed. So oh yes, the last thing broader impact statement. Just read this like try to estimate the perplexity of this broader impact statement. Let's go. The presented research should be categorized as research in the field of unsupervised learning. This work may inspire new algorithms, theoretical and experimental investigation. The algorithm presented here can be used for many different vision applications and a particular use may have both positive or negative impacts, which is known as the dual use problem. Besides as vision data sets could be biased, the representation learned by BOL 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 words here. Blank, like field, let's just put field. Or machine learning. Why not? Machine learning. Machine learning. This work inspire new algorithms? Yes. The algorithm presented here can be used for many different machine learning applications and a particular use may have both negative effects. Besides as data sets could be biased, the representation learned by this paper could be susceptible to replicate these biases. Well there is a copy-paste thing that you can apparently put into any and all papers that you write from now on. And hey DeepMind is doing it. So you know, there you go. Okay maybe a bit cynical but I'm like I told you this would happen. I told you. And you know. Okay so that was it for my comments right here. They do have like a giant ton of experiments and I appreciate that right. They really try to show that it works in many different situations and yeah yet to solve why this doesn't collapse but apparently it doesn't. So try it out. Give it a try and I'll see you next time. Bye bye.
[ { "start": 0, "end": 4.5, "text": " Hello there! Today we're looking at Bootstrap Your Own Latent, a new approach" }, { "start": 4.5, "end": 9.74, "text": " to self-supervised learning by researchers of DeepMind and Imperial" }, { "start": 9.74, "end": 16.740000000000002, "text": " College. So almost no day goes by where we don't hear some sort of new" }, { "start": 16.740000000000002, "end": 21.82, "text": " self-supervised algorithm right here. This paper on a high level tries to get" }, { "start": 21.82, "end": 27, "text": " rid of the necessary negative samples when doing the contrastive loss for" }, { "start": 27, "end": 33.08, "text": " self-supervised learning. They basically combine momentum contrast and" }, { "start": 33.08, "end": 38.28, "text": " same clear and then remove the negative samples. That seems to work pretty" }, { "start": 38.28, "end": 44.32, "text": " well even though it's magic. So yeah, if you want to see how it's done, stick" }, { "start": 44.32, "end": 50.22, "text": " around, share the video out. If you want other people to see how it's done, leave" }, { "start": 50.22, "end": 56.84, "text": " a comment. This one I really don't get what's going on. So if you have" }, { "start": 56.84, "end": 61.040000000000006, "text": " ideas, put them there. I'll read them through. It'll be fun." }, { "start": 61.040000000000006, "end": 68.68, "text": " Alright, so they say we introduce Bootstrap Your Own Latent or B.O.L. a new" }, { "start": 68.68, "end": 73.68, "text": " approach to self-supervised image representation learning. Image" }, { "start": 73.68, "end": 80.44, "text": " representation learning is the simple task of taking an image and then feeding" }, { "start": 80.44, "end": 84.04, "text": " it through a function which is usually like a neural network. Let's just" }, { "start": 84.04, "end": 89.52000000000001, "text": " say this is a neural network and in fact all of these, the community has sort of" }, { "start": 89.52000000000001, "end": 95.80000000000001, "text": " standardized this to be, most of the time it's something like a ResNet-50." }, { "start": 95.80000000000001, "end": 100.48, "text": " So what you want to do is you want to train a neural network like a ResNet-50" }, { "start": 100.48, "end": 106.04, "text": " to give you a good representation of the image. So this would be like H and H is a" }, { "start": 106.04, "end": 112.92, "text": " vector and H is a representation of this image and the representation should be" }, { "start": 112.92, "end": 119.2, "text": " such that you can then take this representation and solve many tasks with" }, { "start": 119.2, "end": 125.24000000000001, "text": " it, which either can be like linear, you can put a linear classifier on top of" }, { "start": 125.24000000000001, "end": 130.04, "text": " the H or you can fine-tune the entire architecture to solve some other tasks." }, { "start": 130.04, "end": 136.6, "text": " The idea is if you have a large data set here you may use this data set to train" }, { "start": 136.6, "end": 141.56, "text": " these good representations of these images and then you can transfer" }, { "start": 141.56, "end": 147.32, "text": " this to a task where you might not have as much data. Because you" }, { "start": 147.32, "end": 151.24, "text": " don't have as much data it's not enough to completely train an architecture like" }, { "start": 151.24, "end": 155.6, "text": " this, but it is enough to take an architecture that's been trained with" }, { "start": 155.6, "end": 160.48000000000002, "text": " the large data set and just adapt it to your small data set. That usually" }, { "start": 160.48000000000002, "end": 165.72, "text": " tends to work pretty well. This is called transfer learning. This step here" }, { "start": 165.72, "end": 172.32, "text": " is called fine-tuning sometimes and it's sort of the approach that comes from" }, { "start": 172.32, "end": 178.4, "text": " natural language processing from these big transformers like BERT where you" }, { "start": 178.4, "end": 182.16, "text": " first train on a really big data set that might not be the data set that you" }, { "start": 182.16, "end": 187.16, "text": " want in the end but it's really big so you can sort of learn a lot of things" }, { "start": 187.16, "end": 192.4, "text": " from that data set and then the only thing left to do is to fine-tune it to" }, { "start": 192.4, "end": 197.16, "text": " basically adapt it to the nuances of your data set but it will have learned" }, { "start": 197.16, "end": 200.88, "text": " most things already and that's called representation learning. The goal is" }, { "start": 200.88, "end": 208.8, "text": " to learn a good representation. The self-supervised here is also important" }, { "start": 208.8, "end": 214.96, "text": " because representation learning can be as easy as if this here is ImageNet." }, { "start": 214.96, "end": 219.54000000000002, "text": " The ImageNet data set contains like a million images all with labels. You can" }, { "start": 219.54, "end": 224.51999999999998, "text": " simply train your ResNet-50 to predict the class. This is called" }, { "start": 224.51999999999998, "end": 230.64, "text": " supervised pre-training or supervised representation learning and that works" }, { "start": 230.64, "end": 236.16, "text": " pretty well but you need a labeled data set. In self-supervised learning you do" }, { "start": 236.16, "end": 241.2, "text": " not need labels. What you do is you do self-supervision and self-supervision" }, { "start": 241.2, "end": 245.79999999999998, "text": " there are many ways to do self-supervision but what we'll" }, { "start": 245.8, "end": 253.04000000000002, "text": " see in this particular paper is that you will take an image and you'll make" }, { "start": 253.04000000000002, "end": 259.2, "text": " different variants of that same image. You'll take the image and you'll make" }, { "start": 259.2, "end": 265.36, "text": " many many variants of it. Let's just say two. You have some procedure to" }, { "start": 265.36, "end": 269.6, "text": " sort of change the picture a little bit but it's essentially still the same and" }, { "start": 269.6, "end": 275, "text": " you do that through data augmentation. This could be a random crop or you" }, { "start": 275, "end": 281.12, "text": " color jitter or you rotate it or something like this and then you exploit" }, { "start": 281.12, "end": 285.56, "text": " the fact that you know that these two things they should be still sort of the" }, { "start": 285.56, "end": 291.44, "text": " same image. Once you send them through your encoder the" }, { "start": 291.44, "end": 298.2, "text": " representations of the two images they should be fairly close. Now let's" }, { "start": 298.2, "end": 308.68, "text": " actually read on right here. Bjoll relies on two neural networks referred to as" }, { "start": 308.68, "end": 312.08, "text": " online and target networks that interact and learn from each other. From an" }, { "start": 312.08, "end": 316.12, "text": " augmented view of an image we train the online network to predict the target" }, { "start": 316.12, "end": 321.84, "text": " representation of the same image under a different augmented view. That's" }, { "start": 321.84, "end": 327.48, "text": " sort of what we saw. We have the same image under a different" }, { "start": 327.48, "end": 333.8, "text": " augmented view. What does it mean? You make two versions of" }, { "start": 333.8, "end": 338.28000000000003, "text": " the same image. One that are slightly different and then their representation" }, { "start": 338.28000000000003, "end": 345.04, "text": " should be close. Until this point we have always thought that this would" }, { "start": 345.04, "end": 350.64000000000004, "text": " degenerate. If you think of this neural network that does this" }, { "start": 350.64000000000004, "end": 356.08000000000004, "text": " encoding to the hidden space, this ResNet-50 right here, if you" }, { "start": 356.08, "end": 359.59999999999997, "text": " simply want to make the two representations close, what's the best" }, { "start": 359.59999999999997, "end": 365.15999999999997, "text": " thing it can do? It can simply map all the hidden, it can simply have the" }, { "start": 365.15999999999997, "end": 370.24, "text": " constant function h equals zero or something like this. Just a constant" }, { "start": 370.24, "end": 375.56, "text": " function. Because then this loss here is always going to be zero. Like perfect." }, { "start": 375.56, "end": 380.59999999999997, "text": " No matter what image comes in, if you always map it to the same thing you" }, { "start": 380.59999999999997, "end": 386.03999999999996, "text": " will always be close in representation space and therefore you always win." }, { "start": 386.04, "end": 392.12, "text": " That doesn't learn a really good representation. What people have" }, { "start": 392.12, "end": 398.76000000000005, "text": " done is they have included so-called negative samples where you'll say I'll" }, { "start": 398.76000000000005, "end": 403.8, "text": " take a different image from this data set but it's a different" }, { "start": 403.8, "end": 409.6, "text": " image than this image. I also do some data augmentation with that" }, { "start": 409.6, "end": 415.56, "text": " image and then I send this through the same encoder to also give me an h." }, { "start": 415.56, "end": 422.36, "text": " This is the h, let's call that h original. This is h plus because it's the same" }, { "start": 422.36, "end": 428.04, "text": " image but slightly differently augmented. And this is h minus which is a different" }, { "start": 428.04, "end": 436.48, "text": " image. Now the task is let's make those two very similar to each other but" }, { "start": 436.48, "end": 443.12, "text": " let's distance them from this other one. We want this to be as far away" }, { "start": 443.12, "end": 449.6, "text": " as possible and these two to be close to each other. Now the network can't simply" }, { "start": 449.6, "end": 454.08, "text": " map everything to a constant function anymore. It needs to actually do" }, { "start": 454.08, "end": 460.6, "text": " something to make these be close together and this be far apart. The" }, { "start": 460.6, "end": 465.08, "text": " combination of this together with the augmentation procedure that goes into" }, { "start": 465.08, "end": 470.32, "text": " augmenting the images has been sort of a good combo to learn good" }, { "start": 470.32, "end": 476.15999999999997, "text": " representations. A lot of papers have alluded to the fact that this is..." }, { "start": 476.15999999999997, "end": 481.88, "text": " The negative samples are to not have these degeneracy, so to not have" }, { "start": 481.88, "end": 487.96, "text": " the simple solutions. But the fact that the representation then is actually good," }, { "start": 487.96, "end": 493.9, "text": " like is good for image tasks down the line, probably comes from the" }, { "start": 493.9, "end": 498.88, "text": " fact of these augmentations right here. There's a lot of evidence from the" }, { "start": 498.88, "end": 503.32, "text": " fact that depending on which augmentations we choose, these" }, { "start": 503.32, "end": 508.56, "text": " representations are going to be better or worse. For example random cropping of" }, { "start": 508.56, "end": 516.88, "text": " an image, so the random sub, like taking a random crop from the image, tends to be" }, { "start": 516.88, "end": 523.88, "text": " very very beneficial. So here this is the same image twice, right? Let's" }, { "start": 523.88, "end": 529.64, "text": " say we take a random crop here and one up here. Maybe there's an" }, { "start": 529.64, "end": 536.2, "text": " overlap here in the middle, right? So it sort of needs to understand that these" }, { "start": 536.2, "end": 541.98, "text": " random crops sort of needs to communicate between these two places in" }, { "start": 541.98, "end": 548, "text": " these random crops. So the representation has to somehow make sure that the" }, { "start": 548, "end": 551.72, "text": " object that is overlapping here is somehow represented, but it can't" }, { "start": 551.72, "end": 556.72, "text": " represent it just as a pixel value, because it doesn't know where the crops" }, { "start": 556.72, "end": 562.48, "text": " come from. So there's a lot of evidence that these representations are the thing" }, { "start": 562.48, "end": 569.64, "text": " that's responsible for making the representation so good. Okay, now this" }, { "start": 569.64, "end": 575.76, "text": " paper simply says do we really need these negative samples right here? Let's" }, { "start": 575.76, "end": 583.12, "text": " just get rid of them. And with a couple of tricks this seems to work. And this" }, { "start": 583.12, "end": 589.4399999999999, "text": " is what seems like magic to me, because as we go forward, think of it," }, { "start": 589.4399999999999, "end": 597.28, "text": " nothing keeps this model right here from doing the degenerate solution" }, { "start": 597.28, "end": 605.52, "text": " h equals constant. Nothing, right? Now for some reason it doesn't do that. And I" }, { "start": 605.52, "end": 609.24, "text": " have the feeling that this is a super delicate balance that you have to do," }, { "start": 609.24, "end": 613.4399999999999, "text": " because when you train, when you start out, it's probably not the constant" }, { "start": 613.4399999999999, "end": 618.16, "text": " function, right? It's probably some distribution. And then simply by the" }, { "start": 618.16, "end": 623.16, "text": " fact that you train it and kind of keep it in the... So this is certainly an" }, { "start": 623.16, "end": 629.4399999999999, "text": " optimal solution, but you might be like in some sort of local minimum once you" }, { "start": 629.4399999999999, "end": 634.84, "text": " start training and you simply don't get out of it during training. And that's why" }, { "start": 634.84, "end": 641.52, "text": " the network has an easier time step by step as it updates itself in very small" }, { "start": 641.52, "end": 645.48, "text": " incremental steps. It has an easier time actually going for the good" }, { "start": 645.48, "end": 651.36, "text": " representation than it has to see this solution right here and converge to that." }, { "start": 651.36, "end": 660.72, "text": " But yeah, it seems delicate. So what are they doing? They are taking that idea of" }, { "start": 660.72, "end": 667, "text": " taking an input image right here. And so by the way, why is it important that" }, { "start": 667, "end": 671.12, "text": " there are no negative samples? Because now the question is always, oh, where do" }, { "start": 671.12, "end": 675.28, "text": " you get these negative samples from? Right? Should they be uniformly sampled?" }, { "start": 675.28, "end": 680.28, "text": " Should we keep a buffer? Should we order them? There is this task of hard negative" }, { "start": 680.28, "end": 684.72, "text": " mining where you say, oh, any old negative won't do. It's actually better if we take" }, { "start": 684.72, "end": 690.36, "text": " negatives that are, you know, just hard enough. There is a curriculum" }, { "start": 690.36, "end": 694.84, "text": " learning problems and so on. So it would be best to actually just get rid of these" }, { "start": 694.84, "end": 700.32, "text": " negative things. So that's why we want to get rid of them. So that's the approach." }, { "start": 700.32, "end": 708, "text": " BYOL. Bootstrap your own latent. There is the input image. You take one image at a" }, { "start": 708, "end": 714.8000000000001, "text": " time and you apply two different random augmentations to it. Right? So you create" }, { "start": 714.8, "end": 720.8399999999999, "text": " two slightly different variants of that image through augmentation. And again," }, { "start": 720.8399999999999, "end": 725.56, "text": " this can be something like a random crop. It can be a horizontal flip randomly." }, { "start": 725.56, "end": 731.8399999999999, "text": " You color jitter, you solarize, you blur, and so on. There are all these variants of" }, { "start": 731.8399999999999, "end": 740.7199999999999, "text": " data augmentation. And the fact that down the line, the representation of" }, { "start": 740.72, "end": 746.5600000000001, "text": " these two things has to be close to each other. I think these random, these" }, { "start": 746.5600000000001, "end": 756.6800000000001, "text": " augmentations here are responsible to make the representations powerful." }, { "start": 756.6800000000001, "end": 761.4, "text": " The fact that later down the line, the network has to sort of learn to ignore" }, { "start": 761.4, "end": 767.24, "text": " these. It has to learn that, oh, you know, it doesn't matter where in the image this" }, { "start": 767.24, "end": 770.92, "text": " object is, because it's been random cropped for different, you know, at" }, { "start": 770.92, "end": 776.24, "text": " different locations. It doesn't matter where in the image this object is. I" }, { "start": 776.24, "end": 780.08, "text": " simply need to have my hidden representation have this particular" }, { "start": 780.08, "end": 784.92, "text": " object in the image. And that's what makes it powerful. Okay, I've said that" }, { "start": 784.92, "end": 790.36, "text": " enough now. Then you have these two slightly different versions. And then you" }, { "start": 790.36, "end": 795.96, "text": " map it through your encoder. Okay, let's go the top path first. You see the bottom" }, { "start": 795.96, "end": 800.2800000000001, "text": " path has the same encoder, but the parameters are different. And this is" }, { "start": 800.2800000000001, "end": 805.9200000000001, "text": " going to be one of the crucial elements right here. So this here are your actual" }, { "start": 805.9200000000001, "end": 810.8000000000001, "text": " parameters that you learn. And this here are what are called the target" }, { "start": 810.8000000000001, "end": 816.9200000000001, "text": " parameters. Now after each, and you can see this for all of these components" }, { "start": 816.9200000000001, "end": 821.52, "text": " right here. So what happens is that the target parameters are basically a copy" }, { "start": 821.52, "end": 826.92, "text": " of these what's what are called the online parameters. Okay, so after each" }, { "start": 826.92, "end": 832.52, "text": " step, you copy over from the online parameters, you copy over to the target" }, { "start": 832.52, "end": 836.76, "text": " parameters, you never learn the target parameters, you simply copy them after" }, { "start": 836.76, "end": 841.76, "text": " each step. Now you don't copy them outright, what you do is you do an" }, { "start": 841.76, "end": 846.88, "text": " exponential moving average. So the target parameters are always going to be sort" }, { "start": 846.88, "end": 852.76, "text": " of a lagging average of your online parameters. And that idea comes from the" }, { "start": 852.76, "end": 860, "text": " momentum contrast principle, where the reasoning sort of behind it is that you" }, { "start": 860, "end": 867.48, "text": " need a kind of a stable you kind of need a stable representation as a target. But" }, { "start": 867.76, "end": 874.92, "text": " I think it hasn't been fully explored or explained why exactly that is so helpful." }, { "start": 874.92, "end": 882.28, "text": " But we just know that if if we have the target to be not the same as the the" }, { "start": 882.28, "end": 887.5999999999999, "text": " online parameters, but actually a kind of a stable version of the past of the" }, { "start": 887.5999999999999, "end": 892.28, "text": " online parameters, then that tends to work well. Again, it's kind of the same" }, { "start": 892.28, "end": 896.64, "text": " principle as with the augmentations. With the augmentations, we have two" }, { "start": 896.76, "end": 901.7199999999999, "text": " different versions of the same image. And now with this procedure here, we sort of" }, { "start": 901.72, "end": 906.4, "text": " have two different versions of the same neural network, but they're slightly" }, { "start": 906.4, "end": 913.76, "text": " different, right. This idea has been around for much longer, like the first" }, { "start": 913.76, "end": 918.76, "text": " queue, deep queue networks, and so on. They had the same principles where they had" }, { "start": 918.76, "end": 922.88, "text": " the the network that they actually learned and then the target network that" }, { "start": 922.88, "end": 927.9200000000001, "text": " is copied over every such and such episodes, and so on. So this, this seems" }, { "start": 927.92, "end": 934.52, "text": " to work seems to be a fundamental principle that seems to work. All right, so" }, { "start": 934.52, "end": 940.5999999999999, "text": " we take our two slightly different augmented versions of the same image, and" }, { "start": 940.5999999999999, "end": 947.0799999999999, "text": " we run them through our two slightly different encoders to obtain two" }, { "start": 947.0799999999999, "end": 952.24, "text": " representations. Now this thing right here, that's going to be our representer." }, { "start": 952.24, "end": 960, "text": " So after this procedure, we discard the entire thing right here, except that. So" }, { "start": 960, "end": 966.64, "text": " this here is your whatever your ResNet 50. Okay, after that follows a projection." }, { "start": 966.64, "end": 975.08, "text": " And the projection is is here to reduce the dimensionality. And honestly, I'm" }, { "start": 975.08, "end": 980.64, "text": " actually not sure why it is here. Because you can do it without, like" }, { "start": 980.64, "end": 986.12, "text": " technically, the algorithm doesn't require this projection. So you can" }, { "start": 986.12, "end": 989.6, "text": " imagine the algorithm without the projection. But just really quickly, the" }, { "start": 989.6, "end": 995.84, "text": " projection simply brings down the representation, which is like 2048" }, { "start": 995.84, "end": 1000.84, "text": " dimensional that comes out of the ResNet 50. It has, it is a two layer neural" }, { "start": 1000.84, "end": 1008.96, "text": " network that first pumps this up to like 4092, and then compresses it down to 256" }, { "start": 1008.96, "end": 1015.24, "text": " dimensions. Okay, so that's the projection network. Again, there is a part that's" }, { "start": 1015.24, "end": 1019.8000000000001, "text": " learned and then the target projector is simply the exponential moving average of" }, { "start": 1019.8000000000001, "end": 1027.1200000000001, "text": " the online projector. But again, this is why exactly this is here, probably" }, { "start": 1027.1200000000001, "end": 1035.3600000000001, "text": " simply because it works, right? But probably because there is no" }, { "start": 1035.36, "end": 1039.1999999999998, "text": " distinction because you don't have different losses, you simply back propagate" }, { "start": 1039.1999999999998, "end": 1043, "text": " through everything and then train everything. So there is no logical" }, { "start": 1043, "end": 1047.08, "text": " distinction between the projection and the representation other than you have a" }, { "start": 1047.08, "end": 1051.84, "text": " different dimensionality. But maybe that's the point here that you make a" }, { "start": 1051.84, "end": 1056.9599999999998, "text": " different dimensionality, even though you could you could do the rest in this" }, { "start": 1056.9599999999998, "end": 1064.04, "text": " 2048 space. Yeah, so for now, just this doesn't exist. Let's just say this" }, { "start": 1064.04, "end": 1070.04, "text": " doesn't exist. And we just work with this representation here. Let's call this Z, Z" }, { "start": 1070.04, "end": 1077.1599999999999, "text": " prime. Okay, so what happens is we take the representation. And now we have one" }, { "start": 1077.1599999999999, "end": 1084.8, "text": " neural network, the predictor right here, that takes the representation of one of" }, { "start": 1084.8, "end": 1090.36, "text": " the image versions. And it simply tries to predict the representation of the" }, { "start": 1090.36, "end": 1099.52, "text": " other image version. So what you want is that q of z equals z prime. Okay, and if" }, { "start": 1099.52, "end": 1113.6, "text": " we expand that is that q of f of z is equal to f target of z prime. And if we" }, { "start": 1113.6, "end": 1121.36, "text": " expand that even further, you can see that q, I'll just write q and f for now" }, { "start": 1121.36, "end": 1132.12, "text": " q of f of a, which is an augmentation at an augmentation of z should be one" }, { "start": 1132.12, "end": 1141.4399999999998, "text": " bracket two bracket three bracket should be f of a of z sorry not see that's the" }, { "start": 1141.44, "end": 1153.24, "text": " image x. Alright, so this makes a lot of sense. You're simply with q. Since these" }, { "start": 1153.24, "end": 1158.1200000000001, "text": " are all different here, so f is the target instead of the online parameters," }, { "start": 1158.1200000000001, "end": 1163.0800000000002, "text": " a is also different, it's a different augmentation that you do, but the x is the" }, { "start": 1163.08, "end": 1171.52, "text": " same. Okay, so the queue simply tries to somehow negate this augmentation and this" }, { "start": 1171.52, "end": 1176.4399999999998, "text": " difference between the target and the online parameters. But you don't tell the" }, { "start": 1176.4399999999998, "end": 1181.72, "text": " queue which augmentation was used. And you don't tell the queue what are the" }, { "start": 1181.72, "end": 1187.6399999999999, "text": " exact parameters of that network. So what the queue has to do is it has to" }, { "start": 1187.64, "end": 1194.96, "text": " somehow it's like it's like it has to take its best guess, right? So basically" }, { "start": 1194.96, "end": 1201.8000000000002, "text": " the queue is trained to output the expected value of the representation" }, { "start": 1201.8000000000002, "end": 1213.48, "text": " right the expected value of the representation f of a of x under all of" }, { "start": 1213.48, "end": 1220.24, "text": " the different possible image augmentations. And that's why it learns" }, { "start": 1220.24, "end": 1224.32, "text": " to ignore these augmentations. So your entire goal with these methods is you" }, { "start": 1224.32, "end": 1230.32, "text": " learn to ignore these augmentations. So you want to learn some method that is" }, { "start": 1230.32, "end": 1235.52, "text": " independent of the augmentations. So by crafting the augmentations in a smart" }, { "start": 1235.52, "end": 1241.24, "text": " way, we can make these representations contain a lot of semantic information," }, { "start": 1241.24, "end": 1244.2, "text": " because what we want to do with the augmentation is basically we want to" }, { "start": 1244.2, "end": 1249.52, "text": " destroy all the non-segmented information. So non-semantic information." }, { "start": 1249.52, "end": 1254.1200000000001, "text": " And random cropping is one of those methods. Horizontal flipping is one of" }, { "start": 1254.1200000000001, "end": 1258.28, "text": " those methods, because we say, well, whether an image goes left to right or" }, { "start": 1258.28, "end": 1262.48, "text": " right to left, most of the time the semantics are the same. The pixels are" }, { "start": 1262.48, "end": 1267.24, "text": " different, but the semantics are the same. So by putting an augmentation in there," }, { "start": 1267.24, "end": 1273.76, "text": " we learn to ignore that augmentation, because our representation now needs to" }, { "start": 1273.76, "end": 1283.08, "text": " be predictable. We learn Q to predict the representation under the" }, { "start": 1283.08, "end": 1288.84, "text": " expectation of our augmentations. And that means it can't be dependent on one" }, { "start": 1288.84, "end": 1296, "text": " particular augmentation. It learns to ignore it. So that's basically what's" }, { "start": 1296, "end": 1301.84, "text": " happening here. Again, there is nothing keeping this from simply collapsing it" }, { "start": 1301.84, "end": 1309.44, "text": " to a trivial solution. And it's probably a combination of the initialization and" }, { "start": 1309.44, "end": 1314.56, "text": " the learning procedure itself, that it goes on in little, little steps, one by" }, { "start": 1314.56, "end": 1320.16, "text": " one, that keeps it in the realm of rather having to... Like it's easier to learn a" }, { "start": 1320.16, "end": 1328.1200000000001, "text": " good representation than it is to collapse to that solution. Okay? So again," }, { "start": 1328.1200000000001, "end": 1333.5600000000002, "text": " components is image, then you augment differently, then you run it through" }, { "start": 1333.5600000000002, "end": 1337.6000000000001, "text": " different encoders, but the encoders are similar in the fact that one is the" }, { "start": 1337.6000000000001, "end": 1343.24, "text": " exponential moving average of the other. And then you try to predict one from the" }, { "start": 1343.24, "end": 1350.2, "text": " other. And that ultimately makes the representation be independent of the" }, { "start": 1350.2, "end": 1354.64, "text": " augmentation. And that means that the representation can only include things" }, { "start": 1354.64, "end": 1359, "text": " that are not destroyed by the augmentations. And if you construct the" }, { "start": 1359, "end": 1365.76, "text": " augmentations smartly, that means you only retain the semantic information." }, { "start": 1365.76, "end": 1371.84, "text": " That's it. So the loss function is pretty simple. As you can see right here, what" }, { "start": 1371.84, "end": 1375.72, "text": " you want is, and this bar is a normalization, what you want is the L2" }, { "start": 1375.72, "end": 1382.4399999999998, "text": " norm between this representation be close to the Q of that" }, { "start": 1382.4399999999998, "end": 1388.3999999999999, "text": " representation. So the Q simply tries to predict the other representation. And you" }, { "start": 1388.3999999999999, "end": 1393.8, "text": " do that for both ways. So you once stick the image in here and try to predict the" }, { "start": 1393.8, "end": 1398.28, "text": " other one, and you do it vice versa. So you get two loss components each time." }, { "start": 1398.28, "end": 1405.72, "text": " It's a symmetric loss. And that's it. That's the method. And they beat all the" }, { "start": 1405.72, "end": 1410.76, "text": " other self-supervised methods, and they get pretty close to the supervised" }, { "start": 1410.76, "end": 1416.96, "text": " representation learning method. As you can see right here, as the" }, { "start": 1416.96, "end": 1421.24, "text": " number of parameters goes up in their model, so one of them is ResNet-50, but" }, { "start": 1421.24, "end": 1425.24, "text": " I'm gonna guess this one right here. But you can also get two higher" }, { "start": 1425.24, "end": 1431.84, "text": " architectures, and then it appears to work even better and come even closer to" }, { "start": 1431.84, "end": 1436.48, "text": " this supervised baseline. This could be because if you have more" }, { "start": 1436.48, "end": 1440.52, "text": " parameters technically in a supervised method, you would also need more labeled" }, { "start": 1440.52, "end": 1446.48, "text": " images maybe, and therefore it doesn't scale as well. I don't know. There is a" }, { "start": 1446.48, "end": 1451.64, "text": " lot of unclarity in this research. All they show is that their numbers are" }, { "start": 1451.64, "end": 1456.5600000000002, "text": " good, which is cool, right? And it's cool that you don't need the" }, { "start": 1456.5600000000002, "end": 1461.48, "text": " negative samples anymore, and it actually doesn't collapse when you do that kind" }, { "start": 1461.48, "end": 1468.2, "text": " of stuff. But there's a lot of, I don't know, there's a lot of things here. For" }, { "start": 1468.2, "end": 1479.72, "text": " example, we use a batch size of 4096 split over 512 TPUv3 cores. With this" }, { "start": 1479.72, "end": 1484.76, "text": " setup, training takes approximately eight hours for ResNet-50. So they train eight" }, { "start": 1484.76, "end": 1494.6000000000001, "text": " hours on 512 TPUs. Just imagine that! So that's sort of crazy amount of" }, { "start": 1494.6000000000001, "end": 1498.76, "text": " computation, again, going into these models. And then the second thing here is" }, { "start": 1498.76, "end": 1502.68, "text": " that you can see that there are some things missing right here, and there are" }, { "start": 1502.68, "end": 1507.16, "text": " all these annotations, which probably means that they take these numbers" }, { "start": 1507.16, "end": 1515.3600000000001, "text": " from those papers. Now, they allude to the fact that they try to follow their" }, { "start": 1515.3600000000001, "end": 1521.0800000000002, "text": " protocol as closely as possible, but I mean, that's never given." }, { "start": 1521.0800000000002, "end": 1528.28, "text": " Or almost never, unless they release the exact code, and even then there" }, { "start": 1528.28, "end": 1533.24, "text": " are still going to be differences. You'd have to replicate the" }, { "start": 1533.24, "end": 1542.04, "text": " exact thing on the exact same number of TPU cores and whatnot. So I highly" }, { "start": 1542.04, "end": 1549, "text": " like these numbers seem to be... I'm not sure, especially if you then go and look," }, { "start": 1549, "end": 1555.8, "text": " and at some point they actually do reproduce the SimClear baseline. So you" }, { "start": 1555.8, "end": 1561.16, "text": " can see right here that they have a own implementation of SimClear, and they" }, { "start": 1561.16, "end": 1566.2, "text": " actually compare this to the numbers that they find in the SimClear paper. And" }, { "start": 1566.2, "end": 1571.5600000000002, "text": " you can see, for example, here there's like four percentage points that" }, { "start": 1571.5600000000002, "end": 1577.72, "text": " their implementation of SimClear gains above this implementation. And if you" }, { "start": 1577.72, "end": 1582.8400000000001, "text": " look at this supervised baseline, that's also from that paper. And there is a" }, { "start": 1582.8400000000001, "end": 1590.1200000000001, "text": " graph further down where they also implement their own version of the..." }, { "start": 1590.12, "end": 1596.52, "text": " their own version of the supervised baseline. I forget... here. So you can see" }, { "start": 1596.52, "end": 1601.6399999999999, "text": " that between the supervised in that paper and the supervised of them," }, { "start": 1601.6399999999999, "end": 1610.28, "text": " sometimes there's like a giant gap right here for the same model, it seems. So all" }, { "start": 1610.28, "end": 1615.12, "text": " of these numbers, I'm not sure you should put too much weight on the fact" }, { "start": 1615.12, "end": 1621.7199999999998, "text": " that this is now outperforming the other methods. I would not put... like unless" }, { "start": 1621.7199999999998, "end": 1626.9199999999998, "text": " this is like super duper replicated very often, I would not put a lot of weight on" }, { "start": 1626.9199999999998, "end": 1631.6799999999998, "text": " the fact that it is better. What I would put a lot of weight on is the fact that" }, { "start": 1631.6799999999998, "end": 1638.6399999999999, "text": " it works at all and achieves, you know, good performance. And there is more. They" }, { "start": 1638.6399999999999, "end": 1644.12, "text": " make... they have like experiments right here that show that their method, the" }, { "start": 1644.12, "end": 1651.12, "text": " BYOL, is much more resistant to like changes in hyperparameters. So here you" }, { "start": 1651.12, "end": 1656.7199999999998, "text": " can see that it falls off much later when you reduce the batch size, which" }, { "start": 1656.7199999999998, "end": 1661.1599999999999, "text": " makes sense, right? Because SimClear is one of these methods that uses negative" }, { "start": 1661.1599999999999, "end": 1666.36, "text": " samples. And for negative samples, it uses the other samples in the mini batch. Now" }, { "start": 1666.36, "end": 1670.1599999999999, "text": " if you have less samples in the mini batch, that means you have a less" }, { "start": 1670.16, "end": 1675.3200000000002, "text": " representative distribution of your entire data set as negative samples. And" }, { "start": 1675.3200000000002, "end": 1681.1200000000001, "text": " therefore, if you increase... decrease the mini batch, then this drops off. And also" }, { "start": 1681.1200000000001, "end": 1687.8000000000002, "text": " they show that, for example, their method is much more robust to the removal of a" }, { "start": 1687.8000000000002, "end": 1695.3600000000001, "text": " couple of these image augmentations. So all of this I find actually pretty cool." }, { "start": 1695.36, "end": 1701.8799999999999, "text": " But the actual numbers here... first, I'm not super duper interested that they" }, { "start": 1701.8799999999999, "end": 1708, "text": " get like two or one points more in something, but they do perform like a lot" }, { "start": 1708, "end": 1715.56, "text": " of experiments. And that... it shows that you can apply the method to different" }, { "start": 1715.56, "end": 1720.28, "text": " things. It's not only like in one setting, so that's pretty cool. It works at least..." }, { "start": 1720.28, "end": 1727.36, "text": " you can say it works at least as well as other methods. And it is a lot easier" }, { "start": 1727.36, "end": 1732.48, "text": " because you don't have this negative sample things. Now the last quarrel I" }, { "start": 1732.48, "end": 1744.2, "text": " have with the paper, and where is it? Where is it? Somewhere they say that we" }, { "start": 1744.2, "end": 1750.04, "text": " release the code... they release the pseudo code. They don't release the code." }, { "start": 1750.04, "end": 1756.8799999999999, "text": " They release the pseudo code in the appendix. So I mean, there are reasons why" }, { "start": 1756.8799999999999, "end": 1761.28, "text": " you sometimes want to release pseudo code. And that's if an algorithm is so" }, { "start": 1761.28, "end": 1767.52, "text": " high level and so simple in its high levelity and so modular to be fleshed" }, { "start": 1767.52, "end": 1774.8, "text": " out that you can't... like it makes more sense. But here it's like pseudo code in" }, { "start": 1774.8, "end": 1783.84, "text": " jacks. And come on... is it really that competitively advantageous to retain" }, { "start": 1783.84, "end": 1788.76, "text": " your code? It's just not reproducible with this. You know that they" }, { "start": 1788.76, "end": 1795.6399999999999, "text": " have like 50 billion hacks in their code. And yeah, so DeepMind has this history of" }, { "start": 1795.6399999999999, "end": 1800.76, "text": " just not releasing... like publishing behind paywalls and just giving pseudo" }, { "start": 1800.76, "end": 1805.52, "text": " code that has lots of mistakes in them. Like the new zero pseudo code, you can't" }, { "start": 1805.52, "end": 1812.52, "text": " even like run it in its basic form if you fill in the things. It's a bit" }, { "start": 1812.52, "end": 1818.72, "text": " annoying. In any way, the method itself seems promising for representation" }, { "start": 1818.72, "end": 1823.08, "text": " learning, as I said, especially because it's pretty simple. It still heavily" }, { "start": 1823.08, "end": 1828.08, "text": " relies on these augmentation methods. So and that's what they say right here." }, { "start": 1828.08, "end": 1832.8, "text": " Nevertheless, BYOL remains dependent on existing sets of" }, { "start": 1832.8, "end": 1837.6399999999999, "text": " augmentations that are specific to vision applications. To generalize BOL to" }, { "start": 1837.6399999999999, "end": 1843.12, "text": " other modalities, it is necessary to obtain similarly suitable augmentations" }, { "start": 1843.12, "end": 1847.3999999999999, "text": " for each of them. Designing such augmentations may require significant" }, { "start": 1847.3999999999999, "end": 1850.36, "text": " effort and expertise. Therefore automating the search for these" }, { "start": 1850.36, "end": 1854.08, "text": " augmentations would be an important next step to generalize BOL to other" }, { "start": 1854.08, "end": 1859.6, "text": " modalities. And I'm not sure if you can do this automating the search for these" }, { "start": 1859.6, "end": 1864.4399999999998, "text": " augmentations. I guess you can do it if you have like a supervised data set and" }, { "start": 1864.4399999999998, "end": 1867, "text": " then you can search and then you can use those augmentations for the" }, { "start": 1867, "end": 1871.6799999999998, "text": " unsupervised. But it seems a bit bootstrap-y, no pun intended right here. I" }, { "start": 1871.6799999999998, "end": 1877.1999999999998, "text": " think the power of these representations again comes from the" }, { "start": 1877.2, "end": 1885.72, "text": " fact that we have these augmentations carefully constructed. So oh yes, the last" }, { "start": 1885.72, "end": 1890.4, "text": " thing broader impact statement. Just read this like try to estimate the" }, { "start": 1890.4, "end": 1895.1200000000001, "text": " perplexity of this broader impact statement. Let's go. The presented" }, { "start": 1895.1200000000001, "end": 1899.64, "text": " research should be categorized as research in the field of unsupervised" }, { "start": 1899.64, "end": 1905.92, "text": " learning. This work may inspire new algorithms, theoretical and experimental" }, { "start": 1905.92, "end": 1910.64, "text": " investigation. The algorithm presented here can be used for many different" }, { "start": 1910.64, "end": 1915.88, "text": " vision applications and a particular use may have both positive or negative" }, { "start": 1915.88, "end": 1922.16, "text": " impacts, which is known as the dual use problem. Besides as vision data sets" }, { "start": 1922.16, "end": 1927.76, "text": " could be biased, the representation learned by BOL could be susceptible to" }, { "start": 1927.76, "end": 1934.76, "text": " replicate these biases. Like come on. So people who advocated for making everyone" }, { "start": 1934.76, "end": 1940.12, "text": " do this. Is this what you wanted? Is this like is this a satisfactory result for" }, { "start": 1940.12, "end": 1946.28, "text": " you? And if you have this as a reviewer, is this okay or not? I mean let's just" }, { "start": 1946.28, "end": 1953.64, "text": " cross out some words here. Blank, like field, let's just put field. Or" }, { "start": 1953.64, "end": 1959, "text": " machine learning. Why not? Machine learning. Machine learning. This work" }, { "start": 1959, "end": 1963.04, "text": " inspire new algorithms? Yes. The algorithm presented here can be used for many" }, { "start": 1963.04, "end": 1967.96, "text": " different machine learning applications and a particular use may have both negative" }, { "start": 1967.96, "end": 1974.24, "text": " effects. Besides as data sets could be biased, the representation learned by this" }, { "start": 1974.24, "end": 1982.96, "text": " paper could be susceptible to replicate these biases. Well there is a copy-paste" }, { "start": 1982.96, "end": 1987.56, "text": " thing that you can apparently put into any and all papers that you write from" }, { "start": 1987.56, "end": 1994.12, "text": " now on. And hey DeepMind is doing it. So you know, there you go. Okay maybe a bit" }, { "start": 1994.12, "end": 2000.6399999999999, "text": " cynical but I'm like I told you this would happen. I told you. And you know." }, { "start": 2000.6399999999999, "end": 2008, "text": " Okay so that was it for my comments right here. They do have like a giant ton of" }, { "start": 2008, "end": 2012.6399999999999, "text": " experiments and I appreciate that right. They really try to show that it works in" }, { "start": 2012.64, "end": 2018.8400000000001, "text": " many different situations and yeah yet to solve why this doesn't collapse but" }, { "start": 2018.84, "end": 2043.12, "text": " apparently it doesn't. So try it out. Give it a try and I'll see you next time. Bye bye." } ]
sEG8hD64c_Q
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
TUNIT: Rethinking the Truly Unsupervised Image-to-Image Translation (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "image translation", "style transfer", "unsupervised", "clustering", "self-supervised", "cnn", "convolutional neural networks", "gan", "generative adversarial network", "generator", "encoder", "discriminator", "conditional", "style", "pseudo-label", "augmentation", "cropping" ]
Image-to-Image translation usually requires corresponding samples or at least domain labels of the dataset. This paper removes that restriction and allows for fully unsupervised image translation of a source image to the style of one or many reference images. This is achieved by jointly training a guiding network that provides style information and pseudo-labels. OUTLINE: 0:00 - Intro & Overview 1:20 - Unsupervised Image-to-Image Translation 7:05 - Architecture Overview 14:15 - Pseudo-Label Loss 19:30 - Encoder Style Contrastive Loss 25:30 - Adversarial Loss 31:20 - Generator Style Contrastive Loss 35:15 - Image Reconstruction Loss 36:55 - Architecture Recap 39:55 - Full Loss 42:05 - Experiments Paper: https://arxiv.org/abs/2006.06500 Code: https://github.com/clovaai/tunit Abstract: Every recent image-to-image translation model uses either image-level (i.e. input-output pairs) or set-level (i.e. domain labels) supervision at minimum. However, even the set-level supervision can be a serious bottleneck for data collection in practice. In this paper, we tackle image-to-image translation in a fully unsupervised setting, i.e., neither paired images nor domain labels. To this end, we propose the truly unsupervised image-to-image translation method (TUNIT) that simultaneously learns to separate image domains via an information-theoretic approach and generate corresponding images using the estimated domain labels. Experimental results on various datasets show that the proposed method successfully separates domains and translates images across those domains. In addition, our model outperforms existing set-level supervised methods under a semi-supervised setting, where a subset of domain labels is provided. The source code is available at this https URL Authors: Kyungjune Baek, Yunjey Choi, Youngjung Uh, Jaejun Yoo, Hyunjung Shim Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we'll look at rethinking the truly unsupervised image-to-image translation by Kyungjoon Baek, Yoonjae Choi, Yongjung Woo, Ja-Joon Yoo, and Hyeong-Joon Shim. So in this paper we'll deal with image-to-image translation in an unsupervised fashion. So on a high level they replace the need for domain or really single image label annotations in image-to-image translation by training a guiding network that is able to sort of do a self-clustering of the image domain and therefore that guides the image-to-image translation instead of the previously needed labels. I myself don't know too much about image-to-image translation and style transfer and all of this stuff. This has always been kind of a mystery to me and we'll try to make as much sense as possible out of this paper if you're with me. I might not get everything right but I will give my best of course. As always if you like content like this consider sharing it out and leaving a like and a comment. I do read the comments so I get a good idea of what you have to say about it. Cool so what we're seeing here is an example of image-to-image translation of like a sort of a style transfer. Now what you'll have on the left is a source image. Now the goal is to translate this source image to a different domain while sort of keeping the 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 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 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 i don't there's no correspondence right there is no this corresponds to this or or something like this so image to image translation is now possible between domains when i just have domain level labels but this is still expensive collecting these labels you know it's is like collecting labels for a supervised data so 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 um i guess you could differentiate these people into many many different ways but um 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 discriminators so general adversarial network but they have like a bit of some sort of twists so you can already see from the design from the drawings right here the discriminator is probably the easiest the discriminator gets an image right here it doesn't have to be a generated it is a either a generated image or a real image and it needs to decide you can see right here this means that the input domain is a vector or an image in this case and the output is a number it needs to decide if it's real or fake now in fact it's not as easy because you can see there are these multiple heads right here so this whole thing as I said is built on this kind of pseudo clustering approach there is this pseudo label that comes out of the left side we're going to look at that in a second but in essence you assume that there are multiple classes multiple domains in the data set and the discriminator here has one classification head for each of those classes so from somewhere outside it will get the information oh this is now supposed to be one of those ginger cats right as opposed to one of those black and white cats or one of the brown haired cats no it's one of the ginger cats and then there is a special head on top of the classifier that only classifies fake from real ginger cats okay which is a different classifier from the other domains so the discriminator it's sort of a conditional discriminator conditioned on a label okay from the discriminators point of view it's simply a label conditioned discriminator discriminating between real and false and I think that's yeah how you train the discriminator is you would give an image and you would let this encoder here this guiding network label the image and how we come up with this label again that we'll look in a second but this just gives a label and then 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 now 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 um what about this this encoding network right here it's e for encoder I guess but they also call it the guiding network so what this does is this is what's this supposed to do is it'll take an image any image and it will output two things one is a label and one is a style code so the label is supposed to be a number between zero and da da da da da k minus one so 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 this e it simply comes up with a class label and it also comes up with the style code now these two things are going to go then different pathways in this in this network the label is directly going to the discriminator right the generator does not see the label okay the style code does not go to the discriminator but goes to the generator all right so the two inputs from the encoder they one goes to the discriminator which is the label and one goes to the generator which is the style now the generator lastly it takes a source image and it takes this style code right here now the style code is encapsulating as we said the style of the reference image so the style is supposed to be whatever whatever whatever makes this domain of images the same so the style the way we're going to train this is that the style is going to describe somehow all the images that are from this label the style is going to describe whatever the style is it's very hard to it's very hard to explain if we look at the loss it becomes clearer why the things are how they are so it takes the style code and it takes the source image and it combines them and its task is to output this generated image as you can see in this example the generated image is basically this cat but with the style of the reference image and it outputs an image and the discriminator of course then is tasked with differentiating whether that image is real or fake for the given label over here okay so this is the entire thing and you all train this jointly so you jointly train the encoder to produce these class labels and the styles you train the generator to take in the styles and the source images and output the generated image to fool the discriminator and the discriminator at the same time is trained to differentiate between real and fake images based on the label that the encoder gives very very convoluted and complicated but there are a few things that make it easier first of all as you can see here the pseudo label is detached is argmaxed and detached so the pseudo label really is a number and there is no gradient back propagation along this line okay that makes that makes it a lot easier so the so what we first need is we need a way to train the encoder to come up with suitable class labels even though it doesn't get any back propagation signal into that part of its network so that's where we start with the loss functions the way we're going to do this is we're going to take the following approach we're going to take an image and we're going to take a randomly augmented version so for example a random crop or a horizontal flip and so on so the now we bring in ideas from self-supervision and again if you watch the video on learning to classify images without labels this is one of their main staples these self-supervised approaches really tend to learn representations that allow you to self cluster now in that paper they go further and they do this nearest neighbor thing in this paper they just do sort of the first step of this self clustering which i guess makes it such that you could potentially improve this paper by applying the other paper but who knows so we're going to take an image and we're going to augment it okay so that means we're going to like random crop it or in change its luminance or whatnot so we have two versions of the same image and what we want to maximize we want to maximize the mutual information between not between the images themselves but p is going to be this output of the encoder so x goes into the encoder and the encoder outputs the style and the class label and the class label here so p is going to be the class distribution all right so this is going to be like a histogram or maybe the log it's it's already yes so it's going to be a histogram over classes from which we're going to sample the label c or l or whatnot y hat y but the p is the distribution over output classes so since we don't have a label we can't train the distribution like in a supervised way supervised way so what we'll have to say is we want to maximize the mutual information between the output distribution of the image and the output distribution of the augmented image now that entails the following two quantities there's the entropy of p and there's the conditional entropy of p given p augmented now first of all it means we want to maximize this the entropy of p and that's supposed to be over the entire data set so this is the entropy over the entire data set x what it means is that we want different x's so if there's x1 x2 x3 and so on we want those to have different distributions in labels okay so if if the entropy is really high of the distribution p that means that different images get assigned to different classes some something like this all right if this is low then that would mean all the images basically get assigned to the same class and that's not good we want our classifier since we don't have labels it's a it's basically a cluster we want our cluster to sort of fill the space of possible clusters with the images so that's the first thing we want to maximize the mutual information we need to maximize this entropy and then second we want 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 of the do a plus augmented right then that shouldn't really change its class label and this is what these so that should sort of keep the class labeling this is horrible but the idea here is that it's kind of a reverse thinking from supervised learning in supervised learning we have the label like this is class this is class 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 bluer sky so i assume that it'll still have the same label here i don't have the label but what i can require is to say whatever you output for the image it should be the same for the augmented image so these two objectives are enough to give you sort of a rough clustering of the output space maximize the entropy minimize the conditional entropy between two versions of the same image okay that's how we train this pseudo labeling approach so now we have a we have a model that can give a label to each image very cool so how do we train the other parts now there are additional um 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 our encoder here is trained to help the generator with its task of fooling the discriminator okay but um 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 and you train then take the next image or you take batches of image you take train and so on like this right and now you have this image what you want to do for this to work is you want to build up sort of a queue of images that you have already looked at like these images these are going and the queue can be let's say 10 long and you would always throw out the oldest and and in queue and newest 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 what are 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 three and two so now what will require is that the s the style code of our image is closer to the style code of its augmented version so the same principle again we want we'll say that you know these augmentations they don't really change anything about the style now this argument is a bit more wonky but if you think of you know random crops and random flips don't really change anything about the fur color or so of a of a cat so we want those two to be closer together than s is to any of these other images okay so this is a contrast of loss where you pull together two things that you think should be close and you push apart things that you think should be far away from each other so this style loss basically guarantees that you have a distinct style for each image that is robust to the kind of transformations that you do under augmentation okay specifically this style loss doesn't care about the domain right this is for each image you don't know if these other images are from the same domain or from different domains and that's why the style is basically individual to the image but as we as we're going to see the style does capture something of the domain as well but this loss right here is supposed to be each image has a style right so this is the style code of x this n plus one way classification enables e to utilize not only the similarity of the positive pair but also the dissimilarity of the negative pairs where the negative style codes are stored into a queue using previously sampled images we observe that adding this objective significantly improves unsupervised classification accuracy in animal faces from this to that compared to the previous over clustering approach okay so we have two outputs now and now we go to the adversarial loss so the question is how do we train the generator and the discriminator and the discriminator so they have three different losses for the generator and the discriminator and the most important one of course is this adversarial loss right here so the discriminator simply tries to distinguish is an image real or fake conditioned on a class so in case of a real image and that's this line right here it tries to distinguish is this real or fake based on y and y is x fed to the encoder and the encoder gives you a label all right that's and the label selects the head of the discriminator at the same time that the discriminator is trying to distinguish real from fake so these two lines the generator is trying to fool the discriminator so the upper if you've never seen a GAN loss the upper part here that's the real data and the bottom part here is the fake data now at the same time the discriminator is trying to distinguish real from fake and the generator is trying to make the discrim fool the discriminator so both are of the generator and the discriminator are actually using that loss but the sign in front of it is different okay and since the generator is not involved in the top line you can usually leave that away because there is no backprop path through that and there is no backprop backprop 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 these 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 not tilde whatever x fake xf 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 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 okay 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 what with a particular class and that's how you get the domain into the style that's why the style can capture something like fur color of the different cat breeds because the generator is forced to take the style that the encoder gives and map it to an image of the class y tilde that it also the encoder gives but doesn't tell to the generator 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 adversary loss that's the most important loss now there's also additional losses so they they do additional losses that they add on top for the generator they say in order to prevent degenerate situation where the generator ignores the style code and synthesizes a random image in the domain y or in the domain y tilde we impose a style contrastive loss to the generator so now there's still the danger that the degenerator simply produces a valid image right from the data set or even from the domain y tilde though i don't know how it would know why tilde or i've just not seen something i 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 will clear it out so they say we impose a style contrastive loss to the generator now this is almost the same 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 i take i take this i 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 all right so what does that do if i now and then i ask that s prime be close to s tilde so that means if i generate an image with the style of my reference image the upcoming 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 of 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 uh 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 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 um it of the image x but now you teach it and i think before this loss you'd have a good chance that uh the styles would just be all over the place they would sort of be consistent but they will not be aligned and with this you force that the style of an image itself if you gent if you put that into the generator it will lead to that image itself okay that's it so this is a 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 generator needs to if the generator knows what sort of class it's going to produce it's going to be better okay so you can count on that information being in there but also also because of all the other losses that the generator has and the contrastive loss on the style the style code is going to sort of describe the individual style of an image and but is also going to describe what the style of that class is because it technically needs to contain information about the class and that's why i think this works with the style because there is no inherent notion of like this is 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 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 put an image into a source image and i input its own style again going through the encoder you should give me back the source image itself very complex and all of the generator loss is back propagated through to the encoder so this is the full loss as i said discriminator easy adversarial loss generator adversarial loss plus this style round trip consistency plus the own image round trip consistency encoder gets all of the generator loss all of it so all of this goes here so the encoder fully helps the generator and it is also trained with this mutual information and the style contrastive loss wow that's some losses wow that that's a lot of damage so they do different investigations into their model here and i don't even know if we've missed some of the pictures but ultimately what you can now do is you can do image to image translation either that's the cool thing you can have a reference image for one or what you can do is you can ask your discriminator what kind of domains are there sorry you can ask your encoder what kind of domains are there you've guessed the number of domains so it's maybe 10 or in this case it's uh eight eight eight domains of cats and you can simply divide your data set into these eight domains right one two three four five and so on oh 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 wholly unholy mixture of losses especially the first concern is couldn't we just train the guiding network like by its own on its own and then after that train this gan thing right that's what we had at the very beginning we said there's this guiding network and it does the clustering and all and couldn't we just train this gan architecture on top of the frozen guiding network and their conclusion is no if we train everything together it works better so on the left you have whenever you train the guiding network by itself and what you're seeing here is the t-sne visualization t-sne is a a down like a 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 but for purposes of investigating we'll 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 and that means the style is sort of representative of the domain okay that's what we want we want the style to capture the domain of an image and ideally not the image itself too much now on the left you see that there is quite a bit of overlap between these quite a bit of wash between the style and the group and on the right if you jointly train the gan together with the guiding network you see that these classes of the style codes which have no reason to cluster are much more clustered and separated and they are separated much more along the lines of the ground truth classes okay so that's pretty cool now i would actually be interested in what happens if you do the separate training with the full pipeline of this learning to classify images without labels thing and their nearest neighbor thing because they've also shown that just purely this self-clustering doesn't work too well but if you then do the nearest neighbor thing on top then that improves the classification significantly so this could potentially help either the separate or the joint training right here and there might be a connection between the joint training and whatever they're doing in any case they also show that then these fid which is a quality metric for gans lower is better that the joint training goes way lower in the fid than the separate training okay that's that's the reason why they built this convoluted thing because it works way better and here they ablate they ablate some of the losses to investigate what's really going on and in this case t-sne visualization of the 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 network's prediction so each color is whatever the guiding network says the classes and the dot is one style each is one style each dot is one style vector and they're projected down to two dimensions you can see pretty clearly that the individual classes the individual clusters of style vectors correspond to different labels of the guiding network which is to be expected but also since they overestimate the number of classes in this case you can see that the even though the class label is different the style network will group the very similar classes together you can see here these are both cheetahs and here are both lions so it'll group them together which is pretty cool and sort of verifies that it recognizes these these different things because you force the guiding network to make 10 classes but the style network is simply continuous so it's cool to see that the style network will make one cluster with styles even though it's different labels and here you can see different samples from these domains just to verify that the guiding network has actually learned to separate things i still find this pretty pretty magical too this is completely unsupervised and it sort of finds these clusters by itself all right they have a bunch of images here as i said this is no longer with one reference images image this is where you take the entire domain so you self-label with your guiding network and then you take the mean vector and that's going to be your target style vector and these are the source images that you transfer and you can see that you know it works pretty well so they always have like one adult animal and one child animal and i guess not or just two different ones here this is particularly cute though i have to show you this fox right here what's going on with that fox like someone help that fox yeah um so we're not at perfection yet as you can see but it's you know that 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 um so this is sort of where you can see the limitations right here um 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 um 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 um fully image to image and you see it especially with faces because we as us humans as us humans are extremely good at you know seeing when there's something wrong with a face but it's 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-sneak plots and whatnot in their appendix they have the code online as far as i as i have seen and with that let me know what you think in the comments bye bye
[ { "start": 0, "end": 6.48, "text": " Hi there! Today we'll look at rethinking the truly unsupervised image-to-image translation" }, { "start": 6.48, "end": 16.48, "text": " by Kyungjoon Baek, Yoonjae Choi, Yongjung Woo, Ja-Joon Yoo, and Hyeong-Joon Shim." }, { "start": 16.48, "end": 23.44, "text": " So in this paper we'll deal with image-to-image translation in an unsupervised fashion." }, { "start": 23.44, "end": 31.44, "text": " So on a high level they replace the need for domain or really single image label annotations" }, { "start": 31.44, "end": 37.6, "text": " in image-to-image translation by training a guiding network that is able to sort of do a" }, { "start": 37.6, "end": 44.32, "text": " self-clustering of the image domain and therefore that guides the image-to-image translation instead" }, { "start": 44.32, "end": 52.16, "text": " of the previously needed labels. I myself don't know too much about image-to-image translation" }, { "start": 52.16, "end": 58.8, "text": " and style transfer and all of this stuff. This has always been kind of a mystery to me and we'll try" }, { "start": 58.8, "end": 64.88, "text": " to make as much sense as possible out of this paper if you're with me. I might not get everything" }, { "start": 64.88, "end": 72.16, "text": " right but I will give my best of course. As always if you like content like this consider" }, { "start": 72.16, "end": 79.19999999999999, "text": " sharing it out and leaving a like and a comment. I do read the comments so I get a good idea of" }, { "start": 79.2, "end": 85.76, "text": " what you have to say about it. Cool so what we're seeing here is an example of image-to-image" }, { "start": 85.76, "end": 93.2, "text": " translation of like a sort of a style transfer. Now what you'll have on the left is a source image." }, { "start": 93.2, "end": 100, "text": " Now the goal is to translate this source image to a different domain while sort of keeping the" }, { "start": 100, "end": 106.64, "text": " the features of the image the same. And here is sort of I'm always confused because here it's like" }, { "start": 106.64, "end": 112.8, "text": " we keep the pose of the cat the same okay so we sort of keep the same cat but we want to change" }, { "start": 112.8, "end": 120.16, "text": " its style which means it's breed in this particular case. So on the top you can see that" }, { "start": 120.16, "end": 127.36, "text": " the domain images are they come in these different groups and in fact it's not only those four but" }, { "start": 127.36, "end": 132.88, "text": " the entire data set is split into these different groups and among these different groups you have" }, { "start": 132.88, "end": 140.88, "text": " some sort of a shared style. Now this shared style is what you would like to transfer to the" }, { "start": 140.88, "end": 147.2, "text": " source image. So if you transfer the style of all of these cats right here which all seem to be sort" }, { "start": 147.2, "end": 154.64, "text": " of ginger cats to this instance right here what you'll end up with is a cat okay it was ginger" }, { "start": 154.64, "end": 161.2, "text": " before. Might not be the best example but you you sort of get what I mean is that the thing that" }, { "start": 161.2, "end": 169.28, "text": " you transfer is whatever is common among these domain images okay and that's what I guess" }, { "start": 169.28, "end": 177.6, "text": " explains why the pose of the cat stays the same because it only it is basically taught to keep" }, { "start": 177.6, "end": 184.95999999999998, "text": " the image the same except to transfer whatever is common among the images in the domain class" }, { "start": 184.96, "end": 191.76000000000002, "text": " and that's image to image transfer or translation. Now until this paper at least that's what the" }, { "start": 191.76000000000002, "end": 198.64000000000001, "text": " paper claims these image to image translation models they required labels and why is that?" }, { "start": 198.64000000000001, "end": 206.56, "text": " That's because you need to know how to build these domains here at the top to get these" }, { "start": 206.56, "end": 212.16, "text": " different style vectors out or you actually would need label annotations for each image" }, { "start": 212.16, "end": 217.84, "text": " for each single image you would need to know which one you need to know which one of the source" }, { "start": 217.84, "end": 222.56, "text": " corresponds to which one of the target so they have a graphic right here where they explain the" }, { "start": 223.04, "end": 230.16, "text": " sort of different the different stages that image to image translation went through historically" }, { "start": 230.16, "end": 238, "text": " so first you'd have to have corresponding images one to one where you'd say okay here is an example" }, { "start": 238, "end": 243.36, "text": " of a sketch of a shoe and here is the corresponding shoe here is the sketch of another shoe and here" }, { "start": 243.36, "end": 249.6, "text": " is the corresponding shoe and so on and from that you could learn a model that translates from one" }, { "start": 249.6, "end": 257.36, "text": " domain to the other because you have corresponding image level annotations which image corresponds to" }, { "start": 257.36, "end": 262.88, "text": " which so basically which element of the domain a corresponds to which element in the domain b" }, { "start": 262.88, "end": 268.71999999999997, "text": " then the next stage of this was when you only need set level annotations and that's sort of what we" }, { "start": 268.71999999999997, "end": 276, "text": " looked at if you had supervised labels for domains so what you'll say is that there are three domains" }, { "start": 276, "end": 283.52, "text": " a b and c and actually let's let's forget c for a moment and just deal with a and b" }, { "start": 283.52, "end": 289.44, "text": " to make it equivalent to the thing on the left now i just know that these things are instances" }, { "start": 289.44, "end": 296.48, "text": " of class a and these things are instances of class b yet i i don't there's no correspondence" }, { "start": 296.48, "end": 304.16, "text": " right there is no this corresponds to this or or something like this so image to image translation" }, { "start": 304.16, "end": 312.15999999999997, "text": " is now possible between domains when i just have domain level labels but this is still expensive" }, { "start": 312.15999999999997, "end": 317.52, "text": " collecting these labels you know it's is like collecting labels for a supervised data so" }, { "start": 317.52, "end": 322.88, "text": " collecting labels for a supervised data set a human needs to look at each image and then conclude" }, { "start": 322.88, "end": 331.44, "text": " what sort of domain it is their paper introduces the following where you do not have domains anymore" }, { "start": 331.44, "end": 338.64, "text": " you simply have a data set x now this data set your hypothesis is that there are still going to be" }, { "start": 338.64, "end": 344.47999999999996, "text": " domains in the data set they can i guess they can be overlapping or not but there are still going to" }, { "start": 344.48, "end": 351.52000000000004, "text": " be domains you just don't know what they are so in this case um i guess you could differentiate" }, { "start": 351.52000000000004, "end": 357.92, "text": " these people into many many different ways but um in essence you're going to assume that there is" }, { "start": 357.92, "end": 364.32, "text": " some kind of a domain structure you just don't know what it is but if you knew what it was then" }, { "start": 364.32, "end": 372.24, "text": " you could simply apply methods from here to the data set and you'd be done now their paper shows" }, { "start": 372.24, "end": 378.88, "text": " that if you apply something like a self-clustering approach and we've seen these approaches before in" }, { "start": 378.88, "end": 386.24, "text": " the paper about learning to classify images without labels if you have techniques like this you can do" }, { "start": 386.24, "end": 392.40000000000003, "text": " like a self-clustering approach on this data set x right here and then you could learn your image" }, { "start": 392.40000000000003, "end": 399.44, "text": " to image translation yet this paper shows that if you do that the quality is not as good as if you" }, { "start": 399.44, "end": 407.44, "text": " do both things jointly so what this paper does is it jointly learns to cluster let's say to" }, { "start": 408, "end": 415.84, "text": " self-label the images and to make the to do this image to image translation and by doing the tasks" }, { "start": 415.84, "end": 423.12, "text": " jointly they help each other perform better okay that's a general overview so how do they do this" }, { "start": 423.12, "end": 432.8, "text": " they have three different parts to their model there is the encoder or they call this the guiding" }, { "start": 432.8, "end": 439.44, "text": " network there is the generator and there is the discriminator so the generator and the discriminator" }, { "start": 439.44, "end": 445.84000000000003, "text": " they are fairly standard GAN generators and discriminators so general adversarial network" }, { "start": 445.84, "end": 453.35999999999996, "text": " but they have like a bit of some sort of twists so you can already see from the design from the" }, { "start": 453.35999999999996, "end": 460.79999999999995, "text": " drawings right here the discriminator is probably the easiest the discriminator gets an image right" }, { "start": 460.79999999999995, "end": 468.08, "text": " here it doesn't have to be a generated it is a either a generated image or a real image and it" }, { "start": 468.08, "end": 474.79999999999995, "text": " needs to decide you can see right here this means that the input domain is a vector or an image in" }, { "start": 474.8, "end": 482.72, "text": " this case and the output is a number it needs to decide if it's real or fake now in fact it's not" }, { "start": 482.72, "end": 489.2, "text": " as easy because you can see there are these multiple heads right here so this whole thing" }, { "start": 489.2, "end": 494.64, "text": " as I said is built on this kind of pseudo clustering approach there is this pseudo label" }, { "start": 494.64, "end": 501.68, "text": " that comes out of the left side we're going to look at that in a second but in essence you assume" }, { "start": 501.68, "end": 508.08, "text": " that there are multiple classes multiple domains in the data set and the discriminator here has one" }, { "start": 508.08, "end": 514.96, "text": " classification head for each of those classes so from somewhere outside it will get the information" }, { "start": 514.96, "end": 521.04, "text": " oh this is now supposed to be one of those ginger cats right as opposed to one of those black and" }, { "start": 521.04, "end": 527.52, "text": " white cats or one of the brown haired cats no it's one of the ginger cats and then there is a special" }, { "start": 527.52, "end": 535.4399999999999, "text": " head on top of the classifier that only classifies fake from real ginger cats okay which is a" }, { "start": 535.4399999999999, "end": 541.04, "text": " different classifier from the other domains so the discriminator it's sort of a conditional" }, { "start": 541.04, "end": 547.1999999999999, "text": " discriminator conditioned on a label okay from the discriminators point of view it's simply a" }, { "start": 547.1999999999999, "end": 554.0799999999999, "text": " label conditioned discriminator discriminating between real and false and I think that's yeah" }, { "start": 554.08, "end": 563.44, "text": " how you train the discriminator is you would give an image and you would let this encoder here this" }, { "start": 563.44, "end": 569.36, "text": " guiding network label the image and how we come up with this label again that we'll look in a second" }, { "start": 569.36, "end": 575.44, "text": " but this just gives a label and then you'd for that particular label you'd classify the image" }, { "start": 575.44, "end": 582.4000000000001, "text": " into real or false now the fact that there is this shared part right here of course is" }, { "start": 582.4, "end": 587.92, "text": " you could also think of having one discriminator per class but the shared part now gives you some" }, { "start": 587.92, "end": 592.72, "text": " shared features and so on but it's not necessary it's not the the point is that there is a" }, { "start": 592.72, "end": 602.0799999999999, "text": " discriminator per class it's class conditional okay so what about the generator I think is I" }, { "start": 602.0799999999999, "end": 609.52, "text": " guess is the most complex um what about this this encoding network right here it's e for encoder I" }, { "start": 609.52, "end": 615.76, "text": " guess but they also call it the guiding network so what this does is this is what's this supposed to" }, { "start": 615.76, "end": 624.16, "text": " do is it'll take an image any image and it will output two things one is a label and one is a" }, { "start": 624.16, "end": 635.4399999999999, "text": " style code so the label is supposed to be a number between zero and da da da da da k minus one so" }, { "start": 635.44, "end": 642.48, "text": " k minus one so that's supposed to be a class label and how do you know how many classes there are if" }, { "start": 642.48, "end": 649.36, "text": " there are no labels you just guess and your best bet is to slightly over guess so if you expect" }, { "start": 649.36, "end": 655.9200000000001, "text": " there to be between 10 and 15 classes maybe put k to 20 okay you don't want to under guess but you" }, { "start": 655.9200000000001, "end": 665.2800000000001, "text": " can over guess but not by too much of course so you have to have this this estimation of how many" }, { "start": 665.28, "end": 672.48, "text": " classes but then this e it simply comes up with a class label and it also comes up with the style" }, { "start": 672.48, "end": 681.76, "text": " code now these two things are going to go then different pathways in this in this network the" }, { "start": 681.76, "end": 688.4, "text": " label is directly going to the discriminator right the generator does not see the label" }, { "start": 688.4, "end": 697.28, "text": " okay the style code does not go to the discriminator but goes to the generator all right so the two" }, { "start": 697.28, "end": 703.12, "text": " inputs from the encoder they one goes to the discriminator which is the label and one goes" }, { "start": 703.12, "end": 713.12, "text": " to the generator which is the style now the generator lastly it takes a source image and" }, { "start": 713.12, "end": 719.92, "text": " it takes this style code right here now the style code is encapsulating as we said the style of the" }, { "start": 719.92, "end": 729.12, "text": " reference image so the style is supposed to be whatever whatever whatever makes this domain" }, { "start": 729.12, "end": 735.52, "text": " of images the same so the style the way we're going to train this is that the style is going" }, { "start": 735.52, "end": 743.36, "text": " to describe somehow all the images that are from this label the style is going to describe whatever" }, { "start": 743.36, "end": 749.1999999999999, "text": " the style is it's very hard to it's very hard to explain if we look at the loss it becomes clearer" }, { "start": 749.1999999999999, "end": 757.4399999999999, "text": " why the things are how they are so it takes the style code and it takes the source image and it" }, { "start": 757.4399999999999, "end": 763.04, "text": " combines them and its task is to output this generated image as you can see in this example" }, { "start": 763.04, "end": 770.64, "text": " the generated image is basically this cat but with the style of the reference image and it outputs an" }, { "start": 770.64, "end": 776.24, "text": " image and the discriminator of course then is tasked with differentiating whether that image" }, { "start": 776.24, "end": 784.0799999999999, "text": " is real or fake for the given label over here okay so this is the entire thing and you all train" }, { "start": 784.0799999999999, "end": 790.88, "text": " this jointly so you jointly train the encoder to produce these class labels and the styles you" }, { "start": 790.88, "end": 796.64, "text": " train the generator to take in the styles and the source images and output the generated image to" }, { "start": 796.64, "end": 802.48, "text": " fool the discriminator and the discriminator at the same time is trained to differentiate between" }, { "start": 802.48, "end": 811.12, "text": " real and fake images based on the label that the encoder gives very very convoluted and complicated" }, { "start": 811.68, "end": 819.52, "text": " but there are a few things that make it easier first of all as you can see here the pseudo label" }, { "start": 819.52, "end": 827.36, "text": " is detached is argmaxed and detached so the pseudo label really is a number and there is no gradient" }, { "start": 827.36, "end": 837.28, "text": " back propagation along this line okay that makes that makes it a lot easier so the so what we first" }, { "start": 837.28, "end": 844.48, "text": " need is we need a way to train the encoder to come up with suitable class labels even though it" }, { "start": 844.48, "end": 851.2, "text": " doesn't get any back propagation signal into that part of its network so that's where we start with" }, { "start": 851.2, "end": 857.36, "text": " the loss functions the way we're going to do this is we're going to take the following approach" }, { "start": 858.16, "end": 867.28, "text": " we're going to take an image and we're going to take a randomly augmented version so for example" }, { "start": 867.28, "end": 873.2, "text": " a random crop or a horizontal flip and so on so the now we bring in ideas from self-supervision" }, { "start": 873.2, "end": 879.2800000000001, "text": " and again if you watch the video on learning to classify images without labels this is one of" }, { "start": 879.2800000000001, "end": 886.8000000000001, "text": " their main staples these self-supervised approaches really tend to learn representations that allow" }, { "start": 886.8000000000001, "end": 892.32, "text": " you to self cluster now in that paper they go further and they do this nearest neighbor thing" }, { "start": 892.32, "end": 898.6400000000001, "text": " in this paper they just do sort of the first step of this self clustering which i guess makes it such" }, { "start": 898.64, "end": 905.36, "text": " that you could potentially improve this paper by applying the other paper but who knows so" }, { "start": 906.3199999999999, "end": 911.84, "text": " we're going to take an image and we're going to augment it okay so that means we're going to like" }, { "start": 911.84, "end": 919.1999999999999, "text": " random crop it or in change its luminance or whatnot so we have two versions of the same image" }, { "start": 919.1999999999999, "end": 925.4399999999999, "text": " and what we want to maximize we want to maximize the mutual information between not between the" }, { "start": 925.44, "end": 934, "text": " images themselves but p is going to be this output of the encoder so x goes into the encoder and the" }, { "start": 934, "end": 941.7600000000001, "text": " encoder outputs the style and the class label and the class label here so p is going to be the class" }, { "start": 941.7600000000001, "end": 949.36, "text": " distribution all right so this is going to be like a histogram or maybe the log it's it's already" }, { "start": 949.36, "end": 955.12, "text": " yes so it's going to be a histogram over classes from which we're going to sample the label c or" }, { "start": 955.12, "end": 964.96, "text": " l or whatnot y hat y but the p is the distribution over output classes so since we don't have a label" }, { "start": 964.96, "end": 972.48, "text": " we can't train the distribution like in a supervised way supervised way so what we'll have to say is we" }, { "start": 972.48, "end": 977.04, "text": " want to maximize the mutual information between the output distribution of the image and the" }, { "start": 977.04, "end": 983.4399999999999, "text": " output distribution of the augmented image now that entails the following two quantities" }, { "start": 983.4399999999999, "end": 991.04, "text": " there's the entropy of p and there's the conditional entropy of p given p augmented" }, { "start": 991.92, "end": 1001.12, "text": " now first of all it means we want to maximize this the entropy of p and that's supposed to be over" }, { "start": 1001.12, "end": 1009.04, "text": " the entire data set so this is the entropy over the entire data set x what it means is that we want" }, { "start": 1009.92, "end": 1020.16, "text": " different x's so if there's x1 x2 x3 and so on we want those to have different distributions in labels" }, { "start": 1020.16, "end": 1028.56, "text": " okay so if if the entropy is really high of the distribution p that means that different images" }, { "start": 1028.56, "end": 1035.36, "text": " get assigned to different classes some something like this all right if this is low then that would" }, { "start": 1035.36, "end": 1040.3999999999999, "text": " mean all the images basically get assigned to the same class and that's not good we want our" }, { "start": 1040.3999999999999, "end": 1046.8799999999999, "text": " classifier since we don't have labels it's a it's basically a cluster we want our cluster to sort of" }, { "start": 1046.8799999999999, "end": 1052.8, "text": " fill the space of possible clusters with the images so that's the first thing we want to" }, { "start": 1052.8, "end": 1058.08, "text": " maximize the mutual information we need to maximize this entropy and then second we want" }, { "start": 1058.08, "end": 1065.6, "text": " second since this is a minus here we need to minimize the conditional entropy of p given p" }, { "start": 1065.6, "end": 1074.72, "text": " augmented what does that mean that means if we know the augmented version of an image its class" }, { "start": 1074.72, "end": 1082.8799999999999, "text": " labeling should be the same as the un-augmented version so that means that if i now take one of" }, { "start": 1082.88, "end": 1090.72, "text": " these x's to x1 augmented of the do a plus augmented right then that shouldn't really" }, { "start": 1090.72, "end": 1098.3200000000002, "text": " change its class label and this is what these so that should sort of keep the class labeling" }, { "start": 1098.3200000000002, "end": 1105.0400000000002, "text": " this is horrible but the idea here is that it's kind of a reverse thinking from supervised learning" }, { "start": 1105.0400000000002, "end": 1112.48, "text": " in supervised learning we have the label like this is class this is class five okay this image is" }, { "start": 1112.48, "end": 1118.24, "text": " class five and our thinking is this augmentation techniques if i random crop an image or if i" }, { "start": 1118.24, "end": 1123.84, "text": " change its colorization a little bit the class is not going to change right an airplane with a" }, { "start": 1123.84, "end": 1130.88, "text": " in front of a blue sky is still an airplane in front of a bit bluer sky so i assume that it'll" }, { "start": 1130.88, "end": 1137.68, "text": " still have the same label here i don't have the label but what i can require is to say whatever" }, { "start": 1137.68, "end": 1144.72, "text": " you output for the image it should be the same for the augmented image so these two objectives" }, { "start": 1144.72, "end": 1150.88, "text": " are enough to give you sort of a rough clustering of the output space maximize the entropy minimize" }, { "start": 1150.88, "end": 1158.4, "text": " the conditional entropy between two versions of the same image okay that's how we train this" }, { "start": 1158.4, "end": 1165.6000000000001, "text": " pseudo labeling approach so now we have a we have a model that can give a label to each image very" }, { "start": 1165.6, "end": 1178.8, "text": " cool so how do we train the other parts now there are additional um additional losses here so" }, { "start": 1180.7199999999998, "end": 1189.36, "text": " i'm not sure yeah we'll go over it so this style part is also has to be trained right this encoder" }, { "start": 1189.36, "end": 1194.9599999999998, "text": " outputs a labeling we got that covered and it outputs a style part now the style part if you" }, { "start": 1194.96, "end": 1203.04, "text": " can see from the graphic it actually goes into let me erase some of that stuff here the style part" }, { "start": 1203.04, "end": 1210.8, "text": " actually is down here and it feeds into the generator and luckily they write detach here" }, { "start": 1210.8, "end": 1217.44, "text": " and since they don't write detach anywhere here that means that we do get gradient back propagation" }, { "start": 1217.44, "end": 1226.56, "text": " from the generator to the style code so that means our our encoder here is trained to help the" }, { "start": 1226.56, "end": 1234.8, "text": " generator with its task of fooling the discriminator okay but um first of all we're going to forget" }, { "start": 1234.8, "end": 1240.88, "text": " about that for now what we're going to do is simply look at a loss that they impose on the style" }, { "start": 1240.88, "end": 1246.48, "text": " they wouldn't they don't have to impose that loss but they have an additional loss on the style codes" }, { "start": 1246.48, "end": 1253.3600000000001, "text": " for the encoder in addition to the fact that there is gradient back propagating from g so the second" }, { "start": 1253.3600000000001, "end": 1261.52, "text": " loss we're going to look at is this style loss the style loss is almost the same so the style loss is" }, { "start": 1261.52, "end": 1269.52, "text": " a contrastive loss so what you want to do is if you have your data set you have your data set of" }, { "start": 1269.52, "end": 1275.6, "text": " images and you you know take images out and you train your network on and you train then take the" }, { "start": 1275.6, "end": 1282.24, "text": " next image or you take batches of image you take train and so on like this right and now you have" }, { "start": 1282.24, "end": 1288.24, "text": " this image what you want to do for this to work is you want to build up sort of a queue of images" }, { "start": 1288.24, "end": 1293.6799999999998, "text": " that you have already looked at like these images these are going and the queue can be let's say" }, { "start": 1293.6799999999998, "end": 1298.3999999999999, "text": " 10 long and you would always throw out the oldest and and in queue and newest so when you're done" }, { "start": 1298.3999999999999, "end": 1303.52, "text": " with this image right here you'll put it into the queue you load your next image and so on so now" }, { "start": 1303.52, "end": 1310.24, "text": " what does this mean you now always have a queue of other images and it's not important what they" }, { "start": 1310.24, "end": 1320, "text": " are as long as they are others right because now we're going to compare ourselves with others and" }, { "start": 1320, "end": 1326, "text": " this is this contrastive loss right here so this style loss is going to be a contrastive loss" }, { "start": 1326, "end": 1335.28, "text": " between this and this now the bottom part this here these are the others these are the other images" }, { "start": 1335.92, "end": 1344, "text": " and what are the individual quantities so s is the style code of the image you're considering" }, { "start": 1344, "end": 1351.36, "text": " right now s plus you could have already guessed it is the style code of the augmented image right" }, { "start": 1351.36, "end": 1361.76, "text": " so we had our image x let's go again with x1 x2 x3 are different images so we put x1 through the" }, { "start": 1361.76, "end": 1367.36, "text": " encoder that gives us s the style it also gives us the class label but now we care about this head" }, { "start": 1367.36, "end": 1377.1999999999998, "text": " that gives us the style code and we augment x1 to be x1 plus and we go we put that through the" }, { "start": 1377.2, "end": 1385.76, "text": " encoder that gives us s plus and now we also put all of these other images remember these are the" }, { "start": 1385.76, "end": 1390.72, "text": " images that we've looked at previously but the only real importance is that there are other images" }, { "start": 1390.72, "end": 1400.56, "text": " we put those through here and they get the s minus i in this case three and two so now what will" }, { "start": 1400.56, "end": 1408.6399999999999, "text": " require is that the s the style code of our image is closer to the style code of its augmented" }, { "start": 1408.6399999999999, "end": 1415.6, "text": " version so the same principle again we want we'll say that you know these augmentations they don't" }, { "start": 1415.6, "end": 1420.08, "text": " really change anything about the style now this argument is a bit more wonky but if you think of" }, { "start": 1420.08, "end": 1426.48, "text": " you know random crops and random flips don't really change anything about the fur color or so" }, { "start": 1426.48, "end": 1436.8, "text": " of a of a cat so we want those two to be closer together than s is to any of these other images" }, { "start": 1436.8, "end": 1442.4, "text": " okay so this is a contrast of loss where you pull together two things that you think should be close" }, { "start": 1442.4, "end": 1451.44, "text": " and you push apart things that you think should be far away from each other so this style loss" }, { "start": 1451.44, "end": 1458.4, "text": " basically guarantees that you have a distinct style for each image that is robust to the kind" }, { "start": 1458.4, "end": 1467.6000000000001, "text": " of transformations that you do under augmentation okay specifically this style loss doesn't care" }, { "start": 1467.6000000000001, "end": 1472.48, "text": " about the domain right this is for each image you don't know if these other images are from" }, { "start": 1472.48, "end": 1479.1200000000001, "text": " the same domain or from different domains and that's why the style is basically individual" }, { "start": 1479.12, "end": 1488, "text": " to the image but as we as we're going to see the style does capture something of the domain as well" }, { "start": 1488, "end": 1495.6, "text": " but this loss right here is supposed to be each image has a style right so this is the style code" }, { "start": 1495.6, "end": 1500.3999999999999, "text": " of x this n plus one way classification enables e to utilize not only the similarity of the" }, { "start": 1500.3999999999999, "end": 1505.9199999999998, "text": " positive pair but also the dissimilarity of the negative pairs where the negative style codes are" }, { "start": 1505.92, "end": 1513.04, "text": " stored into a queue using previously sampled images we observe that adding this objective" }, { "start": 1513.04, "end": 1518.16, "text": " significantly improves unsupervised classification accuracy in animal faces from this to that" }, { "start": 1518.16, "end": 1526.96, "text": " compared to the previous over clustering approach okay so we have two outputs now and now" }, { "start": 1528, "end": 1534.88, "text": " we go to the adversarial loss so the question is how do we train the generator and the discriminator" }, { "start": 1534.88, "end": 1541.92, "text": " and the discriminator so they have three different losses for the generator and the discriminator and" }, { "start": 1541.92, "end": 1549.0400000000002, "text": " the most important one of course is this adversarial loss right here so the discriminator simply tries" }, { "start": 1549.0400000000002, "end": 1558.8000000000002, "text": " to distinguish is an image real or fake conditioned on a class so in case of a real image and that's" }, { "start": 1558.8, "end": 1569.12, "text": " this line right here it tries to distinguish is this real or fake based on y and y is x fed to the" }, { "start": 1569.12, "end": 1574.72, "text": " encoder and the encoder gives you a label all right that's and the label selects the head of the" }, { "start": 1574.72, "end": 1582, "text": " discriminator at the same time that the discriminator is trying to distinguish real from fake so these" }, { "start": 1582, "end": 1587.52, "text": " two lines the generator is trying to fool the discriminator so the upper if you've never seen" }, { "start": 1587.52, "end": 1595.6, "text": " a GAN loss the upper part here that's the real data and the bottom part here is the fake data" }, { "start": 1596.4, "end": 1603.92, "text": " now at the same time the discriminator is trying to distinguish real from fake and the generator" }, { "start": 1603.92, "end": 1610.4, "text": " is trying to make the discrim fool the discriminator so both are of the generator and the discriminator" }, { "start": 1610.4, "end": 1617.2, "text": " are actually using that loss but the sign in front of it is different okay and since the generator" }, { "start": 1617.2, "end": 1622.8, "text": " is not involved in the top line you can usually leave that away because there is no backprop path" }, { "start": 1623.6000000000001, "end": 1630.56, "text": " through that and there is no backprop backprop path here because we detach the graph right here so" }, { "start": 1630.56, "end": 1637.8400000000001, "text": " there is no gradient signal going to the encoder so this bottom line what does it mean the generator" }, { "start": 1637.84, "end": 1648.1599999999999, "text": " will take in an image and the style now s tilde comes from x tilde it's x tilde going through the" }, { "start": 1648.1599999999999, "end": 1655.36, "text": " encoder giving you s tilde so this is the reference image right this is you want these this style" }, { "start": 1655.36, "end": 1662.24, "text": " right here this is the reference image and x is the source image so the generator is supposed to" }, { "start": 1662.24, "end": 1669.44, "text": " take the source image and basically apply the style from the reference image and generate" }, { "start": 1670.96, "end": 1681.2, "text": " x i don't even know how to call this x not tilde whatever x fake xf and that's supposed to fool" }, { "start": 1681.2, "end": 1690.4, "text": " the discriminator now the question is which discriminator right because you need a label for" }, { "start": 1690.4, "end": 1695.2, "text": " the discriminator the label is conditional with this discriminator is pretty easy because it's" }, { "start": 1695.2, "end": 1703.52, "text": " simply the label of this image now however as you can see the generator learns to translate x to the" }, { "start": 1703.52, "end": 1711.0400000000002, "text": " target domain while reflecting the style code s tilde so y tilde is going to be the label" }, { "start": 1711.04, "end": 1720.6399999999999, "text": " that comes out of this x so this encoder right here is also going to give us y tilde and that's" }, { "start": 1720.6399999999999, "end": 1731.44, "text": " going to go here all right so recap what we want to put into the discriminator is one time a real" }, { "start": 1731.44, "end": 1741.52, "text": " image like we do up up here and we get its label from the encoder the encoder gets us a label for" }, { "start": 1741.52, "end": 1748.96, "text": " each image very cool we'll also take the same image put it through the generator task the" }, { "start": 1748.96, "end": 1756.24, "text": " generator with transferring the style of another image from here onto it we get the style from the" }, { "start": 1756.24, "end": 1763.84, "text": " encoder and then the generator is supposed to make an image and we feed that to the discriminator" }, { "start": 1763.84, "end": 1770.88, "text": " and the discriminator discriminates assuming it comes from class y tilde now you see right here" }, { "start": 1770.88, "end": 1779.52, "text": " the generator never has access to y tilde okay so the generator is kind of at a disadvantage here" }, { "start": 1779.52, "end": 1786.48, "text": " the discriminator gets told what kind of image it is in terms of class while the generator" }, { "start": 1786.48, "end": 1791.44, "text": " because it needs to fool the discriminator it needs to come up with an image of that class" }, { "start": 1791.44, "end": 1799.36, "text": " but it has no idea of the class it only has the style code so it is forced to learn to sort of" }, { "start": 1800.4, "end": 1807.44, "text": " it is forced to learn to map a style to associate a style with a particular class and that's what" }, { "start": 1807.44, "end": 1812.48, "text": " with a particular class and that's how you get the domain into the style that's why the style can" }, { "start": 1812.48, "end": 1820.16, "text": " capture something like fur color of the different cat breeds because the generator is forced to take" }, { "start": 1820.16, "end": 1827.44, "text": " the style that the encoder gives and map it to an image of the class y tilde that it also the" }, { "start": 1827.44, "end": 1835.28, "text": " encoder gives but doesn't tell to the generator okay and in fact there is a more path because you" }, { "start": 1835.28, "end": 1842.24, "text": " now back propagate the loss to the encoder which means that the encoder will even help the generator" }, { "start": 1843.92, "end": 1851.84, "text": " it will help the generator make style codes that are very class specific now you can maybe think" }, { "start": 1851.84, "end": 1857.68, "text": " why why wouldn't you just have one output why doesn't the encoder simply output the label also" }, { "start": 1857.68, "end": 1864.08, "text": " as the style because that would be the easiest and the reason is because we have different losses" }, { "start": 1864.08, "end": 1866.8799999999999, "text": " on the style and the label" }, { "start": 1869.84, "end": 1875.28, "text": " okay otherwise that would be a valid tactic so that's cool that's the adversary loss that's the" }, { "start": 1875.28, "end": 1882.8, "text": " most important loss now there's also additional losses so they they do additional losses that" }, { "start": 1882.8, "end": 1888.8799999999999, "text": " they add on top for the generator they say in order to prevent degenerate situation where the" }, { "start": 1888.88, "end": 1895.5200000000002, "text": " generator ignores the style code and synthesizes a random image in the domain y or in the domain y" }, { "start": 1895.5200000000002, "end": 1900.24, "text": " tilde we impose a style contrastive loss to the generator so now there's still the danger that" }, { "start": 1900.24, "end": 1907.1200000000001, "text": " the degenerator simply produces a valid image right from the data set or even from the domain" }, { "start": 1907.1200000000001, "end": 1914.48, "text": " y tilde though i don't know how it would know why tilde or i've just not seen something" }, { "start": 1914.48, "end": 1918.88, "text": " i in my mind it doesn't get the y tilde" }, { "start": 1920.72, "end": 1927.6, "text": " but it could read it from the style but here the danger is to ignore the style i'm slightly" }, { "start": 1927.6, "end": 1932, "text": " i'm slightly confused by this part but maybe looking at the loss will will clear it out" }, { "start": 1932.8, "end": 1939.28, "text": " so they say we impose a style contrastive loss to the generator now this is almost the same" }, { "start": 1939.28, "end": 1946.8799999999999, "text": " is almost the same as we imposed on the encoder so the generator you can see there is a" }, { "start": 1946.8799999999999, "end": 1953.12, "text": " contrastive loss again where you want to be you want these things to be close and you want these" }, { "start": 1953.12, "end": 1960.96, "text": " things to be far apart so these s minuses these are going to be the ones from your the style codes" }, { "start": 1960.96, "end": 1969.04, "text": " of the images from your queue so these are just going to be other images here s tilde that's" }, { "start": 1969.04, "end": 1974.48, "text": " going to be the style that you get from your reference image so your reference image is going" }, { "start": 1974.48, "end": 1980.48, "text": " through the encoder and that's going to give you this right here now the question is what is s prime" }, { "start": 1981.2, "end": 1988.8, "text": " here because in the before we simply had s which was our source image our source image style" }, { "start": 1989.44, "end": 1997.28, "text": " now what is s prime here s prime is going to be it gets more complicated yes s prime is going to be" }, { "start": 1997.28, "end": 2009.68, "text": " whoops it's going to be the round trip to the encoder so it's going to be if i generate my image" }, { "start": 2009.68, "end": 2020, "text": " from the source image x and the style s tilde of the reference and then i ask my generate my" }, { "start": 2020, "end": 2028.48, "text": " encoder again what style does this have i get the s prime so it's kind of a round trip right so i" }, { "start": 2029.28, "end": 2039.36, "text": " i take i take this i ask the encoder what style is it that's s tilde right then i take s tilde" }, { "start": 2039.36, "end": 2048.72, "text": " go to the generator together with a source image x and that gives me like x fake and then i ask my" }, { "start": 2048.72, "end": 2056.16, "text": " generator again what style would you assign to the fake image i just produced and then the encoder" }, { "start": 2056.16, "end": 2066.72, "text": " will tell you i'll give it s fake or s prime in this case and then i compare that s prime with" }, { "start": 2066.72, "end": 2073.12, "text": " the one i gave before okay so it's sort of a round trip loss of my reference image" }, { "start": 2073.12, "end": 2081.2799999999997, "text": " all right so what does that do if i now and then i ask that s prime be close to s tilde so that" }, { "start": 2081.2799999999997, "end": 2088.16, "text": " means if i generate an image with the style of my reference image the upcoming image should better" }, { "start": 2088.16, "end": 2094.24, "text": " have the style of the reference image that's all it says so the style of the thing i generate" }, { "start": 2095.04, "end": 2102.7999999999997, "text": " given this style they should better be close and especially closer together than the style of the" }, { "start": 2102.8, "end": 2109.84, "text": " style with any other image in my queue it makes sense but it's kind of convoluted so you go with" }, { "start": 2109.84, "end": 2117.76, "text": " your out it's kind of a reconstruction loss except in style space all right and then the last thing" }, { "start": 2117.76, "end": 2126.4, "text": " is an actual image reconstruction loss so what you'll do is your generator will produce x" }, { "start": 2126.4, "end": 2132.96, "text": " uh sorry will produce an image from the source image and its own style right here that's important" }, { "start": 2133.76, "end": 2143.12, "text": " before we input s tilde here so this now is we input the source image and its own style so we" }, { "start": 2143.12, "end": 2152.56, "text": " go with x we go to the e and we put the style here and we tell the generator if i input the" }, { "start": 2152.56, "end": 2159.36, "text": " input the source image and its own style then what you give me back better be the source image itself" }, { "start": 2159.36, "end": 2168.16, "text": " right this is a consistency loss that tells the generator that basically it learns now the generator" }, { "start": 2168.16, "end": 2177.92, "text": " learns to the generator learns to map to recognize an image with its own style sort of because it" }, { "start": 2177.92, "end": 2185.6800000000003, "text": " doesn't know right it doesn't know that what's coming in here is the style of um it of the image" }, { "start": 2185.6800000000003, "end": 2195.36, "text": " x but now you teach it and i think before this loss you'd have a good chance that uh the styles" }, { "start": 2195.36, "end": 2199.76, "text": " would just be all over the place they would sort of be consistent but they will not be aligned" }, { "start": 2199.76, "end": 2206.32, "text": " and with this you force that the style of an image itself if you gent if you put that into" }, { "start": 2206.32, "end": 2216, "text": " the generator it will lead to that image itself okay that's it so this is a this is extremely" }, { "start": 2216, "end": 2222.2400000000002, "text": " convoluted right the discriminator is the easiest the discriminator is a class conditional discriminator" }, { "start": 2222.2400000000002, "end": 2229.84, "text": " that gets the label from some mechanism that decides on a label right okay that's the easiest" }, { "start": 2229.84, "end": 2237.84, "text": " the encoder has two parts the pseudo label which is over here which is trained completely unsupervised" }, { "start": 2237.84, "end": 2246.56, "text": " detached from everything else in a self clustering approach while the style part here is trained" }, { "start": 2246.56, "end": 2254.88, "text": " first of all in a contrastive way which makes sense and also in a back propagated way from the" }, { "start": 2254.88, "end": 2262.56, "text": " generator so the style generation mechanism tries to help the generator okay and that means it's" }, { "start": 2262.56, "end": 2267.36, "text": " going to leak some information about the label into the style because that helps the generator" }, { "start": 2267.36, "end": 2273.52, "text": " generator needs to if the generator knows what sort of class it's going to produce it's going to be" }, { "start": 2273.52, "end": 2279.28, "text": " better okay so you can count on that information being in there but also also because of all the" }, { "start": 2279.28, "end": 2285.0400000000004, "text": " other losses that the generator has and the contrastive loss on the style the style code is" }, { "start": 2285.0400000000004, "end": 2293.6800000000003, "text": " going to sort of describe the individual style of an image and but is also going to describe what" }, { "start": 2293.6800000000003, "end": 2299.6000000000004, "text": " the style of that class is because it technically needs to contain information about the class" }, { "start": 2300.88, "end": 2308.0800000000004, "text": " and that's why i think this works with the style because there is no inherent notion of like" }, { "start": 2308.08, "end": 2312.88, "text": " this is the pose of a cat or something like this" }, { "start": 2314.16, "end": 2320.64, "text": " yeah it still seems like a bit magic to me and then the generator is first of all trained to" }, { "start": 2320.64, "end": 2327.2, "text": " fool the discriminator given a source image and a style and you can fool the discriminator" }, { "start": 2327.2, "end": 2336.4, "text": " by producing an image that's so good it looks real and specifically it looks real in the class" }, { "start": 2336.4, "end": 2342.32, "text": " that the pseudo label has given right so in the class that the encoder has given to it so the" }, { "start": 2342.32, "end": 2350.8, "text": " generator must somehow come up with an image that's of that class and so it will it will be forced" }, { "start": 2350.8, "end": 2357.6800000000003, "text": " to interpret the style code in terms of that class label which makes the style code the style code" }, { "start": 2358.08, "end": 2365.6, "text": " and also we have these two additional losses which is the round trip loss to the style space" }, { "start": 2365.6, "end": 2373.68, "text": " so whatever the generator outputs you should be able to recover the style from it by putting it" }, { "start": 2373.68, "end": 2379.6, "text": " through the encoder again and then lastly there is a consistency loss where you say if i put an" }, { "start": 2379.6, "end": 2387.2799999999997, "text": " image into a source image and i input its own style again going through the encoder you should" }, { "start": 2387.2799999999997, "end": 2395.44, "text": " give me back the source image itself very complex and all of the generator loss is back propagated" }, { "start": 2395.44, "end": 2402.8, "text": " through to the encoder so this is the full loss as i said discriminator easy adversarial loss" }, { "start": 2402.8, "end": 2411.04, "text": " generator adversarial loss plus this style round trip consistency plus the own image round trip" }, { "start": 2411.04, "end": 2420.96, "text": " consistency encoder gets all of the generator loss all of it so all of this goes here so the" }, { "start": 2420.96, "end": 2428.56, "text": " encoder fully helps the generator and it is also trained with this mutual information and the" }, { "start": 2428.56, "end": 2436.16, "text": " style contrastive loss wow that's some losses wow that that's a lot of damage" }, { "start": 2438.2400000000002, "end": 2443.36, "text": " so they do different investigations into their model here and i don't even know if we've" }, { "start": 2443.36, "end": 2448.8, "text": " missed some of the pictures but ultimately what you can now do is you can do image to image" }, { "start": 2448.8, "end": 2455.04, "text": " translation either that's the cool thing you can have a reference image for one or what you can do" }, { "start": 2455.04, "end": 2463.52, "text": " is you can ask your discriminator what kind of domains are there sorry you can ask your" }, { "start": 2463.52, "end": 2469.36, "text": " encoder what kind of domains are there you've guessed the number of domains so it's maybe 10" }, { "start": 2469.36, "end": 2478.2400000000002, "text": " or in this case it's uh eight eight eight domains of cats and you can simply divide your data set" }, { "start": 2478.24, "end": 2484.7999999999997, "text": " into these eight domains right one two three four five and so on oh this is 10 okay i can't see" }, { "start": 2484.7999999999997, "end": 2491.68, "text": " anymore so 10 domains and then you can simply calculate for each image you calculate the style" }, { "start": 2491.68, "end": 2500.72, "text": " vector so the style the style and then you simply take the average one over the number in that in" }, { "start": 2500.72, "end": 2507.4399999999996, "text": " that domain you take the average style vector and that's going to be your target style so you can do" }, { "start": 2507.44, "end": 2511.68, "text": " image to image translation with a reference image or you can do image to image translation" }, { "start": 2512.2400000000002, "end": 2518.56, "text": " for an entire group of images for example all the images in a given domain and that's how they do" }, { "start": 2518.56, "end": 2525.04, "text": " these graphs right here now just quickly wait until my tablet decides to show me the paper again" }, { "start": 2525.04, "end": 2532.16, "text": " thank you all right they do a bunch of investigations into their wholly unholy mixture" }, { "start": 2532.16, "end": 2540.16, "text": " of losses especially the first concern is couldn't we just train the guiding network" }, { "start": 2541.04, "end": 2547.44, "text": " like by its own on its own and then after that train this gan thing right that's what we had" }, { "start": 2547.44, "end": 2552.96, "text": " at the very beginning we said there's this guiding network and it does the clustering and all" }, { "start": 2552.96, "end": 2559.44, "text": " and couldn't we just train this gan architecture on top of the frozen guiding network and their" }, { "start": 2559.44, "end": 2566.08, "text": " conclusion is no if we train everything together it works better so on the left you have whenever" }, { "start": 2566.08, "end": 2573.92, "text": " you train the guiding network by itself and what you're seeing here is the t-sne visualization" }, { "start": 2573.92, "end": 2581.92, "text": " t-sne is a a down like a non-linear visualization tool of style codes extracted by our guiding" }, { "start": 2581.92, "end": 2588.88, "text": " network the ground truth domains of all test images is represented in different colors so" }, { "start": 2588.88, "end": 2594.1600000000003, "text": " this is a data set that has labels but you don't you don't provide the labels to this algorithm" }, { "start": 2594.1600000000003, "end": 2599.52, "text": " the algorithm is completely unlabeled but for purposes of investigating we'll visualize the" }, { "start": 2599.52, "end": 2606.4, "text": " labels with colors and what you'll see here are the t-sne visualizations of the style codes so" }, { "start": 2606.4, "end": 2613.6800000000003, "text": " things that are close together they have similar style codes and the ideal case would be if things" }, { "start": 2613.68, "end": 2621.7599999999998, "text": " that are close together here have the same label and that means the style is sort of representative" }, { "start": 2621.7599999999998, "end": 2628.96, "text": " of the domain okay that's what we want we want the style to capture the domain of an image" }, { "start": 2628.96, "end": 2636.16, "text": " and ideally not the image itself too much now on the left you see that there is quite a bit of" }, { "start": 2636.16, "end": 2642.56, "text": " overlap between these quite a bit of wash between the style and the group and on the right if you" }, { "start": 2642.56, "end": 2649.92, "text": " jointly train the gan together with the guiding network you see that these classes of the style" }, { "start": 2649.92, "end": 2656.4, "text": " codes which have no reason to cluster are much more clustered and separated and they are separated" }, { "start": 2656.4, "end": 2665.44, "text": " much more along the lines of the ground truth classes okay so that's pretty cool now i would" }, { "start": 2665.44, "end": 2670, "text": " actually be interested in what happens if you do the separate training with the full pipeline of" }, { "start": 2670, "end": 2674.72, "text": " this learning to classify images without labels thing and their nearest neighbor thing because" }, { "start": 2674.72, "end": 2681.2, "text": " they've also shown that just purely this self-clustering doesn't work too well but if" }, { "start": 2681.2, "end": 2687.52, "text": " you then do the nearest neighbor thing on top then that improves the classification significantly" }, { "start": 2687.52, "end": 2693.68, "text": " so this could potentially help either the separate or the joint training right here" }, { "start": 2693.68, "end": 2699.8399999999997, "text": " and there might be a connection between the joint training and whatever they're doing in any case" }, { "start": 2699.8399999999997, "end": 2706.56, "text": " they also show that then these fid which is a quality metric for gans lower is better that the" }, { "start": 2706.56, "end": 2714.64, "text": " joint training goes way lower in the fid than the separate training okay that's that's the reason" }, { "start": 2714.64, "end": 2720.08, "text": " why they built this convoluted thing because it works way better and here they ablate they ablate" }, { "start": 2720.08, "end": 2724.56, "text": " some of the losses to investigate what's really going on and in this case" }, { "start": 2726.72, "end": 2731.52, "text": " t-sne visualization of the style space of our guiding network trained on this since this does" }, { "start": 2731.52, "end": 2736.56, "text": " not have ground truth domain labels each data point is colored with the guiding network's prediction" }, { "start": 2738.64, "end": 2746.08, "text": " so each color is whatever the guiding network says the classes and the dot is one style each" }, { "start": 2746.08, "end": 2752.48, "text": " is one style each dot is one style vector and they're projected down to two dimensions you can" }, { "start": 2753.2, "end": 2760.72, "text": " see pretty clearly that the individual classes the individual clusters of style vectors correspond" }, { "start": 2760.72, "end": 2767.92, "text": " to different labels of the guiding network which is to be expected but also since they overestimate" }, { "start": 2767.92, "end": 2776.4, "text": " the number of classes in this case you can see that the even though the class label is different" }, { "start": 2776.4, "end": 2782.56, "text": " the style network will group the very similar classes together you can see here these are both" }, { "start": 2782.56, "end": 2789.44, "text": " cheetahs and here are both lions so it'll group them together which is pretty cool and sort of" }, { "start": 2789.44, "end": 2795.76, "text": " verifies that it recognizes these these different things because you force the guiding network to" }, { "start": 2795.76, "end": 2801.2000000000003, "text": " make 10 classes but the style network is simply continuous so it's cool to see that the style" }, { "start": 2801.2000000000003, "end": 2808.32, "text": " network will make one cluster with styles even though it's different labels and here you can" }, { "start": 2808.32, "end": 2813.1200000000003, "text": " see different samples from these domains just to verify that the guiding network has actually" }, { "start": 2813.1200000000003, "end": 2821.2000000000003, "text": " learned to separate things i still find this pretty pretty magical too this is completely" }, { "start": 2821.2, "end": 2828.7999999999997, "text": " unsupervised and it sort of finds these clusters by itself all right they have a bunch of images" }, { "start": 2828.7999999999997, "end": 2834.8799999999997, "text": " here as i said this is no longer with one reference images image this is where you take the entire" }, { "start": 2834.8799999999997, "end": 2839.3599999999997, "text": " domain so you self-label with your guiding network and then you take the mean vector" }, { "start": 2840.16, "end": 2845.4399999999996, "text": " and that's going to be your target style vector and these are the source images that you transfer" }, { "start": 2845.4399999999996, "end": 2850.48, "text": " and you can see that you know it works pretty well so they always have like one adult animal" }, { "start": 2850.48, "end": 2859.12, "text": " and one child animal and i guess not or just two different ones here this is particularly cute" }, { "start": 2859.12, "end": 2867.84, "text": " though i have to show you this fox right here what's going on with that fox like someone help that" }, { "start": 2867.84, "end": 2876.96, "text": " fox yeah um so we're not at perfection yet as you can see but it's you know that that looks like a" }, { "start": 2876.96, "end": 2886.88, "text": " pretty pretty cool fox maybe okay where did it go maybe it slipped maybe it's an it's an offshoot" }, { "start": 2886.88, "end": 2895.04, "text": " of this one on the top left yeah who knows these data sets they have their way and um so this is" }, { "start": 2895.04, "end": 2901.6, "text": " sort of where you can see the limitations right here um that's not how a baby snow leopard looks" }, { "start": 2901.6, "end": 2908.96, "text": " you see the limitations here in that all of these animal faces they are still pretty aligned like" }, { "start": 2908.96, "end": 2916, "text": " they're fairly frontal not exactly but they're fairly frontal pictures um they're fairly" }, { "start": 2916, "end": 2922.56, "text": " standardized and so on so we're i don't think we're yet at the level where we can just do" }, { "start": 2923.2, "end": 2930.4, "text": " you know um fully image to image and you see it especially with faces because we as us humans" }, { "start": 2930.4, "end": 2935.92, "text": " as us humans are extremely good at you know seeing when there's something wrong with a face" }, { "start": 2936.7200000000003, "end": 2943.44, "text": " but it's still it's still pretty impressive what's possible and i think if the past is of any" }, { "start": 2943.44, "end": 2951.04, "text": " indication here is summer to winter that actually looks good if the past is of any indication then" }, { "start": 2951.84, "end": 2958.8, "text": " this technology will be pushed pretty hard and soon we'll be able to do this with a simple smartphone" }, { "start": 2958.8, "end": 2965.04, "text": " app or something like this so i invite you to check out the paper right here they have lots" }, { "start": 2965.04, "end": 2972.1600000000003, "text": " and lots and lots of examples and t-sneak plots and whatnot in their appendix they have the code" }, { "start": 2972.16, "end": 2989.44, "text": " online as far as i as i have seen and with that let me know what you think in the comments bye bye" } ]
DLq1DUcMh1Q
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
A bio-inspired bistable recurrent cell allows for long-lasting memory (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "gru", "lstm", "schmidhuber", "bistable", "bistability", "neurons", "biological", "spiking", "tanh", "stable", "attractor", "fixed points", "memory", "memorize", "sparse", "long sequence", "history", "storage", "remember", "rnn", "recurrent neural network", "gated recurrent unit", "forget", "backpropagation", "biologically inspired" ]
Even though LSTMs and GRUs solve the vanishing and exploding gradient problems, they have trouble learning to remember things over very long time spans. Inspired from bistability, a property of biological neurons, this paper constructs a recurrent cell with an inherent memory property, with only minimal modification to existing architectures. OUTLINE: 0:00 - Intro & Overview 1:10 - Recurrent Neural Networks 6:00 - Gated Recurrent Unit 14:40 - Neuronal Bistability 22:50 - Bistable Recurrent Cell 31:00 - Neuromodulation 32:50 - Copy First Benchmark 37:35 - Denoising Benchmark 48:00 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.05252 Code: https://github.com/nvecoven/BRC Abstract: Recurrent neural networks (RNNs) provide state-of-the-art performances in a wide variety of tasks that require memory. These performances can often be achieved thanks to gated recurrent cells such as gated recurrent units (GRU) and long short-term memory (LSTM). Standard gated cells share a layer internal state to store information at the network level, and long term memory is shaped by network-wide recurrent connection weights. Biological neurons on the other hand are capable of holding information at the cellular level for an arbitrary long amount of time through a process called bistability. Through bistability, cells can stabilize to different stable states depending on their own past state and inputs, which permits the durable storing of past information in neuron state. In this work, we take inspiration from biological neuron bistability to embed RNNs with long-lasting memory at the cellular level. This leads to the introduction of a new bistable biologically-inspired recurrent cell that is shown to strongly improves RNN performance on time-series which require very long memory, despite using only cellular connections (all recurrent connections are from neurons to themselves, i.e. a neuron state is not influenced by the state of other neurons). Furthermore, equipping this cell with recurrent neuromodulation permits to link them to standard GRU cells, taking a step towards the biological plausibility of GRU. Authors: Nicolas Vecoven, Damien Ernst, Guillaume Drion Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at a bio-inspired bistable recurrent cell, allows for long-lasting memory by Nicolas Vécovin, Damien Ernst and Gion Drion of the University of Liège. This paper here is not a paper that wants to push state-of-the-art on anything, it is a paper that takes a concept from the biological research on actual neurons, which is the bistability property and tries to introduce it to recurrent neural networks. And on toy data or small data they show that this has the interesting property that these recurrent neural networks can then remember important things for much much longer than our current recurrent architectures can do. I believe this is a very interesting paper and it's a nice refresher from the whole state-of-the-art number pushing papers. So dive in with me to explore this. If you like content like this also consider subscribing if you aren't and sharing it out and leaving a like and a comment if you have any sort of comments. They basically say recurrent neural networks provide state-of-the-art performance in a wide variety of tasks that will 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 call 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 the input, they're always the same. So 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 goes for the functions here that transform one hidden state into the next hidden state. Of course 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 the signal is going to explode and if it's lower than one the signal is going to fade over time and there's pretty much nothing you can do. So classic RNNs have looked like this right here. So the next hidden state is a nonlinear function G and G can be some non-linearity like a sigmoid or a hyperbolic tangent but it's a function of the current input and the last hidden state by simply matrix multiplying these two things by some weight matrices and then adding them up. So that's what we've just looked at. Now this is problematic as I said because of the vanishing or exploding gradients and therefore people have come up with methods to solve this and you might know things like LSTMs and GRUs that are used to solve this. Now these cells here are much more complicated than the standard cell that we saw here but they also are much more effective because they don't have this vanishing or exploding gradient problems. Their promise is that they can remember things for longer because they allow the gradient to flow without these problems during backpropagation. 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. Let's do that. Let's say we have the last hidden state here and we have Xt here. So first we're going to calculate the Zt and the Rt from that. Now every one of these arrows right here is a multiplication by a weight matrix. So every one of these arrows is transforming the input and let's also let's join this into a sigmoid node and that gives you Zt and let's join these into a sigmoid that gives you Rt. Okay so far so good. Now we need to combine all of this in this last line right here. So you can see that the Z thing here sort of acts as a switch. So Z is the result of a sigmoid and therefore it's between 0 and 1 and here this is the Hadamard product. This is the element-wise product between vectors which sort of means this is like a gating. This is like a switch. If it's 1 it selects this quantity and if it's 0 it selects the quantity over here and of course it can be between 0 and 1 but those are the ends of the spectrum. So Z is a switch that selects between the last hidden state. So let's draw that right here. So the last hidden state goes here and is one of the options of the output. And the option is given by Z. So Zt let's draw a switch like this maybe. So Zt is responsible for modulating this switch right here. Okay this gives you the next hidden state. You see Zt modulates that switch so Ht is the one possibility that the switch can select. What's the other possibility? The other possibility is this quantity right here which is a hyperbolic tangent of whatever that is. So that is combined of X. So let's go from the back right here. Tanh. What's the input to the tanh? It's two things. First of all the X is an input to the tanh so we can draw directly a line from here. The X modulated. Every arrow as you might remember can be a function. Not all arrows are functions like this arrow right here is not a function it's just an arrow. Maybe that's confusing. You get what I mean. And the next thing is R times the hidden the last hidden state or the last hidden state modulated by this matrix. So R is acting as another gate. R can be again between 0 and 1 because it's the result of a sigmoid. So this hidden state will also go here. It will be modulated running out of colors here. It will be modulated by R here as a sort of gate. So R can either close or open this gate right here and then that's fed into the tanh. So it's a 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. 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. Because remember the task of the network sometimes is to remember things from the sequence. I think we drew this over here. So if this is an email and we want to detect whether it's spam then this word in the sequence right here might be really important because it would say something like gold, like buy gold. These two things might be buy gold and you need to remember that in the hidden state because the only way that information from X is going to flow to Y is through the hidden states. So you would want at this point you would want to remember this input in the hidden state so you would actually want to update the hidden state. And then this here might be not as important so you might want to say I don't want to I don't want to I still want my hidden state to be the old hidden state. So Z is that gate that allows us to do this. If we decide to update the hidden state then what do we do? Again if we decide to update the hidden state we can we can we will incorporate the new input but we will we can also decide to mix that how to mix that new input with the old hidden state. 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 be sort of still there to be remembered but it's a longer path and it needs to go through this thing here and through this thing here. So this thing here decides which of the old hidden state pass through. So at each you can see right here this is an element-wise product this R is going to be between 0 and 1 at each point in the vector. So at each point in the vector the R decides is this worth remembering or not? And if it's not worth remembering then this is going to be 0 and that that position of the old hidden state is going to be 0 and then that's going to be forgotten and that's the opportunity for the hidden state to incorporate new information because then it can delete this old information and then it can incorporate the new input and that will result then on this path on the new hidden state. So there's two major things. First we can decide whether or not to even incorporate new information that's achieved by the Z gate and then we can decide which parts of the old hidden state if we want to update it which parts to forget that's the R gate and how to update it is then basically a result of the weight matrix that's associated with this function right here. Alright so that's the gated recurrent unit and it works a lot better than the classic RNNs. So having said that they now turn to this property of neuronal 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. This can be weighted and whatnot but in this case it's just a function of the inputs and that gives you your input signal. So this is like this is 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 connection this back connection right here and that means that the signal that comes out at time step t is going to be fed back into the signal and actually added to the signal before itself and sort of self modulating right the signal comes out is sent back is added to this input and then sent through again and this here is just an integrator that's integrating everything that's happening. So if you if you look a bit closer you'll see that there is a minus here so it's actually not added it's subtracted and there is an F here which means that this is a nonlinear function. Now if this weren't a nonlinear function we can just sort of try or let's say this is a monotonic function we can sort of try to estimate what happens. If all of this right here is very high it's a high number big number this will be a big number then this sum will be a big number this output will be a big number what happens is this here will be a big number this is monotonic so it will also be a big number and that means it will subtract that big number so that means when whenever the neuron is going to to be very excited this feedback would actually push it back now when it is not very excited so when it's a very low number very negatively excited then the feedback would work in the exact opposite direction this will be very negative this will be very negative and this here would push it towards the positive so this neuron somehow self stabilizes over time to this to the zero point right here and that's simply if this F is 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 tan H of V post or is this the entire F yes that's this this thing right here if this is the case if this is that this if this is the signal minus the tan H then something very very very interesting happens and that that's depending on this alpha right here in that if this alpha is between if the alpha is between 0 and 1 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 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 just the parameter alpha to be 1.5 a very different thing happens that you can see right here then it turns out if your output signal is very is very high the same thing happens is going to 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 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 it's 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 then provide some huge input signal right here you could potentially throw this over to the other side over this hill and then it would stabilize at this point so this is sort of a way to remember things within these biological cells pretty cool now this here is a non filled out circle that means it's an unstable point it's technically stable in the sense that if you're exactly at zero you will remain at zero but if you perturb even a little bit you will go if you perturb a bit you will go away from it okay I hope this sort of property is right is clear and why this is so fascinating because we can use this these this fact that the stable points are not at zero and are more than just one stable point for remembering things and they're now trying to fill this into the gated recurrent unit so they call this the bi-stable recurrent cell BRC and the formulas are these right here maybe a little smaller come on can't zoom anymore okay it looks almost the same as the GRU so the formulas are these this and this so let's analyze the differences to the GRU the first most striking difference is that a lot of weight matrices here have become single numbers so 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 and neuron can only feed back onto itself if there is a layer of neurons right here they can only each feed back onto themselves whereas in a recurrent neural network my hidden vector my hidden state is a vector and if I transform this into the next hidden state or any quantity let's say I transform this H into this R right here and this R is a vector too then any interaction is possible so any cell any entry in the vector here can influence any other vector because there's a big weight matrix in the middle they want to leave this away they want to model this as close as possible to actual layers of neurons and therefore they say okay the input X can you know be distributed to all the neurons because technically the input comes from some other neurons down here and they can all have connections to these neurons but these feedbacks we only really observe them in individual neuron this feedback cycle so that's why they model these recurrent weight products by just element wise products with vectors and then the second difference you again see that there is this switch right here this C switch and the C switch is like before it's a sigmoid with where combine the the output and the previous hidden state there's nothing new here so this switch is the same the cell has the possibility of letting in new information or just ignoring the new current information the XT the second thing is here and this is the same as well right the tanh this is a combination of the new information it's in case we want to let in the new information of the new information and you need to decide what things of the old information to forget or remember now the difference here is in this a so this a used to be again this sigmoid of the combination and now it's just slightly different it used to be sigmoid now it's one plus tanh this is a very very slight modification it's tanh because tanh is between minus one and one instead of zero and one like the sigmoid and the one plus makes it such that this is between zero and two and we've seen before that this critical behavior there 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 bi-stability okay so depending on what the a is if the a is zero to one it's a classic cell and if the a is one to two it's a bi-stable cell and the network can decide by itself what it wants to do because here it has it can actually learn how to do that 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 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 this recurrent cell this by modal 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 parameter aren't learned they're just fixed and you see what happens now as you can see the the blue should be a classic the classic behavior so in this blue case what happens you see right here this C is moderately low so we saw the C is the switch of whether to leave in old information or take up new information if it's low it means we want to take up new information this is reasonably low and that's why when the signal goes up here the blue line goes up as well and when the signal goes down the blue line goes down again and so on so the blue line pretty straightforwardly follows the signal right here okay now in contrast to this the red line is over this threshold so a is fixed at 1.5 C is still at 0.2 so again when this line goes up then this line goes up but because this is near a this stable point if it goes down again it doesn't appear to go down enough it sort of remembers that state it was in it doesn't go down with the signal only now that it goes down even further it's over this threshold so we were in this situation now and the first bump down was only like to here and that pushed it up again but now it jumps over here because the signal is even lower and then the cell sort of switches to another state as you can see here it goes down but then this bump here is not enough to bring it up again so it kind of remains in this 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 a neuromodulation 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 lo and behold we're now back to having weight matrices right here so this this is sort of they say this is a not really a super biologically plausible way of implementing 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 1 plus tan 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 gradient descent iterations and you can see that when these time steps when the series are pretty small the LSTM or the GRUs tend to perform well but you can see that these BRCs they 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 they start to fail because they are not made explicitly to remember for that long they don't have this by stability property whereas now these things excel you can see they're still pretty low and at 600 steps these things completely fail they completely forget the input so and the NBRC at least is still able to remember the first thing pretty pretty well and yeah so the second one is no this is the first experiment still the copy input benchmark you can see right here that even at this three at this 100 thing where the GRU still learns it it learns it much much later than the BRC which learns it pretty fast only here when the when it's only five when 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 these NBRC then with time will be as proficient at handling them and they will probably become on par or even outperform the LSTMs or GRUs on every day like on all the tasks and then be especially good on tasks where you have to remember things but for now they're outperformed by LSTMs and GRUs okay so the second thing is a more interesting experiment the denoising benchmark where they say the the copy input benchmark is interesting as a means to highlight the memorization capacity of the recurrent neural network but it does not tackle its ability to successfully exploit complex relationships between different elements of the input signal to predict the output so 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 in 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 five eight two nine actually these are numbers sampled from a uniform Gaussian or so so they're not actually five eight two and nine but you can imagine it like this five eight two nine three four zero two and so on and in the second dimension you have a negative one I believe almost anywhere and then at some points you have a one negative one again and then you have a one and a negative one again and at the last point of the sequence you'll have a zero and so the zero is simply a marker that it's the end of the sequence what the network needs to do is it needs to output all the elements so the output of the network should be in this case should be nine four so all the elements where there was a one in order okay so it remember what it needs to learn it needs to learn to every time it sees a one in the second dimension it needs to take the first dimension put it somehow into the hidden state and then carry that hidden state forward and sees a one again it needs to take the second thing also put it into the hidden state but not override the first thing it put into the hidden state like if it were to just realize I need to put this into the hidden state then it would almost surely override the previous information so it needs to be able to say I've already kind of in my H is going to be a vector of a hundred 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 GRU's and LSTMs are able to do it but as we'll see they're not as much the results are in this table where you can clearly see that whenever the n so the n the n is a parameter that is how far how far in this direction are these ones so when n is 0 the ones can be anywhere but when n here is like 5 that means that the last five ones surely don't contain a one that means only the first whatever a L minus L minus 5 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 GRU'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 GRU's and the LSTMs fail while the BRC'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 end here or just introduced this 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 actually good can incorporate this information can reason about what they need to remember and whatnot and in the end they also have this sequential MNIST where they just feed an MNIST digit digit by digit and at the end I think that the output of the neural network needs to be the class of the of the MNIST digit and again here they have a parameter called N black which means that so they have an MNIST digit it's like a three they unroll it to a single vector right they feed this one by one into the recurrent network and then after that they attach a certain number of just empty pixels black 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 MNIST 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 GRUs and the LSTMs they can't learn they can't learn to ignore these things because the learning signal is just too far away right here but these things they can because they can exploit this by stability property and remember things again I wonder how this came to be it seems pretty funny but the last thing they do is they investigate what happens in their cells and this I feel is the most interesting part and they do this on this denoising benchmark so the task we've looked at before where you need to remember five randomly selected numbers that are indicated by the second dimension here they show a sequence where the five numbers occur at 3100 246 at 300 and at 376 so these are the five positions where the sequence indicates that the network should remember the thing in the first dimension and then output they analyze two things they analyze the proportion of bi-stable neurons so basically they analyze these out these a quantities and they analyze how many of the neurons in the layer have an a that's higher than one which means that they are in this bi-stable mode and also they analyze what's the average value of C so see 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 colors 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 but then as soon as one of these inputs appear the C drops which basically means that the network realizes it now must let in the new information and then it immediately shoots back up makes it seem like so the network says okay as long as so all of these inputs here they have the negative one in the second dimension right so it recognizes it says there's no reason for me to incorporate that information it's not important and as soon as the second input comes it immediately shoots down again now you can see this here is the last layer of the network the highest layer so sort of the highest abstractive information and you can see that from input to input this value of C gets higher and higher and these spikes as they go down but they go down to a higher and higher point which you know is is the fact that it recognizes it needs to let in new information but it lets in less and less new information the more things it needs to remember so not only does it recognize wait I need to remember this it also recognizes but I probably shouldn't shouldn't you know completely forget what I had previously because I it is important for me to remember these previous things so that's a pretty cool demonstration the fact that these go down at the input and the fact that generally they go up every time after a new input is incorporated into the hidden state this basically this shows that the or this is a pretty good indication that what they're saying is really happening right okay the second thing shows almost the same it shows how many of these neurons are actually in their bi-stable mode and you can also see right here that especially in the last layer you can see that the number of neurons in the bi-stable mode goes up and up and up and up after each of these steps and these spikes here correspond to always the points where they have to let in new information okay cool so I find that I find this to be pretty cool and I find this last experiment to be the coolest where they can actually show look here there's a pretty good indication that the thing we we build does what we say it does they also actually have a proof here of the bi-stability when this a is higher than one I won't go through this right here but if you want you can look at that I'm excited to see what happens with these kinds of architectures in the future because it seems to be a pretty minor modification and maybe with a little bit of more modification or if we sort of just tune this a little bit and kind of figure out what we have to do to make these things actually compete with the classic GRUs and LSTMs in regimes where a long memory isn't necessary I feel this could be a you know kind of a standard building block in the recurrent neural network toolkit even though it's been sort of outperformed by transformers in previous years 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, "end": 5.2, "text": " Hi there, today we're looking at a bio-inspired bistable recurrent cell," }, { "start": 5.2, "end": 10.52, "text": " allows for long-lasting memory by Nicolas Vécovin, Damien Ernst and" }, { "start": 10.52, "end": 16.52, "text": " Gion Drion of the University of Liège. This paper here is not a paper that wants" }, { "start": 16.52, "end": 21.68, "text": " to push state-of-the-art on anything, it is a paper that takes a concept from the" }, { "start": 21.68, "end": 27.68, "text": " biological research on actual neurons, which is the bistability property and" }, { "start": 27.68, "end": 34.24, "text": " tries to introduce it to recurrent neural networks. And on toy data or small" }, { "start": 34.24, "end": 38.2, "text": " data they show that this has the interesting property that these" }, { "start": 38.2, "end": 43.24, "text": " recurrent neural networks can then remember important things for much much" }, { "start": 43.24, "end": 49.64, "text": " longer than our current recurrent architectures can do. I believe this" }, { "start": 49.64, "end": 53.92, "text": " is a very interesting paper and it's a nice refresher from the whole" }, { "start": 53.92, "end": 61.160000000000004, "text": " state-of-the-art number pushing papers. So dive in with me to explore this. If you" }, { "start": 61.160000000000004, "end": 65.58, "text": " like content like this also consider subscribing if you aren't and sharing it" }, { "start": 65.58, "end": 71.84, "text": " out and leaving a like and a comment if you have any sort of comments." }, { "start": 71.84, "end": 75.88, "text": " They basically say recurrent neural networks provide state-of-the-art" }, { "start": 75.88, "end": 80.48, "text": " performance in a wide variety of tasks that will require memory, which is true." }, { "start": 80.48, "end": 84.44, "text": " So we have these recurrent neural networks and what the recurrent neural" }, { "start": 84.44, "end": 92.2, "text": " networks do is they're basically... So a classic recurrent neural network goes" }, { "start": 92.2, "end": 97.44, "text": " something like this. There is a hidden state at time step T and there is a" }, { "start": 97.44, "end": 105.52000000000001, "text": " sequence of inputs that you have to work with. So we'll call them x1, x2, x3, x4" }, { "start": 105.52000000000001, "end": 110.44, "text": " and so on. And then at some point you have to provide an output. This could be" }, { "start": 110.44, "end": 114.6, "text": " at every single time step or sometimes it's just at the end you have to provide" }, { "start": 114.6, "end": 119.64, "text": " an output y. So for example this here could be a piece of text and you need to" }, { "start": 119.64, "end": 123.67999999999999, "text": " decide whether or not that piece of text, maybe it's an email, whether or not" }, { "start": 123.67999999999999, "end": 129.28, "text": " that's spam. This could be a time series of a patient in an ICU and you need to" }, { "start": 129.28, "end": 133.72, "text": " decide whether or not to give some medication to the patient. So the" }, { "start": 133.72, "end": 141.68, "text": " applications of this are very wide and any sort of series data will do. So" }, { "start": 141.68, "end": 146.64, "text": " there's this hidden state and at each time step this hidden state is updated" }, { "start": 146.64, "end": 153.2, "text": " to a new hidden state. So this call this h0. It's updated to a new" }, { "start": 153.2, "end": 159.66, "text": " hidden state by incorporating the input. So somehow the input x and the previous" }, { "start": 159.66, "end": 165.2, "text": " hidden state are made into a new hidden state. And then the next input is taken" }, { "start": 165.2, "end": 171, "text": " in and by using this hidden state a new hidden state is made and so on. So one" }, { "start": 171, "end": 177.12, "text": " property here is that the newest hidden state always only depends on the" }, { "start": 177.12, "end": 181.68, "text": " previous hidden state and it doesn't really directly depend on like the" }, { "start": 181.68, "end": 186.64, "text": " hidden state to before itself. It only depends on the hidden state right before" }, { "start": 186.64, "end": 192.35999999999999, "text": " itself and the input that corresponds to it. So this is the information flow. The" }, { "start": 192.35999999999999, "end": 197.64, "text": " other important property here is that these connections that make a hidden" }, { "start": 197.64, "end": 202.44, "text": " state into the next hidden state and also that incorporate the input, they're" }, { "start": 202.44, "end": 206.95999999999998, "text": " always the same. So these functions here that incorporate the input," }, { "start": 206.95999999999998, "end": 211.39999999999998, "text": " they're always the same in each time step. So the parameters are shared" }, { "start": 211.4, "end": 218, "text": " between them and the same goes for the functions here that transform" }, { "start": 218, "end": 221.32, "text": " one hidden state into the next hidden state. Of course there is a joint" }, { "start": 221.32, "end": 225.64000000000001, "text": " function between the two that actually produces the next hidden state. So these" }, { "start": 225.64000000000001, "end": 232.48000000000002, "text": " weights are all shared and for each time step and that's what makes the network" }, { "start": 232.48000000000002, "end": 238.84, "text": " recurrent. So we call the single time step here, we call that a recurrent cell." }, { "start": 238.84, "end": 243.64000000000001, "text": " And the question now is how do you construct a recurrent cell? Usually" }, { "start": 243.64000000000001, "end": 247.48000000000002, "text": " recurrent neural networks they run into this problem of either gradient" }, { "start": 247.48000000000002, "end": 253.96, "text": " explosion or vanishing gradients because usually this here, if you are into" }, { "start": 253.96, "end": 259.52, "text": " neural networks you know this, this is a weight matrix multiplied by the previous" }, { "start": 259.52, "end": 264.56, "text": " hidden state and if you just multiply the same weight matrix over and over and" }, { "start": 264.56, "end": 268.52, "text": " over again it pretty much depends on the singular value of that weight matrix" }, { "start": 268.52, "end": 274.47999999999996, "text": " if the top singular value is higher than one then the signal is going to explode" }, { "start": 274.47999999999996, "end": 279, "text": " and if it's lower than one the signal is going to fade over time and there's" }, { "start": 279, "end": 286.28, "text": " pretty much nothing you can do. So classic RNNs have looked like" }, { "start": 286.28, "end": 294.76, "text": " this right here. So the next hidden state is a nonlinear function G and G can be" }, { "start": 294.76, "end": 302.68, "text": " some non-linearity like a sigmoid or a hyperbolic tangent but it's a" }, { "start": 302.68, "end": 308.44, "text": " function of the current input and the last hidden state by simply matrix" }, { "start": 308.44, "end": 313.71999999999997, "text": " multiplying these two things by some weight matrices and then adding them up." }, { "start": 313.71999999999997, "end": 319.15999999999997, "text": " So that's what we've just looked at. Now this is problematic as I said because of" }, { "start": 319.16, "end": 325.36, "text": " the vanishing or exploding gradients and therefore people have come up with" }, { "start": 325.36, "end": 332.28000000000003, "text": " methods to solve this and you might know things like LSTMs and GRUs that are" }, { "start": 332.28000000000003, "end": 338.28000000000003, "text": " used to solve this. Now these cells here are much more complicated than the" }, { "start": 338.28000000000003, "end": 343.96000000000004, "text": " standard cell that we saw here but they also are much more effective because" }, { "start": 343.96000000000004, "end": 347.72, "text": " they don't have this vanishing or exploding gradient problems. Their" }, { "start": 347.72, "end": 353, "text": " promise is that they can remember things for longer because they allow the" }, { "start": 353, "end": 359.96000000000004, "text": " gradient to flow without these problems during backpropagation. Now how does one" }, { "start": 359.96000000000004, "end": 364.68, "text": " of these look? In this paper they mainly look at the GRU, the gated recurrent unit" }, { "start": 364.68, "end": 372.24, "text": " which is a simpler version of the LSTM. The LSTM is slightly more complex but" }, { "start": 372.24, "end": 378.04, "text": " the principles are the same. So they look at the GRU right here. What does the GRU" }, { "start": 378.04, "end": 383.44, "text": " do? These are the formulas for the GRU and we're going to try to" }, { "start": 383.44, "end": 388.56, "text": " deconstruct these formulas. So as you can see the inputs are the same. The inputs" }, { "start": 388.56, "end": 394.2, "text": " are going to be this points input, this time steps input and the last hidden" }, { "start": 394.2, "end": 398.8, "text": " state. Those are all the quantities that we need and we need to output" }, { "start": 398.8, "end": 403.6, "text": " somehow the next hidden state. The last hidden state is then used to predict" }, { "start": 403.6, "end": 409.40000000000003, "text": " the y by the way in all of these cases. So first we need to calculate two things" }, { "start": 409.40000000000003, "end": 416.04, "text": " called Z and R and both of them are the same. They're multiplying these two" }, { "start": 416.04, "end": 420.32, "text": " things by weight matrices and then running them through a sigmoid non-linearity." }, { "start": 420.32, "end": 426.8, "text": " Let's do that. Let's say we have the last hidden state here and we" }, { "start": 426.8, "end": 437.8, "text": " have Xt here. So first we're going to calculate the Zt and the Rt from that." }, { "start": 437.8, "end": 443.64, "text": " Now every one of these arrows right here is a multiplication by a weight matrix." }, { "start": 443.64, "end": 450.64, "text": " So every one of these arrows is transforming the input and let's also" }, { "start": 450.64, "end": 459.15999999999997, "text": " let's join this into a sigmoid node and that gives you Zt and let's join these" }, { "start": 459.15999999999997, "end": 468.56, "text": " into a sigmoid that gives you Rt. Okay so far so good. Now we need to combine all" }, { "start": 468.56, "end": 475.52, "text": " of this in this last line right here. So you can see that the Z thing here sort" }, { "start": 475.52, "end": 480.44, "text": " of acts as a switch. So Z is the result of a sigmoid and therefore it's between" }, { "start": 480.44, "end": 488.8, "text": " 0 and 1 and here this is the Hadamard product. This is the element-wise" }, { "start": 488.8, "end": 494.6, "text": " product between vectors which sort of means this is like a gating. This is like" }, { "start": 494.6, "end": 500.96, "text": " a switch. If it's 1 it selects this quantity and if it's 0 it selects the" }, { "start": 500.96, "end": 505.5, "text": " quantity over here and of course it can be between 0 and 1 but those are the" }, { "start": 505.5, "end": 511.28, "text": " ends of the spectrum. So Z is a switch that selects between the last hidden" }, { "start": 511.28, "end": 520.04, "text": " state. So let's draw that right here. So the last hidden state goes here and is" }, { "start": 520.04, "end": 527.2, "text": " one of the options of the output. And the option is given by Z. So Zt" }, { "start": 527.2, "end": 534.2, "text": " let's draw a switch like this maybe. So Zt is responsible for" }, { "start": 534.2, "end": 541.6400000000001, "text": " modulating this switch right here. Okay this gives you the next hidden state. You" }, { "start": 541.6400000000001, "end": 547.08, "text": " see Zt modulates that switch so Ht is the one possibility that the switch can" }, { "start": 547.08, "end": 552.76, "text": " select. What's the other possibility? The other possibility is this quantity right" }, { "start": 552.76, "end": 561.88, "text": " here which is a hyperbolic tangent of whatever that is. So that is combined of" }, { "start": 561.88, "end": 573.4, "text": " X. So let's go from the back right here. Tanh. What's the input to the tanh?" }, { "start": 573.4, "end": 579.28, "text": " It's two things. First of all the X is an input to the tanh so we can draw" }, { "start": 579.28, "end": 585.4, "text": " directly a line from here. The X modulated. Every arrow as you might" }, { "start": 585.4, "end": 590.2, "text": " remember can be a function. Not all arrows are functions like this" }, { "start": 590.2, "end": 595.2800000000001, "text": " arrow right here is not a function it's just an arrow. Maybe that's confusing." }, { "start": 595.2800000000001, "end": 604.9200000000001, "text": " You get what I mean. And the next thing is R times the hidden the last hidden" }, { "start": 604.9200000000001, "end": 612, "text": " state or the last hidden state modulated by this matrix. So R is" }, { "start": 612, "end": 616.6, "text": " acting as another gate. R can be again between 0 and 1 because it's the result" }, { "start": 616.6, "end": 624.32, "text": " of a sigmoid. So this hidden state will also go here. It will be modulated running" }, { "start": 624.32, "end": 632.24, "text": " out of colors here. It will be modulated by R here as a sort of gate. So R can either" }, { "start": 632.24, "end": 638.48, "text": " close or open this gate right here and then that's fed into the tanh. So it's" }, { "start": 638.48, "end": 645.24, "text": " a rather complicated setup as you can see right here. So let's analyze this." }, { "start": 645.24, "end": 653.48, "text": " First of all the hidden state is either the last hidden state or it is something" }, { "start": 653.48, "end": 658.98, "text": " new and that's modulated by this Z right here. And Z is calculated from the hidden" }, { "start": 658.98, "end": 666.36, "text": " state and the current input. So this allows the cell to basically look at" }, { "start": 666.36, "end": 670.28, "text": " the hidden state is sort of the information of what happened so far and" }, { "start": 670.28, "end": 676.04, "text": " the current input is the new information that it gets from the sequence. And it" }, { "start": 676.04, "end": 680.9599999999999, "text": " sort of gets to look at these two things and decides do I even want to update my" }, { "start": 680.9599999999999, "end": 685.68, "text": " hidden state? If not I can just select this path right here and then nothing" }, { "start": 685.68, "end": 689.68, "text": " happens to the hidden state. The next hidden state will be exactly the same as" }, { "start": 689.68, "end": 695.6, "text": " the last hidden state. If it decides, if it thinks wow this new thing in the" }, { "start": 695.6, "end": 699.12, "text": " sequence that's actually important I should remember that. Because" }, { "start": 699.12, "end": 704.88, "text": " remember the task of the network sometimes is to remember things from" }, { "start": 704.88, "end": 710.92, "text": " the sequence. I think we drew this over here. So if this is an email and we want" }, { "start": 710.92, "end": 715.26, "text": " to detect whether it's spam then this word in the sequence right here might be" }, { "start": 715.26, "end": 719.96, "text": " really important because it would say something like gold, like buy gold. These" }, { "start": 719.96, "end": 725.72, "text": " two things might be buy gold and you need to remember that in the hidden" }, { "start": 725.72, "end": 729.5600000000001, "text": " state because the only way that information from X is going to flow to" }, { "start": 729.5600000000001, "end": 733.64, "text": " Y is through the hidden states. So you would want at this point you would want" }, { "start": 733.64, "end": 737.12, "text": " to remember this input in the hidden state so you would actually want to" }, { "start": 737.12, "end": 741.1600000000001, "text": " update the hidden state. And then this here might be not as important so you" }, { "start": 741.1600000000001, "end": 744.76, "text": " might want to say I don't want to I don't want to I still want my hidden" }, { "start": 744.76, "end": 750.6800000000001, "text": " state to be the old hidden state. So Z is that gate that allows us to do" }, { "start": 750.68, "end": 757.9599999999999, "text": " this. If we decide to update the hidden state then what do we do? Again if we" }, { "start": 757.9599999999999, "end": 766.8, "text": " decide to update the hidden state we can we can we will incorporate the new" }, { "start": 766.8, "end": 773.92, "text": " input but we will we can also decide to mix that how to mix that new input with" }, { "start": 773.92, "end": 779.7199999999999, "text": " the old hidden state. So if we decide to update the hidden state we don't" }, { "start": 779.72, "end": 783.2, "text": " simply discard the old hidden state because the old hidden state will still" }, { "start": 783.2, "end": 791.2, "text": " have a path to be sort of still there to be remembered but it's a" }, { "start": 791.2, "end": 797.24, "text": " longer path and it needs to go through this thing here and through this thing" }, { "start": 797.24, "end": 804.2, "text": " here. So this thing here decides which of the old hidden state pass through. So at" }, { "start": 804.2, "end": 808.8000000000001, "text": " each you can see right here this is an element-wise product this R is going to" }, { "start": 808.8, "end": 813.4, "text": " be between 0 and 1 at each point in the vector. So at each point in the vector" }, { "start": 813.4, "end": 820.3199999999999, "text": " the R decides is this worth remembering or not? And if it's not worth" }, { "start": 820.3199999999999, "end": 825.04, "text": " remembering then this is going to be 0 and that that position of the old hidden" }, { "start": 825.04, "end": 830.16, "text": " state is going to be 0 and then that's going to be forgotten and that's the" }, { "start": 830.16, "end": 835.1999999999999, "text": " opportunity for the hidden state to incorporate new information because" }, { "start": 835.2, "end": 840.96, "text": " then it can delete this old information and then it can incorporate" }, { "start": 840.96, "end": 845.84, "text": " the new input and that will result then on this path on the new hidden state." }, { "start": 845.84, "end": 850.5600000000001, "text": " So there's two major things. First we can decide whether or not to even" }, { "start": 850.5600000000001, "end": 855.36, "text": " incorporate new information that's achieved by the Z gate and then we can" }, { "start": 855.36, "end": 859.8000000000001, "text": " decide which parts of the old hidden state if we want to update it which" }, { "start": 859.8, "end": 865.3599999999999, "text": " parts to forget that's the R gate and how to update it is then basically a" }, { "start": 865.3599999999999, "end": 871, "text": " result of the weight matrix that's associated with this function right here." }, { "start": 871, "end": 878.5999999999999, "text": " Alright so that's the gated recurrent unit and it works a lot better than the" }, { "start": 878.5999999999999, "end": 884.64, "text": " classic RNNs. So having said that they now turn to this property of neuronal" }, { "start": 884.64, "end": 890.48, "text": " by stability that happens in actual neurons. So this here is sort of a model" }, { "start": 890.48, "end": 895.48, "text": " of a neuron with this property. Now forget everything we said about GRUs" }, { "start": 895.48, "end": 900.1999999999999, "text": " we're just going to look at this right now. What happens in a neuron usually is" }, { "start": 900.1999999999999, "end": 907.56, "text": " you have this is a single neuron you have input synapses from other neurons" }, { "start": 907.56, "end": 913.12, "text": " so these are connections coming from other neurons into you. They are" }, { "start": 913.12, "end": 919.24, "text": " accumulated right here. Usually they are just in a classic model of a neuron" }, { "start": 919.24, "end": 923.68, "text": " they're just summed up you would sum up all these all these input signals and" }, { "start": 923.68, "end": 930.84, "text": " then you decide you'd run it through like a step function. So if the sum of" }, { "start": 930.84, "end": 937.6800000000001, "text": " all the things is smaller than a particular threshold the output would be" }, { "start": 937.6800000000001, "end": 942.04, "text": " just nothing and if it's higher than a particular threshold then the output of" }, { "start": 942.04, "end": 947.68, "text": " the neuron would be sort of a firing of the neuron. This can be weighted and" }, { "start": 947.68, "end": 952.68, "text": " whatnot but in this case it's just a function of the inputs and that gives" }, { "start": 952.68, "end": 957.8399999999999, "text": " you your input signal. So this is like this is your input signal to" }, { "start": 957.8399999999999, "end": 964, "text": " the neuron. Now there is this property right here that makes it interesting." }, { "start": 964, "end": 972.64, "text": " The signal goes out here and is integrated. This is an integrator and that's" }, { "start": 972.64, "end": 976.4, "text": " going to be in the output signal but there's this connection this back" }, { "start": 976.4, "end": 982, "text": " connection right here and that means that the signal that comes out at time" }, { "start": 982, "end": 988, "text": " step t is going to be fed back into the signal and actually added to the signal" }, { "start": 988, "end": 995.96, "text": " before itself and sort of self modulating right the signal comes out" }, { "start": 995.96, "end": 1002.4, "text": " is sent back is added to this input and then sent through again and this here is" }, { "start": 1002.4, "end": 1007.44, "text": " just an integrator that's integrating everything that's happening. So if you" }, { "start": 1007.44, "end": 1014.4, "text": " if you look a bit closer you'll see that there is a minus here so it's actually" }, { "start": 1014.4, "end": 1019.36, "text": " not added it's subtracted and there is an F here which means that this is a" }, { "start": 1019.36, "end": 1024.44, "text": " nonlinear function. Now if this weren't a nonlinear function we can just sort of" }, { "start": 1024.44, "end": 1029.84, "text": " try or let's say this is a monotonic function we can sort of try to estimate" }, { "start": 1029.84, "end": 1035.4, "text": " what happens. If all of this right here is very high it's a high number big" }, { "start": 1035.4, "end": 1040.08, "text": " number this will be a big number then this sum will be a big number this" }, { "start": 1040.08, "end": 1046.28, "text": " output will be a big number what happens is this here will be a big number this" }, { "start": 1046.28, "end": 1051.04, "text": " is monotonic so it will also be a big number and that means it will subtract" }, { "start": 1051.04, "end": 1058.24, "text": " that big number so that means when whenever the neuron is going to to be" }, { "start": 1058.24, "end": 1063.84, "text": " very excited this feedback would actually push it back now when it is not" }, { "start": 1063.84, "end": 1068.84, "text": " very excited so when it's a very low number very negatively excited then the" }, { "start": 1068.84, "end": 1071.9599999999998, "text": " feedback would work in the exact opposite direction this will be very" }, { "start": 1071.9599999999998, "end": 1076.1999999999998, "text": " negative this will be very negative and this here would push it towards the" }, { "start": 1076.1999999999998, "end": 1083.6799999999998, "text": " positive so this neuron somehow self stabilizes over time to this to the zero" }, { "start": 1083.6799999999998, "end": 1091.1599999999999, "text": " point right here and that's simply if this F is the identity function right" }, { "start": 1091.1599999999999, "end": 1098.04, "text": " now so you can sort of see how this property works now we'll make it a bit" }, { "start": 1098.04, "end": 1104.24, "text": " more complicated in that we'll assume that this F here is not the identity" }, { "start": 1104.24, "end": 1112.44, "text": " function but let's say they have it somewhere but this right here so the F" }, { "start": 1112.44, "end": 1127.28, "text": " F of V post is this here it's V post minus alpha tan H of V post or is this" }, { "start": 1127.28, "end": 1135.84, "text": " the entire F yes that's this this thing right here if this is the case if this" }, { "start": 1135.84, "end": 1143.24, "text": " is that this if this is the signal minus the tan H then something very very very" }, { "start": 1143.24, "end": 1148.24, "text": " interesting happens and that that's depending on this alpha right here in" }, { "start": 1148.24, "end": 1156.6, "text": " that if this alpha is between if the alpha is between 0 and 1 then we simply" }, { "start": 1156.6, "end": 1162.52, "text": " have our monotonic function so here you can see how big V post is so how big the" }, { "start": 1162.52, "end": 1165.9599999999998, "text": " output signal is here that's the experiment we made before and here you" }, { "start": 1165.9599999999998, "end": 1173.48, "text": " can see what the feedback signal is okay or the integrator the integrated signal" }, { "start": 1173.48, "end": 1177.84, "text": " maybe this is in the wrong place and maybe F is just minus the tan H I'm not" }, { "start": 1177.84, "end": 1183.1599999999999, "text": " sure but in any case the way they build it after in the GRU it's pretty explicit" }, { "start": 1183.16, "end": 1191.72, "text": " so this is the thing we said before namely if if the signal is very high" }, { "start": 1191.72, "end": 1199.16, "text": " then this signal here will be high as well and because it's subtracted right" }, { "start": 1199.16, "end": 1206.24, "text": " here it's it's going to push the signal back towards zero again if this is" }, { "start": 1206.24, "end": 1211.48, "text": " lower than zero then this thing here will also be lower than zero and because" }, { "start": 1211.48, "end": 1216.1200000000001, "text": " it's subtracted it's going to push the signal towards zero so this thing here" }, { "start": 1216.1200000000001, "end": 1222.52, "text": " is the stable point it will always push it back towards zero however if we" }, { "start": 1222.52, "end": 1229.92, "text": " change the function and we change just the parameter alpha to be 1.5 a very" }, { "start": 1229.92, "end": 1236.3600000000001, "text": " different thing happens that you can see right here then it turns out if your" }, { "start": 1236.36, "end": 1241.52, "text": " output signal is very is very high the same thing happens is going to put me" }, { "start": 1241.52, "end": 1246.32, "text": " push back but if your output signal is between zero and this point right here" }, { "start": 1246.32, "end": 1253, "text": " there is a regime where actually even though the output signal is positive you" }, { "start": 1253, "end": 1260.1599999999999, "text": " will be pushed towards this point right here and therefore there is there are" }, { "start": 1260.1599999999999, "end": 1264.28, "text": " these two stable points right now and the stable point basically means if you" }, { "start": 1264.28, "end": 1268, "text": " deviate if the signal deviates from it it's going to be pushed back towards" }, { "start": 1268, "end": 1271.96, "text": " that point and you can see these two stable points they're not at zero they're" }, { "start": 1271.96, "end": 1279.52, "text": " actually at at these two points here and that's pretty interesting because that" }, { "start": 1279.52, "end": 1285.16, "text": " means you can potentially remember things with the cell right an output" }, { "start": 1285.16, "end": 1289.44, "text": " signal of zero it's basically not informative but here you can be in either" }, { "start": 1289.44, "end": 1297.16, "text": " the state here or in the state here and the little little perturbations will" }, { "start": 1297.16, "end": 1301.48, "text": " still keep you in that state so you could potentially be in this state right" }, { "start": 1301.48, "end": 1307.28, "text": " here as an output and the cell will just keep updating itself and be stable and" }, { "start": 1307.28, "end": 1314, "text": " always output that signal right here and then you could go ahead and if you then" }, { "start": 1314, "end": 1320, "text": " provide some huge input signal right here you could potentially throw this" }, { "start": 1320, "end": 1325.04, "text": " over to the other side over this hill and then it would stabilize at this point" }, { "start": 1325.04, "end": 1329.8, "text": " so this is sort of a way to remember things within these biological cells" }, { "start": 1329.8, "end": 1333.92, "text": " pretty cool now this here is a non filled out circle that means it's an" }, { "start": 1333.92, "end": 1340.12, "text": " unstable point it's technically stable in the sense that if you're exactly at" }, { "start": 1340.12, "end": 1345.6799999999998, "text": " zero you will remain at zero but if you perturb even a little bit you will go if" }, { "start": 1345.6799999999998, "end": 1353.4799999999998, "text": " you perturb a bit you will go away from it okay I hope this sort of property is" }, { "start": 1353.4799999999998, "end": 1357.28, "text": " right is clear and why this is so fascinating because we can use this" }, { "start": 1357.28, "end": 1362.2399999999998, "text": " these this fact that the stable points are not at zero and are more than just" }, { "start": 1362.2399999999998, "end": 1368.32, "text": " one stable point for remembering things and they're now trying to fill this into" }, { "start": 1368.32, "end": 1379.2, "text": " the gated recurrent unit so they call this the bi-stable recurrent cell BRC" }, { "start": 1379.2, "end": 1386.52, "text": " and the formulas are these right here maybe a little smaller come on can't" }, { "start": 1386.52, "end": 1395.2, "text": " zoom anymore okay it looks almost the same as the GRU so the formulas are" }, { "start": 1395.2, "end": 1404.32, "text": " these this and this so let's analyze the differences to the GRU the first most" }, { "start": 1404.32, "end": 1409.28, "text": " striking difference is that a lot of weight matrices here have become single" }, { "start": 1409.28, "end": 1415.48, "text": " numbers so or single vectors this here used to be a weight matrix and this used" }, { "start": 1415.48, "end": 1420.04, "text": " to be a matrix multiplication and you'll see this sort of throughout whenever the" }, { "start": 1420.04, "end": 1425.96, "text": " last hidden state is incorporated into these things then you'll see that it is" }, { "start": 1425.96, "end": 1434.24, "text": " no longer a weight matrix but is in fact a in a product with a vector a element" }, { "start": 1434.24, "end": 1438.92, "text": " wise product and that has a reason namely what they want to model is" }, { "start": 1438.92, "end": 1445.78, "text": " individual neurons so on a biological level and neuron can only feed back onto" }, { "start": 1445.78, "end": 1451.24, "text": " itself if there is a layer of neurons right here they can only each feed back" }, { "start": 1451.24, "end": 1459.44, "text": " onto themselves whereas in a recurrent neural network my hidden vector my" }, { "start": 1459.44, "end": 1464.2, "text": " hidden state is a vector and if I transform this into the next hidden" }, { "start": 1464.2, "end": 1469, "text": " state or any quantity let's say I transform this H into this R right here" }, { "start": 1469, "end": 1477.76, "text": " and this R is a vector too then any interaction is possible so any cell any" }, { "start": 1477.76, "end": 1481.6, "text": " entry in the vector here can influence any other vector because there's a big" }, { "start": 1481.6, "end": 1486.24, "text": " weight matrix in the middle they want to leave this away they want to model this" }, { "start": 1486.24, "end": 1491.54, "text": " as close as possible to actual layers of neurons and therefore they say okay the" }, { "start": 1491.54, "end": 1497.24, "text": " input X can you know be distributed to all the neurons because technically the" }, { "start": 1497.24, "end": 1501.14, "text": " input comes from some other neurons down here and they can all have connections" }, { "start": 1501.14, "end": 1507.08, "text": " to these neurons but these feedbacks we only really observe them in individual" }, { "start": 1507.08, "end": 1512.1200000000001, "text": " neuron this feedback cycle so that's why they model these recurrent weight" }, { "start": 1512.1200000000001, "end": 1518.04, "text": " products by just element wise products with vectors and then the second" }, { "start": 1518.04, "end": 1523.6, "text": " difference you again see that there is this switch right here this C switch and" }, { "start": 1523.6, "end": 1532.24, "text": " the C switch is like before it's a sigmoid with where combine the the output" }, { "start": 1532.24, "end": 1537.4599999999998, "text": " and the previous hidden state there's nothing new here so this switch is the" }, { "start": 1537.4599999999998, "end": 1542.52, "text": " same the cell has the possibility of letting in new information or just" }, { "start": 1542.52, "end": 1550.4599999999998, "text": " ignoring the new current information the XT the second thing is here and this is" }, { "start": 1550.46, "end": 1555.24, "text": " the same as well right the tanh this is a combination of the new information" }, { "start": 1555.24, "end": 1559.8400000000001, "text": " it's in case we want to let in the new information of the new information and" }, { "start": 1559.8400000000001, "end": 1567.64, "text": " you need to decide what things of the old information to forget or remember now" }, { "start": 1567.64, "end": 1575.2, "text": " the difference here is in this a so this a used to be again this sigmoid of the" }, { "start": 1575.2, "end": 1582.04, "text": " combination and now it's just slightly different it used to be sigmoid now it's" }, { "start": 1582.04, "end": 1590.92, "text": " one plus tanh this is a very very slight modification it's tanh because tanh is" }, { "start": 1590.92, "end": 1595.78, "text": " between minus one and one instead of zero and one like the sigmoid and the" }, { "start": 1595.78, "end": 1601.64, "text": " one plus makes it such that this is between zero and two and we've seen" }, { "start": 1601.64, "end": 1605.6000000000001, "text": " before that this critical behavior there is two regimes to these functions when" }, { "start": 1605.6000000000001, "end": 1612.0400000000002, "text": " it's between zero and one this behaves like a classic gated recurrent unit like" }, { "start": 1612.0400000000002, "end": 1617.8400000000001, "text": " a classic GRU but when it's between one and two then you have that exact" }, { "start": 1617.8400000000001, "end": 1622.76, "text": " behavior that we saw before of the bi-stability okay so depending on what" }, { "start": 1622.76, "end": 1629.0400000000002, "text": " the a is if the a is zero to one it's a classic cell and if the a is one to two" }, { "start": 1629.04, "end": 1635.04, "text": " it's a bi-stable cell and the network can decide by itself what it wants to do" }, { "start": 1635.04, "end": 1641.92, "text": " because here it has it can actually learn how to do that all right so this" }, { "start": 1641.92, "end": 1645.3999999999999, "text": " is the only change the only change really apart from it only being" }, { "start": 1645.3999999999999, "end": 1649.92, "text": " individual neurons feeding back on themselves is that now this is no longer" }, { "start": 1649.92, "end": 1654.72, "text": " between zero and one with the sigmoid this is now between zero and two because" }, { "start": 1654.72, "end": 1663, "text": " it's one plus the tan h very simple change but the effect of this is pretty" }, { "start": 1663, "end": 1671.52, "text": " pretty cool so they do some here is like a schematic drawing of this if this a is" }, { "start": 1671.52, "end": 1676.48, "text": " between zero and one again you have this stable state that's at zero but it's" }, { "start": 1676.48, "end": 1682.24, "text": " if it's between one and two you have two stable states at two non zero points" }, { "start": 1682.24, "end": 1690.28, "text": " and again this we already saw this but now this is for I believe this this" }, { "start": 1690.28, "end": 1697.52, "text": " recurrent cell this by modal recurrent cell not for the neuron itself and here" }, { "start": 1697.52, "end": 1702.36, "text": " they give an example of what happens when you run this particular signal this" }, { "start": 1702.36, "end": 1708, "text": " particular time series through a cell like this while fixing the C and the a" }, { "start": 1708, "end": 1711.08, "text": " parameters so now the C and their a parameter aren't learned they're just" }, { "start": 1711.08, "end": 1720.6399999999999, "text": " fixed and you see what happens now as you can see the the blue should be a" }, { "start": 1720.6399999999999, "end": 1727.24, "text": " classic the classic behavior so in this blue case what happens you see right" }, { "start": 1727.24, "end": 1735.48, "text": " here this C is moderately low so we saw the C is the switch of whether to leave" }, { "start": 1735.48, "end": 1740.1999999999998, "text": " in old information or take up new information if it's low it means we want" }, { "start": 1740.2, "end": 1743.96, "text": " to take up new information this is reasonably low and that's why when the" }, { "start": 1743.96, "end": 1750.1200000000001, "text": " signal goes up here the blue line goes up as well and when the signal goes down" }, { "start": 1750.1200000000001, "end": 1753.68, "text": " the blue line goes down again and so on so the blue line pretty" }, { "start": 1753.68, "end": 1760.0800000000002, "text": " straightforwardly follows the signal right here okay now in contrast to this" }, { "start": 1760.0800000000002, "end": 1767.88, "text": " the red line is over this threshold so a is fixed at 1.5 C is still at 0.2 so" }, { "start": 1767.88, "end": 1776, "text": " again when this line goes up then this line goes up but because this is near a" }, { "start": 1776, "end": 1781.2800000000002, "text": " this stable point if it goes down again it doesn't appear to go down enough it" }, { "start": 1781.2800000000002, "end": 1787.5600000000002, "text": " sort of remembers that state it was in it doesn't go down with the signal only" }, { "start": 1787.5600000000002, "end": 1793.0800000000002, "text": " now that it goes down even further it's over this threshold so we were in this" }, { "start": 1793.08, "end": 1799.36, "text": " situation now and the first bump down was only like to here and that pushed it" }, { "start": 1799.36, "end": 1804.32, "text": " up again but now it jumps over here because the signal is even lower and" }, { "start": 1804.32, "end": 1809.76, "text": " then the cell sort of switches to another state as you can see here it" }, { "start": 1809.76, "end": 1815.4399999999998, "text": " goes down but then this bump here is not enough to bring it up again so it kind" }, { "start": 1815.4399999999998, "end": 1822.1999999999998, "text": " of remains in this state so you can see the it sort of remembers the input and" }, { "start": 1822.2, "end": 1828.68, "text": " small deviations or small changes in signal don't manage to throw it away" }, { "start": 1828.68, "end": 1834.32, "text": " from that only larger things only it needs to go very the signal needs to go" }, { "start": 1834.32, "end": 1839.28, "text": " very much down in order for it to change state so that's pretty cool that there's" }, { "start": 1839.28, "end": 1843.96, "text": " this remembering behavior and now remember in the actual implementation" }, { "start": 1843.96, "end": 1851.3600000000001, "text": " these C and A parameters this C and this A right here aren't fixed they are also" }, { "start": 1851.36, "end": 1856.6799999999998, "text": " determined by the cell itself and therefore the cell can decide by itself" }, { "start": 1856.6799999999998, "end": 1861.12, "text": " when it wants to remember things how hard it wants to remember things and so" }, { "start": 1861.12, "end": 1867.9599999999998, "text": " on so we're going to check this out in an actual implementation so there's this" }, { "start": 1867.9599999999998, "end": 1872.76, "text": " one last modification they make where they say okay they tried this and it" }, { "start": 1872.76, "end": 1878.1999999999998, "text": " doesn't really work because it works sometimes but there is this issue of" }, { "start": 1878.2, "end": 1884.52, "text": " these neurons connecting only back on themselves which really makes the model" }, { "start": 1884.52, "end": 1889.92, "text": " much less powerful than a classic recurrent cell it's closer to biology" }, { "start": 1889.92, "end": 1895.3600000000001, "text": " but it's much less powerful and there is this property they say of a neuromodulation" }, { "start": 1895.3600000000001, "end": 1904.3600000000001, "text": " where technically in real neurons the one neuron here could influence another" }, { "start": 1904.36, "end": 1910.52, "text": " neuron by modulating these A and C parameters okay these A and C parameters" }, { "start": 1910.52, "end": 1915.4399999999998, "text": " this is called neuromodulation so there are interconnections between the neurons" }, { "start": 1915.4399999999998, "end": 1920.6, "text": " that influence how much other neurons remember and forget things so they" }, { "start": 1920.6, "end": 1925.76, "text": " decide let's model that and lo and behold we're now back to having weight" }, { "start": 1925.76, "end": 1933.9199999999998, "text": " matrices right here so this this is sort of they say this is a not really a" }, { "start": 1933.92, "end": 1939.64, "text": " super biologically plausible way of implementing neuromodulation but it's" }, { "start": 1939.64, "end": 1947.04, "text": " sort of it's an easier way and it brings us closer to the G back to the GRU and" }, { "start": 1947.04, "end": 1952.28, "text": " yeah so now the only difference to the GRU is that the fact that here there" }, { "start": 1952.28, "end": 1961.48, "text": " was a sigmoid now it's a 1 plus tan H okay I find this this pretty cool so now" }, { "start": 1961.48, "end": 1967.72, "text": " also the only difference here is this property of bi stability this is the" }, { "start": 1967.72, "end": 1974.24, "text": " only difference and now we can actually compare so let's compare they first" }, { "start": 1974.24, "end": 1981.76, "text": " give they do these sort of benchmarks which are they're pretty pretty neat so" }, { "start": 1981.76, "end": 1985.4, "text": " they have this first benchmark where it's the copy first input benchmark I'm" }, { "start": 1985.4, "end": 1991.64, "text": " having some trouble here moving this paper around with my fingers so the copy" }, { "start": 1991.64, "end": 1996.92, "text": " first input benchmark is simply a time series in this benchmark the network is" }, { "start": 1996.92, "end": 2002.24, "text": " presented with a one-dimensional time series of T time steps and the each" }, { "start": 2002.24, "end": 2009.1200000000001, "text": " entry is a is a random number after receiving the last time step the network" }, { "start": 2009.1200000000001, "end": 2014.92, "text": " output value should approximate the very very first input step okay so all the" }, { "start": 2014.92, "end": 2019.72, "text": " network needs to do is remember the first thing it sees and that's that" }, { "start": 2019.72, "end": 2025.16, "text": " should be learnable right that should be learnable because you can so you can" }, { "start": 2025.16, "end": 2030.5600000000002, "text": " it's not specified whether the zero with hidden state the initial hidden state is" }, { "start": 2030.5600000000002, "end": 2035.68, "text": " given into the network but technically it doesn't matter because it can just" }, { "start": 2035.68, "end": 2043.04, "text": " learn whatever that is I can learn to have a designated bit in this hidden" }, { "start": 2043.04, "end": 2049.2, "text": " state so this hidden state is of size 100 I believe one designated bit in the" }, { "start": 2049.2, "end": 2055.24, "text": " hidden state of whether it has already encountered the first thing or not if it" }, { "start": 2055.24, "end": 2059.2, "text": " has not encountered it means that it's at the first time step therefore it" }, { "start": 2059.2, "end": 2063.94, "text": " should incorporate the new information into the hidden state and if and also" }, { "start": 2063.94, "end": 2067.88, "text": " set this bit and then for each subsequent step it can see I've already" }, { "start": 2067.88, "end": 2072.2799999999997, "text": " set this bit and it can simply close that gate that makes it incorporate new" }, { "start": 2072.28, "end": 2076.88, "text": " information so it should be able to carry this information all the way to" }, { "start": 2076.88, "end": 2083.88, "text": " the end by simply always closing that gate after the first step and what" }, { "start": 2083.88, "end": 2096.8, "text": " happens in this so as you can see when the result is all the results up here so" }, { "start": 2096.8, "end": 2101.6800000000003, "text": " this is after three so they train it for 300,000 gradient descent iterations and" }, { "start": 2101.68, "end": 2106.44, "text": " you can see that when these time steps when the series are pretty small the" }, { "start": 2106.44, "end": 2112.6, "text": " LSTM or the GRUs tend to perform well but you can see that these BRCs they" }, { "start": 2112.6, "end": 2116.96, "text": " they don't tend to perform poorly they're just performing worse right it's" }, { "start": 2116.96, "end": 2123.3599999999997, "text": " zero it's still the 0.01 regime or something like this of error however" }, { "start": 2123.3599999999997, "end": 2128.72, "text": " when you go up to like 300 steps then you can see the GRUs and the LSTM they" }, { "start": 2128.72, "end": 2134.72, "text": " start to fail because they are not made explicitly to remember for that long" }, { "start": 2134.72, "end": 2141.2, "text": " they don't have this by stability property whereas now these things excel" }, { "start": 2141.2, "end": 2145.6, "text": " you can see they're still pretty low and at 600 steps these things completely" }, { "start": 2145.6, "end": 2153.2799999999997, "text": " fail they completely forget the input so and the NBRC at least is still able to" }, { "start": 2153.28, "end": 2162, "text": " remember the first thing pretty pretty well and yeah so the second one is no" }, { "start": 2162, "end": 2165.8, "text": " this is the first experiment still the copy input benchmark you can see right" }, { "start": 2165.8, "end": 2172.1600000000003, "text": " here that even at this three at this 100 thing where the GRU still learns it it" }, { "start": 2172.1600000000003, "end": 2178.36, "text": " learns it much much later than the BRC which learns it pretty fast only here" }, { "start": 2178.36, "end": 2184.6800000000003, "text": " when the when it's only five when that series are only five steps long does the" }, { "start": 2184.6800000000003, "end": 2191.52, "text": " GRU slightly outperform the BRC so the general notion here is that these" }, { "start": 2191.52, "end": 2200.28, "text": " classic cells are more powerful in like classic tasks whereas these things are" }, { "start": 2200.28, "end": 2205.56, "text": " shining whenever these things fail because they can't remember things for" }, { "start": 2205.56, "end": 2211.08, "text": " very long so they're not these new cells are not state-of-the-art yet possibly" }, { "start": 2211.08, "end": 2216.96, "text": " there are still some modifications to be made we've had a pretty long history of" }, { "start": 2216.96, "end": 2222.08, "text": " optimizing GRUs and LSTMs they haven't always worked so well as they do now" }, { "start": 2222.08, "end": 2227.48, "text": " because we kind of know how to handle them and I expect if these cells here" }, { "start": 2227.48, "end": 2235.16, "text": " take off especially these NBRC then with time will be as proficient at handling" }, { "start": 2235.16, "end": 2241.8799999999997, "text": " them and they will probably become on par or even outperform the LSTMs or GRUs on" }, { "start": 2241.8799999999997, "end": 2246.64, "text": " every day like on all the tasks and then be especially good on tasks where you" }, { "start": 2246.64, "end": 2252.3999999999996, "text": " have to remember things but for now they're outperformed by LSTMs and GRUs" }, { "start": 2252.3999999999996, "end": 2257, "text": " okay so the second thing is a more interesting experiment the denoising" }, { "start": 2257, "end": 2264.08, "text": " benchmark where they say the the copy input benchmark is interesting as a" }, { "start": 2264.08, "end": 2267.2, "text": " means to highlight the memorization capacity of the recurrent neural network" }, { "start": 2267.2, "end": 2271.4, "text": " but it does not tackle its ability to successfully exploit complex" }, { "start": 2271.4, "end": 2275.72, "text": " relationships between different elements of the input signal to predict the output" }, { "start": 2275.72, "end": 2280.92, "text": " so they have a new benchmark in the denoising benchmark the network is" }, { "start": 2280.92, "end": 2285.52, "text": " presented with a two-dimensional time series of t time steps five different" }, { "start": 2285.52, "end": 2292.68, "text": " time steps are sampled uniformly with okay and are communicated in the network" }, { "start": 2292.68, "end": 2297.44, "text": " okay I'll just tell you what's going on so this new time series is two" }, { "start": 2297.44, "end": 2301.7999999999997, "text": " dimensional in the lower dimension you simply have a bunch of random numbers" }, { "start": 2301.7999999999997, "end": 2308.68, "text": " like five eight two nine actually these are numbers sampled from a uniform" }, { "start": 2308.68, "end": 2312.72, "text": " Gaussian or so so they're not actually five eight two and nine but you can" }, { "start": 2312.72, "end": 2320.66, "text": " imagine it like this five eight two nine three four zero two and so on and in the" }, { "start": 2320.66, "end": 2326.72, "text": " second dimension you have a negative one I believe almost anywhere and then at" }, { "start": 2326.72, "end": 2331.24, "text": " some points you have a one negative one again and then you have a one and a" }, { "start": 2331.24, "end": 2336.8799999999997, "text": " negative one again and at the last point of the sequence you'll have a zero and" }, { "start": 2336.8799999999997, "end": 2342.56, "text": " so the zero is simply a marker that it's the end of the sequence what the" }, { "start": 2342.56, "end": 2348, "text": " network needs to do is it needs to output all the elements so the output of" }, { "start": 2348, "end": 2354.48, "text": " the network should be in this case should be nine four so all the elements" }, { "start": 2354.48, "end": 2361.08, "text": " where there was a one in order okay so it remember what it needs to learn it" }, { "start": 2361.08, "end": 2366.88, "text": " needs to learn to every time it sees a one in the second dimension it needs to" }, { "start": 2366.88, "end": 2373.12, "text": " take the first dimension put it somehow into the hidden state and then carry" }, { "start": 2373.12, "end": 2378.56, "text": " that hidden state forward and sees a one again it needs to take the second thing" }, { "start": 2378.56, "end": 2383.48, "text": " also put it into the hidden state but not override the first thing it put into" }, { "start": 2383.48, "end": 2387.3199999999997, "text": " the hidden state like if it were to just realize I need to put this into the" }, { "start": 2387.3199999999997, "end": 2392.52, "text": " hidden state then it would almost surely override the previous information so it" }, { "start": 2392.52, "end": 2398.72, "text": " needs to be able to say I've already kind of in my H is going to be a vector" }, { "start": 2398.72, "end": 2404.3599999999997, "text": " of a hundred dimensions it needs to be able to say well I've already stored a" }, { "start": 2404.3599999999997, "end": 2409.7999999999997, "text": " bunch of stuff in that part of the vector maybe I should store that thing" }, { "start": 2409.7999999999997, "end": 2415.9599999999996, "text": " here over here so this is fairly complex things to remember and technically GRU's" }, { "start": 2415.9599999999996, "end": 2424.16, "text": " and LSTMs are able to do it but as we'll see they're not as much the results are" }, { "start": 2424.16, "end": 2432.8399999999997, "text": " in this table where you can clearly see that whenever the n so the n the n is a" }, { "start": 2432.8399999999997, "end": 2440.2799999999997, "text": " parameter that is how far how far in this direction are these ones so when n" }, { "start": 2440.2799999999997, "end": 2446.8799999999997, "text": " is 0 the ones can be anywhere but when n here is like 5 that means that the last" }, { "start": 2446.8799999999997, "end": 2453.3999999999996, "text": " five ones surely don't contain a one that means only the first whatever a L" }, { "start": 2453.4, "end": 2458.52, "text": " minus L minus 5 contain the one so the higher this number n is the harder the" }, { "start": 2458.52, "end": 2465.48, "text": " task because your learning signal is way way farther away from the from what's" }, { "start": 2465.48, "end": 2473.32, "text": " when you get the output so you can see when the n is low then the GRU's and the" }, { "start": 2473.32, "end": 2478.12, "text": " LSTMs they perform pretty well but also these cells perform pretty well they're" }, { "start": 2478.12, "end": 2483.7599999999998, "text": " just not performing as well however when the task gets harder and you actually" }, { "start": 2483.7599999999998, "end": 2489.2799999999997, "text": " need to learn a sparse signal over a long period of time where in between you" }, { "start": 2489.2799999999997, "end": 2494.68, "text": " don't get any signal the GRU's and the LSTMs fail while the BRC's would still" }, { "start": 2494.68, "end": 2501.2, "text": " be able to learn these kinds of things so that's that's fairly cool now it's if" }, { "start": 2501.2, "end": 2506.2, "text": " from a researcher's perspective I wonder if they just first tried this task you" }, { "start": 2506.2, "end": 2510.2799999999997, "text": " know as I described it and then they discovered like ah crap they can still" }, { "start": 2510.2799999999997, "end": 2514.96, "text": " do it and like okay how can we make it such that there's a difference okay" }, { "start": 2514.96, "end": 2519.24, "text": " let's actually make the task harder like this and then they did that I wonder if" }, { "start": 2519.24, "end": 2526.04, "text": " they always had the idea with the end here or just introduced this after after" }, { "start": 2526.04, "end": 2531, "text": " it they they failed to produce a difference in the first place I'm not" }, { "start": 2531, "end": 2534.9199999999996, "text": " sure but they have they have another benchmark but they basically show that" }, { "start": 2534.92, "end": 2539.8, "text": " these cells are actually good can incorporate this information can reason" }, { "start": 2539.8, "end": 2544.4, "text": " about what they need to remember and whatnot and in the end they also have" }, { "start": 2544.4, "end": 2549.7200000000003, "text": " this sequential MNIST where they just feed an MNIST digit digit by digit and" }, { "start": 2549.7200000000003, "end": 2555.2000000000003, "text": " at the end I think that the output of the neural network needs to be the class" }, { "start": 2555.2000000000003, "end": 2561.96, "text": " of the of the MNIST digit and again here they have a parameter called N black" }, { "start": 2561.96, "end": 2567.92, "text": " which means that so they have an MNIST digit it's like a three they unroll it to" }, { "start": 2567.92, "end": 2574.64, "text": " a single vector right they feed this one by one into the recurrent network and" }, { "start": 2574.64, "end": 2580, "text": " then after that they attach a certain number of just empty pixels black pixels" }, { "start": 2580, "end": 2586.4, "text": " and after that the network needs to predict the Y you can see if they ask" }, { "start": 2586.4, "end": 2591.7200000000003, "text": " the network the class of the digit immediately after it's done then the G" }, { "start": 2591.72, "end": 2598.3599999999997, "text": " are using the LSTM perform fairly well as do the BRCs but if you attach a whole" }, { "start": 2598.3599999999997, "end": 2603.6, "text": " bunch of these black pixels remember an MNIST digit has some seven sorry seven" }, { "start": 2603.6, "end": 2612.3999999999996, "text": " hundred and eighty four maybe entries so attaching 300 black pixels is quite" }, { "start": 2612.3999999999996, "end": 2617.64, "text": " significant in in terms of the length of these sequences and then the GRUs and" }, { "start": 2617.64, "end": 2623.64, "text": " the LSTMs they can't learn they can't learn to ignore these things because the" }, { "start": 2623.64, "end": 2630.72, "text": " learning signal is just too far away right here but these things they can" }, { "start": 2630.72, "end": 2636.6, "text": " because they can exploit this by stability property and remember things" }, { "start": 2636.6, "end": 2642.16, "text": " again I wonder how this came to be it seems pretty funny but the last thing" }, { "start": 2642.16, "end": 2647, "text": " they do is they investigate what happens in their cells and this I feel is the" }, { "start": 2647, "end": 2651.96, "text": " most interesting part and they do this on this denoising benchmark so the task" }, { "start": 2651.96, "end": 2656.96, "text": " we've looked at before where you need to remember five randomly selected numbers" }, { "start": 2656.96, "end": 2662.4, "text": " that are indicated by the second dimension here they show a sequence" }, { "start": 2662.4, "end": 2670.12, "text": " where the five numbers occur at 3100 246 at 300 and at 376 so these are the five" }, { "start": 2670.12, "end": 2675.48, "text": " positions where the sequence indicates that the network should remember the" }, { "start": 2675.48, "end": 2681.88, "text": " thing in the first dimension and then output they analyze two things they" }, { "start": 2681.88, "end": 2685.76, "text": " analyze the proportion of bi-stable neurons so basically they analyze these" }, { "start": 2685.76, "end": 2691.96, "text": " out these a quantities and they analyze how many of the neurons in the layer" }, { "start": 2691.96, "end": 2696.68, "text": " have an a that's higher than one which means that they are in this bi-stable" }, { "start": 2696.68, "end": 2702.68, "text": " mode and also they analyze what's the average value of C so see if you" }, { "start": 2702.68, "end": 2707.68, "text": " remember if this is high it means it doesn't let in new information and if" }, { "start": 2707.68, "end": 2712.6, "text": " this is low it means it lets in new information if you first look at the C" }, { "start": 2712.6, "end": 2717.7999999999997, "text": " you can see that every single time when the second dimension indicates that this" }, { "start": 2717.7999999999997, "end": 2722.8399999999997, "text": " is one of the inputs to remember this the network drops immediately drops the" }, { "start": 2722.8399999999997, "end": 2726.8399999999997, "text": " C values the different colors here are different layers they build they have a" }, { "start": 2726.8399999999997, "end": 2732.52, "text": " recurrent network has multiple layers of these cells as is usual in the" }, { "start": 2732.52, "end": 2738.52, "text": " recurrent neural networks so this C as you can see it goes up pretty quickly" }, { "start": 2738.52, "end": 2744.52, "text": " but then as soon as one of these inputs appear the C drops which basically means" }, { "start": 2744.52, "end": 2749.8, "text": " that the network realizes it now must let in the new information and then it" }, { "start": 2749.8, "end": 2756.44, "text": " immediately shoots back up makes it seem like so the network says okay as long as" }, { "start": 2756.44, "end": 2760.52, "text": " so all of these inputs here they have the negative one in the second dimension" }, { "start": 2760.52, "end": 2764.56, "text": " right so it recognizes it says there's no reason for me to incorporate that" }, { "start": 2764.56, "end": 2769.36, "text": " information it's not important and as soon as the second input comes it" }, { "start": 2769.36, "end": 2774.52, "text": " immediately shoots down again now you can see this here is the last layer of" }, { "start": 2774.52, "end": 2780.24, "text": " the network the highest layer so sort of the highest abstractive information and" }, { "start": 2780.24, "end": 2786.8, "text": " you can see that from input to input this value of C gets higher and higher" }, { "start": 2786.8, "end": 2791.6800000000003, "text": " and these spikes as they go down but they go down to a higher and higher" }, { "start": 2791.6800000000003, "end": 2798.5600000000004, "text": " point which you know is is the fact that it recognizes it needs to let in new" }, { "start": 2798.5600000000004, "end": 2805.4, "text": " information but it lets in less and less new information the more things it needs" }, { "start": 2805.4, "end": 2808.6000000000004, "text": " to remember so not only does it recognize wait I need to remember this" }, { "start": 2808.6000000000004, "end": 2813.0800000000004, "text": " it also recognizes but I probably shouldn't shouldn't you know completely" }, { "start": 2813.08, "end": 2819.84, "text": " forget what I had previously because I it is important for me to remember these" }, { "start": 2819.84, "end": 2824.48, "text": " previous things so that's a pretty cool demonstration the fact that these go" }, { "start": 2824.48, "end": 2830.2799999999997, "text": " down at the input and the fact that generally they go up every time after a" }, { "start": 2830.2799999999997, "end": 2835.7599999999998, "text": " new input is incorporated into the hidden state this basically this shows" }, { "start": 2835.7599999999998, "end": 2841.7999999999997, "text": " that the or this is a pretty good indication that what they're saying is" }, { "start": 2841.8, "end": 2848.2400000000002, "text": " really happening right okay the second thing shows almost the same it shows how" }, { "start": 2848.2400000000002, "end": 2852.6000000000004, "text": " many of these neurons are actually in their bi-stable mode and you can also" }, { "start": 2852.6000000000004, "end": 2860.2400000000002, "text": " see right here that especially in the last layer you can see that the number" }, { "start": 2860.2400000000002, "end": 2866.1200000000003, "text": " of neurons in the bi-stable mode goes up and up and up and up after each of these" }, { "start": 2866.1200000000003, "end": 2871.6400000000003, "text": " steps and these spikes here correspond to always the points where they have to" }, { "start": 2871.64, "end": 2881.3199999999997, "text": " let in new information okay cool so I find that I find this to be pretty cool" }, { "start": 2881.3199999999997, "end": 2885.52, "text": " and I find this last experiment to be the coolest where they can actually show" }, { "start": 2885.52, "end": 2891, "text": " look here there's a pretty good indication that the thing we we build" }, { "start": 2891, "end": 2897.92, "text": " does what we say it does they also actually have a proof here of the" }, { "start": 2897.92, "end": 2903.76, "text": " bi-stability when this a is higher than one I won't go through this right here" }, { "start": 2903.76, "end": 2909.7200000000003, "text": " but if you want you can look at that I'm excited to see what happens with these" }, { "start": 2909.7200000000003, "end": 2913.6, "text": " kinds of architectures in the future because it seems to be a pretty minor" }, { "start": 2913.6, "end": 2919.16, "text": " modification and maybe with a little bit of more modification or if we sort of" }, { "start": 2919.16, "end": 2923.2000000000003, "text": " just tune this a little bit and kind of figure out what we have to do to make" }, { "start": 2923.2, "end": 2929.52, "text": " these things actually compete with the classic GRUs and LSTMs in regimes where" }, { "start": 2929.52, "end": 2934.3599999999997, "text": " a long memory isn't necessary I feel this could be a you know kind of a" }, { "start": 2934.3599999999997, "end": 2940.04, "text": " standard building block in the recurrent neural network toolkit even though it's" }, { "start": 2940.04, "end": 2944.9199999999996, "text": " been sort of outperformed by transformers in previous years alright" }, { "start": 2944.9199999999996, "end": 2950.02, "text": " that was it for me and I hope you had fun with this paper I invite you to" }, { "start": 2950.02, "end": 2953.56, "text": " check it out and bye bye" } ]
8l-TDqpoUQs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
SynFlow: Pruning neural networks without any data by iteratively conserving synaptic flow
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "initialization", "lottery ticket hypothesis", "pruning", "training", "magnitude", "snip", "grasp", "init", "xavier", "glorot", "he", "flow", "layer collapse", "iterative", "recompute", "stepwise", "memory", "fast", "prune", "weights", "feedforward", "layer", "neural network" ]
The Lottery Ticket Hypothesis has shown that it's theoretically possible to prune a neural network at the beginning of training and still achieve good performance, if we only knew which weights to prune away. This paper does not only explain where other attempts at pruning fail, but provides an algorithm that provably reaches maximum compression capacity, all without looking at any data! OUTLINE: 0:00 - Intro & Overview 1:00 - Pruning Neural Networks 3:40 - Lottery Ticket Hypothesis 6:00 - Paper Story Overview 9:45 - Layer Collapse 18:15 - Synaptic Saliency Conservation 23:25 - Connecting Layer Collapse & Saliency Conservation 28:30 - Iterative Pruning avoids Layer Collapse 33:20 - The SynFlow Algorithm 40:45 - Experiments 43:35 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.05467 Code: https://github.com/ganguli-lab/Synaptic-Flow My Video on the Lottery Ticket Hypothesis: https://youtu.be/ZVVnvZdUMUk Street Talk about LTH: https://youtu.be/SfjJoevBbjU Abstract: Pruning the parameters of deep neural networks has generated intense interest due to potential savings in time, memory and energy both during training and at test time. Recent works have identified, through an expensive sequence of training and pruning cycles, the existence of winning lottery tickets or sparse trainable subnetworks at initialization. This raises a foundational question: can we identify highly sparse trainable subnetworks at initialization, without ever training, or indeed without ever looking at the data? We provide an affirmative answer to this question through theory driven algorithm design. We first mathematically formulate and experimentally verify a conservation law that explains why existing gradient-based pruning algorithms at initialization suffer from layer-collapse, the premature pruning of an entire layer rendering a network untrainable. This theory also elucidates how layer-collapse can be entirely avoided, motivating a novel pruning algorithm Iterative Synaptic Flow Pruning (SynFlow). This algorithm can be interpreted as preserving the total flow of synaptic strengths through the network at initialization subject to a sparsity constraint. Notably, this algorithm makes no reference to the training data and consistently outperforms existing state-of-the-art pruning algorithms at initialization over a range of models (VGG and ResNet), datasets (CIFAR-10/100 and Tiny ImageNet), and sparsity constraints (up to 99.9 percent). Thus our data-agnostic pruning algorithm challenges the existing paradigm that data must be used to quantify which synapses are important. Authors: Hidenori Tanaka, Daniel Kunin, Daniel L. K. Yamins, Surya Ganguli Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're looking at pruning neural networks without any data by iteratively conserving synaptic flow by Hidenori Tanaka, Daniel Kunin, Daniel L.K. Yamins and Surya Ganguly. So this paper on a high level does what the lottery ticket hypothesis does, but does so without any data. It prunes a neural network at the beginning and it does so. It's able to do that because it claims that its algorithm avoids this problem called layer collapse and then is based on conserving a quantity they call the synaptic flow. And we're going to look at this and it's a pretty cool algorithm. It seems to work pretty well. As always, if you want to help out, you can share this video and let me know in the comments what you think of it. I do read the comments and I would love to hear from you. Alright, let's dive in. So they're saying, pruning the parameters of deep neural networks has generated intense interest due to potential savings in time, memory and energy, both during training and at test time. Recent works have identified through an expensive sequence of training and pruning cycles, the existence of winning lottery tickets or sparse trainable sub networks at initialization. So what is this paper talking about? If you don't know much about pruning, here is kind of a basic overview. So if you have a neural network that consists of many, many layers of neurons, what you can do, that one way of pruning that, what 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 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 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 buys you mainly two things. So imagine this network right here is much smaller than the original network. So it is less, it uses less storage. So you can potentially, if you want to ship it to like a customer over the internet, you maybe instead of a gigabyte, you only have to transfer a few megabytes. And that's pretty cool. The second thing, if you prune in the correct way, you can also make it faster because now there's less weights to multiply with, you can actually make it go faster. So pruning is a now this this and it combines with techniques called distillation and so on is our ways to make the networks smaller and faster. So if your customers are for example, on on mobile phones, then you can ship you can train a big network to a good performance on your big GPU server, and then ship it out to a mobile phone. Once it's small, and it will perform fairly well on that mobile phone without GPU. So what about this other way? Now, in order to do the other way, we would sort of have to have an idea which one of these big networks which sub parts of these layers are the good ones, right in order for us to do this first prune and then train. The interesting thing is that the paper the lottery ticket hypothesis, I've done a video on this and we've also interviewed the author on our ML Street talk podcast. This paper has shown that this is in fact possible. A long time people have thought we need the big network in order to train, right? We sort of the bigness of the network, the full connectedness of the network is required for the training dynamics. But this paper has shown this is not possible, you can prune at the very beginning. Now, what does it do? It first trains a neural network, like in the olden days, then it prunes the neural network. And then it remembers which connections of the train neural network it has pruned. And then it simply goes back to the beginning of training right here, up here, and says, I now know which connections are important. And I'm simply going to prune all the other connections other than these ones. And then interestingly, if you prune first, and then train, that works just as well and can actually work even better. The interesting thing here is that I mean, this is a big, big cycle. But the interesting thing that the paper demonstrates is that this is even possible, right? People thought it wasn't possible. And this paper demonstrates if you only knew if you only knew which ones you must retain, you can prune at the beginning of training. The lottery ticket hypothesis paper, though still requires to actually train the full network and then do the pruning, like in a classic way in order to find out which ones you need to prune and which ones you don't. This paper right here takes that idea and says, can we find can we find a pruning algorithm that prunes at the beginning of training, yet does not have to train the full network, in fact, doesn't look at any of the data? Okay, and this is are 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. Well, as we go through the paper. So first, they named this problem called layer collapse. Now, layer collapse is going to be whenever a pruning algorithm removes the entirety of a neural network layer, which means that no information can flow anymore. And therefore the network can't train. And they claim that this is the main problem, why these current pruning algorithms cannot achieve very high pruning ratios, so can like very high compression ratios is because they do premature layer collapse, they then formulate this maximal critical critical compression axiom that has sort of a guiding principle to build pruning algorithms. Second, they show that this quantity called synaptic saliency, a general class of gradient based scores for pruning is conserved at every hidden unit layer of a neural network. So they show that these are conserved. And they show this because this is their, their argument is going to be first, the argument is layer collapse is a problem. The second argument is these things are conserved and these, the conservation of the synaptic saliency leads to the layer collapse. And we're going to see how that happens. And then third, they say the solution to that is iterative pruning. So they show this at the at the example of iterative magnitude pruning, which we know avoids layer collapse. So iterative magnitude pruning is something that happens in this lottery ticket way of of doing it. This lottery ticket way, you can actually do it not in one step, but it tends to work better when you want to go from 100% of your weights to just 5% of your weights, it tends to work better if you do it in stages. So first you go to 90% to 80 to 70 and so on down to your desired thing. And this iterative procedure, they claim is what is what circumvents this problem of layer collapse. And then at last, they say we proved that a pruning algorithm avoids layer collapse entirely and satisfies blah blah blah, if it uses iterative positive synaptic saliency scores. So they bring it all together and say, if an algorithm satisfies our axiom, and if the algorithm is an algorithm that uses these saliency scores, like this one here, and if the algorithm is iterative, then it is not going to be subject to layer collapse. And therefore, it is going to be able to compress to a very high compression ratio. And then they actually do suggest an algorithm, this iterative synaptic flow pruning, SYNFLOW, 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 collapse is a problem. Second, why is layer collapse a problem? It's because of this synaptic saliency conservation. Third, we can avoid it by doing iterative pruning. And lastly, this algorithm does it without looking at data. Okay, so layer, layer collapse, layer collapse is a pretty simple phenomenon. I've already said it, if you have a neural network, and it has a bunch of layers, and let's draw a couple of neurons here, and the neurons are connected to each other via connections, connections, connections, connections. And you have a pruning algorithm. Now the pruning 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 at some point, they look at the neural network, and they assign a score to each of these weights. Like they'll say, you're a 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 111213 here. Okay, so and then you're in you're in this situation right here. And the algorithm is pretty, is 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't just retain a layer like a connection. For example, if this were a connection, there would also be no information flow because you'd have no outgoing connection here. But ultimately, layer collapse is whenever an entire layer is removed. Okay. And they they do say somewhere that that's the case. I think layer collapse here, layer collapse occurs when an algorithm prunes all parameters in a single weight layer, even when prunable parameters remain elsewhere in the network. So I'm not as such, I'm not sure that this is like a giant problem. It gets to be a problem. But it could be circumvented fairly easily, right by simply saying, if you're about to prune a connection that's integral to the information flow from the start to the end, don't prune that connection, prune some other connection, right, and then you could simply avoid that. And I'd be interested in how that works out. So but in this case, for purposes of this paper, they simply consider algorithms that assign a score and then prune the bottom couple of percent, okay, for so we don't want any like handcrafted rules in here or something. So they look at this quantity called the max compression. The max compression is a quantity that's basically the maximum achievable compression while still avoiding layer collapse. And they say, for example, for a network with L layers and n parameters, the max compression is n over L, which is basically means every layer only has one parameter remaining and therefore, and 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 or 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 grasp 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 grasp even involves the Hessian right here. So they're fairly, you know, complex method that have some thoughts behind them about why they do what they do, yet they all induce layer collapse before they actually have to. So they define this thing here called the critical compression. The critical compression is the maximal compression ratio a given algorithm can achieve without inducing layer collapse. So the critical compression here is basically whenever that algorithm goes to zero, that's the critical compression. That's kind of the farthest you can push the algorithm without him without sorry, German speaker, without it induced without it inducing layer collapse. Okay, so you can see that for these baseline algorithms, the layer collapse occurs way below the theoretically possible max compression. And we're going to see that in their algorithm, this sin flow, that this max compression is achieved. And it's actually achieved without any of these handcrafted rules that I mentioned, it is the algorithm by design already achieved this maximum compression ratio. So they formulate this here as a guiding principle, they formulate as an axiom, I would, I would rather say it's like this kind of a, it's kind of a guiding principle of building these algorithms that any algorithm you build should have. So the critical compression ratio of a pruning algorithm applied to a network should always equal the max compression of that network. It basically means when you build a pruning algorithm, if you push that pruning algorithm to its limits, it should not do layer collapse unless it absolutely needs to. Okay. Again, the extent of this problem, I don't, I don't know, but they do demonstrate that that they can push their algorithm a fair bit further. Now, without inducing layer collapse, you already see that these other algorithms, like in this regime, apparently layer collapse hasn't happened yet because they still have sizeable accuracy, but there's still, 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 it were only layer collapse, what you'll see is that they do the same, the same, the same, and then at some point it's like, boom, now I have layer collapse. Okay. Yeah. So the layer collapse story, I'm not sure, but it's part of the story. So let's, let's go with that. The second part, which is kind of disconnected. So they established two things. They established a layer collapse problem, and now they establish the synaptic saliency, which then later they're going to connect to the layer collapse. So the synaptic saliency, they say is a score, is any score metric that can be expressed as the Hadamard product of this thing with the parameters. Okay. So each parameter is going to be multiplied by the gradient of some function with respect to that parameter. They say where R is a scalar loss function of the output of a feed forward neural network parameterized by theta. Okay. So many of these pruning algorithms can be formulated in this framework right here. And their, their algorithm can also be formulated in this framework. So you can see the score that the algorithm assigns to a weight can be defined as such. And as I said, many fall into this category or are similar to this, especially for example, they say when R is the training loss L. So this is the simplest case you take, you put data through the network, and then you take the training loss of that data and you sort of back propagate it. And now you're going to prune these connections according to how big the gradient is. If you say the gradient is very big, that must mean the connection is very important because there's lots of information flowing through it. So if it's a training loss L, the resulting synaptic saliency metric is equivalent to the score metric used in skeletonization, one of the first network pruning algorithms. The resulting metrics metric is also closely related to this right here. Now this you can see it's not exactly the same, but it's closely related to the one used in this snip baseline and also closely related to this thing right here used in grasp, where it's not just the gradient, it's actually the gradient multiplied by the Hessian to account for curvature. Okay, so they're going to investigate this synaptic saliency in neural networks. They formulate two theorems right here about the conservation of synaptic saliency. Remember synaptic saliency is any score that respects this that is built like this, any score S. The conservation of synaptic saliency, all synaptic saliency metrics respect two surprising conservation laws that hold at any initialization and step in training. So these are not usually like in distribution or something like this with high probability. These things hold at any point in the neural network. First is the neuron wise conservation of synaptic saliency. For a feet forward neural network with homogeneous activation functions and a homogeneous activation function is an activation function that can be expressed like this, for example, relu's 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 feet 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 it can also apply to like a group of layers and so on. But the synaptic saliency is conserved in that way. Now, why is that important? And here is where we make the connection with the layer. Was it later drop layer? Whatever. Okay, the fact that the fact that these algorithms tend to drop entire layers before they have to, if you have in your network layers that are of different sizes, so you have large layers, and then smaller layers and smaller layers, what will happen is that since the synaptic saliency is conserved, the sum is conserved, if you have more connections in one layer, so lots of connections, lots of connections, and in the small layers, you don't have as many connections, the sum is equal. So that means each individual one here is much, much smaller. So the S is very small for each individual one here, and the S is very large in there. That means the pruning algorithm is going to really, really kill off these connections in the big layers. And it's actually going to kill them off to a point where it probably is going to eliminate that layer before it even prunes many of the connections of the small layer, just because of that conservation fact. And they do experiments like this. I think there's an experiment up here where I like this one down here better, where they basically show that you have inverse layer size on the bottom, and you have the average score that the pruning algorithm assigns to any connection. Now, these, as we've seen, they're not exactly assigning the scores of this saliency, but they're very close to it. The Synflow algorithm does exactly assign the synaptic saliency as the score for the pruning. Now, we've basically seen that this leads to a bad result, but the synaptic flow is going to compensate for that. But in essence, as you can see, as the layers get, so inverse layer size grows, which means that layer size shrinks as the layer size gets smaller, the average score of the connections in the layer is higher and higher, which basically means that the pruning algorithm, if you just let it go by itself, it's going to kill off the smaller, sorry, the larger layers first because they have the smaller scores. And you can see that even though the other algorithms don't conform exactly to that, they conform to this approximately. So these here, because their score is closely related to what the Synflow does, and the magnitude pruning, because mostly, because now I'm not sure if that's at the end of the training, at the beginning of the training, if you just initialize, then the score is going to be proportional to 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 a higher initialization constant to layers that have the lower number of parameters. So even the magnitude pruning will conform to this. Now, it might be absolutely reasonable to say that that's also the case at the end of training because most parameters aren't going to move super much during training. So this still approximately holds, as you can see here. Of course, the random one doesn't do that. Yet, because you prune randomly, you're still absolutely subject to this layer collapse. In fact, in the random one, the smallest layers would be the ones to go away first because it's just more probable. Okay. So we've discovered that if you do something like saliency scoring or something that's correlated to it, then you're going to remove the biggest layers first. And that's a problem. And that's what they say. This fact of this conservation laws and the single shot nature of these algorithms that they only assign scores once and then they prune away whatever the bottom such and such percent are leads to layer collapse. 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 retrains 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 in importance to avoid being pruned. So you can see if you push your network to a sorry to a high compression ratio, then if you just do this single shot pruning, you run into this layer collapse at some compression ratio, you simply crash to random performance or zero performance. Yet, if you do multiple iterations, you can see here already two iterations, then it's much longer before you run right here into layer collapse. And if you do three iterations, you do much more. Now this the three iterations doesn't mean you prune more like at this, at this point right here to tend to the one. All of these things prune nine out of every 10 connections. It's just the thing that has three iterations prunes maybe first three and then again, three 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, the smaller we will consider the a differentiable score, this one. So this is not exactly magnitude pruning, but it is very close, right? The squared it's just the square of the parameter instead of the absolute value of the parameter. They say it's algorithmically equivalent to magnitude score. Consider these scores throughout training with gradient descent on a loss function using an infinitesimal step. In this setting, the temporal derivative of the parameters is equivalent to that. And thus the temporal derivative of the score is this. So now they're going to look at how does the score evolve when they train the network and the score evolves exactly as the negative to the saliency. Surprisingly, this is a form of synaptic saliency. And thus the neuron wise and layer wise conservation laws from section four apply. In particular, this implies that for any two layers of a simple fully connected network, then this quantity holds. So 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 small layer, and because it's a big layer, these scores are very much lower, right? It's just little s and here it's big s per layer. But then if you prune away, and you run gradient descent on this, these scores will tend to become bigger. And in this case, these weights will tend to grow in magnitude. Because you've pruned away the others, they now have more signal probably flowing to them and more gradient flowing to them. And therefore they're going to grow in size. And therefore, their score is going to be bigger. So this gradient descent of this iterative procedure makes the scores better for that. So basically counteracts the layer collapse. So they put all of this together and say, theorem three, iterative positive conservative scoring achieves maximal critical compression. If a pruning algorithm with global masking, and global masking means that you rank all of the connections and then prune from all of the connections, it's a difference to 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 your score should be, or if your score is a saliency score, then that's the case. And if the algorithm reevaluates the scores every time a parameter is pruned, then the algorithm satisfies the maximal critical compression axiom. Okay. So that's basically saying that if you have any algorithm that prunes with a saliency score, like theirs is going to do, is going to be able to be pushed to the limit until the maximal capacity is reached if you reevaluate the scores every time a parameter is pruned. So this is basically saying that whatever the lottery ticket hypothesis paper did with magnitude pruning, if you do it with saliency based pruning, you're guaranteed to achieve the maximum possible compression if you 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 SYNFLOW algorithm. They say theorem three directly motivates the design of our novel pruning algorithm. SYNFLOW that provably reaches maximal critical compression. First, the necessity for iterative score evaluation discourages algorithms that involve back propagation on batches of data and instead motivates the development of an efficient data independent scoring procedure. Second, positivity and conservation probably motivates the construction of a loss function that yields positive synaptic saliency scores. We combine these insights and introduce a new loss function where the one is the all one vectors. Okay, so this is the loss function of their saliency scores. And this might seem like... So what do we have? We have the parameters of layer L, the absolute product, sorry, the absolute value of those parameters, and then you simply multiply all of the layers together. And you have this product here with the ones on the side. So this is a quadratic form, sort of. Okay, this might seem a bit weird, but in practice, and this is also what happens in their code, you can do something pretty easy. So first, you have to transform all your weights to their absolute values. Now in their code, you can look at it, they do remember the signs for later. So but first, you convert all of them to their absolute values. Then second, you simply take a data point that is filled with ones that literally the number one. So if your if your input is an image, you just put a one at each pixel, you feed it through the network with all of these positive weights, and you get out some output, you get some output vector, okay, then you simply you need to do this inner product with the one vector, which is simply a sum, right? I don't I don't get why they it's a bit of a funky way of writing a sum, right? You simply sum that up to get a to get a single number. And this single number now is your is your pseudo loss function. It's simply the loss function that an all one data point gets when the when the loss function is just the sum of the outputs. That's that's it. That's it. And then you back propagate that loss to you back propagate that loss to the layers. Right? So this is our remember this is not the score itself, but our score is going to be the derivative of our with respect to a weight times that weight. Okay, so you want to back propagate, and then you multiply each of these weights by the back propagated signal. And that's going to be your score for each parameter. Now, this doesn't seem too hard, right? You just need you don't even need a batch, you need a single data point, one back propagation, and then you get your scores. Okay, you don't need expensive training or anything like this. This seems pretty cool. And they give an example here. For example, for a simple, come on, for a simple fully connected network, ie this, so they consider here a linear network, right, just so we can look at exactly what happens for linear networks, you can often compute quantities exactly. So if we look at just a linear network without nonlinearities, we can factor the synaptic flow score for any parameter as such. So the score, this is now not the the R, this is going to be the score is going to be this thing right here. So you can see that the parameter is multiplied by this thing, and by this thing. And other than for example, magnitude pruning, this actually takes into account all the input flow because it goes from this one, sorry, 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 score is going to depend on all of these paths, all of these all of the information flow from input to output that goes through that weight. And if you do this, then you get a really good pruning algorithm. So yeah, the algorithm is is I've already described it. And in their experiments, as you can see right now, they have a bunch of networks, these VGG networks, or like wide resnet, they have a bunch of data sets like tiny image net or C for 10, 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 data sets, that the baselines crash at some point as well. Now I've already said the comparison here, it seems a little bit unfair. I might I might have over read something, but I'm pretty sure that the baselines remain single shot, while the sin flow algorithm here is now of course, no longer single shot, it's actually multi shot, and they've made the exact argument that the single shot is the problem. And therefore their algorithm is multi multi shot. And it 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 any anything. So it, you know, it just seems like the comparison is a bit unfair. If you identify the problem, and then just leave the other algorithms with the problem, sin flow is still different from these other algorithms, even if they had the multiple steps. Now, the counter argument to this, of course, is that these other algorithms all require the training data, they require actually passing the data or training the network in the case of magnitude pruning and so on. So that's pretty expensive, whereas sin flow, you simply pass forward one data point, and that's it. That's a good argument. But it seems like the effect of the synaptic saliency scores, and the effect of the multiple steps aren't really disentangled in these experiments right here, it simply shows that it consistently outperforms other pruning methods. And what 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 line of work into pruning at the beginning of training without looking at data. And maybe, you know, maybe we can even think of building networks, like, instead of just pruning them, we can think of constructively building networks that observe these properties. And therefore, we can just construct initialized networks already with good properties such that we don't even have to go to a bigger network and then prune it down. It seems wasteful. It seems like we should just be able to derive principles of what we want in the how the weights are structured, and then construct networks that are according to that. And I guess that's what's going to happen in a few papers that are coming. Alright, again, if you 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, "end": 6.24, "text": " Hi there! Today we're looking at pruning neural networks without any data by iteratively conserving" }, { "start": 6.24, "end": 14.74, "text": " synaptic flow by Hidenori Tanaka, Daniel Kunin, Daniel L.K. Yamins and Surya Ganguly. So this" }, { "start": 14.74, "end": 20.48, "text": " paper on a high level does what the lottery ticket hypothesis does, but does so without" }, { "start": 20.48, "end": 26.44, "text": " any data. It prunes a neural network at the beginning and it does so. It's able to do" }, { "start": 26.44, "end": 32.44, "text": " that because it claims that its algorithm avoids this problem called layer collapse" }, { "start": 32.44, "end": 39.68, "text": " and then is based on conserving a quantity they call the synaptic flow. And we're going" }, { "start": 39.68, "end": 45.88, "text": " to look at this and it's a pretty cool algorithm. It seems to work pretty well. As always, if" }, { "start": 45.88, "end": 52.56, "text": " you want to help out, you can share this video and let me know in the comments what you think" }, { "start": 52.56, "end": 59.92, "text": " of it. I do read the comments and I would love to hear from you. Alright, let's dive" }, { "start": 59.92, "end": 65.74000000000001, "text": " in. So they're saying, pruning the parameters of deep neural networks has generated intense" }, { "start": 65.74000000000001, "end": 72.08, "text": " interest due to potential savings in time, memory and energy, both during training and" }, { "start": 72.08, "end": 77.64, "text": " at test time. Recent works have identified through an expensive sequence of training" }, { "start": 77.64, "end": 83.48, "text": " and pruning cycles, the existence of winning lottery tickets or sparse trainable sub networks" }, { "start": 83.48, "end": 90.88, "text": " at initialization. So what is this paper talking about? If you don't know much about pruning," }, { "start": 90.88, "end": 96.36, "text": " here is kind of a basic overview. So if you have a neural network that consists of many," }, { "start": 96.36, "end": 102.84, "text": " many layers of neurons, what you can do, that one way of pruning that, what the goal is," }, { "start": 102.84, "end": 110.28, "text": " is to end up with a small neural network that performs well. But for now, we have a big" }, { "start": 110.28, "end": 115.16, "text": " neural network that doesn't perform well. It hasn't been trained yet, right? So what" }, { "start": 115.16, "end": 121.52000000000001, "text": " you can do is you can first train the neural network. And then you have a big neural network" }, { "start": 121.52000000000001, "end": 128.44, "text": " that performs well, and then you can prune it. Now, a lot of times, a lot of the time" }, { "start": 128.44, "end": 133.68, "text": " this has been seen as sort of the pruning way. You would train the big neural network" }, { "start": 133.68, "end": 140.16, "text": " and then you would prune it, because the other way was not feasible. First pruning and then" }, { "start": 140.16, "end": 146.98, "text": " training was not feasible. You might ask, okay, we might just want to start with a small" }, { "start": 146.98, "end": 153.76, "text": " one. And yeah, that's correct. So what does this first way buy you? This first way buys" }, { "start": 153.76, "end": 160.35999999999999, "text": " you mainly two things. So imagine this network right here is much smaller than the original" }, { "start": 160.35999999999999, "end": 166.88, "text": " network. So it is less, it uses less storage. So you can potentially, if you want to ship" }, { "start": 166.88, "end": 172.16, "text": " it to like a customer over the internet, you maybe instead of a gigabyte, you only have" }, { "start": 172.16, "end": 178.68, "text": " to transfer a few megabytes. And that's pretty cool. The second thing, if you prune in the" }, { "start": 178.68, "end": 185.28, "text": " correct way, you can also make it faster because now there's less weights to multiply with," }, { "start": 185.28, "end": 192.52, "text": " you can actually make it go faster. So pruning is a now this this and it combines with techniques" }, { "start": 192.52, "end": 198.56, "text": " called distillation and so on is our ways to make the networks smaller and faster. So" }, { "start": 198.56, "end": 205.44, "text": " if your customers are for example, on on mobile phones, then you can ship you can train a big" }, { "start": 205.44, "end": 210.56, "text": " network to a good performance on your big GPU server, and then ship it out to a mobile" }, { "start": 210.56, "end": 218.64, "text": " phone. Once it's small, and it will perform fairly well on that mobile phone without GPU." }, { "start": 218.64, "end": 224.92, "text": " So what about this other way? Now, in order to do the other way, we would sort of have" }, { "start": 224.92, "end": 232.8, "text": " to have an idea which one of these big networks which sub parts of these layers are the good" }, { "start": 232.8, "end": 238.08, "text": " ones, right in order for us to do this first prune and then train. The interesting thing" }, { "start": 238.08, "end": 244, "text": " is that the paper the lottery ticket hypothesis, I've done a video on this and we've also interviewed" }, { "start": 244, "end": 249.64000000000001, "text": " the author on our ML Street talk podcast. This paper has shown that this is in fact" }, { "start": 249.64000000000001, "end": 254.72000000000003, "text": " possible. A long time people have thought we need the big network in order to train," }, { "start": 254.72000000000003, "end": 261.1, "text": " right? We sort of the bigness of the network, the full connectedness of the network is required" }, { "start": 261.1, "end": 265.20000000000005, "text": " for the training dynamics. But this paper has shown this is not possible, you can prune" }, { "start": 265.20000000000005, "end": 272.36, "text": " at the very beginning. Now, what does it do? It first trains a neural network, like in" }, { "start": 272.36, "end": 278.88, "text": " the olden days, then it prunes the neural network. And then it remembers which connections" }, { "start": 278.88, "end": 283.92, "text": " of the train neural network it has pruned. And then it simply goes back to the beginning" }, { "start": 283.92, "end": 289.52000000000004, "text": " of training right here, up here, and says, I now know which connections are important." }, { "start": 289.52, "end": 294.96, "text": " And I'm simply going to prune all the other connections other than these ones. And then" }, { "start": 294.96, "end": 301.91999999999996, "text": " interestingly, if you prune first, and then train, that works just as well and can actually" }, { "start": 301.91999999999996, "end": 308.03999999999996, "text": " work even better. The interesting thing here is that I mean, this is a big, big cycle." }, { "start": 308.03999999999996, "end": 315.02, "text": " But the interesting thing that the paper demonstrates is that this is even possible, right? People" }, { "start": 315.02, "end": 320.44, "text": " thought it wasn't possible. And this paper demonstrates if you only knew if you only" }, { "start": 320.44, "end": 327.21999999999997, "text": " knew which ones you must retain, you can prune at the beginning of training. The lottery" }, { "start": 327.21999999999997, "end": 332.79999999999995, "text": " ticket hypothesis paper, though still requires to actually train the full network and then" }, { "start": 332.79999999999995, "end": 338.84, "text": " do the pruning, like in a classic way in order to find out which ones you need to prune and" }, { "start": 338.84, "end": 346.91999999999996, "text": " which ones you don't. This paper right here takes that idea and says, can we find can" }, { "start": 346.91999999999996, "end": 352.96, "text": " we find a pruning algorithm that prunes at the beginning of training, yet does not have" }, { "start": 352.96, "end": 358.88, "text": " to train the full network, in fact, doesn't look at any of the data? Okay, and this is" }, { "start": 358.88, "end": 364.88, "text": " are going to be our starting point. So their story is going to be, it's quite an involved" }, { "start": 364.88, "end": 372.28, "text": " story. And I think the overview is important. Well, as we go through the paper. So first," }, { "start": 372.28, "end": 379.52, "text": " they named this problem called layer collapse. Now, layer collapse is going to be whenever" }, { "start": 379.52, "end": 385.48, "text": " a pruning algorithm removes the entirety of a neural network layer, which means that no" }, { "start": 385.48, "end": 390.4, "text": " information can flow anymore. And therefore the network can't train. And they claim that" }, { "start": 390.4, "end": 398.12, "text": " this is the main problem, why these current pruning algorithms cannot achieve very high" }, { "start": 398.12, "end": 404.28, "text": " pruning ratios, so can like very high compression ratios is because they do premature layer" }, { "start": 404.28, "end": 412.44, "text": " collapse, they then formulate this maximal critical critical compression axiom that has" }, { "start": 412.44, "end": 419.91999999999996, "text": " sort of a guiding principle to build pruning algorithms. Second, they show that this quantity" }, { "start": 419.92, "end": 425.36, "text": " called synaptic saliency, a general class of gradient based scores for pruning is conserved" }, { "start": 425.36, "end": 431.76, "text": " at every hidden unit layer of a neural network. So they show that these are conserved. And" }, { "start": 431.76, "end": 437.76, "text": " they show this because this is their, their argument is going to be first, the argument" }, { "start": 437.76, "end": 444.20000000000005, "text": " is layer collapse is a problem. The second argument is these things are conserved and" }, { "start": 444.2, "end": 451.03999999999996, "text": " these, the conservation of the synaptic saliency leads to the layer collapse. And we're going" }, { "start": 451.03999999999996, "end": 460.34, "text": " to see how that happens. And then third, they say the solution to that is iterative pruning." }, { "start": 460.34, "end": 466.56, "text": " So they show this at the at the example of iterative magnitude pruning, which we know" }, { "start": 466.56, "end": 471.8, "text": " avoids layer collapse. So iterative magnitude pruning is something that happens in this" }, { "start": 471.8, "end": 479.68, "text": " lottery ticket way of of doing it. This lottery ticket way, you can actually do it not in" }, { "start": 479.68, "end": 485.28000000000003, "text": " one step, but it tends to work better when you want to go from 100% of your weights to" }, { "start": 485.28000000000003, "end": 490.12, "text": " just 5% of your weights, it tends to work better if you do it in stages. So first you" }, { "start": 490.12, "end": 499.40000000000003, "text": " go to 90% to 80 to 70 and so on down to your desired thing. And this iterative procedure," }, { "start": 499.4, "end": 511.09999999999997, "text": " they claim is what is what circumvents this problem of layer collapse. And then at last," }, { "start": 511.09999999999997, "end": 517.4399999999999, "text": " they say we proved that a pruning algorithm avoids layer collapse entirely and satisfies" }, { "start": 517.4399999999999, "end": 524.3, "text": " blah blah blah, if it uses iterative positive synaptic saliency scores. So they bring it" }, { "start": 524.3, "end": 533.4399999999999, "text": " all together and say, if an algorithm satisfies our axiom, and if the algorithm is an algorithm" }, { "start": 533.4399999999999, "end": 541.16, "text": " that uses these saliency scores, like this one here, and if the algorithm is iterative," }, { "start": 541.16, "end": 546.3, "text": " then it is not going to be subject to layer collapse. And therefore, it is going to be" }, { "start": 546.3, "end": 553.56, "text": " able to compress to a very high compression ratio. And then they actually do suggest an" }, { "start": 553.56, "end": 561.4799999999999, "text": " algorithm, this iterative synaptic flow pruning, SYNFLOW, that does all of this and never looks" }, { "start": 561.4799999999999, "end": 568.4399999999999, "text": " at any data. All right, this is quite a story. But remember what we're doing. First, layer" }, { "start": 568.4399999999999, "end": 573.3199999999999, "text": " collapse is a problem. Second, why is layer collapse a problem? It's because of this synaptic" }, { "start": 573.3199999999999, "end": 580.3199999999999, "text": " saliency conservation. Third, we can avoid it by doing iterative pruning. And lastly," }, { "start": 580.32, "end": 590.72, "text": " this algorithm does it without looking at data. Okay, so layer, layer collapse, layer" }, { "start": 590.72, "end": 596.7600000000001, "text": " collapse is a pretty simple phenomenon. I've already said it, if you have a neural network," }, { "start": 596.7600000000001, "end": 602.6800000000001, "text": " and it has a bunch of layers, and let's draw a couple of neurons here, and the neurons" }, { "start": 602.6800000000001, "end": 610.08, "text": " are connected to each other via connections, connections, connections, connections. And" }, { "start": 610.08, "end": 614.5200000000001, "text": " you have a pruning algorithm. Now the pruning algorithms they consider here are so called" }, { "start": 614.5200000000001, "end": 618.0400000000001, "text": " single shot pruning algorithms. What they do is they look at the neural network, and" }, { "start": 618.0400000000001, "end": 623.5200000000001, "text": " this can be before training or after training. But at some point, they look at the neural" }, { "start": 623.5200000000001, "end": 630.6800000000001, "text": " network, and they assign a score to each of these weights. Like they'll say, you're a" }, { "start": 630.6800000000001, "end": 637.6800000000001, "text": " one, you're a five, you're a nine, and so on. And then they simply prune away the lowest" }, { "start": 637.68, "end": 643.16, "text": " scores. Okay, and you tell the network what compression ratio you want to you tell the" }, { "start": 643.16, "end": 648.8399999999999, "text": " network, for example, please prune away 90% of the connections. So these algorithms would" }, { "start": 648.8399999999999, "end": 656.3199999999999, "text": " look would assign the scores once and then remove the bottom 90% of weights. Okay, like" }, { "start": 656.3199999999999, "end": 664.1999999999999, "text": " this. So those are the single shot pruning algorithms. Now what is layer collapse? Layer" }, { "start": 664.2, "end": 671, "text": " collapse is whenever an algorithm removes all of one layer, because maybe so here was" }, { "start": 671, "end": 679.8000000000001, "text": " a nine, maybe you have like 111213 here. Okay, so and then you're in you're in this situation" }, { "start": 679.8000000000001, "end": 684.6800000000001, "text": " right here. And the algorithm is pretty, is pretty dumb. It's simply removing the bottom" }, { "start": 684.6800000000001, "end": 690.1600000000001, "text": " 90% of the connections. And here it figures I need to remove one more to meet that goal." }, { "start": 690.16, "end": 694.16, "text": " I remove the one with the lowest score, I'm going to remove this one. And it's pretty obvious" }, { "start": 694.16, "end": 700.24, "text": " that now no more information can flow from the beginning to the end of the network because," }, { "start": 700.24, "end": 706.4399999999999, "text": " well, what's where is it going to flow to? It's a bit more complex than that. Like, you" }, { "start": 706.4399999999999, "end": 711.1999999999999, "text": " can't just retain a layer like a connection. For example, if this were a connection, there" }, { "start": 711.1999999999999, "end": 715.48, "text": " would also be no information flow because you'd have no outgoing connection here. But" }, { "start": 715.48, "end": 725.88, "text": " ultimately, layer collapse is whenever an entire layer is removed. Okay. And they they" }, { "start": 725.88, "end": 734.84, "text": " do say somewhere that that's the case. I think layer collapse here, layer collapse occurs" }, { "start": 734.84, "end": 740.38, "text": " when an algorithm prunes all parameters in a single weight layer, even when prunable" }, { "start": 740.38, "end": 747.4399999999999, "text": " parameters remain elsewhere in the network. So I'm not as such, I'm not sure that this" }, { "start": 747.4399999999999, "end": 754.28, "text": " is like a giant problem. It gets to be a problem. But it could be circumvented fairly easily," }, { "start": 754.28, "end": 759.52, "text": " right by simply saying, if you're about to prune a connection that's integral to the" }, { "start": 759.52, "end": 764.16, "text": " information flow from the start to the end, don't prune that connection, prune some other" }, { "start": 764.16, "end": 769.44, "text": " connection, right, and then you could simply avoid that. And I'd be interested in how that" }, { "start": 769.44, "end": 776.8800000000001, "text": " works out. So but in this case, for purposes of this paper, they simply consider algorithms" }, { "start": 776.8800000000001, "end": 782.8000000000001, "text": " that assign a score and then prune the bottom couple of percent, okay, for so we don't want" }, { "start": 782.8000000000001, "end": 789.96, "text": " any like handcrafted rules in here or something. So they look at this quantity called the max" }, { "start": 789.96, "end": 797.12, "text": " compression. The max compression is a quantity that's basically the maximum achievable compression" }, { "start": 797.12, "end": 802.12, "text": " while still avoiding layer collapse. And they say, for example, for a network with L layers" }, { "start": 802.12, "end": 807.84, "text": " and n parameters, the max compression is n over L, which is basically means every layer" }, { "start": 807.84, "end": 816.64, "text": " only has one parameter remaining and therefore, and if it's the correct one, therefore information" }, { "start": 816.64, "end": 822.48, "text": " can flow from start to the end. All right, so this is the maximum achievable compression," }, { "start": 822.48, "end": 827.64, "text": " anything beyond that would automatically induce layer collapse. Now, anything before that" }, { "start": 827.64, "end": 833.76, "text": " could induce layer collapse, but there is a way to compress the network to the same" }, { "start": 833.76, "end": 838.08, "text": " level without inducing layer collapse. And their point is basically that these other" }, { "start": 838.08, "end": 843.88, "text": " compression algorithms that they compare with, they always they always induce layer collapse" }, { "start": 843.88, "end": 849.48, "text": " before they actually have to because they cut off a connection that leads to layer collapse" }, { "start": 849.48, "end": 855.2, "text": " before they like there would be another connection that they could cut off that would not lead" }, { "start": 855.2, "end": 860.8000000000001, "text": " to layer collapse. And of course, if you are layer, if you have done a layer collapse," }, { "start": 860.8000000000001, "end": 867.04, "text": " then you accuracy immediately drops to zero or to random, because no more information" }, { "start": 867.04, "end": 872.64, "text": " flow. So they look at these things here, random pruning is where you simply assign a random" }, { "start": 872.64, "end": 879.4, "text": " score to each connection. Magnitude pruning is what the lottery ticket hypothesis does," }, { "start": 879.4, "end": 886.76, "text": " but just they look here at a single shot. So you simply look at the magnitude of the" }, { "start": 886.76, "end": 890.88, "text": " weights and this can be before or after training. I think they do it after training here, which" }, { "start": 890.88, "end": 896.36, "text": " is classically done. You look at the magnitude of the weights and you prune the bottom 90%" }, { "start": 896.36, "end": 904.0799999999999, "text": " away. They there are also two more advanced methods, these SNIP and the grasp piece of" }, { "start": 904.08, "end": 911.96, "text": " SNIP and grasp, which look at the gradient of the training loss in the network and they" }, { "start": 911.96, "end": 917.2800000000001, "text": " decide according to that gradient, which which things to cut and which things not to cut" }, { "start": 917.2800000000001, "end": 925.08, "text": " away. The grasp even involves the Hessian right here. So they're fairly, you know, complex" }, { "start": 925.08, "end": 930.72, "text": " method that have some thoughts behind them about why they do what they do, yet they all" }, { "start": 930.72, "end": 936.08, "text": " induce layer collapse before they actually have to. So they define this thing here called" }, { "start": 936.08, "end": 943.6800000000001, "text": " the critical compression. The critical compression is the maximal compression ratio a given algorithm" }, { "start": 943.6800000000001, "end": 948.34, "text": " can achieve without inducing layer collapse. So the critical compression here is basically" }, { "start": 948.34, "end": 952.96, "text": " whenever that algorithm goes to zero, that's the critical compression. That's kind of the" }, { "start": 952.96, "end": 960.6, "text": " farthest you can push the algorithm without him without sorry, German speaker, without" }, { "start": 960.6, "end": 967.24, "text": " it induced without it inducing layer collapse. Okay, so you can see that for these baseline" }, { "start": 967.24, "end": 974.24, "text": " algorithms, the layer collapse occurs way below the theoretically possible max compression." }, { "start": 974.24, "end": 979.32, "text": " And we're going to see that in their algorithm, this sin flow, that this max compression is" }, { "start": 979.32, "end": 984.6800000000001, "text": " achieved. And it's actually achieved without any of these handcrafted rules that I mentioned," }, { "start": 984.6800000000001, "end": 991, "text": " it is the algorithm by design already achieved this maximum compression ratio. So they formulate" }, { "start": 991, "end": 995.5200000000001, "text": " this here as a guiding principle, they formulate as an axiom, I would, I would rather say it's" }, { "start": 995.5200000000001, "end": 1002.12, "text": " like this kind of a, it's kind of a guiding principle of building these algorithms that" }, { "start": 1002.12, "end": 1008.1600000000001, "text": " any algorithm you build should have. So the critical compression ratio of a pruning algorithm" }, { "start": 1008.16, "end": 1013.4, "text": " applied to a network should always equal the max compression of that network. It basically" }, { "start": 1013.4, "end": 1018.6, "text": " means when you build a pruning algorithm, if you push that pruning algorithm to its" }, { "start": 1018.6, "end": 1028.72, "text": " limits, it should not do layer collapse unless it absolutely needs to. Okay. Again, the extent" }, { "start": 1028.72, "end": 1033.98, "text": " of this problem, I don't, I don't know, but they do demonstrate that that they can push" }, { "start": 1033.98, "end": 1040.64, "text": " their algorithm a fair bit further. Now, without inducing layer collapse, you already see that" }, { "start": 1040.64, "end": 1044.96, "text": " these other algorithms, like in this regime, apparently layer collapse hasn't happened" }, { "start": 1044.96, "end": 1050.3600000000001, "text": " yet because they still have sizeable accuracy, but there's still, you know, there is a reasonable" }, { "start": 1050.3600000000001, "end": 1056.4, "text": " difference here between those and the sin flow algorithm. So I'm not too convinced yet" }, { "start": 1056.4, "end": 1062.76, "text": " that layer collapse as such is the problem because they have a difference before their" }, { "start": 1062.76, "end": 1069.08, "text": " layer collapsing, as you can see right here. And I have the feeling that this difference" }, { "start": 1069.08, "end": 1075.28, "text": " here is due to this iterative procedure and not actually due to the phenomenon of layer" }, { "start": 1075.28, "end": 1081.4, "text": " collapse. But yeah, so if it were only layer collapse, what you'll see is that they do" }, { "start": 1081.4, "end": 1085.84, "text": " the same, the same, the same, and then at some point it's like, boom, now I have layer" }, { "start": 1085.84, "end": 1094.12, "text": " collapse. Okay. Yeah. So the layer collapse story, I'm not sure, but it's part of the" }, { "start": 1094.12, "end": 1100.6999999999998, "text": " story. So let's, let's go with that. The second part, which is kind of disconnected. So they" }, { "start": 1100.6999999999998, "end": 1104.8, "text": " established two things. They established a layer collapse problem, and now they establish" }, { "start": 1104.8, "end": 1113.24, "text": " the synaptic saliency, which then later they're going to connect to the layer collapse. So" }, { "start": 1113.24, "end": 1120.18, "text": " the synaptic saliency, they say is a score, is any score metric that can be expressed" }, { "start": 1120.18, "end": 1129.4, "text": " as the Hadamard product of this thing with the parameters. Okay. So each parameter is" }, { "start": 1129.4, "end": 1135.64, "text": " going to be multiplied by the gradient of some function with respect to that parameter." }, { "start": 1135.64, "end": 1142.4, "text": " They say where R is a scalar loss function of the output of a feed forward neural network" }, { "start": 1142.4, "end": 1149.52, "text": " parameterized by theta. Okay. So many of these pruning algorithms can be formulated in this" }, { "start": 1149.52, "end": 1156, "text": " framework right here. And their, their algorithm can also be formulated in this framework." }, { "start": 1156, "end": 1162.3200000000002, "text": " So you can see the score that the algorithm assigns to a weight can be defined as such." }, { "start": 1162.3200000000002, "end": 1171.5600000000002, "text": " And as I said, many fall into this category or are similar to this, especially for example," }, { "start": 1171.56, "end": 1178.48, "text": " they say when R is the training loss L. So this is the simplest case you take, you put" }, { "start": 1178.48, "end": 1183.36, "text": " data through the network, and then you take the training loss of that data and you sort" }, { "start": 1183.36, "end": 1187.96, "text": " of back propagate it. And now you're going to prune these connections according to how" }, { "start": 1187.96, "end": 1193.24, "text": " big the gradient is. If you say the gradient is very big, that must mean the connection" }, { "start": 1193.24, "end": 1199.3799999999999, "text": " is very important because there's lots of information flowing through it. So if it's" }, { "start": 1199.38, "end": 1204.5600000000002, "text": " a training loss L, the resulting synaptic saliency metric is equivalent to the score" }, { "start": 1204.5600000000002, "end": 1210.64, "text": " metric used in skeletonization, one of the first network pruning algorithms. The resulting" }, { "start": 1210.64, "end": 1216.88, "text": " metrics metric is also closely related to this right here. Now this you can see it's" }, { "start": 1216.88, "end": 1222.92, "text": " not exactly the same, but it's closely related to the one used in this snip baseline and" }, { "start": 1222.92, "end": 1231.28, "text": " also closely related to this thing right here used in grasp, where it's not just the gradient," }, { "start": 1231.28, "end": 1240.92, "text": " it's actually the gradient multiplied by the Hessian to account for curvature. Okay, so" }, { "start": 1240.92, "end": 1247.28, "text": " they're going to investigate this synaptic saliency in neural networks. They formulate" }, { "start": 1247.28, "end": 1253.12, "text": " two theorems right here about the conservation of synaptic saliency. Remember synaptic saliency" }, { "start": 1253.12, "end": 1262.44, "text": " is any score that respects this that is built like this, any score S. The conservation of" }, { "start": 1262.44, "end": 1267.84, "text": " synaptic saliency, all synaptic saliency metrics respect two surprising conservation laws that" }, { "start": 1267.84, "end": 1274.16, "text": " hold at any initialization and step in training. So these are not usually like in distribution" }, { "start": 1274.16, "end": 1280.4, "text": " or something like this with high probability. These things hold at any point in the neural" }, { "start": 1280.4, "end": 1287.16, "text": " network. First is the neuron wise conservation of synaptic saliency. For a feet forward neural" }, { "start": 1287.16, "end": 1292.18, "text": " network with homogeneous activation functions and a homogeneous activation function is an" }, { "start": 1292.18, "end": 1298.52, "text": " activation function that can be expressed like this, for example, relu's fall into that" }, { "start": 1298.52, "end": 1306.16, "text": " category, the sum of the synaptic saliency for the incoming parameters is to a hidden" }, { "start": 1306.16, "end": 1311.56, "text": " neuron is equal to the sum of the synaptic saliency for the outgoing parameters from" }, { "start": 1311.56, "end": 1316.32, "text": " the hidden neuron. So what does it mean is actually pretty simple. If you have a hidden" }, { "start": 1316.32, "end": 1323.56, "text": " neuron and you look at all the incoming weights and you look at their synaptic saliency, which" }, { "start": 1323.56, "end": 1329.1599999999999, "text": " is this S score of each of these weights, like what would the pruning algorithm assign" }, { "start": 1329.1599999999999, "end": 1336.3999999999999, "text": " to that? And you look at the outgoing ones, then the sum of all the incoming ones is going" }, { "start": 1336.3999999999999, "end": 1344, "text": " to be equal to the sum of all the outgoing ones. So that's pretty interesting. And they" }, { "start": 1344, "end": 1353.04, "text": " extend that to layer to the entire network. So an extension of that network wise conservation" }, { "start": 1353.04, "end": 1357.96, "text": " of synaptic saliency, the sum of the synaptic saliency across any set of parameters that" }, { "start": 1357.96, "end": 1362.76, "text": " exactly separates the input neurons from the output neurons of a feet forward neural network" }, { "start": 1362.76, "end": 1369.6, "text": " with homogeneous activation functions equals that. So it basically says it remains equal." }, { "start": 1369.6, "end": 1373.48, "text": " So what does it mean? What does it mean to exactly separate the input from the output?" }, { "start": 1373.48, "end": 1377.36, "text": " That's basically the definition of a layer in a neural network. So what they're saying" }, { "start": 1377.36, "end": 1384.3999999999999, "text": " is that you have a bunch of layers. And if you look at a particular layer like this one" }, { "start": 1384.3999999999999, "end": 1392.32, "text": " here, and you look at the incoming connections, and you sum up all of their synaptic saliency," }, { "start": 1392.32, "end": 1398.3999999999999, "text": " that's going to be equal to the sum of all the synaptic saliency of the outgoing connections" }, { "start": 1398.3999999999999, "end": 1404.4399999999998, "text": " of that layer. And it can also apply to like a group of layers and so on. But the synaptic" }, { "start": 1404.44, "end": 1410.76, "text": " saliency is conserved in that way. Now, why is that important? And here is where we make" }, { "start": 1410.76, "end": 1419.88, "text": " the connection with the layer. Was it later drop layer? Whatever. Okay, the fact that" }, { "start": 1419.88, "end": 1426.1200000000001, "text": " the fact that these algorithms tend to drop entire layers before they have to, if you" }, { "start": 1426.1200000000001, "end": 1432.92, "text": " have in your network layers that are of different sizes, so you have large layers, and then" }, { "start": 1432.92, "end": 1439.1200000000001, "text": " smaller layers and smaller layers, what will happen is that since the synaptic saliency" }, { "start": 1439.1200000000001, "end": 1445.3200000000002, "text": " is conserved, the sum is conserved, if you have more connections in one layer, so lots" }, { "start": 1445.3200000000002, "end": 1451.24, "text": " of connections, lots of connections, and in the small layers, you don't have as many connections," }, { "start": 1451.24, "end": 1457.5600000000002, "text": " the sum is equal. So that means each individual one here is much, much smaller. So the S is" }, { "start": 1457.56, "end": 1463.48, "text": " very small for each individual one here, and the S is very large in there. That means the" }, { "start": 1463.48, "end": 1472.32, "text": " pruning algorithm is going to really, really kill off these connections in the big layers." }, { "start": 1472.32, "end": 1477.6399999999999, "text": " And it's actually going to kill them off to a point where it probably is going to eliminate" }, { "start": 1477.6399999999999, "end": 1484.4199999999998, "text": " that layer before it even prunes many of the connections of the small layer, just because" }, { "start": 1484.42, "end": 1494.8000000000002, "text": " of that conservation fact. And they do experiments like this. I think there's an experiment up" }, { "start": 1494.8000000000002, "end": 1506.8400000000001, "text": " here where I like this one down here better, where they basically show that you have inverse" }, { "start": 1506.8400000000001, "end": 1513.5600000000002, "text": " layer size on the bottom, and you have the average score that the pruning algorithm assigns" }, { "start": 1513.56, "end": 1523.24, "text": " to any connection. Now, these, as we've seen, they're not exactly assigning the scores of" }, { "start": 1523.24, "end": 1529.24, "text": " this saliency, but they're very close to it. The Synflow algorithm does exactly assign" }, { "start": 1529.24, "end": 1535.98, "text": " the synaptic saliency as the score for the pruning. Now, we've basically seen that this" }, { "start": 1535.98, "end": 1540.94, "text": " leads to a bad result, but the synaptic flow is going to compensate for that. But in essence," }, { "start": 1540.94, "end": 1547.52, "text": " as you can see, as the layers get, so inverse layer size grows, which means that layer size" }, { "start": 1547.52, "end": 1555.72, "text": " shrinks as the layer size gets smaller, the average score of the connections in the layer" }, { "start": 1555.72, "end": 1560.74, "text": " is higher and higher, which basically means that the pruning algorithm, if you just let" }, { "start": 1560.74, "end": 1566.6200000000001, "text": " it go by itself, it's going to kill off the smaller, sorry, the larger layers first because" }, { "start": 1566.62, "end": 1570.84, "text": " they have the smaller scores. And you can see that even though the other algorithms" }, { "start": 1570.84, "end": 1577.8, "text": " don't conform exactly to that, they conform to this approximately. So these here, because" }, { "start": 1577.8, "end": 1586.56, "text": " their score is closely related to what the Synflow does, and the magnitude pruning, because" }, { "start": 1586.56, "end": 1592.8799999999999, "text": " mostly, because now I'm not sure if that's at the end of the training, at the beginning" }, { "start": 1592.88, "end": 1601.96, "text": " of the training, if you just initialize, then the score is going to be proportional to their" }, { "start": 1601.96, "end": 1607.0800000000002, "text": " magnitude and their magnitude is determined by the initialization scheme. And the initialization" }, { "start": 1607.0800000000002, "end": 1614.5200000000002, "text": " scheme is most of the time, like modern initialization schemes, compensate for the fact that you" }, { "start": 1614.5200000000002, "end": 1619.88, "text": " have different number of incoming and outgoing connections and therefore they would automatically" }, { "start": 1619.88, "end": 1629.8000000000002, "text": " assign a higher initialization constant to layers that have the lower number of parameters." }, { "start": 1629.8000000000002, "end": 1636.92, "text": " So even the magnitude pruning will conform to this. Now, it might be absolutely reasonable" }, { "start": 1636.92, "end": 1641.4, "text": " to say that that's also the case at the end of training because most parameters aren't" }, { "start": 1641.4, "end": 1647.5600000000002, "text": " going to move super much during training. So this still approximately holds, as you" }, { "start": 1647.56, "end": 1654.52, "text": " can see here. Of course, the random one doesn't do that. Yet, because you prune randomly," }, { "start": 1654.52, "end": 1659.6399999999999, "text": " you're still absolutely subject to this layer collapse. In fact, in the random one, the" }, { "start": 1659.6399999999999, "end": 1669.76, "text": " smallest layers would be the ones to go away first because it's just more probable. Okay." }, { "start": 1669.76, "end": 1675.84, "text": " So we've discovered that if you do something like saliency scoring or something that's" }, { "start": 1675.84, "end": 1684.8799999999999, "text": " correlated to it, then you're going to remove the biggest layers first. And that's a problem." }, { "start": 1684.8799999999999, "end": 1691.6999999999998, "text": " And that's what they say. This fact of this conservation laws and the single shot nature" }, { "start": 1691.6999999999998, "end": 1697.08, "text": " of these algorithms that they only assign scores once and then they prune away whatever" }, { "start": 1697.08, "end": 1704.9599999999998, "text": " the bottom such and such percent are leads to layer collapse. I think we've established" }, { "start": 1704.96, "end": 1710.56, "text": " this now that the combination of the two things leads to layer collapse. Now they make a little" }, { "start": 1710.56, "end": 1716.8400000000001, "text": " bit of an excursion and they say there is actually something that doesn't run into layer" }, { "start": 1716.8400000000001, "end": 1725.4, "text": " collapse. And that's iterative pruning algorithms. So specifically, they look at magnitude pruning." }, { "start": 1725.4, "end": 1732.88, "text": " They say magnitude pruning, which remember is also if you do it single shot, it also" }, { "start": 1732.88, "end": 1738.0600000000002, "text": " runs into layer collapse. Magnitude pruning avoids layer collapse with conservation and" }, { "start": 1738.0600000000002, "end": 1746, "text": " iteration. So because it iterates, it avoids that. And that's what these lottery ticket" }, { "start": 1746, "end": 1752.3000000000002, "text": " hypothesis paper does. It does it iteratively removes a couple of connections, then it retrains" }, { "start": 1752.3000000000002, "end": 1758, "text": " the network, basically recomputes the magnitudes and therefore recomputes the scores. And then" }, { "start": 1758, "end": 1764.08, "text": " it prunes again, and then it recomputes and and prunes again. And by recomputing, you" }, { "start": 1764.08, "end": 1769.88, "text": " can basically these some of the connections that weren't important before, but just survive" }, { "start": 1769.88, "end": 1776, "text": " the pruning, they can now be like, wait, I have now way more responsibility as a connection," }, { "start": 1776, "end": 1783.76, "text": " and they will shoot up in importance to avoid being pruned. So you can see if you push your" }, { "start": 1783.76, "end": 1792.8799999999999, "text": " network to a sorry to a high compression ratio, then if you just do this single shot pruning," }, { "start": 1792.8799999999999, "end": 1799.92, "text": " you run into this layer collapse at some compression ratio, you simply crash to random performance" }, { "start": 1799.92, "end": 1808.32, "text": " or zero performance. Yet, if you do multiple iterations, you can see here already two iterations," }, { "start": 1808.32, "end": 1814.48, "text": " then it's much longer before you run right here into layer collapse. And if you do three" }, { "start": 1814.48, "end": 1820.36, "text": " iterations, you do much more. Now this the three iterations doesn't mean you prune more" }, { "start": 1820.36, "end": 1827.84, "text": " like at this, at this point right here to tend to the one. All of these things prune" }, { "start": 1827.84, "end": 1833.3999999999999, "text": " nine out of every 10 connections. It's just the thing that has three iterations prunes" }, { "start": 1833.4, "end": 1840.1200000000001, "text": " maybe first three and then again, three and then again, three out of the 10. Whereas the" }, { "start": 1840.1200000000001, "end": 1849.9, "text": " one iteration would prune all of the nine at in one go. Okay. And they give a reason" }, { "start": 1849.9, "end": 1858.64, "text": " for this they give they say that it's the fact that gradient descent encourages conservation." }, { "start": 1858.64, "end": 1863.96, "text": " So they give a little toy example here they say to better understand the dynamics of the" }, { "start": 1863.96, "end": 1873.96, "text": " IMP algorithm during training, the smaller we will consider the a differentiable score," }, { "start": 1873.96, "end": 1879.2800000000002, "text": " this one. So this is not exactly magnitude pruning, but it is very close, right? The" }, { "start": 1879.2800000000002, "end": 1884.64, "text": " squared it's just the square of the parameter instead of the absolute value of the parameter." }, { "start": 1884.64, "end": 1890.24, "text": " They say it's algorithmically equivalent to magnitude score. Consider these scores throughout" }, { "start": 1890.24, "end": 1896.24, "text": " training with gradient descent on a loss function using an infinitesimal step. In this setting," }, { "start": 1896.24, "end": 1900.3200000000002, "text": " the temporal derivative of the parameters is equivalent to that. And thus the temporal" }, { "start": 1900.3200000000002, "end": 1906.8000000000002, "text": " derivative of the score is this. So now they're going to look at how does the score evolve" }, { "start": 1906.8, "end": 1916.36, "text": " when they train the network and the score evolves exactly as the negative to the saliency." }, { "start": 1916.36, "end": 1924.1599999999999, "text": " Surprisingly, this is a form of synaptic saliency. And thus the neuron wise and layer wise conservation" }, { "start": 1924.1599999999999, "end": 1929.44, "text": " laws from section four apply. In particular, this implies that for any two layers of a" }, { "start": 1929.44, "end": 1937.16, "text": " simple fully connected network, then this quantity holds. So this is not new. But what" }, { "start": 1937.16, "end": 1944.4, "text": " it basically says is that through training, these connections equalize the saliency again." }, { "start": 1944.4, "end": 1953.76, "text": " So if you have a very big layer, and here a very small layer, and because it's a big" }, { "start": 1953.76, "end": 1959.92, "text": " layer, these scores are very much lower, right? It's just little s and here it's big s per" }, { "start": 1959.92, "end": 1966.76, "text": " layer. But then if you prune away, and you run gradient descent on this, these scores" }, { "start": 1966.76, "end": 1974.4, "text": " will tend to become bigger. And in this case, these weights will tend to grow in magnitude." }, { "start": 1974.4, "end": 1979.52, "text": " Because you've pruned away the others, they now have more signal probably flowing to them" }, { "start": 1979.52, "end": 1985.12, "text": " and more gradient flowing to them. And therefore they're going to grow in size. And therefore," }, { "start": 1985.12, "end": 1991.8, "text": " their score is going to be bigger. So this gradient descent of this iterative procedure" }, { "start": 1991.8, "end": 2006.44, "text": " makes the scores better for that. So basically counteracts the layer collapse. So they put" }, { "start": 2006.44, "end": 2015.52, "text": " all of this together and say, theorem three, iterative positive conservative scoring achieves" }, { "start": 2015.52, "end": 2022.28, "text": " maximal critical compression. If a pruning algorithm with global masking, and global" }, { "start": 2022.28, "end": 2029.64, "text": " masking means that you rank all of the connections and then prune from all of the connections," }, { "start": 2029.64, "end": 2035.04, "text": " it's a difference to layer wise masking where you say I want to remove 90% of each layer," }, { "start": 2035.04, "end": 2041.1599999999999, "text": " which sounds like it would avoid layer collapse, but also it works a lot worse than the global" }, { "start": 2041.1599999999999, "end": 2047.44, "text": " one, the global strategy. Assigns positive scores that respect layer wise conservation." }, { "start": 2047.44, "end": 2054.56, "text": " And if the algorithm, so respecting layer wise conservation, it basically means your" }, { "start": 2054.56, "end": 2062.48, "text": " score should be, or if your score is a saliency score, then that's the case. And if the algorithm" }, { "start": 2062.48, "end": 2068.48, "text": " reevaluates the scores every time a parameter is pruned, then the algorithm satisfies the" }, { "start": 2068.48, "end": 2076.56, "text": " maximal critical compression axiom. Okay. So that's basically saying that if you have" }, { "start": 2076.56, "end": 2083.96, "text": " any algorithm that prunes with a saliency score, like theirs is going to do, is going" }, { "start": 2083.96, "end": 2094.16, "text": " to be able to be pushed to the limit until the maximal capacity is reached if you reevaluate" }, { "start": 2094.16, "end": 2100.64, "text": " the scores every time a parameter is pruned. So this is basically saying that whatever" }, { "start": 2100.64, "end": 2108.1, "text": " the lottery ticket hypothesis paper did with magnitude pruning, if you do it with saliency" }, { "start": 2108.1, "end": 2116.16, "text": " based pruning, you're guaranteed to achieve the maximum possible compression if you push" }, { "start": 2116.16, "end": 2126.2799999999997, "text": " it. But of course we know that whatever the lottery ticket hypothesis paper did is impractical" }, { "start": 2126.2799999999997, "end": 2131.6, "text": " because it needs to retrain the network every single time it wants to prune. Right? So if" }, { "start": 2131.6, "end": 2135.04, "text": " you want to do this after every parameter, that's going to be a long time. It's going" }, { "start": 2135.04, "end": 2142.2799999999997, "text": " to be impractical. We ideally want to prune the network before we even look at any data." }, { "start": 2142.2799999999997, "end": 2150.2, "text": " And they're going to do exactly that with the SYNFLOW algorithm. They say theorem three" }, { "start": 2150.2, "end": 2155.24, "text": " directly motivates the design of our novel pruning algorithm. SYNFLOW that provably reaches" }, { "start": 2155.24, "end": 2164.52, "text": " maximal critical compression. First, the necessity for iterative" }, { "start": 2164.52, "end": 2172.16, "text": " score evaluation discourages algorithms that involve back propagation on batches of data" }, { "start": 2172.16, "end": 2176.68, "text": " and instead motivates the development of an efficient data independent scoring procedure." }, { "start": 2176.68, "end": 2184.88, "text": " Second, positivity and conservation probably motivates the construction of a loss function" }, { "start": 2184.88, "end": 2190.92, "text": " that yields positive synaptic saliency scores. We combine these insights and introduce a" }, { "start": 2190.92, "end": 2197.8, "text": " new loss function where the one is the all one vectors. Okay, so this is the loss function" }, { "start": 2197.8, "end": 2204.92, "text": " of their saliency scores. And this might seem like... So what do we have? We have the parameters" }, { "start": 2204.92, "end": 2211.28, "text": " of layer L, the absolute product, sorry, the absolute value of those parameters, and then" }, { "start": 2211.28, "end": 2218.12, "text": " you simply multiply all of the layers together. And you have this product here with the ones" }, { "start": 2218.12, "end": 2226.6, "text": " on the side. So this is a quadratic form, sort of. Okay, this might seem a bit weird," }, { "start": 2226.6, "end": 2233.7599999999998, "text": " but in practice, and this is also what happens in their code, you can do something pretty" }, { "start": 2233.7599999999998, "end": 2239.8199999999997, "text": " easy. So first, you have to transform all your weights to their absolute values. Now" }, { "start": 2239.8199999999997, "end": 2245.4, "text": " in their code, you can look at it, they do remember the signs for later. So but first," }, { "start": 2245.4, "end": 2251.6800000000003, "text": " you convert all of them to their absolute values. Then second, you simply take a data" }, { "start": 2251.6800000000003, "end": 2257.84, "text": " point that is filled with ones that literally the number one. So if your if your input is" }, { "start": 2257.84, "end": 2265.32, "text": " an image, you just put a one at each pixel, you feed it through the network with all of" }, { "start": 2265.32, "end": 2271.64, "text": " these positive weights, and you get out some output, you get some output vector, okay," }, { "start": 2271.64, "end": 2276.96, "text": " then you simply you need to do this inner product with the one vector, which is simply" }, { "start": 2276.96, "end": 2282.16, "text": " a sum, right? I don't I don't get why they it's a bit of a funky way of writing a sum," }, { "start": 2282.16, "end": 2289.2, "text": " right? You simply sum that up to get a to get a single number. And this single number" }, { "start": 2289.2, "end": 2295.3199999999997, "text": " now is your is your pseudo loss function. It's simply the loss function that an all" }, { "start": 2295.32, "end": 2303.92, "text": " one data point gets when the when the loss function is just the sum of the outputs. That's" }, { "start": 2303.92, "end": 2310.32, "text": " that's it. That's it. And then you back propagate that loss to you back propagate that loss" }, { "start": 2310.32, "end": 2316.0800000000004, "text": " to the layers. Right? So this is our remember this is not the score itself, but our score" }, { "start": 2316.0800000000004, "end": 2324.8, "text": " is going to be the derivative of our with respect to a weight times that weight. Okay," }, { "start": 2324.8, "end": 2332.1200000000003, "text": " so you want to back propagate, and then you multiply each of these weights by the back" }, { "start": 2332.1200000000003, "end": 2339.28, "text": " propagated signal. And that's going to be your score for each parameter. Now, this doesn't" }, { "start": 2339.28, "end": 2343.4, "text": " seem too hard, right? You just need you don't even need a batch, you need a single data" }, { "start": 2343.4, "end": 2350.92, "text": " point, one back propagation, and then you get your scores. Okay, you don't need expensive" }, { "start": 2350.92, "end": 2361.7200000000003, "text": " training or anything like this. This seems pretty cool. And they give an example here." }, { "start": 2361.7200000000003, "end": 2369.56, "text": " For example, for a simple, come on, for a simple fully connected network, ie this, so" }, { "start": 2369.56, "end": 2374.96, "text": " they consider here a linear network, right, just so we can look at exactly what happens" }, { "start": 2374.96, "end": 2378.8, "text": " for linear networks, you can often compute quantities exactly. So if we look at just" }, { "start": 2378.8, "end": 2384.52, "text": " a linear network without nonlinearities, we can factor the synaptic flow score for any" }, { "start": 2384.52, "end": 2391.52, "text": " parameter as such. So the score, this is now not the the R, this is going to be the score" }, { "start": 2391.52, "end": 2397.28, "text": " is going to be this thing right here. So you can see that the parameter is multiplied by" }, { "start": 2397.28, "end": 2404.04, "text": " this thing, and by this thing. And other than for example, magnitude pruning, this actually" }, { "start": 2404.04, "end": 2411.24, "text": " takes into account all the input flow because it goes from this one, sorry, it goes from" }, { "start": 2411.24, "end": 2417.32, "text": " this goes from this one, it goes through all the network, right, every path that arrives" }, { "start": 2417.32, "end": 2423.4, "text": " at this particular weight is going to be considered. And every path that goes out from this particular" }, { "start": 2423.4, "end": 2429.88, "text": " weight is going to be considered. And the saliency score is going to depend on all of" }, { "start": 2429.88, "end": 2436.36, "text": " these paths, all of these all of the information flow from input to output that goes through" }, { "start": 2436.36, "end": 2445.2400000000002, "text": " that weight. And if you do this, then you get a really good pruning algorithm. So yeah," }, { "start": 2445.2400000000002, "end": 2450.6400000000003, "text": " the algorithm is is I've already described it. And in their experiments, as you can see" }, { "start": 2450.6400000000003, "end": 2456.76, "text": " right now, they have a bunch of networks, these VGG networks, or like wide resnet, they" }, { "start": 2456.76, "end": 2462, "text": " have a bunch of data sets like tiny image net or C for 10, where they experiment with" }, { "start": 2462, "end": 2467.4, "text": " these different baselines. And you can see that the baselines often run into this layer" }, { "start": 2467.4, "end": 2473.96, "text": " collapse problem. Sorry, often run into this where all of a sudden, let's actually look" }, { "start": 2473.96, "end": 2481.84, "text": " at let's look at this resonant 18. Right here. Maybe you can find a connection between maybe" }, { "start": 2481.84, "end": 2486.2000000000003, "text": " there's differently sized layers in resonant 18. And that's why the collapse happens even" }, { "start": 2486.2, "end": 2490.64, "text": " earlier. But you can see right here, there's a collapse if you do magnitude pruning, even" }, { "start": 2490.64, "end": 2495.3199999999997, "text": " also if you do random pruning, it falls down pretty hard after a while, the baselines they" }, { "start": 2495.3199999999997, "end": 2501.52, "text": " hold up better. But you can see in different models and different data sets, that the baselines" }, { "start": 2501.52, "end": 2508.52, "text": " crash at some point as well. Now I've already said the comparison here, it seems a little" }, { "start": 2508.52, "end": 2515.16, "text": " bit unfair. I might I might have over read something, but I'm pretty sure that the baselines" }, { "start": 2515.16, "end": 2522.64, "text": " remain single shot, while the sin flow algorithm here is now of course, no longer single shot," }, { "start": 2522.64, "end": 2528.2799999999997, "text": " it's actually multi shot, and they've made the exact argument that the single shot is" }, { "start": 2528.2799999999997, "end": 2536, "text": " the problem. And therefore their algorithm is multi multi shot. And it it seems like" }, { "start": 2536, "end": 2541.7599999999998, "text": " they should give the other algorithms the opportunity to also do multi shot, just to" }, { "start": 2541.76, "end": 2548.96, "text": " compare them fairly. Maybe, as I said, maybe they're doing that, but I'm, I haven't read" }, { "start": 2548.96, "end": 2556.36, "text": " any anything. So it, you know, it just seems like the comparison is a bit unfair. If you" }, { "start": 2556.36, "end": 2561.36, "text": " identify the problem, and then just leave the other algorithms with the problem, sin" }, { "start": 2561.36, "end": 2569.48, "text": " flow is still different from these other algorithms, even if they had the multiple steps. Now," }, { "start": 2569.48, "end": 2573.64, "text": " the counter argument to this, of course, is that these other algorithms all require the" }, { "start": 2573.64, "end": 2578.64, "text": " training data, they require actually passing the data or training the network in the case" }, { "start": 2578.64, "end": 2583.4, "text": " of magnitude pruning and so on. So that's pretty expensive, whereas sin flow, you simply" }, { "start": 2583.4, "end": 2590.32, "text": " pass forward one data point, and that's it. That's a good argument. But it seems like" }, { "start": 2590.32, "end": 2598.52, "text": " the effect of the synaptic saliency scores, and the effect of the multiple steps aren't" }, { "start": 2598.52, "end": 2606, "text": " really disentangled in these experiments right here, it simply shows that it consistently" }, { "start": 2606, "end": 2610.52, "text": " outperforms other pruning methods. And what what I'd like to see is really where that" }, { "start": 2610.52, "end": 2619.64, "text": " outperforming comes from. Okay, so that's what I think of this. And that was the paper," }, { "start": 2619.64, "end": 2627.44, "text": " basically, I'm even even if I am not convinced quite yet. This is pretty cool, right? And" }, { "start": 2627.44, "end": 2634.84, "text": " I think this will, if not be if it's not used itself, it will inspire kind of a line of" }, { "start": 2634.84, "end": 2642.16, "text": " work into pruning at the beginning of training without looking at data. And maybe, you know," }, { "start": 2642.16, "end": 2649.48, "text": " maybe we can even think of building networks, like, instead of just pruning them, we can" }, { "start": 2649.48, "end": 2656.96, "text": " think of constructively building networks that observe these properties. And therefore," }, { "start": 2656.96, "end": 2663.2400000000002, "text": " we can just construct initialized networks already with good properties such that we" }, { "start": 2663.2400000000002, "end": 2667.16, "text": " don't even have to go to a bigger network and then prune it down. It seems wasteful." }, { "start": 2667.16, "end": 2672.2400000000002, "text": " It seems like we should just be able to derive principles of what we want in the how the" }, { "start": 2672.2400000000002, "end": 2677.88, "text": " weights are structured, and then construct networks that are according to that. And I" }, { "start": 2677.88, "end": 2683.7200000000003, "text": " guess that's what's going to happen in a few papers that are coming. Alright, again, if" }, { "start": 2683.72, "end": 2689.3599999999997, "text": " you like this video, consider subscribing, giving it a like commenting, and let me know" }, { "start": 2689.36, "end": 2716.7200000000003, "text": " what you think. And until next time, bye bye." } ]
l12GXD0t_RE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Deep Differential System Stability - Learning advanced computations from examples (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "math", "derivative", "ode", "pde", "solution", "integral", "gradient", "jacobian", "mathematics", "language model", "transformer", "symbolic", "numeric", "stability", "equilibrium", "attention", "tokens", "dataset", "abstract" ]
Determining the stability properties of differential systems is a challenging task that involves very advanced symbolic and numeric mathematical manipulations. This paper shows that given enough training data, a simple language model with no underlying knowledge of mathematics can learn to solve these problems with remarkably high accuracy. OUTLINE: 0:00 - Intro & Overview 3:15 - Differential System Tasks 11:30 - Datasets & Models 15:15 - Experiments 21:00 - Discussion & My Comments Paper: https://arxiv.org/abs/2006.06462 My Video on Deep Learning for Symbolic Mathematics: https://youtu.be/p3sAF3gVMMA Abstract: Can advanced mathematical computations be learned from examples? Using transformers over large generated datasets, we train models to learn properties of differential systems, such as local stability, behavior at infinity and controllability. We achieve near perfect estimates of qualitative characteristics of the systems, and good approximations of numerical quantities, demonstrating that neural networks can learn advanced theorems and complex computations without built-in mathematical knowledge. Authors: François Charton, Amaury Hayat, Guillaume Lample Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi, here's a question for the whiz kids among you. Is this system here controllable at a point xe with asymptotic control ue? I'll give you 10 seconds. Okay, 10 seconds are over. So to solve this, it's actually pretty easy. All you need to do is first differentiate the system with respect to its internal variables, which are the x's, to obtain the Jacobian a. Second step, differentiate the system with respect to its control variables, which are the u variables to obtain the matrix B. Look, this is a zero, like this is not hard. Then evaluate a and b at the point that you want and the control point that you want pretty easy. Calculate the controllability matrix. Come on, that's nothing. Another zero. And at the end, you calculate the rank of the controllability matrix. Now, if the if n minus d is zero, 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 system stability, learning advanced computations from examples by Francois Chardon, Amory Hayat, and Jiam Lampel of Facebook AI research and Ecole de Pompari Tech and Rutgers Rutgers University. So at this, in this paper, these authors basically propose that you can learn these complex mathematics with a model that has no clue about mathematics. In fact, it is a language model. And it can output the solutions, for example, whether or not a system is controllable, which are sort of binary solutions, but it can also output actual solutions as in numbers or as in the matrices that you would need to obtain from these problems. So that's pretty cool. And it is built upon this other paper called, I think, some deep learning for symbolic mathematics or something. I have made a video on it if you search for it, and I'll also link it in 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 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 the derivation of some variable is characterized by the variable itself. So the the 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 other variables. So you can have systems of differential equations that all depend on each other. And there are a number of questions about these systems. These are very relevant in like physics or engineering, control theory, and so on. So they investigate different problems that you can solve with these. They investigate specifically problems where we already know the solutions, but the solutions require very complex mathematical manipulation, such as as you've seen, calculate the integral of something, take the trace, calculate the rank, invert some matrix. So all of these mathematical steps are required to solve these problems if we were to teach them to math students or engineering students. And this paper basically says, if we just input the problem into a big language model, and, and ask it to output the solution, it can do it. So basically can learn to do all of these things. So that's pretty, pretty surprising, because you don't program it to do any math. So the first problem they look at is this local stability problem. So in, I don't, I don't really want to go into, into much of the actual mathematical problems, but we'll look at the first one to just give you an idea of what these sort of problems are. So 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. Okay. 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'd try to find local points of stability. So this point here would be maybe a local point of stability, if you consider this as sort of an optimization landscape, because if you go from here, if you go a little bit away from it, you're always sort of pushed back. If this, if this is a, if the system is gravity, sort of, so if these differential equations did 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. And they list them out here just to show you how complex this is. This is not meant to teach you, you don't have to like understand or be able to apply this. This is simply meant to tell you how complicated it is to arrive at a solution. So first you need to differentiate each function with respect to each variable and obtain the formal Jacobian. So they do this here for this example system, which is this system right here. This is a system of two equations, two differential equations in two variables. Okay. So if you 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, I mean, you have several methods of that. You have several methods of computing the largest eigenvalue. You could do power method. You could do decomposition. There are numerous ways, but none of these is like particularly easy, 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, 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 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 in there, they're not trying to beat that program, they're simply trying to investigate, can a language model that knows nothing of math, do this simply by learning from data. So they're going to try to build a data set, or they are building a data set. And they do it in the same way as this previous paper, which say we generate random functions by sampling unary binary trees and randomly selecting operators, variables and integers for their internal nodes and leaves. So they use any combination of plus minus times divide x blog, and so on. So all these functions can appear in these things. And they basically they build a tree where they say, okay, we go from plus and then here is five, and then here maybe is minus sin of x, and here over is x of y. So that would be five plus sine 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 train our models with the atom optimizer learning rate, blah, blah, blah, we vary the dimension, and the number of layers. So that's going to be interesting to see how the size of this language model influences how well this model can solve these things. So as you can see here, they build these data sets for local stability, they include systems with two to six equations, which is already fairly, fairly complicated, and would take a human quite a while to to do this. They say we generate a data set with over 50 million systems. So it's a pretty dense sampling of this space. And I feel this is one of the important components here. They do make sure that none of their tests, so they do a train test split, and they do make sure that none of their test examples is in the training data set, though they claim that they never actually have to remove anything, they just check and the search space, the space of these trees here is so large, that it never happens that the data test sample or almost never happens that a test sample is in the training data set. Alright, so they generate these things. And here are the results. So for local stability, it is trained to predict this lambda that we saw at the beginning, the largest part of the eigenvalue of the Jacobian corresponding to the convergence speed of equilibrium, we consider that predictions are correct when they fall within 10% of the ground truth. And here you can see that their best model achieves 96% if the degree of if it's two equations, so if the degree of the system is two, it achieves in 96% accuracy. So in 96% of the time, the convergence speed is within 10% of the true convergence speed. That's fairly crazy, right? That's pretty good. And here the exact prediction of local convergence speed to given precision. So how many digits actually match of that conversion speed. So it's not only 10% off, they also measure how many digits match. And here, you can see that as you up the degree of equation, sorry, here, the performance drops off, as you can see, less and less and less. And also as you lower the number of layers in your model, or lower the dimensionality, the performance drops quite significantly. So that means the language model sort of is doing real work here. And here you also see that if it's degree two, the convergence speed has pretty even goes to two, three or four digits often. But as you now increase the degree, this accuracy drops off fairly quickly. All right, let's keep that in mind. So the surprising thing is that it actually works. And it works in surprisingly big amount of the time. Now, I don't know, you could bicker about this 10% and how bad or how easy this is, and so on. But it is fairly, it is fairly complicated problem. And to be within 10% of the solution seems quite remarkable. And the same things here happen with the other tasks. So here they say they predict controllability in the autonomous case. So in the control theory, they predict these two things, whether it's controllable, and then they output this K matrix that we saw before. Yeah. So here, you can see that if they have high enough dimensions and high enough layers, with sample systems with three to six equations, they achieve again a 97% in the prediction of whether the system is controllable or not. Now remember, this is a binary prediction, but still, it requires a good understanding of math for a human to solve this. Again, we see this drop off with dimension and layers. But you know, this number here is pretty good compared to the 50% you'd have from random guessing. Also interesting is when they look at is this correct, sorry, is the feedback matrix correct? So this matrix that you optionally have to output, they find that if they analyze whether or not that's within 10% of the true one, they see that pretty, pretty quickly this accuracy drops when they up the degree. Of course, the matrix, as I understand it has more entries at degree six than at degree three. So maybe that's understandable. But it drops off pretty quickly. But what is true is whether they call this correct feedback matrix. So from the feedback matrix, from the entries in that, you can read out whether it's the system is controllable or not, if all of the eigenvalues, I believe, are negative or positive, or all the values are negative or positive. So basically, by saying whether or not these things are positive or negative, you can read out the controllability. And if they check whether that property holds, then that is is fairly well. So they argue here that this shows that it doesn't, it doesn't predict the the matrix they want. But the matrix that it predicts has the appropriate properties to solve this other task right here. Okay, that's experiment two. Experiment three, as you can imagine, is quite different, sorry, quite similar in that they investigate these partial differential equations. In a Fourier transform, the model is given differential operator and an initial condition is trained to predict if a solution exists. And if so, whether it converges to zero, when t goes to infinity, the space, the dimensions between two and six. So the random guessing here would be, I guess, 25%, because it's two bits, you need to output. And this model performs extremely well, even up to this dimension six, there is a drop off with dimension, but it still does perform very, very well. Now, they go into the discussion a bit. And they and this, this is the part that in this paper, interests me, like, how do you interpret these results? Apparently, you give these mathematical things to a language model that has no clue of math. And just by looking at examples, it learns to produce correct solutions. And if you want to teach that to a human, the human would have to go through all these steps, right? So something is happening here. And we'll want to find out what and the discussion is maybe they try to explain a bit why they think this happens. They say we studied five problems of advanced mathematics from widely research. In three of them, we predict qualitative and theoretical features. In two, we perform numerical computations. According to mathematical theory, solving these problems requires a combination of advanced techniques, symbolic and numerical that seem unlikely to be learnable from examples. Yet our model achieves more than 95% accuracy on all qualitative tasks. And between 65 and 85 on numerical computations, such high performances over difficult mathematical tasks may come as a surprise. One way to generate data set of problems with their solutions consists in sampling the solution first and deriving an associated problem. For instance, pairs of functions with their integrals can be generated by sampling and differentiating from random functions. So here they hedge against there's this criticism and this was mainly a criticism of their other paper, which they already addressed in their other paper was if you want to find 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 different 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 compose to the number 142, they would put as now there's an integer and then the token one, the token four and the token two. Okay. And the decimal point representation is the sequence float three dot one for e in negative one. So this is it's really just a string, there is no, like the model would even have to learn the decimal representation of numbers to get that this four here is actually not not just a different token than two, but it's 20 times larger because it is in the position one in front of two. So it's not two times larger, like four is to two, but because four is, you know, one digit away from two, it's 20 times larger. And then this here is actually 50 times larger than this. So it seems like a quite inconvenient way to input data into the model. And yet the model is super accurate, right? And we already know that these language models, what they tend to do is they tend to memorize the training data or abstracted in a way that they can sort of interpolate between fuzzy versions of the training data. Here they say this is unlikely, sorry, this is unlikely because first, because the size of our problem space is too large to be memorized. So say for all consider problems, we did not get a single duplicate over 50 million generated examples. Second, because in some of our problems, such as non autonomous control, even a model with a one layer and 64 dimensions obtains a high accuracy and such a small model would never be able to memorize that many examples, which is true, right? This is this is a fair defense against you're just interpolating training data. But I think the kind of broader, the broader scope of this criticism would be something like your model is just kind of learning the pattern regularities of the textual data that you feed in. It's not actually learning math, it's just learning sort of, okay, there is like a cosine. And if there's a cosine here, followed by an exponential function that often leads to like a very low number of this lambda, right? And then if a very similar thing comes, 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 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, IEG, the real value of eigenvalues cannot be obtained by simple interpolation. And I mean, that is also a valid defense. But I think the argument goes further than just simple interpolation. What we mean by interpolation is not we interpolate the real values of the eigenvalues. What we mean by interpolation is sort of interpolation in the regression space of these tokens. Like we know that if we go from a sine to a cosine, maybe the sine of the output flips at the end. And that's what we mean by interpolation. Like when we see two equations that are very similar, like x squared plus 4x minus the sine of x, and then we see x squared plus 5x minus twice the sine of x. What we mean by interpolation is that we now get a test example that says x squared plus, let's say, 4x minus 3 times the sine of x. Then what we would interpolate is sort of these things. 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. If you train the language model, it will recognize that maybe I can interpolate whenever the coefficient here is just different or I can interpolate when there's just, you know, if there's like a log x here, that doesn't really change anything. So I can interpolate between the two, but I might not be able to interpolate when the exponent here is different. So if you give a training data set, you teach the model where it can interpolate and where it can't. Now again, it's not able to remember the training data, but it will be able to sort of abstract it and store it fuzzily and abstract the patterns from it, which is good, right? That's machine learning. But there's no evidence here that this does any mathematical reasoning. So up until now, all that has built up is sort of if you read the abstract, can advanced mathematical computations be learned from examples? Neural networks can learn advanced theorems, complex computation without built in mathematical knowledge. All of the story here, all of this 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 operations, 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. It's that probably the model learns shortcuts and the shortcuts might be just in a way of pattern matching. The pattern matching of whatever patterns you extract from the training data, you pattern match that and you relatively simply interpolate between those matched patterns, not between the training data itself, but between the match patterns. And therefore, you can arrive at approximately good 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 a model and you evaluated it, it is really good at this task for which you thought you need, you know, to do these four steps. What would be really interesting is to now introspect your model and see, can I somehow show that my model has in somewhere in the intermediate layers has this quantity right here? And it's 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 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 these on the path of the solution, right? If I want to get the solution, I almost have to calculate this quantity. Can I parse this out from the middle of the model somewhere? When the model isn't explicitly trained to give me this, if I can, then I can really make the point that the model does something like this and learn something like this from data. Whereas if I can't, that 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 of my criticism right here is that they they show it works, which is pretty cool. But then they, they don't do the sort of interesting experiments of these of this introspection right here, which is a bit sad, but you know, they leave it for future research, which I guess is going to be themselves. And that's how you make two papers. So no, I don't want to be too critical. It's a very cool paper. And I invite you to check it out and leave a like and subscribe and leave a comment of what you think of this kind of research of this paper, and whether or not you think I'm totally wrong. That's entirely possible. Okay, I'll see you next time. Bye bye. Transcribed by https://otter.ai
[ { "start": 0, "end": 7.5, "text": " Hi, here's a question for the whiz kids among you. Is this system here controllable at a" }, { "start": 7.5, "end": 14.700000000000001, "text": " point xe with asymptotic control ue? I'll give you 10 seconds. Okay, 10 seconds are" }, { "start": 14.700000000000001, "end": 19.62, "text": " over. So to solve this, it's actually pretty easy. All you need to do is first differentiate" }, { "start": 19.62, "end": 24.54, "text": " the system with respect to its internal variables, which are the x's, to obtain the Jacobian" }, { "start": 24.54, "end": 29.54, "text": " a. Second step, differentiate the system with respect to its control variables, which are" }, { "start": 29.54, "end": 35.68, "text": " the u variables to obtain the matrix B. Look, this is a zero, like this is not hard. Then" }, { "start": 35.68, "end": 40.2, "text": " evaluate a and b at the point that you want and the control point that you want pretty" }, { "start": 40.2, "end": 48.16, "text": " easy. Calculate the controllability matrix. Come on, that's nothing. Another zero. And" }, { "start": 48.16, "end": 54.6, "text": " at the end, you calculate the rank of the controllability matrix. Now, if the if n minus" }, { "start": 54.6, "end": 60.52, "text": " d is zero, this system is controllable. And optionally, if you want, if you feel like" }, { "start": 60.52, "end": 65.52, "text": " it, you can output the control feedback matrix as an equation three, which gives you this" }, { "start": 65.52, "end": 73.8, "text": " here. Now, what's equation three? Equation three is super duper simple. It's just this" }, { "start": 73.8, "end": 82.5, "text": " little sort of integral thing, inverse matrix trace transposed exponential function, outer" }, { "start": 82.5, "end": 90.36, "text": " product thing. Come on, what's the matter with you? Okay, so if you found you can't" }, { "start": 90.36, "end": 98.84, "text": " do this just on the spot, then you are in the same category as most people. But interestingly," }, { "start": 98.84, "end": 104.68, "text": " apparently, according to this paper, a deep learning system can. So today we're going" }, { "start": 104.68, "end": 110.56, "text": " to look at deep differential system stability, learning advanced computations from examples" }, { "start": 110.56, "end": 118.48, "text": " by Francois Chardon, Amory Hayat, and Jiam Lampel of Facebook AI research and Ecole de" }, { "start": 118.48, "end": 126.96000000000001, "text": " Pompari Tech and Rutgers Rutgers University. So at this, in this paper, these authors basically" }, { "start": 126.96000000000001, "end": 133.84, "text": " propose that you can learn these complex mathematics with a model that has no clue about mathematics." }, { "start": 133.84, "end": 141.20000000000002, "text": " In fact, it is a language model. And it can output the solutions, for example, whether" }, { "start": 141.20000000000002, "end": 146, "text": " or not a system is controllable, which are sort of binary solutions, but it can also" }, { "start": 146, "end": 154.32, "text": " output actual solutions as in numbers or as in the matrices that you would need to obtain" }, { "start": 154.32, "end": 162.16, "text": " from these problems. So that's pretty cool. And it is built upon this other paper called," }, { "start": 162.16, "end": 167.48, "text": " I think, some deep learning for symbolic mathematics or something. I have made a video on it if" }, { "start": 167.48, "end": 174.8, "text": " you search for it, and I'll also link it in the description. And you can go check that" }, { "start": 174.8, "end": 180.1, "text": " out because that's sort of the basis. So in this previous paper, I think it was from partially" }, { "start": 180.1, "end": 187.04, "text": " the same authors, they have investigated language models into integrating functions. So you" }, { "start": 187.04, "end": 191.72, "text": " have some sort of function, you're trying to find the integral, and they've tried to" }, { "start": 191.72, "end": 200.24, "text": " do that. Now they go a lot further. So they look at these at these differential systems," }, { "start": 200.24, "end": 205.24, "text": " which are characterized by these differential equations. So if you've never seen differential" }, { "start": 205.24, "end": 213.44, "text": " equations, it's basically an equation where the the derivation of some variable is characterized" }, { "start": 213.44, "end": 220.4, "text": " by the variable itself. So the the the gradient, if you will, or the code in the derivation" }, { "start": 220.4, "end": 226.16, "text": " according to some input variable here, it's most often it's time and physical systems" }, { "start": 226.16, "end": 231.76, "text": " is a function of that variable itself, and partially also other variables. So you can" }, { "start": 231.76, "end": 237.48000000000002, "text": " have systems of differential equations that all depend on each other. And there are a" }, { "start": 237.48000000000002, "end": 243.48000000000002, "text": " number of questions about these systems. These are very relevant in like physics or engineering," }, { "start": 243.48000000000002, "end": 250.32, "text": " control theory, and so on. So they investigate different problems that you can solve with" }, { "start": 250.32, "end": 256.32, "text": " these. They investigate specifically problems where we already know the solutions, but the" }, { "start": 256.32, "end": 265.12, "text": " solutions require very complex mathematical manipulation, such as as you've seen, calculate" }, { "start": 265.12, "end": 270.15999999999997, "text": " the integral of something, take the trace, calculate the rank, invert some matrix. So" }, { "start": 270.15999999999997, "end": 274.44, "text": " all of these mathematical steps are required to solve these problems if we were to teach" }, { "start": 274.44, "end": 281.12, "text": " them to math students or engineering students. And this paper basically says, if we just" }, { "start": 281.12, "end": 289.8, "text": " input the problem into a big language model, and, and ask it to output the solution, it" }, { "start": 289.8, "end": 294.76, "text": " can do it. So basically can learn to do all of these things. So that's pretty, pretty" }, { "start": 294.76, "end": 300.32, "text": " surprising, because you don't program it to do any math. So the first problem they look" }, { "start": 300.32, "end": 310.04, "text": " at is this local stability problem. So in, I don't, I don't really want to go into, into" }, { "start": 310.04, "end": 314.42, "text": " much of the actual mathematical problems, but we'll look at the first one to just give" }, { "start": 314.42, "end": 322.12, "text": " you an idea of what these sort of problems are. So Xe is an, if Xe is an equilibrium" }, { "start": 322.12, "end": 329.71999999999997, "text": " point, it means that all solutions, if all solutions converge to Xe when their initial" }, { "start": 329.72, "end": 336.04, "text": " positions are close enough, the equilibrium point is said to be locally stable. Okay." }, { "start": 336.04, "end": 341.76000000000005, "text": " This problem is well known if f is differentiable in Xe, and answers provided by the spectral" }, { "start": 341.76000000000005, "end": 351.04, "text": " mapping theorem. So in that case, you'd have a system, maybe we can draw one where you'd" }, { "start": 351.04, "end": 356.44000000000005, "text": " try to find local points of stability. So this point here would be maybe a local point" }, { "start": 356.44, "end": 363.48, "text": " of stability, if you consider this as sort of an optimization landscape, because if you" }, { "start": 363.48, "end": 368.82, "text": " go from here, if you go a little bit away from it, you're always sort of pushed back." }, { "start": 368.82, "end": 376.44, "text": " If this, if this is a, if the system is gravity, sort of, so if these differential equations" }, { "start": 376.44, "end": 386.08, "text": " did sort of describe that the height here is the force with which you're pulled down," }, { "start": 386.08, "end": 390.28, "text": " then this thing here would be a local point of stability. The question is, if I give you" }, { "start": 390.28, "end": 395.41999999999996, "text": " a system that's described by these differential equations, can you tell me whether or not" }, { "start": 395.41999999999996, "end": 403.68, "text": " it is stable at some point? Okay. And there is a spectral mapping theorem, which says," }, { "start": 403.68, "end": 409.4, "text": " if you have the Jacobian matrix of f at this point, the matrix of its partial derivatives" }, { "start": 409.4, "end": 415.91999999999996, "text": " relative to its variable. And if you take lambda to be the largest real part of its" }, { "start": 415.91999999999996, "end": 423.64, "text": " complex eigenvalues, if lambda is positive, then this is an unstable equilibrium. If lambda" }, { "start": 423.64, "end": 428.71999999999997, "text": " is negative, then it's a locally stable equilibrium. So an unstable equilibrium likewise would" }, { "start": 428.71999999999997, "end": 436.64, "text": " be the point here on top, which means that if you're exactly at the point, then you stay" }, { "start": 436.64, "end": 441, "text": " there. But as soon as you're a little bit off, you drift away from it. That would be" }, { "start": 441, "end": 448.76, "text": " an unstable equilibrium. Okay. So there are complex steps involved in deriving this solution." }, { "start": 448.76, "end": 452.91999999999996, "text": " And they list them out here just to show you how complex this is. This is not meant to" }, { "start": 452.91999999999996, "end": 458.91999999999996, "text": " teach you, you don't have to like understand or be able to apply this. This is simply meant" }, { "start": 458.91999999999996, "end": 464.58, "text": " to tell you how complicated it is to arrive at a solution. So first you need to differentiate" }, { "start": 464.58, "end": 470.15999999999997, "text": " each function with respect to each variable and obtain the formal Jacobian. So they do" }, { "start": 470.15999999999997, "end": 476.52, "text": " this here for this example system, which is this system right here. This is a system of" }, { "start": 476.52, "end": 484.26, "text": " two equations, two differential equations in two variables. Okay. So if you derive the" }, { "start": 484.26, "end": 490.79999999999995, "text": " Jacobian that will give you a four entry Jacobian. So each one of these is one of the equations" }, { "start": 490.8, "end": 497.04, "text": " derived with respect to one of the variables. You can do that, right? But it requires fairly" }, { "start": 497.04, "end": 502.48, "text": " complex mathematical knowledge. Like knowing that the derivative of the sign here is the" }, { "start": 502.48, "end": 508.8, "text": " cosine and knowing that this cosine doesn't matter for this particular entry because it's" }, { "start": 508.8, "end": 517.82, "text": " in X2 and here we derive by X1. So that's already very challenging. Second, you need" }, { "start": 517.82, "end": 524.2800000000001, "text": " to evaluate the Jacobian at that point. So first you've done it symbolically. Now you" }, { "start": 524.2800000000001, "end": 528.4000000000001, "text": " actually need to put in the numbers at the point you're interested in, which will give" }, { "start": 528.4000000000001, "end": 535.6800000000001, "text": " you this thing right here, which is a numerical matrix, whereas this was a symbolical matrix." }, { "start": 535.6800000000001, "end": 542.0600000000001, "text": " Then you need to calculate the eigenvalues, which is, I mean, you have several methods" }, { "start": 542.06, "end": 548.16, "text": " of that. You have several methods of computing the largest eigenvalue. You could do power" }, { "start": 548.16, "end": 555.4799999999999, "text": " method. You could do decomposition. There are numerous ways, but none of these is like" }, { "start": 555.4799999999999, "end": 563.7199999999999, "text": " particularly easy, right? And then lastly, you need to return the minus max of the real" }, { "start": 563.7199999999999, "end": 568.9599999999999, "text": " part, which is the speed of convergence of the system. So not only do you need to be" }, { "start": 568.96, "end": 576.08, "text": " able to tell whether it is stable, which is if this is negative, you also need to be able" }, { "start": 576.08, "end": 584.52, "text": " to say, or if this is negative, you need to be able to say whether it is locally stable" }, { "start": 584.52, "end": 593.4000000000001, "text": " or locally unstable. And since this is larger than zero, it's locally stable. And this would" }, { "start": 593.4, "end": 601.24, "text": " be the decay rate 0.441. This is what you're asking this model to output, right? Now we'll" }, { "start": 601.24, "end": 608.36, "text": " quickly go over the other things, but not as in depth. But this is in control theory" }, { "start": 608.36, "end": 612.76, "text": " where you're trying, you have almost the same thing, you have a differential equation. But" }, { "start": 612.76, "end": 617.64, "text": " now, in addition to these variables, you have these control variables, which you have power" }, { "start": 617.64, "end": 624.88, "text": " over and you're trying to decide, can I control the system with the appropriate function?" }, { "start": 624.88, "end": 629.48, "text": " And in order to do that, that's kind of the problem that we had at the beginning. I know" }, { "start": 629.48, "end": 635.96, "text": " it's not. Oh, yeah, it is. So what you need to do is again, differentiate the system with" }, { "start": 635.96, "end": 641.4, "text": " respect to its internal variables, differentiate the system with respect to its control variables," }, { "start": 641.4, "end": 649.64, "text": " evaluate A and B, calculate the controllability matrix with one of the functions above, calculate" }, { "start": 649.64, "end": 657.52, "text": " the rank, and optionally evaluate this equation number three that we saw before. Now, the" }, { "start": 657.52, "end": 663.76, "text": " last task is equally complicated. It relates to the stability of partial differential equations" }, { "start": 663.76, "end": 671.48, "text": " using the Fourier transform. And again, to obtain this, it is a five step intricate process" }, { "start": 671.48, "end": 679.36, "text": " where that is a mix of symbolic complex manipulation and numerical evaluation of that symbolic" }, { "start": 679.36, "end": 687.72, "text": " things. And here you need to simply output two bits, one bit says whether there exists" }, { "start": 687.72, "end": 695.44, "text": " a solution and the other bit says whether it vanishes at t to infinity. So what are" }, { "start": 695.44, "end": 700.28, "text": " they expecting here? What they're doing is they're going to build a data set that is" }, { "start": 700.28, "end": 705.2, "text": " composed of these things. And I think they do it one by one. So they take one of the" }, { "start": 705.2, "end": 710.9200000000001, "text": " tasks and they're going to build a giant data set of these things. Since they all have solutions," }, { "start": 710.9200000000001, "end": 717.44, "text": " right? You can build a data set with labels, because you can actually build a you can build" }, { "start": 717.44, "end": 723.36, "text": " software that does these steps, because you program mathematical knowledge into the software," }, { "start": 723.36, "end": 729.08, "text": " but it's custom made for that particular problem. And they're simply trying to in there, they're" }, { "start": 729.08, "end": 733.8000000000001, "text": " not trying to beat that program, they're simply trying to investigate, can a language model" }, { "start": 733.8000000000001, "end": 740.96, "text": " that knows nothing of math, do this simply by learning from data. So they're going to" }, { "start": 740.96, "end": 746.24, "text": " try to build a data set, or they are building a data set. And they do it in the same way" }, { "start": 746.24, "end": 753.5600000000001, "text": " as this previous paper, which say we generate random functions by sampling unary binary" }, { "start": 753.5600000000001, "end": 759.04, "text": " trees and randomly selecting operators, variables and integers for their internal nodes and" }, { "start": 759.04, "end": 765.04, "text": " leaves. So they use any combination of plus minus times divide x blog, and so on. So all" }, { "start": 765.04, "end": 770.5600000000001, "text": " these functions can appear in these things. And they basically they build a tree where" }, { "start": 770.56, "end": 777.88, "text": " they say, okay, we go from plus and then here is five, and then here maybe is minus sin" }, { "start": 777.88, "end": 793.28, "text": " of x, and here over is x of y. So that would be five plus sine of x minus x of y. So they" }, { "start": 793.28, "end": 799.88, "text": " build trees like this by randomly sampling. And then they simply feed this to their mathematical" }, { "start": 799.88, "end": 807.2, "text": " program to obtain a solution y. And then they feed all of this into that's now a training" }, { "start": 807.2, "end": 814.16, "text": " data point. This here is x and here you have y. And they generate a giant bunch of these" }, { "start": 814.16, "end": 822.96, "text": " things. And they feed them into the into the model. They say here is seek to seek models," }, { "start": 822.96, "end": 828.96, "text": " not even sure what kind of models they use. I think they just they use transformers as" }, { "start": 828.96, "end": 834.2800000000001, "text": " well. So they they use standard transformers, I believe. So yes, in all experiments, we" }, { "start": 834.2800000000001, "end": 838.6, "text": " use the transformer architecture with eight attention heads, we train our models with" }, { "start": 838.6, "end": 843.52, "text": " the atom optimizer learning rate, blah, blah, blah, we vary the dimension, and the number" }, { "start": 843.52, "end": 848.12, "text": " of layers. So that's going to be interesting to see how the size of this language model" }, { "start": 848.12, "end": 856, "text": " influences how well this model can solve these things. So as you can see here, they build" }, { "start": 856, "end": 861.64, "text": " these data sets for local stability, they include systems with two to six equations," }, { "start": 861.64, "end": 867.68, "text": " which is already fairly, fairly complicated, and would take a human quite a while to to" }, { "start": 867.68, "end": 875.28, "text": " do this. They say we generate a data set with over 50 million systems. So it's a pretty" }, { "start": 875.28, "end": 881.72, "text": " dense sampling of this space. And I feel this is one of the important components here. They" }, { "start": 881.72, "end": 886.48, "text": " do make sure that none of their tests, so they do a train test split, and they do make" }, { "start": 886.48, "end": 891.6, "text": " sure that none of their test examples is in the training data set, though they claim that" }, { "start": 891.6, "end": 897.24, "text": " they never actually have to remove anything, they just check and the search space, the" }, { "start": 897.24, "end": 904.48, "text": " space of these trees here is so large, that it never happens that the data test sample" }, { "start": 904.48, "end": 911.1600000000001, "text": " or almost never happens that a test sample is in the training data set. Alright, so they" }, { "start": 911.16, "end": 920.56, "text": " generate these things. And here are the results. So for local stability, it is trained to predict" }, { "start": 920.56, "end": 924.24, "text": " this lambda that we saw at the beginning, the largest part of the eigenvalue of the" }, { "start": 924.24, "end": 930.6, "text": " Jacobian corresponding to the convergence speed of equilibrium, we consider that predictions" }, { "start": 930.6, "end": 937.0799999999999, "text": " are correct when they fall within 10% of the ground truth. And here you can see that their" }, { "start": 937.08, "end": 945.36, "text": " best model achieves 96% if the degree of if it's two equations, so if the degree of the" }, { "start": 945.36, "end": 953.48, "text": " system is two, it achieves in 96% accuracy. So in 96% of the time, the convergence speed" }, { "start": 953.48, "end": 959.64, "text": " is within 10% of the true convergence speed. That's fairly crazy, right? That's pretty" }, { "start": 959.64, "end": 968.04, "text": " good. And here the exact prediction of local convergence speed to given precision. So how" }, { "start": 968.04, "end": 974.36, "text": " many digits actually match of that conversion speed. So it's not only 10% off, they also" }, { "start": 974.36, "end": 981.76, "text": " measure how many digits match. And here, you can see that as you up the degree of equation," }, { "start": 981.76, "end": 990.12, "text": " sorry, here, the performance drops off, as you can see, less and less and less. And also" }, { "start": 990.12, "end": 998.16, "text": " as you lower the number of layers in your model, or lower the dimensionality, the performance" }, { "start": 998.16, "end": 1004.64, "text": " drops quite significantly. So that means the language model sort of is doing real work" }, { "start": 1004.64, "end": 1014.8, "text": " here. And here you also see that if it's degree two, the convergence speed has pretty even" }, { "start": 1014.8, "end": 1023.88, "text": " goes to two, three or four digits often. But as you now increase the degree, this accuracy" }, { "start": 1023.88, "end": 1028.94, "text": " drops off fairly quickly. All right, let's keep that in mind. So the surprising thing" }, { "start": 1028.94, "end": 1036.96, "text": " is that it actually works. And it works in surprisingly big amount of the time. Now," }, { "start": 1036.96, "end": 1041.48, "text": " I don't know, you could bicker about this 10% and how bad or how easy this is, and so" }, { "start": 1041.48, "end": 1049.24, "text": " on. But it is fairly, it is fairly complicated problem. And to be within 10% of the solution" }, { "start": 1049.24, "end": 1058.8400000000001, "text": " seems quite remarkable. And the same things here happen with the other tasks. So here" }, { "start": 1058.84, "end": 1065.56, "text": " they say they predict controllability in the autonomous case. So in the control theory," }, { "start": 1065.56, "end": 1070.32, "text": " they predict these two things, whether it's controllable, and then they output this K" }, { "start": 1070.32, "end": 1080.9199999999998, "text": " matrix that we saw before. Yeah. So here, you can see that if they have high enough" }, { "start": 1080.9199999999998, "end": 1088.36, "text": " dimensions and high enough layers, with sample systems with three to six equations, they" }, { "start": 1088.36, "end": 1094.9399999999998, "text": " achieve again a 97% in the prediction of whether the system is controllable or not. Now remember," }, { "start": 1094.9399999999998, "end": 1104.62, "text": " this is a binary prediction, but still, it requires a good understanding of math for" }, { "start": 1104.62, "end": 1111.8799999999999, "text": " a human to solve this. Again, we see this drop off with dimension and layers. But you" }, { "start": 1111.88, "end": 1126.3600000000001, "text": " know, this number here is pretty good compared to the 50% you'd have from random guessing." }, { "start": 1126.3600000000001, "end": 1133.38, "text": " Also interesting is when they look at is this correct, sorry, is the feedback matrix correct?" }, { "start": 1133.38, "end": 1139.74, "text": " So this matrix that you optionally have to output, they find that if they analyze whether" }, { "start": 1139.74, "end": 1147.56, "text": " or not that's within 10% of the true one, they see that pretty, pretty quickly this" }, { "start": 1147.56, "end": 1153.36, "text": " accuracy drops when they up the degree. Of course, the matrix, as I understand it has" }, { "start": 1153.36, "end": 1160.36, "text": " more entries at degree six than at degree three. So maybe that's understandable. But" }, { "start": 1160.36, "end": 1166.86, "text": " it drops off pretty quickly. But what is true is whether they call this correct feedback" }, { "start": 1166.86, "end": 1174.1, "text": " matrix. So from the feedback matrix, from the entries in that, you can read out whether" }, { "start": 1174.1, "end": 1181.08, "text": " it's the system is controllable or not, if all of the eigenvalues, I believe, are negative" }, { "start": 1181.08, "end": 1185.4599999999998, "text": " or positive, or all the values are negative or positive. So basically, by saying whether" }, { "start": 1185.4599999999998, "end": 1190.8, "text": " or not these things are positive or negative, you can read out the controllability. And" }, { "start": 1190.8, "end": 1197.6599999999999, "text": " if they check whether that property holds, then that is is fairly well. So they argue" }, { "start": 1197.6599999999999, "end": 1204.84, "text": " here that this shows that it doesn't, it doesn't predict the the matrix they want. But the" }, { "start": 1204.84, "end": 1211.6399999999999, "text": " matrix that it predicts has the appropriate properties to solve this other task right" }, { "start": 1211.64, "end": 1220.92, "text": " here. Okay, that's experiment two. Experiment three, as you can imagine, is quite different," }, { "start": 1220.92, "end": 1227, "text": " sorry, quite similar in that they investigate these partial differential equations. In a" }, { "start": 1227, "end": 1232.3200000000002, "text": " Fourier transform, the model is given differential operator and an initial condition is trained" }, { "start": 1232.3200000000002, "end": 1238.68, "text": " to predict if a solution exists. And if so, whether it converges to zero, when t goes" }, { "start": 1238.68, "end": 1244.72, "text": " to infinity, the space, the dimensions between two and six. So the random guessing here" }, { "start": 1244.72, "end": 1250.98, "text": " would be, I guess, 25%, because it's two bits, you need to output. And this model performs" }, { "start": 1250.98, "end": 1256.68, "text": " extremely well, even up to this dimension six, there is a drop off with dimension, but" }, { "start": 1256.68, "end": 1266.3600000000001, "text": " it still does perform very, very well. Now, they go into the discussion a bit. And they" }, { "start": 1266.36, "end": 1272.52, "text": " and this, this is the part that in this paper, interests me, like, how do you interpret these" }, { "start": 1272.52, "end": 1277.76, "text": " results? Apparently, you give these mathematical things to a language model that has no clue" }, { "start": 1277.76, "end": 1283.24, "text": " of math. And just by looking at examples, it learns to produce correct solutions. And" }, { "start": 1283.24, "end": 1287.84, "text": " if you want to teach that to a human, the human would have to go through all these steps," }, { "start": 1287.84, "end": 1294.6799999999998, "text": " right? So something is happening here. And we'll want to find out what and the discussion" }, { "start": 1294.68, "end": 1302.2, "text": " is maybe they try to explain a bit why they think this happens. They say we studied five" }, { "start": 1302.2, "end": 1307.4, "text": " problems of advanced mathematics from widely research. In three of them, we predict qualitative" }, { "start": 1307.4, "end": 1313.3200000000002, "text": " and theoretical features. In two, we perform numerical computations. According to mathematical" }, { "start": 1313.3200000000002, "end": 1319.04, "text": " theory, solving these problems requires a combination of advanced techniques, symbolic" }, { "start": 1319.04, "end": 1325.28, "text": " and numerical that seem unlikely to be learnable from examples. Yet our model achieves more" }, { "start": 1325.28, "end": 1333.36, "text": " than 95% accuracy on all qualitative tasks. And between 65 and 85 on numerical computations," }, { "start": 1333.36, "end": 1341.12, "text": " such high performances over difficult mathematical tasks may come as a surprise. One way to generate" }, { "start": 1341.12, "end": 1346.96, "text": " data set of problems with their solutions consists in sampling the solution first and" }, { "start": 1346.96, "end": 1352.16, "text": " deriving an associated problem. For instance, pairs of functions with their integrals can" }, { "start": 1352.16, "end": 1357.68, "text": " be generated by sampling and differentiating from random functions. So here they hedge" }, { "start": 1357.68, "end": 1362.26, "text": " against there's this criticism and this was mainly a criticism of their other paper, which" }, { "start": 1362.26, "end": 1367.92, "text": " they already addressed in their other paper was if you want to find if you want to create" }, { "start": 1367.92, "end": 1374, "text": " a data set where you have the function, and then the label is the integral of the function," }, { "start": 1374, "end": 1382.56, "text": " then there is no common solution to derive these integrals. Sorry, the derive is a, there" }, { "start": 1382.56, "end": 1387.68, "text": " is no common solution to integrate functions. I mean, you can do it numerically, but there" }, { "start": 1387.68, "end": 1394.44, "text": " is no common symbolic solution to integrate any function. And that's why what you can" }, { "start": 1394.44, "end": 1399.4, "text": " do if you want to produce a data set is you start with the integral already, and then" }, { "start": 1399.4, "end": 1408.72, "text": " you differentiate that to get to get a thing. And then you know that if you integrate this," }, { "start": 1408.72, "end": 1414.66, "text": " you should get back your original function. But this biases the data set because the sampling" }, { "start": 1414.66, "end": 1420.76, "text": " is now not over these functions, but the sampling is over these functions. And that might lead" }, { "start": 1420.76, "end": 1427.4, "text": " to this distribution here being biased. So they hedge against that, which I don't care" }, { "start": 1427.4, "end": 1432.76, "text": " because it clearly in this paper, and they say in this paper, data sets for all considered" }, { "start": 1432.76, "end": 1437.5400000000002, "text": " tasks are generated using a forward approach by directly sampling as a result, potential" }, { "start": 1437.5400000000002, "end": 1442.4, "text": " bias caused by backward generative model do not apply here. And they studied problems" }, { "start": 1442.4, "end": 1445.48, "text": " from three different so they hedge against this argument that they could have a bias" }, { "start": 1445.48, "end": 1452.8400000000001, "text": " data set, which I don't think anyone reading this paper would leverage against them. Yeah," }, { "start": 1452.84, "end": 1461.72, "text": " so in so here, they basically say how good they are, how surprising this is all of this" }, { "start": 1461.72, "end": 1466.56, "text": " requires math, this part is irrelevant, because it hedges against an argument that I don't" }, { "start": 1466.56, "end": 1472.1, "text": " think is reasonable against the paper. And then the last thing in their discussion is" }, { "start": 1472.1, "end": 1476.84, "text": " an objection traditionally raised is that the model might memorize a very large number" }, { "start": 1476.84, "end": 1481.6799999999998, "text": " of cases and interpolate between them, which I think we know in language model happens" }, { "start": 1481.68, "end": 1486.8400000000001, "text": " often. Right? Oh, by the way, have I shown you how they encode this into the language" }, { "start": 1486.8400000000001, "end": 1493.6000000000001, "text": " model? I have not. This is the I guess this is the craziest part. They don't even put" }, { "start": 1493.6000000000001, "end": 1500.8400000000001, "text": " the numbers there. Wait, wait, they don't even put the numbers there. They actually" }, { "start": 1500.8400000000001, "end": 1507.24, "text": " put the as I understand it, they put the string tokens here, right? So they put the string" }, { "start": 1507.24, "end": 1516.2, "text": " tokens of the math, and then even like compose to the number 142, they would put as now there's" }, { "start": 1516.2, "end": 1523.74, "text": " an integer and then the token one, the token four and the token two. Okay. And the decimal" }, { "start": 1523.74, "end": 1532.52, "text": " point representation is the sequence float three dot one for e in negative one. So this" }, { "start": 1532.52, "end": 1537.8799999999999, "text": " is it's really just a string, there is no, like the model would even have to learn the" }, { "start": 1537.8799999999999, "end": 1547.32, "text": " decimal representation of numbers to get that this four here is actually not not just a" }, { "start": 1547.32, "end": 1553.54, "text": " different token than two, but it's 20 times larger because it is in the position one in" }, { "start": 1553.54, "end": 1558.2, "text": " front of two. So it's not two times larger, like four is to two, but because four is," }, { "start": 1558.2, "end": 1563.6000000000001, "text": " you know, one digit away from two, it's 20 times larger. And then this here is actually" }, { "start": 1563.6000000000001, "end": 1570.04, "text": " 50 times larger than this. So it seems like a quite inconvenient way to input data into" }, { "start": 1570.04, "end": 1575.56, "text": " the model. And yet the model is super accurate, right? And we already know that these language" }, { "start": 1575.56, "end": 1580.44, "text": " models, what they tend to do is they tend to memorize the training data or abstracted" }, { "start": 1580.44, "end": 1587.76, "text": " in a way that they can sort of interpolate between fuzzy versions of the training data." }, { "start": 1587.76, "end": 1593.34, "text": " Here they say this is unlikely, sorry, this is unlikely because first, because the size" }, { "start": 1593.34, "end": 1600.28, "text": " of our problem space is too large to be memorized. So say for all consider problems, we did not" }, { "start": 1600.28, "end": 1607.12, "text": " get a single duplicate over 50 million generated examples. Second, because in some of our problems," }, { "start": 1607.12, "end": 1612.92, "text": " such as non autonomous control, even a model with a one layer and 64 dimensions obtains" }, { "start": 1612.92, "end": 1618.6000000000001, "text": " a high accuracy and such a small model would never be able to memorize that many examples," }, { "start": 1618.6000000000001, "end": 1623.98, "text": " which is true, right? This is this is a fair defense against you're just interpolating" }, { "start": 1623.98, "end": 1631.48, "text": " training data. But I think the kind of broader, the broader scope of this criticism would" }, { "start": 1631.48, "end": 1637.72, "text": " be something like your model is just kind of learning the pattern regularities of the" }, { "start": 1637.72, "end": 1643.64, "text": " textual data that you feed in. It's not actually learning math, it's just learning sort of," }, { "start": 1643.64, "end": 1648.92, "text": " okay, there is like a cosine. And if there's a cosine here, followed by an exponential" }, { "start": 1648.92, "end": 1657.2, "text": " function that often leads to like a very low number of this lambda, right? And then if" }, { "start": 1657.2, "end": 1662.1200000000001, "text": " a very similar thing comes, it comes across a very similar thing in the test sample, even" }, { "start": 1662.1200000000001, "end": 1666.76, "text": " though it's not exactly the same thing, it will map it to like a similar place in the" }, { "start": 1666.76, "end": 1671.72, "text": " label space. I mean, this is literally machine learning, this is literally regression. But" }, { "start": 1671.72, "end": 1681.2, "text": " I think the more the broader scope of this criticism is that what your model might be" }, { "start": 1681.2, "end": 1688.36, "text": " doing might simply be sort of a very simple regression on these tokens or on these context" }, { "start": 1688.36, "end": 1695.08, "text": " dependent tokens, rather than this internal mathematical reasoning. And I don't, while" }, { "start": 1695.08, "end": 1703.12, "text": " it is true that it's probably not memorizing any examples, this still doesn't. And while" }, { "start": 1703.12, "end": 1709.6, "text": " it is also true that they did not get a single exact duplicate, what would be interesting" }, { "start": 1709.6, "end": 1715.8, "text": " to know is how many like approximate duplicates, so can you basically solve the problem with" }, { "start": 1715.8, "end": 1720.76, "text": " a nearest neighbor approach? That would be my question. Can you solve the problem with" }, { "start": 1720.76, "end": 1726.24, "text": " a nearest neighbor approach over their training data set? Because that means you basically" }, { "start": 1726.24, "end": 1734.7, "text": " don't need the mathematical knowledge. They say third, because for some of our problems," }, { "start": 1734.7, "end": 1740.4, "text": " we know from mathematical theory, that solutions, IEG, the real value of eigenvalues cannot" }, { "start": 1740.4, "end": 1746.84, "text": " be obtained by simple interpolation. And I mean, that is also a valid defense. But I" }, { "start": 1746.84, "end": 1752.6399999999999, "text": " think the argument goes further than just simple interpolation. What we mean by interpolation" }, { "start": 1752.6399999999999, "end": 1759.32, "text": " is not we interpolate the real values of the eigenvalues. What we mean by interpolation" }, { "start": 1759.32, "end": 1765.04, "text": " is sort of interpolation in the regression space of these tokens. Like we know that if" }, { "start": 1765.04, "end": 1774.9199999999998, "text": " we go from a sine to a cosine, maybe the sine of the output flips at the end. And that's" }, { "start": 1774.92, "end": 1781.52, "text": " what we mean by interpolation. Like when we see two equations that are very similar, like" }, { "start": 1781.52, "end": 1793.76, "text": " x squared plus 4x minus the sine of x, and then we see x squared plus 5x minus twice" }, { "start": 1793.76, "end": 1800.26, "text": " the sine of x. What we mean by interpolation is that we now get a test example that says" }, { "start": 1800.26, "end": 1812.48, "text": " x squared plus, let's say, 4x minus 3 times the sine of x. Then what we would interpolate" }, { "start": 1812.48, "end": 1821.48, "text": " is sort of these things. I'm making a bad example right here. Maybe I should go with" }, { "start": 1821.48, "end": 1828.44, "text": " x squared and this is x third. I know these things aren't exactly equal, but this in the" }, { "start": 1828.44, "end": 1835.8400000000001, "text": " middle would be sort of an interpolation in token space. If you train the language model," }, { "start": 1835.8400000000001, "end": 1842.56, "text": " it will recognize that maybe I can interpolate whenever the coefficient here is just different" }, { "start": 1842.56, "end": 1847.5800000000002, "text": " or I can interpolate when there's just, you know, if there's like a log x here, that doesn't" }, { "start": 1847.5800000000002, "end": 1852.4, "text": " really change anything. So I can interpolate between the two, but I might not be able to" }, { "start": 1852.4, "end": 1857.54, "text": " interpolate when the exponent here is different. So if you give a training data set, you teach" }, { "start": 1857.54, "end": 1862.1599999999999, "text": " the model where it can interpolate and where it can't. Now again, it's not able to remember" }, { "start": 1862.1599999999999, "end": 1869.12, "text": " the training data, but it will be able to sort of abstract it and store it fuzzily and" }, { "start": 1869.12, "end": 1873.32, "text": " abstract the patterns from it, which is good, right? That's machine learning. But there's" }, { "start": 1873.32, "end": 1878.94, "text": " no evidence here that this does any mathematical reasoning. So up until now, all that has built" }, { "start": 1878.94, "end": 1887.3, "text": " up is sort of if you read the abstract, can advanced mathematical computations be learned" }, { "start": 1887.3, "end": 1894.56, "text": " from examples? Neural networks can learn advanced theorems, complex computation without built" }, { "start": 1894.56, "end": 1903.44, "text": " in mathematical knowledge. All of the story here, all of this showing of, hey, look at" }, { "start": 1903.44, "end": 1911.48, "text": " what steps is required to solve these problems. And even this discussion here basically says," }, { "start": 1911.48, "end": 1919.6, "text": " hey, you need mathematical complex reasoning to arrive at the solutions. And then in the" }, { "start": 1919.6, "end": 1928.84, "text": " conclusion, in the conclusion, they say, it seems that our models have learned to solve" }, { "start": 1928.84, "end": 1933, "text": " these problems, but that does not mean they learned these techniques we use to compute" }, { "start": 1933, "end": 1938.52, "text": " their solutions. Problems such as non-autonomous control involve long and complex chain of" }, { "start": 1938.52, "end": 1942.96, "text": " operations, yet even small models, so means one layer transformers with 64 dimensions," }, { "start": 1942.96, "end": 1948.4, "text": " achieve high accuracy. Most probably, our models learn shortcuts that allow them to" }, { "start": 1948.4, "end": 1954.96, "text": " solve specific problems without having to learn or understand their theoretical background." }, { "start": 1954.96, "end": 1964.8, "text": " Such a situation is common in everyday life. Yada, yada, yada. So here, in this paragraph" }, { "start": 1964.8, "end": 1970.12, "text": " here, they sort of counter their whole narrative of the paper. And that's, I guess that's sort" }, { "start": 1970.12, "end": 1974.72, "text": " of to, it's fair, right? They criticize their own work, which is good for research. It's" }, { "start": 1974.72, "end": 1981.2, "text": " also to hedge against criticism, and it's to be a bit real. This, it's a good paper," }, { "start": 1981.2, "end": 1985.84, "text": " right? Because it's a nice and interesting story. And then at the end, you also say," }, { "start": 1985.84, "end": 1991.52, "text": " look, this might actually not be all that what it's made up or what it seems like to" }, { "start": 1991.52, "end": 1998.28, "text": " be. And I agree with this statement right here. It's that probably the model learns" }, { "start": 1998.28, "end": 2004.08, "text": " shortcuts and the shortcuts might be just in a way of pattern matching. The pattern" }, { "start": 2004.08, "end": 2008.56, "text": " matching of whatever patterns you extract from the training data, you pattern match" }, { "start": 2008.56, "end": 2014.92, "text": " that and you relatively simply interpolate between those matched patterns, not between" }, { "start": 2014.92, "end": 2019.2, "text": " the training data itself, but between the match patterns. And therefore, you can arrive" }, { "start": 2019.2, "end": 2024.8, "text": " at approximately good solutions. So what I would have liked to see from such a paper," }, { "start": 2024.8, "end": 2030.76, "text": " right? They say that we leave that to future research after making really kind of big claims" }, { "start": 2030.76, "end": 2036.04, "text": " in the introduction and the abstract. They have taken three different problems here," }, { "start": 2036.04, "end": 2045.32, "text": " right? There's this local stability, then there is this control theory, and then there" }, { "start": 2045.32, "end": 2049.44, "text": " is this stability. They have three different problems. And okay, they try to show that" }, { "start": 2049.44, "end": 2056.2799999999997, "text": " they can apply this to a diverse range. But what I would have expected from a paper like" }, { "start": 2056.2799999999997, "end": 2064.04, "text": " this is they even spell out, here are four things that you need to do to solve this if" }, { "start": 2064.04, "end": 2070.6, "text": " we were to teach this to a human, right? Now, if you have trained a model and you evaluated" }, { "start": 2070.6, "end": 2075.44, "text": " it, it is really good at this task for which you thought you need, you know, to do these" }, { "start": 2075.44, "end": 2083.24, "text": " four steps. What would be really interesting is to now introspect your model and see, can" }, { "start": 2083.24, "end": 2091.52, "text": " I somehow show that my model has in somewhere in the intermediate layers has this quantity" }, { "start": 2091.52, "end": 2096.88, "text": " right here? And it's not just nearest neighboring in some learned pattern space. That would" }, { "start": 2096.88, "end": 2102.2400000000002, "text": " be an actually interesting research question, right? So rather, in my mind, rather than" }, { "start": 2102.2400000000002, "end": 2106.76, "text": " having three different things where they all, you know, they demonstrate the same thing" }, { "start": 2106.76, "end": 2111.42, "text": " over and over and over again, that this actually works, it would be a much more interesting" }, { "start": 2111.42, "end": 2116.2400000000002, "text": " question to introspect the model and parse out can can I, for example, you can see, can" }, { "start": 2116.2400000000002, "end": 2123.26, "text": " I reconstruct this quantity from the inside of the model? When the model isn't specifically" }, { "start": 2123.26, "end": 2130, "text": " trained to give me back this quantity, because I know this quantity would be a step on these" }, { "start": 2130, "end": 2135.2000000000003, "text": " on the path of the solution, right? If I want to get the solution, I almost have to calculate" }, { "start": 2135.2000000000003, "end": 2141.6400000000003, "text": " this quantity. Can I parse this out from the middle of the model somewhere? When the model" }, { "start": 2141.6400000000003, "end": 2146.44, "text": " isn't explicitly trained to give me this, if I can, then I can really make the point" }, { "start": 2146.44, "end": 2151.94, "text": " that the model does something like this and learn something like this from data. Whereas" }, { "start": 2151.94, "end": 2157.48, "text": " if I can't, that would be more of an evidence that the model is simply sort of pattern matching," }, { "start": 2157.48, "end": 2165.68, "text": " close enough, seen examples in the training data. Right? So that's a bit of my of my criticism" }, { "start": 2165.68, "end": 2172, "text": " right here is that they they show it works, which is pretty cool. But then they, they" }, { "start": 2172, "end": 2178.52, "text": " don't do the sort of interesting experiments of these of this introspection right here," }, { "start": 2178.52, "end": 2184.16, "text": " which is a bit sad, but you know, they leave it for future research, which I guess is going" }, { "start": 2184.16, "end": 2190.24, "text": " to be themselves. And that's how you make two papers. So no, I don't want to be too" }, { "start": 2190.24, "end": 2198, "text": " critical. It's a very cool paper. And I invite you to check it out and leave a like and subscribe" }, { "start": 2198, "end": 2203.2, "text": " and leave a comment of what you think of this kind of research of this paper, and whether" }, { "start": 2203.2, "end": 2207.56, "text": " or not you think I'm totally wrong. That's entirely possible. Okay, I'll see you next" }, { "start": 2207.56, "end": 2208.56, "text": " time. Bye bye." }, { "start": 2208.56, "end": 2237.56, "text": " Transcribed by https://otter.ai" } ]
ZfDZRX3WiJg
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
VirTex: Learning Visual Representations from Textual Annotations (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "cnn", "visual", "resnet", "caption", "nlp", "transformer", "vasvani", "attention", "text", "coco", "imagenet", "convolutional neural network", "adaptation", "transfer learning", "quality", "unsupervised", "self-supervised" ]
Pre-training a CNN backbone for visual transfer learning has recently seen a big push into the direction of incorporating more data, at the cost of less supervision. This paper investigates the opposite: Visual transfer learning by pre-training from very few, but very high-quality samples on an image captioning task. OUTLINE: 0:00 - Intro & Overview 1:00 - Pre-Training for Visual Tasks 3:40 - Quality-Quantity Tradeoff 5:50 - Image Captioning 8:35 - VirTex Method 14:30 - Linear Classification 20:30 - Ablations 22:05 - Fine-Tuning 25:45 - Attention Visualization 27:30 - Conclusion & Remarks Paper: https://arxiv.org/abs/2006.06666 Code: https://github.com/kdexd/virtex Abstract: The de-facto approach to many vision tasks is to start from pretrained visual representations, typically learned via supervised training on ImageNet. Recent methods have explored unsupervised pretraining to scale to vast quantities of unlabeled images. In contrast, we aim to learn high-quality visual representations from fewer images. To this end, we revisit supervised pretraining, and seek data-efficient alternatives to classification-based pretraining. We propose VirTex -- a pretraining approach using semantically dense captions to learn visual representations. We train convolutional networks from scratch on COCO Captions, and transfer them to downstream recognition tasks including image classification, object detection, and instance segmentation. On all tasks, VirTex yields features that match or exceed those learned on ImageNet -- supervised or unsupervised -- despite using up to ten times fewer images. Authors: Karan Desai, Justin Johnson Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're looking at Vertex Learning Visual Representations from Textual Annotations by Karen Desai and Justin Johnson of the University of Michigan. So this paper at its core is pretty simple. On a high level it proposes to take the task of image captioning, which is where you're given an image and you're asked to produce a caption for the image, and basically train a model to do this, and then just take the visual part of it as a baseline to transfer learn on other visual tasks. And that appears to work surprisingly well if you don't have much data. So if you 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 an 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 cats, and maybe all of these pixels here are sky. And so it labels every pixel. There's many visual tasks that you can formulate, and they all sort of share the same architecture. And specifically, they all share this part right here. 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 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 many 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. You have a very good learning signal, but even ImageNet has like 1 million images. But for example, the internet has many more images. So what you could do is you could train on this much bigger 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. You rotate it 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's also a number of techniques that do supervised pre training and then transfer learning. You can maybe watch my video on big transfer, which is a very large attempt to do to pre train a backbone for visual tasks. All right. Now, you can see right here that the sort of direction is that the more data the better. So that's sort of the idea here that ImageNet is a big data set, we can train a really good backbone. But you know, the internet is an even bigger data set, we don't have labels. So there's a trade off. But we potentially can train an even better visual backbone to then transfer learn with. This paper goes into a different direction. They say, look, if you go in this direction right here, you get more images, but you get less information per image. So with 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 to label you have to resort to self supervised. What if we go into the other direction, and we look for images that have very high quality annotations, but maybe we don't have as many? Can we can we do the same thing? Can we learn good backbones by trading off quality for quantity in this case, and their quantity and quality trade off is they go for descriptions. So they'll go for something like this, where you'll have an image, and you'll have a caption for the image. And so they show these on a line here, semantically dense, semantically sparse, but their task is going to be caption generation. So their back their mod, their task is given an image, I want to produce a caption. And there are data sets that you can train this from in a supervised fashion, which of course, these are very expensive to create. I mean, if you want to create an ImageNet data set, then you have to label each image. But if you want to create a caption data set, that's even harder because human really needs to sit down, look at the image. And in ImageNet, everything is like one class. But here you need to look at the image. And then you'll have to come up with like an adequate description. Here the adequate description is an orange, sorry, an orange and white, an orange and white cat near a plate, and the white cake. Okay. So that's, that's the caption right here. And of course, the caption is ambiguous. So you'll have to collect multiple captions per image. And you'll have to make sure that the humans that do this do a good job and so on. So this these are very, very expensive data sets, but they are very high quality. If you think of what does what does a single label, let's just take 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 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 the backdrop here to say, Hey, can't we can't we do? Can't we pre train a backbone from maybe a small data set, but that has so much information, like a caption date, image caption data set. Okay, so their method is nothing more. They train image captioning, and then they use the visual backbone for transfer learning. So this is the model, there's an image, the image goes into this visual backbone right here, which is a resin at 50. So this is a very, very standard convolutional neural network. And that gives you these features. So these features are seven by seven by 2048. This is the standard output of a resin at 50. And then from this part on, they do a linear projection, such that they can now input it into a language model. So they have visual features. And now they feed those into the language model. And the language model is just a transformer, actually two transformers. So one transformer, they're both autoregressive, one transformer tries to predict the caption in a forward way. And the other transformer tries to predict the caption in a backward way. And 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 decode this, sorry, I mixed this up. This is the decoder. This is the encoder. The only difference right here is that this encoder is no longer a transformer, but is this ResNet, this ResNet 50. Okay, because now you don't have an image as a, you can think of it like a translation task. You want to translate from images to text. Okay, so your input is going to be an image and the signal is going like it would go in the original transformer into the decoder. It would come from the image. So from these visual features goes here. So in this drawing, this thing is going in here. And then you simply predict the next word and you do it in both directions. And the reason you can do it in both directions here, this wasn't, is not the case, of course, if you have a 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 bi directional way. You don't need, you don't need this at inference time. So at inference time, you simply cut off this part right here. That's your visual backbone. Okay. 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. Alright, so convolutional network to encode the images that gives you features, visual features. Those visual features go into two transformers, both try to predict the caption of the image, one in a forward motion, one in a backward motion. And you train it to predict as accurately as possible the gold standard captions that you have in your data set. That's it. If you train this model well, that means the model can produce accurate captions for these images, which means that it has learned something meaningful about the image to the degree of course, that the original caption that was in your data set was a good descriptive caption. But we're just we're going to assume that the in these data sets, this is the case. Alright, that's what they do. Now, interesting thing here is that in their standard in their standard in their standard setup, they only have one of these transformer layers. So of these things right here, they only have one. And that's like I think it's like 2000 units wide, but or sorry, the hidden dimension is 2000 units or 2048. But they only have one layer. So what that means is that this transformer is not very powerful. So most that you force most of the power to come from the visual encoder, the visual encoder had basically has to do most of the work. And then the transformer is going to simply be a very shallow language model on top of that. And that of course makes your visual backbone even better. Alright, we can pretty much skip the rest. That's the idea. Like that there's nothing more to it. You train this from the beginning, you don't use any pre trained, whatever you train this from scratch. And then you use this. And then the first experiment, they simply train a linear classifier on top of that representation. So they freeze the backbone, and then they use a linear classifier. And they compare this to baselines. So one of the baseline is image net supervised, where you use the same backbone, but you train it on image net in a supervised fashion. Okay, and then you use that backbone to transfer out of the text, it's kind of like what big transfer does, but just on the regular 1000 class image net baseline. Then you have the sort of the unsupervised pre training ones. So moco, so pearly pearly some, I want to go into pearl, 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 cocoa is trained on the cocoa data set. And the cocoa data set is what this paper here, the vertex paper uses cocoa is this image captioning data set. Now what's important to note is that cocoa has about 10% only of the images of image net. So it's considerably smaller. Now let's see how these things fair. Right here, you can see on the x axis, the number of images, okay, the number of images that the data set or that the pre training method trains on. Now, of course, some of these are going to be capped because for some data sets, there are just not more images available, right? So they're going to be capped here, the ones that are training on cocoa and the ones that are training on image net are going to be capped here. 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 unsupervised self supervised baselines are even lower. But if you go to more images, they sort of get closer to image net. And in their own papers, there are there are some evidence that if you self supervised train for long enough, you can actually surpass image net supervised pre training, but I'm not so sure that that's really the case. But you can see here the trade off between higher quality information, but smaller data sets versus lower quality information, but more data per data set. And yeah, if I guess if you were to if you were to pre train these self supervised methods with lots more data in a self supervised manner, they would maybe end up even higher than image net. Now this graph here is sort of the same thing where they also train a linear classifier. And you can see right here that now the image net supervised baseline is outperforming vertex by a lot. So what's happening here? Now this here is actually this is on image net. So the task here that you transfer learn is image net. Here it was like a neutral task Pascal VOC. None of these methods have trained on Pascal. They simply have trained on their own data set. These have trained on cocoa. This has trained on image net. And then they have transfer learned to Pascal. Now, the task is actually the transfer learning task is image net. So naturally, the the thing that was pre trained in a supervised fashion on image net is going to have a huge advantage in this task, because it basically has already learned the task beforehand, whereas the vertex, it has pre trained on cocoa, 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 that baseline is going to outperform it. But so pretty cool to see here that in this smaller image regime, and also consider this down here, if you go even an order of magnitude lower, it's really shining that if you have higher quality information, and you make use of it, you don't need as many images. And now we knew this for a long time. But this now is showing the same for transfer learning for visual transfer learning. So this was when we froze the backbone. And then we trained a linear classifier on top, they go, they make a short excursion here and show how different parts of their model affect their final performance. And they find that, for example, the by captioning, which I believe is the is forward and backward captioning significantly helps, for example, compared to only forward captioning. And they also find that it'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. Oh, I was I was wrong, actually, they the 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 to, to afford to make it worth. And also if you make the network deeper here, you make the transformer have more layers, the performance goes up. But again, the gains are marginal. So I guess they're going to leave it away. So their baseline, as you can see, is these resin at 50 with the one layer of 1024 size. So this is now the last task, it's the fine tuning task. So this is what most people would do is they would train a backbone, and then they would fine tune it on a different data set on or on a different task where they don't have much labels. And here the situation looks a bit different. So if you look at, for example, a task on cocoa, so there are several tasks on cocoa, one of them is image captioning, which they use for peritra for pre training. If you do other tasks on cocoa, you can see right here that compared to the supervised baseline, this vertex, it performs about the same or maybe a bit worse. But what you can see is it performs significantly better than, for example, moco that was only trained on cocoa. So again, this shows that if you have the same data set, higher quality information makes it worth it. And it's even better, as you can see, on moco that was trained on image net is 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 LVS 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 the 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 outperform it by a significant margin. But then on this task right here, they again lag behind. So I think the point of the paper isn't really to show that that this is the best thing ever. But the point of the paper is to show that you can go about pre trainings, basically, the the common assumption is that you need more and more and more and more data for your model to learn about the data set. And they conclude here, no, actually, you can do with with very few data points as long as they have high quality annotations. Okay, so I think that's the point of the of the paper that and they don't always outperform the other baselines and whatnot. But they keep, they keep the performance the same, which basically means that this is an option. Here is a pretty cool result where they visualize the attention of their image captioning model, because they train an image captioning model. And you can really see that the image captioning model learns something meaningful about the image. So when it's a bird flying, the attention is mainly on the bird, as you can see, then over the the attention widens out over the image, air. So over the air, the attention is here in the sky and on the on the ocean. And then it goes near the ocean. And then the attention is on the ocean itself. As you can see, so they have a bunch of these images and they're they're pretty cool here a dog, so focused on the dog riding on and then you can see the attention going down because on is riding on means probably there's something below the dog. A surfboard. Now the attention is fully on the surfboard in. So as soon as you say in the attention, as you can see, it widens out. So I think that's that's fairly cool, fairly cool demonstration that the model understands sort of the the in relation, namely, if it is focused on something, and that something is in something else, then it widens the attention out to see what it is in, okay, the ocean, and then it focuses the attention on the ocean. So that's, that's a pretty, that's a pretty cool result. I guess we already knew this because we could train image captioning models before. It's just to show that it actually makes sense to use them as a pre training task for backbones. Now, what's the future of this, the authors here in their introduction, they make a claim that this has a good future because they here they only train on this small data set, right, it's smaller than 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 10 times less images. And they they say something to the effect of you do you know, it would be pretty easy to collect more data for this task, because the internet is full of images. And mostly these images have like some text with them. They, you know, they have these descriptions or they have text around it, people write something about the images, you could like 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 data sets with these these image captioning data sets like Coco, they have very, very high quality annotations. So this this text here is very high quality is really a descriptive text of the image that tries to capture what a human can see visually in the image. And as soon as you go out to the internet and collect a text around images, that's not going to be the case that information is again going to be quite low quality. And so I doubt that the performance here would hold up or that the claim you can easily, you know, you can easily create more data for this task holds up. So that's a bit my worry about the future of this, but it's definitely cool and definitely shows these quality quantity trade off very well. Alright, 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, "end": 6.08, "text": " Hi there! Today we're looking at Vertex Learning Visual Representations from Textual Annotations" }, { "start": 6.08, "end": 13, "text": " by Karen Desai and Justin Johnson of the University of Michigan. So this paper at its core is pretty" }, { "start": 13, "end": 18.8, "text": " simple. On a high level it proposes to take the task of image captioning, which is where" }, { "start": 18.8, "end": 23.8, "text": " you're given an image and you're asked to produce a caption for the image, and basically" }, { "start": 23.8, "end": 30.96, "text": " train a model to do this, and then just take the visual part of it as a baseline to transfer" }, { "start": 30.96, "end": 38.38, "text": " learn on other visual tasks. And that appears to work surprisingly well if you don't have" }, { "start": 38.38, "end": 45.6, "text": " much data. So if you don't have much data to pre-train on, this appears to work very" }, { "start": 45.6, "end": 53.66, "text": " well. Alright, as always, if you like content like this, then consider sharing it out, subscribing" }, { "start": 53.66, "end": 61.64, "text": " to the channel, or tell me what you think in the comments. So as I already said, the" }, { "start": 61.64, "end": 68.84, "text": " idea here is pretty simple. So people have been looking for pre-training tasks for visual" }, { "start": 68.84, "end": 75.72, "text": " tasks. So a visual task is anything where the input is an image, and then you usually" }, { "start": 75.72, "end": 80.44, "text": " have some sort of neural network that processes the image, and then at the end you can have" }, { "start": 80.44, "end": 85.39999999999999, "text": " many things. So you could have a classifier that classifies the image into one of many" }, { "start": 85.39999999999999, "end": 93.96, "text": " classes. If you know ImageNet, that's a thing. So if there's a cat here, then the ImageNet" }, { "start": 93.96, "end": 100.92, "text": " classifier here would say cat. Or you could have something like an object detector that" }, { "start": 100.92, "end": 108.4, "text": " tries to predict on the image where the cat is, like with a bounding box. You could have" }, { "start": 108.4, "end": 115.32000000000001, "text": " a semantic segmentation where it's like all of these pixels here are cats, and maybe all" }, { "start": 115.32000000000001, "end": 122.92, "text": " of these pixels here are sky. And so it labels every pixel. There's many visual tasks that" }, { "start": 122.92, "end": 128.36, "text": " you can formulate, and they all sort of share the same architecture. And specifically, they" }, { "start": 128.36, "end": 135.08, "text": " all share this part right here. If you will, this is the visual encoder. It's usually a" }, { "start": 135.08, "end": 140.68, "text": " convolutional neural network. And what's really different between the tasks is mostly this" }, { "start": 140.68, "end": 146.68, "text": " last part here that does the actual task. But this is often called the backbone. So" }, { "start": 146.68, "end": 154.32000000000002, "text": " this is the backbone. And the idea now is, if I have a bunch of these tasks, sometimes" }, { "start": 154.32000000000002, "end": 158.28, "text": " I don't have many labels for these tasks. I don't have many labeled images so that I" }, { "start": 158.28, "end": 165.48, "text": " could train this big architecture from scratch, like in medical images or just in domains" }, { "start": 165.48, "end": 170.68, "text": " where you don't have many images. So couldn't I somehow come up with a method to create" }, { "start": 170.68, "end": 178.44, "text": " this backbone beforehand? So to create backbone given another dataset. And the simplest variant" }, { "start": 178.44, "end": 185.72, "text": " here is you take a big image dataset, such as ImageNet, and then you train a classifier," }, { "start": 185.72, "end": 190.44, "text": " like we said, to predict some classes on it. And then because an ImageNet has a lot of" }, { "start": 190.44, "end": 194.6, "text": " images, then this is your backbone. And then whenever you have a different task, you simply" }, { "start": 194.6, "end": 201.92, "text": " take the backbone, transfer it over, and then train the other. Basically, you continue training" }, { "start": 201.92, "end": 207.4, "text": " on the other task. That's called transfer learning. The question is, how do you get" }, { "start": 207.4, "end": 214.64, "text": " a good backbone? So if you train on something like ImageNet, then this is of course a supervised" }, { "start": 214.64, "end": 220, "text": " task. You have a very good learning signal, but even ImageNet has like 1 million images." }, { "start": 220, "end": 224.83999999999997, "text": " But for example, the internet has many more images. So what you could do is you could" }, { "start": 224.83999999999997, "end": 229.95999999999998, "text": " train on this much bigger dataset that you collected from the internet. Let's call it" }, { "start": 229.95999999999998, "end": 235.23999999999998, "text": " internet. But there you don't have labels, right? So what you'll have to resort to is" }, { "start": 235.23999999999998, "end": 240, "text": " instead of supervised learning is self supervised learning, where you have an image and maybe" }, { "start": 240, "end": 245.64, "text": " you rotate it to the right. So here is our cat. You rotate it to the right. And then" }, { "start": 245.64, "end": 252.6, "text": " you have a classifier that predicts that this image was rotated to the right. And then that" }, { "start": 252.6, "end": 259.72, "text": " will become your backbone. These self supervised methods, they work very well. There is a different" }, { "start": 259.72, "end": 265.6, "text": " number of them. For example, MoCo, things like this. And there's also a number of techniques" }, { "start": 265.6, "end": 271.28000000000003, "text": " that do supervised pre training and then transfer learning. You can maybe watch my video on" }, { "start": 271.28000000000003, "end": 277.84000000000003, "text": " big transfer, which is a very large attempt to do to pre train a backbone for visual" }, { "start": 277.84000000000003, "end": 286, "text": " tasks. All right. Now, you can see right here that the sort of direction is that the more" }, { "start": 286, "end": 290.88, "text": " data the better. So that's sort of the idea here that ImageNet is a big data set, we can" }, { "start": 290.88, "end": 295.56, "text": " train a really good backbone. But you know, the internet is an even bigger data set, we" }, { "start": 295.56, "end": 300.15999999999997, "text": " don't have labels. So there's a trade off. But we potentially can train an even better" }, { "start": 300.15999999999997, "end": 306.12, "text": " visual backbone to then transfer learn with. This paper goes into a different direction." }, { "start": 306.12, "end": 311.92, "text": " They say, look, if you go in this direction right here, you get more images, but you get" }, { "start": 311.92, "end": 318.2, "text": " less information per image. So with ImageNet, at least you have the label, right per image." }, { "start": 318.2, "end": 322.8, "text": " But if you simply take a photo of the internet, you don't even have to label you have to resort" }, { "start": 322.8, "end": 329.47999999999996, "text": " to self supervised. What if we go into the other direction, and we look for images that" }, { "start": 329.47999999999996, "end": 336.36, "text": " have very high quality annotations, but maybe we don't have as many? Can we can we do the" }, { "start": 336.36, "end": 343.88, "text": " same thing? Can we learn good backbones by trading off quality for quantity in this case," }, { "start": 343.88, "end": 352.68, "text": " and their quantity and quality trade off is they go for descriptions. So they'll go for" }, { "start": 352.68, "end": 359.68, "text": " something like this, where you'll have an image, and you'll have a caption for the image." }, { "start": 359.68, "end": 366.08, "text": " And so they show these on a line here, semantically dense, semantically sparse, but their task" }, { "start": 366.08, "end": 372.6, "text": " is going to be caption generation. So their back their mod, their task is given an image," }, { "start": 372.6, "end": 378.56, "text": " I want to produce a caption. And there are data sets that you can train this from in" }, { "start": 378.56, "end": 383.76000000000005, "text": " a supervised fashion, which of course, these are very expensive to create. I mean, if you" }, { "start": 383.76000000000005, "end": 389.3, "text": " want to create an ImageNet data set, then you have to label each image. But if you want" }, { "start": 389.3, "end": 394.58000000000004, "text": " to create a caption data set, that's even harder because human really needs to sit down," }, { "start": 394.58000000000004, "end": 400.36, "text": " look at the image. And in ImageNet, everything is like one class. But here you need to look" }, { "start": 400.36, "end": 404.40000000000003, "text": " at the image. And then you'll have to come up with like an adequate description. Here" }, { "start": 404.40000000000003, "end": 411.04, "text": " the adequate description is an orange, sorry, an orange and white, an orange and white cat" }, { "start": 411.04, "end": 417.84000000000003, "text": " near a plate, and the white cake. Okay. So that's, that's the caption right here. And" }, { "start": 417.84000000000003, "end": 423.52000000000004, "text": " of course, the caption is ambiguous. So you'll have to collect multiple captions per image." }, { "start": 423.52000000000004, "end": 427.52000000000004, "text": " And you'll have to make sure that the humans that do this do a good job and so on. So this" }, { "start": 427.52, "end": 432.96, "text": " these are very, very expensive data sets, but they are very high quality. If you think" }, { "start": 432.96, "end": 437.96, "text": " of what does what does a single label, let's just take ImageNet, ImageNet has a single" }, { "start": 437.96, "end": 444.52, "text": " label per class. Let's say this is cat or cake for that matter. It just sort of gives" }, { "start": 444.52, "end": 450.88, "text": " you very few bits of information. But if you consider the text here, an orange cat and" }, { "start": 450.88, "end": 457.6, "text": " a white cat, an orange and white cat, you know that there is a cat, right? You know" }, { "start": 457.6, "end": 463.52, "text": " that it's one cat, you know what its color is, orange and white, then you know that there" }, { "start": 463.52, "end": 469.71999999999997, "text": " is a white cake, right? So you know the other object. And you know the relation, they are" }, { "start": 469.71999999999997, "end": 476.68, "text": " near each other. Okay, same for here, a brown and white puppy. So this is one object and" }, { "start": 476.68, "end": 483.44, "text": " the description of the object. There is a there are apples, there is a green lawn, and" }, { "start": 483.44, "end": 488.56, "text": " the relations between them are also clear. The puppy is lying on the green lawn and looking" }, { "start": 488.56, "end": 496.4, "text": " at the apples. So the information in captions is so much more dense than just labels. And" }, { "start": 496.4, "end": 504.9, "text": " that's the that's the backdrop here to say, Hey, can't we can't we do? Can't we pre train" }, { "start": 504.9, "end": 510.67999999999995, "text": " a backbone from maybe a small data set, but that has so much information, like a caption" }, { "start": 510.67999999999995, "end": 519.36, "text": " date, image caption data set. Okay, so their method is nothing more. They train image captioning," }, { "start": 519.36, "end": 523.4399999999999, "text": " and then they use the visual backbone for transfer learning. So this is the model, there's" }, { "start": 523.4399999999999, "end": 529.3, "text": " an image, the image goes into this visual backbone right here, which is a resin at 50." }, { "start": 529.3, "end": 536.3199999999999, "text": " So this is a very, very standard convolutional neural network. And that gives you these features." }, { "start": 536.3199999999999, "end": 543.3399999999999, "text": " So these features are seven by seven by 2048. This is the standard output of a resin at" }, { "start": 543.3399999999999, "end": 550, "text": " 50. And then from this part on, they do a linear projection, such that they can now" }, { "start": 550, "end": 556.3199999999999, "text": " input it into a language model. So they have visual features. And now they feed those into" }, { "start": 556.32, "end": 564.34, "text": " the language model. And the language model is just a transformer, actually two transformers." }, { "start": 564.34, "end": 571.1600000000001, "text": " So one transformer, they're both autoregressive, one transformer tries to predict the caption" }, { "start": 571.1600000000001, "end": 576.4000000000001, "text": " in a forward way. And the other transformer tries to predict the caption in a backward" }, { "start": 576.4000000000001, "end": 582.72, "text": " way. And that's down here. So in this direction is backward because the caption has been reversed." }, { "start": 582.72, "end": 586.8000000000001, "text": " If you don't know what a transformer is, I've made several videos on transformers. The first" }, { "start": 586.8000000000001, "end": 592.96, "text": " one is attention is all you need. And that's sort of the same, the same kind of transformer" }, { "start": 592.96, "end": 600.5600000000001, "text": " they use here. So as you can see right here, you have this multi-head attention, the layer" }, { "start": 600.5600000000001, "end": 607.48, "text": " normalization attention from the decoder. Now the difference between the original Vasvani" }, { "start": 607.48, "end": 614.24, "text": " attention is all you need transformer. And this one is that in the original transformer," }, { "start": 614.24, "end": 619.08, "text": " you had, for example, if you had a machine translation task, you would have the French," }, { "start": 619.08, "end": 626.64, "text": " maybe a French sentence over here. And then you would have the beginnings of German sentence" }, { "start": 626.64, "end": 630.36, "text": " here, right? This is what you have already produced. And now you're asking what should" }, { "start": 630.36, "end": 637.22, "text": " the next word be. And the architecture was such that there is a decoder transformer right" }, { "start": 637.22, "end": 644.5600000000001, "text": " here and that there is an encoder transformer that encodes whatever you already had. And" }, { "start": 644.5600000000001, "end": 649.96, "text": " then at some point there is this cross attention, right? There is the signal from the decoder" }, { "start": 649.96, "end": 657.08, "text": " going into the encoder and the encoder incorporating that. And then at the end right here, the encoder" }, { "start": 657.08, "end": 662.36, "text": " would predict or the entire transformer would predict what the next word will be. The only" }, { "start": 662.36, "end": 669.52, "text": " difference right here is that the decode this, sorry, I mixed this up. This is the decoder." }, { "start": 669.52, "end": 677.2, "text": " This is the encoder. The only difference right here is that this encoder is no longer a transformer," }, { "start": 677.2, "end": 685.02, "text": " but is this ResNet, this ResNet 50. Okay, because now you don't have an image as a," }, { "start": 685.02, "end": 690.72, "text": " you can think of it like a translation task. You want to translate from images to text." }, { "start": 690.72, "end": 696.6800000000001, "text": " Okay, so your input is going to be an image and the signal is going like it would go in" }, { "start": 696.6800000000001, "end": 701.88, "text": " the original transformer into the decoder. It would come from the image. So from these" }, { "start": 701.88, "end": 711.6800000000001, "text": " visual features goes here. So in this drawing, this thing is going in here. And then you" }, { "start": 711.6800000000001, "end": 716.6600000000001, "text": " simply predict the next word and you do it in both directions. And the reason you can" }, { "start": 716.66, "end": 724, "text": " do it in both directions here, this wasn't, is not the case, of course, if you have a" }, { "start": 724, "end": 728.16, "text": " decoder like a standard transformer task, because you don't need to do inference at" }, { "start": 728.16, "end": 734.0799999999999, "text": " this, you just need to do training. And training you can do using teacher forcing. And so you" }, { "start": 734.0799999999999, "end": 740.28, "text": " can do this in a bi directional way. You don't need, you don't need this at inference time." }, { "start": 740.28, "end": 748, "text": " So at inference time, you simply cut off this part right here. That's your visual backbone." }, { "start": 748, "end": 753.72, "text": " Okay. And these features here, those are going to be the features that you then train your" }, { "start": 753.72, "end": 758.88, "text": " task on. And sometimes you fine tune this or sometimes you keep it frozen, you can choose" }, { "start": 758.88, "end": 766.06, "text": " that. Alright, so convolutional network to encode the images that gives you features," }, { "start": 766.06, "end": 771.4799999999999, "text": " visual features. Those visual features go into two transformers, both try to predict" }, { "start": 771.4799999999999, "end": 778.3199999999999, "text": " the caption of the image, one in a forward motion, one in a backward motion. And you" }, { "start": 778.3199999999999, "end": 784.8199999999999, "text": " train it to predict as accurately as possible the gold standard captions that you have in" }, { "start": 784.8199999999999, "end": 790.1999999999999, "text": " your data set. That's it. If you train this model well, that means the model can produce" }, { "start": 790.2, "end": 796.2, "text": " accurate captions for these images, which means that it has learned something meaningful" }, { "start": 796.2, "end": 800.9200000000001, "text": " about the image to the degree of course, that the original caption that was in your data" }, { "start": 800.9200000000001, "end": 806.7800000000001, "text": " set was a good descriptive caption. But we're just we're going to assume that the in these" }, { "start": 806.7800000000001, "end": 813.6400000000001, "text": " data sets, this is the case. Alright, that's what they do. Now, interesting thing here" }, { "start": 813.64, "end": 820.4399999999999, "text": " is that in their standard in their standard in their standard setup, they only have one" }, { "start": 820.4399999999999, "end": 825.96, "text": " of these transformer layers. So of these things right here, they only have one. And that's" }, { "start": 825.96, "end": 832.92, "text": " like I think it's like 2000 units wide, but or sorry, the hidden dimension is 2000 units" }, { "start": 832.92, "end": 838.8, "text": " or 2048. But they only have one layer. So what that means is that this transformer is" }, { "start": 838.8, "end": 846.68, "text": " not very powerful. So most that you force most of the power to come from the visual" }, { "start": 846.68, "end": 852.4, "text": " encoder, the visual encoder had basically has to do most of the work. And then the transformer" }, { "start": 852.4, "end": 861.12, "text": " is going to simply be a very shallow language model on top of that. And that of course makes" }, { "start": 861.12, "end": 867.8, "text": " your visual backbone even better. Alright, we can pretty much skip the rest. That's the" }, { "start": 867.8, "end": 871.5999999999999, "text": " idea. Like that there's nothing more to it. You train this from the beginning, you don't" }, { "start": 871.5999999999999, "end": 877.64, "text": " use any pre trained, whatever you train this from scratch. And then you use this. And then" }, { "start": 877.64, "end": 882.9599999999999, "text": " the first experiment, they simply train a linear classifier on top of that representation." }, { "start": 882.9599999999999, "end": 888, "text": " So they freeze the backbone, and then they use a linear classifier. And they compare" }, { "start": 888, "end": 893.88, "text": " this to baselines. So one of the baseline is image net supervised, where you use the" }, { "start": 893.88, "end": 900.28, "text": " same backbone, but you train it on image net in a supervised fashion. Okay, and then you" }, { "start": 900.28, "end": 904.2, "text": " use that backbone to transfer out of the text, it's kind of like what big transfer does," }, { "start": 904.2, "end": 914.24, "text": " but just on the regular 1000 class image net baseline. Then you have the sort of the unsupervised" }, { "start": 914.24, "end": 922.6, "text": " pre training ones. So moco, so pearly pearly some, I want to go into pearl, but moco is" }, { "start": 922.6, "end": 927.32, "text": " this momentum contrast, which is one of these supervised methods that has been shown to" }, { "start": 927.32, "end": 935.36, "text": " work really, really well. And this is also moco en is trained on image net, but now without" }, { "start": 935.36, "end": 941.6800000000001, "text": " the labels, because moco is unsupervised. And moco cocoa is trained on the cocoa data" }, { "start": 941.6800000000001, "end": 949.32, "text": " set. And the cocoa data set is what this paper here, the vertex paper uses cocoa is this image" }, { "start": 949.32, "end": 957.5600000000001, "text": " captioning data set. Now what's important to note is that cocoa has about 10% only of" }, { "start": 957.5600000000001, "end": 968.12, "text": " the images of image net. So it's considerably smaller. Now let's see how these things fair." }, { "start": 968.12, "end": 974.72, "text": " Right here, you can see on the x axis, the number of images, okay, the number of images" }, { "start": 974.72, "end": 980.4, "text": " that the data set or that the pre training method trains on. Now, of course, some of" }, { "start": 980.4, "end": 985.0400000000001, "text": " these are going to be capped because for some data sets, there are just not more images" }, { "start": 985.0400000000001, "end": 990.9200000000001, "text": " available, right? So they're going to be capped here, the ones that are training on cocoa" }, { "start": 990.9200000000001, "end": 994.5600000000001, "text": " and the ones that are training on image net are going to be capped here. And you can already" }, { "start": 994.5600000000001, "end": 1004.26, "text": " see that the vertex outperforms the image net supervised baseline by pretty much when" }, { "start": 1004.26, "end": 1010, "text": " you only give it this many images. Okay, so the way you do it is, in this case, you simply" }, { "start": 1010, "end": 1017.08, "text": " train these models. Now the brown one is when you take one caption per image, but the data" }, { "start": 1017.08, "end": 1021.6, "text": " set actually has more more than one caption per image. So when you use more than one," }, { "start": 1021.6, "end": 1029.22, "text": " you can still boost your performance a bit. And that works way better than when you do" }, { "start": 1029.22, "end": 1035.6000000000001, "text": " the supervised pre training on image net, which would get you here with about the same" }, { "start": 1035.6000000000001, "end": 1040.64, "text": " amount of images. Now, when you use all of image net, you can see here you can get to" }, { "start": 1040.64, "end": 1046.56, "text": " a similar performance right here, but you have to use a 10 times bigger data set to" }, { "start": 1046.56, "end": 1054.52, "text": " get there. Right, so this already shows you sort of the advantage here. Now also consider" }, { "start": 1054.52, "end": 1060.24, "text": " the difference to the unsupervised ones. So if you look at the same amount of images," }, { "start": 1060.24, "end": 1068.68, "text": " the unsupervised self supervised baselines are even lower. But if you go to more images," }, { "start": 1068.68, "end": 1073.8, "text": " they sort of get closer to image net. And in their own papers, there are there are some" }, { "start": 1073.8, "end": 1080.84, "text": " evidence that if you self supervised train for long enough, you can actually surpass" }, { "start": 1080.84, "end": 1089.08, "text": " image net supervised pre training, but I'm not so sure that that's really the case. But" }, { "start": 1089.08, "end": 1098.56, "text": " you can see here the trade off between higher quality information, but smaller data sets" }, { "start": 1098.56, "end": 1108.84, "text": " versus lower quality information, but more data per data set. And yeah, if I guess if" }, { "start": 1108.84, "end": 1114.6799999999998, "text": " you were to if you were to pre train these self supervised methods with lots more data" }, { "start": 1114.6799999999998, "end": 1122.52, "text": " in a self supervised manner, they would maybe end up even higher than image net. Now this" }, { "start": 1122.52, "end": 1126.9599999999998, "text": " graph here is sort of the same thing where they also train a linear classifier. And you" }, { "start": 1126.9599999999998, "end": 1132.24, "text": " can see right here that now the image net supervised baseline is outperforming vertex" }, { "start": 1132.24, "end": 1137.28, "text": " by a lot. So what's happening here? Now this here is actually this is on image net. So" }, { "start": 1137.28, "end": 1143.6399999999999, "text": " the task here that you transfer learn is image net. Here it was like a neutral task Pascal" }, { "start": 1143.6399999999999, "end": 1149.6399999999999, "text": " VOC. None of these methods have trained on Pascal. They simply have trained on their" }, { "start": 1149.6399999999999, "end": 1153.76, "text": " own data set. These have trained on cocoa. This has trained on image net. And then they" }, { "start": 1153.76, "end": 1159.8, "text": " have transfer learned to Pascal. Now, the task is actually the transfer learning task" }, { "start": 1159.8, "end": 1167.68, "text": " is image net. So naturally, the the thing that was pre trained in a supervised fashion" }, { "start": 1167.68, "end": 1173, "text": " on image net is going to have a huge advantage in this task, because it basically has already" }, { "start": 1173, "end": 1180.32, "text": " learned the task beforehand, whereas the vertex, it has pre trained on cocoa, not on image" }, { "start": 1180.32, "end": 1186.44, "text": " net. And you can see, if you give it the same amount of images for pre training, it can" }, { "start": 1186.44, "end": 1191.96, "text": " actually it's it's fairly close to the image net baseline. So that's pretty respectable" }, { "start": 1191.96, "end": 1196.68, "text": " right there. Now, again, of course, if you use more images on the same data set that" }, { "start": 1196.68, "end": 1201.6000000000001, "text": " you then train for, then of course, the the image that baseline is going to outperform" }, { "start": 1201.6000000000001, "end": 1210.06, "text": " it. But so pretty cool to see here that in this smaller image regime, and also consider" }, { "start": 1210.06, "end": 1215.98, "text": " this down here, if you go even an order of magnitude lower, it's really shining that" }, { "start": 1215.98, "end": 1221.98, "text": " if you have higher quality information, and you make use of it, you don't need as many" }, { "start": 1221.98, "end": 1229.2, "text": " images. And now we knew this for a long time. But this now is showing the same for transfer" }, { "start": 1229.2, "end": 1238.46, "text": " learning for visual transfer learning. So this was when we froze the backbone. And then" }, { "start": 1238.46, "end": 1246.88, "text": " we trained a linear classifier on top, they go, they make a short excursion here and show" }, { "start": 1246.88, "end": 1253.2, "text": " how different parts of their model affect their final performance. And they find that," }, { "start": 1253.2, "end": 1261.52, "text": " for example, the by captioning, which I believe is the is forward and backward captioning" }, { "start": 1261.52, "end": 1268.7, "text": " significantly helps, for example, compared to only forward captioning. And they also" }, { "start": 1268.7, "end": 1274.6399999999999, "text": " find that it's significantly outperforms other pre training tasks that they could do. And" }, { "start": 1274.6399999999999, "end": 1280.44, "text": " they also investigate whether how big their models should be. So here, this is their baseline" }, { "start": 1280.44, "end": 1291.94, "text": " model. Oh, I was I was wrong, actually, they the it's one layer of with 1024. You can see" }, { "start": 1291.94, "end": 1297.68, "text": " as you make the layer bigger and bigger, that generally helps. But I guess they decided" }, { "start": 1297.68, "end": 1304.8200000000002, "text": " against it because the gains are too little to, to afford to make it worth. And also if" }, { "start": 1304.82, "end": 1311.08, "text": " you make the network deeper here, you make the transformer have more layers, the performance" }, { "start": 1311.08, "end": 1315.24, "text": " goes up. But again, the gains are marginal. So I guess they're going to leave it away." }, { "start": 1315.24, "end": 1325.48, "text": " So their baseline, as you can see, is these resin at 50 with the one layer of 1024 size." }, { "start": 1325.48, "end": 1333.4199999999998, "text": " So this is now the last task, it's the fine tuning task. So this is what most people would" }, { "start": 1333.42, "end": 1338.76, "text": " do is they would train a backbone, and then they would fine tune it on a different data" }, { "start": 1338.76, "end": 1344.66, "text": " set on or on a different task where they don't have much labels. And here the situation looks" }, { "start": 1344.66, "end": 1352.1000000000001, "text": " a bit different. So if you look at, for example, a task on cocoa, so there are several tasks" }, { "start": 1352.1000000000001, "end": 1358.14, "text": " on cocoa, one of them is image captioning, which they use for peritra for pre training." }, { "start": 1358.14, "end": 1365.92, "text": " If you do other tasks on cocoa, you can see right here that compared to the supervised" }, { "start": 1365.92, "end": 1374.6000000000001, "text": " baseline, this vertex, it performs about the same or maybe a bit worse. But what you can" }, { "start": 1374.6000000000001, "end": 1382.68, "text": " see is it performs significantly better than, for example, moco that was only trained on" }, { "start": 1382.68, "end": 1388.42, "text": " cocoa. So again, this shows that if you have the same data set, higher quality information" }, { "start": 1388.42, "end": 1394.6000000000001, "text": " makes it worth it. And it's even better, as you can see, on moco that was trained on image" }, { "start": 1394.6000000000001, "end": 1400.78, "text": " net is just not quite as good as the supervised baseline. But all of them, of course, are" }, { "start": 1400.78, "end": 1405.48, "text": " better than just a randomly initialized network that is trained from scratch. I mean, that's" }, { "start": 1405.48, "end": 1411.3400000000001, "text": " the entire point of transfer learning, that you are better than simply learning from scratch." }, { "start": 1411.34, "end": 1419.3799999999999, "text": " And this shows throughout this experiment, except in this LVS masking task, where they" }, { "start": 1419.3799999999999, "end": 1427.22, "text": " do outperform the other the other things, the other methods significantly. Now the lower" }, { "start": 1427.22, "end": 1433.6, "text": " numbers on this tasks task also means that the task is harder than these tasks right" }, { "start": 1433.6, "end": 1438.74, "text": " here. And therefore, there are more gains to be made. And therefore, you could hypothesize" }, { "start": 1438.74, "end": 1446.16, "text": " that the bigger, the more quality information that you input can be used in a better way." }, { "start": 1446.16, "end": 1451.76, "text": " So maybe more complex, also, the more complex a task is might also have an influence on" }, { "start": 1451.76, "end": 1457.3, "text": " how well the transfer learning works, if you come from a high quality transfer learning" }, { "start": 1457.3, "end": 1462.06, "text": " task versus a low quality transfer learning tasks." }, { "start": 1462.06, "end": 1473.26, "text": " Yeah, so the lastly compare here with the again with Pascal VOC object detection, and" }, { "start": 1473.26, "end": 1479.46, "text": " these iNaturalist classification, where I believe this is also a transfer learning task" }, { "start": 1479.46, "end": 1487.6399999999999, "text": " with fine tuning. And as you can see, they can also hold up against the supervised baseline," }, { "start": 1487.64, "end": 1493.0400000000002, "text": " or even outperform it at sometimes the green triangles mean that they outperform it by" }, { "start": 1493.0400000000002, "end": 1499.3000000000002, "text": " a significant margin. But then on this task right here, they again lag behind. So I think" }, { "start": 1499.3000000000002, "end": 1507.3400000000001, "text": " the point of the paper isn't really to show that that this is the best thing ever. But" }, { "start": 1507.3400000000001, "end": 1513.7, "text": " the point of the paper is to show that you can go about pre trainings, basically, the" }, { "start": 1513.7, "end": 1518.42, "text": " the common assumption is that you need more and more and more and more data for your model" }, { "start": 1518.42, "end": 1525.66, "text": " to learn about the data set. And they conclude here, no, actually, you can do with with very" }, { "start": 1525.66, "end": 1532.76, "text": " few data points as long as they have high quality annotations. Okay, so I think that's" }, { "start": 1532.76, "end": 1537.7, "text": " the point of the of the paper that and they don't always outperform the other baselines" }, { "start": 1537.7, "end": 1544.14, "text": " and whatnot. But they keep, they keep the performance the same, which basically means" }, { "start": 1544.14, "end": 1550.38, "text": " that this is an option. Here is a pretty cool result where they visualize the attention" }, { "start": 1550.38, "end": 1555.06, "text": " of their image captioning model, because they train an image captioning model. And you can" }, { "start": 1555.06, "end": 1559.98, "text": " really see that the image captioning model learns something meaningful about the image." }, { "start": 1559.98, "end": 1566.74, "text": " So when it's a bird flying, the attention is mainly on the bird, as you can see, then" }, { "start": 1566.74, "end": 1573.66, "text": " over the the attention widens out over the image, air. So over the air, the attention" }, { "start": 1573.66, "end": 1580.02, "text": " is here in the sky and on the on the ocean. And then it goes near the ocean. And then" }, { "start": 1580.02, "end": 1586.54, "text": " the attention is on the ocean itself. As you can see, so they have a bunch of these images" }, { "start": 1586.54, "end": 1592.6200000000001, "text": " and they're they're pretty cool here a dog, so focused on the dog riding on and then you" }, { "start": 1592.62, "end": 1600.06, "text": " can see the attention going down because on is riding on means probably there's something" }, { "start": 1600.06, "end": 1608.3, "text": " below the dog. A surfboard. Now the attention is fully on the surfboard in. So as soon as" }, { "start": 1608.3, "end": 1614.4199999999998, "text": " you say in the attention, as you can see, it widens out. So I think that's that's fairly" }, { "start": 1614.4199999999998, "end": 1620.6599999999999, "text": " cool, fairly cool demonstration that the model understands sort of the the in relation, namely," }, { "start": 1620.66, "end": 1627.0600000000002, "text": " if it is focused on something, and that something is in something else, then it widens the attention" }, { "start": 1627.0600000000002, "end": 1634.3400000000001, "text": " out to see what it is in, okay, the ocean, and then it focuses the attention on the ocean." }, { "start": 1634.3400000000001, "end": 1638.8600000000001, "text": " So that's, that's a pretty, that's a pretty cool result. I guess we already knew this" }, { "start": 1638.8600000000001, "end": 1644.4, "text": " because we could train image captioning models before. It's just to show that it actually" }, { "start": 1644.4, "end": 1651.74, "text": " makes sense to use them as a pre training task for backbones. Now, what's the future" }, { "start": 1651.74, "end": 1657.9, "text": " of this, the authors here in their introduction, they make a claim that this has a good future" }, { "start": 1657.9, "end": 1663.74, "text": " because they here they only train on this small data set, right, it's smaller than image" }, { "start": 1663.74, "end": 1669.18, "text": " net, as you can see here, and they already get the same performance as if you train on" }, { "start": 1669.18, "end": 1674.5800000000002, "text": " the whole image net data set in a supervised fashion. Of course, they're also supervised," }, { "start": 1674.5800000000002, "end": 1681.38, "text": " but they have 10 times less images. And they they say something to the effect of you do" }, { "start": 1681.38, "end": 1686.38, "text": " you know, it would be pretty easy to collect more data for this task, because the internet" }, { "start": 1686.38, "end": 1694.78, "text": " is full of images. And mostly these images have like some text with them. They, you know," }, { "start": 1694.78, "end": 1698.18, "text": " they have these descriptions or they have text around it, people write something about" }, { "start": 1698.18, "end": 1703.18, "text": " the images, you could like mine Twitter, and then the responses when someone posts an image" }, { "start": 1703.18, "end": 1709.98, "text": " might tell you something about the image. But this definitely counteracts their this" }, { "start": 1709.98, "end": 1715.3400000000001, "text": " definitely counteracts their notion that these are very high quality labels, right? Their" }, { "start": 1715.3400000000001, "end": 1721.8, "text": " entire point here was that these annotations, these, these data sets with these these image" }, { "start": 1721.8, "end": 1727.18, "text": " captioning data sets like Coco, they have very, very high quality annotations. So this" }, { "start": 1727.18, "end": 1733.5800000000002, "text": " this text here is very high quality is really a descriptive text of the image that tries" }, { "start": 1733.5800000000002, "end": 1741.14, "text": " to capture what a human can see visually in the image. And as soon as you go out to the" }, { "start": 1741.14, "end": 1746.54, "text": " internet and collect a text around images, that's not going to be the case that information" }, { "start": 1746.54, "end": 1752.04, "text": " is again going to be quite low quality. And so I doubt that the performance here would" }, { "start": 1752.04, "end": 1758.98, "text": " hold up or that the claim you can easily, you know, you can easily create more data" }, { "start": 1758.98, "end": 1764.52, "text": " for this task holds up. So that's a bit my worry about the future of this, but it's definitely" }, { "start": 1764.52, "end": 1772.02, "text": " cool and definitely shows these quality quantity trade off very well. Alright, that was my" }, { "start": 1772.02, "end": 1778.34, "text": " two cents to the paper. I invite you to read it and tell me in the comments what you think" }, { "start": 1778.34, "end": 1782.34, "text": " about it and I'll see you next time." } ]
-_2AF9Lhweo
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Linformer: Self-Attention with Linear Complexity (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "facebook", "linear", "quadratic", "transformer", "attention", "self-attention", "multi-head attention", "t2t", "vasvani", "bert", "devlin", "roberta", "glue", "language modeling", "perplexity", "dot product", "johnson", "lindenstrauss", "random projection" ]
Transformers are notoriously resource-intensive because their self-attention mechanism requires a squared number of memory and computations in the length of the input sequence. The Linformer Model gets around that by using the fact that often, the actual information in the attention matrix is of lower rank and can be approximated. OUTLINE: 0:00 - Intro & Overview 1:40 - The Complexity of Self-Attention 4:50 - Embedding Dimension & Multiple Heads 8:45 - Formal Attention 10:30 - Empirical Investigation into RoBERTa 20:00 - Theorem: Self-Attention is Low Rank 28:10 - Linear Self-Attention Method 36:15 - Theorem: Linear Self-Attention 44:10 - Language Modeling 46:40 - NLP Benchmarks 47:50 - Compute Time & Memory Gains 48:20 - Broader Impact Statement 49:55 - Conclusion Paper: https://arxiv.org/abs/2006.04768 Abstract: Large transformer models have shown extraordinary success in achieving state-of-the-art results in many natural language processing applications. However, training and deploying these models can be prohibitively costly for long sequences, as the standard self-attention mechanism of the Transformer uses O(n2) time and space with respect to sequence length. In this paper, we demonstrate that the self-attention mechanism can be approximated by a low-rank matrix. We further exploit this finding to propose a new self-attention mechanism, which reduces the overall self-attention complexity from O(n2) to O(n) in both time and space. The resulting linear transformer, the \textit{Linformer}, performs on par with standard Transformer models, while being much more memory- and time-efficient. Authors: Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, Hao Ma Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're going to look at Linformer self-attention with linear complexity by Sinon Wang, Belinda Li, Madian Kabsa, Han Feng and Hao Ma of Facebook AI. So on a high level this paper observes that often the way we build transformers the self-attention matrix is low rank and can be approximated by first projecting the signal to a lower dimensional space and then performing these inner products that are responsible for attention in there. And thereby you save a lot of the complexity of multiplying full sequence length by full sequence length matrices but instead do these operations in the lower dimensional space. And they achieve a linear scaling of the transformer attention and we'll figure out how that is. As always if you like content like this consider subscribing, sharing, liking and commenting if you feel like it. Okay let's dive in. They say large transformer models have shown extraordinary success in achieving state-of-the-art results in many natural language processing applications. Okay so these, if you don't know what a transformer model is you can watch my video on the paper Attention is all you need. That was sort of the beginning of these transformers and it introduces the attention mechanism that we're going to look at today. If you don't know what an attention mechanism is you're not going to have a fun time in this paper. They say however training and deploying these models can be prohibitively costly for long sequences as the standard self attention mechanism of the transformer uses n squared time and space with respect to the sequence length. Now why is that? So really shortly to recap recap this the attention mechanism. These 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 feed-forward network you would simply connect everything to everything and sort of learn the weights of these of these connections. That's not what we do here. In a convolutional network you would simply connect each node to its immediate neighbors like this. But this is also not what we do here. What we do here is we route the information according to the information itself. So according to the incoming information right here we route the information that goes out and we do that by expressing 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. Now the information is simply routed by looking at the inner products 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 is in the same order of magnitude. So you can also imagine this to be something like 512. Now if you think of these matrices if you multiply the keys by the queries however you want to let's do it like this then you have the keys are n by D and the queries are D by n. Now since n and D in this case are the same dimension this matrix is 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 now this isn't actually the modern way of transformers as such because usually what we have is multi-head attention which means that we're going to split this inner dimension right here. We're going to split these vectors into many many lower dimensional vectors and then have attention mechanism on these lower dimensional vectors. And that's such that you don't only have one attention mechanism you have multiple attention mechanisms so you can route different kinds of information with these multiple attention heads. Now sometimes you would split this you could split this in a modern transformer up to like 16 different heads but here we're going to let's say we're going to split this into four subvectors each of 128 dimensions. So we're going to split this up and now if 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 these 512 dimensions actually only contain information that is 128 dimensional in nature. It's just distributed over 512 dimensions but most of these are redundant. So in fact in these modern transformers these thing here this matrix here is low rank and therefore that's what this paper sort of exploits we could we could approximate this by 128 dimensions. Okay this is our starting point. They go on and they say in this paper we demonstrate that the self-attention mechanism can be approximated by a low rank matrix. We further exploit this finding to propose a new self-attention mechanism which reduces the overall self-attention complexity from n squared to n in both time and space. The resulting linear transformer the Lin former performs on par with standard transformer models while being much more memory and time efficient. Alright so let's dive into their thing. This is how they formulate the attention mechanism. So right here the attention has queries and keys as you can see here. Now these W matrices you can largely ignore. The W simply maps the queries to so this is these are simply d by d matrices that are a linear transformation of the queries. You can sort of overlook them for the arguments in this paper. So these are the keys and the queries we talked about. The values here this is the actual information that's being routed. So what we want to do is we want to compute this product between queries and keys right here and scale it appropriately. But ultimately this is this product. Then run this through a softmax operation. That means we 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. 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. If sorry if you want to go look those up. But it is one of these transformer models and they take two data sets wiki103 and IMDB and they run them through this model and they look at this P matrix. So they look at how this information routing matrix is built and then they calculate the eigenvalues of that. So you calculate the eigenvalues and by looking at the eigenvalues you can look at the rank of a matrix broadly speaking. So if you list the eigenvalues in order of their size then a matrix that is sort of high dimensional has a high rank would have sort of a slope like this and that means as you go as you go to the next and next and next eigenvalue they drop like if you order a set of uniformly distributed numbers if you order them then it would look like this right so there is no particular dimension that's that's better than any or has much more information than any other. However if the matrix is approximately low rank you would look something like this and that would mean that most of the information is concentrated in very few dimensions and those are the ones with very high eigenvalues and most of the dimensions have no information. The thing you see here is simply the cumulative sum of these things so if you calculate the cumulative sum of this you'll get that over here. So if this is very high rank you would expect a curve that goes like this sort of slanted but not very. If this is very low rank you would expect a curve that goes very much into the corner right here and they show that the general shape here is such that there is this kind of a kink to it as you can see here. Now also notice that the axis here starts at 0.4 so actually this comes from down here somewhere and goes up and then goes like this. So they have a I feel they have a legitimate claim here that these matrices are approximately low rank and here they look at I don't actually know at which layer this is or if this is in all of the layers overall or something like this but they look at how this develops inside the layers so they look at the always the 128th eigenvalue and they discover that as they go deeper and deeper into the network this cumulative eigenvalue is higher and higher that means that network puts more and more information into fewer and fewer dimension in this routing as you go up the layers so it gets more and more skewed as you go up the layers it gets more and more into this corner right here so their claim appears to be more and more true. Now I have sort of thought about this a little and I've tried it out a bit myself and I invite you to just follow me here shortly. So right here I have a matrix that is just a random Gaussian matrix of size 512 by 512. If we look at the eigen spectrum of that so I have this function SVD it simply gives me the eigen spectrum of that then you can see that it sort of falls off uniformly and that will result in a in this cumulative sum of 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 and and let's look at the MT now this only goes to 128 because we only get back 128 singular values so let's make a lower dimensional matrix that's actually 512 by 512 so if we do this this is sort of what they're doing in this this will construct a 512 by 512 matrix but that is only of rank 128 right and you can see that at the 128 singular or eigenvalue this snaps right at the at the one so it's sort of like what they what they have okay so we've seen the difference between a let's say 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 there the matrices they look at these routing matrices they're not Gaussian they're not sort of distributed with mean zero and the nice variance they are the result of a softmax operation and in particular that means they're all positive and that means that their mean is not zero so if you look at a data set and it's mean it's not zero and you calculate like the the eigenvalues or in this case the principal component you will find that the first one will be very strong because that must account for the fact that the mean is not at the center 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 already see that this axis doesn't start at zero so let's go let's actually how do we do this xlim right xlim zero none so haha okay so the first one you simply have to imagine or I can do even something something more we can just put a zero in front here and that should do the trick no yes oh that's X I meant Y calm and dumb 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'll put a softmax and that gives you also this kink now you might think that wait this is that this kink looks a lot smaller than the other kink so but if we simply modify let's modify the standard deviation of this random matrix and you can see that this spectrum immediately changes right because of the interaction now between the softmax and the standard deviation if I only were to change the standard deviation on the normal M matrix and we can actually try this right here that wouldn't do much that would still look pretty much the same it's just differently scaled but in the interaction with the softmax now this changes the spectrum dramatically and here as you know these these transformers have always sort of like layer normalization and so on so probably the standard deviation if we if if these are sort of Gaussian the standard deviation before the softmax would be a lot smaller so let's go something like this so smaller than one and can we run this please and you can see that this kink immediately appears now it's not it's it's it's not the same thing as this other as this here because this is a lot smoother as you can see right here but still I feel that this might not actually be a result of the you know the fact that this is an attention mechanism but it simply might be the result of that you apply a softmax now still that doesn't change the fact that it is approximately a lower rank matrix everything they say holds but yeah maybe maybe one should also look into why exactly that happens but in fact it is low rank okay it is approximately low rank they've demonstrated this and now they go to their first first theory below we provide a theoretical answer a theoretical analysis of the above spectrum results okay so the theoretical analysis theorem one is self-attention is low rank and we're going to go through this just glance at it for now they say for any of these query key values and these matrices which of course you can ignore for now for any column vector W of matrix V W and W here that's the information that needs to be routed there exists a low rank matrix P tilde so this P tilde here is going to be their low rank approximation of the P matrix you can see it's still n by n but it's going to be low 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 occurs with high probability okay so the entire guarantee here the entire formula just basically means that this thing is small this norm is small what's this norm this norm is the distance between these two things now what are these two things this is the information that we want to route and this is the routing matrix and that simply means that if I route my information using the P tilde this approximation then I won't be too far away as if I had routed my information using the original P matrix okay that's that's it that's what the theorem says the theorem says if I route my information using this approximation then I am not too far away as it had I routed my information using the original routing matrix 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 Linden Strauss lemma this thing here or the JL for short and they're going to get this out of the JL now the Johnson Linden Strauss 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 have data distributed and I use a certain kind of projection matrix and there are a number so the the JL gives conditions on what these projections can be but for example a randomly sampled matrix with zero mean Gaussian entries and 1 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 2 then the projected data is related to the original data by the fact that the distances between the points in the original space will not be distorted too much so the distances between these points are approximately preserved through this projection okay so that's that's the that's the Johnson Linden Strauss lemma now you'll notice here there is no reference to the fact that this data is or isn't low rank it's simply high dimensional data projected to lower dimension and the distances are approximately preserved and this theory here and I've looked at it for a while now they simply define okay they define this P matrix as this attention mechanism and here you can see the A matrix we've discussed before which is actually low rank but we don't know yet if the softmax is they write it as this form right here of the exponential of each entry of a divided by this diagonal right here so in the softmax of course you have the exponential of each entry divided by the sum of the entries and they write this simply as two matrices but ultimately this is a matrix right here and all they do is they take this P matrix and they apply the Johnson Linden Strauss 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 simply says if you pull if you this here is going to be your P tilde so if you project R in this manner and obtain P tilde and then you use P tilde instead of P then this this is going to be very close in fact you can reformulate the JL into different variants such that it gives you things like this things like saying that the distance between this projected version and this unprojected version is going to be a constant smaller than a constant 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 it's you can do this with any matrix P right the JL doesn't concern itself with the nature of this matrix P it says any matrix any sort of high dimensional data you can project to low dimensional data and this holds if you choose the projection correctly which they do right here so to claim that this theorem proves that self-attention is low rank to me is a bit it's a bit of a statement that is not warranted like this here should read something like the Johnson Lindenstrout's lemma exists or something like this it I'm not I'm not sure like convince me otherwise but yeah so they go with this so they say given the low rank property of the context mapping matrix P now again I disagree that this has been shown except empirically one straightforward idea is to use singularality composition to approximate P with a low rank matrix P low as follows so what you could do is you could simply learn these low rank matrices and approximate P through it or you can decompose P as such and then have these easier inner products in dimension K but they say however this approach requires performing an SVD decomposition in each self-attention matrix which adds additional complexity therefore we propose another approach for a low rank approximation that avoids this added complexity okay so they now come up with their model and their model goes as follows so here on the left you see a classic attention mechanism with their projections built in what they're proposing is they say let's project the matrix K using one of these random projections and then this attention routing if you route if you now multiply so you multiply K and Q right here K times Q and then you put it into the softmax and then you use it to route this W so they say if we build in this projection matrix that will project K to a lower dimension and then we won't have as expensive of inner products now the important part to see here is that if you think of this lower projection the first thing you think is that you project this inner this hidden dimension D right to a lower dimension and that's not the case here you actually project the N so in in a conceptual framework so you can see right here forget about this this is this W matrix in a conceptual framework you see here is this N by D matrix which are the keys so N is the sequence length and D is the dimensions and what you want to do is you want to project that by this matrix which is K by N so you want to reduce the sequence length you can see in this matrix right here why that might work because N is much larger than D and that means this matrix can be at most rank D right so you should not lose too much you should sort of be able to preserve the information if you project this N to a K where the K if the K is still larger than the D or approximately in the same order of magnitude you should be able to preserve that information if you do it in a smart way so conceptually if we have our five token sequence like here and the next layer produces five tokens again what we first do is we say we know we know that the information we want is not five dimensional it's actually two dimensional because okay let's say these this inner dimension D is is two as well so we have two dimensional vectors each thing exposes two dimensional vectors so we first project the sequence of length five to a sequence of length two and we simply do that in a random manner so we have a random Gaussian matrix that assigns weights to mix these five into these two and again because the JL works for any sort of data but in my argumentation if you you know think that this here is low rank it's of rank two then you shouldn't lose too much information by projecting it to a sequence length two and now we do this attention mechanism so now we expose the keys and now we expose the queries up here and now you can see instead of routing five things with five things you only have to route five things with two things and so instead of having O and squared you now have O N K if K K is the number right here okay so this is the idea you project the sequence length and it comes from the fact that the sequence length is much larger than the dimensionality and therefore you can sort of preserve the information if you project in a smart way they build this in this fashion right here so the attention mechanism now before we saw it was between the queries and the keys right here they built now this projection matrix here that projects the keys into a lower dimensional sequence and the now such that this will result in an N by K attention matrix we saw over here you don't need to route N by N things you need to route N by K so this this routing table in here is now N by K now the next layer as you can see here it actually needs to produce a sequence of length five again right so we always transform sequence of length five into sequence of length five but now we have we have this N corresponds to the 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 don't 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 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 2 so this goes up with the sequence length and it should go up quadratically right and you can also see that the Lin former keeps fairly constant for the same K now of course as you increase the K of the Lin former the inference time will go up because now it's dependent on N times K and not on N times N okay so let's look a bit further of how you have to choose that K up here in the first theorem we there was a already a hint to it in the first theorem you had to choose K by 5 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 2 explains goes now to a linear shows how you can make self-attention linear okay they show again blah blah blah blah now you have to choose K at the minimum of these two things and you can see right here that one of them is independent of N so that means as N grows of course the minimum is no longer going to be this here the minimum is actually going to be the thing on the left and that is dependent on just D okay so you have D log D in here and that makes sense because in the very beginning we said hey D is actually much smaller than N and that means the information that is contained in these matrices is at most rank D so if we down project to K we should adjust K to what D is right if we adjust K to about the same thing as D we're guaranteed to not lose too much information so now we choose K according to D instead of according to N and therefore the computation is linear in N and N times K is like N times D to log D so it's linear in K and linear in D how do we get there so the first thing they do is they make these sort of Johnson-Lindenstrout 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 tension 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 is exactly the softmax what what I alluded to right so this softmax is the tricky part because if this weren't a softmax so if the softmax weren't here this would simply be a projection down and a projection up and the dilemma would almost apply as it is written right there you wouldn't have to actually do anything but the question is if this inside the softmax is is low rank can you make a claim that the entire softmax then is also low rank and it's not entirely clear because because oh yes we've done this so you can see right here that the softmax we have actually done the softmax of a low rank matrix so we have already seen the low rank matrix itself and how it immediately snaps to the to the upper axis after 128 now if we do the same thing for the softmax of that and we probably have to take away some of these dimensions the first few let's go with let's go to dimension 100 and look from there okay same thing okay that's pretty good I did not expect that hi there so this is Yannick from the future I've realized I've been an idiot in how I constructed these low rank matrices right here by multiplying MT by itself of course what's a better way to do it is to construct two independent 128 dimensional matrices like these two sub slices of M right here and then multiplying those together and looking at the SVD and you as you can see right here so the softmax of this is now not of this super low rank anymore it's still low rank but it's not not very it's not like hard low rank so if I just look at the matrix without the softmax then you can see it has a very peak that by at the 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 Yannick in the past who is wholly surprised that the two that if you multiply MT by itself that that will give you back the the exact same thing 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 resultant K has a dependency on sequence length 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 you 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 Lipschitz continuous in a compact region then we can choose a small enough Delta such that the as you can see here this now directly relates to this projection matrix within the exponential function to the projection matrix out of the exponential function so you can basically say that if I project first and then use the exponential function that's not too different than if I first use the exponential function and then project okay so that's the that's the sort of of of catch here now they only do this for the exponential function not the actual softmax as you can see here throughout they do it to the exponential function and also here in their statements the softmax isn't the exponential function the softmax is the exponential function divided by the sum of the exponential functions but I believe that this generalizes straightforwardly alright so for given choices of Delta and K they have shown that the Lin former in fact can do in a linear fashion what a transformer can do in a quadratic fashion and they are not too far off ok that's that's their point right here the results on these benchmarks 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 ok so something like this Lin former with K cost 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 Lin former but of course the point here is that the Lin former is much much much faster and can keep up now also the scale here of the perplexity you see these are percentage points in perplexity but I can't actually tell if that matters or not I think I think in the original transformer paper the perplexities hovered between like three point something and five point something so this might actually be sort of significant differences and I'm not sure they investigate different methods of sharing these weights of these of these projections and they seems like they don't find real differences but I don't want to go into that because this video is already really long and then they look at what happens if they up the sequence length that they put into the Lin former and you can see that the Lin former 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 Lin former 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 Lin former here will be better than this but then also variants of the Lin former will be worse and they'll even be worse than this and sometimes they'll be better sometimes this Lin former is good and sometimes the original model is the best so this sort of points to you can make the general claim that the Lin former doesn't destroy your your gains but also it's not like a a better model it's simply a faster model that in some tasks can keep up with the original model and they show that of course this is the real deal here that as you go up in length the performance gains and also sorry this this way the performance gains and the memory gains that you get by the Lin former 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 Yannick from the future just wanted to draw your attention on this beautiful broader impact statement in this paper saying our work focuses on making transformers more efficient everything cool potential positive in spec impacts of efficient transformers that's pretty cool it also has potential impact on training transformers on images since we can support very long sequences very cool furthermore there are positive environmental benefits very cool I mean these are all very cool things they say as such we see no immediate negative ethical or societal impacts of our work beyond what applies to the core building blocks of deep learning do better now this this honestly I agree with them right I completely agree with them that this is sort of a good thing you might trade off you know some accuracy might some make some approximations but you will get a much faster model and this model has any model can be used you know for things and and that they now have to pull out of there out of their but some way in in 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 back back to past Yannick all right this was the Lin former paper I hope this somewhat makes sense made sense to you I had to read it multiple times for it to make sense to me but ultimately it's all about the fact that you have these multiple heads and therefore your information is probably lower dimensional and you can abuse that and to just calculate in this lower dimension all right I'll see you next time bye bye
[ { "start": 0, "end": 4.96, "text": " Hi there! Today we're going to look at Linformer self-attention with linear" }, { "start": 4.96, "end": 11.84, "text": " complexity by Sinon Wang, Belinda Li, Madian Kabsa, Han Feng and Hao Ma of" }, { "start": 11.84, "end": 17.94, "text": " Facebook AI. So on a high level this paper observes that often the way we" }, { "start": 17.94, "end": 24, "text": " build transformers the self-attention matrix is low rank and can be" }, { "start": 24, "end": 29.080000000000002, "text": " approximated by first projecting the signal to a lower dimensional space and" }, { "start": 29.08, "end": 33.48, "text": " then performing these inner products that are responsible for attention in" }, { "start": 33.48, "end": 40.76, "text": " there. And thereby you save a lot of the complexity of multiplying full sequence" }, { "start": 40.76, "end": 46.84, "text": " length by full sequence length matrices but instead do these" }, { "start": 46.84, "end": 53.76, "text": " operations in the lower dimensional space. And they achieve a linear scaling" }, { "start": 53.76, "end": 60.64, "text": " of the transformer attention and we'll figure out how that is. As always if you" }, { "start": 60.64, "end": 65.48, "text": " like content like this consider subscribing, sharing, liking and" }, { "start": 65.48, "end": 73.4, "text": " commenting if you feel like it. Okay let's dive in. They say large transformer" }, { "start": 73.4, "end": 77.8, "text": " models have shown extraordinary success in achieving state-of-the-art results in" }, { "start": 77.8, "end": 83.44, "text": " many natural language processing applications. Okay so these, if you don't" }, { "start": 83.44, "end": 87.36, "text": " know what a transformer model is you can watch my video on the paper" }, { "start": 87.36, "end": 92.44, "text": " Attention is all you need. That was sort of the beginning of these" }, { "start": 92.44, "end": 96.75999999999999, "text": " transformers and it introduces the attention mechanism that we're going to" }, { "start": 96.75999999999999, "end": 100.72, "text": " look at today. If you don't know what an attention mechanism is you're not going" }, { "start": 100.72, "end": 106.96, "text": " to have a fun time in this paper. They say however training and deploying these" }, { "start": 106.96, "end": 111.92, "text": " models can be prohibitively costly for long sequences as the standard self" }, { "start": 111.92, "end": 117.12, "text": " attention mechanism of the transformer uses n squared time and space with" }, { "start": 117.12, "end": 122.44, "text": " respect to the sequence length. Now why is that? So really shortly to recap" }, { "start": 122.44, "end": 128.72, "text": " recap this the attention mechanism. These attention, these transformers they" }, { "start": 128.72, "end": 134.44, "text": " transform for basics let's say they transform one sequence into another. So" }, { "start": 134.44, "end": 141.28, "text": " here we have five tokens and the next layer will output five tokens. Okay so" }, { "start": 141.28, "end": 146.2, "text": " five tokens in five tokens out and the question is how do you route" }, { "start": 146.2, "end": 152.48, "text": " information between these five tokens from the first layer to produce the next" }, { "start": 152.48, "end": 156.92000000000002, "text": " layer. In a feed-forward network you would simply connect everything to" }, { "start": 156.92000000000002, "end": 162.56, "text": " everything and sort of learn the weights of these of these connections. That's not" }, { "start": 162.56, "end": 166.12, "text": " what we do here. In a convolutional network you would simply connect each" }, { "start": 166.12, "end": 172.36, "text": " node to its immediate neighbors like this. But this is also not what we do here." }, { "start": 172.36, "end": 176.98000000000002, "text": " What we do here is we route the information according to the information" }, { "start": 176.98000000000002, "end": 181.36, "text": " itself. So according to the incoming information right here we route the" }, { "start": 181.36, "end": 186.64000000000001, "text": " information that goes out and we do that by expressing" }, { "start": 186.64000000000001, "end": 192.32, "text": " queries and keys. So this incoming information is transformed first of all" }, { "start": 192.32, "end": 197.28, "text": " into what are called keys. Now keys are simply vectors so each node is going to" }, { "start": 197.28, "end": 203.23999999999998, "text": " expose a vector right here and each node in the higher layer. Now these are" }, { "start": 203.23999999999998, "end": 207.44, "text": " produced by the same from the same information down here but I'm going to" }, { "start": 207.44, "end": 212.24, "text": " draw it conceptually on the higher layer. So each node here is going to expose a" }, { "start": 212.24, "end": 217.64, "text": " query which is sort of like calling the query is calling for what kind of" }, { "start": 217.64, "end": 221.6, "text": " information do you want from the lower layer and the key is sort of exposing" }, { "start": 221.6, "end": 229.12, "text": " what type of information this node contains right now. Now the information" }, { "start": 229.12, "end": 234, "text": " is simply routed by looking at the inner products of the keys and" }, { "start": 234, "end": 238.72, "text": " the queries. So this information right here would probably be routed to this" }, { "start": 238.72, "end": 244.35999999999999, "text": " node right here whereas this one would probably be routed here. This one would" }, { "start": 244.35999999999999, "end": 248.28, "text": " be routed here. In fact this is a soft assignment so it's not like a hard" }, { "start": 248.28, "end": 252.56, "text": " routing it's a soft routing. Everything is routed to everything with different" }, { "start": 252.56, "end": 257.56, "text": " weights but the majority goes to the place where the inner product is high" }, { "start": 257.56, "end": 262.24, "text": " and this one is again routed here. So you can see this is the attention" }, { "start": 262.24, "end": 268.04, "text": " mechanism. In order to do this we need to compute the inner product of every" }, { "start": 268.04, "end": 273.96, "text": " single one of these queries with every single one of these keys. And this if" }, { "start": 273.96, "end": 281.28, "text": " our sequence length here is of length n is going to require n squared" }, { "start": 281.28, "end": 288.56, "text": " operations. Now here is another parameter we need to pay attention." }, { "start": 288.56, "end": 293.64, "text": " These vectors here they have a certain dimension and the certain dimension" }, { "start": 293.64, "end": 300.35999999999996, "text": " we're going to call D. The inner the embedding dimension of the vectors. Now" }, { "start": 300.36, "end": 308.40000000000003, "text": " in modern transformers you can think of n as something like maybe 512 tokens go" }, { "start": 308.40000000000003, "end": 313.40000000000003, "text": " into a transformer like this. And the hidden dimension here also is in the" }, { "start": 313.40000000000003, "end": 318.44, "text": " same order of magnitude. So you can also imagine this to be something like 512." }, { "start": 318.44, "end": 323.96000000000004, "text": " Now if you think of these matrices if you multiply the keys by the queries" }, { "start": 323.96, "end": 330.32, "text": " however you want to let's do it like this then you have the keys are n by D and" }, { "start": 330.32, "end": 336.56, "text": " the queries are D by n. Now since n and D in this case are the same" }, { "start": 336.56, "end": 342.79999999999995, "text": " dimension this matrix is of rank 512. It doesn't have to be but it's" }, { "start": 342.79999999999995, "end": 348.67999999999995, "text": " a pretty good bet that it's of rank 512. Maybe it's approximately lower rank but" }, { "start": 348.68, "end": 357.08, "text": " now this isn't actually the modern way of transformers as such because usually" }, { "start": 357.08, "end": 361.6, "text": " what we have is multi-head attention which means that we're going to split" }, { "start": 361.6, "end": 366.2, "text": " this inner dimension right here. We're going to split these vectors into many" }, { "start": 366.2, "end": 370.88, "text": " many lower dimensional vectors and then have attention mechanism on these lower" }, { "start": 370.88, "end": 376.36, "text": " dimensional vectors. And that's such that you don't only have one attention" }, { "start": 376.36, "end": 380.62, "text": " mechanism you have multiple attention mechanisms so you can route different" }, { "start": 380.62, "end": 386.88, "text": " kinds of information with these multiple attention heads. Now sometimes you would" }, { "start": 386.88, "end": 391.44, "text": " split this you could split this in a modern transformer up to like 16" }, { "start": 391.44, "end": 395.72, "text": " different heads but here we're going to let's say we're going to split this into" }, { "start": 395.72, "end": 403.12, "text": " four subvectors each of 128 dimensions. So we're going to split this up" }, { "start": 403.12, "end": 408.16, "text": " and now if this product here is only computed on these lower" }, { "start": 408.16, "end": 412.84000000000003, "text": " dimensional vectors so all of a sudden you no longer have n by D but you have" }, { "start": 412.84000000000003, "end": 421.7, "text": " like n by D over 4 and now this is 512 still but this now is 128 so the rank of" }, { "start": 421.7, "end": 427.88, "text": " this matrix is going to be 128. Mind it's still the thing that comes out is" }, { "start": 427.88, "end": 437.15999999999997, "text": " still a 512 by 512 matrix but it is of rank 128 and that means even though this" }, { "start": 437.15999999999997, "end": 444.56, "text": " matrix contains vectors that are of size 512 they could be they could be" }, { "start": 444.56, "end": 453.6, "text": " represented accurately by a matrix that's just 128 dimensions. Okay so these" }, { "start": 453.6, "end": 459.72, "text": " these 512 dimensions actually only contain information that is 128" }, { "start": 459.72, "end": 466.08000000000004, "text": " dimensional in nature. It's just distributed over 512 dimensions but most" }, { "start": 466.08000000000004, "end": 472.88, "text": " of these are redundant. So in fact in these modern transformers these thing" }, { "start": 472.88, "end": 478.84000000000003, "text": " here this matrix here is low rank and therefore that's what this paper sort" }, { "start": 478.84, "end": 488.88, "text": " of exploits we could we could approximate this by 128 dimensions. Okay" }, { "start": 488.88, "end": 494.56, "text": " this is our starting point. They go on and they say in this paper we" }, { "start": 494.56, "end": 499.79999999999995, "text": " demonstrate that the self-attention mechanism can be approximated by a low" }, { "start": 499.79999999999995, "end": 504.79999999999995, "text": " rank matrix. We further exploit this finding to propose a new self-attention" }, { "start": 504.8, "end": 510.16, "text": " mechanism which reduces the overall self-attention complexity from n squared" }, { "start": 510.16, "end": 515.08, "text": " to n in both time and space. The resulting linear transformer the Lin" }, { "start": 515.08, "end": 520.28, "text": " former performs on par with standard transformer models while being much more" }, { "start": 520.28, "end": 527.92, "text": " memory and time efficient. Alright so let's dive into their thing. This is how" }, { "start": 527.92, "end": 534.64, "text": " they formulate the attention mechanism. So right here the attention has queries" }, { "start": 534.64, "end": 540.16, "text": " and keys as you can see here. Now these W matrices you can largely ignore. The W" }, { "start": 540.16, "end": 545.84, "text": " simply maps the queries to so this is these are simply d by d matrices that" }, { "start": 545.84, "end": 550.72, "text": " are a linear transformation of the queries. You can sort of overlook them" }, { "start": 550.72, "end": 556.24, "text": " for the arguments in this paper. So these are the keys and the queries we" }, { "start": 556.24, "end": 561.12, "text": " talked about. The values here this is the actual information that's being routed." }, { "start": 561.12, "end": 564.88, "text": " So what we want to do is we want to compute this product between queries and" }, { "start": 564.88, "end": 570, "text": " keys right here and scale it appropriately. But ultimately this is" }, { "start": 570, "end": 577.44, "text": " this product. Then run this through a softmax operation. That means we" }, { "start": 577.44, "end": 583.48, "text": " normalize it such that it sums to one, the distribution sums to one. And then we" }, { "start": 583.48, "end": 591.5600000000001, "text": " want to route this information according to that distribution. So that's" }, { "start": 591.5600000000001, "end": 595.6, "text": " how they formulate an attention mechanism. Now notice something. This thing in here" }, { "start": 595.6, "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": 608.44, "text": " Now the actual thing that you would need to be low rank for their paper to hold" }, { "start": 608.44, "end": 614.44, "text": " is the matrix P which is different because this is after the softmax right." }, { "start": 614.44, "end": 620.08, "text": " So if the matrix P is low rank then you have a legitimate claim of approximating" }, { "start": 620.08, "end": 626.6800000000001, "text": " this routing via a low rank matrix. However if P is not low rank you don't." }, { "start": 626.6800000000001, "end": 634.84, "text": " Okay all right now the first thing they're going to show is that this is in" }, { "start": 634.84, "end": 639.72, "text": " fact low rank. So self-attention is low rank. And for that they make an" }, { "start": 639.72, "end": 647.08, "text": " empirical investigation into Roberta. So Roberta is a model that's based on BERT" }, { "start": 647.08, "end": 653.32, "text": " and I have made videos of both BERT and Roberta I believe. If sorry if you want" }, { "start": 653.32, "end": 658.9200000000001, "text": " to go look those up. But it is one of these transformer models and they take" }, { "start": 658.92, "end": 665.4, "text": " two data sets wiki103 and IMDB and they run them through this model and they" }, { "start": 665.4, "end": 671.8, "text": " look at this P matrix. So they look at how this information routing matrix is" }, { "start": 671.8, "end": 679.4, "text": " built and then they calculate the eigenvalues of that. So you calculate" }, { "start": 679.4, "end": 684.24, "text": " the eigenvalues and by looking at the eigenvalues you can look at the rank of" }, { "start": 684.24, "end": 692.12, "text": " a matrix broadly speaking. So if you list the eigenvalues in order of their size" }, { "start": 692.12, "end": 698.76, "text": " then a matrix that is sort of high dimensional has a high rank would have" }, { "start": 698.76, "end": 707.12, "text": " sort of a slope like this and that means as you go as you go to the next and" }, { "start": 707.12, "end": 712.2, "text": " next and next eigenvalue they drop like if you order a set of uniformly" }, { "start": 712.2, "end": 717.9200000000001, "text": " distributed numbers if you order them then it would look like this right so" }, { "start": 717.9200000000001, "end": 723.12, "text": " there is no particular dimension that's that's better than any or has much more" }, { "start": 723.12, "end": 728.4000000000001, "text": " information than any other. However if the matrix is approximately low rank you" }, { "start": 728.4000000000001, "end": 732, "text": " would look something like this and that would mean that most of the information" }, { "start": 732, "end": 736.74, "text": " is concentrated in very few dimensions and those are the ones with very high" }, { "start": 736.74, "end": 742.96, "text": " eigenvalues and most of the dimensions have no information. The thing you see" }, { "start": 742.96, "end": 747.6800000000001, "text": " here is simply the cumulative sum of these things so if you calculate the" }, { "start": 747.6800000000001, "end": 754, "text": " cumulative sum of this you'll get that over here. So if this is very high rank" }, { "start": 754, "end": 760.72, "text": " you would expect a curve that goes like this sort of slanted but not very. If" }, { "start": 760.72, "end": 765.4, "text": " this is very low rank you would expect a curve that goes very much into the" }, { "start": 765.4, "end": 773.84, "text": " corner right here and they show that the general shape here is such that there is" }, { "start": 773.84, "end": 780.88, "text": " this kind of a kink to it as you can see here. Now also notice that the axis here" }, { "start": 780.88, "end": 785.1999999999999, "text": " starts at 0.4 so actually this comes from down here somewhere and goes up and" }, { "start": 785.1999999999999, "end": 790.12, "text": " then goes like this. So they have a I feel they have a legitimate claim here" }, { "start": 790.12, "end": 795.92, "text": " that these matrices are approximately low rank and here they look at I don't" }, { "start": 795.92, "end": 800.68, "text": " actually know at which layer this is or if this is in all of the layers overall" }, { "start": 800.68, "end": 806.24, "text": " or something like this but they look at how this develops inside the layers so" }, { "start": 806.24, "end": 813.48, "text": " they look at the always the 128th eigenvalue and they discover that as" }, { "start": 813.48, "end": 818.94, "text": " they go deeper and deeper into the network this cumulative eigenvalue is" }, { "start": 818.94, "end": 823.2800000000001, "text": " higher and higher that means that network puts more and more information" }, { "start": 823.2800000000001, "end": 829.48, "text": " into fewer and fewer dimension in this routing as you go up the layers so it" }, { "start": 829.48, "end": 834.44, "text": " gets more and more skewed as you go up the layers it gets more and more into" }, { "start": 834.44, "end": 840.48, "text": " this corner right here so their claim appears to be more and more true. Now I" }, { "start": 840.48, "end": 846.44, "text": " have sort of thought about this a little and I've tried it out a bit myself and I" }, { "start": 846.44, "end": 852.24, "text": " invite you to just follow me here shortly. So right here I have a matrix" }, { "start": 852.24, "end": 860.6400000000001, "text": " that is just a random Gaussian matrix of size 512 by 512. If we look at the" }, { "start": 860.6400000000001, "end": 864.6400000000001, "text": " eigen spectrum of that so I have this function SVD it simply gives me the" }, { "start": 864.6400000000001, "end": 871.6400000000001, "text": " eigen spectrum of that then you can see that it sort of falls off uniformly and" }, { "start": 871.64, "end": 882.8, "text": " that will result in a in this cumulative sum of pretty much flat curve or slowly" }, { "start": 882.8, "end": 890.4, "text": " ascending curve like this. Now if we actually have a low rank matrix this" }, { "start": 890.4, "end": 894.8199999999999, "text": " would look different this would have this sort of typical kink in it and we" }, { "start": 894.8199999999999, "end": 899.48, "text": " can demonstrate that by making a lower dimensional matrix so let's just take" }, { "start": 899.48, "end": 910.12, "text": " let's just go 512 by 128 of this lower dimensional and and let's look at the MT" }, { "start": 910.12, "end": 917.48, "text": " now this only goes to 128 because we only get back 128 singular values so" }, { "start": 917.48, "end": 923.44, "text": " let's make a lower dimensional matrix that's actually 512 by 512 so if we do" }, { "start": 923.44, "end": 931.72, "text": " this this is sort of what they're doing in this this will construct a" }, { "start": 931.72, "end": 941.44, "text": " 512 by 512 matrix but that is only of rank 128 right and you can see that at" }, { "start": 941.44, "end": 948.84, "text": " the 128 singular or eigenvalue this snaps right at the at the one so it's" }, { "start": 948.84, "end": 955.08, "text": " sort of like what they what they have okay so we've seen the difference between" }, { "start": 955.08, "end": 960.64, "text": " a let's say higher rank matrix and the low rank matrix in this cumulative sum" }, { "start": 960.64, "end": 966.64, "text": " plot now I want to go back to the original matrix right here of course" }, { "start": 966.64, "end": 971.5600000000001, "text": " there the matrices they look at these routing matrices they're not Gaussian" }, { "start": 971.5600000000001, "end": 977, "text": " they're not sort of distributed with mean zero and the nice variance they are" }, { "start": 977, "end": 981.36, "text": " the result of a softmax operation and in particular that means they're all" }, { "start": 981.36, "end": 986.96, "text": " positive and that means that their mean is not zero so if you look at a data" }, { "start": 986.96, "end": 992.24, "text": " set and it's mean it's not zero and you calculate like the the eigenvalues or in" }, { "start": 992.24, "end": 998.64, "text": " this case the principal component you will find that the first one will be" }, { "start": 998.64, "end": 1003.48, "text": " very strong because that must account for the fact that the mean is not at the" }, { "start": 1003.48, "end": 1012.24, "text": " center or the first few will be like this so it is sort of maybe we can" }, { "start": 1012.24, "end": 1018, "text": " replicate this right here so let's say we'll put M through let's first go with" }, { "start": 1018, "end": 1027.6, "text": " the absolute value of M okay not much of a change but you already see that this" }, { "start": 1027.6, "end": 1037.1999999999998, "text": " axis doesn't start at zero so let's go let's actually how do we do this xlim" }, { "start": 1037.1999999999998, "end": 1050.36, "text": " right xlim zero none so haha okay so the first one you simply have to imagine or" }, { "start": 1050.36, "end": 1055.7199999999998, "text": " I can do even something something more we can just put a zero in front here and" }, { "start": 1055.72, "end": 1067.96, "text": " that should do the trick no yes oh that's X I meant Y calm and dumb never" }, { "start": 1067.96, "end": 1072.28, "text": " mind this will work as well so you already get this sort of of kink and" }, { "start": 1072.28, "end": 1082.32, "text": " let's put it into the softmax so we'll put a softmax and that gives you also" }, { "start": 1082.32, "end": 1087, "text": " this kink now you might think that wait this is that this kink looks a lot" }, { "start": 1087, "end": 1093.76, "text": " smaller than the other kink so but if we simply modify let's modify the standard" }, { "start": 1093.76, "end": 1098.12, "text": " deviation of this random matrix and you can see that this spectrum immediately" }, { "start": 1098.12, "end": 1103.1599999999999, "text": " changes right because of the interaction now between the softmax and the" }, { "start": 1103.1599999999999, "end": 1108.04, "text": " standard deviation if I only were to change the standard deviation on the" }, { "start": 1108.04, "end": 1115.1599999999999, "text": " normal M matrix and we can actually try this right here that wouldn't do much" }, { "start": 1115.1599999999999, "end": 1119.3999999999999, "text": " that would still look pretty much the same it's just differently scaled but in" }, { "start": 1119.3999999999999, "end": 1124.56, "text": " the interaction with the softmax now this changes the spectrum dramatically" }, { "start": 1124.56, "end": 1129.04, "text": " and here as you know these these transformers have always sort of like" }, { "start": 1129.04, "end": 1134, "text": " layer normalization and so on so probably the standard deviation if we" }, { "start": 1134, "end": 1139.76, "text": " if if these are sort of Gaussian the standard deviation before the softmax" }, { "start": 1139.76, "end": 1147.72, "text": " would be a lot smaller so let's go something like this so smaller than one" }, { "start": 1147.72, "end": 1155.44, "text": " and can we run this please and you can see that this kink immediately appears" }, { "start": 1155.44, "end": 1162.56, "text": " now it's not it's it's it's not the same thing as this other as this here because" }, { "start": 1162.56, "end": 1168.56, "text": " this is a lot smoother as you can see right here but still I feel that this" }, { "start": 1168.56, "end": 1173.36, "text": " might not actually be a result of the you know the fact that this is an" }, { "start": 1173.36, "end": 1178.72, "text": " attention mechanism but it simply might be the result of that you apply a softmax" }, { "start": 1178.72, "end": 1185.08, "text": " now still that doesn't change the fact that it is approximately a lower rank" }, { "start": 1185.08, "end": 1192.8799999999999, "text": " matrix everything they say holds but yeah maybe maybe one should also look" }, { "start": 1192.8799999999999, "end": 1198.6799999999998, "text": " into why exactly that happens but in fact it is low rank okay it is" }, { "start": 1198.6799999999998, "end": 1202, "text": " approximately low rank they've demonstrated this and now they go to" }, { "start": 1202, "end": 1208.4399999999998, "text": " their first first theory below we provide a theoretical answer a" }, { "start": 1208.4399999999998, "end": 1214.56, "text": " theoretical analysis of the above spectrum results okay so the theoretical" }, { "start": 1214.56, "end": 1220.32, "text": " analysis theorem one is self-attention is low rank and we're going to go" }, { "start": 1220.32, "end": 1227.56, "text": " through this just glance at it for now they say for any of these query key" }, { "start": 1227.56, "end": 1233.1599999999999, "text": " values and these matrices which of course you can ignore for now for any" }, { "start": 1233.1599999999999, "end": 1239.6399999999999, "text": " column vector W of matrix V W and W here that's the information that needs to be" }, { "start": 1239.64, "end": 1247, "text": " routed there exists a low rank matrix P tilde so this P tilde here is going to" }, { "start": 1247, "end": 1254.8000000000002, "text": " be their low rank approximation of the P matrix you can see it's still n by n but" }, { "start": 1254.8000000000002, "end": 1259.68, "text": " it's going to be low rank in fact it's going to be of the order of the" }, { "start": 1259.68, "end": 1267.0400000000002, "text": " logarithm of the rank of the full matrix or well the full matrix of the rank that" }, { "start": 1267.04, "end": 1271.76, "text": " the full matrix could have as we have already seen the full matrix doesn't" }, { "start": 1271.76, "end": 1279.44, "text": " have full rank but yeah okay so if you use and this is the type of guarantee" }, { "start": 1279.44, "end": 1284.84, "text": " you get so what do we see here it basically means that this distance here" }, { "start": 1284.84, "end": 1291.2, "text": " is smaller than this and this here this is just the norm of one of these vectors" }, { "start": 1291.2, "end": 1297.3600000000001, "text": " projected times this error coefficient epsilon so all it says is that the" }, { "start": 1297.3600000000001, "end": 1302.32, "text": " distance on the left is smaller than something and that occurs with high" }, { "start": 1302.32, "end": 1307.64, "text": " probability okay so the entire guarantee here the entire formula just basically" }, { "start": 1307.64, "end": 1314.04, "text": " means that this thing is small this norm is small what's this norm this norm is" }, { "start": 1314.04, "end": 1319.8400000000001, "text": " the distance between these two things now what are these two things this is" }, { "start": 1319.84, "end": 1324.9199999999998, "text": " the information that we want to route and this is the routing matrix and that" }, { "start": 1324.9199999999998, "end": 1331.08, "text": " simply means that if I route my information using the P tilde this" }, { "start": 1331.08, "end": 1337.8799999999999, "text": " approximation then I won't be too far away as if I had routed my information" }, { "start": 1337.8799999999999, "end": 1344.12, "text": " using the original P matrix okay that's that's it that's what the theorem says" }, { "start": 1344.12, "end": 1348.04, "text": " the theorem says if I route my information using this approximation" }, { "start": 1348.04, "end": 1354.32, "text": " then I am not too far away as it had I routed my information using the original" }, { "start": 1354.32, "end": 1358.92, "text": " routing matrix that I don't say how they're going to construct they simply" }, { "start": 1358.92, "end": 1367.08, "text": " say there exists a low rank matrix like this and the proof of this and it's sort" }, { "start": 1367.08, "end": 1371.92, "text": " of worth looking at the proof of it it uses the Johnson Linden Strauss lemma" }, { "start": 1371.92, "end": 1381.3200000000002, "text": " this thing here or the JL for short and they're going to get this out of the JL" }, { "start": 1381.3200000000002, "end": 1385.96, "text": " now the Johnson Linden Strauss lemma in a classic sense says something like this" }, { "start": 1385.96, "end": 1390.52, "text": " if I have data in a high dimensional space here in a three dimensional space" }, { "start": 1390.52, "end": 1398, "text": " okay I have data distributed and I use a certain kind of projection matrix and" }, { "start": 1398, "end": 1403.48, "text": " there are a number so the the JL gives conditions on what these projections can" }, { "start": 1403.48, "end": 1410.12, "text": " be but for example a randomly sampled matrix with zero mean Gaussian entries" }, { "start": 1410.12, "end": 1418.04, "text": " and 1 over K standard deviation where K is the dimension you project into can do" }, { "start": 1418.04, "end": 1424.08, "text": " the trick so if I project my data in a certain way into a lower dimension here" }, { "start": 1424.08, "end": 1431.04, "text": " dimension 2 then the projected data is related to the original data by the fact" }, { "start": 1431.04, "end": 1438.32, "text": " that the distances between the points in the original space will not be distorted" }, { "start": 1438.32, "end": 1443.8799999999999, "text": " too much so the distances between these points are approximately preserved" }, { "start": 1443.8799999999999, "end": 1450.6799999999998, "text": " through this projection okay so that's that's the that's the Johnson Linden" }, { "start": 1450.68, "end": 1455.92, "text": " Strauss lemma now you'll notice here there is no reference to the fact that" }, { "start": 1455.92, "end": 1462.72, "text": " this data is or isn't low rank it's simply high dimensional data projected" }, { "start": 1462.72, "end": 1468.1200000000001, "text": " to lower dimension and the distances are approximately preserved and this theory" }, { "start": 1468.1200000000001, "end": 1474.2, "text": " here and I've looked at it for a while now they simply define okay they define" }, { "start": 1474.2, "end": 1478.64, "text": " this P matrix as this attention mechanism and here you can see the A" }, { "start": 1478.64, "end": 1482.44, "text": " matrix we've discussed before which is actually low rank but we don't know yet" }, { "start": 1482.44, "end": 1489.3600000000001, "text": " if the softmax is they write it as this form right here of the exponential of" }, { "start": 1489.3600000000001, "end": 1496.8000000000002, "text": " each entry of a divided by this diagonal right here so in the softmax of course" }, { "start": 1496.8000000000002, "end": 1500.68, "text": " you have the exponential of each entry divided by the sum of the entries and" }, { "start": 1500.68, "end": 1504.8400000000001, "text": " they write this simply as two matrices but ultimately this is a matrix right" }, { "start": 1504.84, "end": 1510.8799999999999, "text": " here and all they do is they take this P matrix and they apply the Johnson" }, { "start": 1510.8799999999999, "end": 1519.12, "text": " Linden Strauss lemma by having this projection matrix R and R is entries" }, { "start": 1519.12, "end": 1523.8, "text": " from this Gaussian as I said so this is the special type of projection that the" }, { "start": 1523.8, "end": 1530, "text": " JL addresses and then simply says if you pull if you this here is going to be" }, { "start": 1530, "end": 1536.96, "text": " your P tilde so if you project R in this manner and obtain P tilde and then you" }, { "start": 1536.96, "end": 1544.84, "text": " use P tilde instead of P then this this is going to be very close in fact you" }, { "start": 1544.84, "end": 1548.52, "text": " can reformulate the JL into different variants such that it gives you things" }, { "start": 1548.52, "end": 1553.8, "text": " like this things like saying that the distance between this projected version" }, { "start": 1553.8, "end": 1558.36, "text": " and this unprojected version is going to be a constant smaller than a constant" }, { "start": 1558.36, "end": 1562.9199999999998, "text": " time the norms of the unprojected version that is equivalent to saying that" }, { "start": 1562.9199999999998, "end": 1568, "text": " the distances are preserved now you can see right here nowhere in this theorem" }, { "start": 1568, "end": 1575.6399999999999, "text": " is the fact that this is self-attention and nowhere in the theorem appears the" }, { "start": 1575.6399999999999, "end": 1581.12, "text": " fact that this inner matrix A is low rank or even that this matrix A exists" }, { "start": 1581.12, "end": 1586.36, "text": " it's you can do this with any matrix P right the JL doesn't concern itself with" }, { "start": 1586.36, "end": 1591.7199999999998, "text": " the nature of this matrix P it says any matrix any sort of high dimensional data" }, { "start": 1591.7199999999998, "end": 1596, "text": " you can project to low dimensional data and this holds if you choose the" }, { "start": 1596, "end": 1601.7199999999998, "text": " projection correctly which they do right here so to claim that this theorem" }, { "start": 1601.7199999999998, "end": 1611.52, "text": " proves that self-attention is low rank to me is a bit it's a bit of a statement" }, { "start": 1611.52, "end": 1618.4, "text": " that is not warranted like this here should read something like the Johnson" }, { "start": 1618.4, "end": 1626.52, "text": " Lindenstrout's lemma exists or something like this it I'm not I'm not sure like" }, { "start": 1626.52, "end": 1634.84, "text": " convince me otherwise but yeah so they go with this so they say given the low" }, { "start": 1634.84, "end": 1640.68, "text": " rank property of the context mapping matrix P now again I disagree that this" }, { "start": 1640.68, "end": 1646.44, "text": " has been shown except empirically one straightforward idea is to use" }, { "start": 1646.44, "end": 1650.4, "text": " singularality composition to approximate P with a low rank matrix P low as" }, { "start": 1650.4, "end": 1654.44, "text": " follows so what you could do is you could simply learn these low rank" }, { "start": 1654.44, "end": 1660.2, "text": " matrices and approximate P through it or you can decompose P as such and then" }, { "start": 1660.2, "end": 1670, "text": " have these easier inner products in dimension K but they say however this" }, { "start": 1670, "end": 1674.48, "text": " approach requires performing an SVD decomposition in each self-attention" }, { "start": 1674.48, "end": 1679.16, "text": " matrix which adds additional complexity therefore we propose another approach" }, { "start": 1679.16, "end": 1687.32, "text": " for a low rank approximation that avoids this added complexity okay so they now" }, { "start": 1687.32, "end": 1691.72, "text": " come up with their model and their model goes as follows so here on the left you" }, { "start": 1691.72, "end": 1696.28, "text": " see a classic attention mechanism with their projections built in what they're" }, { "start": 1696.28, "end": 1704.32, "text": " proposing is they say let's project the matrix K using one of these random" }, { "start": 1704.32, "end": 1710.6, "text": " projections and then this attention routing if you route if you now" }, { "start": 1710.6, "end": 1717.32, "text": " multiply so you multiply K and Q right here K times Q and then you put it into" }, { "start": 1717.32, "end": 1722.48, "text": " the softmax and then you use it to route this W so they say if we build in this" }, { "start": 1722.48, "end": 1728.3600000000001, "text": " projection matrix that will project K to a lower dimension and then we won't have" }, { "start": 1728.3600000000001, "end": 1733.68, "text": " as expensive of inner products now the important part to see here is that if" }, { "start": 1733.68, "end": 1737.32, "text": " you think of this lower projection the first thing you think is that you" }, { "start": 1737.32, "end": 1743.6, "text": " project this inner this hidden dimension D right to a lower dimension and that's" }, { "start": 1743.6, "end": 1751.08, "text": " not the case here you actually project the N so in in a conceptual framework so" }, { "start": 1751.08, "end": 1755.4399999999998, "text": " you can see right here forget about this this is this W matrix in a conceptual" }, { "start": 1755.4399999999998, "end": 1760.1999999999998, "text": " framework you see here is this N by D matrix which are the keys so N is the" }, { "start": 1760.1999999999998, "end": 1766.1599999999999, "text": " sequence length and D is the dimensions and what you want to do is you want to" }, { "start": 1766.1599999999999, "end": 1771.6399999999999, "text": " project that by this matrix which is K by N so you want to reduce the sequence" }, { "start": 1771.6399999999999, "end": 1776.6, "text": " length you can see in this matrix right here why that might work because N is" }, { "start": 1776.6, "end": 1784.1599999999999, "text": " much larger than D and that means this matrix can be at most rank D right so" }, { "start": 1784.1599999999999, "end": 1788.84, "text": " you should not lose too much you should sort of be able to preserve the" }, { "start": 1788.84, "end": 1795.56, "text": " information if you project this N to a K where the K if the K is still larger" }, { "start": 1795.56, "end": 1799.9599999999998, "text": " than the D or approximately in the same order of magnitude you should be able to" }, { "start": 1799.9599999999998, "end": 1803.8999999999999, "text": " preserve that information if you do it in a smart way so conceptually if we" }, { "start": 1803.9, "end": 1810.26, "text": " have our five token sequence like here and the next layer produces five tokens" }, { "start": 1810.26, "end": 1817.16, "text": " again what we first do is we say we know we know that the information we want is" }, { "start": 1817.16, "end": 1825.4, "text": " not five dimensional it's actually two dimensional because okay let's say these" }, { "start": 1825.4, "end": 1832.52, "text": " this inner dimension D is is two as well so we have two dimensional vectors each" }, { "start": 1832.52, "end": 1838, "text": " thing exposes two dimensional vectors so we first project the sequence of length" }, { "start": 1838, "end": 1843.8799999999999, "text": " five to a sequence of length two and we simply do that in a random manner so we" }, { "start": 1843.8799999999999, "end": 1850.1, "text": " have a random Gaussian matrix that assigns weights to mix these five into" }, { "start": 1850.1, "end": 1856.48, "text": " these two and again because the JL works for any sort of data but in my" }, { "start": 1856.48, "end": 1862.72, "text": " argumentation if you you know think that this here is low rank it's of rank two" }, { "start": 1862.72, "end": 1867.04, "text": " then you shouldn't lose too much information by projecting it to a" }, { "start": 1867.04, "end": 1872.84, "text": " sequence length two and now we do this attention mechanism so now we expose the" }, { "start": 1872.84, "end": 1879.88, "text": " keys and now we expose the queries up here and now you can see instead of" }, { "start": 1879.88, "end": 1885.08, "text": " routing five things with five things you only have to route five things with two" }, { "start": 1885.08, "end": 1894.3999999999999, "text": " things and so instead of having O and squared you now have O N K if K K is the" }, { "start": 1894.3999999999999, "end": 1901.8, "text": " number right here okay so this is the idea you project the sequence length and" }, { "start": 1901.8, "end": 1907.62, "text": " it comes from the fact that the sequence length is much larger than the" }, { "start": 1907.62, "end": 1913.02, "text": " dimensionality and therefore you can sort of preserve the information if you" }, { "start": 1913.02, "end": 1920.52, "text": " project in a smart way they build this in this fashion right here so the" }, { "start": 1920.52, "end": 1926.32, "text": " attention mechanism now before we saw it was between the queries and the keys" }, { "start": 1926.32, "end": 1933.16, "text": " right here they built now this projection matrix here that projects the" }, { "start": 1933.16, "end": 1940.76, "text": " keys into a lower dimensional sequence and the now such that this will result" }, { "start": 1940.76, "end": 1946.64, "text": " in an N by K attention matrix we saw over here you don't need to route N by" }, { "start": 1946.64, "end": 1953.08, "text": " N things you need to route N by K so this this routing table in here is now N" }, { "start": 1953.08, "end": 1959.24, "text": " by K now the next layer as you can see here it actually needs to produce a" }, { "start": 1959.24, "end": 1963.8799999999999, "text": " sequence of length five again right so we always transform sequence of length" }, { "start": 1963.88, "end": 1972.5200000000002, "text": " five into sequence of length five but now we have we have this N corresponds" }, { "start": 1972.5200000000002, "end": 1976.7600000000002, "text": " to the sorry corresponds to the next layer and this K corresponds to the" }, { "start": 1976.7600000000002, "end": 1983.3200000000002, "text": " down projected sequence of the last layer and in order for that to fit we of" }, { "start": 1983.3200000000002, "end": 1987.68, "text": " course also need to down project the information that we're routing so if we" }, { "start": 1987.68, "end": 1991.5600000000002, "text": " don't project the routing table we also need to down project the information" }, { "start": 1991.56, "end": 1998, "text": " that we're routing that's we do this by a similar matrix F that is also sampled" }, { "start": 1998, "end": 2006.96, "text": " in this way in this special way and that gives us a K by D so we have projected" }, { "start": 2006.96, "end": 2011.72, "text": " the sequence to size K and if we multiply these two things again of" }, { "start": 2011.72, "end": 2018.6, "text": " course we'll get out an N by D matrix which is the signal for the next layer" }, { "start": 2018.6, "end": 2027.32, "text": " okay so an N by D signal comes in down here it's projected down to K sequence" }, { "start": 2027.32, "end": 2032.84, "text": " length it's and it's routed up again to N sequence length and you have again an" }, { "start": 2032.84, "end": 2041.36, "text": " N by D matrix here cool so that's how they do it and they build this into the" }, { "start": 2041.36, "end": 2046.6, "text": " transformer now as I understand it these projection matrices again they're not" }, { "start": 2046.6, "end": 2054.56, "text": " learned they are built up in this JL conscribed way they are not" }, { "start": 2054.56, "end": 2061.56, "text": " learned they are fixed once and then that's that's that at least that's how I" }, { "start": 2061.56, "end": 2070.2799999999997, "text": " understand it so there are no more learnable parameters okay so here they" }, { "start": 2070.2799999999997, "end": 2075.44, "text": " have a demonstration where they up the sequence length and you can see the" }, { "start": 2075.44, "end": 2080.2400000000002, "text": " batch size decreases but that's just to sort of keep the total amount of flops" }, { "start": 2080.2400000000002, "end": 2085, "text": " to be done the same you up the sequence length and down the batch size as the" }, { "start": 2085, "end": 2090.68, "text": " sequence length increases the standard transformers requirement in inference" }, { "start": 2090.68, "end": 2095.32, "text": " time goes up and this here as you can see this is not a linear scale it's a" }, { "start": 2095.32, "end": 2103.04, "text": " log scale log 2 so this goes up with the sequence length and it should go up" }, { "start": 2103.04, "end": 2108.64, "text": " quadratically right and you can also see that the Lin former keeps fairly" }, { "start": 2108.64, "end": 2114.72, "text": " constant for the same K now of course as you increase the K of the Lin former" }, { "start": 2114.72, "end": 2121.84, "text": " the inference time will go up because now it's dependent on N times K and not" }, { "start": 2121.84, "end": 2129.84, "text": " on N times N okay so let's look a bit further of how you have to choose that" }, { "start": 2129.84, "end": 2136.6800000000003, "text": " K up here in the first theorem we there was a already a hint to it in the first" }, { "start": 2136.6800000000003, "end": 2145.2000000000003, "text": " theorem you had to choose K by 5 log N and this is a problem so here you have" }, { "start": 2145.2000000000003, "end": 2155.1600000000003, "text": " log N that means it's not so O of N K is equal to O of N log N now that's not" }, { "start": 2155.1600000000003, "end": 2159.82, "text": " linear that's actually that's the same as the reformer but they want to get" }, { "start": 2159.82, "end": 2169.6800000000003, "text": " to a linear place and theorem 2 explains goes now to a linear shows how you can" }, { "start": 2169.6800000000003, "end": 2178.92, "text": " make self-attention linear okay they show again blah blah blah blah now you" }, { "start": 2178.92, "end": 2184.44, "text": " have to choose K at the minimum of these two things and you can see right here" }, { "start": 2184.44, "end": 2191.04, "text": " that one of them is independent of N so that means as N grows of course the" }, { "start": 2191.04, "end": 2194.52, "text": " minimum is no longer going to be this here the minimum is actually going to" }, { "start": 2194.52, "end": 2201.16, "text": " be the thing on the left and that is dependent on just D okay so you have D" }, { "start": 2201.16, "end": 2207.6, "text": " log D in here and that makes sense because in the very beginning we said" }, { "start": 2207.6, "end": 2216.08, "text": " hey D is actually much smaller than N and that means the information that is" }, { "start": 2216.08, "end": 2222.72, "text": " contained in these matrices is at most rank D so if we down project to K we" }, { "start": 2222.72, "end": 2228.7599999999998, "text": " should adjust K to what D is right if we adjust K to about the same thing as D" }, { "start": 2228.7599999999998, "end": 2236.7599999999998, "text": " we're guaranteed to not lose too much information so now we choose K" }, { "start": 2236.76, "end": 2242.36, "text": " according to D instead of according to N and therefore the computation is linear" }, { "start": 2242.36, "end": 2251, "text": " in N and N times K is like N times D to log D so it's linear in K and linear in" }, { "start": 2251, "end": 2259, "text": " D how do we get there so the first thing they do is they make these sort of" }, { "start": 2259, "end": 2266.1600000000003, "text": " Johnson-Lindenstrout statements again but now instead of the general statement" }, { "start": 2266.16, "end": 2270.92, "text": " they plug in their actual modified attention mechanism so here they have a" }, { "start": 2270.92, "end": 2277.24, "text": " bound on the distance between if I route my this is the information to be routed" }, { "start": 2277.24, "end": 2283.52, "text": " right if I route my information using the original softmax and this in here" }, { "start": 2283.52, "end": 2291.12, "text": " is the matrix A if the original tension mechanism I won't be too far away as if" }, { "start": 2291.12, "end": 2298.68, "text": " I were to route my information using this modified attention mechanism now" }, { "start": 2298.68, "end": 2308.2, "text": " the tricky part here mathematically I believe is that is is exactly the softmax" }, { "start": 2308.2, "end": 2314.2, "text": " what what I alluded to right so this softmax is the tricky part because if" }, { "start": 2314.2, "end": 2318.56, "text": " this weren't a softmax so if the softmax weren't here this would simply be a" }, { "start": 2318.56, "end": 2324.12, "text": " projection down and a projection up and the dilemma would almost apply as it is" }, { "start": 2324.12, "end": 2328.7599999999998, "text": " written right there you wouldn't have to actually do anything but the question is" }, { "start": 2328.7599999999998, "end": 2336.16, "text": " if this inside the softmax is is low rank can you make a claim that the" }, { "start": 2336.16, "end": 2344.7599999999998, "text": " entire softmax then is also low rank and it's not entirely clear because because" }, { "start": 2344.76, "end": 2351.6000000000004, "text": " oh yes we've done this so you can see right here that the softmax we have" }, { "start": 2351.6000000000004, "end": 2355.32, "text": " actually done the softmax of a low rank matrix so we have already seen the low" }, { "start": 2355.32, "end": 2360.76, "text": " rank matrix itself and how it immediately snaps to the to the upper" }, { "start": 2360.76, "end": 2371.2400000000002, "text": " axis after 128 now if we do the same thing for the softmax of that and we" }, { "start": 2371.24, "end": 2379.8799999999997, "text": " probably have to take away some of these dimensions the first few let's go with" }, { "start": 2379.8799999999997, "end": 2388.72, "text": " let's go to dimension 100 and look from there okay same thing okay that's pretty" }, { "start": 2388.72, "end": 2399.68, "text": " good I did not expect that hi there so this is Yannick from the future I've" }, { "start": 2399.68, "end": 2403.8799999999997, "text": " realized I've been an idiot in how I constructed these low rank matrices" }, { "start": 2403.8799999999997, "end": 2410, "text": " right here by multiplying MT by itself of course what's a better way to do it" }, { "start": 2410, "end": 2416.3999999999996, "text": " is to construct two independent 128 dimensional matrices like these two" }, { "start": 2416.3999999999996, "end": 2421.2799999999997, "text": " sub slices of M right here and then multiplying those together and looking" }, { "start": 2421.2799999999997, "end": 2429.3599999999997, "text": " at the SVD and you as you can see right here so the softmax of this is now not" }, { "start": 2429.36, "end": 2436.56, "text": " of this super low rank anymore it's still low rank but it's not not very it's" }, { "start": 2436.56, "end": 2442.92, "text": " not like hard low rank so if I just look at the matrix without the softmax then" }, { "start": 2442.92, "end": 2448.6400000000003, "text": " you can see it has a very peak that by at the 128 which gives us the indication" }, { "start": 2448.6400000000003, "end": 2455.92, "text": " it's actually 128 rank which we already knew but if we now introduce the softmax" }, { "start": 2455.92, "end": 2463.28, "text": " then you can see that this vanishes and it's no longer 128 dimensional and it's" }, { "start": 2463.28, "end": 2469.64, "text": " only approximately low rank as you can see all right back to Yannick in the" }, { "start": 2469.64, "end": 2475.84, "text": " past who is wholly surprised that the two that if you multiply MT by itself" }, { "start": 2475.84, "end": 2483.32, "text": " that that will give you back the the exact same thing all right so did we try" }, { "start": 2483.32, "end": 2489.76, "text": " this before maybe we did okay but the mathematical difficulty still remains" }, { "start": 2489.76, "end": 2495.04, "text": " and their main thing here is so they have a first first version where they" }, { "start": 2495.04, "end": 2502.1600000000003, "text": " pretty much plug it into the JL again and they they get out this K is the K" }, { "start": 2502.1600000000003, "end": 2506.92, "text": " needs to be by log n but they say this result does not utilize the low rank" }, { "start": 2506.92, "end": 2511.88, "text": " property of matrix A and the resultant K has a dependency on sequence length n" }, { "start": 2511.88, "end": 2522.6400000000003, "text": " and then in the appendix they finally go through the math to show that now if" }, { "start": 2522.6400000000003, "end": 2532.2400000000002, "text": " they choose E and F like this they can actually pull out this and show that" }, { "start": 2532.24, "end": 2542.9199999999996, "text": " the K is where you have it the decay is independent of n like this and I think" }, { "start": 2542.9199999999996, "end": 2551.8399999999997, "text": " the main the main step in this proof is the step B here where they say uses the" }, { "start": 2551.8399999999997, "end": 2556.12, "text": " fact that the exponential function is Lipschitz continuous in a compact" }, { "start": 2556.12, "end": 2562.6, "text": " region then we can choose a small enough Delta such that the as you can see here" }, { "start": 2562.6, "end": 2568.3199999999997, "text": " this now directly relates to this projection matrix within the exponential" }, { "start": 2568.3199999999997, "end": 2572.92, "text": " function to the projection matrix out of the exponential function so you can" }, { "start": 2572.92, "end": 2577.8399999999997, "text": " basically say that if I project first and then use the exponential function" }, { "start": 2577.8399999999997, "end": 2582.52, "text": " that's not too different than if I first use the exponential function and then" }, { "start": 2582.52, "end": 2591.52, "text": " project okay so that's the that's the sort of of of catch here now they only" }, { "start": 2591.52, "end": 2596.36, "text": " do this for the exponential function not the actual softmax as you can see here" }, { "start": 2596.36, "end": 2600.96, "text": " throughout they do it to the exponential function and also here in their" }, { "start": 2600.96, "end": 2607.04, "text": " statements the softmax isn't the exponential function the softmax is the" }, { "start": 2607.04, "end": 2611.92, "text": " exponential function divided by the sum of the exponential functions but I" }, { "start": 2611.92, "end": 2615.88, "text": " believe that this generalizes straightforwardly" }, { "start": 2615.88, "end": 2623.8, "text": " alright so for given choices of Delta and K they have shown that the Lin" }, { "start": 2623.8, "end": 2629.52, "text": " former in fact can do in a linear fashion what a transformer can do in a" }, { "start": 2629.52, "end": 2634, "text": " quadratic fashion and they are not too far off" }, { "start": 2634, "end": 2640.7200000000003, "text": " ok that's that's their point right here the results on these benchmarks" }, { "start": 2640.72, "end": 2645.52, "text": " sorry let's first go to the perplexities in language modeling so they show right" }, { "start": 2645.52, "end": 2650.08, "text": " here that they pretty much can keep up with the standard transformer as you can" }, { "start": 2650.08, "end": 2655.3599999999997, "text": " see here so with the standard transformer they can keep up here now" }, { "start": 2655.3599999999997, "end": 2663.24, "text": " think that this the the computation is n times K ok so something like this Lin" }, { "start": 2663.24, "end": 2670.56, "text": " former with K cost 256 will only so instead of n by n it's n times K it" }, { "start": 2670.56, "end": 2678.64, "text": " won't save you too much in that case but it's it's not too surprising that in" }, { "start": 2678.64, "end": 2683.4799999999996, "text": " fact you have the same performance because probably the standard transformer" }, { "start": 2683.4799999999996, "end": 2688.3599999999997, "text": " is distributed over more heads than two so the information necessarily has a" }, { "start": 2688.36, "end": 2694.2000000000003, "text": " lower dimensionality 10 to 56 one thing I want to draw attention to though here" }, { "start": 2694.2000000000003, "end": 2700.96, "text": " is that you can see that here it's not really done learning yet and as you can" }, { "start": 2700.96, "end": 2707.1600000000003, "text": " see the standard transformer sort of surpasses all of these models towards" }, { "start": 2707.1600000000003, "end": 2713.6400000000003, "text": " the end I wonder I wonder what happens I wouldn't be surprised if they end up" }, { "start": 2713.64, "end": 2719.04, "text": " sort of at the same place but I wonder if these diverge even more right here" }, { "start": 2719.04, "end": 2727.52, "text": " after that they also compare with a higher sequence length and the standard" }, { "start": 2727.52, "end": 2731.2799999999997, "text": " transformer outperforms the Lin former but of course the point here is that the" }, { "start": 2731.2799999999997, "end": 2739.72, "text": " Lin former is much much much faster and can keep up now also the scale here of" }, { "start": 2739.72, "end": 2745.7599999999998, "text": " the perplexity you see these are percentage points in perplexity but I" }, { "start": 2745.7599999999998, "end": 2751.52, "text": " can't actually tell if that matters or not I think I think in the original" }, { "start": 2751.52, "end": 2755.7999999999997, "text": " transformer paper the perplexities hovered between like three point" }, { "start": 2755.7999999999997, "end": 2762.12, "text": " something and five point something so this might actually be sort of" }, { "start": 2762.12, "end": 2768.04, "text": " significant differences and I'm not sure they investigate different methods of" }, { "start": 2768.04, "end": 2773.24, "text": " sharing these weights of these of these projections and they seems like they" }, { "start": 2773.24, "end": 2776.36, "text": " don't find real differences but I don't want to go into that because this video" }, { "start": 2776.36, "end": 2781.92, "text": " is already really long and then they look at what happens if they up the" }, { "start": 2781.92, "end": 2786.94, "text": " sequence length that they put into the Lin former and you can see that the Lin" }, { "start": 2786.94, "end": 2792.88, "text": " former can deal with higher sequence lengths and arrive at the same" }, { "start": 2792.88, "end": 2798.6400000000003, "text": " perplexities though again I don't know how much different that is and" }, { "start": 2798.6400000000003, "end": 2806.08, "text": " the scale here is larger than before but yeah so how does this fare on these" }, { "start": 2806.08, "end": 2811.32, "text": " benchmarks where you first train a transformer with pre training with" }, { "start": 2811.32, "end": 2817.2000000000003, "text": " language modeling and then you use it to do certain NLP tasks and here you can" }, { "start": 2817.2000000000003, "end": 2822.46, "text": " see that the Lin former is on par in some of these tasks with the original" }, { "start": 2822.46, "end": 2829.32, "text": " transformer but also you can see like a pattern where you can see pretty wild" }, { "start": 2829.32, "end": 2836.4, "text": " results in that you know sometimes the the Lin former here will be better than" }, { "start": 2836.4, "end": 2842.44, "text": " this but then also variants of the Lin former will be worse and they'll even be" }, { "start": 2842.44, "end": 2846.64, "text": " worse than this and sometimes they'll be better sometimes this Lin former is good" }, { "start": 2846.64, "end": 2854.2799999999997, "text": " and sometimes the original model is the best so this sort of points to you can" }, { "start": 2854.2799999999997, "end": 2860.7999999999997, "text": " make the general claim that the Lin former doesn't destroy your your gains" }, { "start": 2860.7999999999997, "end": 2867.2, "text": " but also it's not like a a better model it's simply a faster model that in some" }, { "start": 2867.2, "end": 2873.04, "text": " tasks can keep up with the original model and they show that of course this" }, { "start": 2873.04, "end": 2879.7599999999998, "text": " is the real deal here that as you go up in length the performance gains and also" }, { "start": 2879.7599999999998, "end": 2886.7599999999998, "text": " sorry this this way the performance gains and the memory gains that you get" }, { "start": 2886.7599999999998, "end": 2892.08, "text": " by the Lin former are dramatic of course the longer and you go and to the lower" }, { "start": 2892.08, "end": 2896.2799999999997, "text": " dimension you project the more these gains are but of course the more" }, { "start": 2896.2799999999997, "end": 2900.92, "text": " performance you're going to lose potentially hello again Yannick from the" }, { "start": 2900.92, "end": 2904.56, "text": " future just wanted to draw your attention on this beautiful broader" }, { "start": 2904.56, "end": 2911.28, "text": " impact statement in this paper saying our work focuses on making transformers" }, { "start": 2911.28, "end": 2915.7200000000003, "text": " more efficient everything cool potential positive in spec impacts of efficient" }, { "start": 2915.7200000000003, "end": 2919.48, "text": " transformers that's pretty cool it also has potential impact on training" }, { "start": 2919.48, "end": 2924.12, "text": " transformers on images since we can support very long sequences very cool" }, { "start": 2924.12, "end": 2929.2400000000002, "text": " furthermore there are positive environmental benefits very cool I mean" }, { "start": 2929.24, "end": 2934.9199999999996, "text": " these are all very cool things they say as such we see no immediate negative" }, { "start": 2934.9199999999996, "end": 2940.04, "text": " ethical or societal impacts of our work beyond what applies to the core building" }, { "start": 2940.04, "end": 2947.7599999999998, "text": " blocks of deep learning do better now this this honestly I agree with them" }, { "start": 2947.7599999999998, "end": 2953.4799999999996, "text": " right I completely agree with them that this is sort of a good thing you might" }, { "start": 2953.4799999999996, "end": 2957.52, "text": " trade off you know some accuracy might some make some approximations but you" }, { "start": 2957.52, "end": 2963.36, "text": " will get a much faster model and this model has any model can be used you" }, { "start": 2963.36, "end": 2969.2, "text": " know for things and and that they now have to pull out of there out of their" }, { "start": 2969.2, "end": 2980.16, "text": " but some way in in in over five steps of intermediate layers this could be used" }, { "start": 2980.16, "end": 2987.96, "text": " for bad it just seems ridiculous so good on them for defying the please also" }, { "start": 2987.96, "end": 2994, "text": " think about negative impacts right here all right back to back back to past" }, { "start": 2994, "end": 3000.24, "text": " Yannick all right this was the Lin former paper I hope this somewhat makes" }, { "start": 3000.24, "end": 3007.16, "text": " sense made sense to you I had to read it multiple times for it to make sense to" }, { "start": 3007.16, "end": 3011.3999999999996, "text": " me but ultimately it's all about the fact that you have these multiple heads" }, { "start": 3011.3999999999996, "end": 3016, "text": " and therefore your information is probably lower dimensional and you can" }, { "start": 3016, "end": 3022, "text": " abuse that and to just calculate in this lower dimension all right I'll see you" }, { "start": 3022, "end": 3037.84, "text": " next time bye bye" } ]
WTB2p4bqtXU
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
End-to-End Adversarial Text-to-Speech (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "tts", "text-to-speech", "aligner", "convolutions", "spectrogram", "mel", "alignment", "phonemes", "deepmind", "deep mind", "dynamic time warping", "gaussian kernel", "adversarial", "gan", "discriminator", "tokens", "sound wave", "speech" ]
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 entwined 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 entwined manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs. Okay, now you've probably, if you have listened to the text and not just how the text sounds, you have gotten what this paper is about. So the paper is called End to End Adversarial Text to Speech by Jeff Donahue, Sander Dieleman, Mikolai Binkowski, Eric Elson and Karen Simonian of, I believe, of mostly deep mind. And this paper on a high level, it produces speech, so the sound waves of speech directly from text or from what they call normalized text or phoneme text. And it does so without any intermediate supervised representations. And that's a challenging task. And the main problems here are the alignment problem that they have to solve and actually making this work in an adversarial manner. So we're going to look at this paper. As always, if you like work like this, consider subscribing and sharing it out. And if you have any comments, leave them in the comment section. Okay, so what's the problem with text to speech? Text to speech is basically you take a piece of text like this one, modern text to speech synthesis pipelines typically involve blah, blah, blah. And you want to make a model that takes this and outputs sound waves, as if a human would say it right so you do 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. 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 sense. So 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. Usually 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 these are sort of intermediate features for the text to be produced. And then another model would take these and it would produce something like spectrograms spectrograms. And then another model would take the spectrograms and finally produce sound or speech. So you have usually in these systems, you have intermediate representation. And each of these models right here can be trained by itself. So that's an advantage that you can train. For example, you can train a model that goes from a spectrogram to a sound wave by itself. And you don't need you simply need sound for that. The computation from sound to spectrogram is super easy. So you can generate your own training data. So you can go from spectrogram to sound. You can train a model like this. So in these pipelines, usually there are multiple stages and each of these models has to be trained by itself. This paper tries to do this end to end. That means you input the text and you get out the you get out the sound wave. And and there is nothing in between that the I mean, of course, there are latent representations, but you train it ends to end in one go. Okay, so let's look at the different systems they employ. First of all, let's look at the discriminators, because that's the easiest. So they have these discriminators and these are adopted from this GAN TTS paper. Now, as we already said, the discriminator try to to differentiate between real and fake sound. And they do it in a sort of. So if they were to just look at the entire sound wave, then it would just basically reduce to comparing the two. But instead, the discriminators, they operate on very small windows. So in specific, they have five different discriminators and each of the five different discriminators take a different size window length. But all of these windows are super short. So one discriminator might take this long windows. Another discriminator might take a bit longer windows and another discriminator might take a bit shorter windows. And that, of course, from the real and from the fake and the discriminators simply try to discriminate only in these windows, whether it's 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'd run into all sorts of questions. So this is a set of five discriminators that all try to take each takes a different length of sub sub sound of this wave tries to discriminate real from fake. That's the discriminator loss. They have an additional discriminator loss where they compute spectrograms of these things. So spectrograms and compute spectrogram of this. And they have a discriminator, another neural network here that it tries to distinguish which one is real and which one is fake. Note that this is not the same as down here where the spectrogram is an intermediate representation. Here, the sound is the output and from the sound you compute the spectrogram and then you compare the two. So this is simply a different spectrogram is a different feature space for the discriminator to compute the loss. It is not an intermediate representation on the way to produce the sound itself so that the difference. That's the difference here between the classic approach and this approach. So it's end to end adversarial. So we got the discriminator. The discriminators simply try to differentiate the sound waves and short scales as well as the spectrograms. Now, the second part is, of course, the generator. How do we even produce sound? And that's this diagram right here. So you have this Gantt generator. This is a generator that takes in a hidden representation. It takes in tokens. Let's say token one, token two. Let's go from the one before. Think of a sentence. Hello there. There. OK, so it takes these tokens and of course it takes like hidden representations of the tokens. And it will output. It will output for each one or for this joint sequence. One hidden, two. It would output the sound wave. OK. And this has been a paper before, the Gantt TTS. And you also you condition it on the speaker and on latent variables like how you want the pitch to be and so on. That's not really important for us right here. The generator can simply take these token embeddings and produce sound. The problem is in the original paper, you had an alignment. You knew which token corresponded to which piece of sound. And therefore you sort of knew. So after that, you need to compare this to the generator thing. And you knew which token corresponded to which piece of sound right here. So the generator knew what it had to produce from each token, how long it should be and so on. So this is the generally the alignment problem or what I call the alignment problem. So if you take a piece of text like this entire paragraph right here. Let's look at this paragraph. This paragraph to read it out takes like 30 to 60 seconds. You can't train really models that output this long of sound. It would be too big of a sample. You want to train ideally on segments. They train segments that are, I believe here, two second windows from each examples. So because they say if we train on 20 seconds, that would just be wasteful and prohibitively expensive. Now, the problem, of course, is if I simply take a window here like this one of two seconds and I have my human that has read this entire paragraph in one go, I have no clue again which part of the entire sound wave of this paragraph this subsequence corresponds to. A good guess would be to go like, well, this is about 50 percent 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 do you compute these alignments? How do you compute this thing? If you don't have it, if you're if you don't have it in your training data, so it needs to be part of the loss. So that's what this entire architecture down here is. 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 preprocessing they do. And they can also leave it away in the heaven ablation on their website. So this is like phoneme text. Cat sat on the mat. Now, this phoneme text goes through these big block of convolutions and of dilated convolutions. And this outputs a 200 hertz representation token length. Alignment. OK, I should specify this. So for each token here, it outputs a length. So this thing predicts the length of each of the tokens. These all of this all of this thing here is to to embed the tokens in hidden space and then predict its length. You can see that right here. OK, so first we use F to to take X. So F is a stack of dilated convolutions and it takes X and outputs a hidden representation. So H. So first X goes to H and then H is used to predict the length of each of the tokens. 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 so they give some silence buffer here. But roughly, you can assume that the beginning of the speech corresponds to the first the first token. Right. You can simply trace the waveform. And whenever it goes up, that's where the first token starts. And 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 word starts. So if we want to know where on starts, we simply go from the beginning and go 200 plus 100 milliseconds. So our data points 200 plus 100. Here is where on starts. OK. 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 sequence is. And now we do this. We said we take random two second audio, but we do this procedure for the entire for the entire text. OK, for the for every single token in the text that we look at in the 20 second text, we do this because then for each token, we'll get a token center. And now the aligners job here is to align that to the actual sound. So what we also give the generators here, the offset. So let's say we have this 20 second of speech and we randomly sampled 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, OK, 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, OK, 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. Because I have this offset where I sampled it and I simply add use this and the predicted lengths to figure it out. I still need to figure out these tokens that are actually in the span. How do they distribute? And that's what this aligner here does. Since we've already predicted the token centers, we simply assume that if these are correct, right, then if this is, let's say if this is one second long, I assume that the middle is after point five seconds. So this is one second. The middle is point five seconds. So I think that this token is aligned right here. This is the center of the token. Now, we want to be a little bit a little bit fuzzy with respect to that. So what they do is they sort of use a Gaussian kernel right here. So for each token, as you can see here, each token has a center, which is here. So the y axis is the time in sound and the x axis is the token. And for each token, we say, well, it doesn't have to be exactly there. It can be so they put a Gaussian kernel like this. OK, if you imagine this kernel popping out of the frame, they say this is about where the center is. And for this token, right for this token right here, they say, well, it's it's probably here in the middle, but it could also be here or here or here or here. And we weigh this like this. So these are these are the weights. And then you simply sum up the weights with these embeddings. So for each token out of this dilated convolution block, you get a hidden embedding. And by using this alignment matrix that you computed by predicting the lengths and therefore predicting the centers of the tokens, you can then sort of shift. So first, you assume that h1, h2, h3, if you were to do nothing, these would just all take up like a third of the time. And now by multiplying with this matrix, you have the opportunity because you predicted a longer length for the first token. You have the opportunity to shift that a bit to the right and maybe shorten the second token a bit. And then the third token goes until the end. OK, 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, OK, 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 that will ultimately train this loss, this model right here that computes the token lengths. Right. So we sum up in a weighted fashion these embeddings right here. And that's what goes into the generator. So now we have embeddings and we have the alignments for the embeddings, which are these pieces of where in the sound wave these are. And from that, the generator can now produce the sound wave itself. OK. 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. So 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 token here, which is what the discriminator looks at, it produces these tokens here. Of course, you have no chance, no matter how good your adversarial loss is. Remember, the this is these length predictions are used to see basically to see which of these tokens the generator needs to produce the sound for and how they're aligned. So they have an additional loss right here. What they do is they produce from the again, they go via the spectrograms within this spectrogram prediction loss. So they say we discovered that adversarial feedback is insufficient to learn alignment. At the start of training, the aligner does not produce an accurate alignment. So the information in the input tokens is incorrectly temporally distributed. This encourages the decoder to ignore the aligner output. The unconditional discriminators provide no useful signal to correct this. Oh, yeah, I should have mentioned this. The discriminators here, since you don't know, you don't know which tokens you should produce. The discriminators are unconditional. They don't know which text is produced. You don't give them the tokens. You simply give them the sound waves. That's something I find particularly interesting here. Now, you of course, this wouldn't work in a like a traditional 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 subsequence. So you don't know which text you're producing. So you have to make the discriminators unconditional. And therefore, they are going to discriminate, as we said, between potentially between two completely non overlapping pieces of the sound wave, which, of course, doesn't help you. And then the aligner can also not learn anything because there is no learning signal because everything just says this is not the same. OK. And that's what they say here. We face a different problem. We do not have aligned ground truth. Conditional discriminators, which they don't have, need an aligner module, which cannot function correctly at the start of training, effectively turning them into unconditional discriminators. So even if they were to input the text, it would still be the wrong text because their aligner is wrong at the beginning. Although it should be possible in theory to train the discriminators aligner module adversarially, we find that this does not work in practice and training gets stuck. So what do they do? They say instead we propose to guide learning by using an explicit prediction loss in the spectrogram domain. We minimize the L one 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 they take the spectrogram of the generator output and the corresponding ground truth training window and they simply calculate the L one 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 this. This was the discriminator on the spectrograms. And I think this is even different. So what they're doing is they also the discriminator simply decides do the spectrograms look real or fake? Does the spectrogram look real or fake? Now they also take the spectrograms and compare them with the L one 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, OK, 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 L one loss. So we potentially run into this problem, right? Of the of the generator simply copying the input because you always tell it what the correct input is. This is now a supervised loss that we guide the training with. And what was I going to say? Yeah, so you take the generator output, you transform it into a spectrogram. You take the real output, transform it into a spectrogram, compare the L one loss. Now, you sort of run into the same problem in that if these are completely not aligned, then this is not going to work. But since you have a supervised loss, this it can it gives you a much stronger learning signal of what the generator should produce. So you're kind of counting at the beginning of training, you're counting on sort of a reverse reverse learning process in that the real the real sound will go into a spectrogram. And the generator will go here. And then that learning signal will sort of travel to make the generator produce more of whatever the real sound is. And that almost like if you think that the aligner is so bad that we have even non overlapping fragments, basically you teach the generator to ignore the inputs that it gets from down here, that it gets from its entire backbone. You teach it to sort of ignore all of that. If if that makes any sense. It simply produces the sound according to this supervised loss. Now, of course, it doesn't ignore it. It still takes the features, but it ignores the this whole alignment thing. And now once the generator gets a better signal of what it should produce, that signal can travel back to the aligner module to this length estimation module. And guide that one to make better predictions about the lengths. Okay, so that's how you at the beginning of training, you sort of rely on this path of learning to make to initialize this module of the aligner. And then once these length predictors are better, then the the loss can travel in its intended path where you forward produce these aligned sound waves. And then these discriminators take over. I don't exactly know if they trade this off during training or they simply set it to a number such that it helps them at the beginning. But it's a it's a good idea. And it's a it's a good trick to introduce here a supervised portion to make the beginning easier. But of course, you'd run into the same problem as I said, and that the fact that if you have two spectrograms, they not don't necessarily align again. And here they use this dynamic time warping loss. Now, this looks very, very similar to the aligner, but it is something different. Because now you have to the difference here is you have two things that you know should match. Right. You have this thing and you have this thing and they both have the same amount of entries. So they both have a, b, c, d, e. This has an a, a b, a c, a d and an e slot. And this also has an a, a b, a c, a d and an e slot. And you know that you assume so here is something you assume you assume that the beginning and the ends match. This is not true, of course, because we could have completely unaligned. But they say in practice, this works. So you assume that sort of at least a little bit. These are aligned. Right. So they have, by the way, there's so much to this paper, by the way, they have an auxiliary loss where the produced lengths, all the lengths that the this length prediction module produces, they I don't remember where that is, but they have an auxiliary loss where all the lengths must add up right here. All the lengths that these length predictors must add up to the total length of the sound, which in our case, I guess, is the two seconds. OK, 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 warping to assume that the beginnings and the endings align. All right, so we have two things with they have the same amount of of slots. We know the beginnings and ends align or we assume that. How do we make it? How do we find out which slots align to which? And this is a dynamic programming. They formulate this as a dynamic programming problem that you might, you know, from you might know from from like these are often taught in algorithms and data structure courses and so on, where you you can figure out which of these align. So if you go a step here, that means that you go one step in each in each of the sequences. And then if you go a step here, that means only this one advances and this one still corresponds to this one right here. And OK, I formulated wrong at the beginning. You don't have ABCDE. I guess you would actually have all of these slots and you would figure out which ones correspond to which. And we have the same problem here. And we have the same problem again, where we have a different selection. 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 this is a 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. So they align 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 or short the sequences are, they always follow one after another in both of the spectrograms and both of the 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 these length predictions that make the 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 phony miser. That's the very beginning, but they also ablate that. So in the results, they do a lot, lot of ablation studies, which I don't want to go into right now. I've already shown you some. 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 the lengths of each of the tokens in the sound and are also used to as an input to the generator here. Now, they can only be used as an input to the generator if the generator knows how to align them in time and how to align them in time is predicted from these predicted lengths right here via this aligner algorithm. This is 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, the now aligned tokens into sound. This goes into the discriminator. The discriminator is actually five different discriminators, which try each try to discriminate the original from the real. Sorry, the generated from the real at different time scales. In addition to that, you have a discriminator on the spectrograms and you also have an L1 loss on the 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, share it out, subscribe and have a good day. Bye bye.
[ { "start": 0, "end": 14, "text": " In this work, we take on the challenging task of learning to synthesize speech from normalized text or phonemes in an entwined manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs." }, { "start": 16, "end": 26, "text": " 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." }, { "start": 26, "end": 40, "text": " In this work, we take on the challenging task of learning to synthesize speech from normalized text or phonemes in an entwined manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs." }, { "start": 40, "end": 68, "text": " Okay, now you've probably, if you have listened to the text and not just how the text sounds, you have gotten what this paper is about. So the paper is called End to End Adversarial Text to Speech by Jeff Donahue, Sander Dieleman, Mikolai Binkowski, Eric Elson and Karen Simonian of, I believe, of mostly deep mind." }, { "start": 70, "end": 83, "text": " And this paper on a high level, it produces speech, so the sound waves of speech directly from text or from what they call normalized text or phoneme text." }, { "start": 83, "end": 100, "text": " And it does so without any intermediate supervised representations. And that's a challenging task. And the main problems here are the alignment problem that they have to solve and actually making this work in an adversarial manner." }, { "start": 101, "end": 111, "text": " 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." }, { "start": 111, "end": 122, "text": " 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." }, { "start": 123, "end": 136, "text": " And you want to make a model that takes this and outputs sound waves, as if a human would say it right so you do modern text to speech and so on." }, { "start": 136, "end": 146, "text": " 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." }, { "start": 147, "end": 156, "text": " So you have modern text to speech. Those are four tokens. However, sound waves are, of course, much, much densely sampled." }, { "start": 156, "end": 171, "text": " 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." }, { "start": 172, "end": 179, "text": " So one token will produce many, many thousand samples in the speech. So that's the first problem." }, { "start": 179, "end": 192, "text": " 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," }, { "start": 193, "end": 202, "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." }, { "start": 202, "end": 209, "text": " You don't know this word text right here. You don't know. You don't know where it starts and where it ends in this sound wave." }, { "start": 210, "end": 223, "text": " 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." }, { "start": 223, "end": 231, "text": " And this paper here solves all of these problems jointly by doing an adversarial approach to learning." }, { "start": 232, "end": 244, "text": " 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." }, { "start": 244, "end": 254, "text": " 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 sense." }, { "start": 255, "end": 263, "text": " So let's say this over here is real. And this is what the generator has produced. The discriminator tries to discriminate between the two." }, { "start": 263, "end": 274, "text": " Now this is not entirely the same thing as a supervised loss. Usually in a GAN, you do not have the corresponding samples, right?" }, { "start": 275, "end": 281, "text": " You simply input a real sample here and the generator produces a generated sample here." }, { "start": 282, "end": 290, "text": " You do not necessarily have in a classic GAN the corresponding sample. Here you assume that you have the corresponding real sample," }, { "start": 290, "end": 300, "text": " 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," }, { "start": 301, "end": 311, "text": " 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." }, { "start": 311, "end": 323, "text": " 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." }, { "start": 324, "end": 330, "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." }, { "start": 330, "end": 344, "text": " And the first thing they do is they would produce a set of whatever they would call features like textual features." }, { "start": 345, "end": 352, "text": " So these are these are sort of intermediate features for the text to be produced." }, { "start": 352, "end": 361, "text": " And then another model would take these and it would produce something like spectrograms spectrograms." }, { "start": 362, "end": 368, "text": " And then another model would take the spectrograms and finally produce sound or speech." }, { "start": 369, "end": 374, "text": " So you have usually in these systems, you have intermediate representation." }, { "start": 374, "end": 381, "text": " And each of these models right here can be trained by itself. So that's an advantage that you can train." }, { "start": 382, "end": 391, "text": " 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." }, { "start": 392, "end": 398, "text": " The computation from sound to spectrogram is super easy. So you can generate your own training data." }, { "start": 398, "end": 403, "text": " So you can go from spectrogram to sound. You can train a model like this." }, { "start": 404, "end": 410, "text": " So in these pipelines, usually there are multiple stages and each of these models has to be trained by itself." }, { "start": 411, "end": 420, "text": " This paper tries to do this end to end. That means you input the text and you get out the you get out the sound wave." }, { "start": 420, "end": 432, "text": " And and there is nothing in between that the I mean, of course, there are latent representations, but you train it ends to end in one go." }, { "start": 433, "end": 437, "text": " Okay, so let's look at the different systems they employ." }, { "start": 438, "end": 443, "text": " First of all, let's look at the discriminators, because that's the easiest." }, { "start": 443, "end": 449, "text": " So they have these discriminators and these are adopted from this GAN TTS paper." }, { "start": 450, "end": 457, "text": " Now, as we already said, the discriminator try to to differentiate between real and fake sound." }, { "start": 458, "end": 468, "text": " 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." }, { "start": 468, "end": 472, "text": " But instead, the discriminators, they operate on very small windows." }, { "start": 473, "end": 480, "text": " So in specific, they have five different discriminators and each of the five different discriminators take a different size window length." }, { "start": 481, "end": 486, "text": " But all of these windows are super short. So one discriminator might take this long windows." }, { "start": 487, "end": 493, "text": " Another discriminator might take a bit longer windows and another discriminator might take a bit shorter windows." }, { "start": 493, "end": 502, "text": " And that, of course, from the real and from the fake and the discriminators simply try to discriminate only in these windows, whether it's real or fake." }, { "start": 503, "end": 511, "text": " 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." }, { "start": 512, "end": 520, "text": " 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" }, { "start": 520, "end": 531, "text": " whether a short sequence sounds like real or sounds like fake and whether the two samples sound alike in different scales of time." }, { "start": 532, "end": 537, "text": " And by only doing this on these short scales, you can you can the loss sort of generalizes." }, { "start": 538, "end": 547, "text": " Otherwise, if you compare it on the entire sound wave, it would just reduce to comparing point like point by point right here." }, { "start": 547, "end": 554, "text": " And if the generator produces something that's not exactly aligned, then, of course, every point would be wrong." }, { "start": 555, "end": 569, "text": " And you'd run into all sorts of questions. So this is a set of five discriminators that all try to take each takes a different length of sub sub sound of this wave tries to discriminate real from fake." }, { "start": 569, "end": 577, "text": " That's the discriminator loss. They have an additional discriminator loss where they compute spectrograms of these things." }, { "start": 578, "end": 584, "text": " So spectrograms and compute spectrogram of this." }, { "start": 585, "end": 592, "text": " And they have a discriminator, another neural network here that it tries to distinguish which one is real and which one is fake." }, { "start": 592, "end": 598, "text": " Note that this is not the same as down here where the spectrogram is an intermediate representation." }, { "start": 599, "end": 605, "text": " Here, the sound is the output and from the sound you compute the spectrogram and then you compare the two." }, { "start": 606, "end": 612, "text": " So this is simply a different spectrogram is a different feature space for the discriminator to compute the loss." }, { "start": 613, "end": 620, "text": " It is not an intermediate representation on the way to produce the sound itself so that the difference." }, { "start": 620, "end": 626, "text": " That's the difference here between the classic approach and this approach." }, { "start": 627, "end": 630, "text": " So it's end to end adversarial. So we got the discriminator." }, { "start": 631, "end": 636, "text": " The discriminators simply try to differentiate the sound waves and short scales as well as the spectrograms." }, { "start": 637, "end": 642, "text": " Now, the second part is, of course, the generator. How do we even produce sound?" }, { "start": 643, "end": 645, "text": " And that's this diagram right here." }, { "start": 645, "end": 655, "text": " So you have this Gantt generator. This is a generator that takes in a hidden representation." }, { "start": 656, "end": 659, "text": " It takes in tokens. Let's say token one, token two." }, { "start": 660, "end": 667, "text": " Let's go from the one before. Think of a sentence. Hello there." }, { "start": 667, "end": 676, "text": " There. OK, so it takes these tokens and of course it takes like hidden representations of the tokens." }, { "start": 677, "end": 683, "text": " And it will output. It will output for each one or for this joint sequence." }, { "start": 684, "end": 688, "text": " One hidden, two. It would output the sound wave. OK." }, { "start": 688, "end": 700, "text": " And this has been a paper before, the Gantt TTS. And you also you condition it on the speaker and on latent variables like how you want the pitch to be and so on." }, { "start": 701, "end": 708, "text": " That's not really important for us right here. The generator can simply take these token embeddings and produce sound." }, { "start": 708, "end": 718, "text": " The problem is in the original paper, you had an alignment. You knew which token corresponded to which piece of sound." }, { "start": 719, "end": 725, "text": " And therefore you sort of knew. So after that, you need to compare this to the generator thing." }, { "start": 726, "end": 730, "text": " And you knew which token corresponded to which piece of sound right here." }, { "start": 731, "end": 736, "text": " So the generator knew what it had to produce from each token, how long it should be and so on." }, { "start": 736, "end": 741, "text": " So this is the generally the alignment problem or what I call the alignment problem." }, { "start": 742, "end": 746, "text": " So if you take a piece of text like this entire paragraph right here." }, { "start": 747, "end": 753, "text": " Let's look at this paragraph. This paragraph to read it out takes like 30 to 60 seconds." }, { "start": 754, "end": 761, "text": " You can't train really models that output this long of sound. It would be too big of a sample." }, { "start": 761, "end": 770, "text": " You want to train ideally on segments. They train segments that are, I believe here, two second windows from each examples." }, { "start": 771, "end": 777, "text": " So because they say if we train on 20 seconds, that would just be wasteful and prohibitively expensive." }, { "start": 777, "end": 790, "text": " 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," }, { "start": 791, "end": 800, "text": " I have no clue again which part of the entire sound wave of this paragraph this subsequence corresponds to." }, { "start": 800, "end": 808, "text": " A good guess would be to go like, well, this is about 50 percent in. So maybe here to here. Maybe. Who knows." }, { "start": 809, "end": 818, "text": " 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." }, { "start": 818, "end": 830, "text": " 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?" }, { "start": 831, "end": 841, "text": " 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." }, { "start": 841, "end": 849, "text": " 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." }, { "start": 850, "end": 857, "text": " So this generator is really good at producing sound when it has these alignments." }, { "start": 857, "end": 862, "text": " So the challenging task here is how do you compute these alignments?" }, { "start": 862, "end": 864, "text": " How do you compute this thing?" }, { "start": 864, "end": 871, "text": " If you don't have it, if you're if you don't have it in your training data, so it needs to be part of the loss." }, { "start": 871, "end": 874, "text": " So that's what this entire architecture down here is." }, { "start": 875, "end": 878, "text": " So the text is down here." }, { "start": 878, "end": 888, "text": " 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." }, { "start": 888, "end": 890, "text": " There are scripts that do this." }, { "start": 890, "end": 894, "text": " This is the only preprocessing they do." }, { "start": 894, "end": 898, "text": " And they can also leave it away in the heaven ablation on their website." }, { "start": 898, "end": 902, "text": " So this is like phoneme text. Cat sat on the mat." }, { "start": 902, "end": 910, "text": " Now, this phoneme text goes through these big block of convolutions and of dilated convolutions." }, { "start": 910, "end": 916, "text": " And this outputs a 200 hertz representation token length." }, { "start": 916, "end": 920, "text": " Alignment. OK, I should specify this." }, { "start": 920, "end": 926, "text": " So for each token here, it outputs a length." }, { "start": 926, "end": 930, "text": " So this thing predicts the length of each of the tokens." }, { "start": 930, "end": 939, "text": " These all of this all of this thing here is to to embed the tokens in hidden space and then predict its length." }, { "start": 939, "end": 946, "text": " You can see that right here." }, { "start": 946, "end": 954, "text": " OK, so first we use F to to take X." }, { "start": 954, "end": 961, "text": " So F is a stack of dilated convolutions and it takes X and outputs a hidden representation." }, { "start": 961, "end": 968, "text": " So H. So first X goes to H and then H is used to predict the length of each of the tokens." }, { "start": 968, "end": 976, "text": " H is used to predict L and L is the length of that token." }, { "start": 976, "end": 981, "text": " So we embed this into a hidden representation with this right here." }, { "start": 981, "end": 985, "text": " And then we use this stack to predict the length of each token." }, { "start": 985, "end": 994, "text": " So this could be this could say something like this cat token right here is 20 milliseconds long." }, { "start": 994, "end": 999, "text": " Or instead of milliseconds, you would use something like frames or data points." }, { "start": 999, "end": 1005, "text": " Maybe this is 200 data points long." }, { "start": 1005, "end": 1008, "text": " And then SAT is a bit shorter. So this is 100 long." }, { "start": 1008, "end": 1012, "text": " And ON is really short. So this is 50 long." }, { "start": 1012, "end": 1015, "text": " So for each token, it predicts the length." }, { "start": 1015, "end": 1022, "text": " All right. So now if we have the length of each, we can sort of calculate where the starting point is." }, { "start": 1022, "end": 1027, "text": " So if we want to know if we know that here is the beginning and the beginning of the sentence," }, { "start": 1027, "end": 1034, "text": " we we conservatively assume that there is so they give some silence buffer here." }, { "start": 1034, "end": 1041, "text": " But roughly, you can assume that the beginning of the speech corresponds to the first the first token." }, { "start": 1041, "end": 1044, "text": " Right. You can simply trace the waveform." }, { "start": 1044, "end": 1048, "text": " And whenever it goes up, that's where the first token starts." }, { "start": 1048, "end": 1052, "text": " And then since we know that's where the first token starts," }, { "start": 1052, "end": 1056, "text": " and if we could predict the length of each one correctly," }, { "start": 1056, "end": 1060, "text": " we could simply sum those up to figure out where our word starts." }, { "start": 1060, "end": 1066, "text": " So if we want to know where on starts, we simply go from the beginning and go 200 plus 100 milliseconds." }, { "start": 1066, "end": 1073, "text": " So our data points 200 plus 100. Here is where on starts." }, { "start": 1073, "end": 1081, "text": " OK. And if we want to figure out the middle of on, we simply add the half of this number." }, { "start": 1081, "end": 1084, "text": " So plus 25 gets you to the middle." }, { "start": 1084, "end": 1092, "text": " So this is this here is the center of the token on." }, { "start": 1092, "end": 1095, "text": " So for each token, we predict the length like this." }, { "start": 1095, "end": 1101, "text": " And thereby, we can just calculate for each one by summing up from the beginning" }, { "start": 1101, "end": 1108, "text": " and then adding half of its own length where the center of that token in the entire sequence is." }, { "start": 1108, "end": 1113, "text": " And now we do this. We said we take random two second audio," }, { "start": 1113, "end": 1119, "text": " but we do this procedure for the entire for the entire text." }, { "start": 1119, "end": 1125, "text": " OK, for the for every single token in the text that we look at in the 20 second text," }, { "start": 1125, "end": 1133, "text": " we do this because then for each token, we'll get a token center." }, { "start": 1133, "end": 1141, "text": " And now the aligners job here is to align that to the actual sound." }, { "start": 1141, "end": 1145, "text": " So what we also give the generators here, the offset." }, { "start": 1145, "end": 1152, "text": " So let's say we have this 20 second of speech and we randomly sampled these two seconds." }, { "start": 1152, "end": 1155, "text": " And that's maybe five seconds from the beginning." }, { "start": 1155, "end": 1160, "text": " We also tell it this is five seconds right here." }, { "start": 1160, "end": 1170, "text": " So what we can now do is we can calculate back sort of and say, OK, here I have" }, { "start": 1170, "end": 1176, "text": " I first need to discard five seconds of my signal and I have a prediction how long each token is." }, { "start": 1176, "end": 1182, "text": " So I can just cross out tokens until I have basically wasted five seconds." }, { "start": 1182, "end": 1190, "text": " And then I know, OK, from here to wherever these things sum up to two seconds from here to that." }, { "start": 1190, "end": 1194, "text": " Those are my two seconds that I want to look at." }, { "start": 1194, "end": 1201, "text": " Now, this is how I figure out where in the big sound wave my fragment is." }, { "start": 1201, "end": 1209, "text": " Because I have this offset where I sampled it and I simply add use this and the predicted lengths to figure it out." }, { "start": 1209, "end": 1213, "text": " I still need to figure out these tokens that are actually in the span." }, { "start": 1213, "end": 1218, "text": " How do they distribute? And that's what this aligner here does." }, { "start": 1218, "end": 1225, "text": " Since we've already predicted the token centers, we simply assume that if these are correct, right," }, { "start": 1225, "end": 1234, "text": " then if this is, let's say if this is one second long, I assume that the middle is after point five seconds." }, { "start": 1234, "end": 1237, "text": " So this is one second. The middle is point five seconds." }, { "start": 1237, "end": 1241, "text": " So I think that this token is aligned right here." }, { "start": 1241, "end": 1243, "text": " This is the center of the token." }, { "start": 1243, "end": 1251, "text": " Now, we want to be a little bit a little bit fuzzy with respect to that." }, { "start": 1251, "end": 1256, "text": " So what they do is they sort of use a Gaussian kernel right here." }, { "start": 1256, "end": 1263, "text": " So for each token, as you can see here, each token has a center, which is here." }, { "start": 1263, "end": 1267, "text": " So the y axis is the time in sound and the x axis is the token." }, { "start": 1267, "end": 1271, "text": " And for each token, we say, well, it doesn't have to be exactly there." }, { "start": 1271, "end": 1276, "text": " It can be so they put a Gaussian kernel like this." }, { "start": 1276, "end": 1283, "text": " OK, if you imagine this kernel popping out of the frame, they say this is about where the center is." }, { "start": 1283, "end": 1290, "text": " And for this token, right for this token right here, they say, well, it's it's probably here in the middle," }, { "start": 1290, "end": 1293, "text": " but it could also be here or here or here or here." }, { "start": 1293, "end": 1297, "text": " And we weigh this like this." }, { "start": 1297, "end": 1300, "text": " So these are these are the weights." }, { "start": 1300, "end": 1305, "text": " And then you simply sum up the weights with these embeddings." }, { "start": 1305, "end": 1310, "text": " So for each token out of this dilated convolution block, you get a hidden embedding." }, { "start": 1310, "end": 1316, "text": " And by using this alignment matrix that you computed by predicting the lengths" }, { "start": 1316, "end": 1322, "text": " and therefore predicting the centers of the tokens, you can then sort of shift." }, { "start": 1322, "end": 1328, "text": " So first, you assume that h1, h2, h3, if you were to do nothing," }, { "start": 1328, "end": 1332, "text": " these would just all take up like a third of the time." }, { "start": 1332, "end": 1340, "text": " And now by multiplying with this matrix, you have the opportunity because you predicted a longer length for the first token." }, { "start": 1340, "end": 1348, "text": " You have the opportunity to shift that a bit to the right and maybe shorten the second token a bit." }, { "start": 1348, "end": 1351, "text": " And then the third token goes until the end." }, { "start": 1351, "end": 1353, "text": " OK, that's what this aligner thing is." }, { "start": 1353, "end": 1355, "text": " This is not a model by itself." }, { "start": 1355, "end": 1360, "text": " All that this takes in is the computation right here of the token lengths." }, { "start": 1360, "end": 1364, "text": " This estimates these token lengths for each of the tokens." }, { "start": 1364, "end": 1366, "text": " And the rest is deterministic." }, { "start": 1366, "end": 1369, "text": " It's simply saying, OK, how much is the offset?" }, { "start": 1369, "end": 1370, "text": " Cool." }, { "start": 1370, "end": 1372, "text": " That's how we know where in the sound wave we are." }, { "start": 1372, "end": 1375, "text": " And then where is each of the centers?" }, { "start": 1375, "end": 1379, "text": " And we simply do that by summing up the predicted token lengths." }, { "start": 1379, "end": 1387, "text": " 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." }, { "start": 1387, "end": 1390, "text": " So to be differentiable, basically." }, { "start": 1390, "end": 1398, "text": " And that will that will ultimately train this loss, this model right here that computes the token lengths." }, { "start": 1398, "end": 1403, "text": " Right. So we sum up in a weighted fashion these embeddings right here." }, { "start": 1403, "end": 1405, "text": " And that's what goes into the generator." }, { "start": 1405, "end": 1416, "text": " 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." }, { "start": 1416, "end": 1421, "text": " And from that, the generator can now produce the sound wave itself." }, { "start": 1421, "end": 1422, "text": " OK." }, { "start": 1422, "end": 1424, "text": " And that's basically that's just an up sampling here." }, { "start": 1424, "end": 1437, "text": " I think that's just an up convolution up sampling from 200 hertz signal to a 24 kilohertz signal." }, { "start": 1437, "end": 1438, "text": " Cool." }, { "start": 1438, "end": 1441, "text": " So that's that." }, { "start": 1441, "end": 1444, "text": " Now they discover this doesn't work." }, { "start": 1444, "end": 1446, "text": " And why doesn't it work?" }, { "start": 1446, "end": 1453, "text": " It's because at the beginning of training, these token length predictions here are pretty crappy." }, { "start": 1453, "end": 1468, "text": " 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?" }, { "start": 1468, "end": 1469, "text": " Right." }, { "start": 1469, "end": 1491, "text": " So 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 token here, which is what the discriminator looks at, it produces these tokens here." }, { "start": 1491, "end": 1497, "text": " Of course, you have no chance, no matter how good your adversarial loss is." }, { "start": 1497, "end": 1510, "text": " 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." }, { "start": 1510, "end": 1515, "text": " So they have an additional loss right here." }, { "start": 1515, "end": 1525, "text": " What they do is they produce from the again, they go via the spectrograms within this spectrogram prediction loss." }, { "start": 1525, "end": 1531, "text": " So they say we discovered that adversarial feedback is insufficient to learn alignment." }, { "start": 1531, "end": 1535, "text": " At the start of training, the aligner does not produce an accurate alignment." }, { "start": 1535, "end": 1540, "text": " So the information in the input tokens is incorrectly temporally distributed." }, { "start": 1540, "end": 1545, "text": " This encourages the decoder to ignore the aligner output." }, { "start": 1545, "end": 1549, "text": " The unconditional discriminators provide no useful signal to correct this." }, { "start": 1549, "end": 1550, "text": " Oh, yeah, I should have mentioned this." }, { "start": 1550, "end": 1556, "text": " The discriminators here, since you don't know, you don't know which tokens you should produce." }, { "start": 1556, "end": 1558, "text": " The discriminators are unconditional." }, { "start": 1558, "end": 1561, "text": " They don't know which text is produced." }, { "start": 1561, "end": 1562, "text": " You don't give them the tokens." }, { "start": 1562, "end": 1564, "text": " You simply give them the sound waves." }, { "start": 1564, "end": 1567, "text": " That's something I find particularly interesting here." }, { "start": 1567, "end": 1577, "text": " Now, you of course, this wouldn't work in a like a traditional again, because you simply have a data sample here and a data sample right here." }, { "start": 1577, "end": 1582, "text": " But in this case, you of course have the corresponding sound samples." }, { "start": 1582, "end": 1586, "text": " But still, they are, you know, they are cut down to a subsequence." }, { "start": 1586, "end": 1588, "text": " So you don't know which text you're producing." }, { "start": 1588, "end": 1591, "text": " So you have to make the discriminators unconditional." }, { "start": 1591, "end": 1603, "text": " 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." }, { "start": 1603, "end": 1611, "text": " And then the aligner can also not learn anything because there is no learning signal because everything just says this is not the same." }, { "start": 1611, "end": 1613, "text": " OK." }, { "start": 1613, "end": 1615, "text": " And that's what they say here." }, { "start": 1615, "end": 1616, "text": " We face a different problem." }, { "start": 1616, "end": 1620, "text": " We do not have aligned ground truth." }, { "start": 1620, "end": 1630, "text": " 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." }, { "start": 1630, "end": 1638, "text": " So even if they were to input the text, it would still be the wrong text because their aligner is wrong at the beginning." }, { "start": 1638, "end": 1647, "text": " Although it should be possible in theory to train the discriminators aligner module adversarially, we find that this does not work in practice and training gets stuck." }, { "start": 1647, "end": 1649, "text": " So what do they do?" }, { "start": 1649, "end": 1656, "text": " They say instead we propose to guide learning by using an explicit prediction loss in the spectrogram domain." }, { "start": 1656, "end": 1666, "text": " We minimize the L one loss between the log scale male spectrograms of the generator output and the corresponding ground truth training window." }, { "start": 1666, "end": 1674, "text": " This helps learning to take off and renders conditional discriminators unnecessary, simplifying the model." }, { "start": 1674, "end": 1688, "text": " So they take the they take the spectrogram of the generator output and the corresponding ground truth training window and they simply calculate the L one difference of the spectrograms." }, { "start": 1688, "end": 1700, "text": " 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." }, { "start": 1700, "end": 1703, "text": " This is different from that." }, { "start": 1703, "end": 1705, "text": " This is even in addition to that." }, { "start": 1705, "end": 1707, "text": " So here somewhere we had this." }, { "start": 1707, "end": 1711, "text": " This was the discriminator on the spectrograms." }, { "start": 1711, "end": 1713, "text": " And I think this is even different." }, { "start": 1713, "end": 1723, "text": " So what they're doing is they also the discriminator simply decides do the spectrograms look real or fake?" }, { "start": 1723, "end": 1725, "text": " Does the spectrogram look real or fake?" }, { "start": 1725, "end": 1733, "text": " Now they also take the spectrograms and compare them with the L one loss." }, { "start": 1733, "end": 1738, "text": " So this is exactly what they said they wouldn't do right here." }, { "start": 1738, "end": 1740, "text": " Now it's still the case, right?" }, { "start": 1740, "end": 1750, "text": " 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." }, { "start": 1750, "end": 1760, "text": " 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." }, { "start": 1760, "end": 1762, "text": " They're good to guide the training, but they sort of distract." }, { "start": 1762, "end": 1773, "text": " And now they see, OK, maybe we have to introduce this one right here in order to make the training start, because this is a real signal." }, { "start": 1773, "end": 1780, "text": " But again, you run into a problem, namely, if you produce something with the generator." }, { "start": 1780, "end": 1786, "text": " And so first of all, this is not a discriminator anymore." }, { "start": 1786, "end": 1788, "text": " This is a true L one loss." }, { "start": 1788, "end": 1792, "text": " So we potentially run into this problem, right?" }, { "start": 1792, "end": 1799, "text": " Of the of the generator simply copying the input because you always tell it what the correct input is." }, { "start": 1799, "end": 1803, "text": " This is now a supervised loss that we guide the training with." }, { "start": 1803, "end": 1809, "text": " And what was I going to say?" }, { "start": 1809, "end": 1812, "text": " Yeah, so you take the generator output, you transform it into a spectrogram." }, { "start": 1812, "end": 1816, "text": " You take the real output, transform it into a spectrogram, compare the L one loss." }, { "start": 1816, "end": 1824, "text": " Now, you sort of run into the same problem in that if these are completely not aligned, then this is not going to work." }, { "start": 1824, "end": 1833, "text": " But since you have a supervised loss, this it can it gives you a much stronger learning signal of what the generator should produce." }, { "start": 1833, "end": 1846, "text": " So you're kind of counting at the beginning of training, you're counting on sort of a reverse reverse learning process in that the real the real sound will go into a spectrogram." }, { "start": 1846, "end": 1857, "text": " 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." }, { "start": 1857, "end": 1875, "text": " 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 inputs that it gets from down here, that it gets from its entire backbone." }, { "start": 1875, "end": 1882, "text": " You teach it to sort of ignore all of that. If if that makes any sense." }, { "start": 1882, "end": 1886, "text": " It simply produces the sound according to this supervised loss." }, { "start": 1886, "end": 1893, "text": " Now, of course, it doesn't ignore it. It still takes the features, but it ignores the this whole alignment thing." }, { "start": 1893, "end": 1904, "text": " 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." }, { "start": 1904, "end": 1909, "text": " And guide that one to make better predictions about the lengths." }, { "start": 1909, "end": 1919, "text": " Okay, so that's how you at the beginning of training, you sort of rely on this path of learning to make to initialize this module of the aligner." }, { "start": 1919, "end": 1930, "text": " And then once these length predictors are better, then the the loss can travel in its intended path where you forward produce these aligned sound waves." }, { "start": 1930, "end": 1941, "text": " 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." }, { "start": 1941, "end": 1953, "text": " But it's a it's a good idea. And it's a it's a good trick to introduce here a supervised portion to make the beginning easier." }, { "start": 1953, "end": 1966, "text": " But of course, you'd run into the same problem as I said, and that the fact that if you have two spectrograms, they not don't necessarily align again." }, { "start": 1966, "end": 1977, "text": " And here they use this dynamic time warping loss. Now, this looks very, very similar to the aligner, but it is something different." }, { "start": 1977, "end": 1984, "text": " Because now you have to the difference here is you have two things that you know should match." }, { "start": 1984, "end": 1990, "text": " Right. You have this thing and you have this thing and they both have the same amount of entries." }, { "start": 1990, "end": 1998, "text": " So they both have a, b, c, d, e. This has an a, a b, a c, a d and an e slot." }, { "start": 1998, "end": 2002, "text": " And this also has an a, a b, a c, a d and an e slot." }, { "start": 2002, "end": 2010, "text": " And you know that you assume so here is something you assume you assume that the beginning and the ends match." }, { "start": 2010, "end": 2017, "text": " This is not true, of course, because we could have completely unaligned. But they say in practice, this works." }, { "start": 2017, "end": 2024, "text": " So you assume that sort of at least a little bit. These are aligned." }, { "start": 2024, "end": 2035, "text": " Right. So they have, by the way, there's so much to this paper, by the way, they have an auxiliary loss where the produced lengths," }, { "start": 2035, "end": 2043, "text": " all the lengths that the this length prediction module produces, they I don't remember where that is," }, { "start": 2043, "end": 2048, "text": " but they have an auxiliary loss where all the lengths must add up right here." }, { "start": 2048, "end": 2056, "text": " All the lengths that these length predictors must add up to the total length of the sound, which in our case, I guess, is the two seconds." }, { "start": 2056, "end": 2071, "text": " OK, 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." }, { "start": 2071, "end": 2083, "text": " 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 warping to assume that the beginnings and the endings align." }, { "start": 2083, "end": 2088, "text": " All right, so we have two things with they have the same amount of of slots." }, { "start": 2088, "end": 2091, "text": " We know the beginnings and ends align or we assume that." }, { "start": 2091, "end": 2099, "text": " How do we make it? How do we find out which slots align to which?" }, { "start": 2099, "end": 2101, "text": " And this is a dynamic programming." }, { "start": 2101, "end": 2114, "text": " 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," }, { "start": 2114, "end": 2119, "text": " where you you can figure out which of these align." }, { "start": 2119, "end": 2135, "text": " 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." }, { "start": 2135, "end": 2138, "text": " And OK, I formulated wrong at the beginning." }, { "start": 2138, "end": 2141, "text": " You don't have ABCDE." }, { "start": 2141, "end": 2146, "text": " I guess you would actually have all of these slots and you would figure out which ones correspond to which." }, { "start": 2146, "end": 2149, "text": " And we have the same problem here." }, { "start": 2149, "end": 2153, "text": " And we have the same problem again, where we have a different selection." }, { "start": 2153, "end": 2160, "text": " Yeah, but I hope you recognize these sort of problems where and the here you align them again." }, { "start": 2160, "end": 2167, "text": " So these are classic dynamic programming alignment problems and they align it like this." }, { "start": 2167, "end": 2176, "text": " And this is a larger penalty we give. So they give a penalty with respect to how much this path deviates." }, { "start": 2176, "end": 2186, "text": " So here you can see how much the spectrogram of the generated the generated sound aligns with the spectrogram of the ground truth." }, { "start": 2186, "end": 2193, "text": " And here is a penalty for each time that the two spectrograms don't align correctly." }, { "start": 2193, "end": 2198, "text": " So they align in a soft way. So they do every single possible path right here." }, { "start": 2198, "end": 2201, "text": " And you can again do this using dynamic programming." }, { "start": 2201, "end": 2211, "text": " And the entire catch here is that the alignment must be monotonic because no matter how long or short the sequences are," }, { "start": 2211, "end": 2217, "text": " they always follow one after another in both of the spectrograms and both of the sounds." }, { "start": 2217, "end": 2219, "text": " So that's why you can optimize it in a way." }, { "start": 2219, "end": 2229, "text": " So over all the possible paths that you can align them, you weigh these paths by their score that you give them here." }, { "start": 2229, "end": 2236, "text": " And then you calculate the loss across all these different paths." }, { "start": 2236, "end": 2240, "text": " And that will give you that is sort of a fuzzy loss." }, { "start": 2240, "end": 2248, "text": " So you don't compare the spectrograms directly, but you compare them and you sort of forgive them for not aligning too well." }, { "start": 2248, "end": 2251, "text": " But the more they don't align, you give a penalty." }, { "start": 2251, "end": 2254, "text": " And that's how you sort of force the generator." }, { "start": 2254, "end": 2258, "text": " Again, you force the generator to produce things that are aligned." }, { "start": 2258, "end": 2265, "text": " You produce these length predictions that make the spectrograms closer to each other." }, { "start": 2265, "end": 2268, "text": " So that's how you calculate the spectrogram loss." }, { "start": 2268, "end": 2270, "text": " This is entirely deterministic." }, { "start": 2270, "end": 2273, "text": " There's no learned weights right here." }, { "start": 2273, "end": 2276, "text": " Okay, cool." }, { "start": 2276, "end": 2280, "text": " Last thing they say is that they use this phony miser." }, { "start": 2280, "end": 2284, "text": " That's the very beginning, but they also ablate that." }, { "start": 2284, "end": 2292, "text": " So in the results, they do a lot, lot of ablation studies, which I don't want to go into right now." }, { "start": 2292, "end": 2294, "text": " I've already shown you some." }, { "start": 2294, "end": 2298, "text": " And they do a even I think they do a human evaluation." }, { "start": 2298, "end": 2300, "text": " Do they do a human evaluation?" }, { "start": 2300, "end": 2303, "text": " I know this might have been in another paper." }, { "start": 2303, "end": 2308, "text": " But as you have heard from the examples, this sounds extremely realistic." }, { "start": 2308, "end": 2315, "text": " I'll link the website to the samples in the in in the video description for sure." }, { "start": 2315, "end": 2317, "text": " So I think we've gone over everything." }, { "start": 2317, "end": 2325, "text": " The generator starts off with text, puts that into normalized text, calculates hidden features right here." }, { "start": 2325, "end": 2331, "text": " These hidden features on one hand are used to predict the lengths of each of the tokens in the sound" }, { "start": 2331, "end": 2337, "text": " and are also used to as an input to the generator here." }, { "start": 2337, "end": 2344, "text": " Now, they can only be used as an input to the generator if the generator knows how to align them in time" }, { "start": 2344, "end": 2352, "text": " and how to align them in time is predicted from these predicted lengths right here via this aligner algorithm." }, { "start": 2352, "end": 2356, "text": " This is the lengths are the only thing that is predicted." }, { "start": 2356, "end": 2358, "text": " Everything then is deterministic." }, { "start": 2358, "end": 2367, "text": " The aligner is simply a Gaussian kernel over the predicted locations on the on the time axis." }, { "start": 2367, "end": 2374, "text": " It is so the Gaussian kernel is to make it to make this alignment a bit fuzzy to make this prediction fuzzy." }, { "start": 2374, "end": 2382, "text": " You perform a weighted sum with these features and then the generator knows where to put the feet where to put the tokens." }, { "start": 2382, "end": 2388, "text": " Finally, the generator can up sample the token, the now aligned tokens into sound." }, { "start": 2388, "end": 2390, "text": " This goes into the discriminator." }, { "start": 2390, "end": 2398, "text": " The discriminator is actually five different discriminators, which try each try to discriminate the original from the real." }, { "start": 2398, "end": 2402, "text": " Sorry, the generated from the real at different time scales." }, { "start": 2402, "end": 2411, "text": " In addition to that, you have a discriminator on the spectrograms and you also have an L1 loss on the spectrograms," }, { "start": 2411, "end": 2417, "text": " which helps especially at the beginning of training for the L1 loss of the spectrograms." }, { "start": 2417, "end": 2424, "text": " You have to again compute an alignment, but you do this in a deterministic way by this thing down here." }, { "start": 2424, "end": 2433, "text": " This dynamic time warping where you simply assume that they are aligned and forgive them for not being aligned with a with a" }, { "start": 2433, "end": 2440, "text": " a soft penalty and not a hard hard zero score." }, { "start": 2440, "end": 2442, "text": " All right, this was the paper." }, { "start": 2442, "end": 2448, "text": " Again, if you like this, leave a like a comment, share it out, subscribe and have a good day." }, { "start": 2448, "end": 2471, "text": " Bye bye." } ]
xTzFJIknh7E
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
TransCoder: Unsupervised Translation of Programming Languages (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper" ]
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 the cool thing about this paper is that by having no target, 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 Lachaud, Baptiste Rosier, Loïc Chanusso and Jérôme 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 COBOL 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 the modern Python 3. Now 2-to-3 is a 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 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 often times, even though you can write these rules, often times whatever comes out is sort of a bit of a cryptic source code, because you kind of have to make sure that your rules cover all the possible things, and the source code that comes out is oftentimes very cryptic and a bit hard to understand, because it's been sort of expanded and formalized to make sure that it still does the same thing as the original source code. Now for Python 2 to Python 3, this is still easy, right? These languages are extremely similar, because it's not that big of a step to Python 3, except if you use very low level language constructs or language features which have been obsoleted with Python 3. On the other hand, if there's something like Cobol, so a lot of this old banking code or insurance code or government agency code whatnot is written in these really old programming languages, and they've been kept alive by these old-school programmers that are slowly but surely all retiring now, and there are just not many new programmers around that can support these languages, and the languages themselves aren't really updated that much anymore, so you would like to transform 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 are Python 2 and Python 3. So what you would like to do is you would like to have a tool that is like 2 to 3, but humans... because now if you want a tool like this, you need someone that's really proficient in 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 it's source code. So we all know that we've all realized in the last years that things like Google Translate have become extremely good at translating. So they say right here, although neural models significantly outperform their rule-based counterparts in the context of natural language translation, which is Google Translate is all learned right now, they say their applications to trans compilation have been limited due to the scarcity of parallel data in this domain. So what's the problem with just going and saying, oh, we can build really good neural machine translation models, let's just apply them to source code. The problem is if you build a neural machine translation model, say something that transforms English to German, so you have the word hello and you output hello. You can do it not with just one word, but with entire sentences and so on. These models, they usually, or in the classical sense, what they need are parallel corpora, which means that you have documents that are written in many languages and you can guarantee that they mean the same thing. So this is a supervised signal. One example of this is, let's say press releases of the United Nations. So the United Nations will make some press release and they will then have professional translators translate that press release into all of the different or into many different languages. And so you can pretty much guarantee that these mean the same thing. So these pairs of documents or triplets or whatnot, they are supervised training data for a machine translation model that translates from one language into the other. And the neural machine translation models rely heavily on these parallel corpora. For source code, you just don't have that as much. You don't have big code bases in great numbers where the exact same thing is implemented in one language and in the other language. There's just not that much data available. It is the case that sometimes, sorry, that sometimes, let's say in the case of Torch, it started as Lua and then it went to PyTorch and the developers had to translate the code from Torch to Python. But in the same in the same step, they've also made improvements. They sort of re-engineered and reinvented the framework and made it better. And so you can't really say these are the same things. And likewise, there's not a lot of code available where the same thing is implemented in two languages. So we just don't have these parallel corpora for the source code translation. So rather what this paper does is this paper goes into unsupervised machine translation. Now what does unsupervised machine translation mean? Unsupervised machine translation, you imagine I have just a big database of documents. And these documents, I know they're all in English. And I have this other big database and I know that they are all in German. I just know their documents are in German. But they don't correspond to each other. They're just German documents. And over here, they're just English documents. They don't, I don't say that these two here are somehow the same. No, I just have a bunch of German, a bunch of English. They don't even have to correspond. They're just text. And now what I want to do is I want to learn a shared embedding space. I sort of want to learn a shared space of embeddings for these two languages, such that similar things are mapped to the similar place. So if these two documents just happen to talk about the same thing, I want them to be mapped to similar spaces in this shared embedding space. So I'm gonna 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 and English as an output or French as an input and German as an output. In this case, we have this process right here and this process right here is the same model. And then the decoder that translates this, of course, now we have the encoder embedding, and then the decoder that actually translates to a language is also going to be the same model. So it's the same model that translates to English, then it translates to German. So first of all, how do we make the same model? Let's say we have the perfect encoder, right? This is E, the encoder, the same encoder for all languages. Let's say we have the perfect encoder and it can map the... 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 take this embedding, so you take the input, you put it into your model, I don't even know how you do this, and then you're output is going to be autoregressive, right? So you decode one token at a time. So you decode this token and then you feed it back into the model, and then you decode this token, you feed that back into the model, and so on. This is an autoregressive language model. And the trick here is that the very first token is a special token that describes the language you want to output. So here you say, I want German, and then you let the model decode its thing. And by conditioning on this token right here, it knows it should now produce German. During training, you will simply put the token here, and if it produces something other than German, that's a loss, right? So it will learn to produce German after you produce this tag. Alright, so what we need is an encoder and a decoder, such that in the encoder we can put in any language text, and it will map to the same space the things that mean the same things, and we need a decoder that 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, 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 he, and the second word piece might be LLO. There is usually 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 encodings, since the smallest units are going to be the characters themselves, they ensure that you always have everything is in vocabulary. You have no out-of-vocabulary tokens. But here you can already see that if we tokenize the languages like this and then we use the same encoder, so the same encoder will pop them into this shared space, that means that to the model this and this looks like the same thing. It is the same thing, right? It's the same input token in different languages. Now as you can see this comes from the same word, the 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 tokenizing in this way we have already mapped part of our languages, even though they're just 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 hollow, 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 in embedding space. And 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 he appear in front of this low thing. So I should probably map the ha and the he 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 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 partial overlap between word pieces in the different languages combined with the shared embedding pre-training results in these token across the languages results in an alignment of the embeddings. So naturally the things that mean the same things are going to be in the same places in embedding space, either because they are the same or because their statistical relation to the things that are the same is the same. It is sort of like these ha and the he are like synonyms in this shared language. So if you jumble all the English and German text together, the model thinks ha and he are synonyms and therefore maps it to the same space. This happens exactly the same in if you only have one language, two true synonyms. So 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 this happens? 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 languages 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 and likewise there is a lot of overlap between the different programming languages and that exactly is this correspondence to here. These models use the parts that are overlapping either tokens themselves or this can also be grammatical constructs and so on they can also be overlapping and therefore map to the same space so if a construct is used in the same way 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 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 work so well. In this paper here they've chosen C++ Python and Java which do have significant overlap but especially something like Python to Java of course there is a lot of a difference or Python to C++ as well Python is not typed and so you can see a bit of the difficulty is already in the paper here but you have to be aware that this works less and less the less this shared overlap is given. Alright so how do you train these models and remember we don't have parallel corpora we are simply reliant on having databases from having big repositories of Python code C++ code and Java code and they don't correspond to each other so the first thing you do and as I understand it you can do these things in parallel but there are three different objectives that achieve three different things in these models. The first objective is the cross-lingual masked language pre-training. Now the models here are going to be transformer models with encoders and decoders and that's comes from the attention is all you need papers and various other papers like this I've done videos on those if you want to see that. This masked language model pre-training however is from the BERT paper so BERT if you don't know what that is I've also done a video on that. This simply trains the encoder so this is to train the encoder. What you would do is you would input code so usually in masked language model if you train the encoder you input code with tokens like hello there you would then so this is your input you would then mask some of the tokens for example here the low and maybe the entire word there you would scrap that you would put it through your encoder which is this transformer model like BERT and then BERT is supposed to reconstruct hello there. BERT is supposed to reconstruct these two tokens like it doesn't see them and you ask it what did I cross out and it needs to reconstruct that so you train the model to reconstruct these masked tokens and the research on BERT and other things has shown that if you train with this objective the encoder sort of learns about the structure of code it learns about it learns which tokens and which constructs often appear together and therefore it learns something about the 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 comes from different languages it is mapped similar things are mapped to similar places in the embedding space right so the mask language model pre training very quickly as you take a piece of code like here on the left you mask out some of the tokens here you can see them in this mask and you simply ask the model the encoder to reconstruct those things okay so this is just for the encoder as far as I understand it the encoder doesn't it doesn't see the thing back here it simply sees this and you tell it please reconstruct please tell me which words or which tokens I I clipped out here and it's supposed to tell you okay the first one is if the second one is int and the third one is the I now if you consider what the encoder has to do here so if you were to see this then that pretty clearly you know you could you could guess that that is an if of course it's not a hundred percent but this is just pre training right so you train it to output if here now here you have to do a little bit more inference maybe you've seen this for construct a bunch of times and you can see that this is compared here and this is added so probably it's an integer and then in the last thing this is even more complicated if you don't see that the eye 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 asked the encoder to reconstruct tokens so the encoder is this box right here this colors this box is the encoder and the actual part that's going to predict these words is going to be one sort of one classification layer on top that is going to predict for each position the individual word now did this is just for pre-training after the pre-training you scrap that and you attach it to a decoder so you attach whatever you got out of the encoder to a decoder and the decoder will output in an autoregressive way one token after another I did I put a it output a token right here and it feed that token back into the decoder saying okay here's what I've produced now produce the next thing you produce the next token and so on so it would produce token after token the output and now as I said I'm not exactly sure I think they're doing all of these things at the same time so this would still be here but the information would just be routed in two different ways or maybe they do it one after another it doesn't really matter but what matters is in this thing here you now train the decoder I mean you train it jointly with the encoder but you also involve the decoder and you do this by doing something very similar you corrupt a piece of code and you get corrupted code now you can see part of this corruption is masking like you did before but also part of the corruption is like here you scramble some of the tokens right this was it was this over here you just jumble some of them around a bit and then you here you also drop a token as you can see that the one is dropped and you simply so you don't show this to the encoder or the decoder you input this corrupted code into the decode into the first the encoder and then you ask the decoder to give you back the original code without showing it the original code so the the task for the decoder for the encoder decoder for the entire model here is if you're if you see this here is corrupt the code I have corrupted it in various ways please tell me what I originally had now it can the masking it does the same as before it sort of infers it this thing here it says well probably I probably this isn't really correct you don't even tell it where the errors are right before with the masking you at least told it where the errors are now you don't even tell it where the where the errors are so it needs to recognize this here is probably correct this isn't this I'm gonna rewrite this to that okay and it does this one token at a time so it first goes into the dirt and it needs to output the correct thing this is I hope the difference is clear to the masked language modeling which involved the involved the decoder and here also is the first time where in the encoder you you prepend this Java token now this as you can see it still goes from the same language to the same language but this is where you train the decoder to output a given language so here with the token again this is the same decoder for all the three languages the only difference here is every time you simply provided with the special token at the beginning to tell it which language it should decode right now so this this now we have an encoder that maps all the languages to a shared space and we have a decoder that conditioned on a token like this can output a valid code in that thing assuming this here was corrupted code now since the encoder is shared it should map the same kind of corrupted code of the different languages to the same place in the embedding space and therefore this would also this would already be enough to have this model that we desire we can input some code it doesn't actually have to be corrupted right we can just input some code in one language and ask the decoder to output the other language and this works but it doesn't work super well and here the authors go for another idea from the unsupervised machine translation literature which is back translation so back translation is a technique where you can tune an unsupervised machine translation model in a way that you would tune a supervised one but of course you don't have supervised data so what's the plan you will produce the data yourself using your own model so the plan is pretty simple it's actually contained in the back translation name so if you have a piece of code what you would do is you would first use your model to translate this to another language any of your choice now you have no clue whether this thing here is correct or not you have no clue and you have no way of assessing it because you don't have ground truth what you can do is use your model again or actually use a second model that you train in parallel now I believe in this case they could use the same model but you can that could be instable and so on but in any case you can use your system again to translate it back to your original language your system can do that right and here whatever you get as an output you know the ground truth it's whatever you started with so now you can compare what comes out to what you started with the difficulty of course is if there is a mistake you don't know which of the two models made a mistake and you so it could be could be that your original translation model made a mistake and or it could be that your back translation model made a mistake and you have to find a loss function that kind of punishes both equally or you simply keep one sort of constant and loss free and train the other one because there there's going to be a sample where you have C++ as an input and then the intermediate language is Python so all of the models sort of get trained once as an as a source to target translator and once as a target to source translator but I hope the the objective is clear from the back translation so now with the back translation you actually you train the models to go from one language to another language okay and that's the that's the final goal even though you do it without supervised data you now have a model that can encode things into a shared space that can decode into a language and that is attuned to translating from one language to another language so that's that's it how this is all how does this work now for evaluation the question is of course how do you evaluate models like this for evaluation they go to this website called geeks for geeks and this is a an online platform with computer science and programming articles it gathers many coding problems and presents solution in several programming languages okay so this is a website that teaches you to code and it will have like an exercise please do this and then it will provide solutions in the different languages now why is that cool and they 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 you what this website is trying to do is it's trying to teach the people how to how to code up an algorithm that they think up in their head and therefore not only is the solution correct and the same it is implemented in the in the same way as you can see here the construct there's this if construct is everywhere the else if is everywhere so even though some of the languages might have specialty things for implementing some algorithms these are really the same algorithmic the same expression of algorithmic thought in the different languages so that is a perfect parallel data set the problem of course is that there is not that many so it is good enough as a test set it is not good enough as a training set but given that it's a test set you can just have these as test set and then you can input the C++ and see whether or not the Java comes out the problem here of course is that even though this is very clear there are still you know sort of many variations of how you can implement that to even express the same algorithmic thought so metrics from natural language processing like blue just aren't going to be very good because they look at n-gram overlap and you can write this function with very different n-grams and still be very very valid and correct and also exact match is not going to be really the the gold standard here so what they do is they create a set of unit tests where for each of these functions they go they check their input types they randomly generate input randomly generate a set of inputs look whatever comes out and if the same thing comes out in all of their test functions that they consider this a good unit test for that function so whenever you your model now produces let's say you input Python it produces a C++ you simply put these unit tests through the C++ function you produce and if they produce the same output as the Python the original Python function when on the same inputs then you consider the unit test to succeed and you consider the function to be correct that this of course this isn't this isn't the super duper gold standard especially with random inputs because usually what you want to do is test sort of corner cases but it's better than anything else so far I've been a long dis-advocate of unit tests honestly because I think whenever a human writes a unit test then they're probably since they have already implemented the function itself they're probably going to make the same mistakes or they're probably just going to replicate the code and thinking of the function in the unit test itself and therefore it doesn't really get you anything I guess in large organizations you write unit tests so that someone else doesn't screw up your code but in this case it would actually be cool because now as a human you could simply write a bunch of unit tests and then let your let your trans compiler do the heavy lifting and you simply check whether or not the output is good alright so how does this do here you can see they have some baselines the C++ to Java as I understand it is a commercial system and the Java to Python is an open source system both are human experts that make up these rule-based systems on how to trans on how to translate code into other languages now the if you do what they have here is trans coder beam one which means a beam size of one so if you don't know a beam search is very shortly beam search is like if you decode from your language model you can either always take the next token that has the highest probability this would be greedy decoding or a beam size of one or you can sort of always keep the top n hypotheses of what the of what the most likely output is as you can keep that as a you can keep the top five in memory and always decode these five on sort of like you have a mini batch of five sequences and you always keep the top five in memory so at the end of the decoding you're going to have five different variants of the same sentence or of the same decoded output and you can then decide which one you like best and usually what you do is you then output the one that has the highest probability which is not the same as the greedy because sometimes the next token will be will look one next token will look very good in a greedy way but you'd better take the second most likely because the next to next token is going to sort of make up for that to make the entire sequence even more likely so more beam size basically means you can keep more hypotheses of the output in memory until the end so if you just do the greedy decoding you see you already get fairly close to these baselines it's very very cool very interesting and if you up the beam size you surpass these baselines now the way they up the beam size here I find to be a bit let's call it a bit cheaty because when they say beam five what they mean is they keep the five hypotheses and then at the end I as I understand it if any of the five hypotheses passes all the unit tests or the most they keep it right so basically they give themselves the freedom to say whichever one of the five we output is the best that's the one we count and of course that's not really a match to the commercial or to the baseline system because it can output one thing now it is maybe a good practical application to give the human that you know you input a function you give the human five options to choose from and it can choose and thereby decide which one the human likes best but it is sort of it is a wonky what I like more is this here the beam 10 top one this is what you would actually do so we could keep 10 hypotheses during decoding and 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 you know give yourself the freedom to output multiple ones of course though they say that most of the errors that this top one makes come from compilation errors when the target language is Java or C++ it suggests that the beam and top one metric could easily be improved we leave this to future work which this again I find valid right so if you if your method is I'm going to keep the top 10 hypothesis until the end and then I'm going from the top and I simply compile them and I output the first one that compiles that that's not cheating right that's a valid thing again yeah so in that way I can I can understand what they're saying right here okay so they give some examples some of which I find very interesting so the first thing here is that oh yeah by the way I've said in the I've said that the tokenizer between the natural languages is shared they make a little tweak here in that they tokenize the different languages with their language respective tokenizers which will still end up tokenizing pretty much you know this the print statement in C++ or in Java no actually the print statement in Python is print and in Java it's println and so on but it will still like the all the if statements it will still tokenize into the same into the same word but it's simply not viable to to parse Python with a C++ parser okay so we have looked at this the results this is one of the results they look at their shared embedding space and this is a t-sneak plot so a 2d projection of this shared embedding space and you can see that this is actually happening so the different so null null and none are mapped to similar locations println and cout are mapped to similar locations in this space so this is exactly what we want this is sort of a verification that this method of embedding the different languages into the same space really turns out such that whatever means the same thing is mapped to the same place you can see here catch and accept two very different tokens are mapped to the same place simply because they're used in the same sort of constructs across the languages very cool one of these examples here is quite impressive and kind of shows the difference between this and and rule-based translation in this function right here you have a C plus plus function that takes a character pointer to that is called str str in as an input now in C++ strings are at least in old versions of C++ strings are handled as character arrays so a string is indistinguishable from a character array and in this case usually what you do is you don't input the array because that will cause a copy you input a pointer to the first to you input a pointer to the array and that would define the string okay so if you translate this again this the type of this is simply character array if you translate this with this transcoder system that they've built into Java in Java there is a type called string right there's a native type called string and is that true I think oh yeah that's and then that's handled really weirdly in the JVM I think yes so there is it at least there is a type called string so it would map that it would recognize are you mean a string therefore I'm going to put a string here and it uses all the string method like string length string character at and so on where in C++ this is just an array and you just have array accesses now they take this same C++ function and only change one thing they change the name of the parameter everything else is the same but now the character array is called our okay and they put it through the same system and that system now outputs a function that takes in a character array called our 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 as a variable name and that usually means that the constructs here are like the constructs in Java where people use strings and I've seen other places where people use you know names like this right here and usually that is used in the same context as in Java people use character arrays right so it in programming it's not only important what the the code actually does but a lot of programming goes via naming of things like other programmers will read your code and by reading stir right here they will sort of assume that this is a string whereas if they read our right here they will assume you're a pirate and you are referring to a character array and they will treat the code the code means something different and these systems right here these neural machine translation systems can actually understand that part because they do statistical inference on code that humans wrote if you change this back to say input then again it goes back to a string and uses all the string functions so that's fairly impressive in my mind and it yeah definitely an advantage over rule-based systems of course the disadvantage over rule-based systems is that in rule-based systems you can almost get on like sometimes you can even guarantee that the code does the same thing here you can't they give some examples of failed translations where so now you get you run into this problem where the min function in Python is overloaded it can either give you the minimum of a sequence or it can give you the minimum of two things now this is translated to Java right here and math dot min is not overloaded in Java it only gives you the minimum of two things and not the minimum of an array and it still outputs that now given enough data probably could learn because these things are all context dependent but this is one of the this is one of the failure cases of these models of course all right so this was this paper I I've 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, "end": 5.24, "text": " Hi there! So the paper we're looking at today can take the code on the left," }, { "start": 5.24, "end": 9.8, "text": " which is written in Python, and can output the code on the right, which is" }, { "start": 9.8, "end": 15.16, "text": " written in C++. Now the point here is that the code on the right does the same" }, { "start": 15.16, "end": 20.16, "text": " thing as the code on the left, so it is implementing the same function. The" }, { "start": 20.16, "end": 25.6, "text": " surprising thing here is that this model that takes the Python as an input has" }, { "start": 25.6, "end": 32.36, "text": " never been explicitly trained to output C++. So this is an unsupervised" }, { "start": 32.36, "end": 37.56, "text": " translation model. And the cool thing about this paper is that by" }, { "start": 37.56, "end": 43.72, "text": " having no target, having no supervised signal at translating source code" }, { "start": 43.72, "end": 48.040000000000006, "text": " languages into one another, it can perform pretty well at the task" }, { "start": 48.040000000000006, "end": 53.760000000000005, "text": " nonetheless. So we're going to look at this paper. It's called" }, { "start": 53.76, "end": 59.32, "text": " Unsupervised Translation of Programming Languages by Marie-Anne Lachaud, Baptiste" }, { "start": 59.32, "end": 67.44, "text": " Rosier, Loïc Chanusso and Jérôme Lomple at Facebook AI Research. As always, if you" }, { "start": 67.44, "end": 73.24, "text": " like content like this, consider sharing it out and leaving a like and also" }, { "start": 73.24, "end": 78.75999999999999, "text": " leaving a comment if you have something to say about it. They say a trans" }, { "start": 78.75999999999999, "end": 82.7, "text": " compiler, also known as a source-to-source translator, is a system" }, { "start": 82.7, "end": 86.8, "text": " that converts source code from a high-level programming language such as" }, { "start": 86.8, "end": 94.32000000000001, "text": " C++ or Python to another. They say trans compilers are primarily used for" }, { "start": 94.32000000000001, "end": 99.64, "text": " interoperability and to port code bases written in an obsolete or deprecated" }, { "start": 99.64, "end": 106.12, "text": " language such as COBOL or Python 2 to a modern one. So for Python 2, you might" }, { "start": 106.12, "end": 112, "text": " know this tool that's called 2-to-3. So 2-to-3 is a tool that ships with the" }, { "start": 112, "end": 117.16, "text": " Python 3 standard library, I believe, that allows you to take Python 2 code" }, { "start": 117.16, "end": 123.32, "text": " and produce Python 3 code. And that is to kind of push people to convert their" }, { "start": 123.32, "end": 129.76, "text": " old code bases of Python 2 to the modern Python 3. Now 2-to-3 is a" }, { "start": 129.76, "end": 136.32, "text": " handwritten program. It has specific rules built in that the programmers know" }, { "start": 136.32, "end": 140.48, "text": " if we modify Python 2 like this, Python 3 gets out. For example, the print" }, { "start": 140.48, "end": 145.84, "text": " statement in Python 2 requires no brackets, so we make a rule that whenever" }, { "start": 145.84, "end": 148.95999999999998, "text": " there's a print statement with no brackets, we'll add the brackets such that" }, { "start": 148.95999999999998, "end": 155, "text": " it's Python 3 compliant. Most of this code will transform the" }, { "start": 155, "end": 160.51999999999998, "text": " source code first into an abstract syntax tree, modify that, apply specific" }, { "start": 160.51999999999998, "end": 166.04, "text": " rules to that, and then output the language from the abstract syntax tree." }, { "start": 166.04, "end": 172.84, "text": " Now the problem here is many-fold. First of all, there can only be so much" }, { "start": 172.84, "end": 178.28, "text": " translation as there are rules. So every one of these rules has to be coded as a" }, { "start": 178.28, "end": 182.79999999999998, "text": " modification to the abstract syntax tree, and every one of these rules is" }, { "start": 182.79999999999998, "end": 188.35999999999999, "text": " handcrafted and therefore needs sort of human ingenuity. Humans need to go and" }, { "start": 188.35999999999999, "end": 195.2, "text": " write these rules of how to transform one language into another. And often" }, { "start": 195.2, "end": 200.11999999999998, "text": " times, even though you can write these rules," }, { "start": 200.11999999999998, "end": 205.35999999999999, "text": " often times whatever comes out is sort of a bit of a cryptic source code, because" }, { "start": 205.35999999999999, "end": 209.6, "text": " you kind of have to make sure that your rules cover all the possible things, and" }, { "start": 209.6, "end": 214.35999999999999, "text": " the source code that comes out is oftentimes very cryptic and a bit hard" }, { "start": 214.35999999999999, "end": 219.2, "text": " to understand, because it's been sort of expanded and formalized to make sure" }, { "start": 219.2, "end": 225.6, "text": " that it still does the same thing as the original source code. Now for Python 2 to" }, { "start": 225.6, "end": 230.11999999999998, "text": " Python 3, this is still easy, right? These languages are extremely similar," }, { "start": 230.11999999999998, "end": 236.39999999999998, "text": " because it's not that big of a step to Python 3, except if you use very low" }, { "start": 236.39999999999998, "end": 242.07999999999998, "text": " level language constructs or language features which have been" }, { "start": 242.07999999999998, "end": 248.07999999999998, "text": " obsoleted with Python 3. On the other hand, if there's something like Cobol, so a" }, { "start": 248.08, "end": 253.44000000000003, "text": " lot of this old banking code or insurance code or government agency code" }, { "start": 253.44000000000003, "end": 257.40000000000003, "text": " whatnot is written in these really old programming languages, and they've been" }, { "start": 257.40000000000003, "end": 262.2, "text": " kept alive by these old-school programmers that are slowly but surely" }, { "start": 262.2, "end": 267.24, "text": " all retiring now, and there are just not many new programmers around that can" }, { "start": 267.24, "end": 270.72, "text": " support these languages, and the languages themselves aren't really" }, { "start": 270.72, "end": 275.32, "text": " updated that much anymore, so you would like to transform Cobalt into something" }, { "start": 275.32, "end": 282.12, "text": " like... I don't want to call Java modern programming language, but it is used in" }, { "start": 282.12, "end": 287.56, "text": " modern times. I'd rather not call it modern per se. Java itself is a beast" }, { "start": 287.56, "end": 294.15999999999997, "text": " that's been sort of supported since forever, but in any case, you would like" }, { "start": 294.15999999999997, "end": 298.6, "text": " to transform something like Cobalt to something like Java, where you have" }, { "start": 298.6, "end": 303.71999999999997, "text": " a lot of programmers that can develop and further develop your code. This is" }, { "start": 303.72, "end": 309.42, "text": " much harder. Cobalt and Java are much more away from each other than are Python 2" }, { "start": 309.42, "end": 314.52000000000004, "text": " and Python 3. So what you would like to do is you would like to have a tool that" }, { "start": 314.52000000000004, "end": 320.6, "text": " is like 2 to 3, but humans... because now if you want a tool like this, you need" }, { "start": 320.6, "end": 325, "text": " someone that's really proficient in Cobalt and Java in order to write a tool" }, { "start": 325, "end": 329.52000000000004, "text": " like this, and you need lots of them, and they need to invest lots of time. What" }, { "start": 329.52, "end": 333.71999999999997, "text": " you would rather like to do is you would like to learn a system that translates" }, { "start": 333.71999999999997, "end": 338.56, "text": " from one language into another, such that the meaning is conserved. And this of" }, { "start": 338.56, "end": 343.68, "text": " course is exactly the domain of natural language machine translation, except it's" }, { "start": 343.68, "end": 349.59999999999997, "text": " source code. So we all know that we've all realized in the last years that" }, { "start": 349.59999999999997, "end": 356.64, "text": " things like Google Translate have become extremely good at translating. So they" }, { "start": 356.64, "end": 361.56, "text": " say right here, although neural models significantly outperform their rule-based" }, { "start": 361.56, "end": 365.96, "text": " counterparts in the context of natural language translation, which is Google" }, { "start": 365.96, "end": 370.91999999999996, "text": " Translate is all learned right now, they say their applications to trans" }, { "start": 370.91999999999996, "end": 375.59999999999997, "text": " compilation have been limited due to the scarcity of parallel data in this domain." }, { "start": 375.59999999999997, "end": 380.88, "text": " So what's the problem with just going and saying, oh, we can build" }, { "start": 380.88, "end": 384.88, "text": " really good neural machine translation models, let's just apply them to source" }, { "start": 384.88, "end": 388.56, "text": " code. The problem is if you build a neural machine translation model, say" }, { "start": 388.56, "end": 394.4, "text": " something that transforms English to German, so you have the word hello and" }, { "start": 394.4, "end": 401.4, "text": " you output hello. You can do it not with just one word, but with entire sentences" }, { "start": 401.4, "end": 406.71999999999997, "text": " and so on. These models, they usually, or in the classical sense, what they need" }, { "start": 406.71999999999997, "end": 411.92, "text": " are parallel corpora, which means that you have documents that are" }, { "start": 411.92, "end": 418.64000000000004, "text": " written in many languages and you can guarantee that they mean the same thing." }, { "start": 418.64000000000004, "end": 424.44, "text": " So this is a supervised signal. One example of this is, let's say press" }, { "start": 424.44, "end": 428.40000000000003, "text": " releases of the United Nations. So the United Nations will make some press" }, { "start": 428.40000000000003, "end": 433.84000000000003, "text": " release and they will then have professional translators translate that" }, { "start": 433.84000000000003, "end": 439.18, "text": " press release into all of the different or into many different languages. And so" }, { "start": 439.18, "end": 443.32, "text": " you can pretty much guarantee that these mean the same thing. So these pairs of" }, { "start": 443.32, "end": 449.08, "text": " documents or triplets or whatnot, they are supervised training data for a" }, { "start": 449.08, "end": 453.04, "text": " machine translation model that translates from one language into the" }, { "start": 453.04, "end": 458.28000000000003, "text": " other. And the neural machine translation models rely heavily on these parallel" }, { "start": 458.28000000000003, "end": 464.4, "text": " corpora. For source code, you just don't have that as much. You don't have big" }, { "start": 464.4, "end": 470.88, "text": " code bases in great numbers where the exact same thing is implemented in one" }, { "start": 470.88, "end": 474.79999999999995, "text": " language and in the other language. There's just not that much data" }, { "start": 474.79999999999995, "end": 482.03999999999996, "text": " available. It is the case that sometimes, sorry, that sometimes, let's say in the" }, { "start": 482.03999999999996, "end": 489.15999999999997, "text": " case of Torch, it started as Lua and then it went to PyTorch and the developers" }, { "start": 489.16, "end": 496.12, "text": " had to translate the code from Torch to Python. But in the same in the same step," }, { "start": 496.12, "end": 500.12, "text": " they've also made improvements. They sort of re-engineered and reinvented the" }, { "start": 500.12, "end": 504.56, "text": " framework and made it better. And so you can't really say these are the same" }, { "start": 504.56, "end": 510.08000000000004, "text": " things. And likewise, there's not a lot of code available where the same thing is" }, { "start": 510.08000000000004, "end": 515.28, "text": " implemented in two languages. So we just don't have these parallel corpora for" }, { "start": 515.28, "end": 521.24, "text": " the source code translation. So rather what this paper does is this paper goes" }, { "start": 521.24, "end": 526.48, "text": " into unsupervised machine translation. Now what does unsupervised machine" }, { "start": 526.48, "end": 532, "text": " translation mean? Unsupervised machine translation, you imagine I have just a" }, { "start": 532, "end": 538.92, "text": " big database of documents. And these documents, I know they're all in" }, { "start": 538.92, "end": 545.1999999999999, "text": " English. And I have this other big database and I know that they are all" }, { "start": 545.2, "end": 549.9200000000001, "text": " in German. I just know their documents are in German. But they don't correspond" }, { "start": 549.9200000000001, "end": 553.48, "text": " to each other. They're just German documents. And over here, they're just" }, { "start": 553.48, "end": 558.4000000000001, "text": " English documents. They don't, I don't say that these two here are somehow the" }, { "start": 558.4000000000001, "end": 562.6400000000001, "text": " same. No, I just have a bunch of German, a bunch of English. They don't even have" }, { "start": 562.6400000000001, "end": 567.44, "text": " to correspond. They're just text. And now what I want to do is I want to learn a" }, { "start": 567.44, "end": 574.96, "text": " shared embedding space. I sort of want to learn a shared space of embeddings" }, { "start": 574.96, "end": 580.24, "text": " for these two languages, such that similar things are mapped to the similar" }, { "start": 580.24, "end": 584.4000000000001, "text": " place. So if these two documents just happen to talk about the same thing, I" }, { "start": 584.4000000000001, "end": 590.6800000000001, "text": " want them to be mapped to similar spaces in this shared embedding space. So I'm" }, { "start": 590.6800000000001, "end": 597.02, "text": " gonna have one model, a single model, where I input the text and it goes into" }, { "start": 597.02, "end": 601.84, "text": " this shared embedding space. Okay, now this is unusual because usually in" }, { "start": 601.84, "end": 607.8000000000001, "text": " machine translation, if you translate from here from English to German, then" }, { "start": 607.8000000000001, "end": 612.84, "text": " you'll have your dedicated model that takes as English as an input and German" }, { "start": 612.84, "end": 617.6, "text": " as an output. And that would be a different model than one that takes even" }, { "start": 617.6, "end": 621.5600000000001, "text": " German as an input and English as an output or French as an input and German" }, { "start": 621.5600000000001, "end": 627.6, "text": " as an output. In this case, we have this process right here and this process" }, { "start": 627.6, "end": 633.76, "text": " right here is the same model. And then the decoder that translates this, of" }, { "start": 633.76, "end": 637.32, "text": " course, now we have the encoder embedding, and then the decoder that actually" }, { "start": 637.32, "end": 642.4, "text": " translates to a language is also going to be the same model. So it's the same" }, { "start": 642.4, "end": 648.48, "text": " model that translates to English, then it translates to German. So first of all, how" }, { "start": 648.48, "end": 652.96, "text": " do we make the same model? Let's say we have the perfect encoder, right?" }, { "start": 652.96, "end": 656.82, "text": " This is E, the encoder, the same encoder for all languages. Let's say we have the" }, { "start": 656.82, "end": 662.2, "text": " perfect encoder and it can map the... whenever a sentence means the same thing" }, { "start": 662.2, "end": 665.4000000000001, "text": " in different languages, we can completely map it to the same point in" }, { "start": 665.4000000000001, "end": 670.44, "text": " embedding space, irrespective of the language it comes from. Now, how do we tell" }, { "start": 670.44, "end": 676.24, "text": " the decoder, which is also the same model, like how does it know what to do? This is" }, { "start": 676.24, "end": 682.1600000000001, "text": " a little trick where you basically take this embedding, so you take the input," }, { "start": 682.1600000000001, "end": 686.5600000000001, "text": " you put it into your model, I don't even know how you do this, and then you're" }, { "start": 686.56, "end": 690.92, "text": " output is going to be autoregressive, right? So you decode one token at a time." }, { "start": 690.92, "end": 696.8399999999999, "text": " So you decode this token and then you feed it back into the model, and then you" }, { "start": 696.8399999999999, "end": 700.4799999999999, "text": " decode this token, you feed that back into the model, and so on. This is an" }, { "start": 700.4799999999999, "end": 705.1999999999999, "text": " autoregressive language model. And the trick here is that the very" }, { "start": 705.1999999999999, "end": 708.8399999999999, "text": " first token is a special token that describes the language you want to" }, { "start": 708.8399999999999, "end": 714.2399999999999, "text": " output. So here you say, I want German, and then you let the model decode its" }, { "start": 714.24, "end": 719.4, "text": " thing. And by conditioning on this token right here, it knows it should" }, { "start": 719.4, "end": 726.12, "text": " now produce German. During training, you will simply put the token here," }, { "start": 726.12, "end": 730.64, "text": " and if it produces something other than German, that's a loss, right? So it will" }, { "start": 730.64, "end": 736.24, "text": " learn to produce German after you produce this tag. Alright, so what we need" }, { "start": 736.24, "end": 743.6, "text": " is an encoder and a decoder, such that in the encoder we can put in any language" }, { "start": 743.6, "end": 750.44, "text": " text, and it will map to the same space the things that mean the same things, and" }, { "start": 750.44, "end": 757.5600000000001, "text": " we need a decoder that can produce any language given this first thing." }, { "start": 757.5600000000001, "end": 761.32, "text": " Now the decoder should be fairly easy, right? If we have a shared vocabulary" }, { "start": 761.32, "end": 768.96, "text": " between the languages, and we always put this token, the decoder is not a" }, { "start": 768.96, "end": 773.12, "text": " problem. You can just learn the decoder in a straightforward way, but the encoder" }, { "start": 773.12, "end": 779.2, "text": " is going to be a problem. So how does the encoder map the different languages to" }, { "start": 779.2, "end": 784.76, "text": " the same space, such that the same things are ending up in the same place? It seems" }, { "start": 784.76, "end": 791.2, "text": " a bit counterintuitive, right? Because it doesn't know which things" }, { "start": 791.2, "end": 795.36, "text": " correspond to which things. Now the first thing you need is a shared vocabulary" }, { "start": 795.36, "end": 800.12, "text": " here. Since we are in a shared space right here, what you need is a" }, { "start": 800.12, "end": 807.5600000000001, "text": " shared vocabulary. So you tokenize all of the text with a shared vocabulary. And" }, { "start": 807.5600000000001, "end": 812.48, "text": " this vocabulary is going to consist of sort of word pieces. Now if you don't" }, { "start": 812.48, "end": 817.72, "text": " know what word pieces are, in a word piece tokenization what you would" }, { "start": 817.72, "end": 822.48, "text": " do is you would split words into so-called word pieces. So for example" }, { "start": 822.48, "end": 828.36, "text": " hello right here might be split into two word pieces. The first word piece might" }, { "start": 828.36, "end": 835.64, "text": " be he, and the second word piece might be LLO. There is usually some kind of" }, { "start": 835.64, "end": 840.08, "text": " indicator here that this is the end of a word and so on, but we'll simplify. And" }, { "start": 840.08, "end": 846.8000000000001, "text": " hello right here would be a HA for the first token and then LLO for the second" }, { "start": 846.8000000000001, "end": 850.96, "text": " token. And these kind of word piece encodings, since the smallest units are" }, { "start": 850.96, "end": 855.96, "text": " going to be the characters themselves, they ensure that you always have" }, { "start": 855.96, "end": 860.64, "text": " everything is in vocabulary. You have no out-of-vocabulary tokens. But here you" }, { "start": 860.64, "end": 867.36, "text": " can already see that if we tokenize the languages like this and then we use the" }, { "start": 867.36, "end": 873.84, "text": " same encoder, so the same encoder will pop them into this shared space, that" }, { "start": 873.84, "end": 881.08, "text": " means that to the model this and this looks like the same thing. It is the same" }, { "start": 881.08, "end": 886.72, "text": " thing, right? It's the same input token in different languages. Now as you can see" }, { "start": 886.72, "end": 892, "text": " this comes from the same word, the LLO at the end in English and the LLO at the" }, { "start": 892, "end": 898.5200000000001, "text": " end in German. It comes from the same word. So you know it's fair to assume" }, { "start": 898.5200000000001, "end": 903.8000000000001, "text": " that since it's the same input it's going to be mapped into a same embedding" }, { "start": 903.8000000000001, "end": 908.24, "text": " space right here. Or since these things are usually context-dependent we can say" }, { "start": 908.24, "end": 916.28, "text": " in a similar embedding space or a close embedding space, but certainly the" }, { "start": 916.28, "end": 922.2, "text": " initial vectors are the same. That is already half the task, right? So by" }, { "start": 922.2, "end": 929.44, "text": " tokenizing in this way we have already mapped part of our languages, even though" }, { "start": 929.44, "end": 933.4, "text": " they're just the different languages, we have mapped the same word to the same" }, { "start": 933.4, "end": 938.68, "text": " space. And this relies on the fact that in this case for example English and" }, { "start": 938.68, "end": 944.68, "text": " German and for example French they have significant overlap in their words" }, { "start": 944.68, "end": 950.4399999999999, "text": " as such. So the word hello and the word hollow, they are almost the same" }, { "start": 950.4399999999999, "end": 956.88, "text": " word as letters, as word pieces. And these shared embedding techniques abuse" }, { "start": 956.88, "end": 961.84, "text": " sort of the fact that these languages are close. They'll say there will be" }, { "start": 961.84, "end": 966.1600000000001, "text": " some word pieces that are going to be the same in these languages and" }, { "start": 966.1600000000001, "end": 969.8000000000001, "text": " naturally because they're the same they'll end up in the same place in" }, { "start": 969.8000000000001, "end": 976.2, "text": " embedding space. And because that now you have the... so what these" }, { "start": 976.2, "end": 981.32, "text": " embedding techniques do is they simply figure out the statistical relations" }, { "start": 981.32, "end": 986.76, "text": " between the word pieces. So if two things appear together often in the same" }, { "start": 986.76, "end": 992.2, "text": " context they'll be mapped into the same space as well. So it would realize there" }, { "start": 992.2, "end": 998.56, "text": " is a lot of times where ha and he appear in front of this low thing. So I should" }, { "start": 998.56, "end": 1004.28, "text": " probably map the ha and the he to the same location in embedding space. So the" }, { "start": 1004.28, "end": 1009.16, "text": " same relation to the low. So they would end up at the same place. So now you see" }, { "start": 1009.16, "end": 1013.72, "text": " even though these word pieces are different, like they get different" }, { "start": 1013.72, "end": 1018.6800000000001, "text": " IDs, they'll be mapped to the same place in embedding space because their" }, { "start": 1018.6800000000001, "end": 1024.08, "text": " relation to the low is the same and the low themselves are being mapped to the" }, { "start": 1024.08, "end": 1029.28, "text": " same place because they are actually the same. So you can see that this" }, { "start": 1029.28, "end": 1035.56, "text": " partial overlap between word pieces in the different languages combined with" }, { "start": 1035.56, "end": 1042.88, "text": " the shared embedding pre-training results in these token across the" }, { "start": 1042.88, "end": 1049.5200000000002, "text": " languages results in an alignment of the embeddings. So naturally the things that" }, { "start": 1049.5200000000002, "end": 1053.88, "text": " mean the same things are going to be in the same places in embedding space, either" }, { "start": 1053.88, "end": 1059.1200000000001, "text": " because they are the same or because their statistical relation to the things" }, { "start": 1059.1200000000001, "end": 1065.3200000000002, "text": " that are the same is the same. It is sort of like these ha and the he are" }, { "start": 1065.3200000000002, "end": 1070.44, "text": " like synonyms in this shared language. So if you jumble all the English and" }, { "start": 1070.44, "end": 1075.2, "text": " German text together, the model thinks ha and he are synonyms and therefore" }, { "start": 1075.2, "end": 1079.72, "text": " maps it to the same space. This happens exactly the same in if you only have one" }, { "start": 1079.72, "end": 1085.48, "text": " language, two true synonyms. So this would exactly be the same thing in" }, { "start": 1085.48, "end": 1091.8400000000001, "text": " this case. Alright, so now we have different languages. We have a single" }, { "start": 1091.8400000000001, "end": 1097.04, "text": " encoder where we can input any of those languages mapping it to the shared space." }, { "start": 1097.04, "end": 1102.76, "text": " The decoder can be trained by simply giving it this indicator token right" }, { "start": 1102.76, "end": 1108.2, "text": " here to decode the appropriate language. So now the question is how exactly do we" }, { "start": 1108.2, "end": 1114.48, "text": " train this such that this happens? There's one caveat in" }, { "start": 1114.48, "end": 1119.8799999999999, "text": " programming languages of course we still have to check whether that's the same or" }, { "start": 1119.8799999999999, "end": 1123.6, "text": " not and we know that in programming languages a lot of programming languages" }, { "start": 1123.6, "end": 1129.6, "text": " for example the word if is the same right so if you tokenize Java or Python" }, { "start": 1129.6, "end": 1136.56, "text": " or C++ the word if is the same and likewise there is a lot of overlap" }, { "start": 1136.56, "end": 1141.04, "text": " between the different programming languages and that exactly is this" }, { "start": 1141.04, "end": 1147.36, "text": " correspondence to here. These models use the parts that are overlapping either" }, { "start": 1147.36, "end": 1152.84, "text": " tokens themselves or this can also be grammatical constructs and so on they" }, { "start": 1152.84, "end": 1157.1999999999998, "text": " can also be overlapping and therefore map to the same space so if a construct" }, { "start": 1157.1999999999998, "end": 1161.76, "text": " is used in the same way this can be in higher layers this can induce the same" }, { "start": 1161.76, "end": 1167.24, "text": " effect and they'll use that to map the and sorry they'll use that the result" }, { "start": 1167.24, "end": 1171.8, "text": " will be that the similar things in the same in these languages will be" }, { "start": 1171.8, "end": 1175.84, "text": " mapped to the similar spaces in embedding space. Now this makes this" }, { "start": 1175.84, "end": 1180.28, "text": " example a bit weaker because that means this method would work exceptionally" }, { "start": 1180.28, "end": 1184.28, "text": " well for something like Python 2 to Python 3 because they of course have" }, { "start": 1184.28, "end": 1190.12, "text": " like a lot of overlap of syntax and keywords and constructs whereas" }, { "start": 1190.12, "end": 1195.72, "text": " something like cobalt to Java it's more let's say doubtable that they will" }, { "start": 1195.72, "end": 1202.12, "text": " work so well. In this paper here they've chosen C++ Python and Java which" }, { "start": 1202.12, "end": 1207.08, "text": " do have significant overlap but especially something like Python to Java" }, { "start": 1207.08, "end": 1212.48, "text": " of course there is a lot of a difference or Python to C++ as well" }, { "start": 1212.48, "end": 1218.6799999999998, "text": " Python is not typed and so you can see a bit of the difficulty is already in the" }, { "start": 1218.6799999999998, "end": 1223.76, "text": " paper here but you have to be aware that this works less and less the less this" }, { "start": 1223.76, "end": 1230.36, "text": " shared overlap is given. Alright so how do you train these models and remember" }, { "start": 1230.36, "end": 1236.72, "text": " we don't have parallel corpora we are simply reliant on having databases from" }, { "start": 1236.72, "end": 1243.4, "text": " having big repositories of Python code C++ code and Java code and they don't" }, { "start": 1243.4, "end": 1247.6000000000001, "text": " correspond to each other so the first thing you do and as I understand it you" }, { "start": 1247.6000000000001, "end": 1250.72, "text": " can do these things in parallel but there are three different objectives" }, { "start": 1250.72, "end": 1256.24, "text": " that achieve three different things in these models. The first objective is the" }, { "start": 1256.24, "end": 1260.6000000000001, "text": " cross-lingual masked language pre-training. Now the models here are" }, { "start": 1260.6000000000001, "end": 1265.76, "text": " going to be transformer models with encoders and decoders and that's comes" }, { "start": 1265.76, "end": 1269.84, "text": " from the attention is all you need papers and various other papers like" }, { "start": 1269.84, "end": 1275.76, "text": " this I've done videos on those if you want to see that. This masked language" }, { "start": 1275.76, "end": 1280.68, "text": " model pre-training however is from the BERT paper so BERT if you don't know" }, { "start": 1280.68, "end": 1286.28, "text": " what that is I've also done a video on that. This simply trains the encoder so" }, { "start": 1286.28, "end": 1292.12, "text": " this is to train the encoder. What you would do is you would input code so" }, { "start": 1292.12, "end": 1296.9199999999998, "text": " usually in masked language model if you train the encoder you input code with" }, { "start": 1296.9199999999998, "end": 1308.9199999999998, "text": " tokens like hello there you would then so this is your input you would then mask" }, { "start": 1308.9199999999998, "end": 1315.7199999999998, "text": " some of the tokens for example here the low and maybe the entire word there you" }, { "start": 1315.7199999999998, "end": 1320.32, "text": " would scrap that you would put it through your encoder which is this" }, { "start": 1320.32, "end": 1326.6399999999999, "text": " transformer model like BERT and then BERT is supposed to reconstruct hello" }, { "start": 1326.6399999999999, "end": 1333.24, "text": " there. BERT is supposed to reconstruct these two tokens like it doesn't see" }, { "start": 1333.24, "end": 1338.8, "text": " them and you ask it what did I cross out and it needs to reconstruct that so you" }, { "start": 1338.8, "end": 1345.1599999999999, "text": " train the model to reconstruct these masked tokens and the research on BERT" }, { "start": 1345.1599999999999, "end": 1349.72, "text": " and other things has shown that if you train with this objective the encoder" }, { "start": 1349.72, "end": 1355.92, "text": " sort of learns about the structure of code it learns about it learns which" }, { "start": 1355.92, "end": 1360.64, "text": " tokens and which constructs often appear together and therefore it learns" }, { "start": 1360.64, "end": 1366, "text": " something about the structure of the input and that means it can create" }, { "start": 1366, "end": 1371.6000000000001, "text": " whatever is up here is a good and meaningful embedding for these things" }, { "start": 1371.6000000000001, "end": 1377.1200000000001, "text": " that tells you something about the statistical coexistence of tokens and of" }, { "start": 1377.12, "end": 1382.4799999999998, "text": " course since we're doing this with all the languages so the Python goes in here" }, { "start": 1382.4799999999998, "end": 1387.36, "text": " C++ goes in here without telling the model what it is you just throw it in" }, { "start": 1387.36, "end": 1393.9199999999998, "text": " there right Java goes in there by tokenizing it and you see an example" }, { "start": 1393.9199999999998, "end": 1401.12, "text": " right here so if this right here is C++ but in Python this would also be if and" }, { "start": 1401.12, "end": 1407.08, "text": " since it needs to learn a single encoder for all of these languages and since the" }, { "start": 1407.08, "end": 1412.28, "text": " tokens overlap partially it is going to result in exactly what we want namely a" }, { "start": 1412.28, "end": 1416.6399999999999, "text": " shared embedding space where even though the input comes from different" }, { "start": 1416.6399999999999, "end": 1421.28, "text": " languages it is mapped similar things are mapped to similar places in the" }, { "start": 1421.28, "end": 1426.1599999999999, "text": " embedding space right so the mask language model pre training very quickly" }, { "start": 1426.1599999999999, "end": 1431.9199999999998, "text": " as you take a piece of code like here on the left you mask out some of the tokens" }, { "start": 1431.92, "end": 1437.44, "text": " here you can see them in this mask and you simply ask the model the encoder to" }, { "start": 1437.44, "end": 1443.52, "text": " reconstruct those things okay so this is just for the encoder as far as I" }, { "start": 1443.52, "end": 1447.44, "text": " understand it the encoder doesn't it doesn't see the thing back here it" }, { "start": 1447.44, "end": 1454.24, "text": " simply sees this and you tell it please reconstruct please tell me which words" }, { "start": 1454.24, "end": 1460.4, "text": " or which tokens I I clipped out here and it's supposed to tell you okay the first" }, { "start": 1460.4, "end": 1466.6000000000001, "text": " one is if the second one is int and the third one is the I now if you consider" }, { "start": 1466.6000000000001, "end": 1471.8000000000002, "text": " what the encoder has to do here so if you were to see this then that pretty" }, { "start": 1471.8000000000002, "end": 1477.5600000000002, "text": " clearly you know you could you could guess that that is an if of course it's" }, { "start": 1477.5600000000002, "end": 1482.0400000000002, "text": " not a hundred percent but this is just pre training right so you train it to" }, { "start": 1482.0400000000002, "end": 1486, "text": " output if here now here you have to do a little bit more inference maybe you've" }, { "start": 1486, "end": 1491.04, "text": " seen this for construct a bunch of times and you can see that this is compared" }, { "start": 1491.04, "end": 1496.28, "text": " here and this is added so probably it's an integer and then in the last thing" }, { "start": 1496.28, "end": 1500.12, "text": " this is even more complicated if you don't see that the eye is here you" }, { "start": 1500.12, "end": 1505.32, "text": " somehow have to guess that what it is it's not clear right but you can guess" }, { "start": 1505.32, "end": 1509.94, "text": " that okay there's a local variable I right here and probably it's going to be" }, { "start": 1509.94, "end": 1516.24, "text": " used somewhere in this block now this here isn't I and I don't see I anywhere" }, { "start": 1516.24, "end": 1520.3200000000002, "text": " else so probably I goes in here which makes sense because it's an integer and" }, { "start": 1520.3200000000002, "end": 1527.2, "text": " prime is an array and and it integers index arrays so on okay so this is what" }, { "start": 1527.2, "end": 1531.92, "text": " the model does first the second thing is we need to train the decoder somehow" }, { "start": 1531.92, "end": 1536.88, "text": " how do we train the decoder in a very similar way we make the decoder do" }, { "start": 1536.88, "end": 1543.8000000000002, "text": " denoising auto encoding now before we just had single tokens we just asked the" }, { "start": 1543.8000000000002, "end": 1551.64, "text": " encoder to reconstruct tokens so the encoder is this box right here this" }, { "start": 1551.64, "end": 1556.96, "text": " colors this box is the encoder and the actual part that's going to predict" }, { "start": 1556.96, "end": 1563.1200000000001, "text": " these words is going to be one sort of one classification layer on top that is" }, { "start": 1563.12, "end": 1568.8, "text": " going to predict for each position the individual word now did this is just for" }, { "start": 1568.8, "end": 1573.28, "text": " pre-training after the pre-training you scrap that and you attach it to a" }, { "start": 1573.28, "end": 1580, "text": " decoder so you attach whatever you got out of the encoder to a decoder and the" }, { "start": 1580, "end": 1586.4799999999998, "text": " decoder will output in an autoregressive way one token after another I did I put" }, { "start": 1586.4799999999998, "end": 1591.4799999999998, "text": " a it output a token right here and it feed that token back into the decoder" }, { "start": 1591.48, "end": 1595.72, "text": " saying okay here's what I've produced now produce the next thing you produce" }, { "start": 1595.72, "end": 1603.24, "text": " the next token and so on so it would produce token after token the output and" }, { "start": 1603.24, "end": 1607.56, "text": " now as I said I'm not exactly sure I think they're doing all of these things" }, { "start": 1607.56, "end": 1612.52, "text": " at the same time so this would still be here but the information would just be" }, { "start": 1612.52, "end": 1617.32, "text": " routed in two different ways or maybe they do it one after another it doesn't" }, { "start": 1617.32, "end": 1623.04, "text": " really matter but what matters is in this thing here you now train the decoder" }, { "start": 1623.04, "end": 1628.4399999999998, "text": " I mean you train it jointly with the encoder but you also involve the decoder" }, { "start": 1628.4399999999998, "end": 1635.12, "text": " and you do this by doing something very similar you corrupt a piece of code and" }, { "start": 1635.12, "end": 1641.12, "text": " you get corrupted code now you can see part of this corruption is masking like" }, { "start": 1641.12, "end": 1645.6, "text": " you did before but also part of the corruption is like here you scramble" }, { "start": 1645.6, "end": 1650.8, "text": " some of the tokens right this was it was this over here you just jumble some of" }, { "start": 1650.8, "end": 1656, "text": " them around a bit and then you here you also drop a token as you can see that" }, { "start": 1656, "end": 1661.6, "text": " the one is dropped and you simply so you don't show this to the encoder or the" }, { "start": 1661.6, "end": 1667.48, "text": " decoder you input this corrupted code into the decode into the first the" }, { "start": 1667.48, "end": 1674.6399999999999, "text": " encoder and then you ask the decoder to give you back the original code without" }, { "start": 1674.64, "end": 1679.44, "text": " showing it the original code so the the task for the decoder for the encoder" }, { "start": 1679.44, "end": 1684.2800000000002, "text": " decoder for the entire model here is if you're if you see this here is corrupt" }, { "start": 1684.2800000000002, "end": 1691.2800000000002, "text": " the code I have corrupted it in various ways please tell me what I originally" }, { "start": 1691.2800000000002, "end": 1698.96, "text": " had now it can the masking it does the same as before it sort of infers it this" }, { "start": 1698.96, "end": 1705.64, "text": " thing here it says well probably I probably this isn't really correct you" }, { "start": 1705.64, "end": 1709.08, "text": " don't even tell it where the errors are right before with the masking you at" }, { "start": 1709.08, "end": 1712.8400000000001, "text": " least told it where the errors are now you don't even tell it where the where" }, { "start": 1712.8400000000001, "end": 1717.08, "text": " the errors are so it needs to recognize this here is probably correct this isn't" }, { "start": 1717.08, "end": 1723.48, "text": " this I'm gonna rewrite this to that okay and it does this one token at a time so" }, { "start": 1723.48, "end": 1729.32, "text": " it first goes into the dirt and it needs to output the correct thing this is I" }, { "start": 1729.32, "end": 1733.92, "text": " hope the difference is clear to the masked language modeling which involved" }, { "start": 1733.92, "end": 1740.48, "text": " the involved the decoder and here also is the first time where in the encoder" }, { "start": 1740.48, "end": 1745.98, "text": " you you prepend this Java token now this as you can see it still goes from the" }, { "start": 1745.98, "end": 1750.48, "text": " same language to the same language but this is where you train the decoder to" }, { "start": 1750.48, "end": 1757.52, "text": " output a given language so here with the token again this is the same decoder for" }, { "start": 1757.52, "end": 1761.52, "text": " all the three languages the only difference here is every time you simply" }, { "start": 1761.52, "end": 1765.96, "text": " provided with the special token at the beginning to tell it which language it" }, { "start": 1765.96, "end": 1772.6, "text": " should decode right now so this this now we have an encoder that maps all the" }, { "start": 1772.6, "end": 1776.52, "text": " languages to a shared space and we have a decoder that conditioned on a token" }, { "start": 1776.52, "end": 1783.48, "text": " like this can output a valid code in that thing assuming this here was" }, { "start": 1783.48, "end": 1790, "text": " corrupted code now since the encoder is shared it should map the same kind of" }, { "start": 1790, "end": 1793.6, "text": " corrupted code of the different languages to the same place in the" }, { "start": 1793.6, "end": 1798, "text": " embedding space and therefore this would also this would already be enough to" }, { "start": 1798, "end": 1803.2, "text": " have this model that we desire we can input some code it doesn't actually have" }, { "start": 1803.2, "end": 1807.16, "text": " to be corrupted right we can just input some code in one language and ask the" }, { "start": 1807.16, "end": 1812.1200000000001, "text": " decoder to output the other language and this works but it doesn't work super" }, { "start": 1812.1200000000001, "end": 1817.68, "text": " well and here the authors go for another idea from the unsupervised machine" }, { "start": 1817.68, "end": 1822.48, "text": " translation literature which is back translation so back translation is a" }, { "start": 1822.48, "end": 1827.98, "text": " technique where you can tune an unsupervised machine translation model" }, { "start": 1827.98, "end": 1832.8, "text": " in a way that you would tune a supervised one but of course you don't" }, { "start": 1832.8, "end": 1838.6399999999999, "text": " have supervised data so what's the plan you will produce the data yourself using" }, { "start": 1838.6399999999999, "end": 1843.24, "text": " your own model so the plan is pretty simple it's actually contained in the" }, { "start": 1843.24, "end": 1848.6399999999999, "text": " back translation name so if you have a piece of code what you would do is you" }, { "start": 1848.6399999999999, "end": 1853.8799999999999, "text": " would first use your model to translate this to another language any of your" }, { "start": 1853.8799999999999, "end": 1858.6399999999999, "text": " choice now you have no clue whether this thing here is correct or not you have no" }, { "start": 1858.6399999999999, "end": 1861.96, "text": " clue and you have no way of assessing it because you don't have ground truth" }, { "start": 1861.96, "end": 1867.64, "text": " what you can do is use your model again or actually use a second model that you" }, { "start": 1867.64, "end": 1873.16, "text": " train in parallel now I believe in this case they could use the same model but" }, { "start": 1873.16, "end": 1878.72, "text": " you can that could be instable and so on but in any case you can use your system" }, { "start": 1878.72, "end": 1884.04, "text": " again to translate it back to your original language your system can do" }, { "start": 1884.04, "end": 1889.3600000000001, "text": " that right and here whatever you get as an output you know the ground truth it's" }, { "start": 1889.36, "end": 1893.7199999999998, "text": " whatever you started with so now you can compare what comes out to what you" }, { "start": 1893.7199999999998, "end": 1898.36, "text": " started with the difficulty of course is if there is a mistake you don't know" }, { "start": 1898.36, "end": 1906.6399999999999, "text": " which of the two models made a mistake and you so it could be could be that" }, { "start": 1906.6399999999999, "end": 1910.76, "text": " your original translation model made a mistake and or it could be that your" }, { "start": 1910.76, "end": 1917.12, "text": " back translation model made a mistake and you have to find a loss function that" }, { "start": 1917.12, "end": 1924.04, "text": " kind of punishes both equally or you simply keep one sort of constant and" }, { "start": 1924.04, "end": 1929.28, "text": " loss free and train the other one because there there's going to be a" }, { "start": 1929.28, "end": 1932.9599999999998, "text": " sample where you have C++ as an input and then the intermediate language is" }, { "start": 1932.9599999999998, "end": 1938.8799999999999, "text": " Python so all of the models sort of get trained once as an as a source to target" }, { "start": 1938.8799999999999, "end": 1944, "text": " translator and once as a target to source translator but I hope the the" }, { "start": 1944, "end": 1947.68, "text": " objective is clear from the back translation so now with the back" }, { "start": 1947.68, "end": 1954.8, "text": " translation you actually you train the models to go from one language to" }, { "start": 1954.8, "end": 1959.92, "text": " another language okay and that's the that's the final goal even though you do" }, { "start": 1959.92, "end": 1966.28, "text": " it without supervised data you now have a model that can encode things into a" }, { "start": 1966.28, "end": 1970.28, "text": " shared space that can decode into a language and that is attuned to" }, { "start": 1970.28, "end": 1978.2, "text": " translating from one language to another language so that's that's it how this is" }, { "start": 1978.2, "end": 1984.24, "text": " all how does this work now for evaluation the question is of course how" }, { "start": 1984.24, "end": 1989.3999999999999, "text": " do you evaluate models like this for evaluation they go to this website" }, { "start": 1989.3999999999999, "end": 1997.6399999999999, "text": " called geeks for geeks and this is a an online platform with computer science" }, { "start": 1997.64, "end": 2002.5200000000002, "text": " and programming articles it gathers many coding problems and presents solution in" }, { "start": 2002.5200000000002, "end": 2007.48, "text": " several programming languages okay so this is a website that teaches you to" }, { "start": 2007.48, "end": 2012.68, "text": " code and it will have like an exercise please do this and then it will provide" }, { "start": 2012.68, "end": 2017.6200000000001, "text": " solutions in the different languages now why is that cool and they have an" }, { "start": 2017.6200000000001, "end": 2025.5200000000002, "text": " example they have an example right here why is that cool because not only can" }, { "start": 2025.52, "end": 2031.36, "text": " you be relatively sure that these different functions that you have here" }, { "start": 2031.36, "end": 2036.24, "text": " do the same thing but you can also relatively be relatively sure that they" }, { "start": 2036.24, "end": 2041.4, "text": " are implemented in the similar way right because you what this website is trying" }, { "start": 2041.4, "end": 2048.6, "text": " to do is it's trying to teach the people how to how to code up an algorithm that" }, { "start": 2048.6, "end": 2051.84, "text": " they think up in their head and therefore not only is the solution" }, { "start": 2051.84, "end": 2056.4, "text": " correct and the same it is implemented in the in the same way as you can see" }, { "start": 2056.4, "end": 2061, "text": " here the construct there's this if construct is everywhere the else if is" }, { "start": 2061, "end": 2066.36, "text": " everywhere so even though some of the languages might have specialty things" }, { "start": 2066.36, "end": 2071.96, "text": " for implementing some algorithms these are really the same algorithmic the same" }, { "start": 2071.96, "end": 2076.32, "text": " expression of algorithmic thought in the different languages so that is a perfect" }, { "start": 2076.32, "end": 2081.08, "text": " parallel data set the problem of course is that there is not that many so it is" }, { "start": 2081.08, "end": 2087.16, "text": " good enough as a test set it is not good enough as a training set but given that" }, { "start": 2087.16, "end": 2092.96, "text": " it's a test set you can just have these as test set and then you can input the" }, { "start": 2092.96, "end": 2098.2, "text": " C++ and see whether or not the Java comes out the problem here of course is" }, { "start": 2098.2, "end": 2103.44, "text": " that even though this is very clear there are still you know sort of many" }, { "start": 2103.44, "end": 2107.92, "text": " variations of how you can implement that to even express the same algorithmic" }, { "start": 2107.92, "end": 2114.2000000000003, "text": " thought so metrics from natural language processing like blue just aren't going" }, { "start": 2114.2000000000003, "end": 2118.16, "text": " to be very good because they look at n-gram overlap and you can write this" }, { "start": 2118.16, "end": 2124.76, "text": " function with very different n-grams and still be very very valid and correct and" }, { "start": 2124.76, "end": 2130.36, "text": " also exact match is not going to be really the the gold standard here so" }, { "start": 2130.36, "end": 2135.16, "text": " what they do is they create a set of unit tests where for each of these" }, { "start": 2135.16, "end": 2141.52, "text": " functions they go they check their input types they randomly generate input" }, { "start": 2141.52, "end": 2147.7999999999997, "text": " randomly generate a set of inputs look whatever comes out and if the same thing" }, { "start": 2147.7999999999997, "end": 2153.3199999999997, "text": " comes out in all of their test functions that they consider this a good unit test" }, { "start": 2153.3199999999997, "end": 2158.3199999999997, "text": " for that function so whenever you your model now produces let's say you input" }, { "start": 2158.3199999999997, "end": 2164, "text": " Python it produces a C++ you simply put these unit tests through the C++" }, { "start": 2164, "end": 2169.16, "text": " function you produce and if they produce the same output as the Python the" }, { "start": 2169.16, "end": 2175, "text": " original Python function when on the same inputs then you consider the unit" }, { "start": 2175, "end": 2180.96, "text": " test to succeed and you consider the function to be correct that this of" }, { "start": 2180.96, "end": 2186.44, "text": " course this isn't this isn't the super duper gold standard especially with" }, { "start": 2186.44, "end": 2191.8, "text": " random inputs because usually what you want to do is test sort of corner cases" }, { "start": 2191.8, "end": 2197.36, "text": " but it's better than anything else so far I've been a long" }, { "start": 2197.36, "end": 2202, "text": " dis-advocate of unit tests honestly because I think whenever a human writes" }, { "start": 2202, "end": 2207.5600000000004, "text": " a unit test then they're probably since they have already implemented the" }, { "start": 2207.5600000000004, "end": 2212.7200000000003, "text": " function itself they're probably going to make the same mistakes or they're" }, { "start": 2212.7200000000003, "end": 2216.88, "text": " probably just going to replicate the code and thinking of the function in the" }, { "start": 2216.88, "end": 2222.44, "text": " unit test itself and therefore it doesn't really get you anything I guess" }, { "start": 2222.44, "end": 2226.32, "text": " in large organizations you write unit tests so that someone else doesn't screw" }, { "start": 2226.32, "end": 2232.2400000000002, "text": " up your code but in this case it would actually be cool because now as a human" }, { "start": 2232.2400000000002, "end": 2237.6400000000003, "text": " you could simply write a bunch of unit tests and then let your let your trans" }, { "start": 2237.6400000000003, "end": 2241.92, "text": " compiler do the heavy lifting and you simply check whether or not the" }, { "start": 2241.92, "end": 2249.12, "text": " output is good alright so how does this do here you can see they have some" }, { "start": 2249.12, "end": 2253.52, "text": " baselines the C++ to Java as I understand it is a commercial system and" }, { "start": 2253.52, "end": 2259.52, "text": " the Java to Python is an open source system both are human experts that make" }, { "start": 2259.52, "end": 2265, "text": " up these rule-based systems on how to trans on how to translate code into" }, { "start": 2265, "end": 2271.4, "text": " other languages now the if you do what they have here is trans coder beam one" }, { "start": 2271.4, "end": 2275.76, "text": " which means a beam size of one so if you don't know a beam search is very shortly" }, { "start": 2275.76, "end": 2280.88, "text": " beam search is like if you decode from your language model you can either" }, { "start": 2280.88, "end": 2285.2000000000003, "text": " always take the next token that has the highest probability this would be greedy" }, { "start": 2285.2000000000003, "end": 2291.08, "text": " decoding or a beam size of one or you can sort of always keep the top n" }, { "start": 2291.08, "end": 2297.2000000000003, "text": " hypotheses of what the of what the most likely output is as you can keep that as" }, { "start": 2297.2, "end": 2304.96, "text": " a you can keep the top five in memory and always decode these five on sort of" }, { "start": 2304.96, "end": 2309.48, "text": " like you have a mini batch of five sequences and you always keep the top" }, { "start": 2309.48, "end": 2314.4399999999996, "text": " five in memory so at the end of the decoding you're going to have five" }, { "start": 2314.4399999999996, "end": 2320.08, "text": " different variants of the same sentence or of the same decoded output and you" }, { "start": 2320.08, "end": 2324.8799999999997, "text": " can then decide which one you like best and usually what you do is you then" }, { "start": 2324.88, "end": 2328.88, "text": " output the one that has the highest probability which is not the same as the" }, { "start": 2328.88, "end": 2334.48, "text": " greedy because sometimes the next token will be will look one next token will" }, { "start": 2334.48, "end": 2340.28, "text": " look very good in a greedy way but you'd better take the second most likely" }, { "start": 2340.28, "end": 2345.96, "text": " because the next to next token is going to sort of make up for that to make the" }, { "start": 2345.96, "end": 2352.76, "text": " entire sequence even more likely so more beam size basically means you can keep" }, { "start": 2352.76, "end": 2358.76, "text": " more hypotheses of the output in memory until the end so if you just do the" }, { "start": 2358.76, "end": 2363.32, "text": " greedy decoding you see you already get fairly close to these baselines it's" }, { "start": 2363.32, "end": 2370.44, "text": " very very cool very interesting and if you up the beam size you surpass these" }, { "start": 2370.44, "end": 2376.4, "text": " baselines now the way they up the beam size here I find to be a bit let's call" }, { "start": 2376.4, "end": 2380.0400000000004, "text": " it a bit cheaty because when they say beam five what they mean is they keep" }, { "start": 2380.04, "end": 2385.72, "text": " the five hypotheses and then at the end I as I understand it if any of the five" }, { "start": 2385.72, "end": 2392.6, "text": " hypotheses passes all the unit tests or the most they keep it right so basically" }, { "start": 2392.6, "end": 2398, "text": " they give themselves the freedom to say whichever one of the five we output is" }, { "start": 2398, "end": 2403.4, "text": " the best that's the one we count and of course that's not really a match to the" }, { "start": 2403.4, "end": 2409.52, "text": " commercial or to the baseline system because it can output one thing now" }, { "start": 2409.52, "end": 2415.08, "text": " it is maybe a good practical application to give the human that you know you input" }, { "start": 2415.08, "end": 2419.4, "text": " a function you give the human five options to choose from and it can choose" }, { "start": 2419.4, "end": 2427.48, "text": " and thereby decide which one the human likes best but it is sort of it is a" }, { "start": 2427.48, "end": 2432.48, "text": " wonky what I like more is this here the beam 10 top one this is what you would" }, { "start": 2432.48, "end": 2436.84, "text": " actually do so we could keep 10 hypotheses during decoding and that the" }, { "start": 2436.84, "end": 2443.1200000000003, "text": " end output the top one the top likely one and as you can see that is better" }, { "start": 2443.1200000000003, "end": 2447.2400000000002, "text": " than greedy but it is worse than where you you know give yourself the freedom" }, { "start": 2447.2400000000002, "end": 2452.7200000000003, "text": " to output multiple ones of course though they say that most of the errors that" }, { "start": 2452.7200000000003, "end": 2458.28, "text": " this top one makes come from compilation errors when the target language is Java" }, { "start": 2458.28, "end": 2464.44, "text": " or C++ it suggests that the beam and top one metric could easily be improved we" }, { "start": 2464.44, "end": 2469.56, "text": " leave this to future work which this again I find valid right so if you if" }, { "start": 2469.56, "end": 2474.68, "text": " your method is I'm going to keep the top 10 hypothesis until the end and" }, { "start": 2474.68, "end": 2480.16, "text": " then I'm going from the top and I simply compile them and I output the first one" }, { "start": 2480.16, "end": 2489.04, "text": " that compiles that that's not cheating right that's a valid thing again yeah so" }, { "start": 2489.04, "end": 2496.96, "text": " in that way I can I can understand what they're saying right here okay so they" }, { "start": 2496.96, "end": 2503, "text": " give some examples some of which I find very interesting so the first thing here" }, { "start": 2503, "end": 2509.7599999999998, "text": " is that oh yeah by the way I've said in the I've said that the tokenizer between" }, { "start": 2509.7599999999998, "end": 2513.72, "text": " the natural languages is shared they make a little tweak here in that they" }, { "start": 2513.72, "end": 2518.2, "text": " tokenize the different languages with their language respective tokenizers" }, { "start": 2518.2, "end": 2524.16, "text": " which will still end up tokenizing pretty much you know this the print" }, { "start": 2524.16, "end": 2531.2799999999997, "text": " statement in C++ or in Java no actually the print statement in Python is print" }, { "start": 2531.2799999999997, "end": 2534.7999999999997, "text": " and in Java it's println and so on but it will still like the all the if" }, { "start": 2534.7999999999997, "end": 2542.7599999999998, "text": " statements it will still tokenize into the same into the same word but it's" }, { "start": 2542.76, "end": 2554.92, "text": " simply not viable to to parse Python with a C++ parser okay so we have looked" }, { "start": 2554.92, "end": 2560.4, "text": " at this the results this is one of the results they look at their shared" }, { "start": 2560.4, "end": 2564.44, "text": " embedding space and this is a t-sneak plot so a 2d projection of this shared" }, { "start": 2564.44, "end": 2568.4, "text": " embedding space and you can see that this is actually happening so the" }, { "start": 2568.4, "end": 2574.28, "text": " different so null null and none are mapped to similar locations println" }, { "start": 2574.28, "end": 2580.88, "text": " and cout are mapped to similar locations in this space so this is exactly what we" }, { "start": 2580.88, "end": 2587, "text": " want this is sort of a verification that this method of embedding the different" }, { "start": 2587, "end": 2592.1600000000003, "text": " languages into the same space really turns out such that whatever means the" }, { "start": 2592.1600000000003, "end": 2596.76, "text": " same thing is mapped to the same place you can see here catch and accept two" }, { "start": 2596.76, "end": 2600.48, "text": " very different tokens are mapped to the same place simply because they're used" }, { "start": 2600.48, "end": 2607, "text": " in the same sort of constructs across the languages very cool one of these" }, { "start": 2607, "end": 2611.96, "text": " examples here is quite impressive and kind of shows the difference between" }, { "start": 2611.96, "end": 2619.2400000000002, "text": " this and and rule-based translation in this function right here you have a C" }, { "start": 2619.2400000000002, "end": 2624.36, "text": " plus plus function that takes a character pointer to that is called str" }, { "start": 2624.36, "end": 2632.08, "text": " str in as an input now in C++ strings are at least in old versions of C++" }, { "start": 2632.08, "end": 2637.4, "text": " strings are handled as character arrays so a string is indistinguishable from a" }, { "start": 2637.4, "end": 2643.52, "text": " character array and in this case usually what you do is you don't input the array" }, { "start": 2643.52, "end": 2649.6400000000003, "text": " because that will cause a copy you input a pointer to the first to you input a" }, { "start": 2649.64, "end": 2656.7999999999997, "text": " pointer to the array and that would define the string okay so if you" }, { "start": 2656.7999999999997, "end": 2662.24, "text": " translate this again this the type of this is simply character array if you" }, { "start": 2662.24, "end": 2667, "text": " translate this with this transcoder system that they've built into Java in" }, { "start": 2667, "end": 2672.4, "text": " Java there is a type called string right there's a native type called string and" }, { "start": 2672.4, "end": 2677.92, "text": " is that true I think oh yeah that's and then that's handled really weirdly in" }, { "start": 2677.92, "end": 2685.8, "text": " the JVM I think yes so there is it at least there is a type called string so" }, { "start": 2685.8, "end": 2690.32, "text": " it would map that it would recognize are you mean a string therefore I'm going to" }, { "start": 2690.32, "end": 2694.76, "text": " put a string here and it uses all the string method like string length string" }, { "start": 2694.76, "end": 2700.4, "text": " character at and so on where in C++ this is just an array and you just have array" }, { "start": 2700.4, "end": 2706.28, "text": " accesses now they take this same C++ function and only change one thing they" }, { "start": 2706.28, "end": 2711.44, "text": " change the name of the parameter everything else is the same but now the" }, { "start": 2711.44, "end": 2717.32, "text": " character array is called our okay and they put it through the same system and" }, { "start": 2717.32, "end": 2723.88, "text": " that system now outputs a function that takes in a character array called our" }, { "start": 2723.88, "end": 2730.2400000000002, "text": " instead of a string and it uses you know here the property length it uses array" }, { "start": 2730.2400000000002, "end": 2735.6400000000003, "text": " access instead of this car character at method so simply by changing the name" }, { "start": 2735.64, "end": 2741.3599999999997, "text": " and this is something where I believe the rule-based systems can this can be" }, { "start": 2741.3599999999997, "end": 2746.72, "text": " an advantage over rule-based system because what this here does is it simply" }, { "start": 2746.72, "end": 2753.64, "text": " says oh I've seen a lot of humans in my code base that use this use like stir as" }, { "start": 2753.64, "end": 2759.96, "text": " a as a variable name and that usually means that the constructs here are like" }, { "start": 2759.96, "end": 2766.32, "text": " the constructs in Java where people use strings and I've seen other places where" }, { "start": 2766.32, "end": 2771.56, "text": " people use you know names like this right here and usually that is used in" }, { "start": 2771.56, "end": 2777.2400000000002, "text": " the same context as in Java people use character arrays right so it in" }, { "start": 2777.2400000000002, "end": 2782.28, "text": " programming it's not only important what the the code actually does but a lot of" }, { "start": 2782.28, "end": 2786.7200000000003, "text": " programming goes via naming of things like other programmers will read your" }, { "start": 2786.72, "end": 2791.08, "text": " code and by reading stir right here they will sort of assume that this is a" }, { "start": 2791.08, "end": 2796.8799999999997, "text": " string whereas if they read our right here they will assume you're a pirate" }, { "start": 2796.8799999999997, "end": 2802.8799999999997, "text": " and you are referring to a character array and they will treat the code the" }, { "start": 2802.8799999999997, "end": 2807.9399999999996, "text": " code means something different and these systems right here these neural machine" }, { "start": 2807.9399999999996, "end": 2812.56, "text": " translation systems can actually understand that part because they do" }, { "start": 2812.56, "end": 2817.7599999999998, "text": " statistical inference on code that humans wrote if you change this back to" }, { "start": 2817.7599999999998, "end": 2823.7999999999997, "text": " say input then again it goes back to a string and uses all the string functions" }, { "start": 2823.7999999999997, "end": 2830.44, "text": " so that's fairly impressive in my mind and it yeah definitely an advantage over" }, { "start": 2830.44, "end": 2835.32, "text": " rule-based systems of course the disadvantage over rule-based systems is" }, { "start": 2835.32, "end": 2839.04, "text": " that in rule-based systems you can almost get on like sometimes you can" }, { "start": 2839.04, "end": 2844, "text": " even guarantee that the code does the same thing here you can't they give some" }, { "start": 2844, "end": 2850.48, "text": " examples of failed translations where so now you get you run into this problem" }, { "start": 2850.48, "end": 2855.2, "text": " where the min function in Python is overloaded it can either give you the" }, { "start": 2855.2, "end": 2860.7599999999998, "text": " minimum of a sequence or it can give you the minimum of two things now this is" }, { "start": 2860.7599999999998, "end": 2867.56, "text": " translated to Java right here and math dot min is not overloaded in Java it" }, { "start": 2867.56, "end": 2873.44, "text": " only gives you the minimum of two things and not the minimum of an array and it" }, { "start": 2873.44, "end": 2877.92, "text": " still outputs that now given enough data probably could learn because these" }, { "start": 2877.92, "end": 2882.84, "text": " things are all context dependent but this is one of the this is one of the" }, { "start": 2882.84, "end": 2891.6, "text": " failure cases of these models of course all right so this was this paper I" }, { "start": 2891.6, "end": 2898.24, "text": " I've read that the code of this and the unit tests will be output will be put" }, { "start": 2898.24, "end": 2905.5, "text": " online at some times they are not right now if I if I hear about it I can link to" }, { "start": 2905.5, "end": 2909.92, "text": " it or let you know about it let me know what you think of this paper in the" }, { "start": 2909.92, "end": 2922.4, "text": " comments share it out and subscribe if you haven't yet and bye bye" } ]
cvkeWwDQr0A
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
JOIN ME for the NeurIPS 2020 Flatland Multi-Agent RL Challenge!
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper" ]
Join me to solve the NeurIPS 2020 challenge on multi-agent reinforcement learning in the flatland environment. This challenge has participants optimize a complex train scheduling system, subject to accidents, delays and re-routing. The plan is to solve this as a community with no expectations of winning and fully in the open. Discord: https://discord.gg/4H8xxDF Community GitHub Repo: https://github.com/yk/youtube-flatland Neurips 2020 Flatland Challenge: https://www.aicrowd.com/challenges/neurips-2020-flatland-challenge Flatland Environment: https://gitlab.aicrowd.com/flatland/flatland OUTLINE: 0:00 - Intro 1:00 - The Flatland Environment 2:00 - The NeurIPS 2020 Flatland Challenge 3:20 - Let's do this as a Community 4:10 - Ground Rules 6:15 - Conclusion Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today I want to talk to you about something that's very near and dear to my heart and that is the Flatland environment. Now the Flatland environment is a train simulator that has been developed by the Swiss Train Company and I ride the trains every day. So when I heard that there is a NeurIPS challenge to use the Flatland environment to make the train system in my country better, I of course was very excited to do that. So out of purely egotistical reasons I'm going to present to you the Flatland environment and I invite you to join me in solving this as a group together. So the plan is basically that we as a community sort of do this challenge and completely in the open with absolutely no aspirations of winning or doing well or getting any of the prizes just for the fun of it and we'll see how far we'll 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 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. 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 NURIPS 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's the exact connection to NURIPS 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 clue less. 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 in and basically people can discuss solutions to this problem. I'll make a github repository in public where people can submit poll requests to and I'll be sort of the merger and whatnot of these. And we together sort of develop solutions. Now my idea is that people would sort of independently try things and then kind of suggest things and if they work we can merge them and whatnot. And there's just a lot of discussion in the discord server. I myself will not be like super active on the server. It's meant for the community basically together to discuss things and whoever wants to do that. So I just want to make some things clear from the beginning. I will be the dictator of this project. The 100% authoritarian no compromises dictator. If anything is supposed to be decided I may elect to hold the 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 a method for the community among itself to communicate. Third if you decide to put in work don't expect others to do so. Expect nothing. If the project doesn't work out we scrap it. If people get tired of it we scrap it. If there's some other problem we scrap it. No expectations. Never get mad at anyone else for not doing as much work or anything like this. This is purely you participate because you yourself want to learn something, want to have fun and if someone else does the same thing that's all the better okay. I will have a mainly supervisory role in this in that I will look at things that are happening and advise and occasionally I of course will participate myself. So I hope the framing of this is clear. This is not me throwing a hundred percent at this. I just thought it would be cool to do something as a community together and this challenge it seems like you know there are other challenges like mine RL 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. All right if you still want to participate even though I really really really try to talk you out of this right now I will leave a link to the discord somewhere in the description and a link to the git repo as well and I hope that some of you will be motivated enough to come join and have some fun. All right I'll see you there bye bye.
[ { "start": 0, "end": 4.64, "text": " Hi there, today I want to talk to you about something that's very near and dear to my heart" }, { "start": 4.64, "end": 10.88, "text": " and that is the Flatland environment. Now the Flatland environment is a train simulator that" }, { "start": 10.88, "end": 16.96, "text": " has been developed by the Swiss Train Company and I ride the trains every day. So when I heard that" }, { "start": 16.96, "end": 23.12, "text": " there is a NeurIPS challenge to use the Flatland environment to make the train system in my country" }, { "start": 23.12, "end": 29.92, "text": " better, I of course was very excited to do that. So out of purely egotistical reasons I'm going to" }, { "start": 29.92, "end": 36.72, "text": " present to you the Flatland environment and I invite you to join me in solving this as a group" }, { "start": 36.72, "end": 44.24, "text": " together. So the plan is basically that we as a community sort of do this challenge and completely" }, { "start": 44.24, "end": 50.88, "text": " in the open with absolutely no aspirations of winning or doing well or getting any of the" }, { "start": 50.88, "end": 59.2, "text": " prizes just for the fun of it and we'll see how far we'll come together. Okay so let me demonstrate" }, { "start": 59.2, "end": 63.760000000000005, "text": " the environment itself. So as you can see here this is a visualization of the environments. There" }, { "start": 63.760000000000005, "end": 68.64, "text": " are these agents in the environments and they have to reach certain goals and of course they" }, { "start": 68.64, "end": 74, "text": " can't crash. If you look here to the left there's a bunch of them crashing right now which is not" }, { "start": 74, "end": 79.76, "text": " good and your task is this is a multi-agent reinforcement learning problem. All of these" }, { "start": 79.76, "end": 86.80000000000001, "text": " agents have to reach their goal and as fast as possible without any collisions along these tracks" }, { "start": 86.8, "end": 94.24, "text": " right here. So you basically have to specify for every single agent what their next action at each" }, { "start": 94.24, "end": 102.39999999999999, "text": " time step is. Now this simulator is completely given to you. You can use it and basically it's" }, { "start": 102.39999999999999, "end": 107.67999999999999, "text": " a planning problem for multiple agents. So at each step you have to decide does the agent move up," }, { "start": 107.67999999999999, "end": 113.12, "text": " down, left or right depending on whether they can do so, depending on the tracks and whether something" }, { "start": 113.12, "end": 119.28, "text": " is in their way or is not in their way. And you know every agent should reach their goal at the" }, { "start": 119.92, "end": 127.28, "text": " closest possible or at the shortest possible time of course. Now there is this NURIPS 2020" }, { "start": 127.28, "end": 134.88, "text": " Flatland challenge and basically you can submit your solutions to their evaluator and there's a" }, { "start": 134.88, "end": 141.6, "text": " leaderboard and everything and I thought it would be fun to participate in this. Now I don't exactly" }, { "start": 141.6, "end": 149.6, "text": " know what's the exact connection to NURIPS and so on but I don't care honestly and this hasn't" }, { "start": 149.6, "end": 158.07999999999998, "text": " started yet. The timeline isn't really open yet but it will start soon but I think we can already" }, { "start": 158.07999999999998, "end": 164.64, "text": " start working on it. So the plan here is basically to just you know kind of I have no idea of traffic" }, { "start": 164.64, "end": 172.16, "text": " scheduling. No idea, absolutely clue less. But I know a lot about reinforcement learning and even" }, { "start": 172.16, "end": 177.83999999999997, "text": " though they say the challenge has already existed last year in a very in a slightly different form." }, { "start": 177.83999999999997, "end": 184.32, "text": " I think it was just one agent instead of multi-agent and they said usually you have to combine the" }, { "start": 184.32, "end": 189.11999999999998, "text": " reinforcement learning with like some traditional stuff in order to perform really well. Like screw" }, { "start": 189.12, "end": 196.4, "text": " that. No I'm totally up for that but it would be fun to just blast it off with RL and go there." }, { "start": 197.92000000000002, "end": 206.48000000000002, "text": " So here's my proposition. I have opened a discord server for you to join where you can join in and" }, { "start": 206.48000000000002, "end": 213.04000000000002, "text": " basically people can discuss solutions to this problem. I'll make a github repository in public" }, { "start": 213.04, "end": 220.79999999999998, "text": " where people can submit poll requests to and I'll be sort of the merger and whatnot of these. And" }, { "start": 220.79999999999998, "end": 228.32, "text": " we together sort of develop solutions. Now my idea is that people would sort of independently" }, { "start": 228.32, "end": 233.68, "text": " try things and then kind of suggest things and if they work we can merge them and whatnot. And" }, { "start": 233.68, "end": 240.64, "text": " there's just a lot of discussion in the discord server. I myself will not be like super active on" }, { "start": 240.64, "end": 247.44, "text": " the server. It's meant for the community basically together to discuss things and whoever wants to do" }, { "start": 247.44, "end": 255.35999999999999, "text": " that. So I just want to make some things clear from the beginning. I will be the dictator of this" }, { "start": 255.35999999999999, "end": 266, "text": " project. The 100% authoritarian no compromises dictator. If anything is supposed to be decided" }, { "start": 266, "end": 271.92, "text": " I may elect to hold the vote and I may not. If we win something I'll decide what to do with it." }, { "start": 273.36, "end": 279.6, "text": " So just this because otherwise there's just trouble right. Are we going to win? Probably" }, { "start": 279.6, "end": 284.08, "text": " not because anyone could just come to our github repo clone it and then tune it a little bit more." }, { "start": 284.8, "end": 292.8, "text": " Right so I have no aspirations of winning right here. Also as I already said I'm not going to be" }, { "start": 292.8, "end": 300.32, "text": " super active in this discord. It's meant as a method for the community among itself to" }, { "start": 300.32, "end": 307.2, "text": " communicate. Third if you decide to put in work don't expect others to do so. Expect nothing. If" }, { "start": 307.2, "end": 313.04, "text": " the project doesn't work out we scrap it. If people get tired of it we scrap it. If there's some other" }, { "start": 313.04, "end": 321.44, "text": " problem we scrap it. No expectations. Never get mad at anyone else for not doing as much work or" }, { "start": 321.44, "end": 327.2, "text": " anything like this. This is purely you participate because you yourself want to learn something," }, { "start": 327.2, "end": 333.28, "text": " want to have fun and if someone else does the same thing that's all the better okay. I will have a" }, { "start": 333.28, "end": 341.2, "text": " mainly supervisory role in this in that I will look at things that are happening and advise and" }, { "start": 341.2, "end": 348.4, "text": " occasionally I of course will participate myself. So I hope the framing of this is clear. This is" }, { "start": 348.4, "end": 355.67999999999995, "text": " not me throwing a hundred percent at this. I just thought it would be cool to do something as a" }, { "start": 355.67999999999995, "end": 360.32, "text": " community together and this challenge it seems like you know there are other challenges like" }, { "start": 360.32, "end": 367.12, "text": " mine RL where everyone needs like a billion GPUs to even get competitive. This seems like small" }, { "start": 367.12, "end": 373.44, "text": " enough that we could actually make a difference here and hopefully do something very cool." }, { "start": 373.44, "end": 378.71999999999997, "text": " All right if you still want to participate even though I really really really try to talk you out" }, { "start": 378.71999999999997, "end": 386.32, "text": " of this right now I will leave a link to the discord somewhere in the description and a link" }, { "start": 386.32, "end": 394.24, "text": " to the git repo as well and I hope that some of you will be motivated enough to come join and have" }, { "start": 394.24, "end": 407.12, "text": " some fun. All right I'll see you there bye bye." } ]
rl4nUngiR2k
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
BLEURT: Learning Robust Metrics for Text Generation (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nlp", "natural language processing", "mt", "machine translation", "transformer", "bert", "lstm", "attention", "wmt", "wikipedia", "backtranslation", "bleu", "rouge", "ngrams", "score", "metric", "comparison", "human raters", "google", "google research", "automatic", "overlap", "distribution shift" ]
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 BLERT, Learning Robust Metrics for Text Generation by Thibaut Salam, Tipanjan Das and Ankur P. Parikh. So this paper on a high level proposes a new metric for text generation tasks such as machine translation by leveraging a BERT model to produce like an automated metric, an automated quality metric. And they make this BERT model robust by pre-training it on a very wide array of tasks that they can use synthetic data to train it. And therefore the model and the resulting score is very robust to shifts in distribution and they advocate that this could be used in the future to assess text generation systems. Alright, as always, if you like content like this, consider subscribing and sharing it out and leaving a like. Tell YouTube that it's good content. Of course only if you agree. So what's the problem with evaluation for text generation? So if you know the machine translation community, basically what they do is they have these datasets where they translate from one language into another. Let's say English to French. And they have a training dataset that is fairly okay-ishly large. And then they somehow need to evaluate this. So you have like a test dataset, 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 dataset, you produce a program. This is your machine translation program that you produce from the data. And you let this run on your evaluation dataset and you give the results to a bunch of human raters. These could be regular people, these could be linguists that are experts in translation in both languages. And they will score 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 quite slow and it's quite expensive as you know it requires these humans here to assess all of these systems output. And you want a sort of a sizable output, right? Because you want sort of a good sample of the machine translation system. So this is not really satisfactory but like an automated score like perplexity is also not satisfactory. What people have done is they've come up with proxy scores for the humans and two of those scores are called rouge and blue. And specifically blue is one of these metrics that people use and it kind of 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 it was also produced by humans. And it would also look at these snippets of size four and it would just kind of assess how many of the snippets overlap. Of course the machine translation system has never seen the label like the gold standard for that particular set otherwise it wouldn't you know be fair. But you basically compare n-grams of output and gold and some gold standard. You can have multiple gold standards and so on. So this blue metric is more of like a heuristic and it has been found to correlate fairly well with the humans up until recently of course with the explosion of neural machine translation and especially transformer based machine translation I guess and but also the their system that use LSTM 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 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 the better and better these systems were the more these metrics like BLÖ and RÖS have diverged from the humans and they're not really reliable anymore especially if you compare really high skill systems to each other. BLÖ 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. This paper here proposes this BLÖRT. Can we just stop with the variance on BÖRT? We get it, you use BÖRT for everything but you know. They say it's a learned evaluation metric based on BÖRT that can model human judgments with a few thousand possibly biased training examples. What you would do in these cases is now the creation of a metric becomes a machine learning task itself. What you'll have is a data set of things that are gold standard translations by humans. You will have the output of the machine translation system. You put them together so you have the gold standard sentence. 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 8 right here. It says these two sentences match 8 good. So 8 maybe it's out of 10. This bottom thing is a very good translation for the top thing, to match the top thing. The human assesses the quality of the sample. Now you have a training data set. You have a z and z tilde or something or y. They call this y which is the gold standard label. This is y tilde, whatever the machine produced and or x tilde and then y is the label. Your task is now given x and x tilde predict whatever the human would say about this. 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 and formulate a machine learning task. That's exactly what these competitions have done. It's like a meta competition. It's a competition for designing the best metrics of the other competitions. 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 other tasks to use it in the next years as well. The thing about metrics is you need to be able to compare to previous years and so on. You would want a metric that is still valid for other years and other slightly different tasks and also for other machine translation systems. If you just learn on data from this year's competitions and in five years all of these models will have become so much better and they'll produce different output and that's the difficulty. Your metric should still be valid at that point. This paper basically 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. In five years the machine translation systems are better. They maybe use different language constructs to translate certain things because they assess that better. Can you still make a good judgment about which of these systems is better than the other system? Can you still assess how humans would rate these systems? They're saying that they found the method to do this. This blurt, as they said, not only have they found the method but their method only uses a few thousand possibly biased training examples. They do this via a new pre-training scheme. 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. Why is it important that it only uses a few thousand training examples? Because these are generated by humans and humans are expensive. It's not like ImageNet. 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. This is expensive. The fewer of these actual training examples that the thing can be efficient on, the better. They circumvent this by using millions of synthetic examples to help the model generalize. They do this in a pre-training step. Blurt provides state-of-the-art results on the last three years of the WMT metrics shared tasks. This is this meta task where you're asked to come up with a metric for the other tasks. The WebNLG competition dataset, in contrast to a vanilla bird-based approach, yields superior results even when the training data is scarce and out of distribution. Let's have a look at what they do. They say what do we need to do to fine-tune BERT for quality evaluation? If you don't know what BERT is, it's basically a model that takes in a bunch of text. 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 want to check that out. As outputs you get 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 put a classification layer on top to classify it into certain classes. If you want to do regression, you can do other things with these outputs right here, but for this particular paper only this CLS output is relevant. You would input this pair of gold standard and output of the machine and the output would be an output Y, which is either a number or a class label. In this case it's a number. You input these two things and out comes this whole sequence. You take the CLS output vector and you put it through a linear layer, weights and bias, and that would output a number Y. The number Y you train to be as close as possible to what the human would say about this pair X, the gold standard, and X tilde, the output of the system. This is what you would do if you were simply going about it. Just take BERT, take the model, so BERT is really good at language, take the model and train it on this data set. However, fine-tuning BERT requires a sizable amount of IID data. We don't have that in these tasks, which is less than ideal for a metric that should generalize to a variety of tasks and model drift. The problem with just applying BERT here is that you don't have enough data and 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. What does that mean? They say the key aspect of our approach is a pre-training technique that we use to warm up BERT before fine-tuning on the rating data. You might know BERT training, which is where you do this masked language model pre-training. If you are given a piece of text, let's say you're given this piece of text right here, what you would do is you would drop out a couple of words like this one and this one and ask BERT to reconstruct it, like a denoising autoencoder. That way BERT learns about language in this particular way. They're not saying you should replace that. What they're saying is 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. In the naive approach you would skip this step too. Their claim is that by introduction of this step too, that you could be a lot better and a lot more robust. You're already exposed to information in this step that will make you more robust to distribution shifts in this fine-tuning data later. I've advocated for this step to be called priming. Because otherwise you always have to say, okay I want to pre-train BERT but I don't mean pre-pre-training, like I don't mean 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. If you come up with stuff like this, probably you've heard it somewhere. I guess I might not be the inventor of this, but it is a good sounding word and it sort of fits. They say we generate a large number of synthetic reference candidate pairs. What they're going to do is take a bunch of text and in their case I think it's Wikipedia. For each Wikipedia article they're going to draw sentences or samples or paragraphs from Wikipedia. These are going to be your Z and then they're going to kind of muddle with them a bit. They're going to disturb them a bit, to make them a bit different, to make them go Z tilde. This simulates the difference between what the machine translation outputs and the gold standard sentence. They're usually not exactly the same, if you translate a sentence there are many ways you can do it. Their goal is to produce a data set that has sentences and perturbed versions of the sentence, but not perturbed randomly, but perturbed in a language knowledgeable way. How do they do this? They have three different ways. First of all mask filling with BERT. What they're doing is they take a BERT that can do language modeling, a pre-trained BERT. 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. BERT might produce the same words or it might produce slightly different words. Depending on how many you drop out you can choose the amount that you perturb these sentences. The second is they back translate. What they do with back translation is they use a machine translation model. It doesn't matter which one you take. They use any machine translation model to take a sentence and then they map it to another language, say from English to French. This is Z French and then they map it back again. The Z tilde is now the French to English translation. You need two translation models. First you translate it to French and then you translate it back again. 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. That would be the second version that you could make pairs of sentences that are sort of similar. The third way is just to drop out words. They just found this to help. Now they have a giant data set of sentences and perturbed versions of sentences. What are they going to do with that giant data set? The answer is they're going to take this Z and Z tilde and you're going to put that into BERT into their thing that they prime now. This is the priming stage. This was pre-trained on mask language modeling. Now they want to prime it. What are they going to do? They're going to take this CLS vector. Of course this is not the final task and we don't have final labels for these two things. We need to somehow come up with our own tasks and labels for them. They decide to go a whole bunch of tasks. They go like... 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. This could be metrics like BLÖ or RÖSCH or this BERT score right here. You simply calculate the n-gram overlap between Z and Z' that would be one of the scores. It could be the back translation likelihood which is how likely does a back translation model assess the sentence. Here are all the things. Six different tasks. The catch here is... What would happen for example with BLÖ is you would take a model and you would calculate the BLÖ score between those two things. But you wouldn't input that into BERT. You would ask BERT to predict the BLÖ score. BERT would be outputting B hat and B would be the actual BLÖ score. You would train BERT to predict the BLÖ score of this particular pair of inputs. One you take as the input and the other one you take as the reference. You would ask BERT to predict the BLÖ score of this. To predict the RÖSCH score. You would ask all of these signals. You ask the same model. You ask to predict all of these scores for these two things. You can calculate all of these scores by either BLÖ 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. It's 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. You have an entailment model that outputs how much by how much does the second sentence entail the first that basically means does the second sentence follow from the first and of course this is not you know it's not actually proper input data for that task but you can still ask the model and if these are good translations of each other if these sentences match then the second one should probably follow fairly well for the first but at least you can if you make BERT predict that it will learn something useful about the relation between the two sentences. So the entire game name of the game in here is to come up with tasks that if BERT learns to predict the score of these tasks on those inputs sorry on pretending one is the input and the other one is the output or on the two inputs and then trying to predict the score then BERT would learn something useful. So that's 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 it's kind of becoming attuned 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 generalizes better to other sort of distribution shifts. So that is the thing here and 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 is all on data basically where you know we train on training data and evaluate on testing data and they're sort of the same they come from the same year from the same machine translation models and we don't really know how you know next year the machine translation models might be different thus our scores 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 dotted lines right here or so so you can see the overlap between the test and the trained 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 except in this extreme case so the score for all of these it remains relatively high and especially remains above the blue score which is always sort of worse right so this is is pretty as pretty neat and shows this power of this pre training basically that's that's the the robustness to quality drift metric and they have a bunch of other metrics right here where they ablate and so on but I don't want to go too much into that I more want to make some comments on on this work so what what I think so first of all in a paper like this what what I would like to see is like the extrapolation right here to if and where this ever crosses the the blue score right because I mean okay it seems like yeah this skew of three is a 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 everyone's using BERT for everything right and BERT is a specific architecture that is going to be good at specific things at specific grammatical constructs in specific languages right so it's the mistakes it makes are very systematic now if in one year or two years all of a sudden the 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 the skew via just dividing up the data in into bad and good ratings I don't think that covers these distribution shifts that they set out to cover right what I would have expected is something like them because these tasks are repeated year after year and I would have expected them to for example train on 2017 and then evaluate on 2019 or something like or show like evaluate on 2017 2018 and 2019 and there we would have a much better assessment of a distribution shift over the years right so so it is not super convincing to me and what is most worrisome is if you look at their pre training tasks I mean okay there is a there's blur and rouge but there is BERT score right there is entailment which is also a BERT model and the back translation I mean who knows that's probably either going to be a transformer or a LSTM with an attention mechanism which is the attention mechanism is the basis for transformers so all of these things are basically going to make the same sort of bias mistakes right they're doing to to it's not it's not like there is Gaussian noise on top of these things all of these things are going to be weak in the same sort of assessments and not agree with like they're going to have systematic errors in them with respect to them predicting the human scores and if we evaluate our systems that some are also using exactly that thing right so these the systems we evaluate they are using the same type of models as here they're going to fall prey to the same type of mistakes and then if we switch over to systems that use some different right so next year we have some systems that use different techniques they're going to be like exactly maybe not bad in these particular things but bad in other things and then this thing will output a systematically biased assessment so it's sort of a house of like if you've seen these images of plugging in the power strip into itself and you have infinite power it's like it's very to me it seems very dangerous to have as 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 blurt check out they have the code available the metric is available evaluate your stuff with it and bye bye
[ { "start": 0, "end": 6.08, "text": " Hello there! Today we'll look at BLERT, Learning Robust Metrics for Text Generation by" }, { "start": 6.08, "end": 12.6, "text": " Thibaut Salam, Tipanjan Das and Ankur P. Parikh. So this paper on a high level" }, { "start": 12.6, "end": 18, "text": " proposes a new metric for text generation tasks such as machine translation by" }, { "start": 18, "end": 24.240000000000002, "text": " leveraging a BERT model to produce like an automated metric, an automated quality" }, { "start": 24.24, "end": 30.479999999999997, "text": " metric. And they make this BERT model robust by pre-training it on a very wide" }, { "start": 30.479999999999997, "end": 36.32, "text": " array of tasks that they can use synthetic data to train it. And therefore" }, { "start": 36.32, "end": 43.16, "text": " the model and the resulting score is very robust to shifts in distribution and" }, { "start": 43.16, "end": 47.599999999999994, "text": " they advocate that this could be used in the future to assess text generation" }, { "start": 47.599999999999994, "end": 53, "text": " systems. Alright, as always, if you like content like this, consider subscribing" }, { "start": 53, "end": 59.96, "text": " and sharing it out and leaving a like. Tell YouTube that it's good content. Of" }, { "start": 59.96, "end": 66.08, "text": " course only if you agree. So what's the problem with evaluation for text" }, { "start": 66.08, "end": 71.56, "text": " generation? So if you know the machine translation community, basically what they" }, { "start": 71.56, "end": 75.76, "text": " do is they have these datasets where they translate from one language into" }, { "start": 75.76, "end": 82.56, "text": " another. Let's say English to French. And they have a training dataset that is" }, { "start": 82.56, "end": 89.88, "text": " fairly okay-ishly large. And then they somehow need to evaluate this. So" }, { "start": 89.88, "end": 94.8, "text": " you have like a test dataset, but all you can really do is sort of calculate the" }, { "start": 94.8, "end": 98.84, "text": " perplexity of a language model that you produce or of a translation model that" }, { "start": 98.84, "end": 103.84, "text": " you produce. There's not really a metric for translation, so the gold standard is" }, { "start": 103.84, "end": 108.6, "text": " to get it to humans. So you train on this dataset, you produce a program." }, { "start": 108.6, "end": 113.36, "text": " This is your machine translation program that you produce from the data. And you" }, { "start": 113.36, "end": 118.6, "text": " let this run on your evaluation dataset and you give the results to a" }, { "start": 118.6, "end": 123.32, "text": " bunch of human raters. These could be regular people, these could be linguists" }, { "start": 123.32, "end": 129.76, "text": " that are experts in translation in both languages. And they will score each" }, { "start": 129.76, "end": 134.07999999999998, "text": " of the outputs of the machine translation systems and at the end you" }, { "start": 134.08, "end": 139.32000000000002, "text": " will get like a number, like eight. Your system is eight good. The problem of" }, { "start": 139.32000000000002, "end": 144.20000000000002, "text": " course is this process is very very slow. So the machine translation community does" }, { "start": 144.20000000000002, "end": 148.56, "text": " this every year and it's quite slow and it's quite expensive as you know" }, { "start": 148.56, "end": 153.36, "text": " it requires these humans here to assess all of these systems output. And you want" }, { "start": 153.36, "end": 157.84, "text": " a sort of a sizable output, right? Because you want sort of a good sample" }, { "start": 157.84, "end": 165.16, "text": " of the machine translation system. So this is not really satisfactory but like" }, { "start": 165.16, "end": 169.52, "text": " an automated score like perplexity is also not satisfactory. What people have" }, { "start": 169.52, "end": 173.92000000000002, "text": " done is they've come up with proxy scores for the humans and two of those" }, { "start": 173.92000000000002, "end": 180.92000000000002, "text": " scores are called rouge and blue. And specifically blue is one of these" }, { "start": 180.92000000000002, "end": 187.08, "text": " metrics that people use and it kind of takes n-grams in the sentences. So" }, { "start": 187.08, "end": 191.8, "text": " n-grams would be like snippets of like let's say four words after one another" }, { "start": 191.8, "end": 196.16000000000003, "text": " and there would be these snippets and that the machine translation system" }, { "start": 196.16000000000003, "end": 201.12, "text": " produces and then it would go into the validation data set and look at the gold" }, { "start": 201.12, "end": 205.24, "text": " standard translation that it was also produced by humans. And it would also" }, { "start": 205.24, "end": 210.08, "text": " look at these snippets of size four and it would just kind of assess how many of" }, { "start": 210.08, "end": 214.36, "text": " the snippets overlap. Of course the machine translation system has never" }, { "start": 214.36, "end": 219.36, "text": " seen the label like the gold standard for that particular set otherwise it" }, { "start": 219.36, "end": 226.24, "text": " wouldn't you know be fair. But you basically compare n-grams of output and" }, { "start": 226.24, "end": 230.56, "text": " gold and some gold standard. You can have multiple gold standards and so on. So" }, { "start": 230.56, "end": 235.60000000000002, "text": " this blue metric is more of like a heuristic and it has been found to" }, { "start": 235.60000000000002, "end": 240.44000000000003, "text": " correlate fairly well with the humans up until recently of course with the" }, { "start": 240.44, "end": 245.28, "text": " explosion of neural machine translation and especially transformer based machine" }, { "start": 245.28, "end": 250.56, "text": " translation I guess and but also the their system that use LSTM with" }, { "start": 250.56, "end": 254.96, "text": " attention. These systems have become extremely extremely good. I don't know if" }, { "start": 254.96, "end": 261.12, "text": " you notice but Google Translate has been getting better and better really fast. I" }, { "start": 261.12, "end": 265.72, "text": " remember the the first years of Google Translate when people still made fun of" }, { "start": 265.72, "end": 271.12, "text": " it. I don't think many people make fun of it now. At least it's not a meme anymore." }, { "start": 271.12, "end": 278.16, "text": " So the better and better these systems were the more these" }, { "start": 278.16, "end": 285.32000000000005, "text": " metrics like BLÖ and RÖS have diverged from the humans and they're not really" }, { "start": 285.32000000000005, "end": 290.40000000000003, "text": " reliable anymore especially if you compare really high skill systems to" }, { "start": 290.4, "end": 296.76, "text": " each other. BLÖ tends to not correlate well with humans and therefore we're" }, { "start": 296.76, "end": 301.52, "text": " looking for a new metric. A new metric that correlates well with humans but can" }, { "start": 301.52, "end": 311.79999999999995, "text": " be evaluated automatically. This paper here proposes this BLÖRT. Can we" }, { "start": 311.79999999999995, "end": 316.76, "text": " just stop with the variance on BÖRT? We get it, you use BÖRT for everything but you" }, { "start": 316.76, "end": 324.2, "text": " know. They say it's a learned evaluation metric based on BÖRT that can" }, { "start": 324.2, "end": 331.71999999999997, "text": " model human judgments with a few thousand possibly biased training examples." }, { "start": 331.71999999999997, "end": 341.59999999999997, "text": " What you would do in these cases is now the creation of a metric becomes" }, { "start": 341.6, "end": 350.16, "text": " a machine learning task itself. What you'll have is a data set of" }, { "start": 350.16, "end": 356.96000000000004, "text": " things that are gold standard translations by humans. You will have the" }, { "start": 356.96000000000004, "end": 361.64000000000004, "text": " output of the machine translation system. You put them together so you have" }, { "start": 361.64000000000004, "end": 365.48, "text": " the gold standard sentence. This would be the optimal translation." }, { "start": 365.48, "end": 368.96000000000004, "text": " You'll have whatever the machine translation produced and then you'll" }, { "start": 368.96, "end": 374.84, "text": " have a human look at it and create a score like this 8 right here. It says" }, { "start": 374.84, "end": 382.59999999999997, "text": " these two sentences match 8 good. So 8 maybe it's out of 10." }, { "start": 382.59999999999997, "end": 387.56, "text": " This bottom thing is a very good translation for the top thing," }, { "start": 387.56, "end": 393, "text": " to match the top thing. The human assesses the quality of the sample." }, { "start": 393, "end": 402.68, "text": " Now you have a training data set. You have a z and z tilde or something or y." }, { "start": 402.68, "end": 410.76, "text": " They call this y which is the gold standard label. This is y tilde," }, { "start": 410.76, "end": 418.28, "text": " whatever the machine produced and or x tilde and then y is the label." }, { "start": 418.28, "end": 424.44, "text": " Your task is now given x and x tilde predict whatever the human would say" }, { "start": 424.44, "end": 431, "text": " about this. If you can collect a few of these samples right here of" }, { "start": 431, "end": 436.47999999999996, "text": " different machine translation systems then you can formulate, you can make a" }, { "start": 436.47999999999996, "end": 442.11999999999995, "text": " data set out of this and formulate a machine learning task. That's" }, { "start": 442.11999999999995, "end": 447.11999999999995, "text": " exactly what these competitions have done. It's like a meta competition." }, { "start": 447.12, "end": 452, "text": " It's a competition for designing the best metrics of the other" }, { "start": 452, "end": 457.68, "text": " competitions. Of course the difficulty here is that the data set" }, { "start": 457.68, "end": 462.52, "text": " isn't static because if you come up with a metric such as blue, let's say you come" }, { "start": 462.52, "end": 468.2, "text": " up with a better blue, you would want these other tasks to use it in" }, { "start": 468.2, "end": 472.24, "text": " the next years as well. The thing about metrics is you need to be able" }, { "start": 472.24, "end": 476.72, "text": " to compare to previous years and so on. You would want a metric that is" }, { "start": 476.72, "end": 481.84000000000003, "text": " still valid for other years and other slightly different" }, { "start": 481.84000000000003, "end": 486.8, "text": " tasks and also for other machine translation systems. If you just learn" }, { "start": 486.8, "end": 495.48, "text": " on data from this year's competitions and in five years all of" }, { "start": 495.48, "end": 498.8, "text": " these models will have become so much better and they'll produce different" }, { "start": 498.8, "end": 504.20000000000005, "text": " output and that's the difficulty. Your metric should still be valid at that" }, { "start": 504.2, "end": 511, "text": " point. This paper basically deals with the fact that can you" }, { "start": 511, "end": 516.84, "text": " learn such a metric from data that exists at one point in time that will" }, { "start": 516.84, "end": 522.72, "text": " be robust to shifts in distribution. In five years the machine translation" }, { "start": 522.72, "end": 526.72, "text": " systems are better. They maybe use different language constructs to" }, { "start": 526.72, "end": 531.4, "text": " translate certain things because they assess that better. Can you still" }, { "start": 531.4, "end": 535.68, "text": " make a good judgment about which of these systems is better than" }, { "start": 535.68, "end": 540.84, "text": " the other system? Can you still assess how humans would rate these systems?" }, { "start": 540.84, "end": 549.24, "text": " They're saying that they found the method to do this. This blurt, as" }, { "start": 549.24, "end": 554.48, "text": " they said, not only have they found the method but their method only uses a" }, { "start": 554.48, "end": 561.12, "text": " few thousand possibly biased training examples. They do this via a new" }, { "start": 561.12, "end": 565.6, "text": " pre-training scheme. They say a key aspect of our approach is a novel" }, { "start": 565.6, "end": 570.84, "text": " pre-training scheme that uses millions of synthetic examples to help the model" }, { "start": 570.84, "end": 575.4, "text": " generalize. Why is it important that it only uses a few thousand training" }, { "start": 575.4, "end": 581.2, "text": " examples? Because these are generated by humans and humans are expensive." }, { "start": 581.2, "end": 589.08, "text": " It's not like ImageNet. You do it once, you have it for for 20 years." }, { "start": 589.08, "end": 594.88, "text": " This is done year after year and you need real experts like translation experts." }, { "start": 594.88, "end": 600.88, "text": " This is expensive. The fewer of these actual training examples that the" }, { "start": 600.88, "end": 609.12, "text": " thing can be efficient on, the better. They circumvent this by using" }, { "start": 609.12, "end": 613.6, "text": " millions of synthetic examples to help the model generalize. They do this in a" }, { "start": 613.6, "end": 619.6, "text": " pre-training step. Blurt provides state-of-the-art results on the" }, { "start": 619.6, "end": 624.48, "text": " last three years of the WMT metrics shared tasks. This is this" }, { "start": 624.48, "end": 630.6, "text": " meta task where you're asked to come up with a metric for the other tasks." }, { "start": 630.6, "end": 635.72, "text": " The WebNLG competition dataset, in contrast to a vanilla bird-based" }, { "start": 635.72, "end": 639.8000000000001, "text": " approach, yields superior results even when the training data is scarce and out" }, { "start": 639.8, "end": 648.28, "text": " of distribution. Let's have a look at what they do." }, { "start": 648.28, "end": 655.1999999999999, "text": " They say what do we need to do to fine-tune BERT for quality evaluation?" }, { "start": 655.1999999999999, "end": 661.68, "text": " If you don't know what BERT is, it's basically a model that takes" }, { "start": 661.68, "end": 667.4799999999999, "text": " in a bunch of text. You have a bunch of text and then it's a model that is a" }, { "start": 667.48, "end": 673.08, "text": " transformer. I've made a video on it if you want to check that out." }, { "start": 673.08, "end": 679.04, "text": " As outputs you get a sequence of vectors, but important most of the" }, { "start": 679.04, "end": 684.52, "text": " time is only the first one, which you then use in a subsequent task. For" }, { "start": 684.52, "end": 688.36, "text": " example, if you want to do classification, you would put a" }, { "start": 688.36, "end": 693.76, "text": " classification layer on top to classify it into certain classes. If you want to do" }, { "start": 693.76, "end": 699.08, "text": " regression, you can do other things with these outputs right here," }, { "start": 699.08, "end": 708.28, "text": " but for this particular paper only this CLS output is relevant." }, { "start": 708.28, "end": 714.48, "text": " You would input this pair of gold standard and output of the machine and the" }, { "start": 714.48, "end": 721.36, "text": " output would be an output Y, which is either a number or a class label." }, { "start": 721.36, "end": 731.76, "text": " In this case it's a number. You input these two things and" }, { "start": 731.76, "end": 739.04, "text": " out comes this whole sequence. You take the CLS output vector and you" }, { "start": 739.04, "end": 743.6800000000001, "text": " put it through a linear layer, weights and bias, and that would output" }, { "start": 743.6800000000001, "end": 750.52, "text": " a number Y. The number Y you train to be as close as possible to what" }, { "start": 750.52, "end": 756.76, "text": " the human would say about this pair X, the gold standard, and X tilde, the" }, { "start": 756.76, "end": 763.12, "text": " output of the system. This is what you would do if you were simply going" }, { "start": 763.12, "end": 768.4, "text": " about it. Just take BERT, take the model, so BERT is really good at language," }, { "start": 768.4, "end": 776.28, "text": " take the model and train it on this data set. However, fine-tuning BERT" }, { "start": 776.28, "end": 781.36, "text": " requires a sizable amount of IID data. We don't have that in these tasks," }, { "start": 781.36, "end": 786.4399999999999, "text": " which is less than ideal for a metric that should generalize to a variety of" }, { "start": 786.4399999999999, "end": 792.72, "text": " tasks and model drift. The problem with just applying BERT here is that" }, { "start": 792.72, "end": 797.88, "text": " you don't have enough data and it won't be a robust solution." }, { "start": 797.88, "end": 802.92, "text": " It will only work for this particular data set that you train it on. The" }, { "start": 802.92, "end": 808.68, "text": " solution they say is you pre-train on synthetic data. What does that mean?" }, { "start": 808.68, "end": 817.36, "text": " They say the key aspect of our approach is a pre-training technique that we use" }, { "start": 817.36, "end": 823.8, "text": " to warm up BERT before fine-tuning on the rating data. You might know BERT" }, { "start": 823.8, "end": 829.8, "text": " training, which is where you do this masked language model pre-training." }, { "start": 829.8, "end": 834.5999999999999, "text": " If you are given a piece of text, let's say you're given this piece of text" }, { "start": 834.5999999999999, "end": 838.3199999999999, "text": " right here, what you would do is you would drop out a couple of words like" }, { "start": 838.3199999999999, "end": 842.9599999999999, "text": " this one and this one and ask BERT to reconstruct it, like a denoising" }, { "start": 842.9599999999999, "end": 849.2199999999999, "text": " autoencoder. That way BERT learns about language in this" }, { "start": 849.2199999999999, "end": 853.9399999999999, "text": " particular way. They're not saying you should replace that. What they're" }, { "start": 853.94, "end": 859.84, "text": " saying is first you should do this masked language model pre-training," }, { "start": 859.84, "end": 867.08, "text": " second you should do their synthetic pre-training and third you should do the" }, { "start": 867.08, "end": 876.32, "text": " fine-tuning. In the naive approach you would skip this step" }, { "start": 876.32, "end": 881.1600000000001, "text": " too. Their claim is that by introduction of this step too, that you could be a" }, { "start": 881.16, "end": 886.9599999999999, "text": " lot better and a lot more robust. You're already" }, { "start": 886.9599999999999, "end": 892.6, "text": " exposed to information in this step that will make you more robust to" }, { "start": 892.6, "end": 899.48, "text": " distribution shifts in this fine-tuning data later. I've" }, { "start": 899.48, "end": 903.7199999999999, "text": " advocated for this step to be called" }, { "start": 903.72, "end": 911.32, "text": " priming. Because otherwise you always have to say, okay I" }, { "start": 911.32, "end": 915.36, "text": " want to pre-train BERT but I don't mean pre-pre-training, like I don't" }, { "start": 915.36, "end": 920.64, "text": " mean this. This is already called pre-training. I want to pre-train after" }, { "start": 920.64, "end": 929.1, "text": " pre-train, so I just vote for this to be called priming. I have no idea." }, { "start": 929.1, "end": 933, "text": " If you come up with stuff like this, probably you've heard it somewhere." }, { "start": 933, "end": 938.92, "text": " I guess I might not be the inventor of this, but it is a good sounding word and" }, { "start": 938.92, "end": 946.32, "text": " it sort of fits. They say we generate a large number of synthetic" }, { "start": 946.32, "end": 950.88, "text": " reference candidate pairs. What they're going to do is take a" }, { "start": 950.88, "end": 956.68, "text": " bunch of text and in their case I think it's Wikipedia. For each Wikipedia" }, { "start": 956.68, "end": 963.16, "text": " article they're going to draw" }, { "start": 963.16, "end": 968.56, "text": " sentences or samples or paragraphs from Wikipedia. These are going to be" }, { "start": 968.56, "end": 976.8399999999999, "text": " your Z and then they're going to kind of muddle with them a bit. They're going to" }, { "start": 976.8399999999999, "end": 982.4799999999999, "text": " disturb them a bit, to make them a bit different, to make them go Z tilde." }, { "start": 982.48, "end": 987.24, "text": " This simulates the difference between what the machine translation" }, { "start": 987.24, "end": 991.64, "text": " outputs and the gold standard sentence. They're usually not exactly the same," }, { "start": 991.64, "end": 995.16, "text": " if you translate a sentence there are many ways you can do it. Their goal" }, { "start": 995.16, "end": 1001.44, "text": " is to produce a data set that has sentences and perturbed versions" }, { "start": 1001.44, "end": 1006.6, "text": " of the sentence, but not perturbed randomly, but perturbed in a" }, { "start": 1006.6, "end": 1012.5600000000001, "text": " language knowledgeable way. How do they do this?" }, { "start": 1012.5600000000001, "end": 1020.6, "text": " They have three different ways. First of all mask filling with BERT. What" }, { "start": 1020.6, "end": 1024.4, "text": " they're doing is they take a BERT that can do language modeling, a" }, { "start": 1024.4, "end": 1028.84, "text": " pre-trained BERT. Let's again say we have this text right here and they" }, { "start": 1028.84, "end": 1035.04, "text": " simply drop out two words or so and fill them in again with BERT. BERT might" }, { "start": 1035.04, "end": 1039.24, "text": " produce the same words or it might produce slightly different words." }, { "start": 1039.24, "end": 1043.2, "text": " Depending on how many you drop out you can choose the amount that you" }, { "start": 1043.2, "end": 1053.8, "text": " perturb these sentences. The second is they back translate. What they do" }, { "start": 1053.8, "end": 1059.8799999999999, "text": " with back translation is they use a machine translation model. It doesn't" }, { "start": 1059.88, "end": 1066.72, "text": " matter which one you take. They use any machine translation model to take a" }, { "start": 1066.72, "end": 1072.92, "text": " sentence and then they map it to another language, say from English to" }, { "start": 1072.92, "end": 1081.8000000000002, "text": " French. This is Z French and then they map it back again. The Z tilde is" }, { "start": 1081.8000000000002, "end": 1087.16, "text": " now the French to English translation. You need two translation models. First" }, { "start": 1087.16, "end": 1092.1200000000001, "text": " you translate it to French and then you translate it back again. That would" }, { "start": 1092.1200000000001, "end": 1095.44, "text": " sometimes give you the same sentence but often it will give you sort of a" }, { "start": 1095.44, "end": 1101.52, "text": " paraphrase of the sentence that you had at the beginning. That would be" }, { "start": 1101.52, "end": 1107.92, "text": " the second version that you could make pairs of sentences that are sort of" }, { "start": 1107.92, "end": 1113.24, "text": " similar. The third way is just to drop out words. They just found this to" }, { "start": 1113.24, "end": 1119.88, "text": " help. Now they have a giant data set of sentences and perturbed versions of" }, { "start": 1119.88, "end": 1125.48, "text": " sentences. What are they going to do with that giant data set? The answer is" }, { "start": 1125.48, "end": 1132.52, "text": " they're going to take this Z and Z tilde and you're going to put that into BERT" }, { "start": 1132.52, "end": 1138.8, "text": " into their thing that they prime now. This is the priming stage. This" }, { "start": 1138.8, "end": 1141.84, "text": " was pre-trained on mask language modeling. Now they want to prime it. What" }, { "start": 1141.84, "end": 1146.32, "text": " are they going to do? They're going to take this CLS vector. Of course this" }, { "start": 1146.32, "end": 1151.48, "text": " is not the final task and we don't have final labels for these two things." }, { "start": 1151.48, "end": 1157.6399999999999, "text": " We need to somehow come up with our own tasks and labels for them. They" }, { "start": 1157.6399999999999, "end": 1166.8, "text": " decide to go a whole bunch of tasks. They go like... I don't even" }, { "start": 1166.8, "end": 1172.56, "text": " know. They go eight or so or five or so different tasks. They construct different" }, { "start": 1172.56, "end": 1179.28, "text": " tasks to perform with these two things. This could be metrics like BLÖ or" }, { "start": 1179.28, "end": 1185.12, "text": " RÖSCH or this BERT score right here. You simply calculate the n-gram overlap" }, { "start": 1185.12, "end": 1191.24, "text": " between Z and Z' that would be one of the scores. It could be the back" }, { "start": 1191.24, "end": 1196.3999999999999, "text": " translation likelihood which is how likely does a back translation model" }, { "start": 1196.4, "end": 1202.72, "text": " assess the sentence. Here are all the things. Six different tasks." }, { "start": 1202.72, "end": 1210.24, "text": " The catch here is... What would happen for example with" }, { "start": 1210.24, "end": 1217.0400000000002, "text": " BLÖ is you would take a model and you would calculate the BLÖ score between" }, { "start": 1217.0400000000002, "end": 1221.8400000000001, "text": " those two things. But you wouldn't input that into BERT. You would ask BERT to" }, { "start": 1221.84, "end": 1229.9599999999998, "text": " predict the BLÖ score. BERT would be outputting B hat and B would be" }, { "start": 1229.9599999999998, "end": 1235.72, "text": " the actual BLÖ score. You would train BERT to predict the BLÖ score of this" }, { "start": 1235.72, "end": 1242.28, "text": " particular pair of inputs. One you take as the input and the" }, { "start": 1242.28, "end": 1247.52, "text": " other one you take as the reference. You would ask BERT to predict the" }, { "start": 1247.52, "end": 1252.24, "text": " BLÖ score of this. To predict the RÖSCH score. You would ask all of these" }, { "start": 1252.24, "end": 1257.72, "text": " signals. You ask the same model. You ask to predict all of these scores" }, { "start": 1257.72, "end": 1262.76, "text": " for these two things. You can calculate all of these scores by either" }, { "start": 1262.76, "end": 1269.36, "text": " BLÖ is like a script you run or you have some other model like a pre-trained" }, { "start": 1269.36, "end": 1276.76, "text": " translation model that you use to assess the... that you ask how good is this in" }, { "start": 1276.76, "end": 1282.76, "text": " terms of this particular task back translation and then you try to predict" }, { "start": 1282.76, "end": 1287.44, "text": " that score. It's important you're not training the model to perform these" }, { "start": 1287.44, "end": 1293.36, "text": " tasks. These tasks you already have another model that's specialized to" }, { "start": 1293.36, "end": 1299.56, "text": " these particular tasks and you simply ask them to score the input. You have" }, { "start": 1299.56, "end": 1304.52, "text": " an entailment model that outputs how much by how much does the second sentence" }, { "start": 1304.52, "end": 1308.84, "text": " entail the first that basically means does the second sentence follow from" }, { "start": 1308.84, "end": 1314.72, "text": " the first and of course this is not you know it's not actually proper input data" }, { "start": 1314.72, "end": 1318.72, "text": " for that task but you can still ask the model and if these are good" }, { "start": 1318.72, "end": 1322.56, "text": " translations of each other if these sentences match then the second one" }, { "start": 1322.56, "end": 1328.6399999999999, "text": " should probably follow fairly well for the first but at least you can if you" }, { "start": 1328.6399999999999, "end": 1333.08, "text": " make BERT predict that it will learn something useful about the relation" }, { "start": 1333.08, "end": 1338.36, "text": " between the two sentences. So the entire game name of the game in here is to come" }, { "start": 1338.36, "end": 1344.1599999999999, "text": " up with tasks that if BERT learns to predict the score of these tasks on" }, { "start": 1344.1599999999999, "end": 1350.4399999999998, "text": " those inputs sorry on pretending one is the input and the other one is the" }, { "start": 1350.4399999999998, "end": 1356.3999999999999, "text": " output or on the two inputs and then trying to predict the score then BERT" }, { "start": 1356.4, "end": 1364, "text": " would learn something useful. So that's the trick here is to" }, { "start": 1364, "end": 1368.4, "text": " come up with these pre-training tasks and you train them all at the same time" }, { "start": 1368.4, "end": 1373.24, "text": " and by doing it all at the same time and by doing it on many many different" }, { "start": 1373.24, "end": 1377.3600000000001, "text": " perturbations on these different tasks you hope that your model learns" }, { "start": 1377.3600000000001, "end": 1384.2800000000002, "text": " something it's kind of becoming attuned to the variations that language can have" }, { "start": 1384.28, "end": 1389.52, "text": " and what it needs to pay attention to and then you hope that if you then have" }, { "start": 1389.52, "end": 1395.04, "text": " done this then take this model and then do step three which is fine-tuning on" }, { "start": 1395.04, "end": 1399.2, "text": " the actual data you have you would guess that it becomes very good at that data" }, { "start": 1399.2, "end": 1406.6, "text": " but also it retains all of these abilities and generalizes better to" }, { "start": 1406.6, "end": 1416.6799999999998, "text": " other sort of distribution shifts. So that is the thing here and" }, { "start": 1416.6799999999998, "end": 1424.24, "text": " on this metric learning tasks they do outperform all other models" }, { "start": 1424.24, "end": 1431.24, "text": " right here and what I find interesting is down here where they now test for" }, { "start": 1431.24, "end": 1443.68, "text": " the distribution shift so what they're saying is okay this is all on" }, { "start": 1443.68, "end": 1448.96, "text": " data basically where you know we train on training data and evaluate on testing" }, { "start": 1448.96, "end": 1452.2, "text": " data and they're sort of the same they come from the same year from the same" }, { "start": 1452.2, "end": 1458.52, "text": " machine translation models and we don't really know how you know next" }, { "start": 1458.52, "end": 1461.8799999999999, "text": " year the machine translation models might be different thus our scores still" }, { "start": 1461.8799999999999, "end": 1468.68, "text": " hold so they try to simulate this by splitting the data and they introduce" }, { "start": 1468.68, "end": 1474.24, "text": " this skew factor so what they'll do is they'll split the data so usually as you" }, { "start": 1474.24, "end": 1478.98, "text": " can see right here the training date the ratings these are the human ratings the" }, { "start": 1478.98, "end": 1487.76, "text": " training data is sort of distributed like this would be the test data and the" }, { "start": 1487.76, "end": 1491.92, "text": " training data would almost be overlapping that if you can see like" }, { "start": 1491.92, "end": 1499.16, "text": " the dotted lines right here or so so you can see the overlap between the test and" }, { "start": 1499.16, "end": 1504.2, "text": " the trained of the human ratings is very close now they say we can we can skew" }, { "start": 1504.2, "end": 1511.28, "text": " that we can sort of filter the data such that in the training data only very bad" }, { "start": 1511.28, "end": 1517.2, "text": " sentences are and in the test data there are only very good sentences okay and" }, { "start": 1517.2, "end": 1522.56, "text": " this simulates the fact that you know we this might be the previous year's data" }, { "start": 1522.56, "end": 1527.56, "text": " that we train our metric on and then we we evaluate it on the next year's data" }, { "start": 1527.56, "end": 1534.72, "text": " where all the systems have become better and what this does is you can see right" }, { "start": 1534.72, "end": 1542.48, "text": " here the bottom axis is the test skew and the color here is the training skew" }, { "start": 1542.48, "end": 1550.68, "text": " okay so what interests what what we're interested in is to the right and down" }, { "start": 1550.68, "end": 1557.72, "text": " the colors so as these skew increases you can see right here that the the" }, { "start": 1557.72, "end": 1562.52, "text": " quality of the metric decreases okay the correlation with the human ratings" }, { "start": 1562.52, "end": 1570.96, "text": " decreases but it it still remains fairly well but especially the training skew if" }, { "start": 1570.96, "end": 1575.6000000000001, "text": " you update the train so if you make the training examples really bad so to say" }, { "start": 1575.6000000000001, "end": 1580.72, "text": " it the score just drops down and they can show pretty well here that if you" }, { "start": 1580.72, "end": 1587.04, "text": " add this pre training then the score except in this extreme case so the" }, { "start": 1587.04, "end": 1591.48, "text": " score for all of these it remains relatively high and especially remains" }, { "start": 1591.48, "end": 1598.52, "text": " above the blue score which is always sort of worse right so this is is pretty" }, { "start": 1598.52, "end": 1607.08, "text": " as pretty neat and shows this power of this pre training basically that's" }, { "start": 1607.08, "end": 1612, "text": " that's the the robustness to quality drift metric and they have a bunch of" }, { "start": 1612, "end": 1617.32, "text": " other metrics right here where they ablate and so on but I don't want to go" }, { "start": 1617.32, "end": 1624.48, "text": " too much into that I more want to make some comments on on this work so what" }, { "start": 1624.48, "end": 1629.4, "text": " what I think so first of all in a paper like this what what I would like to see" }, { "start": 1629.4, "end": 1637.28, "text": " is like the extrapolation right here to if and where this ever crosses the the" }, { "start": 1637.28, "end": 1642.92, "text": " blue score right because I mean okay it seems like yeah this skew of three is a" }, { "start": 1642.92, "end": 1647.96, "text": " is a big number but who knows if three is a big number right who like we can't" }, { "start": 1647.96, "end": 1652.3600000000001, "text": " assess that what we need to see is really the where the crossover point" }, { "start": 1652.36, "end": 1658.1999999999998, "text": " between the models to assess where does it where is it no longer valid and so on" }, { "start": 1658.1999999999998, "end": 1663.84, "text": " the second part here is that my problem with this method of splitting the data I" }, { "start": 1663.84, "end": 1669.08, "text": " mean yes okay you split the bad from the good but it's not it's not only that" }, { "start": 1669.08, "end": 1674.32, "text": " these things are getting better so right now everyone's using transformers for" }, { "start": 1674.32, "end": 1677.84, "text": " everyone's using BERT for everything right and BERT is a specific" }, { "start": 1677.84, "end": 1682.9599999999998, "text": " architecture that is going to be good at specific things at specific grammatical" }, { "start": 1682.9599999999998, "end": 1688.1599999999999, "text": " constructs in specific languages right so it's the mistakes it makes are very" }, { "start": 1688.1599999999999, "end": 1693.76, "text": " systematic now if in one year or two years all of a sudden the a new model" }, { "start": 1693.76, "end": 1698.6, "text": " pops up I don't know like someone discovers that graph neural networks are" }, { "start": 1698.6, "end": 1702.8, "text": " really good at machine translation these models are going to be attuned to a very" }, { "start": 1702.8, "end": 1708.08, "text": " very different set of construct they might be better overall but they're" }, { "start": 1708.08, "end": 1712.8799999999999, "text": " going to make a different sort of mistake and so I think just assessing" }, { "start": 1712.8799999999999, "end": 1719.04, "text": " the skew via just dividing up the data in into bad and good ratings I don't" }, { "start": 1719.04, "end": 1724.1599999999999, "text": " think that covers these distribution shifts that they set out to cover right" }, { "start": 1724.1599999999999, "end": 1728.9199999999998, "text": " what I would have expected is something like them because these tasks are" }, { "start": 1728.92, "end": 1735.04, "text": " repeated year after year and I would have expected them to for example train" }, { "start": 1735.04, "end": 1741.8400000000001, "text": " on 2017 and then evaluate on 2019 or something like or show like evaluate on" }, { "start": 1741.8400000000001, "end": 1748.4, "text": " 2017 2018 and 2019 and there we would have a much better assessment of a" }, { "start": 1748.4, "end": 1755.5600000000002, "text": " distribution shift over the years right so so it is not super convincing to me" }, { "start": 1755.56, "end": 1760.8799999999999, "text": " and what is most worrisome is if you look at their pre training tasks I mean" }, { "start": 1760.8799999999999, "end": 1767.84, "text": " okay there is a there's blur and rouge but there is BERT score right there is" }, { "start": 1767.84, "end": 1772.96, "text": " entailment which is also a BERT model and the back translation I mean who" }, { "start": 1772.96, "end": 1778.1599999999999, "text": " knows that's probably either going to be a transformer or a LSTM with an" }, { "start": 1778.1599999999999, "end": 1782.96, "text": " attention mechanism which is the attention mechanism is the basis for" }, { "start": 1782.96, "end": 1788.44, "text": " transformers so all of these things are basically going to make the same sort of" }, { "start": 1788.44, "end": 1794.68, "text": " bias mistakes right they're doing to to it's not it's not like there is Gaussian" }, { "start": 1794.68, "end": 1800.16, "text": " noise on top of these things all of these things are going to be weak in the" }, { "start": 1800.16, "end": 1805.16, "text": " same sort of assessments and not agree with like they're going to have" }, { "start": 1805.16, "end": 1809.8, "text": " systematic errors in them with respect to them predicting the human scores and" }, { "start": 1809.8, "end": 1817.24, "text": " if we evaluate our systems that some are also using exactly that thing right so" }, { "start": 1817.24, "end": 1823.32, "text": " these the systems we evaluate they are using the same type of models as here" }, { "start": 1823.32, "end": 1827.8799999999999, "text": " they're going to fall prey to the same type of mistakes and then if we switch" }, { "start": 1827.8799999999999, "end": 1833.24, "text": " over to systems that use some different right so next year we have some systems" }, { "start": 1833.24, "end": 1840.6, "text": " that use different techniques they're going to be like exactly maybe not bad" }, { "start": 1840.6, "end": 1845.2, "text": " in these particular things but bad in other things and then this thing will" }, { "start": 1845.2, "end": 1849.96, "text": " output a systematically biased assessment so it's sort of a house of" }, { "start": 1849.96, "end": 1855.28, "text": " like if you've seen these images of plugging in the power strip into itself" }, { "start": 1855.28, "end": 1860.48, "text": " and you have infinite power it's like it's very to me it seems very dangerous" }, { "start": 1860.48, "end": 1867.2, "text": " to have as such an overlap of architectures and methods to evaluate" }, { "start": 1867.2, "end": 1874.68, "text": " systems as you have in the systems themselves but I hope this will be" }, { "start": 1874.68, "end": 1880.68, "text": " regularly checked with human scores and assessed as to how much these systems" }, { "start": 1880.68, "end": 1886.08, "text": " are out of sync or in sync with humans all right this was it for me for blurt" }, { "start": 1886.08, "end": 1891.1599999999999, "text": " check out they have the code available the metric is available evaluate your" }, { "start": 1891.16, "end": 1919.72, "text": " stuff with it and bye bye" } ]
4GKCxJQSw-g
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Synthetic Petri Dish: A Novel Surrogate Model for Rapid Architecture Search (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nas", "nao", "uber", "openai", "architecture search", "neural architecture search", "inner loop", "inner optimization", "small", "abstract", "turing", "performance", "evolutionary algorithm", "outer loop", "mlp", "sigmoid", "ptb", "rnn", "cell", "meta-learning" ]
Neural Architecture Search is usually prohibitively expensive in both time and resources to be useful. A search strategy has to keep evaluating new models, training them to convergence in an inner loop to find out if they are any good. This paper proposes to abstract the problem and extract the essential part of the architecture to be optimized into a smaller version and evaluates that version on specifically custom learned data points to predict its performance, which is much faster and cheaper than running the full model. OUTLINE: 0:00 - Intro & High-Level Overview 1:00 - Neural Architecture Search 4:30 - Predicting performance via architecture encoding 7:50 - Synthetic Petri Dish 12:50 - Motivating MNIST example 18:15 - Entire Algorithm 23:00 - Producing the synthetic data 26:00 - Combination with architecture search 27:30 - PTB RNN-Cell Experiment 29:20 - Comments & Conclusion Paper: https://arxiv.org/abs/2005.13092 Code: https://github.com/uber-research/Synthetic-Petri-Dish Abstract: Neural Architecture Search (NAS) explores a large space of architectural motifs -- a compute-intensive process that often involves ground-truth evaluation of each motif by instantiating it within a large network, and training and evaluating the network with thousands of domain-specific data samples. Inspired by how biological motifs such as cells are sometimes extracted from their natural environment and studied in an artificial Petri dish setting, this paper proposes the Synthetic Petri Dish model for evaluating architectural motifs. In the Synthetic Petri Dish, architectural motifs are instantiated in very small networks and evaluated using very few learned synthetic data samples (to effectively approximate performance in the full problem). The relative performance of motifs in the Synthetic Petri Dish can substitute for their ground-truth performance, thus accelerating the most expensive step of NAS. Unlike other neural network-based prediction models that parse the structure of the motif to estimate its performance, the Synthetic Petri Dish predicts motif performance by training the actual motif in an artificial setting, thus deriving predictions from its true intrinsic properties. Experiments in this paper demonstrate that the Synthetic Petri Dish can therefore predict the performance of new motifs with significantly higher accuracy, especially when insufficient ground truth data is available. Our hope is that this work can inspire a new research direction in studying the performance of extracted components of models in an alternative controlled setting. Authors: Aditya Rawal, Joel Lehman, Felipe Petroski Such, Jeff Clune, Kenneth O. Stanley Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're looking at Synthetic Petri dish, a novel surrogate model for rapid architecture search by Adi Tarawal, Joel Lehman, Felipe Petroski-Sucs, Jeff Klun 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. So it basically means you want to find a neural architecture, let's say you have a multi-layer perceptron right here, a couple of layers, okay, and they're all connected by you know feet forward weights whatnot and each of these weights basically is a multiplication. So each one of these is a multiplication of X by your weight W and then there is a non-linearity. So the non-linearity could be a sigmoid. So the sigmoid would be something like 1 over 1 plus e to the negative X. Now there's a bit of an extension in a sigmoid where you can do a sigmoid that has like a temperature parameter attached or a slope parameter where you go CX. So in one case you can set C such that the sigmoid has a shape like this and then if you put C to a different value you can make this slope, you can make it like a shape, well this is terrible, like this. You know what I mean. Okay so this this C right here can potentially change the behavior of your network and you want to find a good parameter C and this is a hyper parameter. Now there are many hyper parameters like this for example how many units you have in a particular layer in a CNN it could be your filter size in a transformer could be the number of heads and so on. It could actually be not only the slope of the non-linearity but the actual non-linearity itself or famously in recurrent neural networks you have these recurrent cells and they're like okay we have an input signal and a carry signal and then the input here is like dot multiplied here and then there is like a gate with a non-linearity and then it's kind of like multiplied by the carry but then there's also a like a forget gate and whatnot there's a minus right here. It's very complicated and so people do architecture search over these kind of problems to find better architectures for particular problems. Now the problem is of course that how do you know if a if a given architecture is good? What you have to do is you'll have to go take that cell that you have dreamed up you think well I think that's a good cell and you have to train it on the full training data set this is a data set a database right this is a full training data set then you need to evaluate it on your validation data set and then you have like a number you have like okay this is 8 good and then you go back and you say okay what if I change this cell here what if I change it to a plus instead of a minus and you do the entire thing again train it for I don't know how much validate it and then this is like a 9 and you can say oh cool that's a 9 so this is a very basic architecture search and there has been a lot of development in this space so like evolutionary search and so on but they most of the time they require pretty much evaluating the entire thing on the full data so you get a good you get a good estimate of what your final performance back here is going to be. Now people have come up with methods to counter that and they say well if we can sort of encode the cell structure let's go with the let's go with the RNN cell if we could encode the cell structure in in a sort of a continuous way so you know we can encode text in a continuous way let we could also encode a cell structure because the cell structure I can write it down as an equation I can say like okay it's the forget gate of the carry times the sigmoid output of x plus the so this is the plus here and plus the sigmoid output of x multiplied by the input let's call that I something like this right this is text I can like write it down and then I can encode that into a vector much I can for example build another RNN ironically or something to to encode that or I can represent it as a computation graph like it is here and use a graph neural network to encode that into a single vector and then I have sort of an embedding space where each cell that I could build is a point in that embedding space and then I can evaluate a couple of them I can for example say okay this one here this one here this one here this one here I'm going to train them these cells I'm going to do the full training eval and so on get their scores and then I can learn basically in this latent space I can learn a predictor I can say okay here I get I got an 8 I got a 9 I got a 2 and I got a 4 so it appears to be that in this direction that the good cells are in this direction and then I can do it again I can sample or I can do gradient descent in this space since this is now a continuous space and the gradient descent on the model that gives me this space so 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 a Turing machine right now then you like I I immediately thought of like this this halting problem because it appears to be exactly what it is so you're trying to build a machine that takes the building plan of another machine and tries to predict its performance now in a general sense we can already state that this problem is sort of the difficulty of this problem is equivalent to the difficulty of the original problem so I'm not sure but it appears to you know it appears to work if you throw lots of compute at it but of course that's a problem you need lots of compute right so either your your option one is to run all of these things and kind of iterate them in a neural sorry in an evolutionary way or your second option is to take the building plan and predict the performance from that both are not satisfactory and both use lots of compute now neuro petri dish is a or synthetic petri dish is a way to combine the two together it says can't we take the building plan here but actually run on the data on data to predict the performance so what they're saying is basically if I have this cell right here and usually this cell you know it deals with vectors of let's say size 512 and so on it will say it since this is let me draw it again up here so here you have the cell and here you have somehow the connections in there when you carry and the input and the input here okay and this is the output or the carry I have 512 embedding like size of this so this is a giant cell there's 512 the vector has 512 dimensions going in basically can't I take the exact same thing but and keep the connection pattern so I would keep the entire pattern of connection right here but I only do it for one or two so this is 512 and this is just two right just the I just reduce the dimensionality but I sort of keep the connection pattern alive if I only do that I have like a very small network right now and the same goes for if this is so a lot of times these RNNs they have multiple layers of these things so they have another exactly equal box up here and then another up here I can just reduce this to one layer and out of the regularity of these neural network things it is known that or one can make the assumption that the performance on this thing will sort of kind of be correlated to the performance of the entire thing and that's one of the things that this petri dish paper does so we try to take out what we are trying to search over namely the connection pattern we keep that as it is up here but we reduce everything else we reduce the dimensionality we reduce the number of layers and so on now they don't actually reduce the number of layers here but you can reduce the number of units and so on okay so this in essence this works whenever you can do that whenever you can keep the structure you're searching over but can reduce the rest so that's one precondition doesn't work for everything the second part here is that you don't want to use this particular training data and then this particular validation data because first of all it's a lot of training data and second of all it won't give you that good of a prediction instead of what you're trying to do and this is the second part of the idea of petri dish is you're trying to abstract the training data to get you a very small data set search that and the validation data as well as well search that if you train on this data and evaluate on this data the performance that you get will be very predictive of the performance had you trained the big model on the big data set okay in fact in this petri dish paper these little data sets they have nothing to do with the with the original train and validation data and that's I think that's one of the cool things here these things this training data and this validation data they are optimized as well by the procedure they're optimized special data points that are trained these are trained parameters such that if you train on the training on the small training data and evaluate on the small eval data the you will be able to predict this performance back here with high accuracy okay and this I think is where previous approaches have or might have failed because it's you know the the idea of scaling down your network in order to do the architecture search is probably has it has appeared to many people before that's not you know that's not really genius idea but probably they have all found that now we can't really do it it doesn't really give us accurate enough numbers but in this case the addition of adding these synthetic data sets that are much smaller but can still if you train and evaluate on them can still predict with high accuracy the full score of the full model that I think makes this idea work alright so I guess we're already through the idea and problem setting and everything without actually reading the paper so they give this example right here at the beginning that if you have a a two layer 100 wide so 100 dimensional MNIST networks it's two layers it's I think it's an MLP it's two layer MLP with a non-linearity that is this the sigmoid right here this okay now you can see it has this temperature parameter here it has this slope parameter and you you want to do neural architecture search to find the best slope parameter now usually you would just do a grid search but this is an 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 to convergence and then you eval on the validation data set you get the slope like the blue curve so if you see the blue curve the blue curve is if you start over here if you reduce this slope you'll gain in performance but if you reduce it too much you drop drastically okay until it's if it's if it's zero it's basically you know the the X is not the signal doesn't propagate anymore and you you have no learning occurring okay so that's the original performance now what if I only give you training data in this range right here I only showed you this particular range I can't actually zoom in that much but 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 touring touring machines you would basically say well that looks to me like a line so I'm gonna predict the red thing here and even if you can you know evaluate a bunch of these it just looks like a line and you're going to predict there's probably a slope like this right this happens almost independently of which model you choose to predict right here 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 the criticism about these models is valid that they will only work where you give them training data they can at best interpolate their training data but they can't really extrapolate now here since the synthetic petri dish method which is the green thing here uses the actual not the actual non-linearity that this thing characterizes so it it instantiates the sigmoid with the parameter C that you give it just not on the large network but on a small network in fact their network is just one unit sorry one unit and then another unit so it's just a two hidden layer but just with one unit instead of 100 and of course you can't feed in M nest right here right but we said they don't feed in the data they actually feed in their synthetic data that they learn so you give them the points here and they learn the synthetic data to to evaluate to evaluate the others and then once you ask them well if if my C is right here what's the performance going to be it's going to instantiate that in its small network it is going to use the training data that it has learned from this region right here in order to train this and then it's going to evaluate this on the synthetic validation data that is also learned on the training data and it is going to come up with a performance metric it says okay this is how good it's going to be and since it is an approximation in its building plan to the entire network it will react similarly so it will get that there is this performance dip right here okay so it you can see how this sort of makes sense you are actually running an approximation to the actual program instead of just looking at the plan of the program and trying to predict it which you know halting problem says hello okay so that is the motivating example of their MNIST thing and here is the entire algorithm all right so you take MNIST training and validation data and you instantiate a bunch of really big networks this is ground truth okay you you need this you need this to learn from you instantiate a bunch of really big networks now if I draw the graph from before right we had this was the performance of the actual networks you want you this comes from here from this region right here this is the training data okay so you instantiate a bunch of these networks each one you instantiate in one of them right each one gives rise to a different non-linearity and you do the full training ground truth training and evaluation on the full training set and the full validation set and you get validation losses right for each of these and these are the points right here now you that's the training data for your neural for your neural architecture search so for your petri dish method what the petri dish does is it says it extracts the motive and the motive is the thing that you optimize over so as I said you want to keep that thing in its essence but you want to reduce everything else so it reduces it instead of from a two layer on hundred 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 and we have that here would instantiate the neural network in the small form of that and now we know that if I train the full data and evaluate if I train on the full training data and evaluate on the full validation data I should get this accuracy all right so I will create and we're going to look at in a second I will create training and validation data such that if I train on this training data and then validate on this validation data I get the same validation loss as if I had trained the big network with the same you know the same C parameter on the full training data and evaluate in the full validation data okay so in this step I'm optimizing the data here the training and validation data all right and now in the second step once I have this training and validation data such like that I can basically reproduce this this graph right here then I can go and actually ask my model okay now please tell me what happens over here so what am I gonna do I'm gonna take that I'm gonna instantiate it I'm going to use my training data that I learned to train it when to use my validation data that I learned to evaluate it and it's gonna give me a number and that number is going to be like close to hopefully close to do this so this is how we can extrapolate using that method okay now there are a number of assumptions right here and you can imagine this doesn't work in any situation this works if if you you know if you basically you have to get lucky in that you have to abstract the correct things right I said you need to reduce everything else so they reduce notably you see they reduce the 100 the 100 layer width to a single neuron wide MLP and they sort of guess that that doesn't change the fundamental thing but you can also see they leave the two layer right they leave the two layer neural network and I'm can almost guarantee you that they tried this reducing this to a one layer neural network and it did not work and so you have to be sort of very careful of what quantities you abstract and what quantities you don't because okay now you might always think oh I can reduce the you know number of dimensions or channels that's also not always the case so I think that's kind of the crux of the method you have to actually engineer this down compressing of the architecture such that it's its properties are still kept and yeah but yeah in other things how do you how do you actually produce training and validation data to match these and there are a number of ways but what comes to mind is is meta learning right so because what you're doing they initialize the training and validation data at random points so these are just random at the beginning and then they optimize the data itself using gradient descent okay now see synthetic training data and they are randomly initialized okay and they use gradient descent they have it somewhere yes so they have this inner training loop okay which is many steps of inner training and then they have the outer loss which is the it's the validation loss after the inner training loop and the difference for that to the true validation loss and then they do gradient descent on this outer loss now this outer loss is a result of the inner loss and the inner loss is a result of the inner training procedure and the inner training procedure is n steps of feeding in the training data every step you feed in the training data so your computational graph is going to look like so here's your training data as train and here are your initial parameters you at random lies initialize them randomly in the first step you use the training data to produce theta one then in the second step you use your training perhaps your training data again to produce theta 2 and then you use it again to use data for me and so on each time you feed the training data in order to evolve your parameters to give you a better prediction right so the gradient since somewhere back here there's a loss the gradient here will have to flow back through all of these paths and through all of these connections to the training data this is kind of you back propagate through an optimization procedure and we have this a bunch of times here and I've looked at the code and the code is like really crazy and it looks like proper research code but it appears to be that that's actually what's happening they 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 inner 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 alright 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 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 you that way you don't have to evaluate all the like thousand candidates alright alright cool they do this for this M nest and they also do it for finding a RNN cell for the pen tree 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 date I believe the NAO gets to about here but of course if you give all of them the same data the neural the petri dish beats this method and I think still this method here uses way more compute because it always has to evaluate all the candidates and that's exactly one of these where I learn an architecture to predict the other architecture by just looking at it so it works but it doesn't work as well as actually running the architecture in an abstract fashion this also shows you the importance of selecting your experimental evaluation in a smart way like they argue they argue for very long why it makes sense to evaluate everything on reduced data such that their method here can be better and they don't have to compare to the full thing it's easier for them to work on reduced data and they argue you know it's it's it's what people usually do in practice and that's the task they focus on so you know good good good good paper writing right here yeah that's basically it to the paper there's a lot of things to be said here I think this works in very very limited settings it seems to me that it's sort of brittle with respect to how you abstract and also it it's always the case like how many how how large is this synthetic training data in their case there they like abstract this to 20 or 30 data points or something like this so it seems to me since you're optimizing this training data with gradient descent what you would mainly find are adversarial sort of adversarial examples to this architecture here so I'm going to guess that the inner optimization is very noisy and that's because if you really let your optimizer run then it will abuse every single thing it can to match that validation loss and that will usually lead to an adversarial example since you're optimizing the data itself okay so I think this suffers from that and this is we had this in the in the planning you know planning in in learned world models in reinforcement learning where if you have a really really good planner it will just abuse the mistakes that you make in approximating the true world and the same here you're going to make mistakes approximating this architecture here and the better your your optimizer is for producing this synthetic data the probably the worse the worse the result is going to match the worst that these losses are going to actually match now okay these losses will match because they're that's what you train for but the worst these two curves will match each other because now you're just finding adversarial examples for your particular training data another concern I have here is with respect to the double descent phenomenon so if you know the double descent phenomenon if here you have your number of parameters and here you have your validation loss let's say and you know that if I add parameters I can make my validation loss go down so this is assuming I have a model with p parameters and I always train it on the train data to like to convergence if I add parameters I can generalize better until a point where I add too many parameters and I start overfitting and my validation loss goes up again but the double descent phenomenon and I think I've done a video on this shows that after a certain threshold you get the interpolation threshold the validation loss goes actually down again it goes down even further here now I'm so this is a very strange phenomenon by itself but I'm sort of concerned that if you do this abstraction that this paper proposes so you read your let's say your full model is here with a large number of parameters so it is past this interpolation threshold if you now seriously reduce the number of parameters because you want to go into this petri dish you will get maybe you will cross this interpolation threshold and actually be on this side of the curve right here now of course at the same time you reduce the amount of data which would push you over here again but it is different data so I'm not sure how all of this is going to play out it appears to work in these settings right here but I I think this is it's it's sort of it's sort of applicable in some situations and it's it'd be very cool if we develop this further such that we understand when it applies and when we can use it because I feel this can be a very cool thing if we understand it better and if we can apply it throughout alright 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, "end": 4.96, "text": " Hi there! Today we're looking at Synthetic Petri dish, a novel surrogate model for" }, { "start": 4.96, "end": 11.040000000000001, "text": " rapid architecture search by Adi Tarawal, Joel Lehman, Felipe Petroski-Sucs, Jeff" }, { "start": 11.040000000000001, "end": 18, "text": " Klun and Kenneth O. Stanley. This paper on a high level, it basically says if you" }, { "start": 18, "end": 22.44, "text": " want to do neural architecture search, if you for example search for a better" }, { "start": 22.44, "end": 28.96, "text": " non-linearity, you should be able to extract that non-linearity instantiated" }, { "start": 28.96, "end": 34, "text": " in a very small network and then evaluate that very small network in order" }, { "start": 34, "end": 38.32, "text": " to predict the performance of a large network and therefore you can find a" }, { "start": 38.32, "end": 44.88, "text": " better non-linearity in much less time. Now the exact procedure how you do this" }, { "start": 44.88, "end": 50.32, "text": " in the small network is the topic of this paper. As always if you like content" }, { "start": 50.32, "end": 55.28, "text": " like this I encourage you to subscribe if you are not already and to share out" }, { "start": 55.28, "end": 61.68, "text": " the video so other people can experience the joy themselves. Alright, let's dive" }, { "start": 61.68, "end": 67.92, "text": " in. So they say in the abstract, neural architecture search explores a large" }, { "start": 67.92, "end": 75.56, "text": " space of architectural motives. So it basically means you want to find" }, { "start": 75.56, "end": 81.44, "text": " a neural architecture, let's say you have a multi-layer perceptron right here, a" }, { "start": 81.44, "end": 87, "text": " couple of layers, okay, and they're all connected by you know feet forward" }, { "start": 87, "end": 92.32, "text": " weights whatnot and each of these weights basically is a multiplication. So" }, { "start": 92.32, "end": 97.8, "text": " each one of these is a multiplication of X by your weight W and then there is a" }, { "start": 97.8, "end": 104.68, "text": " non-linearity. So the non-linearity could be a sigmoid. So the sigmoid would be" }, { "start": 104.68, "end": 110.44, "text": " something like 1 over 1 plus e to the negative X. Now there's a bit of an" }, { "start": 110.44, "end": 115.08, "text": " extension in a sigmoid where you can do a sigmoid that has like a temperature" }, { "start": 115.08, "end": 121.36, "text": " parameter attached or a slope parameter where you go CX. So in one case you can" }, { "start": 121.36, "end": 127.75999999999999, "text": " set C such that the sigmoid has a shape like this and then if you put C to a" }, { "start": 127.75999999999999, "end": 133.24, "text": " different value you can make this slope, you can make it like a shape, well this" }, { "start": 133.24, "end": 138.96, "text": " is terrible, like this. You know what I mean. Okay so this this C right here can" }, { "start": 138.96, "end": 144.12, "text": " potentially change the behavior of your network and you want to find a good" }, { "start": 144.12, "end": 148, "text": " parameter C and this is a hyper parameter. Now there are many hyper" }, { "start": 148, "end": 153.24, "text": " parameters like this for example how many units you have in a particular layer" }, { "start": 153.24, "end": 158.32, "text": " in a CNN it could be your filter size in a transformer could be the number of" }, { "start": 158.32, "end": 164.16, "text": " heads and so on. It could actually be not only the slope of the non-linearity but" }, { "start": 164.16, "end": 169.07999999999998, "text": " the actual non-linearity itself or famously in recurrent neural networks" }, { "start": 169.07999999999998, "end": 173.51999999999998, "text": " you have these recurrent cells and they're like okay we have an input" }, { "start": 173.51999999999998, "end": 179.2, "text": " signal and a carry signal and then the input here is like dot multiplied" }, { "start": 179.2, "end": 182.84, "text": " here and then there is like a gate with a non-linearity and then it's kind of" }, { "start": 182.84, "end": 187.64, "text": " like multiplied by the carry but then there's also a like a forget gate and" }, { "start": 187.64, "end": 192.92, "text": " whatnot there's a minus right here. It's very complicated and so people do" }, { "start": 192.92, "end": 197.64, "text": " architecture search over these kind of problems to find better architectures" }, { "start": 197.64, "end": 204.07999999999998, "text": " for particular problems. Now the problem is of course that how do you know if a" }, { "start": 204.07999999999998, "end": 209.76, "text": " if a given architecture is good? What you have to do is you'll have to go take" }, { "start": 209.76, "end": 214.33999999999997, "text": " that cell that you have dreamed up you think well I think that's a good cell" }, { "start": 214.33999999999997, "end": 219.44, "text": " and you have to train it on the full training data set this is a data set a" }, { "start": 219.44, "end": 224.72, "text": " database right this is a full training data set then you need to evaluate it on" }, { "start": 224.72, "end": 229.4, "text": " your validation data set and then you have like a number you have like okay" }, { "start": 229.4, "end": 235.2, "text": " this is 8 good and then you go back and you say okay what if I change this cell" }, { "start": 235.2, "end": 240.2, "text": " here what if I change it to a plus instead of a minus and you do the entire" }, { "start": 240.2, "end": 245.3, "text": " thing again train it for I don't know how much validate it and then this is" }, { "start": 245.3, "end": 250.84, "text": " like a 9 and you can say oh cool that's a 9 so this is a very basic architecture" }, { "start": 250.84, "end": 256.56, "text": " search and there has been a lot of development in this space so like" }, { "start": 256.56, "end": 260.68, "text": " evolutionary search and so on but they most of the time they require pretty" }, { "start": 260.68, "end": 266.16, "text": " much evaluating the entire thing on the full data so you get a good you get a" }, { "start": 266.16, "end": 271.12, "text": " good estimate of what your final performance back here is going to be. Now" }, { "start": 271.12, "end": 275.92, "text": " people have come up with methods to counter that and they say well if we can" }, { "start": 275.92, "end": 282.08, "text": " sort of encode the cell structure let's go with the let's go with the RNN cell" }, { "start": 282.08, "end": 288.32, "text": " if we could encode the cell structure in in a sort of a continuous way so you" }, { "start": 288.32, "end": 293, "text": " know we can encode text in a continuous way let we could also encode a cell" }, { "start": 293, "end": 298.12, "text": " structure because the cell structure I can write it down as an equation I can" }, { "start": 298.12, "end": 304.96, "text": " say like okay it's the forget gate of the carry times the sigmoid output of x" }, { "start": 304.96, "end": 314.36, "text": " plus the so this is the plus here and plus the sigmoid output of x multiplied" }, { "start": 314.36, "end": 320.4, "text": " by the input let's call that I something like this right this is text I can like" }, { "start": 320.4, "end": 326.2, "text": " write it down and then I can encode that into a vector much I can for example" }, { "start": 326.2, "end": 333.84, "text": " build another RNN ironically or something to to encode that or I can" }, { "start": 333.84, "end": 337.68, "text": " represent it as a computation graph like it is here and use a graph neural" }, { "start": 337.68, "end": 341.9, "text": " network to encode that into a single vector and then I have sort of an" }, { "start": 341.9, "end": 347.44, "text": " embedding space where each cell that I could build is a point in that embedding" }, { "start": 347.44, "end": 352.91999999999996, "text": " space and then I can evaluate a couple of them I can for example say okay this" }, { "start": 352.92, "end": 357.08000000000004, "text": " one here this one here this one here this one here I'm going to train them" }, { "start": 357.08000000000004, "end": 361.92, "text": " these cells I'm going to do the full training eval and so on get their scores" }, { "start": 361.92, "end": 367.76, "text": " and then I can learn basically in this latent space I can learn a predictor I" }, { "start": 367.76, "end": 375.92, "text": " can say okay here I get I got an 8 I got a 9 I got a 2 and I got a 4 so it" }, { "start": 375.92, "end": 380.84000000000003, "text": " appears to be that in this direction that the good cells are in this direction" }, { "start": 380.84, "end": 385.32, "text": " and then I can do it again I can sample or I can do gradient descent in this" }, { "start": 385.32, "end": 391.28, "text": " space since this is now a continuous space and the gradient descent on the" }, { "start": 391.28, "end": 396.03999999999996, "text": " model that gives me this space so right so this this method basically tries to" }, { "start": 396.03999999999996, "end": 402.55999999999995, "text": " take in the building plan of a cell and learn to predict the performance just by" }, { "start": 402.55999999999995, "end": 409.55999999999995, "text": " looking at it if if you're thinking of the a Turing machine right now then you" }, { "start": 409.56, "end": 414.28000000000003, "text": " like I I immediately thought of like this this halting problem because it" }, { "start": 414.28000000000003, "end": 417.44, "text": " appears to be exactly what it is so you're trying to build a machine that" }, { "start": 417.44, "end": 421.52, "text": " takes the building plan of another machine and tries to predict its" }, { "start": 421.52, "end": 429.2, "text": " performance now in a general sense we can already state that this problem is" }, { "start": 429.2, "end": 436.2, "text": " sort of the difficulty of this problem is equivalent to the difficulty of the" }, { "start": 436.2, "end": 441.24, "text": " original problem so I'm not sure but it appears to you know it appears to work" }, { "start": 441.24, "end": 444.68, "text": " if you throw lots of compute at it but of course that's a problem you need lots" }, { "start": 444.68, "end": 451.36, "text": " of compute right so either your your option one is to run all of these things" }, { "start": 451.36, "end": 457.4, "text": " and kind of iterate them in a neural sorry in an evolutionary way or your" }, { "start": 457.4, "end": 464.24, "text": " second option is to take the building plan and predict the performance from" }, { "start": 464.24, "end": 469.32, "text": " that both are not satisfactory and both use lots of compute now neuro petri dish" }, { "start": 469.32, "end": 475.6, "text": " is a or synthetic petri dish is a way to combine the two together it says can't" }, { "start": 475.6, "end": 482.32, "text": " we take the building plan here but actually run on the data on data to" }, { "start": 482.32, "end": 489.96000000000004, "text": " predict the performance so what they're saying is basically if I have this cell" }, { "start": 489.96, "end": 494.32, "text": " right here and usually this cell you know it deals with vectors of let's say" }, { "start": 494.32, "end": 502.64, "text": " size 512 and so on it will say it since this is let me draw it again up here so" }, { "start": 502.64, "end": 507.2, "text": " here you have the cell and here you have somehow the connections in there when you" }, { "start": 507.2, "end": 512.72, "text": " carry and the input and the input here okay and this is the output or the carry" }, { "start": 512.72, "end": 521.96, "text": " I have 512 embedding like size of this so this is a giant cell there's 512 the" }, { "start": 521.96, "end": 526.6800000000001, "text": " vector has 512 dimensions going in basically can't I take the exact same" }, { "start": 526.6800000000001, "end": 532.08, "text": " thing but and keep the connection pattern so I would keep the entire" }, { "start": 532.08, "end": 539.76, "text": " pattern of connection right here but I only do it for one or two so this is 512" }, { "start": 539.76, "end": 547.16, "text": " and this is just two right just the I just reduce the dimensionality but I" }, { "start": 547.16, "end": 553.08, "text": " sort of keep the connection pattern alive if I only do that I have like a" }, { "start": 553.08, "end": 559.6, "text": " very small network right now and the same goes for if this is so a lot of" }, { "start": 559.6, "end": 563.08, "text": " times these RNNs they have multiple layers of these things so they have" }, { "start": 563.08, "end": 569.68, "text": " another exactly equal box up here and then another up here I can just reduce" }, { "start": 569.68, "end": 574.3599999999999, "text": " this to one layer and out of the regularity of these neural network" }, { "start": 574.3599999999999, "end": 580.7199999999999, "text": " things it is known that or one can make the assumption that the performance on" }, { "start": 580.7199999999999, "end": 585.8, "text": " this thing will sort of kind of be correlated to the performance of the" }, { "start": 585.8, "end": 591.8399999999999, "text": " entire thing and that's one of the things that this petri dish paper does" }, { "start": 591.8399999999999, "end": 598.56, "text": " so we try to take out what we are trying to search over namely the connection" }, { "start": 598.56, "end": 605.7199999999999, "text": " pattern we keep that as it is up here but we reduce everything else we reduce" }, { "start": 605.7199999999999, "end": 609.4799999999999, "text": " the dimensionality we reduce the number of layers and so on now they don't" }, { "start": 609.4799999999999, "end": 612.8399999999999, "text": " actually reduce the number of layers here but you can reduce the number of" }, { "start": 612.8399999999999, "end": 618.8, "text": " units and so on okay so this in essence this works whenever you can do that" }, { "start": 618.8, "end": 625, "text": " whenever you can keep the structure you're searching over but can reduce" }, { "start": 625, "end": 631.16, "text": " the rest so that's one precondition doesn't work for everything the second" }, { "start": 631.16, "end": 636.16, "text": " part here is that you don't want to use this particular training data and then" }, { "start": 636.16, "end": 640.28, "text": " this particular validation data because first of all it's a lot of training data" }, { "start": 640.28, "end": 646.64, "text": " and second of all it won't give you that good of a prediction instead of what" }, { "start": 646.64, "end": 651.28, "text": " you're trying to do and this is the second part of the idea of petri dish is" }, { "start": 651.28, "end": 659.48, "text": " you're trying to abstract the training data to get you a very small data set" }, { "start": 659.48, "end": 664.92, "text": " search that and the validation data as well as well search that if you train" }, { "start": 664.92, "end": 671.92, "text": " on this data and evaluate on this data the performance that you get will be" }, { "start": 671.92, "end": 677.8399999999999, "text": " very predictive of the performance had you trained the big model on the big" }, { "start": 677.84, "end": 683.6800000000001, "text": " data set okay in fact in this petri dish paper these little data sets they have" }, { "start": 683.6800000000001, "end": 689.76, "text": " nothing to do with the with the original train and validation data and that's I" }, { "start": 689.76, "end": 695.2, "text": " think that's one of the cool things here these things this training data and this" }, { "start": 695.2, "end": 700.44, "text": " validation data they are optimized as well by the procedure they're optimized" }, { "start": 700.44, "end": 706.64, "text": " special data points that are trained these are trained parameters such that" }, { "start": 706.64, "end": 710.96, "text": " if you train on the training on the small training data and evaluate on the" }, { "start": 710.96, "end": 717.04, "text": " small eval data the you will be able to predict this performance back here with" }, { "start": 717.04, "end": 722.88, "text": " high accuracy okay and this I think is where previous approaches have or might" }, { "start": 722.88, "end": 727.28, "text": " have failed because it's you know the the idea of scaling down your network in" }, { "start": 727.28, "end": 731.56, "text": " order to do the architecture search is probably has it has appeared to many" }, { "start": 731.56, "end": 737.5999999999999, "text": " people before that's not you know that's not really genius idea but probably they" }, { "start": 737.5999999999999, "end": 741.16, "text": " have all found that now we can't really do it it doesn't really give us accurate" }, { "start": 741.16, "end": 746.5999999999999, "text": " enough numbers but in this case the addition of adding these synthetic data" }, { "start": 746.5999999999999, "end": 753.0999999999999, "text": " sets that are much smaller but can still if you train and evaluate on them can" }, { "start": 753.0999999999999, "end": 760, "text": " still predict with high accuracy the full score of the full model that I think" }, { "start": 760, "end": 765.76, "text": " makes this idea work alright so I guess we're already through the idea and" }, { "start": 765.76, "end": 772.88, "text": " problem setting and everything without actually reading the paper so they give" }, { "start": 772.88, "end": 780.6, "text": " this example right here at the beginning that if you have a a two layer 100 wide" }, { "start": 780.6, "end": 785.08, "text": " so 100 dimensional MNIST networks it's two layers it's I think it's an MLP" }, { "start": 785.08, "end": 794.4000000000001, "text": " it's two layer MLP with a non-linearity that is this the sigmoid right here this" }, { "start": 794.4000000000001, "end": 800.6, "text": " okay now you can see it has this temperature parameter here it has this" }, { "start": 800.6, "end": 806.2, "text": " slope parameter and you you want to do neural architecture search to find the" }, { "start": 806.2, "end": 810.36, "text": " best slope parameter now usually you would just do a grid search but this is" }, { "start": 810.36, "end": 815.76, "text": " an example because this can be of course much higher dimensional things and" }, { "start": 815.76, "end": 823.84, "text": " then you don't want to do grid search anymore okay so what do we do if you look" }, { "start": 823.84, "end": 830.8000000000001, "text": " at how the 100 wide MNIST network so we can draw it right here so this is a 100" }, { "start": 830.8000000000001, "end": 838, "text": " dimensional MNIST network so this is 100 and each cell each connection here first" }, { "start": 838, "end": 841.64, "text": " has a weight and then has the sigmoid non-linearity and the sigmoid non-" }, { "start": 841.64, "end": 848.32, "text": " linearity is parameterized by the parameter C okay and you have you have" }, { "start": 848.32, "end": 853.72, "text": " many of them right you have one here and so on and each one has a different C and" }, { "start": 853.72, "end": 860.2, "text": " each of these networks represents one blue dot here so if you let C vary so" }, { "start": 860.2, "end": 864.68, "text": " this sigmoid slope value right here that's your parameter C if you let this" }, { "start": 864.68, "end": 868.7199999999999, "text": " variant train the big network on the entire data set to convergence and then" }, { "start": 868.7199999999999, "end": 874.12, "text": " you eval on the validation data set you get the slope like the blue curve so if" }, { "start": 874.12, "end": 878.64, "text": " you see the blue curve the blue curve is if you start over here if you reduce" }, { "start": 878.64, "end": 883, "text": " this slope you'll gain in performance but if you reduce it too much you drop" }, { "start": 883, "end": 889.28, "text": " drastically okay until it's if it's if it's zero it's basically you know the" }, { "start": 889.28, "end": 895.28, "text": " the X is not the signal doesn't propagate anymore and you you have no" }, { "start": 895.28, "end": 901.1999999999999, "text": " learning occurring okay so that's the original performance now what if I only" }, { "start": 901.1999999999999, "end": 906.04, "text": " give you training data in this range right here I only showed you this" }, { "start": 906.04, "end": 911.5, "text": " particular range I can't actually zoom in that much but if I give you" }, { "start": 911.5, "end": 916.48, "text": " this and I ask you to build one of these please take the architecture and predict" }, { "start": 916.48, "end": 920.04, "text": " the performance that we saw at the beginning like one of these girdle" }, { "start": 920.04, "end": 928.84, "text": " machines or touring touring machines you would basically say well that looks" }, { "start": 928.84, "end": 934.52, "text": " to me like a line so I'm gonna predict the red thing here and even if you can" }, { "start": 934.52, "end": 938.6, "text": " you know evaluate a bunch of these it just looks like a line and you're going" }, { "start": 938.6, "end": 944.9200000000001, "text": " to predict there's probably a slope like this right this happens almost" }, { "start": 944.92, "end": 948.92, "text": " independently of which model you choose to predict right here the data of" }, { "start": 948.92, "end": 954.16, "text": " training is simply doesn't give away that the fact that there is a there is" }, { "start": 954.16, "end": 958.52, "text": " this break down here which happens in the real world so if you just give this" }, { "start": 958.52, "end": 965.4799999999999, "text": " as training data there's no way so so the the the criticism about these" }, { "start": 965.4799999999999, "end": 970.7199999999999, "text": " models is valid that they will only work where you give them training data they" }, { "start": 970.7199999999999, "end": 974.7199999999999, "text": " can at best interpolate their training data but they can't really extrapolate" }, { "start": 974.72, "end": 980.8000000000001, "text": " now here since the synthetic petri dish method which is the green thing here" }, { "start": 980.8000000000001, "end": 986.84, "text": " uses the actual not the actual non-linearity that this thing" }, { "start": 986.84, "end": 992.6800000000001, "text": " characterizes so it it instantiates the sigmoid with the parameter C that you" }, { "start": 992.6800000000001, "end": 996.5600000000001, "text": " give it just not on the large network but on a small network in fact their" }, { "start": 996.5600000000001, "end": 1003.9200000000001, "text": " network is just one unit sorry one unit and then another unit so it's just a two" }, { "start": 1003.92, "end": 1009.0799999999999, "text": " hidden layer but just with one unit instead of 100 and of course you can't" }, { "start": 1009.0799999999999, "end": 1013.28, "text": " feed in M nest right here right but we said they don't feed in the data they" }, { "start": 1013.28, "end": 1019, "text": " actually feed in their synthetic data that they learn so you give them the" }, { "start": 1019, "end": 1025.44, "text": " points here and they learn the synthetic data to to evaluate to evaluate the" }, { "start": 1025.44, "end": 1031.3999999999999, "text": " others and then once you ask them well if if my C is right here what's the" }, { "start": 1031.4, "end": 1036.8400000000001, "text": " performance going to be it's going to instantiate that in its small network it" }, { "start": 1036.8400000000001, "end": 1041.44, "text": " is going to use the training data that it has learned from this region right" }, { "start": 1041.44, "end": 1045.48, "text": " here in order to train this and then it's going to evaluate this on the" }, { "start": 1045.48, "end": 1050.92, "text": " synthetic validation data that is also learned on the training data and it is" }, { "start": 1050.92, "end": 1056.24, "text": " going to come up with a performance metric it says okay this is how good it's" }, { "start": 1056.24, "end": 1061.96, "text": " going to be and since it is an approximation in its building plan to the" }, { "start": 1061.96, "end": 1069.68, "text": " entire network it will react similarly so it will get that there is this" }, { "start": 1069.68, "end": 1074.24, "text": " performance dip right here okay so it you can see how this sort of makes sense" }, { "start": 1074.24, "end": 1078.08, "text": " you are actually running an approximation to the actual program" }, { "start": 1078.08, "end": 1082.44, "text": " instead of just looking at the plan of the program and trying to predict it" }, { "start": 1082.44, "end": 1090.88, "text": " which you know halting problem says hello okay so that is the motivating" }, { "start": 1090.88, "end": 1100.2, "text": " example of their MNIST thing and here is the entire algorithm all right so you" }, { "start": 1100.2, "end": 1106.76, "text": " take MNIST training and validation data and you instantiate a bunch of really" }, { "start": 1106.76, "end": 1111.04, "text": " big networks this is ground truth okay you you need this you need this to learn" }, { "start": 1111.04, "end": 1116.36, "text": " from you instantiate a bunch of really big networks now if I draw the graph" }, { "start": 1116.36, "end": 1125.36, "text": " from before right we had this was the performance of the actual networks you" }, { "start": 1125.36, "end": 1130.56, "text": " want you this comes from here from this region right here this is the training" }, { "start": 1130.56, "end": 1135.8, "text": " data okay so you instantiate a bunch of these networks each one you instantiate" }, { "start": 1135.8, "end": 1140.76, "text": " in one of them right each one gives rise to a different non-linearity and you do" }, { "start": 1140.76, "end": 1144.96, "text": " the full training ground truth training and evaluation on the full training set" }, { "start": 1144.96, "end": 1149.52, "text": " and the full validation set and you get validation losses right for each of" }, { "start": 1149.52, "end": 1154.56, "text": " these and these are the points right here now you that's the training data" }, { "start": 1154.56, "end": 1159.28, "text": " for your neural for your neural architecture search so for your petri" }, { "start": 1159.28, "end": 1166.26, "text": " dish method what the petri dish does is it says it extracts the motive and the" }, { "start": 1166.26, "end": 1171.16, "text": " motive is the thing that you optimize over so as I said you want to keep that" }, { "start": 1171.16, "end": 1177.52, "text": " thing in its essence but you want to reduce everything else so it reduces it" }, { "start": 1177.52, "end": 1183.12, "text": " instead of from a two layer on hundred wide MLP it reduces that to a two" }, { "start": 1183.12, "end": 1193, "text": " layer single neuron wide MLP okay and it now this over here is the training data" }, { "start": 1193, "end": 1197.4, "text": " for the procedure that we're going to do now so what it would take is it would" }, { "start": 1197.4, "end": 1202.32, "text": " take it would take one of these values it would instantiate and we have that" }, { "start": 1202.32, "end": 1207.72, "text": " here would instantiate the neural network in the small form of that and" }, { "start": 1207.72, "end": 1214.4, "text": " now we know that if I train the full data and evaluate if I train on the full" }, { "start": 1214.4, "end": 1219.68, "text": " training data and evaluate on the full validation data I should get this" }, { "start": 1219.68, "end": 1227.44, "text": " accuracy all right so I will create and we're going to look at in a second I" }, { "start": 1227.44, "end": 1233.4, "text": " will create training and validation data such that if I train on this training" }, { "start": 1233.4, "end": 1240.3200000000002, "text": " data and then validate on this validation data I get the same validation" }, { "start": 1240.3200000000002, "end": 1245.4, "text": " loss as if I had trained the big network with the same you know the same C" }, { "start": 1245.4, "end": 1249.04, "text": " parameter on the full training data and evaluate in the full validation data" }, { "start": 1249.04, "end": 1254.12, "text": " okay so in this step I'm optimizing the data here the training and validation" }, { "start": 1254.12, "end": 1260.44, "text": " data all right and now in the second step once I have this training and" }, { "start": 1260.44, "end": 1265.2, "text": " validation data such like that I can basically reproduce this this graph" }, { "start": 1265.2, "end": 1273.52, "text": " right here then I can go and actually ask my model okay now please tell me" }, { "start": 1273.52, "end": 1278.08, "text": " what happens over here so what am I gonna do I'm gonna take that I'm gonna" }, { "start": 1278.08, "end": 1283.24, "text": " instantiate it I'm going to use my training data that I learned to train it" }, { "start": 1283.24, "end": 1287.3999999999999, "text": " when to use my validation data that I learned to evaluate it and it's gonna" }, { "start": 1287.3999999999999, "end": 1292.48, "text": " give me a number and that number is going to be like close to hopefully" }, { "start": 1292.48, "end": 1298.84, "text": " close to do this so this is how we can extrapolate using that method okay now" }, { "start": 1298.84, "end": 1303.48, "text": " there are a number of assumptions right here and you can imagine this doesn't" }, { "start": 1303.48, "end": 1309.76, "text": " work in any situation this works if if you you know if you basically you have to" }, { "start": 1309.76, "end": 1317.28, "text": " get lucky in that you have to abstract the correct things right I said you need" }, { "start": 1317.28, "end": 1322.88, "text": " to reduce everything else so they reduce notably you see they reduce the 100 the" }, { "start": 1322.88, "end": 1328.64, "text": " 100 layer width to a single neuron wide MLP and they sort of guess that that" }, { "start": 1328.64, "end": 1334.16, "text": " doesn't change the fundamental thing but you can also see they leave the two" }, { "start": 1334.16, "end": 1340.4, "text": " layer right they leave the two layer neural network and I'm can almost" }, { "start": 1340.4, "end": 1344.8400000000001, "text": " guarantee you that they tried this reducing this to a one layer neural" }, { "start": 1344.8400000000001, "end": 1351.24, "text": " network and it did not work and so you have to be sort of very careful of what" }, { "start": 1351.24, "end": 1356.48, "text": " quantities you abstract and what quantities you don't because okay now" }, { "start": 1356.48, "end": 1360.16, "text": " you might always think oh I can reduce the you know number of dimensions or" }, { "start": 1360.16, "end": 1365.72, "text": " channels that's also not always the case so I think that's kind of the crux of" }, { "start": 1365.72, "end": 1370.4, "text": " the method you have to actually engineer this down compressing of the" }, { "start": 1370.4, "end": 1376.72, "text": " architecture such that it's its properties are still kept and yeah but" }, { "start": 1376.72, "end": 1382.48, "text": " yeah in other things how do you how do you actually produce training and" }, { "start": 1382.48, "end": 1388, "text": " validation data to match these and there are a number of ways but what comes to" }, { "start": 1388, "end": 1394.1200000000001, "text": " mind is is meta learning right so because what you're doing they initialize" }, { "start": 1394.1200000000001, "end": 1397.56, "text": " the training and validation data at random points so these are just random" }, { "start": 1397.56, "end": 1403.84, "text": " at the beginning and then they optimize the data itself using gradient descent" }, { "start": 1403.84, "end": 1413.48, "text": " okay now see synthetic training data and they are randomly initialized okay and" }, { "start": 1413.48, "end": 1418.3999999999999, "text": " they use gradient descent they have it somewhere yes so they have this inner" }, { "start": 1418.3999999999999, "end": 1423.9599999999998, "text": " training loop okay which is many steps of inner training and then they have the" }, { "start": 1423.9599999999998, "end": 1430.36, "text": " outer loss which is the it's the validation loss after the inner training" }, { "start": 1430.36, "end": 1434.52, "text": " loop and the difference for that to the true validation loss and then they do" }, { "start": 1434.52, "end": 1439.4799999999998, "text": " gradient descent on this outer loss now this outer loss is a result of the inner" }, { "start": 1439.4799999999998, "end": 1444.28, "text": " loss and the inner loss is a result of the inner training procedure and the" }, { "start": 1444.28, "end": 1449.7199999999998, "text": " inner training procedure is n steps of feeding in the training data every step" }, { "start": 1449.7199999999998, "end": 1453.32, "text": " you feed in the training data so your computational graph is going to look" }, { "start": 1453.32, "end": 1458.1999999999998, "text": " like so here's your training data as train and here are your initial" }, { "start": 1458.2, "end": 1462.52, "text": " parameters you at random lies initialize them randomly in the first" }, { "start": 1462.52, "end": 1468.16, "text": " step you use the training data to produce theta one then in the second" }, { "start": 1468.16, "end": 1473.0800000000002, "text": " step you use your training perhaps your training data again to produce theta 2" }, { "start": 1473.0800000000002, "end": 1478.24, "text": " and then you use it again to use data for me and so on each time you feed the" }, { "start": 1478.24, "end": 1481.52, "text": " training data in order to evolve your parameters to give you a better" }, { "start": 1481.52, "end": 1486.96, "text": " prediction right so the gradient since somewhere back here there's a loss the" }, { "start": 1486.96, "end": 1492.76, "text": " gradient here will have to flow back through all of these paths and through" }, { "start": 1492.76, "end": 1496.96, "text": " all of these connections to the training data this is kind of you back propagate" }, { "start": 1496.96, "end": 1501.4, "text": " through an optimization procedure and we have this a bunch of times here and I've" }, { "start": 1501.4, "end": 1507.6000000000001, "text": " looked at the code and the code is like really crazy and it looks like proper" }, { "start": 1507.6000000000001, "end": 1511.44, "text": " research code but it appears to be that that's actually what's happening they" }, { "start": 1511.44, "end": 1517.2, "text": " backprop through the optimization procedure to find this synthetic training" }, { "start": 1517.2, "end": 1524.04, "text": " and validation data now that's I mean that's crazy but it also kind of limits" }, { "start": 1524.04, "end": 1527.4, "text": " how far you can go with this because usually you can't backprop for more" }, { "start": 1527.4, "end": 1532.56, "text": " than a couple of steps doing this now that the model the fact that the model" }, { "start": 1532.56, "end": 1537.64, "text": " inner model is small helps but also this introduces very very much like these" }, { "start": 1537.64, "end": 1542.16, "text": " things are very brittle if you backprop through an optimization procedure like" }, { "start": 1542.16, "end": 1548.24, "text": " this these things tend to be very brittle and so I think there's another" }, { "start": 1548.24, "end": 1556.4, "text": " thing there where you have to pay careful attention alright that's it's" }, { "start": 1556.4, "end": 1559.64, "text": " basically it the last thing they say is that they can combine this with" }, { "start": 1559.64, "end": 1567, "text": " architecture search in that so not only can you predict good architectures what" }, { "start": 1567, "end": 1572.56, "text": " you can do is you can actually predict the which architectures are good and" }, { "start": 1572.56, "end": 1578.6, "text": " then you can use that prediction to get new to basically input this into your" }, { "start": 1578.6, "end": 1582.84, "text": " neural architecture search to inform it so instead of the neural architecture" }, { "start": 1582.84, "end": 1587.48, "text": " search having to evaluate all of the candidates that it produces it only has" }, { "start": 1587.48, "end": 1592.32, "text": " to now evaluate the very small subset of candidates that the synthetic petri dish" }, { "start": 1592.32, "end": 1598, "text": " training deems most worthy of being evaluated in this case here instead of" }, { "start": 1598, "end": 1604.4399999999998, "text": " evaluating all of the things here it would limit itself to whatever the" }, { "start": 1604.4399999999998, "end": 1609.8799999999999, "text": " synthetic petri dish says are the highest performing ones because if the" }, { "start": 1609.8799999999999, "end": 1614.4399999999998, "text": " synthetic petri dish is any good then it will you know give accurate predictions" }, { "start": 1614.4399999999998, "end": 1618.6799999999998, "text": " of how they're performing and then that can go in in multiple rounds so the" }, { "start": 1618.68, "end": 1624.48, "text": " architecture search can find new come up with new things that it thinks are" }, { "start": 1624.48, "end": 1628.3600000000001, "text": " better through like an evolutionary mutation algorithm the petri dish can" }, { "start": 1628.3600000000001, "end": 1634.1000000000001, "text": " evaluate them in the synthetic way and then suggest the like 10 candidates to" }, { "start": 1634.1000000000001, "end": 1640.5600000000002, "text": " evaluate on the full test set and you that way you don't have to evaluate all" }, { "start": 1640.5600000000002, "end": 1647.8, "text": " the like thousand candidates alright alright cool they do this for this M" }, { "start": 1647.8, "end": 1657.44, "text": " nest and they also do it for finding a RNN cell for the pen tree bank this is" }, { "start": 1657.44, "end": 1663.68, "text": " a language modeling task and the this is a benchmark for neural architecture" }, { "start": 1663.68, "end": 1668.9199999999998, "text": " search where you're trying to find a good RNN cell to get the perplexity" }, { "start": 1668.9199999999998, "end": 1675, "text": " really low and here you can see if they give the same amount of data to all the" }, { "start": 1675, "end": 1681.32, "text": " methods then the benchmark neural architecture search is worse than the" }, { "start": 1681.32, "end": 1686.64, "text": " synthetic petri dish informed architecture search now one has to say" }, { "start": 1686.64, "end": 1693.4, "text": " on the full date I believe the NAO gets to about here but of course if you give" }, { "start": 1693.4, "end": 1700.56, "text": " all of them the same data the neural the petri dish beats this method and I think" }, { "start": 1700.56, "end": 1704.68, "text": " still this method here uses way more compute because it always has to evaluate" }, { "start": 1704.68, "end": 1711.1200000000001, "text": " all the candidates and that's exactly one of these where I learn an" }, { "start": 1711.1200000000001, "end": 1715.72, "text": " architecture to predict the other architecture by just looking at it so it" }, { "start": 1715.72, "end": 1720.88, "text": " works but it doesn't work as well as actually running the architecture in an" }, { "start": 1720.88, "end": 1725, "text": " abstract fashion this also shows you the importance of selecting your" }, { "start": 1725, "end": 1730.8, "text": " experimental evaluation in a smart way like they argue they argue for very long" }, { "start": 1730.8, "end": 1736, "text": " why it makes sense to evaluate everything on reduced data such that" }, { "start": 1736, "end": 1742, "text": " their method here can be better and they don't have to compare to the full thing" }, { "start": 1742, "end": 1746.6, "text": " it's easier for them to work on reduced data and they argue you know it's it's" }, { "start": 1746.6, "end": 1752.3999999999999, "text": " it's what people usually do in practice and that's the task they focus on so" }, { "start": 1752.4, "end": 1760.68, "text": " you know good good good good paper writing right here yeah that's basically" }, { "start": 1760.68, "end": 1768.3600000000001, "text": " it to the paper there's a lot of things to be said here I think this works in" }, { "start": 1768.3600000000001, "end": 1774.3200000000002, "text": " very very limited settings it seems to me that it's sort of brittle with" }, { "start": 1774.3200000000002, "end": 1781.0400000000002, "text": " respect to how you abstract and also it it's always the case like how many how" }, { "start": 1781.04, "end": 1784.96, "text": " how large is this synthetic training data in their case there they like" }, { "start": 1784.96, "end": 1790.52, "text": " abstract this to 20 or 30 data points or something like this so it seems to me" }, { "start": 1790.52, "end": 1795.2, "text": " since you're optimizing this training data with gradient descent what you" }, { "start": 1795.2, "end": 1800.8, "text": " would mainly find are adversarial sort of adversarial examples to this" }, { "start": 1800.8, "end": 1806.32, "text": " architecture here so I'm going to guess that the inner optimization is very" }, { "start": 1806.32, "end": 1813.04, "text": " noisy and that's because if you really let your optimizer run then it will" }, { "start": 1813.04, "end": 1817.76, "text": " abuse every single thing it can to match that validation loss and that will" }, { "start": 1817.76, "end": 1822.24, "text": " usually lead to an adversarial example since you're optimizing the data itself" }, { "start": 1822.24, "end": 1829.4399999999998, "text": " okay so I think this suffers from that and this is we had this in the in the" }, { "start": 1829.4399999999998, "end": 1834.36, "text": " planning you know planning in in learned world models in reinforcement learning" }, { "start": 1834.36, "end": 1839.28, "text": " where if you have a really really good planner it will just abuse the mistakes" }, { "start": 1839.28, "end": 1843.6799999999998, "text": " that you make in approximating the true world and the same here you're going to" }, { "start": 1843.6799999999998, "end": 1848.1599999999999, "text": " make mistakes approximating this architecture here and the better your" }, { "start": 1848.1599999999999, "end": 1853.6, "text": " your optimizer is for producing this synthetic data the probably the worse" }, { "start": 1853.6, "end": 1859.3999999999999, "text": " the worse the result is going to match the worst that these losses are going to" }, { "start": 1859.3999999999999, "end": 1864.1599999999999, "text": " actually match now okay these losses will match because they're that's what" }, { "start": 1864.16, "end": 1869.3200000000002, "text": " you train for but the worst these two curves will match each other because now" }, { "start": 1869.3200000000002, "end": 1873.68, "text": " you're just finding adversarial examples for your particular training data" }, { "start": 1873.68, "end": 1879.0400000000002, "text": " another concern I have here is with respect to the double descent phenomenon" }, { "start": 1879.0400000000002, "end": 1883.6000000000001, "text": " so if you know the double descent phenomenon if here you have your number" }, { "start": 1883.6000000000001, "end": 1889.52, "text": " of parameters and here you have your validation loss let's say and you know" }, { "start": 1889.52, "end": 1895.24, "text": " that if I add parameters I can make my validation loss go down so this is" }, { "start": 1895.24, "end": 1899.04, "text": " assuming I have a model with p parameters and I always train it on the" }, { "start": 1899.04, "end": 1904.56, "text": " train data to like to convergence if I add parameters I can generalize better" }, { "start": 1904.56, "end": 1909.28, "text": " until a point where I add too many parameters and I start overfitting and" }, { "start": 1909.28, "end": 1914.2, "text": " my validation loss goes up again but the double descent phenomenon and I think" }, { "start": 1914.2, "end": 1920.76, "text": " I've done a video on this shows that after a certain threshold you get the" }, { "start": 1920.76, "end": 1924.76, "text": " interpolation threshold the validation loss goes actually down again it goes" }, { "start": 1924.76, "end": 1931.24, "text": " down even further here now I'm so this is a very strange phenomenon by itself" }, { "start": 1931.24, "end": 1935.0800000000002, "text": " but I'm sort of concerned that if you do this abstraction that this paper" }, { "start": 1935.0800000000002, "end": 1940.52, "text": " proposes so you read your let's say your full model is here with a large number" }, { "start": 1940.52, "end": 1945.36, "text": " of parameters so it is past this interpolation threshold if you now" }, { "start": 1945.36, "end": 1949.04, "text": " seriously reduce the number of parameters because you want to go into" }, { "start": 1949.04, "end": 1955.84, "text": " this petri dish you will get maybe you will cross this interpolation threshold" }, { "start": 1955.84, "end": 1959.92, "text": " and actually be on this side of the curve right here now of course at the" }, { "start": 1959.92, "end": 1966.48, "text": " same time you reduce the amount of data which would push you over here again but" }, { "start": 1966.48, "end": 1970.8, "text": " it is different data so I'm not sure how all of this is going to play out it" }, { "start": 1970.8, "end": 1978.88, "text": " appears to work in these settings right here but I I think this is it's it's" }, { "start": 1978.88, "end": 1984.88, "text": " sort of it's sort of applicable in some situations and it's it'd be very cool if" }, { "start": 1984.88, "end": 1989.3600000000001, "text": " we develop this further such that we understand when it applies and when we" }, { "start": 1989.3600000000001, "end": 1995.68, "text": " can use it because I feel this can be a very cool thing if we understand it" }, { "start": 1995.68, "end": 2001.3600000000001, "text": " better and if we can apply it throughout alright that's the end if you like this" }, { "start": 2001.3600000000001, "end": 2008.1200000000001, "text": " paper leave a comment if you didn't like it leave a comment and bye bye see you" }, { "start": 2008.12, "end": 2027.6399999999999, "text": " next time" } ]
CA8JPbJ75tY
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
CornerNet: Detecting Objects as Paired Keypoints (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "corner", "top left", "bottom right", "corners", "cv", "computer vision", "vision", "object detection", "detr", "bounding box", "center", "anchor", "pooling", "local", "cnn", "convolutions", "convolutional neural network", "hourglass", "skip connection", "heatmap", "embedding", "push", "pull", "loss", "overlap", "filters", "channels" ]
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 Hylah and Jia Ding. So on a high level this paper detects objects in images. Let's say this is an image and here's a chair. You know you have your chair. And the way you detect the chair for this paper is going to be you detect the bottom right and the top left corners of the bounding box of the image. So rather than detecting the middle and then specifying height and width, like we saw in the Facebook DETR paper, you detect the two corners. And this paper goes through what they have to do to get this to work, including a new pooling method called corner pooling. So that's the gist of the paper. As always, if you like content like this, consider subscribing and sharing it out to other people. That would be very helpful. So a commenter actually recommended this paper to me after I made a video on Facebook's DETR object detection pipeline. I said something like, okay, since that paper always would detect the middle of the object and the height and width, couldn't you make something that also that detects the corners here and the corner here and then that would define a bounding box just as well. And in the comments, and thank you very much for that, I, someone made that pointed me to this paper, it's a bit older, as you can see, but it's, I still think it's, it's pretty cool. So we've already seen the the problem, like the problem isn't hard. And it's detecting bounding boxes in images. And in these data set, the problems, the difficult parts are that you sometimes have multiple objects, like here, if two humans, they can be overlapping, they can be of different sizes, that could be like a third human, like small back here, there can be other objects, you don't know how many there are, and so on. So it is it is a fairly complicated problem. But as I already said, the way that 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 con net, 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 con net. Now they in this case use in this hourglass architecture that described down, down here somewhere. And this basically compresses the image into a smaller resolution. So I would take that image and compress it down to very small resolution, but many, many channels. So it's sort of forced to learn a global semantic representation, and then it up samples the image again, and down samples it again, and it up samples it again through. So at each of these steps, there are many convolutional layers right here. And because that would lose you too much space, like local information, there are skip connections built in between pairs of layers where information can travel without computation, basically. So this is a 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. Okay. Now the heat maps, their dimensions are the height of the image. Sorry, the height here, h, come on, and the width of the image. And this here would be the number of classes C. Okay, so you have one channel for each of the classes that you predict. And the heat map will basically be very high at the location and channel where there is a corner of that. So you see have one heat map for the top left corners, and one heat map for the bottom right corners. And then also what you want to predict are these embeddings. Now, simply because you have, you know, I said there can be multiple instances of the same class in the in the same image. So now you have in this case, particular case, you're gonna, even if you predict absolutely correctly, you predict two top left corners and two bottom right corners. Now this isn't particularly hard because there's only one configuration that can possibly be but there could be situations where there are multiple. And that's why you need to somehow match these corners, you have to match, you have to know which ones of those are the same objects. And they do this by a second output in their heads called this embeddings. 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 two different objects. So this orange thing here would have a large inner product with this green bottom right corner embedding. Okay, so you train these embeddings, they don't need to mean anything. You simply train them to predict the same thing for the same objects and different things for different objects. So after that, when you match the corners, you can simply go over you can say, ah, this which one of these two right here has the larger inner product, or you can do like some Hungarian matching and maximize the total inner product or something like this. This was quite surprising to me that it works, but it's based on a line of research that is already has already established that this can work. Because ultimately, these things, these two pipelines do not really communicate, right. So I'm going to guess what they learn is sort of a sort of a descriptor of the actual object that's there. Because if both describe the objects that that's there, with their embeddings, their embeddings are going to have a large inner product. And if they describe different objects, then their embeddings are not going to match, right. So even though you train that this objective, I still think that these embeddings would pick up something about the object, something about the visual characteristics of the objects will be very interesting to see whether someone could actually parse out what they what they do, because it's almost impossible otherwise for these things to be learnable. Alright, so that's the 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 and by downsampling, you have to round certain pixels to certain locations. And then the offsets, they they compensate for this. But I don't want to focus on these right now. So you simply have these two outputs right here. Now we'll look at corner pooling in a second. But how do you train this? So you can now say, okay, if I have a picture like this, there there is exactly two locations in the class human, where the the top left corner is correct. And that's right here. And that's right here. Okay, so two locations. So I fill I make my matrix, my target matrix with a one here and the one here, and zeros everywhere else. Alright 0000000000. And I train my network to give me this particular thing as an output for these heat for this heat map in the channel human. This this might work, but it is more profitable, let's say, if you allow for some slack. So what they say is, you know, since if I'm anywhere within this orange circle right here with my prediction, my resulting bounding box is still going to overlap fairly well with the ground truth bounding box. And the accuracy measures for these things, I think, are based on how much you overlap with the ground truth bounding boxes. So what they do basically is they, they give, they put a one in the spot where the actual corner is, and then they put like a 0.9 around it 0.9 0.9, and so on, and they kind of flatten out. So this is sort of a Gaussian right here in multiple dimensions. If that drawing makes any sense. And they say, well, you the closer you are, basically, the more reward you get. So you train it to predict in this general location. Now, of course, the size, exact size of this Gaussian has to be dependent on the actual size of the box itself. And they have, they, they regard that and say exactly how they calculate these Gaussians. But for the understanding, it's just important that they do give some slack here in how they compute the loss with respect to the heat map. Now the loss with respect to the to the embeddings is pretty simple, pretty straightforward. So remember these embeddings, you have two embeddings per, you have the top left embedding, that's the ETK, the top embed, the top corner embedding, and you have the bottom right embedding. And what you want is for them to be close together when they describe the same object, right? So this is this push and pull losses. So in the pull loss, what you want to do is you want to minimize the distances of these two things to this thing right here. And this thing is simply, so EK is simply the 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 this is the mean, this the mean embedding of this object far away from the mean embedding of any other object in the picture. Okay, so this here is a margin loss, which means that you cap it at some point. So if they're close together, if the embeddings of two different objects are close together, you can 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 any bonus for them being super far apart, you don't simply don't want them to be closer together than one. All right. In their case, I think they have a the dimension of these vectors is actually one, which basically means they just output the single number, which I find astonishing that that works. Yes, they use embeddings of one dimension. So they just use numbers. Astonishing that it works, but okay. So that's how you train the the embedding output embeddings close together of the same objects of the two corners, and embeddings far apart for different objects. Alright, 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 like I'm sort of, I'm like, wait, wait, where is it? Because in this particular receptive field of this resolution, I have I have no clue if the moon is close, right? So at the location where the actual bounding box is, I have no local information of the object, because usually objects are not squares, they're sort of round like the moon, or like here, the plane, these corners, they have no local information about where the plane is. And corner pooling is a method to propagate that information along the axis. So what corner in corner pooling, what you would allow the location here in the CNN to do is to not only look at its itself, so its own location, but actually to extend its field of view over to the right, and down to the bottom, it's asked to predict a top left corner. So what you do is you max pool everything from here to this corner detector. So the corner detector will basically be able to detect whenever in either this band right here. So whenever in this band right here, there is the top, like the top of an object, like the top of the moon here, this corner detector can say, ah, that's probably the right height right here for a corner. And it combines this with the information of this side here, where it also says, oh, there is the side of the moon, that's probably the correct, you know, up down. So there's probably a corner right here. Okay, whereas a 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. Alright, so this corner pooling goes for the top left, and of course, equivalently goes for the bottom right, that can always max pools to up and to the left of itself. And that's exactly what you see here. So in this corner pooling, what you can do is you can propagate signal to the left and to up, and then you add the two informations, and that will give you your output feature. And you can calculate this actually fairly efficiently by doing like, like you do a cumulative sum, you do like a cumulative maximum across the different axes, and then you simply add two arrays. And that's it. So you simply put the corner pooling before you predict the these different outputs right here, the heat maps and the embeddings, which means that this hourglass network is not affected by this. Just the predictors of heat maps and embeddings, they then get the information from this hourglass network into these into these directions. Okay, I think that's a pretty, pretty neat method of solving this. And here they show how you can calculate this. And then the corner pooling is right here, they do add a skip connection here. Because sometimes, if you just aggregate this information, you might, you might actually get confused because so the trouble of course comes when there are multiple, like different objects that have, you know, the same top. And then there's also a person right here that so it gets like a signal, it gets another signal that there is the left side of a person right here. Or maybe, you know, not like this. So it will it will predict like a corner, maybe here, where there is none. So it's, it's, sometimes it is important to have local information still. And that's exactly what this skip connection is supposed to address. I guess the situation up here would be resolved by the different embeddings. But still, so you have that you add and you put another bunch of convolutional layers on top of that, and then you'll get your predictions. And that's it. You mix all the losses. So there is a detection loss from the embeddings, there's the sorry, from the heat maps, there is the pull and push losses for the embeddings. And there's this offset loss that you train to compensate for the down the 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 in the one, one stage neural network category, if so to say. And they show that they get significant improvements with and due to this corner pooling, which is pretty cool to see, because it makes sense. It sort of makes sense, how you would like to think about it like this. And to see that it helps is pretty neat. Yeah, they also investigate how large they have to make these these Gaussians and so on. And these are some qualitative examples, you can see that without the corner pooling, what you'll get is that so the top here and the left and the right are correct are detected correctly. But you can see that probably the network thinks that there is an extension of the object right here, and therefore, doesn't do doesn't do a good job. Because this this position right here, it has no access to sort of it has to use like a long range access, it can't it can't really look in detail at the features here or here. So when it scans up and down the side, where the bottom corner where the bottom break is, it can it can only look at very coarse features, because it has to basically transmit information in the CNN of a higher layer and the higher layer has a higher receptive field, which means it has a lower resolution. So it can't really go and look very in very detailed fashion at this border right here. So it misses it. Okay. Same right here, as you can see, so there are a number of failure cases that they can now solve using this method compared to if they didn't use the corner pooling. They show some also some times where their method fails, for example, here, it matches the top, top left and bottom right corners of two different objects. Because they their embeddings were close enough. And yeah, that's what I'm saying. I'm I'm wondering what these embeddings actually learn, because they are generated independently. So not entirely sure. It's also not exactly what I had in mind when I formulated this idea in the last video. But I'm actually not sure what I had in mind myself, to be honest. But in my mind, it seemed to be like you should be able to train a network. If there is an object right here, you could train a network to predict for any given location, let's say how many pixels to its bottom right, or maybe you want to normalize by the area that's there, are part of a particular object. And then you could use, you could predict each pixel and use like the differences between the differences between the points as as scores for bounding boxes. I don't know if you see what I mean. You could basically tell the you have you'd have one network predict everything to the to the bottom right, and then you'd use the differences. And the transformers would be very good at that because they can sort of have this attention between each pairs of points and so on. I'm not entirely sure, but this might just be crap. Yeah, here's some more examples. This appears to work really nicely. But of course, in the qualitative, qualitative examples, it always works nicely, but they also demonstrated. All right, I found this paper all in all pretty cool, pretty neat. It's a simple idea. It's executed well. I don't have the feeling that there are like too many tricks in here. And they show really that the improvement seems to be due to their their corner pooling method. And that's pretty neat. So if you like this paper, make sure to check it out. And I'll see you next time. Bye bye.
[ { "start": 0, "end": 6.08, "text": " Hello there! Today we're looking at corner net detecting objects as paired key points by" }, { "start": 6.08, "end": 15.280000000000001, "text": " Hylah and Jia Ding. So on a high level this paper detects objects in images. Let's say this is an" }, { "start": 15.280000000000001, "end": 22.8, "text": " image and here's a chair. You know you have your chair. And the way you detect the chair for this" }, { "start": 22.8, "end": 29.64, "text": " paper is going to be you detect the bottom right and the top left corners of the bounding box of" }, { "start": 29.64, "end": 35.72, "text": " the image. So rather than detecting the middle and then specifying height and width, like we saw in" }, { "start": 35.72, "end": 41.4, "text": " the Facebook DETR paper, you detect the two corners. And this paper goes through what they" }, { "start": 41.4, "end": 48.519999999999996, "text": " have to do to get this to work, including a new pooling method called corner pooling. So that's" }, { "start": 48.519999999999996, "end": 55.120000000000005, "text": " the gist of the paper. As always, if you like content like this, consider subscribing and" }, { "start": 55.12, "end": 63.36, "text": " sharing it out to other people. That would be very helpful. So a commenter actually recommended" }, { "start": 63.36, "end": 70.67999999999999, "text": " this paper to me after I made a video on Facebook's DETR object detection pipeline. I said something" }, { "start": 70.67999999999999, "end": 78, "text": " like, okay, since that paper always would detect the middle of the object and the height and width," }, { "start": 78, "end": 84.03999999999999, "text": " couldn't you make something that also that detects the corners here and the corner here and then that" }, { "start": 84.04, "end": 89.92, "text": " would define a bounding box just as well. And in the comments, and thank you very much for that," }, { "start": 89.92, "end": 98.64, "text": " I, someone made that pointed me to this paper, it's a bit older, as you can see, but it's, I still" }, { "start": 98.64, "end": 105.96000000000001, "text": " think it's, it's pretty cool. So we've already seen the the problem, like the problem isn't hard. And" }, { "start": 105.96000000000001, "end": 113.88000000000001, "text": " it's detecting bounding boxes in images. And in these data set, the problems, the difficult parts" }, { "start": 113.88, "end": 121.36, "text": " are that you sometimes have multiple objects, like here, if two humans, they can be overlapping," }, { "start": 121.36, "end": 127, "text": " they can be of different sizes, that could be like a third human, like small back here, there can be" }, { "start": 127, "end": 132.51999999999998, "text": " other objects, you don't know how many there are, and so on. So it is it is a fairly complicated" }, { "start": 132.51999999999998, "end": 140.16, "text": " problem. But as I already said, the way that corner net here does this is by predicting the" }, { "start": 140.16, "end": 146.32, "text": " locations of the top left and bottom right corner, thereby defining a bounding box. And it does this" }, { "start": 146.32, "end": 154.51999999999998, "text": " independently. So there's one network basically, that does the top left and one that does the bottom" }, { "start": 154.51999999999998, "end": 163.8, "text": " right, and they are then combined. And at the end, they're sort of refined, I think. So the" }, { "start": 163.8, "end": 169.64, "text": " architecture is pretty simple. First, you put the image through a con net, which is like a feature" }, { "start": 169.64, "end": 178.88, "text": " extractor. So this is the basic part. It was even the basic part of Facebook's DETR pipeline. First," }, { "start": 178.88, "end": 185.11999999999998, "text": " you have some sort of con net. Now they in this case use in this hourglass architecture that" }, { "start": 185.11999999999998, "end": 195.88, "text": " described down, down here somewhere. And this basically compresses the image into a smaller" }, { "start": 195.88, "end": 200.68, "text": " resolution. So I would take that image and compress it down to very small resolution," }, { "start": 200.68, "end": 206.88, "text": " but many, many channels. So it's sort of forced to learn a global semantic representation," }, { "start": 206.88, "end": 211.35999999999999, "text": " and then it up samples the image again, and down samples it again, and it up samples it again" }, { "start": 211.35999999999999, "end": 218.44, "text": " through. So at each of these steps, there are many convolutional layers right here. And because that" }, { "start": 218.44, "end": 223.44, "text": " would lose you too much space, like local information, there are skip connections built" }, { "start": 223.44, "end": 230.44, "text": " in between pairs of layers where information can travel without computation, basically. So this is" }, { "start": 230.44, "end": 237.8, "text": " a fairly standard architecture right here. But then after this hourglass CNN, you get to these" }, { "start": 237.8, "end": 245.64, "text": " prediction modules. Now let me switch back to the top drawing. Ultimately, what you want as an output" }, { "start": 245.64, "end": 252.76, "text": " of these prediction modules is two things. So first of all, you want these heat maps, sorry about" }, { "start": 252.76, "end": 259.64, "text": " that. And these heat maps will simply tell you where are the corners. Okay. Now the heat maps," }, { "start": 259.64, "end": 270.71999999999997, "text": " their dimensions are the height of the image. Sorry, the height here, h, come on, and the width" }, { "start": 270.71999999999997, "end": 279.15999999999997, "text": " of the image. And this here would be the number of classes C. Okay, so you have one channel for each" }, { "start": 279.16, "end": 287, "text": " of the classes that you predict. And the heat map will basically be very high at the location and" }, { "start": 287, "end": 293.64000000000004, "text": " channel where there is a corner of that. So you see have one heat map for the top left corners," }, { "start": 293.64000000000004, "end": 299.96000000000004, "text": " and one heat map for the bottom right corners. And then also what you want to predict are these" }, { "start": 299.96000000000004, "end": 308.08000000000004, "text": " embeddings. Now, simply because you have, you know, I said there can be multiple instances of the same" }, { "start": 308.08, "end": 315.88, "text": " class in the in the same image. So now you have in this case, particular case, you're gonna, even if" }, { "start": 315.88, "end": 323.12, "text": " you predict absolutely correctly, you predict two top left corners and two bottom right corners. Now" }, { "start": 323.12, "end": 329.08, "text": " this isn't particularly hard because there's only one configuration that can possibly be but there" }, { "start": 329.08, "end": 334.56, "text": " could be situations where there are multiple. And that's why you need to somehow match these" }, { "start": 334.56, "end": 340.92, "text": " corners, you have to match, you have to know which ones of those are the same objects. And they do" }, { "start": 340.92, "end": 348.56, "text": " this by a second output in their heads called this embeddings. These embeddings, they're simply" }, { "start": 348.56, "end": 356.96, "text": " vectors. And the only thing that they're asked to do is they're asked to have a large inner product," }, { "start": 356.96, "end": 364.91999999999996, "text": " whenever they belong to the same object, and they are asked to have a small inner product, sorry," }, { "start": 364.91999999999996, "end": 373.79999999999995, "text": " when they're when they belong to the different two different objects. So this orange thing here would" }, { "start": 373.79999999999995, "end": 378.76, "text": " have a large inner product with this green bottom right corner embedding. Okay, so you train these" }, { "start": 378.76, "end": 384.32, "text": " embeddings, they don't need to mean anything. You simply train them to predict the same thing for" }, { "start": 384.32, "end": 392.15999999999997, "text": " the same objects and different things for different objects. So after that, when you match the corners," }, { "start": 392.15999999999997, "end": 399.64, "text": " you can simply go over you can say, ah, this which one of these two right here has the larger inner" }, { "start": 399.64, "end": 404.84, "text": " product, or you can do like some Hungarian matching and maximize the total inner product" }, { "start": 404.84, "end": 411.92, "text": " or something like this. This was quite surprising to me that it works, but it's based on a line of" }, { "start": 411.92, "end": 419.08000000000004, "text": " research that is already has already established that this can work. Because ultimately, these" }, { "start": 419.08000000000004, "end": 425.56, "text": " things, these two pipelines do not really communicate, right. So I'm going to guess what" }, { "start": 425.56, "end": 434.16, "text": " they learn is sort of a sort of a descriptor of the actual object that's there. Because if both" }, { "start": 434.16, "end": 440.32, "text": " describe the objects that that's there, with their embeddings, their embeddings are going to have a" }, { "start": 440.32, "end": 444.96, "text": " large inner product. And if they describe different objects, then their embeddings are not going to" }, { "start": 444.96, "end": 450.92, "text": " match, right. So even though you train that this objective, I still think that these embeddings" }, { "start": 450.92, "end": 457.08, "text": " would pick up something about the object, something about the visual characteristics of the objects" }, { "start": 457.08, "end": 463.88, "text": " will be very interesting to see whether someone could actually parse out what they what they do," }, { "start": 463.88, "end": 475.04, "text": " because it's almost impossible otherwise for these things to be learnable. Alright, so that's the" }, { "start": 475.04, "end": 479.71999999999997, "text": " that's the goal right here, you want to get these heat maps in these embeddings. And the way you do" }, { "start": 479.71999999999997, "end": 485.6, "text": " it is fairly easy architecturally, you have these two prediction modules, one for top left and one" }, { "start": 485.6, "end": 491.56, "text": " for bottom right. And each of them have three outputs, the heat maps, the embeddings. And here" }, { "start": 491.56, "end": 498.12, "text": " the offsets are simply a way for you to deal with the fact that you downsample and by downsampling," }, { "start": 498.12, "end": 505.36, "text": " you have to round certain pixels to certain locations. And then the offsets, they they" }, { "start": 505.36, "end": 512.5, "text": " compensate for this. But I don't want to focus on these right now. So you simply have these two" }, { "start": 512.5, "end": 520.84, "text": " outputs right here. Now we'll look at corner pooling in a second. But how do you train this? So you" }, { "start": 520.84, "end": 528.44, "text": " can now say, okay, if I have a picture like this, there there is exactly two locations in the class" }, { "start": 528.44, "end": 537.0400000000001, "text": " human, where the the top left corner is correct. And that's right here. And that's right here. Okay," }, { "start": 537.0400000000001, "end": 544.52, "text": " so two locations. So I fill I make my matrix, my target matrix with a one here and the one here," }, { "start": 544.52, "end": 552.76, "text": " and zeros everywhere else. Alright 0000000000. And I train my network to give me this particular" }, { "start": 552.76, "end": 561.64, "text": " thing as an output for these heat for this heat map in the channel human. This this might work," }, { "start": 561.64, "end": 570.96, "text": " but it is more profitable, let's say, if you allow for some slack. So what they say is, you know," }, { "start": 570.96, "end": 577.72, "text": " since if I'm anywhere within this orange circle right here with my prediction, my resulting bounding" }, { "start": 577.72, "end": 583.6, "text": " box is still going to overlap fairly well with the ground truth bounding box. And the accuracy" }, { "start": 583.6, "end": 589.2800000000001, "text": " measures for these things, I think, are based on how much you overlap with the ground truth bounding" }, { "start": 589.28, "end": 600.64, "text": " boxes. So what they do basically is they, they give, they put a one in the spot where the actual" }, { "start": 600.64, "end": 609.4, "text": " corner is, and then they put like a 0.9 around it 0.9 0.9, and so on, and they kind of flatten out." }, { "start": 609.4, "end": 616.1999999999999, "text": " So this is sort of a Gaussian right here in multiple dimensions. If that drawing makes any" }, { "start": 616.2, "end": 625.08, "text": " sense. And they say, well, you the closer you are, basically, the more reward you get. So you train" }, { "start": 625.08, "end": 633, "text": " it to predict in this general location. Now, of course, the size, exact size of this Gaussian has" }, { "start": 633, "end": 641.72, "text": " to be dependent on the actual size of the box itself. And they have, they, they regard that and" }, { "start": 641.72, "end": 647.64, "text": " say exactly how they calculate these Gaussians. But for the understanding, it's just important" }, { "start": 647.64, "end": 654.0400000000001, "text": " that they do give some slack here in how they compute the loss with respect to the heat map." }, { "start": 654.0400000000001, "end": 665.12, "text": " Now the loss with respect to the to the embeddings is pretty simple, pretty straightforward. So" }, { "start": 665.12, "end": 672.48, "text": " remember these embeddings, you have two embeddings per, you have the top left embedding, that's the" }, { "start": 672.48, "end": 680.04, "text": " ETK, the top embed, the top corner embedding, and you have the bottom right embedding. And what you" }, { "start": 680.04, "end": 688.12, "text": " want is for them to be close together when they describe the same object, right? So this is this" }, { "start": 688.12, "end": 694.98, "text": " push and pull losses. So in the pull loss, what you want to do is you want to minimize the distances" }, { "start": 694.98, "end": 702.64, "text": " of these two things to this thing right here. And this thing is simply, so EK is simply the the mean," }, { "start": 702.64, "end": 711.5600000000001, "text": " so it's ETK plus EBK divided by two, that's simply if your top left corner is here and your bottom" }, { "start": 711.5600000000001, "end": 716.48, "text": " right corner is here, and they have embeddings, this one has this embedding, and this one has" }, { "start": 716.48, "end": 724.44, "text": " that embedding, then the mean of the two embeddings, which I guess is whatever this right here. Yeah," }, { "start": 724.44, "end": 730.12, "text": " that's about the mean. So the location is not important, actually. So it's about the embedding" }, { "start": 730.12, "end": 735.6800000000001, "text": " vectors. It's not about where the corners are. The two embedding vectors must be close together," }, { "start": 735.6800000000001, "end": 741.72, "text": " and you model that not directly by making them close to each other, but by making both close to" }, { "start": 741.72, "end": 750.08, "text": " their mean. And that probably saves you some back propagation troubles where you, if you have two" }, { "start": 750.08, "end": 755.48, "text": " moving parts in a loss function, and you optimize both, then you tend to, so you have two things," }, { "start": 755.48, "end": 762.08, "text": " you want to bring them closer together, they might tend to overshoot or something like this. Okay," }, { "start": 762.08, "end": 768.8000000000001, "text": " so this brings those two closer together. And in the push loss, what you want to do is you want to" }, { "start": 768.8000000000001, "end": 778.88, "text": " simply make the mean between the two, remember this is this is the mean, this the mean embedding" }, { "start": 778.88, "end": 787.76, "text": " of this object far away from the mean embedding of any other object in the picture. Okay, so this" }, { "start": 787.76, "end": 796.04, "text": " here is a margin loss, which means that you cap it at some point. So if they're close together," }, { "start": 796.04, "end": 804.72, "text": " if the embeddings of two different objects are close together, you can see here this" }, { "start": 804.72, "end": 812.48, "text": " quantity will be small, and therefore it will lead to this delta, you give a loss of one," }, { "start": 812.48, "end": 818.96, "text": " the delta here is one in this case. But as they get further apart, you're more and more happy," }, { "start": 818.96, "end": 827.96, "text": " and you reduce your loss until you don't give, you don't give any any bonus for them being super far" }, { "start": 827.96, "end": 835.88, "text": " apart, you don't simply don't want them to be closer together than one. All right. In their case," }, { "start": 835.88, "end": 841.6800000000001, "text": " I think they have a the dimension of these vectors is actually one, which basically means they just" }, { "start": 841.6800000000001, "end": 848.9200000000001, "text": " output the single number, which I find astonishing that that works. Yes, they use embeddings of one" }, { "start": 848.92, "end": 861.8, "text": " dimension. So they just use numbers. Astonishing that it works, but okay. So that's how you train" }, { "start": 861.8, "end": 868.7199999999999, "text": " the the embedding output embeddings close together of the same objects of the two corners," }, { "start": 868.7199999999999, "end": 875.8, "text": " and embeddings far apart for different objects. Alright, so we can now predict where the corners" }, { "start": 875.8, "end": 882.8399999999999, "text": " are, and we can match them. Now, one center part of this is the corner pooling. And why is the" }, { "start": 882.8399999999999, "end": 889.7199999999999, "text": " corner pooling necessary? So what's the problem with this sort of approach? The problem, and they" }, { "start": 889.7199999999999, "end": 898.88, "text": " have an example right here, the problem when you want to predict a corner of an object is that in" }, { "start": 898.88, "end": 906.24, "text": " a CNN, what CNN is good at is like local neighborhood information, right? So if you have to" }, { "start": 906.24, "end": 910.64, "text": " predict, let's go for the moon, actually, here, let's predict the location of the moon, if I have" }, { "start": 910.64, "end": 914.96, "text": " to predict the location of the moon, and I'm a CNN, and I have this receptive field, I'm like," }, { "start": 914.96, "end": 920.04, "text": " Oh, yes, it's like in here. And then I have this receptive field. And I'm like, yes, it's in here." }, { "start": 920.04, "end": 925.2, "text": " And then I zoom in on the corner, not on the moon itself, but on the corner where I need to predict," }, { "start": 925.2, "end": 933.2, "text": " right? At some point, I like I'm sort of, I'm like, wait, wait, where is it? Because in this" }, { "start": 933.2, "end": 941.6, "text": " particular receptive field of this resolution, I have I have no clue if the moon is close, right?" }, { "start": 941.6, "end": 948.72, "text": " So at the location where the actual bounding box is, I have no local information of the object," }, { "start": 948.72, "end": 957.36, "text": " because usually objects are not squares, they're sort of round like the moon, or like here, the" }, { "start": 957.36, "end": 963.4, "text": " plane, these corners, they have no local information about where the plane is. And corner pooling is a" }, { "start": 963.4, "end": 971.36, "text": " method to propagate that information along the axis. So what corner in corner pooling, what you" }, { "start": 971.36, "end": 980, "text": " would allow the location here in the CNN to do is to not only look at its itself, so its own location," }, { "start": 980, "end": 989.5600000000001, "text": " but actually to extend its field of view over to the right, and down to the bottom, it's asked to" }, { "start": 989.5600000000001, "end": 998.84, "text": " predict a top left corner. So what you do is you max pool everything from here to this corner" }, { "start": 998.84, "end": 1006.6800000000001, "text": " detector. So the corner detector will basically be able to detect whenever in either this band" }, { "start": 1006.6800000000001, "end": 1014.8000000000001, "text": " right here. So whenever in this band right here, there is the top, like the top of an object, like" }, { "start": 1014.8000000000001, "end": 1021.8000000000001, "text": " the top of the moon here, this corner detector can say, ah, that's probably the right height right" }, { "start": 1021.8, "end": 1030.52, "text": " here for a corner. And it combines this with the information of this side here, where it also says," }, { "start": 1030.52, "end": 1036.96, "text": " oh, there is the side of the moon, that's probably the correct, you know, up down. So there's probably" }, { "start": 1036.96, "end": 1045.48, "text": " a corner right here. Okay, whereas a location right here would get the same signal from the right," }, { "start": 1045.48, "end": 1051.88, "text": " or like almost the same signal, plus this signal right here. But in essence, it would also detect" }, { "start": 1051.88, "end": 1056.92, "text": " the top of the moon, but it would not get the same signal from down here. And therefore it says," }, { "start": 1056.92, "end": 1064.2, "text": " ah, even though to the right, I see some the top of an object, I don't see the left of an object to" }, { "start": 1064.2, "end": 1070.52, "text": " my bottom. So I'm not going to predict a corner right here. Alright, so this corner pooling goes" }, { "start": 1070.52, "end": 1076.04, "text": " for the top left, and of course, equivalently goes for the bottom right, that can always max pools to" }, { "start": 1076.04, "end": 1083.24, "text": " up and to the left of itself. And that's exactly what you see here. So in this corner pooling," }, { "start": 1083.24, "end": 1091.28, "text": " what you can do is you can propagate signal to the left and to up, and then you add the two" }, { "start": 1091.28, "end": 1096.68, "text": " informations, and that will give you your output feature. And you can calculate this actually" }, { "start": 1096.68, "end": 1103.0800000000002, "text": " fairly efficiently by doing like, like you do a cumulative sum, you do like a cumulative maximum" }, { "start": 1103.0800000000002, "end": 1110.96, "text": " across the different axes, and then you simply add two arrays. And that's it. So you simply put" }, { "start": 1110.96, "end": 1118.4, "text": " the corner pooling before you predict the these different outputs right here, the heat maps and" }, { "start": 1118.4, "end": 1125.04, "text": " the embeddings, which means that this hourglass network is not affected by this. Just the" }, { "start": 1125.04, "end": 1131.96, "text": " predictors of heat maps and embeddings, they then get the information from this hourglass network" }, { "start": 1131.96, "end": 1139.6, "text": " into these into these directions. Okay, I think that's a pretty, pretty neat method of solving" }, { "start": 1139.6, "end": 1146.24, "text": " this. And here they show how you can calculate this. And then the corner pooling is right here," }, { "start": 1146.24, "end": 1152.84, "text": " they do add a skip connection here. Because sometimes, if you just aggregate this information," }, { "start": 1152.84, "end": 1161.32, "text": " you might, you might actually get confused because so the trouble of course comes when there are" }, { "start": 1161.32, "end": 1171.24, "text": " multiple, like different objects that have, you know, the same top. And then there's also a person" }, { "start": 1171.24, "end": 1179.3999999999999, "text": " right here that so it gets like a signal, it gets another signal that there is the left side of a" }, { "start": 1179.4, "end": 1187.8400000000001, "text": " person right here. Or maybe, you know, not like this. So it will it will predict like a corner," }, { "start": 1187.8400000000001, "end": 1195.6000000000001, "text": " maybe here, where there is none. So it's, it's, sometimes it is important to have local information" }, { "start": 1195.6000000000001, "end": 1201.0800000000002, "text": " still. And that's exactly what this skip connection is supposed to address. I guess the situation up" }, { "start": 1201.0800000000002, "end": 1208.5600000000002, "text": " here would be resolved by the different embeddings. But still, so you have that you add and you put" }, { "start": 1208.56, "end": 1214.08, "text": " another bunch of convolutional layers on top of that, and then you'll get your predictions. And" }, { "start": 1214.08, "end": 1221.28, "text": " that's it. You mix all the losses. So there is a detection loss from the embeddings, there's the" }, { "start": 1221.28, "end": 1228.32, "text": " sorry, from the heat maps, there is the pull and push losses for the embeddings. And there's this" }, { "start": 1228.32, "end": 1237.32, "text": " offset loss that you train to compensate for the down the down sampling errors. And that's it. And" }, { "start": 1237.32, "end": 1244.52, "text": " they ablate the various things here, basically, they show that they're better than other one shot" }, { "start": 1244.52, "end": 1251.36, "text": " or one stage predictors. So apparently, there's one stage predictors where you have a single pass" }, { "start": 1251.36, "end": 1256.2, "text": " through a neural network. And there's two stage predictors where you have multiple or two passes" }, { "start": 1256.2, "end": 1262.4399999999998, "text": " through different neural networks. And they compete in the in the one, one stage neural network" }, { "start": 1262.44, "end": 1270.1200000000001, "text": " category, if so to say. And they show that they get significant improvements with and due to this" }, { "start": 1270.1200000000001, "end": 1277, "text": " corner pooling, which is pretty cool to see, because it makes sense. It sort of makes sense," }, { "start": 1277, "end": 1288.04, "text": " how you would like to think about it like this. And to see that it helps is pretty neat. Yeah," }, { "start": 1288.04, "end": 1295.3999999999999, "text": " they also investigate how large they have to make these these Gaussians and so on. And these are" }, { "start": 1295.3999999999999, "end": 1303.1599999999999, "text": " some qualitative examples, you can see that without the corner pooling, what you'll get is that so the" }, { "start": 1303.1599999999999, "end": 1309.08, "text": " top here and the left and the right are correct are detected correctly. But you can see that" }, { "start": 1309.08, "end": 1315.48, "text": " probably the network thinks that there is an extension of the object right here, and therefore," }, { "start": 1315.48, "end": 1327.4, "text": " doesn't do doesn't do a good job. Because this this position right here, it has no access to sort" }, { "start": 1327.4, "end": 1334.92, "text": " of it has to use like a long range access, it can't it can't really look in detail at the features" }, { "start": 1334.92, "end": 1340.76, "text": " here or here. So when it scans up and down the side, where the bottom corner where the bottom" }, { "start": 1340.76, "end": 1346.52, "text": " break is, it can it can only look at very coarse features, because it has to basically transmit" }, { "start": 1346.52, "end": 1351.8, "text": " information in the CNN of a higher layer and the higher layer has a higher receptive field," }, { "start": 1351.8, "end": 1358.2, "text": " which means it has a lower resolution. So it can't really go and look very in very detailed fashion" }, { "start": 1358.2, "end": 1367.24, "text": " at this border right here. So it misses it. Okay. Same right here, as you can see, so there are a" }, { "start": 1367.24, "end": 1374.6, "text": " number of failure cases that they can now solve using this method compared to if they didn't use" }, { "start": 1374.6, "end": 1382.76, "text": " the corner pooling. They show some also some times where their method fails, for example, here," }, { "start": 1382.76, "end": 1391.88, "text": " it matches the top, top left and bottom right corners of two different objects. Because they" }, { "start": 1391.88, "end": 1399.48, "text": " their embeddings were close enough. And yeah, that's what I'm saying. I'm I'm wondering what" }, { "start": 1399.48, "end": 1407.3200000000002, "text": " these embeddings actually learn, because they are generated independently. So not entirely sure." }, { "start": 1408.5200000000002, "end": 1415.0800000000002, "text": " It's also not exactly what I had in mind when I formulated this idea in the last video. But" }, { "start": 1415.08, "end": 1421.6399999999999, "text": " I'm actually not sure what I had in mind myself, to be honest. But in my mind, it seemed to be like" }, { "start": 1421.6399999999999, "end": 1428.12, "text": " you should be able to train a network. If there is an object right here, you could train a network" }, { "start": 1428.12, "end": 1436.36, "text": " to predict for any given location, let's say how many pixels to its bottom right, or maybe you want" }, { "start": 1436.36, "end": 1442.6, "text": " to normalize by the area that's there, are part of a particular object. And then you could use," }, { "start": 1442.6, "end": 1448.52, "text": " you could predict each pixel and use like the differences between the differences between the" }, { "start": 1448.52, "end": 1457.8799999999999, "text": " points as as scores for bounding boxes. I don't know if you see what I mean. You could basically" }, { "start": 1457.8799999999999, "end": 1465.3999999999999, "text": " tell the you have you'd have one network predict everything to the to the bottom right, and then" }, { "start": 1465.3999999999999, "end": 1471.32, "text": " you'd use the differences. And the transformers would be very good at that because they can" }, { "start": 1471.32, "end": 1477.32, "text": " sort of have this attention between each pairs of points and so on. I'm not entirely sure," }, { "start": 1477.32, "end": 1484.9199999999998, "text": " but this might just be crap. Yeah, here's some more examples. This appears to work really nicely." }, { "start": 1484.9199999999998, "end": 1491.1599999999999, "text": " But of course, in the qualitative, qualitative examples, it always works nicely, but they also" }, { "start": 1491.1599999999999, "end": 1497.24, "text": " demonstrated. All right, I found this paper all in all pretty cool, pretty neat. It's a simple idea." }, { "start": 1497.24, "end": 1502.52, "text": " It's executed well. I don't have the feeling that there are like too many tricks in here." }, { "start": 1502.52, "end": 1509.88, "text": " And they show really that the improvement seems to be due to their their corner pooling method." }, { "start": 1509.88, "end": 1517.72, "text": " And that's pretty neat. So if you like this paper, make sure to check it out. And I'll see you next" }, { "start": 1517.72, "end": 1528.04, "text": " time. Bye bye." } ]
nxEr4VNgYOE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Movement Pruning: Adaptive Sparsity by Fine-Tuning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "prune", "pruning", "transfer learning", "weights", "magnitude", "gradient", "moving", "small", "importance", "huggingface", "nlp", "natural language processing", "squad", "mnli", "bert", "transformer", "attention", "cnn", "distillation", "teacher", "sparse", "sparsity", "question answering", "mobile", "edge", "tune", "fine-tune" ]
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 Wolff and Alexander M. Rush of Hugging Face and Cornell University. On a high level, this paper proposes that if you have a transfer learning objective and you want to do pruning, you should not do pruning by weight magnitude, you should do pruning by how much the weights move during the transfer learning. This yields better results in the very sparse model regimes and is specifically relevant to current NLP transfer learning tasks such as BERT models. So if you like content like this, consider subscribing and sharing it to your friends and as always leave a comment if you have anything to say on this. Alright let's dive in. So they say magnitude pruning is a widely used strategy for reducing model size in pure supervised learning. So what is magnitude pruning? Now if I have a neural network, let's say I have a convolutional neural network and I input my little cat right here and I have a bunch of layers right and now if we look at these layers, each of these layers is going to be made up of these units of the neurons and the next layer is also made up of these neurons. Now what kind of neural network that is, 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 these 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, it's 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 stepwise fashion, they say well first of all I don't need some of these and then they delete some and then they sort of retrain the pruned network and after that they go again and they say well I don't really need that one and they don't really need that one so they do it in this stepwise fashion until the network is of the size that they want and the hope is that you don't lose too much accuracy. So the 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 you look at the weights and the weights they'll have some distribution, there will be very negative so here is very negative weights and here is very large positive weights and what you'll say is that okay probably the weights that are very large they contribute a lot to the signal of the network within the network and the weights that are quite small they're you know since there's all this noise and stuff they're probably not that important so I'm going to cut off basically right here and everything that's in here I'm going to delete those are the non-important weights whereas on the outside those are the important weights. This is called magnitude pruning because it goes by the magnitude of the weight the absolute value of the weight. So you don't actually need so there's not one threshold here you don't need a threshold you simply need a method to order the weights right and then you keep removing them until you're satisfied with the size. So this is magnitude pruning. Now what's the problem with the magnitude pruning in these kinds of tasks? They say however it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing applications. So what do you do in these transfer learning regimes? In the transfer learning regime and actually let's go with the image example right here even though it's mostly used in NLP we can do the same thing. So let's say we have a classifier here for cats and dogs our classifier and we had a big big database of cats and dogs images right so we were able to train that fairly well and we don't prune it yet we have this full network. Now we want to adapt this to a task where we want to recognize whether or not the animal is 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 the first step we'll train this big neural network on the cats versus dogs and then we 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 right this is cat this is dog and here is sick or not sick not sick and of course we can't transfer these particular weights but we hope that the features here will sort of be the same so we transfer them and then we train these weights including the head right here this part we train it on this little data set and we hope that we already have this good starting point we only need to you know learn the basically the specifics of what makes these two data sets different and we won't have to learn entire task of dealing with cat and dog images from the get-go okay so this is called transfer learning now in this case we combine the two so first we want to transfer learn like if we build this app for vets and then we might say oh this is not you know this is not only for vets this is actually for anyone you know who has a cat or a dog at home so what we could do is build an app where anyone at home could scan their their cat and it would output like a probability of the cat having that disease so we want this neural network is still the same size as this neural network so now we want to do the pruning we want this neural network to become sparse to only have a couple of connections left such that it's a few kilobytes large but retain performance now they say when you do this step you can't just do the magnitude pruning like you did right here and why not because this is not this model right here is not the result of a training step like of a regular training process but is the result of a transfer learning process where first you do the big training and then second you adapt it and why is that the case well ultimately what you want to do is you want to prove the non-important weights now there could be a weight right here this one that is very important for the cat versus dog task but that is not important for the sick versus non-sick task and we also we know that in these transfer learning settings the weights they don't tend to move that much in general the research shows that once you've trained a neural network basically the beginning is important but then once you did it like if you adapt it or transfer learn it and so on the weights they won't move that much so in essence this weight maybe starts out right here and it will sort of stay around this place it will maybe go a little bit down because it's not important but it won't move much during transfer learning that's just a property of transfer learning so this paper here says we can't just use magnitude pruning when we transfer learn because what will basically go by what will basically say is the will assign the importance based on based on the original neural network task on the cat versus dog we we will miss specify the importance of the weights what we should do is actually measure the importance with respect to this task and how do they achieve it so on a high level they're basically saying okay if we start out well this was fatal if we start out with a point over here let's make that red red i want the color red well it's blue now so if we ah if we start out with a point over here what we should do what we should do is we should observe how it moves during transfer learning if it moves towards zero then it's probably not that important for the new task and if it moves to the to be even larger then it's probably important for that new task okay 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-trained model fine-tuning we give mathematical foundations to the method and compare it to existing zero and first-order pruning methods okay so um 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 now you can express pretty much any neural network as such a multiplication with a weight so you have x the in the signal in each layer and you multiply that by the weight matrix 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 um 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 i j okay and then the top v simply means that you take the whoever are the most important the most magnitude that those are going to be one in the mask and everything else is going to be zero in the mask okay that's how this s this the w determines the s and the s determines the m okay so what you ultimately use is the m right here um but in now what we want to do is we want to actually make the s based on the movement and the movement is not really a defined concept because it goes over steps and so on so how do you do the movement in in a kind of dynamic way and this paper says you should do it by gradient so um you you should observe the gradient of your loss function with respect to this s matrix to this importance matrix right what does it mean so the what does it mean it means let's consider this quantity right here if s is the importance of a particular connection and if the gradient is large that means this this connection moves a lot right it like the loss pulls it into a particular direction okay so we're not talking about yet which direction actually the gradient has a sign it's either positive or negative right so by this quantity you can decide how much does this new task want this particular importance score to move so this is a direct direct measure of how much basically the loss function pulls on that importance score how much and now you can simply decide if and they have these they have i think they have a diagram yes so but i don't like that let's go so we have right here we have what's the value of this gradient of l with respect to s and here is w so if the gradient is positive and w is already positive that means the gradient goes into the positive direction so you increase the loss function in that let's put the negative gradient here because you do gradient descent right so so if the negative gradient is positive and the weight is already positive in in this case that means you're all the weight is already high but now the loss function wants to push it even higher so that must be a very very important weight right like it's like very good the same goes if the gradient the negative gradient is negative and the weight is already negative the weight being negative already means the weight you know it has a negative sign and then the gradient wants it to go even more negative the the optimization procedure says this thing should become even more negative and also we say that's probably a good weight now the other two cases means basically the weight's 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 to cross zero and go like if you're here going from over here gonna here cross zero and become like super large but that violates our basic assumptions that the transfer learning doesn't move the weights too much right what you're caring for is basically this local neighborhood right here okay so you can make the fair assumption that these weights are not that important in the case where the negative gradient goes against the sign of the weight so this this is of course discrete right now but we can actually assign a number by how large the gradient is and by how large the weight already is and therefore we can make a score so the important score right here as you can see is the weight multiplied by the gradient of the weight and they can actually show mathematically that if you do this over multiple steps so you optimize while you do this pruning and they do some sort of a soft pruning so you can kind of correct your mistakes later on I mean they have hard and soft pruning but in any case they can correct their mistakes later on this will actually result in these important scores being an accumulation over the training over the entire training of this quantity and that's pretty cool because that means eventually you'll sort of have a consistent estimator of these important scores across your training procedure okay because the main fear with something like this of course is that it's very brittle and very much depends on the training dynamics and who knows if in step one something bad happens and so on but the the math behind this here gives sort of more evidence that this it can be like a self-correcting mechanism it is actually not too dependent on the particular training dynamics so they do this experimental setup now they have some they have some quirks here actually let's first go to the the the actual different methods they compare different methods right here where they say okay there's magnitude pruning it's a zero with order which basically just means you just look at the weight magnitude that that's it it's top v which means you just pick the top whatever and the objective is just the loss and the scores are just the absolute value we've seen this now movement pruning on the other hand is first order which means you look at the movement in our case the gradient as you can see here those are 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 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 importance scores for the weights that here below connect to this weight I think that's what is meant not entirely sure in this though so but you can see that the objective function is also the actual loss function now this is contrasted to a baseline called l0 regularization which is quite similar but is also first order but has this sort of regularizer right here and uses the gumball softmax in order to determine the scores and as you can see it also has a different score function and it has this continuous hard concrete importance 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 importance scores and they have then a regularizer that make the importance scores sparse so instead of saying we just want the top 5% of weights they now just put a lot of mass on this lambda right here which will cause the s to be sparse and you know they think if they are not happy with how many weights they can simply increase or decrease this lambda such that they get to their desired sparsity of course you see there's the direct trade-off with the loss function right so the more you put weight on this lambda the less weight is 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-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 so 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 the actual technique but if you know you can sort of assess whether or not these it's done well and this here actually the rationale makes sense and that's why I tend to think that it is actually a better method and the experiments are very very convincing let's say okay this is just a pictorial comparison where you can see movement pruning sorry magnitude pruning all it does is it looks at after you fine-tune what are the weights and it just cuts away everything in the middle doesn't care about how the weights were when before however movement pruning looks at the combination of what were the weights before and what are the weights now and it cuts away everything where the weights moved towards zero which are these quadrants right here and it leaves in everything where it moved away from zero or that's that's the ordering let's say that how much it moved okay experiments now as you might already have figured out by now in the machine learning and especially the NLP community the methods presented always outperform the previous methods in this case it's pretty special so they test this on these number of tasks quad and NLMI and QQP and these are quite hard tasks from an NLP perspective like squad is question answering MNLIs like language inference so these would be on the I would guess these are on the foreign NLP system on the harder side of tasks that's it's fairly cool and as you can see here now just focus on first of all focus on this MAP which is the magnitude pruning so that's the baseline if you will and the 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 to and you can see that in this regime that the magnitude pruning outperforms the movement pruning but however in this regime the movement pruning is much better and that's the percent where the percent of remaining weights is very very low so this is kind of the extreme sparse case where you only have 10% or you only have 3% of the weights left and you can see that the movement pruning is outperforming the magnitude pruning by a lot okay now they do discover that so this this happens in all in all of these tasks as you can see right here and they do they do discover that if you then distill the model further so in distillation this is yet another technique that you can use to boost the performance of the transfer learned model so in distillation you would not only train the model on you so you have you now you have your this model that you transfer learn and you have the pruned version and in the pruned 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 trained on the same task right that's that's presumably better because it still has all the weights okay you can run a data point through both so the same data point goes through this and you get an output which are logits which is like representing a distribution saying yeah it's about this high now instead of assigning the hard labels so here we also get the label right it's a supervised learning task like one and zero you also put the data point through this model right here obtain whatever that model would have said and let's say it's about this and now presumably this model is better already so you say well the label here says that it's this class but the model that's really good says you shouldn't be too sure about it so you can sort of mix the two losses and this this process of transferring the knowledge of this model to here is called distillation with the lower model being the teacher model now if you do distillation you can actually improve your performance even more and they show that in the experiments here especially again in the low in the low parameter regime but you can see for example in squad here that the distilled movement pruned method now catches up with the magnitude pruned method in the also in the high in the not so sparse regime okay and they analyze these weights and as you can see that expected the magnitude pruned method it will simply cut out anything right here that's not not a surprise whereas the movement pruned method it will leave a lot of these weights alive so as you can as you can see basically it's it's very much the case since you can outperform the red the yellow one can outperform the red one it is almost warranted to say that the this magnitude pruning wasn't the best choice it's actually a better choice to leave some of those weights in and actually cut some of the weights that are large out just based on their movement now the V here in the middle is of course due to the fact that if a weight is here it was probably not super important in the first place and since since this thing removes anything that moves towards zero any point starting let's say around here moving towards zero would end up here so all the points that end up in this region probably moved towards zero during training and therefore are cut away so there's there's not just like for there to be points there would have been points that started even more in the middle and then moved out to here right and there's just not as many so that's why you have that the V shape is very natural to expect right here so they they analyze this then in terms of the where the model cuts the weights out now they experiment on a BERT base thing that which is a transformer with 12 layers and if you don't know what BERT is you can go look at my video on BERT but you can see that the magnitude pruning will sort of cut all the weights on the layers equally so it will sort of go through the layers and take away let's say 90 percent of each here you can see 10 percent of weights remaining whereas the movement pruning especially the soft movement pruning will actually make a large difference it will remove much much more of the later layers weights and keep the lower layer weights which i think if you do transfer learning from these language models it tends to be that the lower layers maybe pick up if you if you think of a CNN the lower layers might pick up you know on these essential image features like corners and so on and the higher layers will pick up on the task specific things now if you do like a big pre-training tasks you might have a lot of information that you need there but then if you distill it and transfer it down to like a small set small task where only a single thing is important like in squad it's only important what's the answer to the question then you can probably remove a lot of that superfluous information that was there like high level features from the pre-training task i mean that's my my guess here but they also have explained that so yeah that was this paper if you're still here and you enjoyed it leave a like tell me in the comments what you think and i'll see you next time bye bye
[ { "start": 0, "end": 5.96, "text": " Hi there, today we're looking at movement pruning, adaptive sparsity by fine tuning" }, { "start": 5.96, "end": 13.040000000000001, "text": " by Victor Sun, Thomas Wolff and Alexander M. Rush of Hugging Face and Cornell University." }, { "start": 13.040000000000001, "end": 18.76, "text": " On a high level, this paper proposes that if you have a transfer learning objective" }, { "start": 18.76, "end": 24.12, "text": " and you want to do pruning, you should not do pruning by weight magnitude, you should" }, { "start": 24.12, "end": 28.64, "text": " do pruning by how much the weights move during the transfer learning." }, { "start": 28.64, "end": 35.6, "text": " This yields better results in the very sparse model regimes and is specifically relevant" }, { "start": 35.6, "end": 41.54, "text": " to current NLP transfer learning tasks such as BERT models." }, { "start": 41.54, "end": 47.040000000000006, "text": " So if you like content like this, consider subscribing and sharing it to your friends" }, { "start": 47.040000000000006, "end": 52.120000000000005, "text": " and as always leave a comment if you have anything to say on this." }, { "start": 52.120000000000005, "end": 53.88, "text": " Alright let's dive in." }, { "start": 53.88, "end": 60.580000000000005, "text": " So they say magnitude pruning is a widely used strategy for reducing model size in pure" }, { "start": 60.580000000000005, "end": 62.400000000000006, "text": " supervised learning." }, { "start": 62.400000000000006, "end": 64.82000000000001, "text": " So what is magnitude pruning?" }, { "start": 64.82000000000001, "end": 70.32000000000001, "text": " Now if I have a neural network, let's say I have a convolutional neural network and" }, { "start": 70.32000000000001, "end": 76.36, "text": " I input my little cat right here and I have a bunch of layers right and now if we look" }, { "start": 76.36, "end": 81.92, "text": " at these layers, each of these layers is going to be made up of these units of the neurons" }, { "start": 81.92, "end": 85.48, "text": " and the next layer is also made up of these neurons." }, { "start": 85.48, "end": 90.96000000000001, "text": " Now what kind of neural network that is, it's not that important but what is important is" }, { "start": 90.96000000000001, "end": 96.08, "text": " that you have these connections from neuron to neuron and in let's say a fully connected" }, { "start": 96.08, "end": 100.28, "text": " network every neuron is connected to every other neuron." }, { "start": 100.28, "end": 105.16, "text": " In a CNN that would be slightly different but in essence you have a lot of connections" }, { "start": 105.16, "end": 108.64, "text": " here and these are usually called weights." }, { "start": 108.64, "end": 110.56, "text": " So these are the weights." }, { "start": 110.56, "end": 117.28, "text": " Now the problem is if I train like these giant neural networks and I want to ship them for" }, { "start": 117.28, "end": 124.46000000000001, "text": " example to mobile devices to my customers then they won't be able to download gigabytes" }, { "start": 124.46000000000001, "end": 129.12, "text": " of models or even like hundreds of megabytes of models, it's just not possible." }, { "start": 129.12, "end": 133.76, "text": " So what we want to do is we want to prune this model which means we want to remove parts" }, { "start": 133.76, "end": 140.28, "text": " of these weights, a lot of these weights but we don't want to lose accuracy of the network." }, { "start": 140.28, "end": 144.92, "text": " So imagine I have a network and that's trained, it's an image classifier, it's here it's cats" }, { "start": 144.92, "end": 148.92000000000002, "text": " or dogs and I have it trained to a good accuracy." }, { "start": 148.92000000000002, "end": 157, "text": " I want to delete these weights but I want to retain the performance and these methods" }, { "start": 157, "end": 158.4, "text": " are called pruning." }, { "start": 158.4, "end": 163.32, "text": " Now what people do is usually they sort of go in stepwise fashion, they say well first" }, { "start": 163.32, "end": 170.51999999999998, "text": " of all I don't need some of these and then they delete some and then they sort of retrain" }, { "start": 170.51999999999998, "end": 175.12, "text": " the pruned network and after that they go again and they say well I don't really need" }, { "start": 175.12, "end": 180.04, "text": " that one and they don't really need that one so they do it in this stepwise fashion until" }, { "start": 180.04, "end": 185.84, "text": " the network is of the size that they want and the hope is that you don't lose too much" }, { "start": 185.84, "end": 187.04, "text": " accuracy." }, { "start": 187.04, "end": 192.44, "text": " So the question is how do you select which weights you need and which ones you don't" }, { "start": 192.44, "end": 201.24, "text": " need and usually this is done by so called magnitude pruning which means that you look" }, { "start": 201.24, "end": 210.28, "text": " at the weights and the weights they'll have some distribution, there will be very negative" }, { "start": 210.28, "end": 215.28, "text": " so here is very negative weights and here is very large positive weights and what you'll" }, { "start": 215.28, "end": 220.6, "text": " say is that okay probably the weights that are very large they contribute a lot to the" }, { "start": 220.6, "end": 225.6, "text": " signal of the network within the network and the weights that are quite small they're you" }, { "start": 225.6, "end": 228.95999999999998, "text": " know since there's all this noise and stuff they're probably not that important so I'm" }, { "start": 228.95999999999998, "end": 235.6, "text": " going to cut off basically right here and everything that's in here I'm going to delete" }, { "start": 235.6, "end": 240.45999999999998, "text": " those are the non-important weights whereas on the outside those are the important weights." }, { "start": 240.45999999999998, "end": 244.6, "text": " This is called magnitude pruning because it goes by the magnitude of the weight the absolute" }, { "start": 244.6, "end": 247.44, "text": " value of the weight." }, { "start": 247.44, "end": 253.07999999999998, "text": " So you don't actually need so there's not one threshold here you don't need a threshold" }, { "start": 253.07999999999998, "end": 257.76, "text": " you simply need a method to order the weights right and then you keep removing them until" }, { "start": 257.76, "end": 260.76, "text": " you're satisfied with the size." }, { "start": 260.76, "end": 263.34, "text": " So this is magnitude pruning." }, { "start": 263.34, "end": 268.52, "text": " Now what's the problem with the magnitude pruning in these kinds of tasks?" }, { "start": 268.52, "end": 273.92, "text": " They say however it is less effective in the transfer learning regime that has become standard" }, { "start": 273.92, "end": 278.48, "text": " for state-of-the-art natural language processing applications." }, { "start": 278.48, "end": 281.08000000000004, "text": " So what do you do in these transfer learning regimes?" }, { "start": 281.08000000000004, "end": 285.88, "text": " In the transfer learning regime and actually let's go with the image example right here" }, { "start": 285.88, "end": 289.82, "text": " even though it's mostly used in NLP we can do the same thing." }, { "start": 289.82, "end": 295.04, "text": " So let's say we have a classifier here for cats and dogs our classifier and we had a" }, { "start": 295.04, "end": 300.44, "text": " big big database of cats and dogs images right so we were able to train that fairly well" }, { "start": 300.44, "end": 303.42, "text": " and we don't prune it yet we have this full network." }, { "start": 303.42, "end": 312.16, "text": " Now we want to adapt this to a task where we want to recognize whether or not the animal" }, { "start": 312.16, "end": 313.74, "text": " is sick." }, { "start": 313.74, "end": 319.28000000000003, "text": " So we developed this app for a veterinarian and it's like a short screening for a particular" }, { "start": 319.28000000000003, "end": 325.14, "text": " disease that a cat might have and we already have this cats and dogs classifier so it's" }, { "start": 325.14, "end": 331.44, "text": " reasonable to assume that this classifier has some good features to work with cats and" }, { "start": 331.44, "end": 332.66, "text": " dog images." }, { "start": 332.66, "end": 337.44, "text": " So what we can do instead of because let's assume for this other task we just have this" }, { "start": 337.44, "end": 342.24, "text": " tiny little data set which is not enough to train a neural network of this size right" }, { "start": 342.24, "end": 348.16, "text": " but so in the first step we'll train this big neural network on the cats versus dogs" }, { "start": 348.16, "end": 354, "text": " and then we what we do is we transfer learning so we transfer all the weights right here" }, { "start": 354, "end": 360.38, "text": " and here we have a different task now sick or not sick right this is cat this is dog" }, { "start": 360.38, "end": 369.1, "text": " and here is sick or not sick not sick and of course we can't transfer these particular" }, { "start": 369.1, "end": 375.76, "text": " weights but we hope that the features here will sort of be the same so we transfer them" }, { "start": 375.76, "end": 382.38, "text": " and then we train these weights including the head right here this part we train it" }, { "start": 382.38, "end": 387.34, "text": " on this little data set and we hope that we already have this good starting point we only" }, { "start": 387.34, "end": 393.38, "text": " need to you know learn the basically the specifics of what makes these two data sets different" }, { "start": 393.38, "end": 400.9, "text": " and we won't have to learn entire task of dealing with cat and dog images from the get-go" }, { "start": 400.9, "end": 408.02, "text": " okay so this is called transfer learning now in this case we combine the two so first we" }, { "start": 408.02, "end": 413.7, "text": " want to transfer learn like if we build this app for vets and then we might say oh this" }, { "start": 413.7, "end": 418.38, "text": " is not you know this is not only for vets this is actually for anyone you know who has" }, { "start": 418.38, "end": 423.62, "text": " a cat or a dog at home so what we could do is build an app where anyone at home could" }, { "start": 423.62, "end": 429.62, "text": " scan their their cat and it would output like a probability of the cat having that disease" }, { "start": 429.62, "end": 434.09999999999997, "text": " so we want this neural network is still the same size as this neural network so now we" }, { "start": 434.09999999999997, "end": 441.06, "text": " want to do the pruning we want this neural network to become sparse to only have a couple" }, { "start": 441.06, "end": 447.78000000000003, "text": " of connections left such that it's a few kilobytes large but retain performance now they say" }, { "start": 447.78000000000003, "end": 455.86, "text": " when you do this step you can't just do the magnitude pruning like you did right here" }, { "start": 455.86, "end": 463.22, "text": " and why not because this is not this model right here is not the result of a training" }, { "start": 463.22, "end": 469.46, "text": " step like of a regular training process but is the result of a transfer learning process" }, { "start": 469.46, "end": 476.7, "text": " where first you do the big training and then second you adapt it and why is that the case" }, { "start": 476.7, "end": 482.85999999999996, "text": " well ultimately what you want to do is you want to prove the non-important weights now" }, { "start": 482.85999999999996, "end": 488.14, "text": " there could be a weight right here this one that is very important for the cat versus" }, { "start": 488.14, "end": 496.46, "text": " dog task but that is not important for the sick versus non-sick task and we also we know" }, { "start": 496.46, "end": 501.18, "text": " that in these transfer learning settings the weights they don't tend to move that much" }, { "start": 501.18, "end": 508.26, "text": " in general the research shows that once you've trained a neural network basically the beginning" }, { "start": 508.26, "end": 513.06, "text": " is important but then once you did it like if you adapt it or transfer learn it and so" }, { "start": 513.06, "end": 520.9399999999999, "text": " on the weights they won't move that much so in essence this weight maybe starts out right" }, { "start": 520.94, "end": 528, "text": " here and it will sort of stay around this place it will maybe go a little bit down because" }, { "start": 528, "end": 531.98, "text": " it's not important but it won't move much during transfer learning that's just a property" }, { "start": 531.98, "end": 537.46, "text": " of transfer learning so this paper here says we can't just use magnitude pruning when we" }, { "start": 537.46, "end": 543.34, "text": " transfer learn because what will basically go by what will basically say is the will" }, { "start": 543.34, "end": 549.2600000000001, "text": " assign the importance based on based on the original neural network task on the cat versus" }, { "start": 549.26, "end": 555.14, "text": " dog we we will miss specify the importance of the weights what we should do is actually" }, { "start": 555.14, "end": 560.9399999999999, "text": " measure the importance with respect to this task and how do they achieve it so on a high" }, { "start": 560.9399999999999, "end": 568.52, "text": " level they're basically saying okay if we start out well this was fatal if we start" }, { "start": 568.52, "end": 577.84, "text": " out with a point over here let's make that red red i want the color red well it's blue" }, { "start": 577.84, "end": 583.58, "text": " now so if we ah if we start out with a point over here what we should do what we should" }, { "start": 583.58, "end": 590.1800000000001, "text": " do is we should observe how it moves during transfer learning if it moves towards zero" }, { "start": 590.1800000000001, "end": 595.94, "text": " then it's probably not that important for the new task and if it moves to the to be" }, { "start": 595.94, "end": 602.1, "text": " even larger then it's probably important for that new task okay so that's that's a high" }, { "start": 602.1, "end": 607.86, "text": " level now how do you measure how it moves and what exactly how exactly do you do all" }, { "start": 607.86, "end": 613.4200000000001, "text": " of this during training such that you don't make mistakes that's the point of this paper" }, { "start": 613.4200000000001, "end": 620.1, "text": " they say we propose movement pruning a simple deterministic first-order weight pruning method" }, { "start": 620.1, "end": 625.86, "text": " that is more adaptive to pre-trained model fine-tuning we give mathematical foundations" }, { "start": 625.86, "end": 634.38, "text": " to the method and compare it to existing zero and first-order pruning methods okay so um" }, { "start": 634.38, "end": 642.98, "text": " yeah we said so that's basically on a high level that's that now how do they actually" }, { "start": 642.98, "end": 651.98, "text": " do it what they do right here is the following they say what we can define we can define" }, { "start": 651.98, "end": 661.26, "text": " each each network layer basically as a matrix multiplication by a weight now you can express" }, { "start": 661.26, "end": 667.78, "text": " pretty much any neural network as such a multiplication with a weight so you have x the in the signal" }, { "start": 667.78, "end": 674.46, "text": " in each layer and you multiply that by the weight matrix w now if you prune the neural" }, { "start": 674.46, "end": 681.1, "text": " network you can see that right here what you're saying is i basically in here i have the matrix" }, { "start": 681.1, "end": 688.34, "text": " m which is a mask so the mask is either zero or one for if a weight is active or if a weight" }, { "start": 688.34, "end": 695.78, "text": " is not active now this is not a matrix multiply actually this is like a hadamard product um" }, { "start": 695.78, "end": 703.14, "text": " but you have this mask matrix and what decides on this mask this mask is decided as you can" }, { "start": 703.14, "end": 714.46, "text": " see right here by this s so s s is a matrix that for each entry in w it will decide how" }, { "start": 714.46, "end": 720.74, "text": " important it is now in the classic sense in the magnitude pruning you already saw that" }, { "start": 720.74, "end": 728.06, "text": " this is just going to be the absolute value of w i j okay and then the top v simply means" }, { "start": 728.06, "end": 733.6999999999999, "text": " that you take the whoever are the most important the most magnitude that those are going to" }, { "start": 733.6999999999999, "end": 739.6999999999999, "text": " be one in the mask and everything else is going to be zero in the mask okay that's how" }, { "start": 739.6999999999999, "end": 746.9, "text": " this s this the w determines the s and the s determines the m okay so what you ultimately" }, { "start": 746.9, "end": 754.78, "text": " use is the m right here um but in now what we want to do is we want to actually make" }, { "start": 754.78, "end": 759.62, "text": " the s based on the movement and the movement is not really a defined concept because it" }, { "start": 759.62, "end": 767.5, "text": " goes over steps and so on so how do you do the movement in in a kind of dynamic way and" }, { "start": 767.5, "end": 775.5, "text": " this paper says you should do it by gradient so um you you should observe the gradient" }, { "start": 775.5, "end": 782.3, "text": " of your loss function with respect to this s matrix to this importance matrix right what" }, { "start": 782.3, "end": 797.0999999999999, "text": " does it mean so the what does it mean it means let's consider this quantity right here if" }, { "start": 797.0999999999999, "end": 805.66, "text": " s is the importance of a particular connection and if the gradient is large that means this" }, { "start": 805.66, "end": 812.42, "text": " this connection moves a lot right it like the loss pulls it into a particular direction" }, { "start": 812.42, "end": 817.5799999999999, "text": " okay so we're not talking about yet which direction actually the gradient has a sign" }, { "start": 817.5799999999999, "end": 823.2199999999999, "text": " it's either positive or negative right so by this quantity you can decide how much does" }, { "start": 823.2199999999999, "end": 831.42, "text": " this new task want this particular importance score to move so this is a direct direct measure" }, { "start": 831.42, "end": 837.3399999999999, "text": " of how much basically the loss function pulls on that importance score how much and now" }, { "start": 837.3399999999999, "end": 847.88, "text": " you can simply decide if and they have these they have i think they have a diagram yes" }, { "start": 847.88, "end": 856.54, "text": " so but i don't like that let's go so we have right here we have what's the value of this" }, { "start": 856.54, "end": 866.38, "text": " gradient of l with respect to s and here is w so if the gradient is positive and w is" }, { "start": 866.38, "end": 876.74, "text": " already positive that means the gradient goes into the positive direction so you increase" }, { "start": 876.74, "end": 882.26, "text": " the loss function in that let's put the negative gradient here because you do gradient descent" }, { "start": 882.26, "end": 889.66, "text": " right so so if the negative gradient is positive and the weight is already positive in in this" }, { "start": 889.66, "end": 895.8199999999999, "text": " case that means you're all the weight is already high but now the loss function wants to push" }, { "start": 895.8199999999999, "end": 901.14, "text": " it even higher so that must be a very very important weight right like it's like very" }, { "start": 901.14, "end": 909.3, "text": " good the same goes if the gradient the negative gradient is negative and the weight is already" }, { "start": 909.3, "end": 914.0999999999999, "text": " negative the weight being negative already means the weight you know it has a negative" }, { "start": 914.0999999999999, "end": 920.14, "text": " sign and then the gradient wants it to go even more negative the the optimization procedure" }, { "start": 920.14, "end": 926.38, "text": " says this thing should become even more negative and also we say that's probably a good weight" }, { "start": 926.38, "end": 931.18, "text": " now the other two cases means basically the weight's already positive but the gradient" }, { "start": 931.18, "end": 936.26, "text": " wants it to go negative which means it's pulled towards zero now it's entirely possible that" }, { "start": 936.26, "end": 943.98, "text": " it's going to cross zero and go like if you're here going from over here gonna here cross" }, { "start": 943.98, "end": 949.3199999999999, "text": " zero and become like super large but that violates our basic assumptions that the transfer" }, { "start": 949.3199999999999, "end": 953.38, "text": " learning doesn't move the weights too much right what you're caring for is basically" }, { "start": 953.38, "end": 959.06, "text": " this local neighborhood right here okay so you can make the fair assumption that these" }, { "start": 959.06, "end": 964.7, "text": " weights are not that important in the case where the negative gradient goes against the" }, { "start": 964.7, "end": 970.34, "text": " sign of the weight so this this is of course discrete right now but we can actually assign" }, { "start": 970.34, "end": 976.4200000000001, "text": " a number by how large the gradient is and by how large the weight already is and therefore" }, { "start": 976.4200000000001, "end": 985.34, "text": " we can make a score so the important score right here as you can see is the weight multiplied" }, { "start": 985.34, "end": 991.22, "text": " by the gradient of the weight and they can actually show mathematically that if you do" }, { "start": 991.22, "end": 996.48, "text": " this over multiple steps so you optimize while you do this pruning and they do some sort" }, { "start": 996.48, "end": 1001.9, "text": " of a soft pruning so you can kind of correct your mistakes later on I mean they have hard" }, { "start": 1001.9, "end": 1007.0600000000001, "text": " and soft pruning but in any case they can correct their mistakes later on this will" }, { "start": 1007.0600000000001, "end": 1012.0600000000001, "text": " actually result in these important scores being an accumulation over the training over" }, { "start": 1012.0600000000001, "end": 1020.34, "text": " the entire training of this quantity and that's pretty cool because that means eventually" }, { "start": 1020.34, "end": 1025.18, "text": " you'll sort of have a consistent estimator of these important scores across your training" }, { "start": 1025.18, "end": 1030.02, "text": " procedure okay because the main fear with something like this of course is that it's" }, { "start": 1030.02, "end": 1035.14, "text": " very brittle and very much depends on the training dynamics and who knows if in step" }, { "start": 1035.14, "end": 1041.38, "text": " one something bad happens and so on but the the math behind this here gives sort of more" }, { "start": 1041.38, "end": 1047.8600000000001, "text": " evidence that this it can be like a self-correcting mechanism it is actually not too dependent" }, { "start": 1047.86, "end": 1055.1799999999998, "text": " on the particular training dynamics so they do this experimental setup now they have some" }, { "start": 1055.1799999999998, "end": 1060.06, "text": " they have some quirks here actually let's first go to the the the actual different methods" }, { "start": 1060.06, "end": 1064.82, "text": " they compare different methods right here where they say okay there's magnitude pruning" }, { "start": 1064.82, "end": 1069.3, "text": " it's a zero with order which basically just means you just look at the weight magnitude" }, { "start": 1069.3, "end": 1076.4599999999998, "text": " that that's it it's top v which means you just pick the top whatever and the objective" }, { "start": 1076.46, "end": 1081.5, "text": " is just the loss and the scores are just the absolute value we've seen this now movement" }, { "start": 1081.5, "end": 1085.58, "text": " pruning on the other hand is first order which means you look at the movement in our case" }, { "start": 1085.58, "end": 1091.18, "text": " the gradient as you can see here those are the importance scores and you use this straight" }, { "start": 1091.18, "end": 1096.3, "text": " through estimator which is basically just a way of saying that even though you're masking" }, { "start": 1096.3, "end": 1100.9, "text": " some things in the forward step you shouldn't mask them in the in the gradient backward" }, { "start": 1100.9, "end": 1106.26, "text": " step because you still want gradient signal to reach so if you have layers and you have" }, { "start": 1106.26, "end": 1111.14, "text": " a weight right here at least that's how I understand it I have not read that paper but" }, { "start": 1111.14, "end": 1116.46, "text": " if you mask this one here you still want the gradient to sort of flow backwards because" }, { "start": 1116.46, "end": 1122.74, "text": " you still need the actual importance scores for the weights that here below connect to" }, { "start": 1122.74, "end": 1130.7, "text": " this weight I think that's what is meant not entirely sure in this though so but you can" }, { "start": 1130.7, "end": 1136.66, "text": " see that the objective function is also the actual loss function now this is contrasted" }, { "start": 1136.66, "end": 1144.04, "text": " to a baseline called l0 regularization which is quite similar but is also first order but" }, { "start": 1144.04, "end": 1149.72, "text": " has this sort of regularizer right here and uses the gumball softmax in order to determine" }, { "start": 1149.72, "end": 1155.02, "text": " the scores and as you can see it also has a different score function and it has this" }, { "start": 1155.02, "end": 1163.3799999999999, "text": " continuous hard concrete importance masking function sorry masking function and they have" }, { "start": 1163.3799999999999, "end": 1168.46, "text": " a variant of movement pruning that tends to perform a little bit better which is soft" }, { "start": 1168.46, "end": 1174.06, "text": " movement pruning where instead of just going by the loss function optimizing the loss function" }, { "start": 1174.06, "end": 1179.46, "text": " they optimize the loss function plus something now they have as you can see here they have" }, { "start": 1179.46, "end": 1188.9, "text": " a thresholding masking function and the threshold is actually dynamic or it's determined by" }, { "start": 1188.9, "end": 1193.52, "text": " the importance scores and they have then a regularizer that make the importance scores" }, { "start": 1193.52, "end": 1200.74, "text": " sparse so instead of saying we just want the top 5% of weights they now just put a lot" }, { "start": 1200.74, "end": 1207.78, "text": " of mass on this lambda right here which will cause the s to be sparse and you know they" }, { "start": 1207.78, "end": 1212.3, "text": " think if they are not happy with how many weights they can simply increase or decrease" }, { "start": 1212.3, "end": 1219.3, "text": " this lambda such that they get to their desired sparsity of course you see there's the direct" }, { "start": 1219.3, "end": 1226.7, "text": " trade-off with the loss function right so the more you put weight on this lambda the" }, { "start": 1226.7, "end": 1232.22, "text": " less weight is you put basically on the loss function itself so you have the trade-off" }, { "start": 1232.22, "end": 1239.06, "text": " here is very explicit whereas in basic movement pruning it's just given by you masking away" }, { "start": 1239.06, "end": 1247.18, "text": " completely the bottom 1-v of percent of the weights but you see the score function is" }, { "start": 1247.18, "end": 1259.94, "text": " the same oh well the score function here the score function is the same okay now there" }, { "start": 1259.94, "end": 1266.38, "text": " are quite a number of tricks here like there's this sparsity scheduling function and so on" }, { "start": 1266.38, "end": 1272.6200000000001, "text": " so as always in NLP and with any big models there are a bunch of engineering tricks that" }, { "start": 1272.6200000000001, "end": 1279.46, "text": " make everything work better and you can never exactly tell how much is due to that and how" }, { "start": 1279.46, "end": 1284.78, "text": " much is due to the the actual technique but if you know you can sort of assess whether" }, { "start": 1284.78, "end": 1290.82, "text": " or not these it's done well and this here actually the rationale makes sense and that's" }, { "start": 1290.82, "end": 1298.7, "text": " why I tend to think that it is actually a better method and the experiments are very" }, { "start": 1298.7, "end": 1305.82, "text": " very convincing let's say okay this is just a pictorial comparison where you can see movement" }, { "start": 1305.82, "end": 1311.7, "text": " pruning sorry magnitude pruning all it does is it looks at after you fine-tune what are" }, { "start": 1311.7, "end": 1316.3400000000001, "text": " the weights and it just cuts away everything in the middle doesn't care about how the weights" }, { "start": 1316.3400000000001, "end": 1322.6200000000001, "text": " were when before however movement pruning looks at the combination of what were the" }, { "start": 1322.6200000000001, "end": 1329.46, "text": " weights before and what are the weights now and it cuts away everything where the weights" }, { "start": 1329.46, "end": 1334.3, "text": " moved towards zero which are these quadrants right here and it leaves in everything where" }, { "start": 1334.3, "end": 1343.18, "text": " it moved away from zero or that's that's the ordering let's say that how much it moved" }, { "start": 1343.18, "end": 1350.7, "text": " okay experiments now as you might already have figured out by now in the machine learning" }, { "start": 1350.7, "end": 1358.78, "text": " and especially the NLP community the methods presented always outperform the previous methods" }, { "start": 1358.78, "end": 1364.26, "text": " in this case it's pretty special so they test this on these number of tasks quad and NLMI" }, { "start": 1364.26, "end": 1370.84, "text": " and QQP and these are quite hard tasks from an NLP perspective like squad is question" }, { "start": 1370.84, "end": 1377.4, "text": " answering MNLIs like language inference so these would be on the I would guess these" }, { "start": 1377.4, "end": 1384.18, "text": " are on the foreign NLP system on the harder side of tasks that's it's fairly cool and" }, { "start": 1384.18, "end": 1391.94, "text": " as you can see here now just focus on first of all focus on this MAP which is the magnitude" }, { "start": 1391.94, "end": 1401.2, "text": " pruning so that's the baseline if you will and the purple one the SMVP which is the soft" }, { "start": 1401.2, "end": 1406.6200000000001, "text": " movement pruning okay now you can also focus on the MVP right here but they're approximately" }, { "start": 1406.6200000000001, "end": 1414.1000000000001, "text": " the same now the RPP you can maybe see in the graph is performing fairly well even compared" }, { "start": 1414.1000000000001, "end": 1421.92, "text": " to the full model it's another baseline basically but we just want to compare those to and" }, { "start": 1421.92, "end": 1430.7, "text": " you can see that in this regime that the magnitude pruning outperforms the movement pruning but" }, { "start": 1430.7, "end": 1436.44, "text": " however in this regime the movement pruning is much better and that's the percent where" }, { "start": 1436.44, "end": 1441.14, "text": " the percent of remaining weights is very very low so this is kind of the extreme sparse" }, { "start": 1441.14, "end": 1447.66, "text": " case where you only have 10% or you only have 3% of the weights left and you can see that" }, { "start": 1447.66, "end": 1455.22, "text": " the movement pruning is outperforming the magnitude pruning by a lot okay now they do" }, { "start": 1455.22, "end": 1463.42, "text": " discover that so this this happens in all in all of these tasks as you can see right" }, { "start": 1463.42, "end": 1472.6200000000001, "text": " here and they do they do discover that if you then distill the model further so in distillation" }, { "start": 1472.62, "end": 1477.62, "text": " this is yet another technique that you can use to boost the performance of the transfer" }, { "start": 1477.62, "end": 1488.86, "text": " learned model so in distillation you would not only train the model on you so you have" }, { "start": 1488.86, "end": 1496.3999999999999, "text": " you now you have your this model that you transfer learn and you have the pruned version" }, { "start": 1496.3999999999999, "end": 1500.84, "text": " and in the pruned version what you would do is you would simply also train it on this" }, { "start": 1500.84, "end": 1506.58, "text": " data set but what you can also do is you can distill this model right here the one that" }, { "start": 1506.58, "end": 1510.6599999999999, "text": " you trained on the same task right that's that's presumably better because it still" }, { "start": 1510.6599999999999, "end": 1517.34, "text": " has all the weights okay you can run a data point through both so the same data point" }, { "start": 1517.34, "end": 1522.98, "text": " goes through this and you get an output which are logits which is like representing a distribution" }, { "start": 1522.98, "end": 1529.82, "text": " saying yeah it's about this high now instead of assigning the hard labels so here we also" }, { "start": 1529.82, "end": 1534.6599999999999, "text": " get the label right it's a supervised learning task like one and zero you also put the data" }, { "start": 1534.6599999999999, "end": 1544.1, "text": " point through this model right here obtain whatever that model would have said and let's" }, { "start": 1544.1, "end": 1553.6599999999999, "text": " say it's about this and now presumably this model is better already so you say well the" }, { "start": 1553.6599999999999, "end": 1559.74, "text": " label here says that it's this class but the model that's really good says you shouldn't" }, { "start": 1559.74, "end": 1566, "text": " be too sure about it so you can sort of mix the two losses and this this process of transferring" }, { "start": 1566, "end": 1572.14, "text": " the knowledge of this model to here is called distillation with the lower model being the" }, { "start": 1572.14, "end": 1578.72, "text": " teacher model now if you do distillation you can actually improve your performance even" }, { "start": 1578.72, "end": 1587.06, "text": " more and they show that in the experiments here especially again in the low in the low" }, { "start": 1587.06, "end": 1593.1, "text": " parameter regime but you can see for example in squad here that the distilled movement" }, { "start": 1593.1, "end": 1600.24, "text": " pruned method now catches up with the magnitude pruned method in the also in the high in the" }, { "start": 1600.24, "end": 1609.8999999999999, "text": " not so sparse regime okay and they analyze these weights and as you can see that expected" }, { "start": 1609.8999999999999, "end": 1616.22, "text": " the magnitude pruned method it will simply cut out anything right here that's not not" }, { "start": 1616.22, "end": 1622.08, "text": " a surprise whereas the movement pruned method it will leave a lot of these weights alive" }, { "start": 1622.08, "end": 1631.78, "text": " so as you can as you can see basically it's it's very much the case since you can outperform" }, { "start": 1631.78, "end": 1638.6200000000001, "text": " the red the yellow one can outperform the red one it is almost warranted to say that" }, { "start": 1638.6200000000001, "end": 1644.02, "text": " the this magnitude pruning wasn't the best choice it's actually a better choice to leave" }, { "start": 1644.02, "end": 1648.78, "text": " some of those weights in and actually cut some of the weights that are large out just" }, { "start": 1648.78, "end": 1654.66, "text": " based on their movement now the V here in the middle is of course due to the fact that" }, { "start": 1654.66, "end": 1663.06, "text": " if a weight is here it was probably not super important in the first place and since since" }, { "start": 1663.06, "end": 1669.42, "text": " this thing removes anything that moves towards zero any point starting let's say around here" }, { "start": 1669.42, "end": 1674.46, "text": " moving towards zero would end up here so all the points that end up in this region probably" }, { "start": 1674.46, "end": 1682.6200000000001, "text": " moved towards zero during training and therefore are cut away so there's there's not just like" }, { "start": 1682.6200000000001, "end": 1687.18, "text": " for there to be points there would have been points that started even more in the middle" }, { "start": 1687.18, "end": 1691.26, "text": " and then moved out to here right and there's just not as many so that's why you have that" }, { "start": 1691.26, "end": 1701.98, "text": " the V shape is very natural to expect right here so they they analyze this then in terms" }, { "start": 1701.98, "end": 1711.26, "text": " of the where the model cuts the weights out now they experiment on a BERT base thing that" }, { "start": 1711.26, "end": 1715.9, "text": " which is a transformer with 12 layers and if you don't know what BERT is you can go" }, { "start": 1715.9, "end": 1726.14, "text": " look at my video on BERT but you can see that the magnitude pruning will sort of cut all" }, { "start": 1726.14, "end": 1732.18, "text": " the weights on the layers equally so it will sort of go through the layers and take away" }, { "start": 1732.18, "end": 1738.18, "text": " let's say 90 percent of each here you can see 10 percent of weights remaining whereas" }, { "start": 1738.18, "end": 1743.5, "text": " the movement pruning especially the soft movement pruning will actually make a large difference" }, { "start": 1743.5, "end": 1750.9, "text": " it will remove much much more of the later layers weights and keep the lower layer weights" }, { "start": 1750.9, "end": 1755.86, "text": " which i think if you do transfer learning from these language models it tends to be" }, { "start": 1755.86, "end": 1761.5, "text": " that the lower layers maybe pick up if you if you think of a CNN the lower layers might" }, { "start": 1761.5, "end": 1766.46, "text": " pick up you know on these essential image features like corners and so on and the higher" }, { "start": 1766.46, "end": 1771.64, "text": " layers will pick up on the task specific things now if you do like a big pre-training tasks" }, { "start": 1771.64, "end": 1775.38, "text": " you might have a lot of information that you need there but then if you distill it and" }, { "start": 1775.38, "end": 1781.46, "text": " transfer it down to like a small set small task where only a single thing is important" }, { "start": 1781.46, "end": 1785.88, "text": " like in squad it's only important what's the answer to the question then you can probably" }, { "start": 1785.88, "end": 1791.22, "text": " remove a lot of that superfluous information that was there like high level features from" }, { "start": 1791.22, "end": 1798.7, "text": " the pre-training task i mean that's my my guess here but they also have explained that" }, { "start": 1798.7, "end": 1806.1000000000001, "text": " so yeah that was this paper if you're still here and you enjoyed it leave a like tell" }, { "start": 1806.1, "end": 1833.1399999999999, "text": " me in the comments what you think and i'll see you next time bye bye" } ]
hQEnzdLkPj4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Learning To Classify Images Without Labels (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "ethz", "clustering", "self-supervision", "self-labeling", "entropy", "dot product", "representation learning", "cnns", "convolutional neural network", "deep cluster", "nce", "noise contrastive estimation", "unsupervised", "overcluster", "imagenet", "cifar10", "nearest neighbors" ]
How do you learn labels without labels? How do you classify images when you don't know what to classify them into? This paper investigates a new combination of representation learning, clustering, and self-labeling in order to group visually similar images together - and achieves surprisingly high accuracy on benchmark datasets. OUTLINE: 0:00 - Intro & High-level Overview 2:15 - Problem Statement 4:50 - Why naive Clustering does not work 9:25 - Representation Learning 13:40 - Nearest-neighbor-based Clustering 28:00 - Self-Labeling 32:10 - Experiments 38:20 - ImageNet Experiments 41:00 - Overclustering Paper: https://arxiv.org/abs/2005.12320 Code: https://github.com/wvangansbeke/Unsupervised-Classification Abstract: Is it possible to automatically classify images without the use of ground-truth annotations? Or when even the classes themselves, are not a priori known? These remain important, and open questions in computer vision. Several approaches have tried to tackle this problem in an end-to-end fashion. In this paper, we deviate from recent works, and advocate a two-step approach where feature learning and clustering are decoupled. First, a self-supervised task from representation learning is employed to obtain semantically meaningful features. Second, we use the obtained features as a prior in a learnable clustering approach. In doing so, we remove the ability for cluster learning to depend on low-level features, which is present in current end-to-end learning approaches. Experimental evaluation shows that we outperform state-of-the-art methods by huge margins, in particular +26.9% on CIFAR10, +21.5% on CIFAR100-20 and +11.7% on STL10 in terms of classification accuracy. Furthermore, results on ImageNet show that our approach is the first to scale well up to 200 randomly selected classes, obtaining 69.3% top-1 and 85.5% top-5 accuracy, and marking a difference of less than 7.5% with fully-supervised methods. Finally, we applied our approach to all 1000 classes on ImageNet, and found the results to be very encouraging. The code will be made publicly available. Authors: Wouter Van Gansbeke, Simon Vandenhende, Stamatios Georgoulis, Marc Proesmans, Luc Van Gool Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Check out these clusters of images right here. And just have a look at how all of them are pretty much showing the same object. So here's balloons, here's birds, here's sharks or other fish. These are images from the ImageNet dataset. And you can see that these clusters are pretty much the object classes themselves. 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 dataset. Of course, the dataset 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 Ganzbecke, Simon Vandenhende, Stamatios Georgoulis, Mark Prozémans and Luke van Gaal. And on a high-level overview, they have a three-step procedure. Basically, first, they use self-supervised learning in order to get good representations. Second, they do a clustering. So they do a sort of k-nearest neighbor clustering, but they do clustering on top of those things. But they do it in a kind of special way. And then third, they do a refinement through self-labeling. So if you know what all of these are, you basically understand the paper already. But there's a bit of tricky steps in there. And it's pretty cool that at the end it works out like you just saw. So before we dive in, as always, if you're here and not subscribed, then please do. And if you like the video, share it out. And leave a comment if you feel like commenting. Cool. So as we already stated the problem, they ask, is it possible to automatically classify images without the use of ground truth annotations? Or even when the classes themselves are not known a priori? Now, you might think that this is outrageous. How can you classify when you don't even know what the classes are and so on? So the way you have to imagine it going forward, and they don't explicitly explain it, but it's assumed that if you have a dataset, and you learn to classify it, what basically that means is you cluster it, right? You put some of the data points in the same clusters. And then, of course, the dataset, I'm going to draw the same dataset right here, the same dataset would have an actual classification thing. So this would be class 0, this here may be class 1, and this here might be class 2. Now, you can't possibly know how the classes are called or something, which one is the first, which one is the second. So at test time, basically, if you have a method like this that doesn't use labels, what you're going to do is you're basically going to find, you're going to be as generous as possible in the assignment of these and say, oh, look, if I assign this here to cluster 0 and this here to cluster 2 and this here to cluster 1, 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 where 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? And 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 use a deep neural network and then basically send the image, that's the image right here, send the image through the deep neural network and then either take this last state right here. So it goes through and through and through. And we could get take either of the hidden states or we could just take, you know, the last state, that is the sort of hidden representation right here and 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, right? You send a bunch of images through to get you in embedding space, to get you points. And then in embedding space, you think, well, the features that are in the embedding space, they are somehow latent and they... If basically the entire thing is, if this neural network was used to classify images, you would have a classification head on top. And a classification head, this is like a five class classification 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, 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 of it and works very good for very well for natural images. So 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 the algorithm tends to focus a lot on very low level features. So if the pixel on the bottom right here is blue, right, then you can. 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, will cluster them together. And then it will basically feed back the new representation 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 with the high level task you're ultimately trying to solve, which is to classify these images later. So what this paper does is it says we can eliminate this. We can eliminate this the fact that these methods will produce will produce neural networks that focus on low level features. And how do we do that? We do that by representation learning. So representation learning, you might know this as self supervised learning. And this is the task they solve in the first step of their objective. So let's go through this. This right here is an image. Now, the T is a transformation of that image. And in self supervised learning, there are several methods that you can transform an image. So, for example, you can random crop an image. You can just cut out like a piece right here and scale that up to be as large as the original image. Or you can use, for example, data augmentation, which means you take the image and you basically so if there is, I don't know, the cat right here, you kind of convolve it with something. So there's like a very squiggly cat. OK, I'm terrible. You can you can rotate it, for example. So it's like this. OK, so these are all these are all sets, including the crop sets of this transformation T. So you transform it in some way and you want after you've transformed it, you send your original image. That should be read. 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 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 its augmented version and you minimize the inner product or the Euclidean distance between the two versions in the hidden space. And the rationale is exactly the same. The rationale is that this hidden space, of course, should be linearly classifiable. And so the distance between those should be close. And the rationale between having these tasks is that, well, if I flip the image, right, if I flip the image to the right, it cannot focus on the pixel on the bottom right anymore, because that's not going to be the pixel on the bottom right here. And I'm not always going to flip it into the same direction. And sometimes I'm going to crop it so it also can't focus on the pixel on the bottom right, because in the crop, that pixel is like out here. It's not even in the crop. But basically what you're looking to do with the self supervised methods is you are looking to destroy this low level information. That's that's all you're looking to build a pipeline of a neural network here that destroys deliberately low level information. And you do that by coming up with tasks like this self supervision tasks that just 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. You send both images, the original and the augmented version, through the same neural network, and then you minimize some distance, which is usually like the inner product or the Euclidean distance in this embedding space. 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 your embeddings minimize this task. Now, this is nothing new. This has been this has been used for a couple of years now to get better representation. Self supervised learning is a thing. But they basically say we can use this as an initialization step for this clustering procedure, because if we don't do that, we we focus on these low level features. OK, and notice you don't need any labels for this procedure. That's why it's called self supervised. OK, so the second second part is the clustering. Now they cluster, but they don't just cluster these representations. That would be that doesn't perform very well in their in their experiments. What they instead do is they minimize this entire objective right here and we'll go through it step by step. So they train a new neural network. OK, this thing right here, this is a new neural network. So first you have you already have the neural network, which was called. What was it even called? The one that gives you the embedding with the theta. OK, it's called five theta. It's the same architecture. I think they initialize one with the other. So in step one, you get five theta five theta goes give from from X gives you a representation of X. OK, 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 five data here, and you initialize it with this one. But now you train it to do the following again. You want to minimize. Sorry, you want to maximize the inner product right here. See, that's the inner product. You want to maximize the inner product between two things. Now, that's the same thing as before. We want to minimize the distance between two things and the dot product distance. In that case, you maximize the dot product between two things. And the two things are two images that go through the same neural network as before. Right. This and this. Now, what's different here is that here we input an one image of the data set. That's the same as before. OK, 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. OK, 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 five as a benchmark. So you're going to find its nearest neighbors. It's five nearest neighbors. And you do this for each image. So this image has these five nearest neighbors. So in step two, what you're trying to do is you're going to try to pull together each image and its nearest neighbors in that in this this not in this space directly, but you determine which ones are the nearest neighbor from this neural network and you keep it constant. That's how you determine what the nearest neighbors are in the first task. And that is your 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 with this thing right here, you maximize the inner product between X in after this neural network and a nearest neighbor of X that was was a nearest neighbor after the first task. Now, the way they cluster here is not just again by putting it into an embedding space like we saw before. But this thing right here, this neural network, as you can see here, is is a C dimensional vector in zero one. Now, C is the number of classes that you can either know that. So you don't know which 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 as you overguess, you can still like build super clusters later. So this they simply say it's in zero one, but they also say it performs a soft assignment. So we're also going to assume that this is normalized. So for each for each data point X here, you're going to you're going to have an image. You're going to put it through this new neural network. Okay, this new neural network new, and it's going to tell you it's going to give you basically a histogram. Let's say class one, two or three, we guess there are three class and it's going to give you an assignment of the three. And you also take a nearest neighbor. Here is your data set. You also take a nearest neighbor of that. So you look for this set N of X and you take a nearest neighbor. Maybe that's that's a maybe that's a dog. I can't I really can't draw dog. Yeah, that's the best I can do. I'm sorry. And you also put that through the same network. And you're saying since they were nearest neighbor in task one, they must share some sort of interesting high level features because that's what the first task was for. Therefore, I want to make them closer together in in the in the light of these of this neural network right here. So this is also going to give you an assignment like maybe like this. Okay. And now you object you you train this network right here to basically match these two distributions. Okay. So this is this is now a classifier into C classes, but we guess C and we don't have labels. We simply our label is going to be my neighbors from the first task must have the same labels. That's our label. Now they say they also have this term right here, which is the entropy over assignments. Okay. As you can see, so they minimize the following. They minimize this quantity, which has a negative in front of it. So that means they maximize this log inner product. And they also maximize the entropy because sorry. So they minimize this thing. But the entropy is a negative quantity. Right. So they maximize the entropy because here's a plus. And now they minimize the entropy. Let's see what they say by minimizing the following objective. Now entropy is the sum of the negative sum of P log P. And this if this is P. Yes, this is the probability that an image is going to be assigned to cluster C over the entire data set. So they're going to. Yes, so it's negative. This quantity negative. Minus P log P. And this is the entropy. So they're going to minimize the entropy. Let's see what they say. We include an entropy term. The second term in equation two. Which spreads the predictions uniformly across clusters C. 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. Right. So they want basically what they want over the whole data set that not all of the images are going to be in the same cluster. This is cluster one. And then this is cluster two. And then this is cluster three. So that term counteracts that basically the more evenly spread the entire data set distribution is the the higher the entropy, the lower the negative entropy. And that's the goal right here. I'm sorry. This this was I was confused by the too many negative signs. And then you minimize the entire thing. All right. Now, they say they say a different thing right here. They say here this bracket denotes the dot product operator. As we saw, it's the dot product between these two distributions right here. The first term in equation two imposes this neural network to make consistent predictions for a sample 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. That means confident and assigned to the same cluster consistent. So they basically say the objective encourages confidence because it encourages predictions to be one hot and it encourages consistency because it you know the because the distributions need to be the same. They should be in the same cluster. Right now, I agree with the consistency. Like if you make the inner product high, then of the of two of these histograms, of course, they look the same. Right. Because these are ultimately vectors. These are three dimensional vectors. Let's call them two dimensional vectors. Right. So here is class one. Here's class two. If you make the inner product small or high, they will agree on their predictions. But I disagree that this encourages anything to be one hot. Like in my mind, if you have two vectors, they're both zero one times zero one. The inner product is going to be one. And if you have two assignments that are point five and point five, then it is also going to result in an in an inner product of it. Zero point five. Right. It's also going to to be no. So what's the inner product here? The inner product is point five times point five plus point five times point five, which is point five. Am I dumb? An embarrassingly long time later. Oh, it's because the L1 norm. OK, OK, we got it. We got it. I am 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 one. But of course, if you have assignments between classes and it's a probability distribution, a histogram, then all of the prob possible assignments lie on this on this thing right here. Now, the inner product with yourself, of course, is the length of the vector and the length of a vector that points to one class or the other class is longer than a vector that points in between. So, 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 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. 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 aren't all exactly the same. The birds. So you can see it really focuses on sort of higher level features, but I guess it's really dependent on this higher level task. And they were they also investigate this quantitatively, but I just want to focus on how good is this after only the self supervised thing. And now they do this clustering and they can already sort of could already 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 now assigning classes. So they could already evaluate this and they are going to do that. But that's not good enough yet. Then they do a third step, which is fine tuning through self labeling. Now self labeling is pretty much exactly what it's what it says. It's you label your own data with your own classifier. Now that might be a bit outrageous. But it's basically saying, wait a minute, if I label my own data and learn a classifier on these labels, isn't isn't it just going to come out the same? And the answer is no. Right. If you have a data set because your classifier doesn't give you just first of all, if your classifier is something like this. Right. Just happens to be and you label and you learn a new classifier. It is going to be more like this. Right. Because it sort of maximizes a lot of classifiers maximize these distances between the classes. So even if it's like that and then the second step they do is they say, 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 neither this one, but we're very confident about these two. So we're only going to use the ones where we are in fact confident about to learn to learn the new classifier. Or basically we you can also weigh them and so on. But they go by confidence right here, as you can see in this final algorithm. So this is the entire algorithm. And I got kicked away. Our algorithm. There we go. All right. So semantic clustering by adopting nearest neighbors, their scan algorithm. So in the first step, you do this pretext task. This is the self supervision, the representation learning. For your entire data set. No, sorry. This is this year. Optimize, 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 this in the third step in the self labeling, they do data augmentation. There's a lot of tricks in here, but ultimately the base algorithm goes like this. So you find your neighboring sets for each X. And then what you do while your clustering loss decreases, you update this clustering neural network by with this loss that we saw. So this is the loss where you make the nearest neighbors closer to each other while still keeping the entropy high. OK, and then in the last after you've done this. You go through and you say, while the length of Y increases, what's why? Why 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. OK, so it's not it's not labels. You have the cross entropy loss between the assignments of this and the assignments of your data set. OK, so you basically do the same task, but you filter by confidence. And they use a threshold, I think, of point seven or something like this. Now let's go into the experiments, the experiments or look as follows. So they do some ablations to find out where in their methods kind of the the gains come from and will 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 C for 10 a thirty five point nine percent accuracy. So not very good. So the clustering, you can't just cluster on top of these representations and then be done. If they do what they say, so this is sample and batch entropy loss. This basically means you do not care about the nearest neighbors. You do this entire thing, but you only make an image close to the prediction, close to itself and its augmentations. So you don't use any nearest neighbor information also doesn't work. I wouldn't pay too much attention that the numbers are 10, 20 or 30. It just 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 this is now significantly above the this is significantly above random guessing. And if you use strong data augmentation, as I said, is a lot of this is 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 percent more. And then if you do this self labeling step, you get another 10 percent more. And this is fairly respectable, like eighty three point five without ever seeing labels. It's fairly good. But of course, there are only 10 classes right here. So keep that in mind. But they will do it on ImageNet later. And they investigate what kind of self supervision tasks at the beginning are important. And they investigate things like ROTNET feature decoupling and noise contrastive estimation, which noise contrastive estimation is the best. And noise contrastive estimation, I think, is just where you as we said, you input an image and then it's kind of noisy versions with augmented in various ways. And then you classify them together. This has been like this. These methods have been very successful in the last few years. Yeah, so this they have various investigations into their algorithm. I want to point out this here. This is the accuracy versus confidence after the complete clustering step. So this is now the third step, the self labeling. And you can see right here as this confidence of the network goes up, the actual accuracy goes up as well. So that means the network after the clustering is really more confident about the points that it can classify more accurately. There's like a correlation between where the network is confident and the actual label of the point, which is remarkable because it has never seen the label. But also see how sort of the range here is quite small. So with the standard augmentation, it goes like from here to here. So where you set that threshold is fairly important and might be quite brittle here because you need to set the threshold right such that some points are below it and some are above it. And you don't want to pull in points where you're not because if you pull in points from here, you're only you only have the correct label for 75 percent 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 this step seems fairly brittle, honestly, but I don't know, of course. They go on and investigate various things such as how many clusters do you need or how many nearest neighbors? Sorry. Do you need this number K here? And you can see that if you have zero neighbors, then you're doing a lot worse than if you have, let's say, five nearest neighbors. So the jump here, as you can see, is fairly high in all the data sets. But after that, it sort of doesn't really matter much. So it seems like five nearest neighbors should be enough for most things. And here they just show that when they remove the false positives, that their algorithm actually converges to the correct clustering, the correct accuracy, which is not surprising. Like if you remove the wrong samples that are wrong, then the rest of the samples are going to be right. I think that's just showing that it doesn't go into some kind of crazy downward spiral loop or something like this. But still, it's just kind of funny. OK, so they do investigate how much they improve. And they improve by quite a lot above the kind of previous methods. So they have a lot of previous methods. But even 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. Now they do sub sample this to 5100 and 200 classes. And they get OK accuracy. As you can see, they get 81% for 50 classes where a supervised baseline would get 86%. Into 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. You can see all of these images. If you know ImageNet, some of the images really only have a part of the object and so on. So here with the prototypical things, you really get center clear shot of the object with clearly visible features and so on. So this sort of repeats the fact that this clustering really does go on that sort of semantic information. Of course, the labels here are from the test label set. The network can't figure that out. And then they go for 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 block diagonal along these super clusters 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, that's you get the same thing for a lot of these methods. So I don't I don't know how much different this would be in other methods. But certainly it's interesting to look at. Now, they go into one last thing, and that is what if we don't know how many clusters there are, right? If we don't know anything. So say so far, we have assumed to to have knowledge about the number of ground truth classes. The model predictions were valid losing the Hungarian matching algorithm. We already saw this in the DETR by Facebook, if you remember. However, what happens if the number of clusters does not match the number of ground truth classes anymore? So they now say table three reports the results when we overestimate the number of ground truth classes by a factor of two. OK, so now they build just 20 classes for C for 10 instead of 10 classes. And we'll look at table three real quick. Where's table three? This is table three. OK, so when they over cluster, you get the thing here on the bottom. And you can see there is a drop in accuracy right here. Now, what I don't actually they don't actually say how they do the over cluster matching. So if you imagine if I now have, I don't know, six clusters, but I need to assign them to three clusters, you know, here. Do I still use this most optimistic thing? So do I still use I think they still use this most optimistic matching right where you assign everything to its best fitted cluster. 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 percent accuracy. OK, so like in one of in these over cluster approach, I would sort of expect that you actually get a better score because you can like there is more generosity of the matching algorithm involved. Now, that's counteracted by the fact that you can't group together things that obviously have similar features because they are in the same class. So there's kind of two forces pulling here. But I was kind of astounded that it's going down and the evaluation method of this matching algorithm, it sort of breaks down when you have more classes, at least in my opinion. Yeah, but but it's interesting to see that you can just overshoot and but then you need some sort of heuristic to reconcile that. In any case, I think this paper is pretty cool. It brings together a lot of things that were already present and introduces this kind of this step approach. But what you have to keep in mind and by the way, there's lots of samples down here. What you have to keep in mind is there are a lot of hyperparameters in here. There are like this threshold and you know, the first of all, yeah, the number of classes, the thresholds, the architectures and so on. And all of this has been tuned to get these numbers really high. Right. All of these steps, all of the augmentations and so on, the chosen data augmentations. It has been chosen to get this number as high as possible. So, you know, to interpret this as, oh, look, we can classify without knowing the labels is, you know, yes, in this case, but the hyperparameter choices of the algorithm are all informed by the labels. So it is still very, very unclear of how this method will actually work when you really don't have the labels, when you actually have to choose the hyperparameters in absence of anything. And yeah, I think the future might tell if they continue to work on this. All right. Thanks for listening, looking, watching and bearing with me through my wrestling with various math, basic math in this video. I wish you a good day and bye bye.
[ { "start": 0, "end": 10, "text": " Hi there! Check out these clusters of images right here. And just have a look at how all of them are pretty much showing the same object." }, { "start": 10, "end": 19, "text": " So here's balloons, here's birds, here's sharks or other fish. These are images from the ImageNet dataset." }, { "start": 19, "end": 26, "text": " And you can see that these clusters are pretty much the object classes themselves." }, { "start": 26, "end": 33, "text": " There's all the frogs right here, all the people that have caught fish." }, { "start": 33, "end": 41, "text": " So the astonishing thing about this is that these clusters have been obtained without any labels of the ImageNet dataset." }, { "start": 41, "end": 50, "text": " Of course, the dataset has labels, but this method doesn't use the labels. It learns to classify images without labels." }, { "start": 50, "end": 69, "text": " So today we're looking at this paper, Learning to Classify Images Without Labels, by Wouter von Ganzbecke, Simon Vandenhende, Stamatios Georgoulis, Mark Prozémans and Luke van Gaal." }, { "start": 69, "end": 83, "text": " 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." }, { "start": 83, "end": 95, "text": " Second, they do a clustering. So they do a sort of k-nearest neighbor clustering, but they do clustering on top of those things." }, { "start": 95, "end": 104, "text": " But they do it in a kind of special way. And then third, they do a refinement through self-labeling." }, { "start": 104, "end": 110, "text": " So if you know what all of these are, you basically understand the paper already." }, { "start": 110, "end": 118, "text": " 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." }, { "start": 118, "end": 128, "text": " 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." }, { "start": 128, "end": 133, "text": " And leave a comment if you feel like commenting. Cool." }, { "start": 133, "end": 144, "text": " So as we already stated the problem, they ask, is it possible to automatically classify images without the use of ground truth annotations?" }, { "start": 144, "end": 149, "text": " Or even when the classes themselves are not known a priori?" }, { "start": 149, "end": 157, "text": " Now, you might think that this is outrageous. How can you classify when you don't even know what the classes are and so on?" }, { "start": 157, "end": 168, "text": " So the way you have to imagine it going forward, and they don't explicitly explain it, but it's assumed that if you have a dataset," }, { "start": 168, "end": 176, "text": " and you learn to classify it, what basically that means is you cluster it, right?" }, { "start": 176, "end": 181, "text": " You put some of the data points in the same clusters." }, { "start": 181, "end": 193, "text": " And then, of course, the dataset, I'm going to draw the same dataset right here, the same dataset would have an actual classification thing." }, { "start": 193, "end": 198, "text": " So this would be class 0, this here may be class 1, and this here might be class 2." }, { "start": 198, "end": 205, "text": " Now, you can't possibly know how the classes are called or something, which one is the first, which one is the second." }, { "start": 205, "end": 213, "text": " So at test time, basically, if you have a method like this that doesn't use labels, what you're going to do is you're basically going to find," }, { "start": 213, "end": 218, "text": " you're going to be as generous as possible in the assignment of these and say," }, { "start": 218, "end": 225, "text": " oh, look, if I assign this here to cluster 0 and this here to cluster 2 and this here to cluster 1," }, { "start": 225, "end": 232, "text": " and I just carry over the labels, what would my accuracy be under that labeling?" }, { "start": 232, "end": 238, "text": " So you're as generous as possible with the assignments of the labels." }, { "start": 238, "end": 242, "text": " So that's how it's going to work, right? That's what you have to keep in mind." }, { "start": 242, "end": 247, "text": " We're basically developing an algorithm that gives us this kind of clustering of the data." }, { "start": 247, "end": 254, "text": " And then if that clustering partitions the data in the same way as the actual labeling would," }, { "start": 254, "end": 262, "text": " the actual labeling with the test labels, then we think it's a good algorithm." }, { "start": 262, "end": 267, "text": " OK, so they claim they have a..." }, { "start": 267, "end": 272, "text": " OK, in this paper, we deviate from recent works and advocate a two-step approach." }, { "start": 272, "end": 279, "text": " And it's actually a three-step approach, but where feature learning and clustering are decoupled." }, { "start": 279, "end": 286, "text": " OK, why is that? So they argue what you could do, what people have done is..." }, { "start": 286, "end": 289, "text": " And I'm going to..." }, { "start": 289, "end": 295, "text": " Well, this is just a wall of text. So what you could do is you could just basically cluster the data." }, { "start": 295, "end": 298, "text": " Like who says you can't use clustering algorithms?" }, { "start": 298, "end": 303, "text": " And then the question is, what do you cluster them by? Like you need a distance." }, { "start": 303, "end": 309, "text": " So if I have points in 2D, it sort of makes sense to use the Euclidean distance here." }, { "start": 309, "end": 317, "text": " But if I have images of cats and dogs and whatnot, then the Euclidean distance between the pixels is really not a good thing." }, { "start": 317, "end": 322, "text": " But also, so you might think we could actually..." }, { "start": 322, "end": 328, "text": " We could use a deep neural network and then basically send the image, that's the image right here," }, { "start": 328, "end": 334, "text": " send the image through the deep neural network and then either take this last state right here." }, { "start": 334, "end": 337, "text": " So it goes through and through and through." }, { "start": 337, "end": 342, "text": " And we could get take either of the hidden states or we could just take, you know, the last state," }, { "start": 342, "end": 347, "text": " that is the sort of hidden representation right here and do the clustering with that." }, { "start": 347, "end": 352, "text": " But then of course, the question is, what do you, which neural network do you take?" }, { "start": 352, "end": 355, "text": " How do you train that neural network?" }, { "start": 355, "end": 359, "text": " And there have been a few approaches such as a deep cluster," }, { "start": 359, "end": 366, "text": " which try to formulate basically an objective for that neural network where you first, you send all the images through, right?" }, { "start": 366, "end": 371, "text": " You send a bunch of images through to get you in embedding space, to get you points." }, { "start": 371, "end": 376, "text": " And then in embedding space, you think, well, the features that are in the embedding space," }, { "start": 376, "end": 379, "text": " they are somehow latent and they..." }, { "start": 379, "end": 385, "text": " If basically the entire thing is, if this neural network was used to classify images," }, { "start": 385, "end": 388, "text": " you would have a classification head on top." }, { "start": 388, "end": 392, "text": " And a classification head, this is like a five class classification head," }, { "start": 392, "end": 401, "text": " is nothing else than a linear classifier boundary that you put on top of this hidden representation." }, { "start": 401, "end": 409, "text": " So if you were to use this neural network for classification, it must be possible to draw a linear boundary between the classes." }, { "start": 409, "end": 418, "text": " And therefore, the either things like the inner product distance or the Euclidean distance must make sense in that space." }, { "start": 418, "end": 424, "text": " They don't make sense in the picture space, but they must make sense in the hidden representation space," }, { "start": 424, "end": 428, "text": " because what you're going to do with them is exactly linear classification." }, { "start": 428, "end": 434, "text": " The last classification head of a neural network is just a linear classifier." }, { "start": 434, "end": 444, "text": " So the assumption is that, and the conclusion is, well, in this space, you should be able to cluster by Euclidean distance." }, { "start": 444, "end": 449, "text": " So what deep cluster does, like is first get the representations." }, { "start": 449, "end": 453, "text": " You start off with a random neural network, then cluster these representations," }, { "start": 453, "end": 459, "text": " then basically label, self label the images in a way." }, { "start": 459, "end": 462, "text": " Now, way over simplifying that technique right here." }, { "start": 462, "end": 469, "text": " But you have these alternative steps of clustering and then kind of finding better representation and then clustering these representations." }, { "start": 469, "end": 475, "text": " And what it basically says is that the CNN itself is such a is like a prior," }, { "start": 475, "end": 481, "text": " because it's the translation of it and works very good for very well for natural images." }, { "start": 481, "end": 486, "text": " So the CNN itself will lead to good representations if we do it in this way." }, { "start": 486, "end": 488, "text": " And they have some good results there." }, { "start": 488, "end": 499, "text": " But this paper argues that if you do that, then the the algorithm tends to focus a lot on very low level features." }, { "start": 499, "end": 504, "text": " So if the pixel on the bottom right here is blue, right, then you can." }, { "start": 504, "end": 513, "text": " And the neural network, by chance, puts two of those images where the blue pixel on the bottom right, it puts them close together." }, { "start": 513, "end": 517, "text": " Then in the next step, it will, because they're close together, will cluster them together." }, { "start": 517, "end": 523, "text": " And then it will basically feed back the new representation should put the two in the same class, right?" }, { "start": 523, "end": 529, "text": " It will feed back that it should focus even more on that blue pixel." }, { "start": 529, "end": 546, "text": " 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 with the high level task you're ultimately trying to solve, which is to classify these images later." }, { "start": 546, "end": 552, "text": " So what this paper does is it says we can eliminate this." }, { "start": 552, "end": 564, "text": " We can eliminate this the fact that these methods will produce will produce neural networks that focus on low level features." }, { "start": 564, "end": 568, "text": " And how do we do that? We do that by representation learning." }, { "start": 568, "end": 573, "text": " So representation learning, you might know this as self supervised learning." }, { "start": 573, "end": 580, "text": " And this is the task they solve in the first step of their objective." }, { "start": 580, "end": 586, "text": " So let's go through this. This right here is an image." }, { "start": 586, "end": 590, "text": " Now, the T is a transformation of that image." }, { "start": 590, "end": 597, "text": " And in self supervised learning, there are several methods that you can transform an image." }, { "start": 597, "end": 601, "text": " So, for example, you can random crop an image." }, { "start": 601, "end": 608, "text": " You can just cut out like a piece right here and scale that up to be as large as the original image." }, { "start": 608, "end": 620, "text": " 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 something." }, { "start": 620, "end": 625, "text": " So there's like a very squiggly cat. OK, I'm terrible." }, { "start": 625, "end": 629, "text": " You can you can rotate it, for example." }, { "start": 629, "end": 636, "text": " So it's like this. OK, so these are all these are all sets, including the crop sets of this transformation T." }, { "start": 636, "end": 648, "text": " So you transform it in some way and you want after you've transformed it, you send your original image." }, { "start": 648, "end": 658, "text": " That should be read. You send your original image and the transformed image through a neural network, each one by themselves." }, { "start": 658, "end": 666, "text": " OK, and then after this, you say the hidden representation here should be close to each other." }, { "start": 666, "end": 670, "text": " OK, this is this is basically the self supervised training task." }, { "start": 670, "end": 678, "text": " It's been shown to work very, very well as a pre training method for classification neural networks." }, { "start": 678, "end": 687, "text": " You have an image and its augmented version and you minimize the inner product or the Euclidean distance between the two versions in the hidden space." }, { "start": 687, "end": 689, "text": " And the rationale is exactly the same." }, { "start": 689, "end": 695, "text": " The rationale is that this hidden space, of course, should be linearly classifiable." }, { "start": 695, "end": 698, "text": " And so the distance between those should be close." }, { "start": 698, "end": 708, "text": " And the rationale between having these tasks is that, well, if I flip the image, right, if I flip the image to the right," }, { "start": 708, "end": 714, "text": " 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." }, { "start": 714, "end": 717, "text": " And I'm not always going to flip it into the same direction." }, { "start": 717, "end": 724, "text": " 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." }, { "start": 724, "end": 726, "text": " It's not even in the crop." }, { "start": 726, "end": 734, "text": " But basically what you're looking to do with the self supervised methods is you are looking to destroy this low level information." }, { "start": 734, "end": 741, "text": " That's that's all you're looking to build a pipeline of a neural network here that destroys deliberately low level information." }, { "start": 741, "end": 754, "text": " And you do that by coming up with tasks like this self supervision tasks that just that deliberately exclude this information from being used." }, { "start": 754, "end": 758, "text": " I think that's what's going on generally in the self supervised learning thing." }, { "start": 758, "end": 764, "text": " OK, so this here, as you can see, is the neural network that you train." }, { "start": 764, "end": 773, "text": " You send both images, the original and the augmented version, through the same neural network, and then you minimize some distance," }, { "start": 773, "end": 778, "text": " which is usually like the inner product or the Euclidean distance in this embedding space." }, { "start": 778, "end": 783, "text": " OK, and what you train, you can see right here, you train the parameters of this neural network." }, { "start": 783, "end": 787, "text": " So the transformations are fixed or sampled and the distance is fixed." }, { "start": 787, "end": 793, "text": " You train the neural networks such that your embeddings minimize this task." }, { "start": 793, "end": 799, "text": " Now, this is nothing new. This has been this has been used for a couple of years now to get better representation." }, { "start": 799, "end": 801, "text": " Self supervised learning is a thing." }, { "start": 801, "end": 808, "text": " But they basically say we can use this as an initialization step for this clustering procedure," }, { "start": 808, "end": 814, "text": " because if we don't do that, we we focus on these low level features." }, { "start": 814, "end": 817, "text": " OK, and notice you don't need any labels for this procedure." }, { "start": 817, "end": 820, "text": " That's why it's called self supervised." }, { "start": 820, "end": 826, "text": " OK, so the second second part is the clustering." }, { "start": 826, "end": 830, "text": " Now they cluster, but they don't just cluster these representations." }, { "start": 830, "end": 835, "text": " That would be that doesn't perform very well in their in their experiments." }, { "start": 835, "end": 845, "text": " What they instead do is they minimize this entire objective right here and we'll go through it step by step." }, { "start": 845, "end": 853, "text": " So they train a new neural network. OK, this thing right here, this is a new neural network." }, { "start": 853, "end": 860, "text": " So first you have you already have the neural network, which was called." }, { "start": 860, "end": 865, "text": " What was it even called? The one that gives you the embedding with the theta." }, { "start": 865, "end": 869, "text": " OK, it's called five theta. It's the same architecture." }, { "start": 869, "end": 871, "text": " I think they initialize one with the other." }, { "start": 871, "end": 881, "text": " So in step one, you get five theta five theta goes give from from X gives you a representation of X." }, { "start": 881, "end": 888, "text": " OK, let's call it hidden X. So that's the self supervised learning." }, { "start": 888, "end": 896, "text": " But in step two, you train an entirely new neural network, this five data here," }, { "start": 896, "end": 903, "text": " and you initialize it with this one. But now you train it to do the following again." }, { "start": 903, "end": 910, "text": " You want to minimize. Sorry, you want to maximize the inner product right here." }, { "start": 910, "end": 915, "text": " See, that's the inner product. You want to maximize the inner product between two things." }, { "start": 915, "end": 921, "text": " Now, that's the same thing as before. We want to minimize the distance between two things and the dot product distance." }, { "start": 921, "end": 927, "text": " In that case, you maximize the dot product between two things. And the two things are two images" }, { "start": 927, "end": 932, "text": " that go through the same neural network as before. Right. This and this." }, { "start": 932, "end": 937, "text": " Now, what's different here is that here we input an one image of the data set." }, { "start": 937, "end": 941, "text": " That's the same as before. OK, so we input one image." }, { "start": 941, "end": 947, "text": " But here before in the self supervised learning, we input an augmented version of that." }, { "start": 947, "end": 952, "text": " And now we input something else. We input this K right here. Now, what's K?" }, { "start": 952, "end": 959, "text": " What K comes from this neighbor set of X. OK, this is the set of neighbors of X." }, { "start": 959, "end": 966, "text": " And these neighbors are determined with respect to this neural network right here." }, { "start": 966, "end": 974, "text": " So what you do after step one is you take your neural network with the good embeddings." }, { "start": 974, "end": 979, "text": " And here is your data set X. Your data set X. This should be another." }, { "start": 979, "end": 985, "text": " Your data set X is this list basically of all the images in your data set." }, { "start": 985, "end": 990, "text": " And what you're going to do is you're going to take all of them using that neural network that you just trained" }, { "start": 990, "end": 997, "text": " and embed them into a latent space right here. OK." }, { "start": 997, "end": 1001, "text": " This is the latent space where you have done the self supervised training." }, { "start": 1001, "end": 1010, "text": " And now for each image right here. So if this is X, I, you're going to find its K nearest neighbors." }, { "start": 1010, "end": 1016, "text": " And they use I think they use five as a benchmark. So you're going to find its nearest neighbors." }, { "start": 1016, "end": 1021, "text": " It's five nearest neighbors. And you do this for each image." }, { "start": 1021, "end": 1030, "text": " So this image has these five nearest neighbors. So in step two, what you're trying to do is you're going to try to pull together" }, { "start": 1030, "end": 1038, "text": " each image and its nearest neighbors in that in this this not in this space directly," }, { "start": 1038, "end": 1044, "text": " but you determine which ones are the nearest neighbor from this neural network and you keep it constant." }, { "start": 1044, "end": 1047, "text": " That's how you determine what the nearest neighbors are in the first task." }, { "start": 1047, "end": 1057, "text": " And that is your NX set for X, I. And in the second step, you're trying to make the representations" }, { "start": 1057, "end": 1063, "text": " of any image and its nearest neighbors closer to each other." }, { "start": 1063, "end": 1074, "text": " OK, so with with this thing right here, you maximize the inner product between X in after this neural network" }, { "start": 1074, "end": 1082, "text": " and a nearest neighbor of X that was was a nearest neighbor after the first task." }, { "start": 1082, "end": 1089, "text": " Now, the way they cluster here is not just again by putting it into an embedding space like we saw before." }, { "start": 1089, "end": 1100, "text": " But this thing right here, this neural network, as you can see here, is is a C dimensional vector in zero one." }, { "start": 1100, "end": 1104, "text": " Now, C is the number of classes that you can either know that." }, { "start": 1104, "end": 1109, "text": " So you don't know which classes which you don't have labels, but you could know how many classes there are." }, { "start": 1109, "end": 1113, "text": " Or you could just guess how many classes there are." }, { "start": 1113, "end": 1119, "text": " And as long as you as you overguess, you can still like build super clusters later." }, { "start": 1119, "end": 1125, "text": " So this they simply say it's in zero one, but they also say it performs a soft assignment." }, { "start": 1125, "end": 1129, "text": " So we're also going to assume that this is normalized." }, { "start": 1129, "end": 1136, "text": " So for each for each data point X here, you're going to you're going to have an image." }, { "start": 1136, "end": 1139, "text": " You're going to put it through this new neural network." }, { "start": 1139, "end": 1146, "text": " Okay, this new neural network new, and it's going to tell you it's going to give you basically a histogram." }, { "start": 1146, "end": 1153, "text": " Let's say class one, two or three, we guess there are three class and it's going to give you an assignment of the three." }, { "start": 1153, "end": 1156, "text": " And you also take a nearest neighbor." }, { "start": 1156, "end": 1158, "text": " Here is your data set." }, { "start": 1158, "end": 1161, "text": " You also take a nearest neighbor of that." }, { "start": 1161, "end": 1166, "text": " So you look for this set N of X and you take a nearest neighbor." }, { "start": 1166, "end": 1171, "text": " Maybe that's that's a maybe that's a dog." }, { "start": 1171, "end": 1174, "text": " I can't I really can't draw dog." }, { "start": 1174, "end": 1176, "text": " Yeah, that's the best I can do." }, { "start": 1176, "end": 1177, "text": " I'm sorry." }, { "start": 1177, "end": 1180, "text": " And you also put that through the same network." }, { "start": 1180, "end": 1188, "text": " And you're saying since they were nearest neighbor in task one, they must share some sort of interesting high level features" }, { "start": 1188, "end": 1191, "text": " because that's what the first task was for." }, { "start": 1191, "end": 1198, "text": " Therefore, I want to make them closer together in in the in the light of these of this neural network right here." }, { "start": 1198, "end": 1204, "text": " So this is also going to give you an assignment like maybe like this." }, { "start": 1204, "end": 1205, "text": " Okay." }, { "start": 1205, "end": 1214, "text": " And now you object you you train this network right here to basically match these two distributions." }, { "start": 1214, "end": 1222, "text": " Okay. So this is this is now a classifier into C classes, but we guess C and we don't have labels." }, { "start": 1222, "end": 1228, "text": " We simply our label is going to be my neighbors from the first task must have the same labels." }, { "start": 1228, "end": 1230, "text": " That's our label." }, { "start": 1230, "end": 1237, "text": " Now they say they also have this term right here, which is the entropy over assignments." }, { "start": 1237, "end": 1238, "text": " Okay." }, { "start": 1238, "end": 1240, "text": " As you can see, so they minimize the following." }, { "start": 1240, "end": 1244, "text": " They minimize this quantity, which has a negative in front of it." }, { "start": 1244, "end": 1247, "text": " So that means they maximize this log inner product." }, { "start": 1247, "end": 1255, "text": " And they also maximize the entropy because sorry." }, { "start": 1255, "end": 1257, "text": " So they minimize this thing." }, { "start": 1257, "end": 1260, "text": " But the entropy is a negative quantity." }, { "start": 1260, "end": 1261, "text": " Right." }, { "start": 1261, "end": 1266, "text": " So they maximize the entropy because here's a plus." }, { "start": 1266, "end": 1271, "text": " And now they minimize the entropy." }, { "start": 1271, "end": 1276, "text": " Let's see what they say by minimizing the following objective." }, { "start": 1276, "end": 1280, "text": " Now entropy is the sum of the negative sum of P log P." }, { "start": 1280, "end": 1283, "text": " And this if this is P." }, { "start": 1283, "end": 1291, "text": " Yes, this is the probability that an image is going to be assigned to cluster C over the entire data set." }, { "start": 1291, "end": 1295, "text": " So they're going to." }, { "start": 1295, "end": 1297, "text": " Yes, so it's negative." }, { "start": 1297, "end": 1302, "text": " This quantity negative." }, { "start": 1302, "end": 1305, "text": " Minus P log P." }, { "start": 1305, "end": 1308, "text": " And this is the entropy." }, { "start": 1308, "end": 1311, "text": " So they're going to minimize the entropy." }, { "start": 1311, "end": 1315, "text": " Let's see what they say." }, { "start": 1315, "end": 1319, "text": " We include an entropy term." }, { "start": 1319, "end": 1321, "text": " The second term in equation two." }, { "start": 1321, "end": 1328, "text": " Which spreads the predictions uniformly across clusters C." }, { "start": 1328, "end": 1329, "text": " OK." }, { "start": 1329, "end": 1341, "text": " So what we want is a uniform assignment over cluster, which means we should maximize the entropy." }, { "start": 1341, "end": 1342, "text": " Oh, yes." }, { "start": 1342, "end": 1343, "text": " OK." }, { "start": 1343, "end": 1344, "text": " They minimize this thing." }, { "start": 1344, "end": 1347, "text": " And this here is the negative entropy." }, { "start": 1347, "end": 1348, "text": " Right." }, { "start": 1348, "end": 1356, "text": " So they want basically what they want over the whole data set that not all of the images are going to be in the same cluster." }, { "start": 1356, "end": 1358, "text": " This is cluster one." }, { "start": 1358, "end": 1359, "text": " And then this is cluster two." }, { "start": 1359, "end": 1360, "text": " And then this is cluster three." }, { "start": 1360, "end": 1372, "text": " So that term counteracts that basically the more evenly spread the entire data set distribution is the the higher the entropy, the lower the negative entropy." }, { "start": 1372, "end": 1373, "text": " And that's the goal right here." }, { "start": 1373, "end": 1374, "text": " I'm sorry." }, { "start": 1374, "end": 1378, "text": " This this was I was confused by the too many negative signs." }, { "start": 1378, "end": 1380, "text": " And then you minimize the entire thing." }, { "start": 1380, "end": 1381, "text": " All right." }, { "start": 1381, "end": 1384, "text": " Now, they say they say a different thing right here." }, { "start": 1384, "end": 1388, "text": " They say here this bracket denotes the dot product operator." }, { "start": 1388, "end": 1395, "text": " As we saw, it's the dot product between these two distributions right here." }, { "start": 1395, "end": 1407, "text": " The first term in equation two imposes this neural network to make consistent predictions for a sample XI and its neighboring samples, the neighbors of XI." }, { "start": 1407, "end": 1409, "text": " And here is an interesting thing." }, { "start": 1409, "end": 1414, "text": " Note that the dot product will be maximal when the predictions are one hot." }, { "start": 1414, "end": 1418, "text": " That means confident and assigned to the same cluster consistent." }, { "start": 1418, "end": 1432, "text": " So they basically say the objective encourages confidence because it encourages predictions to be one hot and it encourages consistency because it you know the because the distributions need to be the same." }, { "start": 1432, "end": 1434, "text": " They should be in the same cluster." }, { "start": 1434, "end": 1437, "text": " Right now, I agree with the consistency." }, { "start": 1437, "end": 1445, "text": " Like if you make the inner product high, then of the of two of these histograms, of course, they look the same." }, { "start": 1445, "end": 1446, "text": " Right." }, { "start": 1446, "end": 1449, "text": " Because these are ultimately vectors. These are three dimensional vectors." }, { "start": 1449, "end": 1451, "text": " Let's call them two dimensional vectors." }, { "start": 1451, "end": 1453, "text": " Right. So here is class one." }, { "start": 1453, "end": 1454, "text": " Here's class two." }, { "start": 1454, "end": 1462, "text": " If you make the inner product small or high, they will agree on their predictions." }, { "start": 1462, "end": 1467, "text": " But I disagree that this encourages anything to be one hot." }, { "start": 1467, "end": 1472, "text": " Like in my mind, if you have two vectors, they're both zero one times zero one." }, { "start": 1472, "end": 1474, "text": " The inner product is going to be one." }, { "start": 1474, "end": 1485, "text": " And if you have two assignments that are point five and point five, then it is also going to result in an in an inner product of it." }, { "start": 1485, "end": 1487, "text": " Zero point five." }, { "start": 1487, "end": 1492, "text": " Right. It's also going to to be no." }, { "start": 1492, "end": 1494, "text": " So what's the inner product here?" }, { "start": 1494, "end": 1503, "text": " The inner product is point five times point five plus point five times point five, which is point five." }, { "start": 1503, "end": 1505, "text": " Am I dumb?" }, { "start": 1505, "end": 1509, "text": " An embarrassingly long time later." }, { "start": 1509, "end": 1511, "text": " Oh, it's because the L1 norm." }, { "start": 1511, "end": 1513, "text": " OK, OK, we got it." }, { "start": 1513, "end": 1516, "text": " We got it." }, { "start": 1516, "end": 1518, "text": " I am I am OK." }, { "start": 1518, "end": 1519, "text": " I am too dumb." }, { "start": 1519, "end": 1526, "text": " Yes, of course, I was thinking of these vectors being normalized in L2 space where their inner products would always be one." }, { "start": 1526, "end": 1541, "text": " But of course, if you have assignments between classes and it's a probability distribution, a histogram, then all of the prob possible assignments lie on this on this thing right here." }, { "start": 1541, "end": 1554, "text": " 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." }, { "start": 1554, "end": 1556, "text": " So, OK, I see." }, { "start": 1556, "end": 1557, "text": " That's where they get this." }, { "start": 1557, "end": 1560, "text": " That's where they get this must be one hot from." }, { "start": 1560, "end": 1562, "text": " So, OK, I'll give that to them." }, { "start": 1562, "end": 1572, "text": " 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." }, { "start": 1572, "end": 1574, "text": " Right." }, { "start": 1574, "end": 1579, "text": " Yes, that was that was dumbness of me." }, { "start": 1579, "end": 1581, "text": " I was trying to make a counter example." }, { "start": 1581, "end": 1587, "text": " I'm like, wait a minute, this counter example is a counter example to my counter example." }, { "start": 1587, "end": 1591, "text": " OK, so, yeah, that's that." }, { "start": 1591, "end": 1602, "text": " So, as you can see, they are, of course, correct here and they now make the first experiments." }, { "start": 1602, "end": 1613, "text": " 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." }, { "start": 1613, "end": 1620, "text": " The nearest neighbors of these images right here are the ones that you see on the right." }, { "start": 1620, "end": 1629, "text": " And after the self supervised one, these nearest neighbors are already pretty good at sharing the high level features actually crazy, crazy good." }, { "start": 1629, "end": 1632, "text": " Right. This flute here is in different sizes." }, { "start": 1632, "end": 1638, "text": " As you can see, the fishes aren't aren't all exactly the same." }, { "start": 1638, "end": 1640, "text": " The birds." }, { "start": 1640, "end": 1648, "text": " So you can see it really focuses on sort of higher level features, but I guess it's really dependent on this higher level task." }, { "start": 1648, "end": 1660, "text": " And they were they also investigate this quantitatively, but I just want to focus on how good is this after only the self supervised thing." }, { "start": 1660, "end": 1668, "text": " And now they do this clustering and they can already sort of could already evaluate it right here because now they have a clustering." }, { "start": 1668, "end": 1676, "text": " Right. After this step, they've basically pulled together the neighbors and they have this neural network that is now assigning classes." }, { "start": 1676, "end": 1679, "text": " So they could already evaluate this and they are going to do that." }, { "start": 1679, "end": 1682, "text": " But that's not good enough yet." }, { "start": 1682, "end": 1688, "text": " Then they do a third step, which is fine tuning through self labeling." }, { "start": 1688, "end": 1693, "text": " Now self labeling is pretty much exactly what it's what it says." }, { "start": 1693, "end": 1697, "text": " It's you label your own data with your own classifier." }, { "start": 1697, "end": 1700, "text": " Now that might be a bit outrageous." }, { "start": 1700, "end": 1710, "text": " But it's basically saying, wait a minute, if I label my own data and learn a classifier on these labels, isn't isn't it just going to come out the same?" }, { "start": 1710, "end": 1712, "text": " And the answer is no." }, { "start": 1712, "end": 1726, "text": " Right. If you have a data set because your classifier doesn't give you just first of all, if your classifier is something like this." }, { "start": 1726, "end": 1727, "text": " Right." }, { "start": 1727, "end": 1731, "text": " Just happens to be and you label and you learn a new classifier." }, { "start": 1731, "end": 1733, "text": " It is going to be more like this." }, { "start": 1733, "end": 1741, "text": " Right. Because it sort of maximizes a lot of classifiers maximize these distances between the classes." }, { "start": 1741, "end": 1751, "text": " 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." }, { "start": 1751, "end": 1753, "text": " We're more confident about that one." }, { "start": 1753, "end": 1754, "text": " Also this one." }, { "start": 1754, "end": 1757, "text": " And then this one here is pretty close." }, { "start": 1757, "end": 1761, "text": " Like we're not super neither this one, but we're very confident about these two." }, { "start": 1761, "end": 1772, "text": " So we're only going to use the ones where we are in fact confident about to learn to learn the new classifier." }, { "start": 1772, "end": 1776, "text": " Or basically we you can also weigh them and so on." }, { "start": 1776, "end": 1783, "text": " But they go by confidence right here, as you can see in this final algorithm." }, { "start": 1783, "end": 1786, "text": " So this is the entire algorithm." }, { "start": 1786, "end": 1792, "text": " And I got kicked away." }, { "start": 1792, "end": 1793, "text": " Our algorithm." }, { "start": 1793, "end": 1794, "text": " There we go." }, { "start": 1794, "end": 1797, "text": " All right." }, { "start": 1797, "end": 1803, "text": " So semantic clustering by adopting nearest neighbors, their scan algorithm." }, { "start": 1803, "end": 1806, "text": " So in the first step, you do this pretext task." }, { "start": 1806, "end": 1809, "text": " This is the self supervision, the representation learning." }, { "start": 1809, "end": 1813, "text": " For your entire data set." }, { "start": 1813, "end": 1814, "text": " No, sorry." }, { "start": 1814, "end": 1815, "text": " This is this year." }, { "start": 1815, "end": 1819, "text": " Optimize, optimize the neural network with task T." }, { "start": 1819, "end": 1822, "text": " That's just self supervised representation learning." }, { "start": 1822, "end": 1830, "text": " OK, then the second thing we're going to determine the nearest neighbor set for each X." }, { "start": 1830, "end": 1833, "text": " Now they also in that step, they also augment the data." }, { "start": 1833, "end": 1836, "text": " They do heavy data augmentation and so on." }, { "start": 1836, "end": 1840, "text": " Also in this in the third step in the self labeling, they do data augmentation." }, { "start": 1840, "end": 1845, "text": " There's a lot of tricks in here, but ultimately the base algorithm goes like this." }, { "start": 1845, "end": 1849, "text": " So you find your neighboring sets for each X." }, { "start": 1849, "end": 1860, "text": " And then what you do while your clustering loss decreases, you update this clustering neural network by with this loss that we saw." }, { "start": 1860, "end": 1867, "text": " So this is the loss where you make the nearest neighbors closer to each other while still keeping the entropy high." }, { "start": 1867, "end": 1871, "text": " OK, and then in the last after you've done this." }, { "start": 1871, "end": 1877, "text": " You go through and you say, while the length of Y increases, what's why?" }, { "start": 1877, "end": 1883, "text": " Why is all the data points that are above a certain threshold?" }, { "start": 1883, "end": 1888, "text": " Now you're going to filter the data set that is above a certain threshold." }, { "start": 1888, "end": 1890, "text": " And that's your data set Y." }, { "start": 1890, "end": 1893, "text": " And you train this same neural network." }, { "start": 1893, "end": 1898, "text": " You basically fine tune it with the cross entropy loss on your own labels." }, { "start": 1898, "end": 1905, "text": " So now you only have labels Y." }, { "start": 1905, "end": 1910, "text": " OK, so it's not it's not labels." }, { "start": 1910, "end": 1917, "text": " You have the cross entropy loss between the assignments of this and the assignments of your data set." }, { "start": 1917, "end": 1927, "text": " OK, so you basically do the same task, but you filter by confidence." }, { "start": 1927, "end": 1932, "text": " And they use a threshold, I think, of point seven or something like this." }, { "start": 1932, "end": 1940, "text": " Now let's go into the experiments, the experiments or look as follows." }, { "start": 1940, "end": 1949, "text": " So they do some ablations to find out where in their methods kind of the the gains come from and will just quickly go through them." }, { "start": 1949, "end": 1956, "text": " If they just do these self supervision at the beginning and then just do K means clustering on top of that," }, { "start": 1956, "end": 1961, "text": " that will give them on C for 10 a thirty five point nine percent accuracy." }, { "start": 1961, "end": 1963, "text": " So not very good." }, { "start": 1963, "end": 1970, "text": " So the clustering, you can't just cluster on top of these representations and then be done." }, { "start": 1970, "end": 1978, "text": " If they do what they say, so this is sample and batch entropy loss." }, { "start": 1978, "end": 1981, "text": " This basically means you do not care about the nearest neighbors." }, { "start": 1981, "end": 1989, "text": " You do this entire thing, but you only make an image close to the prediction, close to itself and its augmentations." }, { "start": 1989, "end": 1993, "text": " So you don't use any nearest neighbor information also doesn't work." }, { "start": 1993, "end": 1998, "text": " I wouldn't pay too much attention that the numbers are 10, 20 or 30." }, { "start": 1998, "end": 2000, "text": " It just doesn't work." }, { "start": 2000, "end": 2009, "text": " Now, if you use the scan loss, you all of a sudden you get into a regime where there is actual signal." }, { "start": 2009, "end": 2018, "text": " So this is this is now significantly above the this is significantly above random guessing." }, { "start": 2018, "end": 2027, "text": " And if you use strong data augmentation, as I said, is a lot of this is has these tricks in it of what kind of data augmentation you do and so on." }, { "start": 2027, "end": 2035, "text": " So never forget that that these papers, besides their idea, they put in all the tricks they can." }, { "start": 2035, "end": 2037, "text": " So you get 10 percent more." }, { "start": 2037, "end": 2043, "text": " And then if you do this self labeling step, you get another 10 percent more." }, { "start": 2043, "end": 2049, "text": " And this is fairly respectable, like eighty three point five without ever seeing labels." }, { "start": 2049, "end": 2051, "text": " It's fairly good." }, { "start": 2051, "end": 2054, "text": " But of course, there are only 10 classes right here." }, { "start": 2054, "end": 2056, "text": " So keep that in mind." }, { "start": 2056, "end": 2059, "text": " But they will do it on ImageNet later." }, { "start": 2059, "end": 2065, "text": " And they investigate what kind of self supervision tasks at the beginning are important." }, { "start": 2065, "end": 2071, "text": " And they investigate things like ROTNET feature decoupling and noise contrastive estimation," }, { "start": 2071, "end": 2073, "text": " which noise contrastive estimation is the best." }, { "start": 2073, "end": 2083, "text": " And noise contrastive 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." }, { "start": 2083, "end": 2088, "text": " And then you classify them together." }, { "start": 2088, "end": 2090, "text": " This has been like this." }, { "start": 2090, "end": 2096, "text": " These methods have been very successful in the last few years." }, { "start": 2096, "end": 2103, "text": " Yeah, so this they have various investigations into their algorithm." }, { "start": 2103, "end": 2106, "text": " I want to point out this here." }, { "start": 2106, "end": 2113, "text": " This is the accuracy versus confidence after the complete clustering step." }, { "start": 2113, "end": 2116, "text": " So this is now the third step, the self labeling." }, { "start": 2116, "end": 2125, "text": " And you can see right here as this confidence of the network goes up, the actual accuracy goes up as well." }, { "start": 2125, "end": 2132, "text": " So that means the network after the clustering is really more confident about the points that it can classify more accurately." }, { "start": 2132, "end": 2142, "text": " 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." }, { "start": 2142, "end": 2147, "text": " But also see how sort of the range here is quite small." }, { "start": 2147, "end": 2151, "text": " So with the standard augmentation, it goes like from here to here." }, { "start": 2151, "end": 2166, "text": " So where you set that threshold is fairly important and might be quite brittle here because you need to set the threshold right such that some points are below it and some are above it." }, { "start": 2166, "end": 2183, "text": " And you don't want to pull in points where you're not because if you pull in points from here, you're only you only have the correct label for 75 percent or something like them of them." }, { "start": 2183, "end": 2188, "text": " And that means if you now self label and learn on them, you're going to learn the wrong signal." }, { "start": 2188, "end": 2199, "text": " So this this step seems fairly brittle, honestly, but I don't know, of course." }, { "start": 2199, "end": 2207, "text": " They go on and investigate various things such as how many clusters do you need or how many nearest neighbors?" }, { "start": 2207, "end": 2210, "text": " Sorry. Do you need this number K here?" }, { "start": 2210, "end": 2219, "text": " 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." }, { "start": 2219, "end": 2224, "text": " So the jump here, as you can see, is fairly high in all the data sets." }, { "start": 2224, "end": 2228, "text": " But after that, it sort of doesn't really matter much." }, { "start": 2228, "end": 2233, "text": " So it seems like five nearest neighbors should be enough for most things." }, { "start": 2233, "end": 2244, "text": " 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." }, { "start": 2244, "end": 2250, "text": " Like if you remove the wrong samples that are wrong, then the rest of the samples are going to be right." }, { "start": 2250, "end": 2256, "text": " I think that's just showing that it doesn't go into some kind of crazy downward spiral loop or something like this." }, { "start": 2256, "end": 2260, "text": " But still, it's just kind of funny." }, { "start": 2260, "end": 2264, "text": " OK, so they do investigate how much they improve." }, { "start": 2264, "end": 2268, "text": " And they improve by quite a lot above the kind of previous methods." }, { "start": 2268, "end": 2270, "text": " So they have a lot of previous methods." }, { "start": 2270, "end": 2278, "text": " But even this includes things like K means and so on, GANs, deep cluster that we spoke about." }, { "start": 2278, "end": 2284, "text": " And this method, it already gets, as you can see, fairly close to good accuracy." }, { "start": 2284, "end": 2290, "text": " So you have like 88.6% accuracy." }, { "start": 2290, "end": 2299, "text": " And that's fairly remarkable on C410 without seeing the labels." }, { "start": 2299, "end": 2301, "text": " But we'll go on." }, { "start": 2301, "end": 2303, "text": " And now they go into ImageNet." }, { "start": 2303, "end": 2306, "text": " Now ImageNet, of course, has way more classes." }, { "start": 2306, "end": 2310, "text": " It has 1,000 classes compared to C410's 10 classes." }, { "start": 2310, "end": 2315, "text": " So if you think clustering 10 classes might, and they're fairly apart from each other," }, { "start": 2315, "end": 2320, "text": " might work with various techniques, ImageNet, 1,000 classes, that's way more difficult." }, { "start": 2320, "end": 2327, "text": " Now they do sub sample this to 5100 and 200 classes." }, { "start": 2327, "end": 2333, "text": " And they get OK accuracy." }, { "start": 2333, "end": 2344, "text": " As you can see, they get 81% for 50 classes where a supervised baseline would get 86%." }, { "start": 2344, "end": 2350, "text": " Into 200 classes, they get 69% where a supervised baseline would get 76%." }, { "start": 2350, "end": 2355, "text": " So it's fairly, it's there." }, { "start": 2355, "end": 2361, "text": " And that's quite remarkable for these low number of classes." }, { "start": 2361, "end": 2368, "text": " And they figure out that if they look for the samples that are kind of in the most of the middle of their cluster," }, { "start": 2368, "end": 2371, "text": " they get these prototypes right here." }, { "start": 2371, "end": 2373, "text": " You can see all of these images." }, { "start": 2373, "end": 2378, "text": " If you know ImageNet, some of the images really only have a part of the object and so on." }, { "start": 2378, "end": 2388, "text": " So here with the prototypical things, you really get center clear shot of the object with clearly visible features and so on." }, { "start": 2388, "end": 2401, "text": " So this sort of repeats the fact that this clustering really does go on that sort of semantic information." }, { "start": 2401, "end": 2405, "text": " Of course, the labels here are from the test label set." }, { "start": 2405, "end": 2410, "text": " The network can't figure that out." }, { "start": 2410, "end": 2413, "text": " And then they go for 1,000 classes." }, { "start": 2413, "end": 2420, "text": " And in 1,000 classes, it doesn't really work because there might be just too many confusions right here." }, { "start": 2420, "end": 2426, "text": " But they do have this confusion matrix of their method." }, { "start": 2426, "end": 2434, "text": " And it shows that the confusion matrix is pretty much a block diagonal along these super clusters right here." }, { "start": 2434, "end": 2442, "text": " So you can see the dogs, the network confuses the dogs fairly often and then insects with each other, but not really across here." }, { "start": 2442, "end": 2445, "text": " Which is still quite remarkable." }, { "start": 2445, "end": 2449, "text": " But I mean, that's you get the same thing for a lot of these methods." }, { "start": 2449, "end": 2456, "text": " So I don't I don't know how much different this would be in other methods." }, { "start": 2456, "end": 2459, "text": " But certainly it's interesting to look at." }, { "start": 2459, "end": 2466, "text": " Now, they go into one last thing, and that is what if we don't know how many clusters there are, right?" }, { "start": 2466, "end": 2468, "text": " If we don't know anything." }, { "start": 2468, "end": 2473, "text": " So say so far, we have assumed to to have knowledge about the number of ground truth classes." }, { "start": 2473, "end": 2477, "text": " The model predictions were valid losing the Hungarian matching algorithm." }, { "start": 2477, "end": 2484, "text": " We already saw this in the DETR by Facebook, if you remember." }, { "start": 2484, "end": 2490, "text": " However, what happens if the number of clusters does not match the number of ground truth classes anymore?" }, { "start": 2490, "end": 2498, "text": " So they now say table three reports the results when we overestimate the number of ground truth classes by a factor of two." }, { "start": 2498, "end": 2505, "text": " OK, so now they build just 20 classes for C for 10 instead of 10 classes." }, { "start": 2505, "end": 2508, "text": " And we'll look at table three real quick." }, { "start": 2508, "end": 2510, "text": " Where's table three?" }, { "start": 2510, "end": 2512, "text": " This is table three." }, { "start": 2512, "end": 2519, "text": " OK, so when they over cluster, you get the thing here on the bottom." }, { "start": 2519, "end": 2523, "text": " And you can see there is a drop in accuracy right here." }, { "start": 2523, "end": 2532, "text": " Now, what I don't actually they don't actually say how they do the over cluster matching." }, { "start": 2532, "end": 2544, "text": " So if you imagine if I now have, I don't know, six clusters, but I need to assign them to three clusters, you know, here." }, { "start": 2544, "end": 2547, "text": " Do I still use this most optimistic thing?" }, { "start": 2547, "end": 2557, "text": " So do I still use I think they still use this most optimistic matching right where you assign everything to its best fitted cluster." }, { "start": 2557, "end": 2562, "text": " You compute all the permutations and then you give it the best benefit of the doubt." }, { "start": 2562, "end": 2574, "text": " Now, if you imagine the situation where I over cluster to the point that I have each image in its own cluster" }, { "start": 2574, "end": 2583, "text": " and I run this algorithm to evaluate my clustering, I give it basically the most beneficial view, then I would get 100 percent accuracy." }, { "start": 2583, "end": 2596, "text": " OK, so like in one of in these over cluster approach, I would sort of expect that you actually get a better score" }, { "start": 2596, "end": 2602, "text": " because you can like there is more generosity of the matching algorithm involved." }, { "start": 2602, "end": 2611, "text": " 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." }, { "start": 2611, "end": 2613, "text": " So there's kind of two forces pulling here." }, { "start": 2613, "end": 2620, "text": " But I was kind of astounded that it's going down and the evaluation method of this matching algorithm," }, { "start": 2620, "end": 2626, "text": " it sort of breaks down when you have more classes, at least in my opinion." }, { "start": 2626, "end": 2636, "text": " Yeah, but but it's interesting to see that you can just overshoot and but then you need some sort of heuristic to reconcile that." }, { "start": 2636, "end": 2640, "text": " In any case, I think this paper is pretty cool." }, { "start": 2640, "end": 2647, "text": " It brings together a lot of things that were already present and introduces this kind of this step approach." }, { "start": 2647, "end": 2652, "text": " But what you have to keep in mind and by the way, there's lots of samples down here." }, { "start": 2652, "end": 2656, "text": " What you have to keep in mind is there are a lot of hyperparameters in here." }, { "start": 2656, "end": 2666, "text": " There are like this threshold and you know, the first of all, yeah, the number of classes, the thresholds, the architectures and so on." }, { "start": 2666, "end": 2672, "text": " And all of this has been tuned to get these numbers really high." }, { "start": 2672, "end": 2678, "text": " Right. All of these steps, all of the augmentations and so on, the chosen data augmentations." }, { "start": 2678, "end": 2683, "text": " It has been chosen to get this number as high as possible." }, { "start": 2683, "end": 2692, "text": " So, you know, to interpret this as, oh, look, we can classify without knowing the labels is, you know," }, { "start": 2692, "end": 2700, "text": " yes, in this case, but the hyperparameter choices of the algorithm are all informed by the labels." }, { "start": 2700, "end": 2708, "text": " So it is still very, very unclear of how this method will actually work when you really don't have the labels," }, { "start": 2708, "end": 2713, "text": " when you actually have to choose the hyperparameters in absence of anything." }, { "start": 2713, "end": 2719, "text": " And yeah, I think the future might tell if they continue to work on this." }, { "start": 2719, "end": 2729, "text": " All right. Thanks for listening, looking, watching and bearing with me through my wrestling with various math," }, { "start": 2729, "end": 2733, "text": " basic math in this video. I wish you a good day and bye bye." } ]
3_qGrmD6iQY
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
On the Measure of Intelligence by François Chollet - Part 1: Foundations (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "chollet", "keras", "google", "francois", "intelligence", "iq", "iq test", "deep neural networks", "prior", "skill", "performance", "measurement", "measure", "test", "number", "intelligent", "smart", "learning", "generalization", "ability", "experience", "humans", "evolution", "nature", "nurture", "psychometrics", "range", "adaptability", "arc", "kaggle", "difficulty", "entropy", "core knowledge", "objectness", "navigation", "contact", "agent", "goal" ]
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 François Cholet 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 we 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 Cholet 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 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. We all kind of feel what seems intelligent but we are not like sure and sometimes it's very misleading. He brings up the Turing test for example which is that you have a computer or a human behind a wall and on the other end sits a human and the human needs to kind of communicate without seeing what he or she communicates with and then determine whether or not on the other side of the wall is a human or a computer and if the computer could fool a human into kind of a 50-50 guess then the computer would be passing the Turing test and therefore intelligent. Now Shirley doesn't go right now into why that's not sufficient but he's basically saying this is not sufficient it's distracting and second of all it's basically just outsourcing the problems of defining intelligence to human right to this human right here who is fallible and noisy and you know doesn't all doesn't really know all you all you tell the human is basically like is this thing intelligent does this thing seem human to you it's also not clearly defined so we need some something more and Shirley says the definitions that exist today of intelligence are basically they they have implicit they are implicit definitions that are loaded with biases and biases basically from a human perspective on what intelligence is and if we want to really make progress in terms of in 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 and agents ability to achieve goals in a wide range of environments that was I believe the conclusion of a an author that distilled lots of different definitions and try to distill them into one one sentence and that's it intelligence measures and agents ability to achieve goals in a wide range of environments so the crucial parts here is to ability to achieve goals so it must the agent must be you know doing something useful doing it like in reinforcement learning we'd say it must be getting higher rewards and the second part is in a wide range of environments so the the notion right here that we're going to encounter time and time again is basically an addition of skill and adaptivity so if you have it's not enough to have high skill you also need to be kind of adaptive to very very different environments to a range of environments and that's this this is the main issue that surely has with the current sort of definitions of intelligence and the current direction of the AI field because it mostly measures skill and not generalization or adaptivity now he he says in this thing in this sentence right here that you just saw there is an implicit sort of something is said implicitly namely that these these these skills this ability to achieve goals in this wide range of environments it must be acquired it must be learned these these new tasks these different environments the agent should basically learn to adapt to the different environments then and then the agent is intelligent it's not that intelligent when it is sort of pre-programmed to already handle these environments so he says that's that's sort of implicit in that statement and we're going to see how this is made explicit later he goes into basically there are two two different viewpoints on intelligence this old nature versus nurture debate and that refers to two things like crystallized intelligence versus skill acquisition intelligence so the evolutionary view would be that intelligence is sort of this set of static programs and here we simply kind of boil down these two views to their extremes right so don't I don't think any major evolutionary biologist is complete like is apps is that extreme right now but these were historical set of views that were held one of them was that intelligence is basically just it's all pre-group pre-programmed into you by evolution so you can you can solve this puzzle because during evolution you know your ancestors that could solve these puzzles were were survived you can plan your path through a a tree jungle because you know that was beneficiary to you and so evolution put that into your brain and therefore what results is AI is the science of making machines capable of performing tasks that would require intelligence if done by humans that's basically what Minsky says a quote I believe by Minsky at least Cholay says it's by Minsky or I misread where if you have this this set of view that that AI is basically just this set of static programs that means that if a human applies that set of programs to a task right and the human achieves 200 points it means if the if an AI comes along and achieves 201 points then it is intelligent because it has simply the better set of the better it has outperformed the static set of programs intelligence is this static set of programs and the AI has a better set of static set of programs so it's basically Minsky says if we know of a task that would require intelligence if done by a human then if that 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's pre-programmed what we can still learn and they would say yeah but the learning is just you memorize situations and that particular ability is also pre-programmed into you the other extreme viewpoint is this tabula rasa viewpoint where it basically says you come into this world and your brain is a blank slate and everything you all of your abilities you basically must acquire through learning throughout your life so this is another extreme viewpoint and in terms of intelligence where that leads is following AI is the science and engineering of making machines do tasks they have never seen and have not been prepared for beforehand and that's a quote by McCarthy and Friedberg if we 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 how the machines have not been prepared for a particular situation so if we make a machine that can do a task that it has not been prepared for we we know it's basically intelligent and again so if we make a machine that can do all of these things all of the things right here then either Friedberg says we must reduce these activities to exciting so basically we must program the solution in there already or we must develop a machine that can do things without being told precisely how and as you as you might realize this is much closer to the to the machine learning paradigm it's basically it's all about how much you say precisely because the extreme proponent of this thing would would basically recognize any sort of learning anything that you haven't seen before is an intelligent right if you if you can handle any new situation you're intelligent and show they is going to argue that that's also not really the case like we have to be a bit more graded about it but this is basically the machine learning approach it's it's we build machines that can do things without being told precisely how that they have not been prepared for beforehand like it can solve things that are not in the training data that's one interpretation and if you're a very strong proponent of this you would call that intelligent and she'll 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 show legos 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 pure competition so this is maybe what we see in sort of like chess so we let the bots play first humans and then we let them play other bots and we determine which one's the best and also the most familiar one benchmarks so this would be where your I don't know your image net net test set is right that's right here that's a skill-based evaluation that's one given task how well can you solve the image net test set without looking at it that's one task so the problem surely says with these this skill-based evaluation is sort of obvious it's like a single focus you can't like you are only good at this particular thing and that is one of the examples of this is the fact that the Kaggle models are usually the winning Kaggle models are usually useless outside of that particular data set because they're just so hyper optimized and hyper focused on winning that particular Kaggle competition so it's actually it's actually pretty strong science on how to set up a Kaggle competition such that you can then use the model the winning model afterwards for doing something actually useful no there are no conditions on how to arrive at a solution and there surely lets a bit of that that's basically his point that's gonna come in to the the measurement later into the math where he says you simply have to arrive at a solution in this skill-based evaluation it this 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 whatnot 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 intelligent so people used to say oh checkers the game of checkers it requires intelligence and then you build a machine to solve checkers because you can just I don't know search do like a bit of a smart tree search and you solve it and you tell them here's like a tree search that does checkers and they'll say well but that's not that's not really intelligent it's just like a tree search but but chess chess you can't possibly do the tree the full tree search so chess is intelligent and the then you build like a smarter tree search they build stockfish and they're like yeah but that'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 now the next task the next task the next task it's overly anthropocentric it's overly based on how humans view the world and what is not left in here and again this this acquisition what is not in this definition is the fact that why do we think that someone that plays chess very well like why do we think Magnus Carlsen is smart why do we think someone like a go master is very intelligent and that's because we know that this person is human at least we believe there are doubts about is some of these grand masters but we believe that they are humans and therefore we know that they have only had whatever 20 30 years to learn this and they must eat regularly and they can only think so fast and it's it's hard to memorize things as a human so we know all of their constraints that went into learning this and we we basically know there is it's not like we are not aware of something like Neo has in the matrix where you can just upload the solution to chess into your brain we know what's required to achieve that level of success and we know the only way it this can be done is through general intelligence we know that there is this correlation in humans that if you are good at chess you must have this or you're very very likely to have this general problem-solving ability right that's a human centric view and that does not count for machines machines can take forever to calculate they can distill years and years of experience like thousands of years and this would also this would be the same case with this open AI dota 5 right dota 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 a board a little bit okay it's about skill acquisition but think about it it's it's not that easy to actually define this skill acquisition thing it without falling back into the exact same trap so it goes into say okay as opposed to this skill based we can measure generalization so what's the generalization generalization is the broad ability to handle tasks that differ from previous tasks so they they you have a task and it's different from previous tasks you generalize now there are two ways you can view this there is system centric generalization and that's basically if you take the strict definition here so this would be a machine learning system trains on the training set and then is evaluated on the test set it has never seen the test set before so it's generalizing right that's called system centric generalization but that's not really enough here because we also need to take into account the developer of the system so developer aware generalization means that you generalize two situations that are new to the system and to the developer so a developer of an image net model knows that it is going to be evaluated on the image net test set and that is that is in this category system centric because the developer knows however a broader generalization this developer aware generalization also takes into account that fact and it would say developer aware generalization is only when the system generalizes to something that is not known to developer that is new to even to the developer themselves they don't they haven't foreseen that so this accounts for prior knowledge of the developer it shall it 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 your 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 the test data point is going to be like if there's a classification boundary right here we can sort of nearest neighbor it and there are arguments that deep networks are basically large nearest neighbor classifiers but that's a topic for another day and we are here basically we are here in machine learning right now we do local generalization we know our unknowns we know our test set as the opposition to this is broad generalization broad generalization is where you don't know what you don't know unknown unknowns you don't know what comes at test time and you can't pre-build sort of your expectations into the system this is more akin to something like level five autonomous driving where you build this car but you don't really know what kind of situations 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 probabilistically make a statement about what so this is it's not a clear-cut definition and I think we're going to so in the math it seems clear-cut but when we get there I don't think it is that clear-cut honestly it's still kind of a an intuition thing what you categorize as local and broad and so on also here the Wozniak coffee cup example where it 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 do you know the coffee might there might be different coffee makers that you've never encountered before but I've long been saying that this is a bit of a trick right here because what what you can always do is you can construct a room a kitchen right and right here is the coffee machine so there's the how do we draw this there's the coffee machine right here one of these fancy Nespresso machines you put in a capsule here and here's the coffee machine okay but then you you build a wall around it and the wall has a door and the door the door will only open if you solve an IQ test right so or any sort of any surface so whatever you put whatever you put in that spot that's the level of generalization you you can achieve basically so you can always up the level of generalization to or you can put I don't know you can put the halting problem here right you can you can you can here you can say you only solve this door if you can whatever give me a proof of the ABC conjecture something like this so coffee cup example kind of kind of has some back doors in any case you sort of know what was the acme needs you should be able to go into a standard kitchen but the standard kitchens are still diverse enough you can't foresee all of them like I don't if any of you has this sort of kitchen that I'm talking about like mad respect all we will all get this robot and you'll you'll just have to wait for the next iteration ok then there's extreme extreme generalization is where you have kind of open-ended you you don't know what's going to 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 surely says is any conceivable task in the universe and that's pointless it's pointless because it's just too much there's this no free lunch theorem right plus what we actually want is we want human level intelligence and human level intelligence has this property of extreme generalization with extreme generalization we mean the scope see it's dependent on a scope we mean the scope of all human tasks of all tasks that humans could produce or could find useful could find themselves in or could pose of this system not all tasks that the universe could pose so that here you you don't even have the relation between tasks the relation between tasks are at most abstract so there maybe it's like the general ability of sorting things generally in in whatever fashion in and things whatever these things are with whatever properties 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 a like surely it 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 and count this contains the other one so why because we can handle situations that previous humans haven't experienced now I'm not I'm not sure he basically says humans have developer aware generalization because we can we can fare well in situations that no humans during evolution have experienced prior but okay let's let's have this abstractly let's say our developer is the evolution process you still have to ask can humans really solve things that 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 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 shoeless framework that would correspond to broad generalization and then these are again hierarchically subdivided and sometimes as you can see your shared task specific skills okay and this in in shoeless framework would be local or no generalization so again he basically goes into psychometrics and specifically IQ tests for humans can they inform the measuring process the note and the thing to note here according to shalé is in an IQ test you want to measure these broad abilities you want to measure ultimately you 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 right you you you want to measure the abilities but you can only measure tasks the abilities are 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 like okay complete this series which number comes next draw like rotate this in your head and so on but there there are so very human centric things like reading comprehension and so on but you do this broad battery of tests and you might think oh oh okay this is sort of like the Atari you know sweet where 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 entailment there is sentiment there is Boolean question answering and but this is according to chalet it's sort of not really it's not really the case that these are equivalent because it is a battery but it is known to the developer so the developer knows that the NLP system has to solve the 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 the tested cannot or ideally should not practice for them that's why people keep developing new and new IQ tests because we sort of know they all correlate first of all so they measure the same thing but also second because otherwise people if you just always do the same test people could practice it and then you would no longer measure the general ability you would only measure that one test by the way that's also why a lot of these you know brain brain exercise apps and so on they none of them really ups your intelligence you you you only get better at one app if you do that you don't you don't get smarter in general so if and and show they says there have been a number of attempts at making machines making AI solve human IQ tests right well the reasoning is the follows like oh okay humans develop IQ tests for humans and presumably those are no you're not known and so on but again the tasks broadly of IQ tests are known I guess really IQ tests work on humans because they only work on humans who don't really care like if someone really really really really cared they would you know research what kind of tests there are they would look at all the tests from history there's only so many tests you can come up with the new ones are going to be like variations on the old 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 they're basically going to look at all these tasks 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're reproducible that are valid that means they really measure IQ or if they really measure artificial intelligence and not you know just task specific skill or something else they're standardized across the spectrum so they're standardized so everyone can do them in the same way by the way the current benchmarks are standardized that's the good part about them and they should be they should be free from bias which means they should not measure anything orthogonal to what they claim to measure and the example he gives is they should not measure reaction time which is also a big component in human IQ tests you also measure how fast the human is at the test and the machine obviously if you simply put more electrons through the cable it's going to run faster you or if you put more more GPUs there so in broad terms we what we should focus on is this new skill acquisition as I said from the beginning but it is not as easy as you might think right now and we're going to dive into the next episode and is going to be math heavy and that's going to be fun so I hope you enjoyed this kind of special episode maybe let me know if you like this style the paper doesn't have any pictures so you're just left with what I'm what I'm drawing yeah if you enjoyed this leave a like leave comments share it out and I'll see you next time bye bye
[ { "start": 0, "end": 5.28, "text": " Hello there! Today we're going to look at On the Measure of Intelligence by" }, { "start": 5.28, "end": 12.32, "text": " François Cholet of Google. This is a bit of a special episode I would say because" }, { "start": 12.32, "end": 18.52, "text": " if you look at the paper it is first of all it's very long and then second of" }, { "start": 18.52, "end": 24.88, "text": " all it is a wall of text basically. Now it's very interesting text but if I were" }, { "start": 24.88, "end": 29.72, "text": " to go through this with you we basically just be kind of scrolling and reading" }, { "start": 29.72, "end": 36.08, "text": " along. So what I've done is I've basically read this and taken notes and" }, { "start": 36.08, "end": 41, "text": " I will attempt to just tell you what happens at least for the first part. So" }, { "start": 41, "end": 46, "text": " I intend for this to be a multi-part series because it's so long. So the first" }, { "start": 46, "end": 51.72, "text": " part as you can see here is context and history which is a little less boring" }, { "start": 51.72, "end": 56.72, "text": " than it sounds. The second part is going to be a new perspective where Cholet" }, { "start": 56.72, "end": 62.04, "text": " proposes his measure of intelligence and the third part is going to be about the" }, { "start": 62.04, "end": 67.32, "text": " benchmark, the ARC benchmark that is currently I believe running on Kaggle. So" }, { "start": 67.32, "end": 73.64, "text": " as it looks right now three parts and today we're going to dive into" }, { "start": 73.64, "end": 81.16, "text": " that first part. So here we go. He basically says that we need to define" }, { "start": 81.16, "end": 88.44, "text": " what intelligence means. We need an explicit goal to measure where if we" }, { "start": 88.44, "end": 92.08, "text": " think about AI like artificial intelligence what does intelligence" }, { "start": 92.08, "end": 96.12, "text": " mean? We need something where we can basically put a number or multiple" }, { "start": 96.12, "end": 101, "text": " numbers on it and says that's intelligent, that's not intelligent. What we have" }, { "start": 101, "end": 106.36, "text": " right now is just basically anecdotes. We all kind of feel what seems" }, { "start": 106.36, "end": 113.44, "text": " intelligent but we are not like sure and sometimes it's very misleading. He brings" }, { "start": 113.44, "end": 119.92, "text": " up the Turing test for example which is that you have a computer or a human" }, { "start": 119.92, "end": 125.2, "text": " behind a wall and on the other end sits a human and the human needs to kind of" }, { "start": 125.2, "end": 130.12, "text": " communicate without seeing what he or she communicates with" }, { "start": 130.12, "end": 135.48, "text": " and then determine whether or not on the other side of the wall is a human or a" }, { "start": 135.48, "end": 141.51999999999998, "text": " computer and if the computer could fool a human into kind of a 50-50 guess then" }, { "start": 141.51999999999998, "end": 148.56, "text": " the computer would be passing the Turing test and therefore intelligent. Now" }, { "start": 148.56, "end": 153.28, "text": " Shirley doesn't go right now into why that's not sufficient but he's basically" }, { "start": 153.28, "end": 158.35999999999999, "text": " saying this is not sufficient it's distracting and second of all it's" }, { "start": 158.35999999999999, "end": 162.79999999999998, "text": " basically just outsourcing the problems of defining intelligence to human right" }, { "start": 162.8, "end": 169.36, "text": " to this human right here who is fallible and noisy and you know doesn't all" }, { "start": 169.36, "end": 174.96, "text": " doesn't really know all you all you tell the human is basically like is this" }, { "start": 174.96, "end": 179.84, "text": " thing intelligent does this thing seem human to you it's also not clearly" }, { "start": 179.84, "end": 186.84, "text": " defined so we need some something more and Shirley says the definitions that" }, { "start": 186.84, "end": 193.32, "text": " exist today of intelligence are basically they they have implicit they" }, { "start": 193.32, "end": 199.44, "text": " are implicit definitions that are loaded with biases and biases basically from a" }, { "start": 199.44, "end": 203.92000000000002, "text": " human perspective on what intelligence is and if we want to really make" }, { "start": 203.92000000000002, "end": 209.12, "text": " progress in terms of in of measuring intelligence we need to point out these" }, { "start": 209.12, "end": 218.20000000000002, "text": " biases that are in these measures okay they has a range of quotes namely one" }, { "start": 218.20000000000002, "end": 224.84, "text": " here intelligence measures and agents ability to achieve goals in a wide range" }, { "start": 224.84, "end": 231.12, "text": " of environments that was I believe the conclusion of a an author that distilled" }, { "start": 231.12, "end": 237.08, "text": " lots of different definitions and try to distill them into one one sentence and" }, { "start": 237.08, "end": 241.16000000000003, "text": " that's it intelligence measures and agents ability to achieve goals in a" }, { "start": 241.16000000000003, "end": 247.4, "text": " wide range of environments so the crucial parts here is to ability to" }, { "start": 247.4, "end": 252.8, "text": " achieve goals so it must the agent must be you know doing something useful doing" }, { "start": 252.8, "end": 257.12, "text": " it like in reinforcement learning we'd say it must be getting higher rewards" }, { "start": 257.12, "end": 264.68, "text": " and the second part is in a wide range of environments so the the notion right" }, { "start": 264.68, "end": 269.32, "text": " here that we're going to encounter time and time again is basically an addition" }, { "start": 269.32, "end": 275.84000000000003, "text": " of skill and adaptivity so if you have it's not enough to have high skill you" }, { "start": 275.84000000000003, "end": 281.2, "text": " also need to be kind of adaptive to very very different environments to a range of" }, { "start": 281.2, "end": 286.92, "text": " environments and that's this this is the main issue that surely has with the" }, { "start": 286.92, "end": 291.2, "text": " current sort of definitions of intelligence and the current direction of" }, { "start": 291.2, "end": 298.24, "text": " the AI field because it mostly measures skill and not generalization or" }, { "start": 298.24, "end": 305.44, "text": " adaptivity now he he says in this thing in this sentence right here that you" }, { "start": 305.44, "end": 311.76, "text": " just saw there is an implicit sort of something is said implicitly namely that" }, { "start": 311.76, "end": 317.88, "text": " these these these skills this ability to achieve goals in this wide range of" }, { "start": 317.88, "end": 323.52, "text": " environments it must be acquired it must be learned these these new tasks these" }, { "start": 323.52, "end": 328.64, "text": " different environments the agent should basically learn to adapt to the" }, { "start": 328.64, "end": 333.71999999999997, "text": " different environments then and then the agent is intelligent it's not that" }, { "start": 333.71999999999997, "end": 337.44, "text": " intelligent when it is sort of pre-programmed to already handle these" }, { "start": 337.44, "end": 342.4, "text": " environments so he says that's that's sort of implicit in that statement and" }, { "start": 342.4, "end": 347.79999999999995, "text": " we're going to see how this is made explicit later he goes into basically" }, { "start": 347.79999999999995, "end": 352.28, "text": " there are two two different viewpoints on intelligence this old nature versus" }, { "start": 352.28, "end": 357.91999999999996, "text": " nurture debate and that refers to two things like crystallized intelligence" }, { "start": 357.91999999999996, "end": 364.67999999999995, "text": " versus skill acquisition intelligence so the evolutionary view would be that" }, { "start": 364.67999999999995, "end": 370.12, "text": " intelligence is sort of this set of static programs and here we simply kind" }, { "start": 370.12, "end": 374.96, "text": " of boil down these two views to their extremes right so don't I don't think any" }, { "start": 374.96, "end": 382.72, "text": " major evolutionary biologist is complete like is apps is that extreme right now" }, { "start": 382.72, "end": 388.88, "text": " but these were historical set of views that were held one of them was that" }, { "start": 388.88, "end": 393.34000000000003, "text": " intelligence is basically just it's all pre-group pre-programmed into you by" }, { "start": 393.34000000000003, "end": 399.32, "text": " evolution so you can you can solve this puzzle because during evolution you know" }, { "start": 399.32, "end": 404.59999999999997, "text": " your ancestors that could solve these puzzles were were survived you can plan" }, { "start": 404.59999999999997, "end": 410.64, "text": " your path through a a tree jungle because you know that was beneficiary to" }, { "start": 410.64, "end": 418.84, "text": " you and so evolution put that into your brain and therefore what results is AI" }, { "start": 418.84, "end": 423.64, "text": " is the science of making machines capable of performing tasks that would" }, { "start": 423.64, "end": 430.28, "text": " require intelligence if done by humans that's basically what Minsky says a" }, { "start": 430.28, "end": 436.32, "text": " quote I believe by Minsky at least Cholay says it's by Minsky or I misread" }, { "start": 436.32, "end": 441.96, "text": " where if you have this this set of view that that AI is basically just this set" }, { "start": 441.96, "end": 448.15999999999997, "text": " of static programs that means that if a human applies that set of programs to a" }, { "start": 448.16, "end": 457.32000000000005, "text": " task right and the human achieves 200 points it means if the if an AI comes" }, { "start": 457.32000000000005, "end": 463.8, "text": " along and achieves 201 points then it is intelligent because it has simply the" }, { "start": 463.8, "end": 469.08000000000004, "text": " better set of the better it has outperformed the static set of programs" }, { "start": 469.08000000000004, "end": 473.20000000000005, "text": " intelligence is this static set of programs and the AI has a better set of" }, { "start": 473.2, "end": 481.24, "text": " static set of programs so it's basically Minsky says if we know of a task that" }, { "start": 481.24, "end": 490.56, "text": " would require intelligence if done by a human then if that something that can" }, { "start": 490.56, "end": 497.15999999999997, "text": " solve that task is intelligent and this equates learning basically just to" }, { "start": 497.15999999999997, "end": 502, "text": " memorization if you if you ask a proponent of this viewpoint well what's" }, { "start": 502, "end": 505.52, "text": " what's learning like if everything's pre-programmed what we can still learn" }, { "start": 505.52, "end": 509.76, "text": " and they would say yeah but the learning is just you memorize situations and that" }, { "start": 509.76, "end": 517.68, "text": " particular ability is also pre-programmed into you the other extreme" }, { "start": 517.68, "end": 525.2, "text": " viewpoint is this tabula rasa viewpoint where it basically says you come into" }, { "start": 525.2, "end": 530.16, "text": " this world and your brain is a blank slate and everything you all of your" }, { "start": 530.16, "end": 535.6, "text": " abilities you basically must acquire through learning throughout your life so" }, { "start": 535.6, "end": 542.76, "text": " this is another extreme viewpoint and in terms of intelligence where that leads" }, { "start": 542.76, "end": 549.28, "text": " is following AI is the science and engineering of making machines do tasks" }, { "start": 549.28, "end": 555.48, "text": " they have never seen and have not been prepared for beforehand and that's a" }, { "start": 555.48, "end": 560.6800000000001, "text": " quote by McCarthy and Friedberg if we are ever to make a machine that will" }, { "start": 560.6800000000001, "end": 564.6, "text": " speak understand translate human languages solve mathematical problems" }, { "start": 564.6, "end": 570.16, "text": " with imagination practice a profession or direct an organization either we must" }, { "start": 570.16, "end": 574.2, "text": " reduce these activities to a science so exact that we can tell a machine" }, { "start": 574.2, "end": 579.54, "text": " precisely how to go about doing them or we must develop a machine that can do" }, { "start": 579.54, "end": 586.14, "text": " things without being told precisely how so this leads to more of of these notions" }, { "start": 586.14, "end": 593.28, "text": " right here that you can see here how the machines have not been prepared for a" }, { "start": 593.28, "end": 598.12, "text": " particular situation so if we make a machine that can do a task that it has" }, { "start": 598.12, "end": 607, "text": " not been prepared for we we know it's basically intelligent and again so if we" }, { "start": 607, "end": 611.8, "text": " make a machine that can do all of these things all of the things right here then" }, { "start": 611.8, "end": 618, "text": " either Friedberg says we must reduce these activities to exciting so" }, { "start": 618, "end": 623.76, "text": " basically we must program the solution in there already or we must develop a" }, { "start": 623.76, "end": 629.04, "text": " machine that can do things without being told precisely how and as you as you" }, { "start": 629.04, "end": 634.12, "text": " might realize this is much closer to the to the machine learning paradigm it's" }, { "start": 634.12, "end": 642.72, "text": " basically it's all about how much you say precisely because the extreme" }, { "start": 642.72, "end": 648.28, "text": " proponent of this thing would would basically recognize any sort of learning" }, { "start": 648.28, "end": 653.84, "text": " anything that you haven't seen before is an intelligent right if you if you can" }, { "start": 653.84, "end": 660.28, "text": " handle any new situation you're intelligent and show they is going to" }, { "start": 660.28, "end": 664.68, "text": " argue that that's also not really the case like we have to be a bit more" }, { "start": 664.68, "end": 669.88, "text": " graded about it but this is basically the machine learning approach it's it's" }, { "start": 669.88, "end": 676.3199999999999, "text": " we build machines that can do things without being told precisely how that" }, { "start": 676.3199999999999, "end": 681.68, "text": " they have not been prepared for beforehand like it can solve things that" }, { "start": 681.68, "end": 686.8399999999999, "text": " are not in the training data that's one interpretation and if you're a very" }, { "start": 686.84, "end": 693.1600000000001, "text": " strong proponent of this you would call that intelligent and she'll is going to" }, { "start": 693.1600000000001, "end": 696.72, "text": " argue that the truth of course is somewhere in the middle between these" }, { "start": 696.72, "end": 700.84, "text": " two viewpoints and therefore defining intelligence in either of these terms is" }, { "start": 700.84, "end": 711.48, "text": " going to lack in in expressivity and in usefulness so how do we evaluate AI and" }, { "start": 711.48, "end": 719.04, "text": " show legos through different levels here of AI evaluation so first of all he" }, { "start": 719.04, "end": 725.32, "text": " contrasts these these two things right here skill-based evaluation and" }, { "start": 725.32, "end": 731.96, "text": " generalization based evaluation so in skill-based evaluation you basically go" }, { "start": 731.96, "end": 739.5600000000001, "text": " for one given task so you evaluate a system on one given task one example" }, { "start": 739.56, "end": 746.56, "text": " here is for example the touring test and that's done by human review another" }, { "start": 746.56, "end": 754.3599999999999, "text": " example is where you have like a proof so you evaluate a system in by giving" }, { "start": 754.3599999999999, "end": 759.4, "text": " its optimality proof you can analyze it and you can say it is always correct at" }, { "start": 759.4, "end": 765.28, "text": " this particular task what you can also do is this pure competition so this is" }, { "start": 765.28, "end": 771.04, "text": " maybe what we see in sort of like chess so we let the bots play first humans and" }, { "start": 771.04, "end": 777.76, "text": " then we let them play other bots and we determine which one's the best and also" }, { "start": 777.76, "end": 783.3399999999999, "text": " the most familiar one benchmarks so this would be where your I don't know your" }, { "start": 783.3399999999999, "end": 790.8, "text": " image net net test set is right that's right here that's a skill-based" }, { "start": 790.8, "end": 797, "text": " evaluation that's one given task how well can you solve the image net test" }, { "start": 797, "end": 802.56, "text": " set without looking at it that's one task so the problem surely says with" }, { "start": 802.56, "end": 808.04, "text": " these this skill-based evaluation is sort of obvious it's like a single focus" }, { "start": 808.04, "end": 815.88, "text": " you can't like you are only good at this particular thing and that is one of the" }, { "start": 815.88, "end": 820.3599999999999, "text": " examples of this is the fact that the Kaggle models are usually the winning" }, { "start": 820.36, "end": 824.5600000000001, "text": " Kaggle models are usually useless outside of that particular data set" }, { "start": 824.5600000000001, "end": 828.6, "text": " because they're just so hyper optimized and hyper focused on winning that" }, { "start": 828.6, "end": 834.5600000000001, "text": " particular Kaggle competition so it's actually it's actually pretty strong" }, { "start": 834.5600000000001, "end": 838.84, "text": " science on how to set up a Kaggle competition such that you can then use" }, { "start": 838.84, "end": 846.2, "text": " the model the winning model afterwards for doing something actually useful no" }, { "start": 846.2, "end": 852.6, "text": " there are no conditions on how to arrive at a solution and there surely lets a" }, { "start": 852.6, "end": 857.72, "text": " bit of that that's basically his point that's gonna come in to the the" }, { "start": 857.72, "end": 864.1600000000001, "text": " measurement later into the math where he says you simply have to arrive at a" }, { "start": 864.1600000000001, "end": 869.08, "text": " solution in this skill-based evaluation it this skill-based evaluation usually" }, { "start": 869.08, "end": 874.5200000000001, "text": " doesn't care how you arrive there so the image net test set score doesn't care" }, { "start": 874.52, "end": 879.6, "text": " how you got the neural network or whatnot that you got it simply cares how" }, { "start": 879.6, "end": 886.0799999999999, "text": " many images do you classify correctly and this leads to what is called the AI" }, { "start": 886.0799999999999, "end": 891.0799999999999, "text": " effect which I didn't know it was called like this until recently but it's fairly" }, { "start": 891.0799999999999, "end": 896, "text": " obvious where people say people say people come up with a task that's that" }, { "start": 896, "end": 901.1999999999999, "text": " is intelligent so people used to say oh checkers the game of checkers it" }, { "start": 901.2, "end": 906.2, "text": " requires intelligence and then you build a machine to solve checkers because you" }, { "start": 906.2, "end": 912.12, "text": " can just I don't know search do like a bit of a smart tree search and you solve" }, { "start": 912.12, "end": 914.76, "text": " it and you tell them here's like a tree search that does checkers and they'll" }, { "start": 914.76, "end": 918.1600000000001, "text": " say well but that's not that's not really intelligent it's just like a" }, { "start": 918.1600000000001, "end": 924.1600000000001, "text": " tree search but but chess chess you can't possibly do the tree the full" }, { "start": 924.16, "end": 932.56, "text": " tree search so chess is intelligent and the then you build like a smarter tree" }, { "start": 932.56, "end": 937.12, "text": " search they build stockfish and they're like yeah but that's just you know" }, { "start": 937.12, "end": 942.9599999999999, "text": " that's just this machine thing and so the goal posts keep moving every time" }, { "start": 942.9599999999999, "end": 946.9599999999999, "text": " they come up with a task and you solve the tasks they'll just say wow that's" }, { "start": 946.9599999999999, "end": 953.0799999999999, "text": " not really intelligence this next task that's intelligence and it's easy to see" }, { "start": 953.08, "end": 958.0400000000001, "text": " that if you just do this skill-based evaluation you will never get there" }, { "start": 958.0400000000001, "end": 962.6800000000001, "text": " because it's always going to be now the next task the next task the next task" }, { "start": 962.6800000000001, "end": 969.84, "text": " it's overly anthropocentric it's overly based on how humans view the world and" }, { "start": 969.84, "end": 975.12, "text": " what is not left in here and again this this acquisition what is not in this" }, { "start": 975.12, "end": 981.24, "text": " definition is the fact that why do we think that someone that plays chess very" }, { "start": 981.24, "end": 987.4, "text": " well like why do we think Magnus Carlsen is smart why do we think someone like a" }, { "start": 987.4, "end": 994.52, "text": " go master is very intelligent and that's because we know that this person is" }, { "start": 994.52, "end": 999.48, "text": " human at least we believe there are doubts about is some of these grand" }, { "start": 999.48, "end": 1005.08, "text": " masters but we believe that they are humans and therefore we know that they" }, { "start": 1005.08, "end": 1012.08, "text": " have only had whatever 20 30 years to learn this and they must eat regularly" }, { "start": 1012.08, "end": 1016.84, "text": " and they can only think so fast and it's it's hard to memorize things as a human" }, { "start": 1016.84, "end": 1022.1600000000001, "text": " so we know all of their constraints that went into learning this and we we" }, { "start": 1022.1600000000001, "end": 1031.16, "text": " basically know there is it's not like we are not aware of something like Neo has" }, { "start": 1031.16, "end": 1036.52, "text": " in the matrix where you can just upload the solution to chess into your brain we" }, { "start": 1036.52, "end": 1041.72, "text": " know what's required to achieve that level of success and we know the only" }, { "start": 1041.72, "end": 1046.68, "text": " way it this can be done is through general intelligence we know that there" }, { "start": 1046.68, "end": 1052.88, "text": " is this correlation in humans that if you are good at chess you must have this" }, { "start": 1052.88, "end": 1058.52, "text": " or you're very very likely to have this general problem-solving ability right" }, { "start": 1058.52, "end": 1063.48, "text": " that's a human centric view and that does not count for machines machines can" }, { "start": 1063.48, "end": 1069.4, "text": " take forever to calculate they can distill years and years of experience" }, { "start": 1069.4, "end": 1073.52, "text": " like thousands of years and this would also this would be the same case with" }, { "start": 1073.52, "end": 1082.68, "text": " this open AI dota 5 right dota 5 is exactly here alpha go is exactly here we" }, { "start": 1082.68, "end": 1086.96, "text": " only think they might be intelligent if a human does it because we know what's" }, { "start": 1086.96, "end": 1094.68, "text": " required for humans to get there again focus skill acquisition now you might be" }, { "start": 1094.68, "end": 1099.8400000000001, "text": " a board a little bit okay it's about skill acquisition but think about it" }, { "start": 1099.8400000000001, "end": 1106.64, "text": " it's it's not that easy to actually define this skill acquisition thing it" }, { "start": 1106.64, "end": 1113.48, "text": " without falling back into the exact same trap so it goes into say okay as opposed" }, { "start": 1113.48, "end": 1118.1200000000001, "text": " to this skill based we can measure generalization so what's the" }, { "start": 1118.1200000000001, "end": 1122.6, "text": " generalization generalization is the broad ability to handle tasks that" }, { "start": 1122.6, "end": 1129.3600000000001, "text": " differ from previous tasks so they they you have a task and it's different from" }, { "start": 1129.3600000000001, "end": 1135.24, "text": " previous tasks you generalize now there are two ways you can view this there is" }, { "start": 1135.24, "end": 1140.1200000000001, "text": " system centric generalization and that's basically if you take the strict" }, { "start": 1140.12, "end": 1144.56, "text": " definition here so this would be a machine learning system trains on the" }, { "start": 1144.56, "end": 1150.4799999999998, "text": " training set and then is evaluated on the test set it has never seen the test" }, { "start": 1150.4799999999998, "end": 1155.3999999999999, "text": " set before so it's generalizing right that's called system centric" }, { "start": 1155.3999999999999, "end": 1160.8, "text": " generalization but that's not really enough here because we also need to take" }, { "start": 1160.8, "end": 1167.56, "text": " into account the developer of the system so developer aware generalization means" }, { "start": 1167.56, "end": 1171.84, "text": " that you generalize two situations that are new to the system and to the" }, { "start": 1171.84, "end": 1177.6, "text": " developer so a developer of an image net model knows that it is going to be" }, { "start": 1177.6, "end": 1184.36, "text": " evaluated on the image net test set and that is that is in this category system" }, { "start": 1184.36, "end": 1190, "text": " centric because the developer knows however a broader generalization this" }, { "start": 1190, "end": 1195.1599999999999, "text": " developer aware generalization also takes into account that fact and it" }, { "start": 1195.16, "end": 1201.92, "text": " would say developer aware generalization is only when the system generalizes to" }, { "start": 1201.92, "end": 1206.72, "text": " something that is not known to developer that is new to even to the developer" }, { "start": 1206.72, "end": 1212.8400000000001, "text": " themselves they don't they haven't foreseen that so this accounts for prior" }, { "start": 1212.8400000000001, "end": 1218.96, "text": " knowledge of the developer it shall it defines different degrees of" }, { "start": 1218.96, "end": 1224.48, "text": " generalization largely along these lines so absence of generalization is when you" }, { "start": 1224.48, "end": 1228.92, "text": " have like an algorithm that you know you absolutely have built in that it works" }, { "start": 1228.92, "end": 1233.64, "text": " for every possible situation like a certain assorting algorithm that you" }, { "start": 1233.64, "end": 1238.22, "text": " have proven mathematically proven to work for all sequences of numbers no" }, { "start": 1238.22, "end": 1243.24, "text": " generalization everything has been foreseen then there is local" }, { "start": 1243.24, "end": 1246.98, "text": " generalization and this in machine learning we call this something like" }, { "start": 1246.98, "end": 1252.16, "text": " robustness this would be your test set robustness your a small distribution" }, { "start": 1252.16, "end": 1258.96, "text": " shift so the test set here comes from a known distribution so this is the notion" }, { "start": 1258.96, "end": 1264.76, "text": " of known unknowns you you have an idea of what can come at your system and you" }, { "start": 1264.76, "end": 1269.44, "text": " require basically you require a dense sampling of the input space usually" }, { "start": 1269.44, "end": 1273.8400000000001, "text": " machine learning training sets are very very densely sample that means there's a" }, { "start": 1273.8400000000001, "end": 1278.92, "text": " lot of data there that we can learn from so we have like lots and lots and lots" }, { "start": 1278.92, "end": 1284.5600000000002, "text": " and lots and lots of data and when the test point comes it is going to be like" }, { "start": 1284.5600000000002, "end": 1290.68, "text": " somewhere really in within between all of these training data points so we can" }, { "start": 1290.68, "end": 1295.3200000000002, "text": " infer from the surrounding training data points what the test data point is going" }, { "start": 1295.3200000000002, "end": 1299.3200000000002, "text": " to be like if there's a classification boundary right here we can sort of" }, { "start": 1299.3200000000002, "end": 1304.3200000000002, "text": " nearest neighbor it and there are arguments that deep networks are" }, { "start": 1304.32, "end": 1311, "text": " basically large nearest neighbor classifiers but that's a topic for another day and we" }, { "start": 1311, "end": 1316.48, "text": " are here basically we are here in machine learning right now we do local" }, { "start": 1316.48, "end": 1325.2, "text": " generalization we know our unknowns we know our test set as the opposition to" }, { "start": 1325.2, "end": 1330.72, "text": " this is broad generalization broad generalization is where you don't know" }, { "start": 1330.72, "end": 1335.16, "text": " what you don't know unknown unknowns you don't know what comes at test time and" }, { "start": 1335.16, "end": 1342.08, "text": " you can't pre-build sort of your expectations into the system this is" }, { "start": 1342.08, "end": 1350.04, "text": " more akin to something like level five autonomous driving where you build this" }, { "start": 1350.04, "end": 1354.72, "text": " car but you don't really know what kind of situations coming no no this is a" }, { "start": 1354.72, "end": 1359.16, "text": " this is a fuzzy definition right I mean you do sort of know what situations" }, { "start": 1359.16, "end": 1366.0800000000002, "text": " will come at the car you can certainly probabilistically make a statement" }, { "start": 1366.0800000000002, "end": 1370.6000000000001, "text": " about what so this is it's not a clear-cut definition and I think we're" }, { "start": 1370.6000000000001, "end": 1376.28, "text": " going to so in the math it seems clear-cut but when we get there I don't" }, { "start": 1376.28, "end": 1382.4, "text": " think it is that clear-cut honestly it's still kind of a an intuition thing what" }, { "start": 1382.4, "end": 1388.0800000000002, "text": " you categorize as local and broad and so on also here the Wozniak coffee cup" }, { "start": 1388.08, "end": 1392.1999999999998, "text": " example where it basically Wozniak says you should be able to build a robot that" }, { "start": 1392.1999999999998, "end": 1399.04, "text": " goes into any kitchen and gets you a cup of coffee and here you have known sorry" }, { "start": 1399.04, "end": 1403.96, "text": " unknown unknowns because you can't possibly foresee all possible kitchen" }, { "start": 1403.96, "end": 1408.3, "text": " arrangements there might be obstacles and so on do you know the coffee might" }, { "start": 1408.3, "end": 1413.56, "text": " there might be different coffee makers that you've never encountered before but" }, { "start": 1413.56, "end": 1419.8, "text": " I've long been saying that this is a bit of a trick right here because what what" }, { "start": 1419.8, "end": 1427.12, "text": " you can always do is you can construct a room a kitchen right and right here is" }, { "start": 1427.12, "end": 1432.24, "text": " the coffee machine so there's the how do we draw this there's the coffee machine" }, { "start": 1432.24, "end": 1438.08, "text": " right here one of these fancy Nespresso machines you put in a capsule here and" }, { "start": 1438.08, "end": 1444.08, "text": " here's the coffee machine okay but then you you build a wall around it and the" }, { "start": 1444.08, "end": 1452.6399999999999, "text": " wall has a door and the door the door will only open if you solve an IQ test" }, { "start": 1452.6399999999999, "end": 1458.96, "text": " right so or any sort of any surface so whatever you put whatever you put in" }, { "start": 1458.96, "end": 1462.72, "text": " that spot that's the level of generalization you you can achieve" }, { "start": 1462.72, "end": 1469.76, "text": " basically so you can always up the level of generalization to or you can put I" }, { "start": 1469.76, "end": 1473.72, "text": " don't know you can put the halting problem here right you can you can you" }, { "start": 1473.72, "end": 1480.3600000000001, "text": " can here you can say you only solve this door if you can whatever give me a proof" }, { "start": 1480.3600000000001, "end": 1487.96, "text": " of the ABC conjecture something like this so coffee cup example kind of kind" }, { "start": 1487.96, "end": 1494.88, "text": " of has some back doors in any case you sort of know what was the acme needs you" }, { "start": 1494.88, "end": 1500.08, "text": " should be able to go into a standard kitchen but the standard kitchens are" }, { "start": 1500.08, "end": 1506.72, "text": " still diverse enough you can't foresee all of them like I don't if any of you" }, { "start": 1506.72, "end": 1513.04, "text": " has this sort of kitchen that I'm talking about like mad respect all we" }, { "start": 1513.04, "end": 1516.92, "text": " will all get this robot and you'll you'll just have to wait for the next" }, { "start": 1516.92, "end": 1524.88, "text": " iteration ok then there's extreme extreme generalization is where you have" }, { "start": 1524.88, "end": 1528.4, "text": " kind of open-ended you you don't know what's going to come you don't even" }, { "start": 1528.4, "end": 1532.8400000000001, "text": " know the broad category of tasks that is going to come right broad here is still" }, { "start": 1532.8400000000001, "end": 1539.3600000000001, "text": " broad still refers to a broad category of related tasks so it is sort of a" }, { "start": 1539.3600000000001, "end": 1544.72, "text": " general ability and the extreme generalization just means you know" }, { "start": 1544.72, "end": 1550.3600000000001, "text": " whatever whatever comes you can solve it but it is different from universal" }, { "start": 1550.3600000000001, "end": 1557.08, "text": " universal generalization surely says is any conceivable task in the universe and" }, { "start": 1557.08, "end": 1561.92, "text": " that's pointless it's pointless because it's just too much there's this no" }, { "start": 1561.92, "end": 1569.28, "text": " free lunch theorem right plus what we actually want is we want human level" }, { "start": 1569.28, "end": 1574.1200000000001, "text": " intelligence and human level intelligence has this property of extreme" }, { "start": 1574.12, "end": 1579.12, "text": " generalization with extreme generalization we mean the scope see" }, { "start": 1579.12, "end": 1584.7199999999998, "text": " it's dependent on a scope we mean the scope of all human tasks of all tasks" }, { "start": 1584.7199999999998, "end": 1590.4399999999998, "text": " that humans could produce or could find useful could find themselves in or could" }, { "start": 1590.4399999999998, "end": 1600.36, "text": " pose of this system not all tasks that the universe could pose so that here you" }, { "start": 1600.36, "end": 1605.08, "text": " you don't even have the relation between tasks the relation between tasks are at" }, { "start": 1605.08, "end": 1613.4799999999998, "text": " most abstract so there maybe it's like the general ability of sorting things" }, { "start": 1613.4799999999998, "end": 1619.04, "text": " generally in in whatever fashion in and things whatever these things are with" }, { "start": 1619.04, "end": 1625.04, "text": " whatever properties or the general ability to communicate an idea or" }, { "start": 1625.04, "end": 1633.68, "text": " something like this and this in humans is called the g factor if you or it's" }, { "start": 1633.68, "end": 1639.68, "text": " related to but we're going to take a like surely it really goes after" }, { "start": 1639.68, "end": 1646.24, "text": " psychometrics here and really models its his framework after psychometrics for" }, { "start": 1646.24, "end": 1651.28, "text": " humans and the sort of achievement in psychometrics one of the achievements is" }, { "start": 1651.28, "end": 1656.52, "text": " this measure of the g factor and that's what we humans usually call intelligence" }, { "start": 1656.52, "end": 1663.16, "text": " he says note that humans have system centric and developer aware" }, { "start": 1663.16, "end": 1669.48, "text": " generalization though you know that one this this and count this contains the" }, { "start": 1669.48, "end": 1676.72, "text": " other one so why because we can handle situations that previous humans haven't" }, { "start": 1676.72, "end": 1681.84, "text": " experienced now I'm not I'm not sure he basically says humans have developer" }, { "start": 1681.84, "end": 1686.92, "text": " aware generalization because we can we can fare well in situations that no" }, { "start": 1686.92, "end": 1694.04, "text": " humans during evolution have experienced prior but okay let's let's have this" }, { "start": 1694.04, "end": 1700.1200000000001, "text": " abstractly let's say our developer is the evolution process you still have to" }, { "start": 1700.12, "end": 1708.84, "text": " ask can humans really solve things that the evolutionary process has not built" }, { "start": 1708.84, "end": 1713.8799999999999, "text": " into them in some sort I guess that refers back to the nature versus nurture" }, { "start": 1713.8799999999999, "end": 1721.4799999999998, "text": " like humans humans cannot you know multiply long floating point numbers it" }, { "start": 1721.4799999999998, "end": 1728.76, "text": " doesn't matter how I get without a pen and paper it doesn't matter how how" }, { "start": 1728.76, "end": 1733.92, "text": " much you learn or something like this there are some things that they just" }, { "start": 1733.92, "end": 1740.8799999999999, "text": " can't do but would want to do and I guess the evolutionary path simply didn't" }, { "start": 1740.8799999999999, "end": 1745.48, "text": " provide us for doing that kind of stuff we have a finite working memory and so" }, { "start": 1745.48, "end": 1752.16, "text": " on so I think the discussion here is still to be had if we really do have" }, { "start": 1752.16, "end": 1757.72, "text": " developer aware generalization if you consider our developer to be the" }, { "start": 1757.72, "end": 1766.6000000000001, "text": " evolutionary process but but we can forgive a little bit here so this is the" }, { "start": 1766.6000000000001, "end": 1771, "text": " general diagram that also emerges from kind of theories of intelligence from" }, { "start": 1771, "end": 1777.8, "text": " psychology where generally you have a general intelligence factor which is one" }, { "start": 1777.8, "end": 1783.34, "text": " factor this is quite remarkable in humans there is one general intelligence" }, { "start": 1783.34, "end": 1788.6799999999998, "text": " factor statistically all all these general intelligence tasks they broadly" }, { "start": 1788.6799999999998, "end": 1793.4399999999998, "text": " correlate and lead to one statistical factor it's not it's not obvious why" }, { "start": 1793.4399999999998, "end": 1799.9599999999998, "text": " that should be but turns out to be one factor and that distributes hierarchically" }, { "start": 1799.9599999999998, "end": 1805.52, "text": " into these things which are called broad abilities broad cognitive abilities and" }, { "start": 1805.52, "end": 1809.9599999999998, "text": " in shoeless framework that would correspond to broad generalization and" }, { "start": 1809.96, "end": 1814.32, "text": " then these are again hierarchically subdivided and sometimes as you can see" }, { "start": 1814.32, "end": 1821.56, "text": " your shared task specific skills okay and this in in shoeless framework would" }, { "start": 1821.56, "end": 1831.24, "text": " be local or no generalization so again he basically goes into psychometrics" }, { "start": 1831.24, "end": 1836.88, "text": " and specifically IQ tests for humans can they inform the measuring process the" }, { "start": 1836.88, "end": 1843.88, "text": " note and the thing to note here according to shalé is in an IQ test you" }, { "start": 1843.88, "end": 1848.72, "text": " want to measure these broad abilities you want to measure ultimately you want" }, { "start": 1848.72, "end": 1853.5200000000002, "text": " to measure G but if even if you measure different things in psychometrics you" }, { "start": 1853.5200000000002, "end": 1857.3200000000002, "text": " want to measure these broad abilities but these are like these are abstract" }, { "start": 1857.3200000000002, "end": 1862.72, "text": " concepts so what you're left with what you can only do is you can only measure" }, { "start": 1862.72, "end": 1871.8, "text": " really tasks okay and is this wrongly numbered or is this intentional I don't" }, { "start": 1871.8, "end": 1877.72, "text": " know you can only measure tasks but you somehow have to make an inference about" }, { "start": 1877.72, "end": 1882.88, "text": " the broad ability from measuring the tasks so that's the difficulty in" }, { "start": 1882.88, "end": 1888.04, "text": " psychometrics right you you you want to measure the abilities but you can only" }, { "start": 1888.04, "end": 1892.96, "text": " measure tasks the abilities are abstract concepts and the skill are the" }, { "start": 1892.96, "end": 1899.12, "text": " measurable things where you can put a number on it now you you can so what" }, { "start": 1899.12, "end": 1906.24, "text": " these IQ tests do they usually usually employ these broad battery of tests so" }, { "start": 1906.24, "end": 1911, "text": " you don't give the human just one tasks you give you give the human a lot of" }, { "start": 1911, "end": 1917.8, "text": " tasks you like okay complete this series which number comes next draw like rotate" }, { "start": 1917.8, "end": 1922.32, "text": " this in your head and so on but there there are so very human centric things" }, { "start": 1922.32, "end": 1928.3999999999999, "text": " like reading comprehension and so on but you do this broad battery of tests and" }, { "start": 1928.3999999999999, "end": 1934.9199999999998, "text": " you might think oh oh okay this is sort of like the Atari you know sweet where" }, { "start": 1934.9199999999998, "end": 1939.8, "text": " one reinforcement learning agent has to solve these whole bunch of Atari games" }, { "start": 1939.8, "end": 1946.72, "text": " or a super glue in NLP where one NLP system has to learn to do all these" }, { "start": 1946.72, "end": 1951.08, "text": " different NLP tasks you know there is entailment there is sentiment there is" }, { "start": 1951.08, "end": 1958.3600000000001, "text": " Boolean question answering and but this is according to chalet it's sort of not" }, { "start": 1958.3600000000001, "end": 1966.32, "text": " really it's not really the case that these are equivalent because it is a" }, { "start": 1966.32, "end": 1970.64, "text": " battery but it is known to the developer so the developer knows that the NLP" }, { "start": 1970.64, "end": 1976.16, "text": " system has to solve the super glue thing so the developer can first of all train" }, { "start": 1976.16, "end": 1981.48, "text": " the system until it reaches a good super glue score but then also it will have" }, { "start": 1981.48, "end": 1986.64, "text": " built in already the assumptions of the developer that you have to solve this so" }, { "start": 1986.64, "end": 1991.0400000000002, "text": " the second important thing about these battery of tests and IQ test is that" }, { "start": 1991.0400000000002, "end": 1996.52, "text": " they are unknown to the tested the tested cannot or ideally should not" }, { "start": 1996.52, "end": 2002.02, "text": " practice for them that's why people keep developing new and new IQ tests because" }, { "start": 2002.02, "end": 2005.3200000000002, "text": " we sort of know they all correlate first of all so they measure the same thing" }, { "start": 2005.32, "end": 2012.6799999999998, "text": " but also second because otherwise people if you just always do the same test" }, { "start": 2012.6799999999998, "end": 2018.32, "text": " people could practice it and then you would no longer measure the general" }, { "start": 2018.32, "end": 2022.6, "text": " ability you would only measure that one test by the way that's also why a lot of" }, { "start": 2022.6, "end": 2031.08, "text": " these you know brain brain exercise apps and so on they none of them really ups" }, { "start": 2031.08, "end": 2037.84, "text": " your intelligence you you you only get better at one app if you do that you" }, { "start": 2037.84, "end": 2049.48, "text": " don't you don't get smarter in general so if and and show they says there have" }, { "start": 2049.48, "end": 2055.2, "text": " been a number of attempts at making machines making AI solve human IQ tests" }, { "start": 2055.2, "end": 2060.52, "text": " right well the reasoning is the follows like oh okay humans develop IQ tests for" }, { "start": 2060.52, "end": 2068.68, "text": " humans and presumably those are no you're not known and so on but again the" }, { "start": 2068.68, "end": 2073.84, "text": " tasks broadly of IQ tests are known I guess really IQ tests work on humans" }, { "start": 2073.84, "end": 2079.24, "text": " because they only work on humans who don't really care like if someone really" }, { "start": 2079.24, "end": 2084.44, "text": " really really really cared they would you know research what kind of tests" }, { "start": 2084.44, "end": 2087.28, "text": " there are they would look at all the tests from history there's only so many" }, { "start": 2087.28, "end": 2090.96, "text": " tests you can come up with the new ones are going to be like variations on the" }, { "start": 2090.96, "end": 2095.36, "text": " old ones so you could technically if you really wanted you could like prepare" }, { "start": 2095.36, "end": 2100.76, "text": " super hard and that's exactly what developers are going to do they're" }, { "start": 2100.76, "end": 2103.76, "text": " basically going to look at all these tasks they're going to pre solve the" }, { "start": 2103.76, "end": 2107.6000000000004, "text": " problem and then they're going to program their you know pre-solved" }, { "start": 2107.6000000000004, "end": 2114.6800000000003, "text": " solution into an AI system so we can't just let AI systems solve human IQ tests" }, { "start": 2114.68, "end": 2121.04, "text": " what we need are tests that are reliable which means they're reproducible that" }, { "start": 2121.04, "end": 2125.72, "text": " are valid that means they really measure IQ or if they really measure" }, { "start": 2125.72, "end": 2130.8799999999997, "text": " artificial intelligence and not you know just task specific skill or something" }, { "start": 2130.8799999999997, "end": 2137.68, "text": " else they're standardized across the spectrum so they're standardized so" }, { "start": 2137.68, "end": 2141.9199999999996, "text": " everyone can do them in the same way by the way the current benchmarks are" }, { "start": 2141.92, "end": 2147.56, "text": " standardized that's the good part about them and they should be they should be" }, { "start": 2147.56, "end": 2153.08, "text": " free from bias which means they should not measure anything orthogonal to what" }, { "start": 2153.08, "end": 2157.96, "text": " they claim to measure and the example he gives is they should not measure" }, { "start": 2157.96, "end": 2162.4, "text": " reaction time which is also a big component in human IQ tests you also" }, { "start": 2162.4, "end": 2167.28, "text": " measure how fast the human is at the test and the machine obviously if you" }, { "start": 2167.28, "end": 2173.1600000000003, "text": " simply put more electrons through the cable it's going to run faster you or if" }, { "start": 2173.1600000000003, "end": 2181.76, "text": " you put more more GPUs there so in broad terms we what we should focus on is this" }, { "start": 2181.76, "end": 2189, "text": " new skill acquisition as I said from the beginning but it is not as easy as you" }, { "start": 2189, "end": 2194.52, "text": " might think right now and we're going to dive into the next episode and is going" }, { "start": 2194.52, "end": 2202.2, "text": " to be math heavy and that's going to be fun so I hope you enjoyed this kind of" }, { "start": 2202.2, "end": 2207, "text": " special episode maybe let me know if you like this style the paper doesn't have" }, { "start": 2207, "end": 2212.96, "text": " any pictures so you're just left with what I'm what I'm drawing yeah if you" }, { "start": 2212.96, "end": 2217.72, "text": " enjoyed this leave a like leave comments share it out and I'll see you next time" }, { "start": 2217.72, "end": 2224.72, "text": " bye bye" } ]
HYEzHX6-fIA
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Dynamics-Aware Unsupervised Discovery of Skills (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "deep rl", "control", "planning", "world model", "dads", "skills", "latent", "high level", "unsupervised", "tree search", "deep reinforcement learning", "mujoco", "ant", "google" ]
This RL framework can discover low-level skills all by itself without any reward. Even better, at test time it can compose its learned skills and reach a specified goal without any additional learning! Warning: Math-heavy! OUTLINE: 0:00 - Motivation 2:15 - High-Level Overview 3:20 - Model-Based vs Model-Free Reinforcement Learning 9:00 - Skills 12:10 - Mutual Information Objective 18:40 - Decomposition of the Objective 27:10 - Unsupervised Skill Discovery Algorithm 42:20 - Planning in Skill Space 48:10 - Conclusion Paper: https://arxiv.org/abs/1907.01657 Website: https://sites.google.com/view/dads-skill Code: https://github.com/google-research/dads Abstract: Conventionally, model-based reinforcement learning (MBRL) aims to learn a global model for the dynamics of the environment. A good model can potentially enable planning algorithms to generate a large variety of behaviors and solve diverse tasks. However, learning an accurate model for complex dynamical systems is difficult, and even then, the model might not generalize well outside the distribution of states on which it was trained. In this work, we combine model-based learning with model-free learning of primitives that make model-based planning easy. To that end, we aim to answer the question: how can we discover skills whose outcomes are easy to predict? We propose an unsupervised learning algorithm, Dynamics-Aware Discovery of Skills (DADS), which simultaneously discovers predictable behaviors and learns their dynamics. Our method can leverage continuous skill spaces, theoretically, allowing us to learn infinitely many behaviors even for high-dimensional state-spaces. We demonstrate that zero-shot planning in the learned latent space significantly outperforms standard MBRL and model-free goal-conditioned RL, can handle sparse-reward tasks, and substantially improves over prior hierarchical RL methods for unsupervised skill discovery. Authors: Archit Sharma, Shixiang Gu, Sergey Levine, Vikash Kumar, Karol Hausman Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Take a look at this humanoid right here. It walks from one checkpoint to another checkpoint and then to the next checkpoint and so on. And that is its task. It gets reward from walking from checkpoint to checkpoint. Take a look at this ant. This is called the ant. It also walks from checkpoint to checkpoint. Now we've seen a lot of reinforcement learning algorithms in this environment. It's called Mukojo, 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 ant has never ever seen what a checkpoint is and has never gotten any reward from walking from checkpoint to another checkpoint. Actually, it has never gotten any reward for anything that is given from the environment. It has discovered the skill of walking by itself. And then at test time, there is no additional learning when it goes from checkpoint to checkpoint. It simply composes the skills that it knows from its unsupervised discovery phase in order to go from checkpoint to checkpoint. So here you can see this paper basically proposes to learn these skills in a completely unsupervised way at the beginning, sort of, so in the training phase, it learns these skills, you can see these skills that the humanoid has learned. And then all you have to do at test time is to compose these skills to reach a given goal. And these are the things that the ant 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 ant 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 to has learned to walk back, forward, going to 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, right. So we have we dive into model based and model free reinforcement learning. Model based reinforcement learning basically means that you have a model of the environment. A example for this is, let's say, tic tac toe. So in tic tac toe, I know, like 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 can now 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 or and then only do the given action that has led to the best result at the end, right. So this is model model based reinforcement learning means you have a model of the environment, you know, what's going to happen when you perform given actions. And you can also combine this with machine learning, like, you know, alpha, alpha go alpha zero, or so they have models of the games they're playing, they know what's going to happen. But it's very intractable to basically go down this entire tree and plan out everything. So they combine it with machine learning. It doesn't change that it's model based. Now in, in opposition to that in model three, in 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 it you have basically no clue how the environment will change. If you do something, all these and all these, these agents do or the classic model free agents do is basically they're trying to have a neural network somewhere in them. And you put the observation in here and outcomes in action. And you can do this in various ways into Q learning or policy gradient or actor critic and so on. But ultimately, it's simply mapping the 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 RL techniques tend to work better, I could hear inside the agent, I could try to learn a model of the environment, E prime, and I could try to basically learn what happens in my environment when I do a certain action. And then I could use that model right here, in order to do this planning that I know from up here. Okay, so in this case, they go for exactly this they go for, let's learn a model of the environment, this is not an exact model, it's a learned model. And then let's use that to plan. Now this usually has a bunch of, you know, very a bunch of things that go against it, namely, if this model right here is bad, then the planning in the model will often accumulate and even exaggerate the errors that are in this model. So it's sometimes very hard to learn a model of the world and then use that for planning. And I've recently done a paper where, where curious AI takes the noise in auto encoders to regularize exactly such a planning procedure to counter this. And this paper right here is a different approach of combining this learned model. This learned model. So, okay. That was about the first sentence. They say it aims to learn a global model for the dynamics of the environment. A good model can potentially enable planning algorithms to generate a large variety of behaviors and solve diverse tasks, which is true, right? If I have a model of the environment, then I could just use it to plan. I wouldn't even have to do anything fancy anymore, right? If I have a model of how my tic tac toe works, I can just plan, plan my way to success. And I can do this all for zero style. Or if the if this state tree is small enough, I can actually just use a planner. And I don't even have to, I don't have to do anything anymore. If I have a good model. They say however, learning an accurate model for complex dynamical systems is difficult. And even then the model might not generalize well outside the distribution of states on which it was trained. So this is another problem. If you learn a model, it's only going to be valid in a certain range. Okay. And say in this work, we combine model based learning with model free learning of the model free learning is of primitives that make model based planning easy. So what they attempt to do is they attempt in an unsupervised fashion to learn so called set of skills. And the set of skills could be something like walk forward, walk backward, stay put, jump. So they attempt to learn things like this in a model free way, that the model is simply asked to come up with these things or the agent is simply asked to come up with these things. And then in in stage two, a planner can use these skills and decompose a plan. Now this plan here, the special thing about this plan, this planner, it doesn't operate in the space of actions of like small scale actions, it actually operates in the space of these skills right here. So here would be walk forward, walk back. So and with if we have a good enough model of the environment, 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 the crucial part and the the sort of contribution of this paper, they say, how can we discover skills whose outcomes are easy to predict? And this is how they counteract this notion here, that if your environment model is crap, then you're you're, it can't basically can't be used for planning, you'll just make it worse. So what they say is that these things right here, these skills that we learn, we will learn them in a way that make them easy to predict. So it makes it easy to predict what will happen after I do them. So they must be at the same time diverse. So only you know, if you stay put, it's pretty easy to predict what's going to happen like nothing. Okay. But we're going to see in the exact objective that they have to be sort of diverse. But also, so only one of them can be stay put, the other ones have to do something else. But also, they should be easily predictable by the environment model. And if you learn the skills such that they're easily predictable, your environment model will make less errors, and then you can use it for planning. Okay, let's dive in. They do actually open source code, and they have more of these videos, if you want to check it out, I'll link everything in the description. Okay, let's actually dive into the meat right here. They say they do maximize the mutual information. And we're going to see between between what and what they want to maximize the mutual information. If you don't know what the mutual information is, the mutual information is a quantity. The mutual information between x and y is a quantity, that's the entropy of x minus the entropy of x conditioned on y, or you can also decompose it in the other way around entropy of y minus entropy of y conditioned on x. And we're going to they apply this, where is it equation two right here. Okay, so what they want is the following, they want to maximize the mutual information. And the mutual information basically means how much does one variable tell me about the other variable, okay? The mutual information between the skill, and we're going to see what that is, and the next state. So what is a skill? A skill is one entry in our table right here. So these here are skills, skills. And they're in their index by z. Now z here, it seems like they're discrete, right? But in this case, they would be z would be a continuous vector. But it's easier if you imagine that so each one of this is like z one, z two, and so on. They're going to be continuous, but in our case, we'll just think of a discrete set of skills to be learned. Okay, so they say we want to maximize the mutual information between the skill that's currently in action. So in every, every time the agent has to like choose a skill and saying like, okay, now I'm going to walk forward. And it's in a given state. And what you want to say is you have to maximize the mutual information between the skill and the next state, which means that it means two things, which you can see right here, you can decompose it in two different ways. One way is the following is to say, if I know which state I'm in, what's the entropy over my? Okay, that's the 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 write, I can in hindsight, I look back, if I know both things, what can I say about this skill z right here, that I couldn't say just from the starting state. So the starting state, let's say is the person right here, and the end state is the person a little bit more over there. So that's, that's called this forward, it's the person is looking to the right. Okay. Now, if I only show you if I only show you the state on the left, the starting state, what can you tell me which action is going to follow right here? Basically, you can 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, 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 about the next state than 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 like what I, I couldn't tell you very much, right? It can be anything. But if I then tell you the action is walk forward, then you could say, ah, now I now I get it, it's probably going to be something like this. Okay. This also would be a high mutual information. So you see that the the task of maximizing this mutual information is good, because what happens if I don't, if I have a low mutual information, if I have a low mutual information, it would mean that I could predict the next state just as well from the current state. It doesn't make a difference whether you give me the skill or not, it would not make a difference. And that is only the case if my skills are basically either all the same or all pretty, pretty random and pretty useless. Right? So if if all my skills are basically walking backwards, then I don't, you don't have to tell me which skill you do, I'm 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. Okay. And to see this, yeah, we only have to imagine what would happen, what would happen in a in a situation where the skills weren't diverse or weren't easy to predict. And you'll get exactly the situation where the information of the skill doesn't help you in predicting the next state, because yeah, either it's obvious or it's random. Okay, so we agree that it makes sense to maximize the mutual information. And they decompose this into two objectives. So they say the mutual information will stay is basically what you'll have to do is you'll have to it decomposes into two terms where you can into two terms in a lower bound in the mutual information. And this is kind of the this is sort of the standard variational approximation literature. If you're into that read up on variational auto encoders and things like this. Basically, the two steps here are you tighten the variational lower bound and you maximize the approximate lower bound. Okay, so you have the mutual information, and you can lower bound it. Okay, you can you can lower bound it by this quantity. Now the if since this is a lower bound, you can prove that this is a lower bound, it means that the higher you make this term, then the the more basically, okay, if it's a lower, I don't know how to formulate, but it should be fairly obvious if this if this thing on the right is a lower bound to the mutual information, then maximizing the thing on the right will maximize the thing on the left. And it will do so very so imagine I is up here. And this E on the right side is down here, it's a lower bound, right? It's lower than I. So if I maximize E, well, I haven't really done anything to I but if I maximize it even more up to here, and since it's a lower bound, I know now my I must be at least higher than this. Okay, so maximizing a lower bound to a quantity will ultimately increase the quantity. But you can also the efficiency by which it does this depends on how tight the bound is. So if the bound is very tight, like this, you see I is not much above E. If the bound is very tight, then maximizing E will result in a faster maximization of I. Okay, so you can do two things, you can maximize the quantity that is the lower bound, or you can tighten the bound. And here we can see that the difference that the tightness of the bound depends on this quantity right here, which is the KL difference between this and this. So yeah, let's watch this in the context of we can actually go go through it on the high level. If you've never done this variational approximation sort of math, then this might be a bit informative. Okay, so the thing right here is just pops out of the definition of the mutual information. It's the it's basically the differences of the entropy's, which the entropy's are log quantities, right? So if you have a log A minus log B, that you can also write this as the log of the fraction of A over B, that's just a property of the log. And so it's expectations over logs, these entropy's. 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 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. P here is the true environment, which we don't know, right? We don't know what the environment's going to do. But we would like to learn a model for the environment. And this model for the environment is now Q, Q, theta, phi, theta, phi, Greek letter. So Q phi here is going to be a neural network that will approximate the environment. And in this probabilistic framework, it is going to be a learned distribution that will approximate the distribution of P. So we approximate it by this. But now this is here it says equal equal, right? This is not equal, because this is just an approximation. So the equality must become must be basically compensated for by this term right here, you can see this here is expanded into these two, you can go through the exact definitions and see why this is an equality. But basically, you can say that the mutual information is this expectation, or it is this expectation. But now you have to correct for the fact that here you only have an approximation. And you have to correct for the fact by exactly the amount by which the approximation is different than the quantity that you're approximating. And this is this key KL divergence right here. So the KL divergence basically measures how different two distributions are. It's sort of a distance, not exactly distance, but sort of a distance between these two distributions right here, it says, here's the real world. And here is your estimate of the real world, how much do they disagree, and that quantity plus, then you can replace your world, the exact world distribution by your approximate distribution. And you still are equal to the mutual information. And now the basically the trick is you say, oh, the KL divergence is always positive, it's a quantity that it can only be a positive number. So if I leave it away, certainly, this is only this is going to be a lower bound to the quantity. Okay. All right. So two tasks right here. First of all, tighten the variational bound, which means make this quantity small, make your approximate world model as close as possible to the real world. How do we do this neural network? Okay, you input trajectories. I was in this state, I performed this skill, and I ended up in this state. Sorry, that's this and then you simply match your neural network simply matches what happens in the real world, it learns the transition function, basically. So that's, that's the tightening of the variational bound. And the second step is this right here to to maximize the approximate lower bound, right? The first step was Titan variation lower bound, that basically means make your world model more accurate. And the second is Titan 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 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 forward, it simply says, okay, you have like, in a discrete case, you would have like, you have five skill slots, right? And the only thing I require is that they're sort of, you know, consistent over time. So skill one is always going to be sort of the same thing and skill two, but agent, you can basically decide what skill one is, right? But make the skill 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 that somehow has to come up with saying, ah, skill zero, that's walking forward. And in this situation, walking forward means I have to lift my leg or something like this. So you're going to take your skill, you're going to with your agent perform an action based on that skill and the current state of the world. Then the environment is going to give you the next state right here. And from those things, you can now learn your world model. You know, I was in state S, I performed action a but I performed action a based on skills Z. And then I ended up in state S prime. And I can learn a model of the world, right? This is a triple, I can do supervised learning of a world model. Now here, they do probabilistic learning, but and we're going to see in a second how that works. But ultimately, they approximate the world with their model. Cool. So that's the this outer loop. And then what are they going to do next, they're going to use that world model to determine a reward for the agent, and the reward for the agent for taking the action. So the reward is going to be, oh, agent, you took action a. Now, what's your reward for doing this? This is the model free reinforcement learning part, your reward is going to be very high, if if this was very predictable. And if it is also diverse, right, so now, the agent has to sort of 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. But ultimately, two steps, learn world model from the experience that you've generated. And second thing, learn the agent such that it maximizes this this quantity that we've seen before. And you do this via giving the agent a reward that is proportional to the mutual information. And we've already seen that we can approximate the mutual information by by this quantity here. Okay. So learn world model, and make the agent go higher mutual information, two steps. Okay, learn world model is very, very classic, you can say, okay, I need to improve, I need to minimize this KL divergence. So I need the gradient with respect to the parameters of my world model, I can write down the KL divergence like this. And then since I can do this reverse, so log a over b is log a minus log b. And since the world doesn't depend on the parameters of my model, this will simply give me this thing right here, which is the gradient of the log probability basically, of my neural network. And this can be just optimized straightforward, this is a neural network, optimize it with gradient descent. These are the inputs, this is the output. Now, okay, you, this is all probability distributions, but ultimately, you can you can do it pretty straightforward. Okay, so corresponds to maximizing the likelihood of the samples from P under Q. Now, the second step maximize the approximate lower bound. Okay. So after they say after fitting Q, after improving our world model, we can optimize pi pi is the agent that actually takes the actions based on the skill. So it's given a skill, and it needs to perform an action. And it needs to maximize this quantity, as we've seen, needs to maximize the mutual information between if I know the action and if I don't, or the mutual information between the skill and the next state. I say note, this is a reinforcement learning style optimization, with a reward function of this quantity. However, so you look at the quantity that they need right here, the quantity is going to be this thing. And this thing is just, I feed the skill and the state into my world model. And I look what what comes out of the world model. So this I can compute, right? But this thing right here, I can't compute because this is this is what happens in the world when I'm in state s, and I just run my agent over in expectation over all the skills. So this I don't know, they have a log of this is intractable. And then so we approximate the reward function for pi as this thing right here. Now, first, let's look at what this thing is. So the reward of taking action a, and action a is based on skill z, right? So skill z was fed into the agent, the agent comes up with action a, oh, you want me to walk forward in this situation, okay, I'm gonna lift my leg. That's the action. Okay. So the reward for this action, given this skill, and given the current state is going to be what it's going to be very high, if this here is very high. So it's going to be very high if the probability so this s prime is the state you ended up in, right? So after taking the action, you ended up in s prime. So if what does it mean when this quantity is very high? It means that my world model q, that is approximating the world, thinks that this state is very probable if you were in this state and are given the skill z. So this basically means that the neural network can predict with very high accuracy, what's going to happen if you are in this state and are given this skill to perform, right? This is one of the things that we want. Now, what is it divided by? It's divided by this. And you can see here, the 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 with? So what does it mean if this quantity is high, or sorry, if the entire sum here is high? That means that the skill doesn't really give you much information, the neural network is very good, no matter which skill you selected, right? It's very accurate in predicting the next state doesn't really matter. The skill doesn't really matter. And this is what we don't want, right? We want that the 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, 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 they this denominator is a proc is an approximation to this. It's an approximation. As you can see here, this is sort of sort of a sample based approximation to the transition from s to s prime under the distribution of z. But what you want is just is the transition from s to s prime, not in your approximation, but in the real world. And they formulate this, they say, okay, we can decompose it as such as a as an integral over this conditional right here. So they bring in the z variable. And then they say, well, this, this is approximately approximately we can replace this here by this. And we can replace this here by this. They say, well, since the this is a an approximation, the two, this is the world model is an approximation to the real world, we can sort of replace that. And then this is the this is the part that doesn't convince me they say, well, this P z of s, we can just replace it by P z. Now this is it's very tricky to see what these quantities are. Ultimately, it ends up being that right here. But it's it's it's so tricky. So they say we replace P z given s by P of z. And, okay, let's think about this for a second. What does the top the bottom quantity is simply the distribution over your skills. And depending on 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 right times P of z divided by P of s. So this quantity depends on multiple things. Here's that prior again. And this means what's the general distribution of states? What's the general distribution of states? If your agent acts in the world, right, this? And this, we don't know, we don't we don't know. And also this right here, what's the distribution in the true world? What's the probability of a state given a given given that you were acting under a skill z? And this is also something we don't know, because we don't know the world, we 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, it basically means what skills, if you're if you're in a certain state, what skills brought you here, basically, what 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. Like, as I said, the entire paper makes sense. But I just feel it's trying to be overly mathematical, and then run into a point where you can't be and then they're just like, okay, we'll, we'll just replace it. And then sort of things break down, like, you can only be overly mathematical to some degree, it doesn't really fit. But okay, so this is how you discover the skills, you maximize these quantities, alternately, you learn the world model, and you improve your your skills by making them diverse and easily predictable. So how do you then plan using these skills? This is the second part of the paper, and this is just as complicated as the first part. So they say given the learned skills, so the learned skills are policies over action given the DZ, right? So now you know how to like walk forward and walk back and so on. And now you're, you're placed in a world, and you're given this checkpoint, it says, well, walk there. And you want this to do this using planning, you don't want to learn anymore, you simply want to plan. Okay, what do you do? And as I said, this is even more so what you want to do is you want to do something like model predictive control, but not over actions, but over your learned skills. So you have this planner in the NPC, and the planner will in its head roll out a number of different, a number of different plans, it will kind of explore a bunch of different, different plans Z, it will roll them out, I'll say, okay, if I do this, and this, and this, and this, what will happen using its world model that it has learned, it will observe what's going to be the reward in each of these cases. Now, they say here, access the environment reward, but can also be estimated. And this is another sort of, I feel weak point of this in that they now assume they have the true reward function. But they don't have a world model, right? They don't have the world model, but they assume that they can sort of always ask for the true reward, which is probably not the case if you had a true world, but it could be the case, the reward could be something like, well, if you're over there, you get higher reward, but you don't exactly know how to get over there. In any case, so they roll out a bunch of trajectories in their head, they kind of plan forward, see what's going to happen if they do this or that, or this or that. And then they choose the best one of these forward thoughts, and they execute it in the real world, right? So they say, well, I'm going to use 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, if you first walk forward, and then walk back, where are you going to be, and so on. So the planner will always plan, basically to go from where you are to the checkpoint using a composition of the skills that you have learned. So the planner may be fine. Okay, if I first walk forward, walk back a bit, and so on, I'm going to get to the goal, I'm going to reach the goal. Now please agent execute this first thing, walk forward, the agent executes it, and maybe it won't, you know, it won't do as well, it will maybe end up here. And then it says, well, I'm here now, please plan again. So it plans again, it says, okay, I can still kind of walk back, I'll be here, here, but then I have to do something else. So now walk back. And okay, so this is what's going to happen. But it is going to happen in a weird way. Namely, what we keep are normal, since everything is continuous, we'll keep normal distributions of all our future steps. So we don't say, okay, I go here, and then I go here. What you'll say is I approximately go here. And after that, I'll approximately go here. And you will do it in such a way that the peak of this normal distribution is going to be the highest, where you think you will get the most reward. If you follow this trajectory, like if you follow this trajectory, you get a very high reward. And if I follow a trajectory that maybe goes here, I won't get a high reward. If it actually turns out in your imagination that you do get a high reward for this trajectory, you'll change this distribution, such that the peak is here. And of course, the tighter the peak is, the more sure you are. So you sort of are looking, if you look out into the world, you want the closest steps to be very peaky. And then as you look out, they can be more 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, go here, then you imagine forward again, you refine these distributions over the future. And then you take the next step that gets you to the where the highest peak is right here, basically. And so on. This is simply planning in a continuous domain, it is pretty analogous to how you would plan in like, alpha go, if you or tic tac toe, if you had a planner. But since everything's continuous, it makes it just so much harder. So they yeah, they always update these distributions, as you can see here, to the skill that gave you a high reward in your imagination, compared to the rewards of the other plans that you had. Okay, well, this was a long, long way until we got here. But if you recap, so first, they in an unsupervised fashion, learn these low level skills, such that they're easily predictable by their own world model, and diverse. And then in the second step, they can use that to, to do basically planning. So they first learn these skills, and then the planner composes them to make the agent do something. And again, the agent will never have to learn how to do this go from checkpoint to checkpoint, because the planner can just compose these low level skills. So they have these experiments right here. And we won't go through the experiment because this video is already very, very long. But they basically show that they 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 you to check out the paper if you're still here. Thanks for being here, I hope this this work was one of the most more complicated and mathy papers we looked at. But I think I still think it's fun. And I still think the outcome is pretty impressive right here, how you can use math to derive basically these intuitive, very intuitive objectives to learn. It's also pretty cool. Alright, that was it for me. And bye bye.
[ { "start": 0, "end": 8.44, "text": " Hi there! Take a look at this humanoid right here. It walks from one checkpoint to another" }, { "start": 8.44, "end": 13.76, "text": " checkpoint and then to the next checkpoint and so on. And that is its task. It gets reward" }, { "start": 13.76, "end": 20, "text": " from walking from checkpoint to checkpoint. Take a look at this ant. This is called the" }, { "start": 20, "end": 26.42, "text": " ant. It also walks from checkpoint to checkpoint. Now we've seen a lot of reinforcement learning" }, { "start": 26.42, "end": 33.160000000000004, "text": " algorithms in this environment. It's called Mukojo, where you basically teach these little" }, { "start": 33.160000000000004, "end": 39.480000000000004, "text": " things to walk around. So what's the impressive part here? The impressive part is that at" }, { "start": 39.480000000000004, "end": 47.2, "text": " training time, this ant has never ever seen what a checkpoint is and has never gotten" }, { "start": 47.2, "end": 52.32000000000001, "text": " any reward from walking from checkpoint to another checkpoint. Actually, it has never" }, { "start": 52.32, "end": 58.52, "text": " gotten any reward for anything that is given from the environment. It has discovered the" }, { "start": 58.52, "end": 65.96000000000001, "text": " skill of walking by itself. And then at test time, there is no additional learning when" }, { "start": 65.96000000000001, "end": 71.32, "text": " it goes from checkpoint to checkpoint. It simply composes the skills that it knows from" }, { "start": 71.32, "end": 80.2, "text": " its unsupervised discovery phase in order to go from checkpoint to checkpoint. So here" }, { "start": 80.2, "end": 86.44, "text": " you can see this paper basically proposes to learn these skills in a completely unsupervised" }, { "start": 86.44, "end": 92.28, "text": " way at the beginning, sort of, so in the training phase, it learns these skills, you can see" }, { "start": 92.28, "end": 97.64, "text": " these skills that the humanoid has learned. And then all you have to do at test time is" }, { "start": 97.64, "end": 103.46000000000001, "text": " to compose these skills to reach a given goal. And these are the things that the ant has" }, { "start": 103.46000000000001, "end": 109.2, "text": " learned. Watch out, this is trippy. You can see it has learned various walks, various" }, { "start": 109.2, "end": 114.28, "text": " ways of walking here. And if you know anything about this environment, it's actually not" }, { "start": 114.28, "end": 122.82000000000001, "text": " that easy to make the ant walk by itself. So the discovery here that these skills that" }, { "start": 122.82000000000001, "end": 128.68, "text": " are discovered are various ways of walking is actually already pretty impressive. And" }, { "start": 128.68, "end": 134, "text": " the last thing here, this cheetah, of course, also has to has learned to walk back, forward," }, { "start": 134, "end": 139.48, "text": " going to jump around, and so on. So we're going to dive into this paper. It's called" }, { "start": 139.48, "end": 145.76, "text": " Dynamics Aware, Unsupervised Discovery of Skills by Archie Sharma and other people of" }, { "start": 145.76, "end": 152.52, "text": " Google Brain. So this was published at iClear 2020. And on a high level, I already said" }, { "start": 152.52, "end": 159.96, "text": " it's basically proposing to learn unsupervised skills, and then to compose these skills in" }, { "start": 159.96, "end": 167.52, "text": " a model based planning method at test time to reach a given goal without additional training," }, { "start": 167.52, "end": 174.64000000000001, "text": " without additional training on the reward that you give at test time. As always, if" }, { "start": 174.64000000000001, "end": 180.8, "text": " you like videos like this, you're very welcome to subscribe and share it to everyone you" }, { "start": 180.8, "end": 189.88, "text": " know. Yeah, okay, that's live in. So they say, conventionally, model based reinforcement" }, { "start": 189.88, "end": 196.32, "text": " learning aims to learn a global model for the dynamics of the environment, which is" }, { "start": 196.32, "end": 202.12, "text": " not exactly true, right. So we have we dive into model based and model free reinforcement" }, { "start": 202.12, "end": 208.96, "text": " learning. Model based reinforcement learning basically means that you have a model of the" }, { "start": 208.96, "end": 217.4, "text": " environment. A example for this is, let's say, tic tac toe. So in tic tac toe, I know," }, { "start": 217.4, "end": 222.96, "text": " like I have nine actions at my disposal. And if I take action, let's say I take action" }, { "start": 222.96, "end": 230.84, "text": " zero, which is to make a let's say I'm the X player, so I take action zero. And if I" }, { "start": 230.84, "end": 236.28, "text": " you know, number my things correctly, then that will result in this state of the world." }, { "start": 236.28, "end": 242.04000000000002, "text": " Okay, so I know exactly how the world will look when I take a given action. And what" }, { "start": 242.04000000000002, "end": 246.88, "text": " that allows me to do is that allows me to actually plan. So I can now plan ahead, I" }, { "start": 246.88, "end": 252.79999999999998, "text": " can say what would happen if I took action zero, so I can do this in my mind. And then" }, { "start": 252.79999999999998, "end": 258.08, "text": " what would happen if I took action one, I can be like, okay, that's going to happen." }, { "start": 258.08, "end": 262.96, "text": " And I can do this with many things. And I can, in my mind, continue this and basically" }, { "start": 262.96, "end": 271.2, "text": " roll out the entire games or and then only do the given action that has led to the best" }, { "start": 271.2, "end": 275.36, "text": " result at the end, right. So this is model model based reinforcement learning means you" }, { "start": 275.36, "end": 280.7, "text": " have a model of the environment, you know, what's going to happen when you perform given" }, { "start": 280.7, "end": 287.76, "text": " actions. And you can also combine this with machine learning, like, you know, alpha, alpha" }, { "start": 287.76, "end": 292.96000000000004, "text": " go alpha zero, or so they have models of the games they're playing, they know what's going" }, { "start": 292.96000000000004, "end": 299.68, "text": " to happen. But it's very intractable to basically go down this entire tree and plan out everything." }, { "start": 299.68, "end": 306.84000000000003, "text": " So they combine it with machine learning. It doesn't change that it's model based. Now" }, { "start": 306.84000000000003, "end": 312.8, "text": " in, in opposition to that in model three, in in reinforcement learning, what you do," }, { "start": 312.8, "end": 317.84000000000003, "text": " you are this agent, there's the environment, and you simply have to do an action, I do" }, { "start": 317.84000000000003, "end": 323.52, "text": " action zero, and the environment just gives you back a reward and the next observation." }, { "start": 323.52, "end": 331.44, "text": " And it you have basically no clue how the environment will change. If you do something," }, { "start": 331.44, "end": 337.59999999999997, "text": " all these and all these, these agents do or the classic model free agents do is basically" }, { "start": 337.59999999999997, "end": 345.79999999999995, "text": " they're trying to have a neural network somewhere in them. And you put the observation in here" }, { "start": 345.79999999999995, "end": 350.47999999999996, "text": " and outcomes in action. And you can do this in various ways into Q learning or policy" }, { "start": 350.48, "end": 357.28000000000003, "text": " gradient or actor critic and so on. But ultimately, it's simply mapping the up the current observation" }, { "start": 357.28000000000003, "end": 363.84000000000003, "text": " and maybe the last few to the best action to take without explicitly modeling what happens" }, { "start": 363.84000000000003, "end": 369.68, "text": " in the environment. Now when they say model based reinforcement learning, what they mean" }, { "start": 369.68, "end": 377.08000000000004, "text": " is technically what you can do if you're in if you are in the model free, if you're in" }, { "start": 377.08, "end": 383.8, "text": " this situation, what you could do is you could say, well, since these model based RL techniques" }, { "start": 383.8, "end": 390.24, "text": " tend to work better, I could hear inside the agent, I could try to learn a model of the" }, { "start": 390.24, "end": 397.28, "text": " environment, E prime, and I could try to basically learn what happens in my environment when" }, { "start": 397.28, "end": 403.47999999999996, "text": " I do a certain action. And then I could use that model right here, in order to do this" }, { "start": 403.48, "end": 412.04, "text": " planning that I know from up here. Okay, so in this case, they go for exactly this they" }, { "start": 412.04, "end": 417.16, "text": " go for, let's learn a model of the environment, this is not an exact model, it's a learned" }, { "start": 417.16, "end": 425, "text": " model. And then let's use that to plan. Now this usually has a bunch of, you know, very" }, { "start": 425, "end": 432.04, "text": " a bunch of things that go against it, namely, if this model right here is bad, then the" }, { "start": 432.04, "end": 439.36, "text": " planning in the model will often accumulate and even exaggerate the errors that are in" }, { "start": 439.36, "end": 444.28000000000003, "text": " this model. So it's sometimes very hard to learn a model of the world and then use that" }, { "start": 444.28000000000003, "end": 453.44, "text": " for planning. And I've recently done a paper where, where curious AI takes the noise in" }, { "start": 453.44, "end": 459.52000000000004, "text": " auto encoders to regularize exactly such a planning procedure to counter this. And this" }, { "start": 459.52, "end": 467.64, "text": " paper right here is a different approach of combining this learned model. This learned" }, { "start": 467.64, "end": 477, "text": " model. So, okay. That was about the first sentence. They say it aims to learn a global" }, { "start": 477, "end": 482.28, "text": " model for the dynamics of the environment. A good model can potentially enable planning" }, { "start": 482.28, "end": 487.52, "text": " algorithms to generate a large variety of behaviors and solve diverse tasks, which is" }, { "start": 487.52, "end": 492.96, "text": " true, right? If I have a model of the environment, then I could just use it to plan. I wouldn't" }, { "start": 492.96, "end": 498.79999999999995, "text": " even have to do anything fancy anymore, right? If I have a model of how my tic tac toe works," }, { "start": 498.79999999999995, "end": 504.96, "text": " I can just plan, plan my way to success. And I can do this all for zero style. Or if the" }, { "start": 504.96, "end": 510.2, "text": " if this state tree is small enough, I can actually just use a planner. And I don't even" }, { "start": 510.2, "end": 516.12, "text": " have to, I don't have to do anything anymore. If I have a good model. They say however," }, { "start": 516.12, "end": 520.88, "text": " learning an accurate model for complex dynamical systems is difficult. And even then the model" }, { "start": 520.88, "end": 525.92, "text": " might not generalize well outside the distribution of states on which it was trained. So this" }, { "start": 525.92, "end": 531.2, "text": " is another problem. If you learn a model, it's only going to be valid in a certain range." }, { "start": 531.2, "end": 540.96, "text": " Okay. And say in this work, we combine model based learning with model free learning of" }, { "start": 540.96, "end": 547.96, "text": " the model free learning is of primitives that make model based planning easy. So what they" }, { "start": 547.96, "end": 556, "text": " attempt to do is they attempt in an unsupervised fashion to learn so called set of skills." }, { "start": 556, "end": 570.88, "text": " And the set of skills could be something like walk forward, walk backward, stay put, jump." }, { "start": 570.88, "end": 578.68, "text": " So they attempt to learn things like this in a model free way, that the model is simply" }, { "start": 578.68, "end": 583.48, "text": " asked to come up with these things or the agent is simply asked to come up with these" }, { "start": 583.48, "end": 592.04, "text": " things. And then in in stage two, a planner can use these skills and decompose a plan." }, { "start": 592.04, "end": 597.48, "text": " Now this plan here, the special thing about this plan, this planner, it doesn't operate" }, { "start": 597.48, "end": 603.64, "text": " in the space of actions of like small scale actions, it actually operates in the space" }, { "start": 603.64, "end": 609.88, "text": " of these skills right here. So here would be walk forward, walk back. So and with if" }, { "start": 609.88, "end": 615.24, "text": " we have a good enough model of the environment, it will tell us if I walk forward in this" }, { "start": 615.24, "end": 620.44, "text": " situation, what will happen? Okay, so I can walk forward. And then after that, I could" }, { "start": 620.44, "end": 627.2, "text": " walk backward, what's going to happen? And if I have a good model of the environment" }, { "start": 627.2, "end": 633.6400000000001, "text": " over the and the actions now are these macro actions of these skills, then I can use planning" }, { "start": 633.6400000000001, "end": 641.24, "text": " to reach my goal. Okay, so the question is, how do we come up with useful skills that" }, { "start": 641.24, "end": 646.6800000000001, "text": " the planner can then use? So they need to be somewhat diverse, right? But also, and" }, { "start": 646.6800000000001, "end": 655.6, "text": " here is the the crucial part and the the sort of contribution of this paper, they say, how" }, { "start": 655.6, "end": 662.64, "text": " can we discover skills whose outcomes are easy to predict? And this is how they counteract" }, { "start": 662.64, "end": 668.72, "text": " this notion here, that if your environment model is crap, then you're you're, it can't" }, { "start": 668.72, "end": 673.16, "text": " basically can't be used for planning, you'll just make it worse. So what they say is that" }, { "start": 673.16, "end": 680.32, "text": " these things right here, these skills that we learn, we will learn them in a way that" }, { "start": 680.32, "end": 686.6800000000001, "text": " make them easy to predict. So it makes it easy to predict what will happen after I do" }, { "start": 686.6800000000001, "end": 691.5600000000001, "text": " them. So they must be at the same time diverse. So only you know, if you stay put, it's pretty" }, { "start": 691.5600000000001, "end": 696.44, "text": " easy to predict what's going to happen like nothing. Okay. But we're going to see in the" }, { "start": 696.44, "end": 703.36, "text": " exact objective that they have to be sort of diverse. But also, so only one of them" }, { "start": 703.36, "end": 708.48, "text": " can be stay put, the other ones have to do something else. But also, they should be easily" }, { "start": 708.48, "end": 715.4, "text": " predictable by the environment model. And if you learn the skills such that they're" }, { "start": 715.4, "end": 720.52, "text": " easily predictable, your environment model will make less errors, and then you can use" }, { "start": 720.52, "end": 729.82, "text": " it for planning. Okay, let's dive in. They do actually open source code, and they have" }, { "start": 729.82, "end": 735, "text": " more of these videos, if you want to check it out, I'll link everything in the description." }, { "start": 735, "end": 748, "text": " Okay, let's actually dive into the meat right here. They say they do maximize the mutual" }, { "start": 748, "end": 755.64, "text": " information. And we're going to see between between what and what they want to maximize" }, { "start": 755.64, "end": 758.84, "text": " the mutual information. If you don't know what the mutual information is, the mutual" }, { "start": 758.84, "end": 764.82, "text": " information is a quantity. The mutual information between x and y is a quantity, that's the" }, { "start": 764.82, "end": 769.44, "text": " entropy of x minus the entropy of x conditioned on y, or you can also decompose it in the" }, { "start": 769.44, "end": 779.12, "text": " other way around entropy of y minus entropy of y conditioned on x. And we're going to" }, { "start": 779.12, "end": 788.12, "text": " they apply this, where is it equation two right here. Okay, so what they want is the" }, { "start": 788.12, "end": 793.32, "text": " following, they want to maximize the mutual information. And the mutual information basically" }, { "start": 793.32, "end": 802.5600000000001, "text": " means how much does one variable tell me about the other variable, okay? The mutual information" }, { "start": 802.5600000000001, "end": 812.7600000000001, "text": " between the skill, and we're going to see what that is, and the next state. So what" }, { "start": 812.7600000000001, "end": 822.8800000000001, "text": " is a skill? A skill is one entry in our table right here. So these here are skills, skills." }, { "start": 822.88, "end": 829.36, "text": " And they're in their index by z. Now z here, it seems like they're discrete, right? But" }, { "start": 829.36, "end": 834.88, "text": " in this case, they would be z would be a continuous vector. But it's easier if you imagine that" }, { "start": 834.88, "end": 842.8, "text": " so each one of this is like z one, z two, and so on. They're going to be continuous," }, { "start": 842.8, "end": 850.88, "text": " but in our case, we'll just think of a discrete set of skills to be learned. Okay, so they" }, { "start": 850.88, "end": 857.48, "text": " say we want to maximize the mutual information between the skill that's currently in action." }, { "start": 857.48, "end": 862.72, "text": " So in every, every time the agent has to like choose a skill and saying like, okay, now" }, { "start": 862.72, "end": 870.32, "text": " I'm going to walk forward. And it's in a given state. And what you want to say is you have" }, { "start": 870.32, "end": 876.12, "text": " to maximize the mutual information between the skill and the next state, which means" }, { "start": 876.12, "end": 882.48, "text": " that it means two things, which you can see right here, you can decompose it in two different" }, { "start": 882.48, "end": 893.4, "text": " ways. One way is the following is to say, if I know which state I'm in, what's the entropy" }, { "start": 893.4, "end": 904.76, "text": " over my? Okay, that's the wrong bad way for me leading it. It's if I knew, if I know these" }, { "start": 904.76, "end": 912, "text": " two things, so if I know the state I'm in, and the next state that I'm going to write," }, { "start": 912, "end": 919.28, "text": " I can in hindsight, I look back, if I know both things, what can I say about this skill" }, { "start": 919.28, "end": 927.4399999999999, "text": " z right here, that I couldn't say just from the starting state. So the starting state," }, { "start": 927.44, "end": 940.32, "text": " let's say is the person right here, and the end state is the person a little bit more" }, { "start": 940.32, "end": 944.7600000000001, "text": " over there. So that's, that's called this forward, it's the person is looking to the" }, { "start": 944.7600000000001, "end": 951.5200000000001, "text": " right. Okay. Now, if I only show you if I only show you the state on the left, the starting" }, { "start": 951.5200000000001, "end": 957.4000000000001, "text": " state, what can you tell me which action is going to follow right here? Basically, you" }, { "start": 957.4, "end": 962.36, "text": " can tell me much it could be any action like walk forward, walk back, stay put. But if" }, { "start": 962.36, "end": 969.56, "text": " I also show you the next state, then you can pretty confidently say, ah, I know what you" }, { "start": 969.56, "end": 975.52, "text": " did, you did walk forward. Okay, so this, this, in this situation, we would have a high" }, { "start": 975.52, "end": 982.4, "text": " mutual information between z and s prime in the formulation here, if you decompose it" }, { "start": 982.4, "end": 986.72, "text": " in the other way, this is equivalent, but it's a different way of thinking about it," }, { "start": 986.72, "end": 993.36, "text": " it means when I show you these two things, how much more can you tell me about the next" }, { "start": 993.36, "end": 1000, "text": " state than if I only show you this. So in this formulation, what we would do is, I would" }, { "start": 1000, "end": 1005.6800000000001, "text": " say I tell you the human is here looking to the right, what can you tell me about the" }, { "start": 1005.6800000000001, "end": 1014.1600000000001, "text": " next state? And you like what I, I couldn't tell you very much, right? It can be anything." }, { "start": 1014.16, "end": 1020, "text": " But if I then tell you the action is walk forward, then you could say, ah, now I now" }, { "start": 1020, "end": 1025.52, "text": " I get it, it's probably going to be something like this. Okay. This also would be a high" }, { "start": 1025.52, "end": 1032.44, "text": " mutual information. So you see that the the task of maximizing this mutual information" }, { "start": 1032.44, "end": 1038.36, "text": " is good, because what happens if I don't, if I have a low mutual information, if I have" }, { "start": 1038.36, "end": 1046.36, "text": " a low mutual information, it would mean that I could predict the next state just as well" }, { "start": 1046.36, "end": 1052.7199999999998, "text": " from the current state. It doesn't make a difference whether you give me the skill or" }, { "start": 1052.7199999999998, "end": 1059, "text": " not, it would not make a difference. And that is only the case if my skills are basically" }, { "start": 1059, "end": 1064.8, "text": " either all the same or all pretty, pretty random and pretty useless. Right? So if if" }, { "start": 1064.8, "end": 1070.08, "text": " all my skills are basically walking backwards, then I don't, you don't have to tell me which" }, { "start": 1070.08, "end": 1075.72, "text": " skill you do, I'm going to know that the next state is like this. So you can see that the" }, { "start": 1075.72, "end": 1084.06, "text": " objective of maximizing the mutual information between the skill and the next state is going" }, { "start": 1084.06, "end": 1090.8, "text": " to result in a situation where these skills are going to be first of all, diverse. And" }, { "start": 1090.8, "end": 1100.32, "text": " second of all, easy to easy to predict. Okay. And to see this, yeah, we only have to imagine" }, { "start": 1100.32, "end": 1106.32, "text": " what would happen, what would happen in a in a situation where the skills weren't diverse" }, { "start": 1106.32, "end": 1111.9199999999998, "text": " or weren't easy to predict. And you'll get exactly the situation where the information" }, { "start": 1111.9199999999998, "end": 1116.28, "text": " of the skill doesn't help you in predicting the next state, because yeah, either it's" }, { "start": 1116.28, "end": 1123.52, "text": " obvious or it's random. Okay, so we agree that it makes sense to maximize the mutual" }, { "start": 1123.52, "end": 1131.32, "text": " information. And they decompose this into two objectives. So they say the mutual information" }, { "start": 1131.32, "end": 1139.72, "text": " will stay is basically what you'll have to do is you'll have to it decomposes into two" }, { "start": 1139.72, "end": 1148.92, "text": " terms where you can into two terms in a lower bound in the mutual information. And this" }, { "start": 1148.92, "end": 1154.26, "text": " is kind of the this is sort of the standard variational approximation literature. If you're" }, { "start": 1154.26, "end": 1160.78, "text": " into that read up on variational auto encoders and things like this. Basically, the two steps" }, { "start": 1160.78, "end": 1168.2, "text": " here are you tighten the variational lower bound and you maximize the approximate lower" }, { "start": 1168.2, "end": 1178.48, "text": " bound. Okay, so you have the mutual information, and you can lower bound it. Okay, you can" }, { "start": 1178.48, "end": 1184.64, "text": " you can lower bound it by this quantity. Now the if since this is a lower bound, you can" }, { "start": 1184.64, "end": 1191.68, "text": " prove that this is a lower bound, it means that the higher you make this term, then the" }, { "start": 1191.68, "end": 1197.52, "text": " the more basically, okay, if it's a lower, I don't know how to formulate, but it should" }, { "start": 1197.52, "end": 1202.6, "text": " be fairly obvious if this if this thing on the right is a lower bound to the mutual information," }, { "start": 1202.6, "end": 1208.32, "text": " then maximizing the thing on the right will maximize the thing on the left. And it will" }, { "start": 1208.32, "end": 1216.8, "text": " do so very so imagine I is up here. And this E on the right side is down here, it's a lower" }, { "start": 1216.8, "end": 1223.8, "text": " bound, right? It's lower than I. So if I maximize E, well, I haven't really done anything to" }, { "start": 1223.8, "end": 1229.3999999999999, "text": " I but if I maximize it even more up to here, and since it's a lower bound, I know now my" }, { "start": 1229.3999999999999, "end": 1235, "text": " I must be at least higher than this. Okay, so maximizing a lower bound to a quantity" }, { "start": 1235, "end": 1241.44, "text": " will ultimately increase the quantity. But you can also the efficiency by which it does" }, { "start": 1241.44, "end": 1248.9199999999998, "text": " this depends on how tight the bound is. So if the bound is very tight, like this, you" }, { "start": 1248.92, "end": 1257.6000000000001, "text": " see I is not much above E. If the bound is very tight, then maximizing E will result" }, { "start": 1257.6000000000001, "end": 1264.6000000000001, "text": " in a faster maximization of I. Okay, so you can do two things, you can maximize the quantity" }, { "start": 1264.6000000000001, "end": 1270.24, "text": " that is the lower bound, or you can tighten the bound. And here we can see that the difference" }, { "start": 1270.24, "end": 1275.3200000000002, "text": " that the tightness of the bound depends on this quantity right here, which is the KL" }, { "start": 1275.32, "end": 1285.96, "text": " difference between this and this. So yeah, let's watch this in the context of we can" }, { "start": 1285.96, "end": 1293.04, "text": " actually go go through it on the high level. If you've never done this variational approximation" }, { "start": 1293.04, "end": 1300.74, "text": " sort of math, then this might be a bit informative. Okay, so the thing right here is just pops" }, { "start": 1300.74, "end": 1307.28, "text": " out of the definition of the mutual information. It's the it's basically the differences of" }, { "start": 1307.28, "end": 1313.28, "text": " the entropy's, which the entropy's are log quantities, right? So if you have a log A" }, { "start": 1313.28, "end": 1319.56, "text": " minus log B, that you can also write this as the log of the fraction of A over B, that's" }, { "start": 1319.56, "end": 1327.36, "text": " just a property of the log. And so it's expectations over logs, these entropy's. So you can write" }, { "start": 1327.36, "end": 1337.28, "text": " it as this thing right here. Okay. And this basically says, this is very high, if or very" }, { "start": 1337.28, "end": 1345.32, "text": " low, depending so you need to whether or something is lower high always will depend on what you" }, { "start": 1345.32, "end": 1353.8999999999999, "text": " exactly you have to consider. But ultimately, what you'll want is the ratio between this" }, { "start": 1353.9, "end": 1360.52, "text": " quantity, which is the probability of the next state given the current state and the" }, { "start": 1360.52, "end": 1368.0400000000002, "text": " skill you're taking divided by just the probability over the next state, given the the current" }, { "start": 1368.0400000000002, "end": 1375.6200000000001, "text": " state, in expectation over all the skills, current states and next states. Now what they're" }, { "start": 1375.6200000000001, "end": 1383, "text": " saying is, this here, this is basically the environment, right? This is if you are in" }, { "start": 1383, "end": 1388.56, "text": " a state and you perform a skill, what's the next state? That's the true environment. P" }, { "start": 1388.56, "end": 1393.12, "text": " here is the true environment, which we don't know, right? We don't know what the environment's" }, { "start": 1393.12, "end": 1399.32, "text": " going to do. But we would like to learn a model for the environment. And this model" }, { "start": 1399.32, "end": 1412.96, "text": " for the environment is now Q, Q, theta, phi, theta, phi, Greek letter. So Q phi here is" }, { "start": 1412.96, "end": 1420.04, "text": " going to be a neural network that will approximate the environment. And in this probabilistic" }, { "start": 1420.04, "end": 1425.88, "text": " framework, it is going to be a learned distribution that will approximate the distribution of" }, { "start": 1425.88, "end": 1435.1200000000001, "text": " P. So we approximate it by this. But now this is here it says equal equal, right? This is" }, { "start": 1435.12, "end": 1442.9199999999998, "text": " not equal, because this is just an approximation. So the equality must become must be basically" }, { "start": 1442.9199999999998, "end": 1451.84, "text": " compensated for by this term right here, you can see this here is expanded into these two," }, { "start": 1451.84, "end": 1456.06, "text": " you can go through the exact definitions and see why this is an equality. But basically," }, { "start": 1456.06, "end": 1463.28, "text": " you can say that the mutual information is this expectation, or it is this expectation." }, { "start": 1463.28, "end": 1467.24, "text": " But now you have to correct for the fact that here you only have an approximation. And you" }, { "start": 1467.24, "end": 1474.2, "text": " have to correct for the fact by exactly the amount by which the approximation is different" }, { "start": 1474.2, "end": 1480.68, "text": " than the quantity that you're approximating. And this is this key KL divergence right here." }, { "start": 1480.68, "end": 1488.8799999999999, "text": " So the KL divergence basically measures how different two distributions are. It's sort" }, { "start": 1488.88, "end": 1493.68, "text": " of a distance, not exactly distance, but sort of a distance between these two distributions" }, { "start": 1493.68, "end": 1497.5800000000002, "text": " right here, it says, here's the real world. And here is your estimate of the real world," }, { "start": 1497.5800000000002, "end": 1506.24, "text": " how much do they disagree, and that quantity plus, then you can replace your world, the" }, { "start": 1506.24, "end": 1512.72, "text": " exact world distribution by your approximate distribution. And you still are equal to the" }, { "start": 1512.72, "end": 1518.76, "text": " mutual information. And now the basically the trick is you say, oh, the KL divergence" }, { "start": 1518.76, "end": 1525.44, "text": " is always positive, it's a quantity that it can only be a positive number. So if I leave" }, { "start": 1525.44, "end": 1532, "text": " it away, certainly, this is only this is going to be a lower bound to the quantity. Okay." }, { "start": 1532, "end": 1537.2, "text": " All right. So two tasks right here. First of all, tighten the variational bound, which" }, { "start": 1537.2, "end": 1542.76, "text": " means make this quantity small, make your approximate world model as close as possible" }, { "start": 1542.76, "end": 1550.46, "text": " to the real world. How do we do this neural network? Okay, you input trajectories. I was" }, { "start": 1550.46, "end": 1556.64, "text": " in this state, I performed this skill, and I ended up in this state. Sorry, that's this" }, { "start": 1556.64, "end": 1561.56, "text": " and then you simply match your neural network simply matches what happens in the real world," }, { "start": 1561.56, "end": 1568.48, "text": " it learns the transition function, basically. So that's, that's the tightening of the variational" }, { "start": 1568.48, "end": 1579.08, "text": " bound. And the second step is this right here to" }, { "start": 1579.08, "end": 1583.6799999999998, "text": " to maximize the approximate lower bound, right? The first step was Titan variation lower bound," }, { "start": 1583.6799999999998, "end": 1588.6399999999999, "text": " that basically means make your world model more accurate. And the second is Titan that" }, { "start": 1588.64, "end": 1595.24, "text": " maximize the approximate lower bound. Now this is going to part, this is going to be" }, { "start": 1595.24, "end": 1601.76, "text": " the part that says, now given that I already have a better world model right here, can" }, { "start": 1601.76, "end": 1611, "text": " I improve my can I sort of improve my skills such that they become easier to predict and" }, { "start": 1611, "end": 1617.96, "text": " more diverse? Can I improve my skills such that this mutual information right here gets" }, { "start": 1617.96, "end": 1626.44, "text": " to be high as high as possible? Okay. So this is sort of an alternating thing. And you can" }, { "start": 1626.44, "end": 1633.52, "text": " see this in this very, very, very, very confusing diagram, honestly. So what are you going to" }, { "start": 1633.52, "end": 1638.96, "text": " do in this algorithm? First of all, in each episode, you're going to select a skill at" }, { "start": 1638.96, "end": 1644.28, "text": " random. And as I said, these skills, they're not predefined. So no one tells the agent" }, { "start": 1644.28, "end": 1649.44, "text": " to walk forward, it simply says, okay, you have like, in a discrete case, you would have" }, { "start": 1649.44, "end": 1655.44, "text": " like, you have five skill slots, right? And the only thing I require is that they're sort" }, { "start": 1655.44, "end": 1659.48, "text": " of, you know, consistent over time. So skill one is always going to be sort of the same" }, { "start": 1659.48, "end": 1665.56, "text": " thing and skill two, but agent, you can basically decide what skill one is, right? But make" }, { "start": 1665.56, "end": 1672.28, "text": " the skill such that it's predictable and that the different skills are diverse. Okay, so" }, { "start": 1672.28, "end": 1677.72, "text": " you're going to sample one of the skills, like skill zero or whatnot. And then you're" }, { "start": 1677.72, "end": 1687.76, "text": " going to do two things. First of all, you're going to learn these skill dynamics, which" }, { "start": 1687.76, "end": 1694.24, "text": " is you're going to learn your approximate model of the world. Okay. And how do you do" }, { "start": 1694.24, "end": 1702.68, "text": " that? Basically, here, you're the agent and the agent will. So what does the agent have" }, { "start": 1702.68, "end": 1709.96, "text": " to do? The agent will take in the skill Z and it will take in the current state of the" }, { "start": 1709.96, "end": 1715.64, "text": " world and it will output an action. Now, this is the model free part, right? So the agent" }, { "start": 1715.64, "end": 1722.8, "text": " that somehow has to come up with saying, ah, skill zero, that's walking forward. And in" }, { "start": 1722.8, "end": 1729.8799999999999, "text": " this situation, walking forward means I have to lift my leg or something like this. So" }, { "start": 1729.8799999999999, "end": 1734.52, "text": " you're going to take your skill, you're going to with your agent perform an action based" }, { "start": 1734.52, "end": 1738.58, "text": " on that skill and the current state of the world. Then the environment is going to give" }, { "start": 1738.58, "end": 1745.48, "text": " you the next state right here. And from those things, you can now learn your world model." }, { "start": 1745.48, "end": 1752.76, "text": " You know, I was in state S, I performed action a but I performed action a based on skills" }, { "start": 1752.76, "end": 1761.92, "text": " Z. And then I ended up in state S prime. And I can learn a model of the world, right? This" }, { "start": 1761.92, "end": 1766.8, "text": " is a triple, I can do supervised learning of a world model. Now here, they do probabilistic" }, { "start": 1766.8, "end": 1772.12, "text": " learning, but and we're going to see in a second how that works. But ultimately, they" }, { "start": 1772.12, "end": 1780.08, "text": " approximate the world with their model. Cool. So that's the this outer loop. And then what" }, { "start": 1780.08, "end": 1786.36, "text": " are they going to do next, they're going to use that world model to determine a reward" }, { "start": 1786.36, "end": 1793.1399999999999, "text": " for the agent, and the reward for the agent for taking the action. So the reward is going" }, { "start": 1793.1399999999999, "end": 1799.24, "text": " to be, oh, agent, you took action a. Now, what's your reward for doing this? This is" }, { "start": 1799.24, "end": 1809.04, "text": " the model free reinforcement learning part, your reward is going to be very high, if if" }, { "start": 1809.04, "end": 1817, "text": " this was very predictable. And if it is also diverse, right, so now, the agent has to sort" }, { "start": 1817, "end": 1826.36, "text": " of max sort of the agent has to go and make this quantity very high this, we want the" }, { "start": 1826.36, "end": 1833.44, "text": " outcome of these actions to be predictable, and dive and the actions themselves to be" }, { "start": 1833.44, "end": 1840.4, "text": " diverse. It is, I'm sorry, it's very hard to keep all of this very straight. Okay. But" }, { "start": 1840.4, "end": 1847.4, "text": " ultimately, two steps, learn world model from the experience that you've generated. And" }, { "start": 1847.4, "end": 1853.92, "text": " second thing, learn the agent such that it maximizes this this quantity that we've seen" }, { "start": 1853.92, "end": 1861.24, "text": " before. And you do this via giving the agent a reward that is proportional to the mutual" }, { "start": 1861.24, "end": 1871.4, "text": " information. And we've already seen that we can approximate the mutual information by" }, { "start": 1871.4, "end": 1881.8, "text": " by this quantity here. Okay. So learn world model, and make the agent go higher mutual" }, { "start": 1881.8, "end": 1889.08, "text": " information, two steps. Okay, learn world model is very, very classic, you can say," }, { "start": 1889.08, "end": 1894.6399999999999, "text": " okay, I need to improve, I need to minimize this KL divergence. So I need the gradient" }, { "start": 1894.6399999999999, "end": 1902, "text": " with respect to the parameters of my world model, I can write down the KL divergence" }, { "start": 1902, "end": 1910.48, "text": " like this. And then since I can do this reverse, so log a over b is log a minus log b. And" }, { "start": 1910.48, "end": 1916.48, "text": " since the world doesn't depend on the parameters of my model, this will simply give me this" }, { "start": 1916.48, "end": 1922.66, "text": " thing right here, which is the gradient of the log probability basically, of my neural" }, { "start": 1922.66, "end": 1928.4, "text": " network. And this can be just optimized straightforward, this is a neural network, optimize it with" }, { "start": 1928.4, "end": 1935.84, "text": " gradient descent. These are the inputs, this is the output. Now, okay, you, this is all" }, { "start": 1935.84, "end": 1940.24, "text": " probability distributions, but ultimately, you can you can do it pretty straightforward." }, { "start": 1940.24, "end": 1948.92, "text": " Okay, so corresponds to maximizing the likelihood of the samples from P under Q. Now, the second" }, { "start": 1948.92, "end": 1958.64, "text": " step maximize the approximate lower bound. Okay. So after they say after fitting Q, after" }, { "start": 1958.64, "end": 1964.56, "text": " improving our world model, we can optimize pi pi is the agent that actually takes the" }, { "start": 1964.56, "end": 1970.9199999999998, "text": " actions based on the skill. So it's given a skill, and it needs to perform an action." }, { "start": 1970.9199999999998, "end": 1977.8, "text": " And it needs to maximize this quantity, as we've seen, needs to maximize the mutual information" }, { "start": 1977.8, "end": 1984.96, "text": " between if I know the action and if I don't, or the mutual information between the skill" }, { "start": 1984.96, "end": 1993.1599999999999, "text": " and the next state. I say note, this is a reinforcement learning style optimization," }, { "start": 1993.16, "end": 2000.1200000000001, "text": " with a reward function of this quantity. However, so you look at the quantity that they need" }, { "start": 2000.1200000000001, "end": 2006.88, "text": " right here, the quantity is going to be this thing. And this thing is just, I feed the" }, { "start": 2006.88, "end": 2012.78, "text": " skill and the state into my world model. And I look what what comes out of the world model." }, { "start": 2012.78, "end": 2019.64, "text": " So this I can compute, right? But this thing right here, I can't compute because this is" }, { "start": 2019.64, "end": 2028.3000000000002, "text": " this is what happens in the world when I'm in state s, and I just run my agent over in" }, { "start": 2028.3000000000002, "end": 2036.66, "text": " expectation over all the skills. So this I don't know, they have a log of this is intractable." }, { "start": 2036.66, "end": 2043.5600000000002, "text": " And then so we approximate the reward function for pi as this thing right here. Now, first," }, { "start": 2043.56, "end": 2053.88, "text": " let's look at what this thing is. So the reward of taking action a, and action a is based" }, { "start": 2053.88, "end": 2059.7599999999998, "text": " on skill z, right? So skill z was fed into the agent, the agent comes up with action" }, { "start": 2059.7599999999998, "end": 2065, "text": " a, oh, you want me to walk forward in this situation, okay, I'm gonna lift my leg. That's" }, { "start": 2065, "end": 2070.84, "text": " the action. Okay. So the reward for this action, given this skill, and given the current state" }, { "start": 2070.84, "end": 2078.4, "text": " is going to be what it's going to be very high, if this here is very high. So it's going" }, { "start": 2078.4, "end": 2087.76, "text": " to be very high if the probability so this s prime is the state you ended up in, right?" }, { "start": 2087.76, "end": 2094.1200000000003, "text": " So after taking the action, you ended up in s prime. So if what does it mean when this" }, { "start": 2094.12, "end": 2103, "text": " quantity is very high? It means that my world model q, that is approximating the world," }, { "start": 2103, "end": 2110.04, "text": " thinks that this state is very probable if you were in this state and are given the skill" }, { "start": 2110.04, "end": 2117.2799999999997, "text": " z. So this basically means that the neural network can predict with very high accuracy," }, { "start": 2117.28, "end": 2124.44, "text": " what's going to happen if you are in this state and are given this skill to perform," }, { "start": 2124.44, "end": 2131.6400000000003, "text": " right? This is one of the things that we want. Now, what is it divided by? It's divided by" }, { "start": 2131.6400000000003, "end": 2141, "text": " this. And you can see here, the z i are other skills. So it is, what does this mean? This" }, { "start": 2141, "end": 2148.2, "text": " is almost the same quantity. It means how well can the same neural network predict the" }, { "start": 2148.2, "end": 2158.6, "text": " next state if you were given a different skill. So it means if I'm here, and I ended up here," }, { "start": 2158.6, "end": 2165, "text": " how well can you predict it if I tell you that I walked forward? And here you ask, well," }, { "start": 2165, "end": 2170.04, "text": " how well can you predict it if I told you you walked backward, if I told you you jumped," }, { "start": 2170.04, "end": 2179.32, "text": " if I told you, and so on. So you basically aggregate over all the other skills you could" }, { "start": 2179.32, "end": 2183.92, "text": " perform. And each time you ask the neural network, well, how likely is it that you end" }, { "start": 2183.92, "end": 2190.7599999999998, "text": " up in the state that I ended up with? So what does it mean if this quantity is high, or" }, { "start": 2190.7599999999998, "end": 2198.36, "text": " sorry, if the entire sum here is high? That means that the skill doesn't really give you" }, { "start": 2198.36, "end": 2202.8, "text": " much information, the neural network is very good, no matter which skill you selected," }, { "start": 2202.8, "end": 2207, "text": " right? It's very accurate in predicting the next state doesn't really matter. The skill" }, { "start": 2207, "end": 2214.88, "text": " doesn't really matter. And this is what we don't want, right? We want that the skills" }, { "start": 2214.88, "end": 2220.08, "text": " are very diverse, right? So the top part is, they're easy, it's easy to predict what will" }, { "start": 2220.08, "end": 2227.6800000000003, "text": " happen if you perform a given skill. And we divide this by the bottom part. And this makes" }, { "start": 2227.68, "end": 2233.24, "text": " it such that these skills are very diverse, because if they're not diverse, then it doesn't" }, { "start": 2233.24, "end": 2238.8399999999997, "text": " really matter which one you perform. And then this quantity on the bottom will be very high," }, { "start": 2238.8399999999997, "end": 2246.2799999999997, "text": " but we divide by it. So we want, we want it to be low. Okay, now the reward is going to" }, { "start": 2246.2799999999997, "end": 2253.24, "text": " be the log of this fraction here. And this makes sense, right intuitively, but they're" }, { "start": 2253.24, "end": 2258.64, "text": " going to try to motivate this mathematically. And for motivating this mathematically, of" }, { "start": 2258.64, "end": 2264.3999999999996, "text": " course, they need to approximate this quantity right here. This quantity is the denominator." }, { "start": 2264.3999999999996, "end": 2272.08, "text": " So they this denominator is a proc is an approximation to this. It's an approximation. As you can" }, { "start": 2272.08, "end": 2280.3199999999997, "text": " see here, this is sort of sort of a sample based approximation to the transition from" }, { "start": 2280.32, "end": 2289.84, "text": " s to s prime under the distribution of z. But what you want is just is the transition" }, { "start": 2289.84, "end": 2298.8, "text": " from s to s prime, not in your approximation, but in the real world. And they formulate" }, { "start": 2298.8, "end": 2308.7200000000003, "text": " this, they say, okay, we can decompose it as such as a as an integral over this conditional" }, { "start": 2308.72, "end": 2318.3199999999997, "text": " right here. So they bring in the z variable. And then they say, well, this, this is approximately" }, { "start": 2318.3199999999997, "end": 2329.2, "text": " approximately we can replace this here by this. And we can replace this here by this." }, { "start": 2329.2, "end": 2336.3199999999997, "text": " They say, well, since the this is a an approximation, the two, this is the world model is an approximation" }, { "start": 2336.32, "end": 2343.32, "text": " to the real world, we can sort of replace that. And then this is the this is the part" }, { "start": 2343.32, "end": 2352.6000000000004, "text": " that doesn't convince me they say, well, this P z of s, we can just replace it by P z. Now" }, { "start": 2352.6000000000004, "end": 2358.84, "text": " this is it's very tricky to see what these quantities are. Ultimately, it ends up being" }, { "start": 2358.84, "end": 2369.48, "text": " that right here. But it's it's it's so tricky. So they say we replace P z given s by P of" }, { "start": 2369.48, "end": 2379.1600000000003, "text": " z. And, okay, let's think about this for a second. What does the top the bottom quantity" }, { "start": 2379.1600000000003, "end": 2383.6800000000003, "text": " is simply the distribution over your skills. And depending on how you sample them, this" }, { "start": 2383.68, "end": 2389.72, "text": " could be like a uniform distribution over your skills, like that's fine. But what's the top thing," }, { "start": 2389.72, "end": 2399.52, "text": " the top thing, basically, we can use base formula to reformulate it. It's P of s given z times" }, { "start": 2399.52, "end": 2414.24, "text": " P of right times P of z divided by P of s. So this quantity depends on multiple things." }, { "start": 2414.24, "end": 2422.6, "text": " Here's that prior again. And this means what's the general distribution of states? What's" }, { "start": 2422.6, "end": 2430.08, "text": " the general distribution of states? If your agent acts in the world, right, this? And this, we" }, { "start": 2430.08, "end": 2438.36, "text": " don't know, we don't we don't know. And also this right here, what's the distribution in the true" }, { "start": 2438.36, "end": 2447.72, "text": " world? What's the probability of a state given a given given that you were acting under a skill" }, { "start": 2447.72, "end": 2454.3599999999997, "text": " z? And this is also something we don't know, because we don't know the world, we we don't have" }, { "start": 2454.3599999999997, "end": 2459.24, "text": " the world model. So you run into the same problem again and again, that you're trying to approximate" }, { "start": 2459.24, "end": 2464.72, "text": " this. And they want to make this so mathematically rigorous, but ultimately, and they go in the" }, { "start": 2464.72, "end": 2469.24, "text": " appendix, they go through various ways that they could solve this. But ultimately, they just say," }, { "start": 2469.24, "end": 2478.08, "text": " well, this is approximately the same. So this right here, it basically means what skills," }, { "start": 2478.08, "end": 2485.7999999999997, "text": " if you're if you're in a certain state, what skills brought you here, basically, what what" }, { "start": 2485.7999999999997, "end": 2490.4799999999996, "text": " skills brought you here, what's the distribution of skills that brought you to this state, and" }, { "start": 2490.4799999999996, "end": 2495.2799999999997, "text": " they say, well, we're just going to approximate that by the prior distribution over our skills," }, { "start": 2495.28, "end": 2503.6000000000004, "text": " basically disregard the state here. And this seems overly shaky. Like, as I said, the entire paper" }, { "start": 2503.6000000000004, "end": 2512.48, "text": " makes sense. But I just feel it's trying to be overly mathematical, and then run into a point" }, { "start": 2512.48, "end": 2518.48, "text": " where you can't be and then they're just like, okay, we'll, we'll just replace it. And then sort" }, { "start": 2518.48, "end": 2526.32, "text": " of things break down, like, you can only be overly mathematical to some degree, it doesn't really fit." }, { "start": 2527.84, "end": 2533.52, "text": " But okay, so this is how you discover the skills, you maximize these quantities, alternately," }, { "start": 2533.52, "end": 2540.56, "text": " you learn the world model, and you improve your your skills by making them diverse and easily" }, { "start": 2540.56, "end": 2546.16, "text": " predictable. So how do you then plan using these skills? This is the second part of the paper," }, { "start": 2546.16, "end": 2553.04, "text": " and this is just as complicated as the first part. So they say given the learned skills," }, { "start": 2553.04, "end": 2560.08, "text": " so the learned skills are policies over action given the DZ, right? So now you know how to like" }, { "start": 2560.08, "end": 2566.64, "text": " walk forward and walk back and so on. And now you're, you're placed in a world, and you're given" }, { "start": 2566.64, "end": 2573.7599999999998, "text": " this checkpoint, it says, well, walk there. And you want this to do this using planning, you don't" }, { "start": 2573.76, "end": 2581.6800000000003, "text": " want to learn anymore, you simply want to plan. Okay, what do you do? And as I said, this is even" }, { "start": 2581.6800000000003, "end": 2588.6400000000003, "text": " more so what you want to do is you want to do something like model predictive control, but not" }, { "start": 2588.6400000000003, "end": 2598.6400000000003, "text": " over actions, but over your learned skills. So you have this planner in the NPC, and the planner will" }, { "start": 2598.64, "end": 2607.3599999999997, "text": " in its head roll out a number of different, a number of different plans, it will kind of" }, { "start": 2607.3599999999997, "end": 2614.48, "text": " explore a bunch of different, different plans Z, it will roll them out, I'll say, okay, if I do this," }, { "start": 2614.48, "end": 2619.7599999999998, "text": " and this, and this, and this, what will happen using its world model that it has learned," }, { "start": 2620.7999999999997, "end": 2627.44, "text": " it will observe what's going to be the reward in each of these cases. Now, they say here, access" }, { "start": 2627.44, "end": 2635.28, "text": " the environment reward, but can also be estimated. And this is another sort of, I feel weak point of" }, { "start": 2635.28, "end": 2643.44, "text": " this in that they now assume they have the true reward function. But they don't have a world model," }, { "start": 2643.44, "end": 2649.2000000000003, "text": " right? They don't have the world model, but they assume that they can sort of always ask for the" }, { "start": 2649.2, "end": 2657.9199999999996, "text": " true reward, which is probably not the case if you had a true world, but it could be the case," }, { "start": 2657.9199999999996, "end": 2661.2, "text": " the reward could be something like, well, if you're over there, you get higher reward," }, { "start": 2661.7599999999998, "end": 2670.48, "text": " but you don't exactly know how to get over there. In any case, so they roll out a bunch of trajectories" }, { "start": 2670.48, "end": 2675.9199999999996, "text": " in their head, they kind of plan forward, see what's going to happen if they do this or that," }, { "start": 2675.92, "end": 2685.2000000000003, "text": " or this or that. And then they choose the best one of these forward thoughts, and they execute it in" }, { "start": 2685.2000000000003, "end": 2691.6800000000003, "text": " the real world, right? So they say, well, I'm going to use choose the skill walk forward. So the agent" }, { "start": 2691.6800000000003, "end": 2696.96, "text": " is now going to be tasked with walking forward. And it's going to do that in the real world for" }, { "start": 2696.96, "end": 2702.16, "text": " a certain amount of steps, like 10 steps of walking forward, after 10 steps of walking forward," }, { "start": 2702.16, "end": 2707.52, "text": " you go back and say, I'm in this new situation right here, what should I do? And again, the planner" }, { "start": 2707.52, "end": 2712.48, "text": " is going to be like, if you first walk forward, and then walk back, where are you going to be," }, { "start": 2712.48, "end": 2719.8399999999997, "text": " and so on. So the planner will always plan, basically to go from where you are to the" }, { "start": 2719.8399999999997, "end": 2727.12, "text": " checkpoint using a composition of the skills that you have learned. So the planner may be fine. Okay," }, { "start": 2727.12, "end": 2733.8399999999997, "text": " if I first walk forward, walk back a bit, and so on, I'm going to get to the goal, I'm going to" }, { "start": 2733.8399999999997, "end": 2740.48, "text": " reach the goal. Now please agent execute this first thing, walk forward, the agent executes it," }, { "start": 2740.48, "end": 2746.08, "text": " and maybe it won't, you know, it won't do as well, it will maybe end up here. And then it says, well," }, { "start": 2746.08, "end": 2751.3599999999997, "text": " I'm here now, please plan again. So it plans again, it says, okay, I can still kind of walk back," }, { "start": 2751.36, "end": 2758.1600000000003, "text": " I'll be here, here, but then I have to do something else. So now walk back. And okay, so this is what's" }, { "start": 2758.1600000000003, "end": 2768.4, "text": " going to happen. But it is going to happen in a weird way. Namely, what we keep are normal," }, { "start": 2768.4, "end": 2775.92, "text": " since everything is continuous, we'll keep normal distributions of all our future steps. So we don't" }, { "start": 2775.92, "end": 2783.84, "text": " say, okay, I go here, and then I go here. What you'll say is I approximately go here. And after that," }, { "start": 2783.84, "end": 2790.64, "text": " I'll approximately go here. And you will do it in such a way that the peak of this normal distribution" }, { "start": 2790.64, "end": 2796.32, "text": " is going to be the highest, where you think you will get the most reward. If you follow this" }, { "start": 2796.32, "end": 2800.88, "text": " trajectory, like if you follow this trajectory, you get a very high reward. And if I follow a" }, { "start": 2800.88, "end": 2807.12, "text": " trajectory that maybe goes here, I won't get a high reward. If it actually turns out in your" }, { "start": 2807.12, "end": 2812.2400000000002, "text": " imagination that you do get a high reward for this trajectory, you'll change this distribution," }, { "start": 2812.2400000000002, "end": 2818.7200000000003, "text": " such that the peak is here. And of course, the tighter the peak is, the more sure you are. So" }, { "start": 2818.7200000000003, "end": 2825.44, "text": " you sort of are looking, if you look out into the world, you want the closest steps to be very peaky." }, { "start": 2825.44, "end": 2832.96, "text": " And then as you look out, they can be more sort of broad. And that's how you plan ahead, you keep" }, { "start": 2833.84, "end": 2840.16, "text": " doing a step. So if you go from here to finally you choose, I want to go here, where the tip is the" }, { "start": 2840.16, "end": 2847.36, "text": " highest, go here, then you imagine forward again, you refine these distributions over the future." }, { "start": 2848, "end": 2855.12, "text": " And then you take the next step that gets you to the where the highest peak is right here, basically." }, { "start": 2855.12, "end": 2864.08, "text": " And so on. This is simply planning in a continuous domain, it is pretty analogous to how you would" }, { "start": 2864.08, "end": 2870.4, "text": " plan in like, alpha go, if you or tic tac toe, if you had a planner. But since everything's" }, { "start": 2870.4, "end": 2877.8399999999997, "text": " continuous, it makes it just so much harder. So they yeah, they always update these distributions," }, { "start": 2877.8399999999997, "end": 2884.16, "text": " as you can see here, to the skill that gave you a high reward in your imagination," }, { "start": 2884.16, "end": 2894.56, "text": " compared to the rewards of the other plans that you had. Okay, well, this was a long, long way" }, { "start": 2894.56, "end": 2902, "text": " until we got here. But if you recap, so first, they in an unsupervised fashion, learn these low" }, { "start": 2902, "end": 2908.16, "text": " level skills, such that they're easily predictable by their own world model, and diverse. And then in" }, { "start": 2908.16, "end": 2917.52, "text": " the second step, they can use that to, to do basically planning. So they first learn these" }, { "start": 2917.52, "end": 2925.6, "text": " skills, and then the planner composes them to make the agent do something. And again, the agent will" }, { "start": 2925.6, "end": 2930.7999999999997, "text": " never have to learn how to do this go from checkpoint to checkpoint, because the planner" }, { "start": 2930.8, "end": 2939.04, "text": " can just compose these low level skills. So they have these experiments right here. And we won't" }, { "start": 2939.04, "end": 2944.5600000000004, "text": " go through the experiment because this video is already very, very long. But they basically show" }, { "start": 2944.5600000000004, "end": 2952.7200000000003, "text": " that they they're learned things, actually, their learned skills do end up being very diverse," }, { "start": 2952.7200000000003, "end": 2960.5600000000004, "text": " do end up predictable, have a high variance, and so on, they have to give certain priors to it" }, { "start": 2960.56, "end": 2968.64, "text": " to make it actually work in a real setting. But the results you can actually see in these videos" }, { "start": 2968.64, "end": 2974.08, "text": " and in the graphs, I'm about you to check out the paper if you're still here. Thanks for being here," }, { "start": 2974.08, "end": 2980.56, "text": " I hope this this work was one of the most more complicated and mathy papers we looked at. But I" }, { "start": 2980.56, "end": 2987.44, "text": " think I still think it's fun. And I still think the outcome is pretty impressive right here, how you" }, { "start": 2987.44, "end": 2996.56, "text": " can use math to derive basically these intuitive, very intuitive objectives to learn. It's also" }, { "start": 2996.56, "end": 3017.84, "text": " pretty cool. Alright, that was it for me. And bye bye." } ]
q7QP_lfqnQM
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Synthesizer: Rethinking Self-Attention in Transformer Models (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nlp", "natural language processing", "machine translation", "google", "attention mechanism", "attention", "transformer", "seq2seq", "bert", "memory", "lsh", "locality sensitive hashing", "reversible", "revertible", "flow", "long sequence" ]
Do we really need dot-product attention? The attention mechanism is a central part of modern Transformers, mainly due to the dot-product attention mechanism. This paper changes the mechanism to remove the quadratic interaction terms and comes up with a new model, the Synthesizer. As it turns out, you can do pretty well like that! OUTLINE: 0:00 - Intro & High Level Overview 1:00 - Abstract 2:30 - Attention Mechanism as Information Routing 5:45 - Dot Product Attention 8:05 - Dense Synthetic Attention 15:00 - Random Synthetic Attention 17:15 - Comparison to Feed-Forward Layers 22:00 - Factorization & Mixtures 23:10 - Number of Parameters 25:35 - Machine Translation & Language Modeling Experiments 36:15 - Summarization & Dialogue Generation Experiments 37:15 - GLUE & SuperGLUE Experiments 42:00 - Weight Sizes & Number of Head Ablations 47:05 - Conclusion Paper: https://arxiv.org/abs/2005.00743 My Video on Transformers (Attention Is All You Need): https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM Abstract: The dot product self-attention is known to be central and indispensable to state-of-the-art Transformer models. But is it really required? This paper investigates the true importance and contribution of the dot product-based self-attention mechanism on the performance of Transformer models. Via extensive experiments, we find that (1) random alignment matrices surprisingly perform quite competitively and (2) learning attention weights from token-token (query-key) interactions is not that important after all. To this end, we propose \textsc{Synthesizer}, a model that learns synthetic attention weights without token-token interactions. Our experimental results show that \textsc{Synthesizer} is competitive against vanilla Transformer models across a range of tasks, including MT (EnDe, EnFr), language modeling (LM1B), abstractive summarization (CNN/Dailymail), dialogue generation (PersonaChat) and Multi-task language understanding (GLUE, SuperGLUE). Authors: Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, Che Zheng Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we're looking at synthesizer rethinking self-attention in transformer models by Yi Tai, Dara Barry, Donald Metzler, Da Cheng Chuan, Chih-Zhao and Chih-Ching. These people are of Google research and on a high level they're trying to replace the self-attention mechanism which is currently a dot product mechanism in a transformer by a sort of a learned attention mechanism, therefore eliminating this expensive dot product. They test the model and conclude that it sometimes works a bit. So the results are sort of inconclusive. But that's the paper on a high level and it's fairly cool to go through. As always, if you like content like this, consider subscribing and sharing it out. Alright, so they say the dot product self-attention is known to be central and indispensable to state-of-the-art transformer models. If you don't know what a transformer is, it's best I made a video on the attention is all you need paper and that explains what a transformer is and what an attention mechanism is in detail. But they are right. Of course the attention mechanism that is via the dot product of queries and keys is pretty much what makes transformers transformers. And they here ask is it really required? Which is a bold question in light of that, right? They say they investigate whether or not you really need this and they say via extensive experiments we find that first random alignment matrices surprisingly perform quite competitively and two, learning attention weights from token-token, that means query key interactions, which is this dot product interaction, is not that important after all. Okay, they propose this new model called synthesizer, a model that learns synthetic attention weights without token-token interactions. Our experimental results show that synthesizer is competitive against even NILA transformer models across a range of tasks. Okay, so let's dive in. So what is different here? They're basically saying look in each transformer layer boils down to something like this, where you have an input sequence X right here and you want to get an output sequence Y. And in order to do that you need some sort of this thing, which is the attention matrix, multiplied by this thing, which are called the values. And we'll explore that a bit deeper over here. So in these transformers it's always kind of helpful to visualize yourself the input sequence as sort of nodes. And so this would be one layer, we have a five length sequence and we want to transform it into the next length five sequence. And maybe it even helps to label maybe like A, B, C, D, E. You can just imagine kind of these, of course as you go up the layers it doesn't necessarily always correspond to the same input token. But the position labeling them is still pretty helpful, I find, especially for things like BERT or something like this. So you want to transform the sequence that's incoming here into another sequence. And the basic mechanism in a transformer, if you go up the layers, is the routing of information. So you want to route information around the sequence and basically such that at the end the whole sequence knows about every word in the sentence, knows about every other word that there is in the sentence, knows about the associations between the other words and so on, such that you gain sort of, you start out with individual words and that the end, what you want, is sort of that every word has a pretty good idea of what's going on with every other word. And that's why you continuously, as you go up the layer, route around this information. Now the question is how do you route this information? How do you know which word goes to which other word? And here maybe the sentence starts with the word, let's call Sarah, okay? Sarah and then it goes on and at some point it says she. So she is the pronoun and we can also label these Sarah, she. So if we want to, if we think how do we route information, it would be beneficial for us if the information that there is a word Sarah here in the sentence would be routed to the word she, because the word she, it's a pronoun, it knows I'm a pronoun and if there is like a person in the sentence that would be valuable information for me, like to know what's kind of going on and to understand myself better. Basically every word wants to understand itself and it kind of calls out for information from the other words. In a transformer this is done via what this paper calls this dot product attention and that's the follows. Every word, every token emits what is called a key and a value and the key and the value are just two vectors. So every word is going to emit two vectors. I'm going to draw one at the bottom here and I'm going to draw one at the top. Like that. So you can imagine the key as sort of the word advertising what it is to other words and so these are the keys down here and you, sorry, the top, I think I called it value, that's wrong, it's called a query. You can imagine the query as a word asking, describing what it wants from others to know. So in that case you'll see that the vector here and the vector here, these are now routed by dot product. So the ones that align in the dot product, in the angle, they will be routed to each other. So this would be routed here and maybe, you know, okay I drew this, this one would be routed here and the others would be kind of routed some a bit here and a bit here maybe. Okay it gets fuzzy but you get the concept. But in order to do that you basically need to pull to put the dot product from every single key with every value, sorry, query. And that gives you basically this quadratic dot product that these transformers have and that's expensive. Okay so they have a little picture here. This is what a vanilla transformer does. Every input here emits two things, a query and a key and then there's the dot product attention to decide what's this attention matrix. Okay now this attention matrix is then used to aggregate these values. So actually every token emits three things, also this value here, which is basically, it's not that important but this just describes the information that you want to pass on to the next layer and then it goes through this routing right here that routes the information to the correct output places and you get your output. Now what they propose is something different. They propose this dense synthesizer right here where instead of the dot product attention every single input here emits a basically a row of this matrix directly without having to go through the dot product. That helps a bit if you imagine it in our little framework here. So let's draw this again and let's see what this synthesizer, by the way they call this the dense synthesizer because they have another variant as well. Okay here is our sequence, the lower layer we want to transform it in the upper layer. This is the Sarah node and this is the she node. So how do we route information now? Okay I missed that. In the dense synthesizer framework every token just gets to output, basically it already gets to output where it wants information from. So every single token here gets to output where it wants information to come from and by where because in the original transformer the where was basically defined by these inner product. Now the where is just defined by the position. So it just says I want information from position 2 and 3 or this node here could say I want information from position 5 and 3. And this is dependent on which token there is. So each token looks at itself and in the case here of she you can imagine this token says well I'm a pronoun therefore I may be referring to a person and I know that in the English language a person is often at the beginning of the sentence and therefore I certainly want information from token from position 0. It doesn't see that there is this word Sarah here. It simply can see only the positions 0, 1, 2, 3, 4. So it will output, it will basically output, each token here will output an L dimensional vector and L here is the length of the sequence. An L dimensional vector that already defines the distribution of how you want the information. So I want lots of that and then not much of that and maybe it wants a bit of that and then not much of that. So each word up here is going to emit this L dimensional vector. So each word, each token decides for itself where it wants information to come from based purely on what the token itself is. And of course in the higher layers this information, like the information of what the token is and what else is there gets aggregated and that's how computation happens. But in a fundamental level each node looks at itself and decides where do I want information from just given what I am and not what others are. So this results in you not having to do this dot product attention. But of course you lose the information of what's down here. You simply go on the positions of the nodes and they formalize this like this. So they basically say okay each transformer mechanism needs some sort of a softmax over this matrix B right here. This is this routing matrix and then G of X is just the values of X. So G is often just a linear function. And they say well this B here in the classic transformer is computed via this dot product attention. Can't we just simply have a function right here that just outputs the B given an X. So you see here XI refers to one row. So X here is an L by D matrix and they say the sequence length is L. So if you imagine this is the sequence length, every XI is a vector here of dimension D. Sort of like a word embedding. Now what you want to do is you want to take each individually, run it through the function F and then get out an L dimensional vector. This is of dimension L. And if you do this with enough of the with all of the X's you'll get an L by L matrix which basically is now your routing matrix. So this thing tells you that this particular piece in the input sequence wants how much information from this particular piece in the output sequence or vice versa. See this is the problem here. They don't really specify this B, how this B matrix will be composed from the B I. Is B I a column or a row of this B matrix? I don't know. And therefore it could actually be the other way around. That's the information, it's not the sort of the tokens deciding where they want information from but it could be the tokens deciding where they want to send information to. But just from the notation I can sort of guess that it's the way that I described right here. But I hope you see the difference here. Before we had this dot product here each of these columns basically is an independent evaluation of this function that only considers X I and doesn't consider any of the X J that it wants information from. It simply goes by position. And they use for this, they use this basically this two layer, one hidden layer neural network right here. Two weight matrices and a non-linearity, a ReLU non-linearity. So they replace the dot product by simply learning what the attention pattern is going to be per individual token. Now they do it one step further. They say okay so we've already lost the dependency basically on what the input sequence tokens here are. Can't we also just kind of lose the dependency of what the output token sequences here are? So what they propose in their second variant, this random synthesizer, is the following. Why don't we just learn how the information is going to be routed, irrespective of which tokens come in? We're just gonna learn this and it's going to be one routing pattern for all of the possible input output sequences. It's just going to be this routing pattern. So they have actually two variants. First one where it is really just random, like they just leave it random and they don't even train it. And the second one where they train this thing. But these things now have nothing to do with the tokens. They're just fixed and they are just global. So this would directly be, you learn this L by L matrix. So if this strikes you a bit in an odd way, because you kind of lose the dependency on your data in this routing pattern and it's not really routing anymore, and if you think that you've seen this before somewhere and you think, hey that looks like a feet forward layer from your very first MLP, then you would be absolutely correct. And I'm not sure why they don't point this out. I have a really hard time believing that they themselves tricked them into such a thing right here. So I can actually show it. So the question is how is this here, this dense synthesizer, is this still different or the same as a feet forward layer? And is this different or the same as a feet forward layer? So if you do the math and you look at what a feet forward layer is, in a feet forward layer, yi, my i-th entry in the output, is going to be a sum over all the inputs xj multiplied by a weight ij. So whenever I can represent something in this fashion, where I have a sum and then I have like a fixed weight that I learn and that has nothing to do with x, that is not dependent on x, multiplied by x, then it is a feet forward layer basically, or like a fancy feet forward layer. So let's look at the dense synthesizer. What does the dense synthesizer do? The dense synthesizer says yi is equal to a sum. Okay we're starting off, we're starting off well. And so it says g of xj, but this g usually is just a weight matrix where we compute the values. We said this was the values of x. So g is usually just a matrix, let's call it vw. And then here we have like some softmax thing. We have some softmax and the softmax is going to be over this dense pattern right here that we described here. And this pattern is going to be f of xj. So no, xi, f of xi. Is that correct? Xi and here is a j. Maybe. Yes, that's correct. And f, okay, it's like two, it's two layers, but we can basically say it's like a weight matrix. Because ultimately if we learn a neural network or a single layer, it doesn't really matter to the discussion here. So let's call this wb xi. So you see right here we do have a weighted sum over the xjs, but the weight that the weighted sum is using is dependent on xi right here. And therefore you can't represent this as just a feet forward layer right here. Of course if you have the full dot product attention, then in here would actually be a dot product between xj and xi, right? So xj transposed xi or something like this. So what about this random synthesizer? So the random synthesizer has yi, has a weighted sum over this wv xi, that's the values, softmax over this matrix R. And R is simply this L by L matrix right here. Now you can immediately see that this part right here is static, it doesn't depend on any x and it is learned as a joint function, right? So this, if I just call this w, wij, then I'm back to my formulation, right? I'm sorry, ij. Then I basically have my feet forward layer. So the random synthesizer is just a fancy way of writing a feet forward layer. Now of course if you're going to have the softmax you maybe have some different inductive biases in learning it, but ultimately it is a straightforward feet forward layer. At least that's what it looks like to me. I am very open to be convinced otherwise. Okay so they have this drawing right here on the left you see the vanilla transformer, the dense synthesizer in the middle where you kind of learn how to produce this matrix and then route the value through it. And on the right where you simply output this in a learned or actually completely random fashion and then route your values through that to the output. Okay now the question of course is, okay they also do factorize it, but this is not really the... this is more of a point where now you can actually, if you have such a matrix or you produce such a matrix, you can then factorize it into sort of lower dimensional matrices. And that is first of all to save space and it is also a regularizer because what you're essentially saying is you're applying an inductive prior to say I think these matrices have like some low level structure to them and if you factorize them that's a prior on that exactly. So you can factorize the dense and the random synthesizer into smaller matrices and that will save you parameters. And you can actually also mix two. So you can for example mix the random and the dense synthesizer. Now you have to pay attention it's not like an interpolation. If you mix random and dense you will have to learn the parameters of the random end of the dense synthesizer. So that's going to be like strictly more powerful than either one alone. They list everything here where they say the standard dot product attention. What we have is we have this formula right here you can actually formulate it in their framework. You condition on all the Xj for any Xi and ah see here I wrote this as Xj I was dumb. It should be the entire X. And there is interaction between the tokens and it's going to cost you 2d squared parameters. Now parameters are different from computation which if you don't do the dot product you also save a bunch of computation but here they look at a number of parameters. So in this random synthesizer you simply output this matrix R. It's global. There's no interaction and you are you are it's cost you L squared memory in L squared parameters. Now often in these models L and D are actually pretty similar. So L might be something like 512 tokens the length and the dimension right here might also be something like 512. So per se this is not really a saving in parameters only when you go to the to the factorized models right here. Can you bring in this K and K is this lower dimension of factorization and if K is much much smaller than L then you save a bunch of parameters. The dense synthesizer formula is like this. This is how you produce the attention matrix. You condition on XI but not Xj right? For each YI you condition on XI and you do not care about the Xjs. It is local that means it depends on XI so the routing actually depends on the information that goes through but there is no interaction and you're going into D squared plus DL which is also pretty much 2D squared. Or you go to this lower number here if you choose a good K. Alright now experiments. So they apply this and we are absolutely stoked how this is going to turn out. So they go on machine translation. Now okay before we go into the results do you think machine translation is a good or a bad task for this model? Okay I think it is a good task for this model. It is a very favorable task for this model. Why? Why is machine translation a favorable task? Well mostly in machine translation if you think about how information is routed. So I have a sequence of German. Let's call it or English let's call it the dog barks. And I have a sequence of German. Der Hund belt. Come on. Hund belt. Now okay first of all I know they are only talking about self-attention so this example here actually makes little sense in the actual practical applications but I just want to demonstrate why machine translation specifically has... So how would you route information here if you have to route information between the two things? What you would do is pretty deterministically do this right? So in machine translation what is very very very often the case is that mostly you're going to align the positions in the same way independent of the input. Specifically here you would always most of the time align the beginning with the beginning the end with the end and so on because for most languages especially similar languages like English and German the order of sentences and number of words per thing you need to express is going to be roughly the same. So if you did not know about even about what the sequences were or you only knew one of them like you only knew there and you have to guess where should information come from well I know in English you also start with like this what's this called an article yeah it yes this is an article showing my linguistic skills here you you would also you would also start with that right you would say I want most information from position zero obviously I don't care what there what what is there so I and again I know they only do it in self-attention so it actually makes no sense that I have two different languages here but machine translation is probably a task that lends itself very much to sort of global globally learned or only partially partial observably learned attention patterns because just because of the nature of the task right so let's keep that in mind and go to the go to the results right here now they first of all what they do is they list the original transformer paper and actually have it here because they have to they have this same experiment now this is the kind of transformer we're talking about right here and it is notable that this paper only proposes to replace the self attention that means the attention that would be within one of these two columns and not the attention that goes across from the left to the right right but still you can see that the attention that goes from the left to the right then in the next layer is going to end up as self-attention information right so my I think my argument still counts in the in this case in the machine translation case alright so they have this same experiment right here here yes they have English German translation and they their base model gets twenty seven point three and that's what they evaluate right here they list this twenty seven point three but they also say when we train it we get a bit of a higher number twenty seven point six seven and especially on English French they get a higher number than that but let's stick to English German for now now they also do language modeling which the original paper didn't do and record the perplexity right here okay so the first thing they point out is if we train the synthesizer with a fixed random matrix that means we just put a random routing and we do not we do not ever change it what's there to learn so if you want to learn something in the transformer there's still many things to learn there's the feet forward layers right there is the the value encoder and so on so it is it is reasonable to assume that the transformer could sort of learn to just handle the attend the routing pattern that is in place that did the rest of the model can sort of absorb that shock and interestingly you get on to twenty three point nine so almost twenty four blue points and I mean it seems they point out that it's fairly close if you look here this twenty four is actually pretty far away it's the worst the worst baseline right here in the original paper despite net had this twenty four blue I mean it's I guess it's cool to point out that it works as such but you know in these tasks actually many things work right with with if you distill this down to some sort of a bag of words model and so on I'm pretty sure you can get pretty pretty good results as well and you can get you know fairly you can go to twenty four blue actually have no clue of this field but I just want to point out just because the number is in the same ballpark doesn't mean that it is very astonishing it's maybe just you have so many parameters that the rest of the model can sort of absorb this shock of not of not being able to learn this and can just handle whatever pattern you put there it can just kind of work with it that's many people have observed if you like put just random junk in the lower layers of a CNN like random filters never train them you can still the rest of the network can adapt so that's basically this effect right here I don't think it's a testament to we don't need the dot product attention it's more like this this just happens in deep learning then however they say if we now learn this one matrix so we learn this routing but globally we get into twenty seven point two seven blue and this already seems fairly close right and you mainly need to compare with this number right here because that's actually the same training run and so on so but still it is quite it is quite a bit away it's point four blue points away and that is a sort of significant difference I think then they go further if they go to the dense synthesizer you can see right here the model size is lower than this one and they get twenty seven point four three now they get even closer right and they are actually on par if they mix random and dense right here and you can see that it's also almost the same amount of parameters and when they mix these random and vanilla so what they now have is the dot product attention plus a purely global feed-forward sort of like a bias of what to route where then they can out compete this original model but also now they have more parameters right so this model you would expect it to be you know strictly better than either of the two alone and it is and it is actually astounding that the synthesizer that mixes the vanilla with the dense even though it has even more parameters it does worse so with these sort of results especially then you go fiddle with like point one you know between this and that I know I said point four blow is a lot so point one must be something and it surely is but also it's always the question of how many hyper parameter tunings you put into something like this and generally you you should always sort of look at this if you were a researcher had to put the best possible numbers here what would you do and then you correct for that in your mind for how much it might actually work if you if you are to if you are to you know go ahead and and train that on your data but nevertheless it gives some cool insights right what I'm a bit confused by is that if you sort of look at the original paper and you look at the perplexities and they have a table down here where they compare a bunch of their instantiations of their model and you compare the comparison the perplexity on a language modeling task and the perplexity here seems to correlate extremely well with the blue score right where as the perplexity here if you look at the perplexities over here they do correlate but I somehow I have the feeling they don't really correlate as much here which sort of speaks to the fact that you're going to see in the rest of the paper that these models they tend to sometimes be able to do well but then other times not and it's not really clear super clear when so look at this for example they now apply their models to summarization and dialogue generation right these are two tasks where you need to output text and you can see that the results are all over the place so in this metric Rouge to and Rouge is sort of an engram overlap metric between gold standards and what you produce in this metric the original transformer is best but in Rouge one this synthesizer mixed here is the best and in Rouge L this one is the best and in dialogue generation all of them are actually not as good as this one right here where it's just the dense which is strictly less powerful than the ones on the bottom but so as you as you can see yeah I think what you should take away from this is that it it is interesting that it sometimes works but it seems to be a fair bit of shakiness to these to these results okay now they go on and they test this on super glue and this is a benchmark so glue and super glue they consist of these different tasks right here and now we are out of the text generation game we are in the game of for example you have two sentences and you need to decide which which one is like which one entails the other or are they contradictory or things like this so it's more of a late say a classification task and people apply different models so it's no longer a text generation task so they switch model instead of the vanilla transformer from the attention is all you need paper they now go on to the t5 the text to text transformer and they change they simply take the architecture and they change the attention in there with their attention and you can see right here that the results are quite different than before so in every single case either the t5 model the base model with the dot product attention is the best model or the synthesizer but including V so plus V means plus vanilla means it also has the dot product attention plus this learned thing right here okay so our is now the learned I think the learned right I would be surprised if it was the random random but it could also be but in any case it's strictly better right it's strictly more powerful model and the only way you can actually perform worse is when you know it's too many parameters and so on and they kind of take stuff from each other and there is effects where more parameters can hurt you but never is any model that doesn't have the dot product attention on on top and these authors here argue that that's this can be largely attributed to the fact that the encoder self-attention in the t5 setting also functions as a cross-sentence attention so what do they mean here if in the t5 is just as I understand it this is just like an encoder like Bert so imagine imagine maybe this is Bert right what Bert is simply an encoder only transformer that means you here you put in your sequence and out again comes a sequence and you have like a special token that you use for classification and so on so this is less when you have to generate text but more when you want to classify text or things like this find something in a text and what you would do if you have two sentences you need to decide something about them you put the first sentence here and then you say you put like a separator token here this usually called like a separator token and then you put the second sentence here is you just concatenate them and you let them go into the transformer and they argue that if you do self-attention on this entire sequence then you get attention patterns like this and this is sort of like cross-attention between sequences right it's not really self-attention and that's why their method doesn't work because it basically deals with self-attention but I'm not really buying that argument I mean if this is a sequence it is if this is one sequence this is self-attention and if you were going to argue that out of the blue a token in your case like in your original formulation can simply you know just by looking at itself know where where which position it wants the information from and certainly here this token could also learn that it wants information from over here or from the first word here I don't I don't really see the difference maybe maybe you need to somehow standardize where this separator token is so that it's always in the same place and that the second sentence always starts at the same place but if you have that then I really don't see any difference in the argument you can make here that this shouldn't work as much as the others what I think is happening is that this task is simply involves more difficult reasoning involves more routing of information like dynamic routing that's actually dependent on what's in the tasks rather than something like machine translation which most of the time has some global routing bias like like some some pattern that works pretty well across all alright so the last part here is where they kind of introspect the model and in the in the first thing they say okay we look at the distribution of weights so these are the weights the weights in the decoder at the beginning of training and you can already see that the standard transformer weights are and the synthesizer weights are different from the sorry the dense synthesizer weights are different from the random synthesizer weights and this probably is mostly due to the fact of how you initialize like these deep learning frameworks if you have a matrix they will look at what's this dimension what's this dimension and calculate how they have to initialize it such that sort of the the total norm of a random vector that goes through stays the same sorry the vector would go through like it would go in here and out there so you see if it changes dimension then if you just randomly initialize with all the same like every matrix with the same number then like with the normal distribution then the in this case the vector would gain in norm and to account for that you initialize the matrices such that the vector norms approximately stay the same and this is why there I guess why there are different initializations here and you can see this at the end of the training now these in in different layers right here it's pretty much always the same pattern that they they say they just remark it so this this is what I find weird they just say what the graphs show they don't interpret it like I would expect something like oh this pattern is exactly what we would expect from our model because something something something right like if they claim that this attention is being able to be learned I just don't see why they do this stuff they simply point out oh yeah this this is higher here and this is higher here but I don't even see that as too interesting given that is this is how you initialize it like if you shift everything to the left of it and you know this is a wall so it like this piles up here then this is exactly what turns out I don't I don't see you know what what this is supposed to mean especially since they don't make any claim of what it is supposed to mean and the same here they say the effect of the number of heads okay we we investigate the effect and the number of heads on the random synthesizer models you know and they train the number of heads now somewhere in the text they say I remember they say since you know since we don't dynamically route it is very important for our models very crucial to have many attention heads right such that basically you don't have one routing pattern you have many routing patterns that you learn globally so they say it's very important for our model to have many attention heads and I guess that's what they're trying to demonstrate here but again they simply say what's happening they don't interpret it and and they don't compare it to anything they just you know put it here they just put the number and I don't like is this good is this is this bad can you compare it to something and also here in the so here in the original paper they do the same thing here as you can see the number H is the heads and they do ablate this but at the same time they adjust the dimensions of the key and value vectors such that in total they have the same amount of parameters right so they can really investigate is one big attention head better or worse than many small attention heads is there a trade-off and they find here that there is a bit of a trade-off like there is a sweet spot you don't want too many don't want too much because they get too small something like this but first we like we don't know whether or not have they simply changed the heads but left every other parameter the same or have they also adjusted the dimension because if they haven't adjusted the dimensions then this this increase would be absolutely expected because you now have more parameters and if they have adjusted then it can we compare this to you know something because this here is the this is the t5 small this is not the original transformer like is this big is this small and what does it say about the claim that you made that the number of heads is so important for your model can you validate this using this so it's just a bit of like this entire page here it's just they just measure some things and then they state them here and you're somehow supposed to guess what they mean by stating that here okay but that was enough for me ranting so they give some supplementary material right here but in essence what I like about the paper is sort of the thinking that goes into this thinking outside the box asking the fundamental questions about these models do we really need this what do they do I don't think it's super well investigated really from a scientific point like the formulation of hypotheses it simply trains these things and then make some claims but the claims interact you know with the number of parameters here and so on so and they're sort of noisy all around and of course the fact that this thing here turns out to be a fully connected layer in disguise is also pretty funny but I get it it's a fan it's like it's it's more it's not exactly the same thing but it you know yeah all right so that was my take on this paper if you have a different one let me know in the comments for sure I read all of them and at least I try and I've always succeeded so far all right I'll see you next time bye bye
[ { "start": 0, "end": 5.72, "text": " Hi there! Today we're looking at synthesizer rethinking self-attention in" }, { "start": 5.72, "end": 12.120000000000001, "text": " transformer models by Yi Tai, Dara Barry, Donald Metzler, Da Cheng Chuan," }, { "start": 12.120000000000001, "end": 17.400000000000002, "text": " Chih-Zhao and Chih-Ching. These people are of Google research and on a high level" }, { "start": 17.400000000000002, "end": 22.28, "text": " they're trying to replace the self-attention mechanism which is" }, { "start": 22.28, "end": 28.68, "text": " currently a dot product mechanism in a transformer by a sort of a learned" }, { "start": 28.68, "end": 33.6, "text": " attention mechanism, therefore eliminating this expensive dot product." }, { "start": 33.6, "end": 41.32, "text": " They test the model and conclude that it sometimes works a bit. So the results" }, { "start": 41.32, "end": 46.04, "text": " are sort of inconclusive. But that's the paper on a high level and it's" }, { "start": 46.04, "end": 50.480000000000004, "text": " fairly cool to go through. As always, if you like content like this, consider" }, { "start": 50.480000000000004, "end": 53.08, "text": " subscribing and sharing it out." }, { "start": 53.08, "end": 59.12, "text": " Alright, so they say the dot product self-attention is known to be central and" }, { "start": 59.12, "end": 63.08, "text": " indispensable to state-of-the-art transformer models. If you don't know" }, { "start": 63.08, "end": 67.64, "text": " what a transformer is, it's best I made a video on the attention is all you need" }, { "start": 67.64, "end": 71.6, "text": " paper and that explains what a transformer is and what an attention" }, { "start": 71.6, "end": 77.72, "text": " mechanism is in detail. But they are right. Of course the attention mechanism" }, { "start": 77.72, "end": 84.24, "text": " that is via the dot product of queries and keys is pretty much what makes" }, { "start": 84.24, "end": 90.68, "text": " transformers transformers. And they here ask is it really required? Which is a" }, { "start": 90.68, "end": 97.12, "text": " bold question in light of that, right? They say they investigate whether or" }, { "start": 97.12, "end": 102.56, "text": " not you really need this and they say via extensive experiments we find" }, { "start": 102.56, "end": 108.16, "text": " that first random alignment matrices surprisingly perform quite" }, { "start": 108.16, "end": 114.36, "text": " competitively and two, learning attention weights from token-token, that means" }, { "start": 114.36, "end": 119.68, "text": " query key interactions, which is this dot product interaction, is not that" }, { "start": 119.68, "end": 125.48, "text": " important after all. Okay, they propose this new model called synthesizer, a" }, { "start": 125.48, "end": 130.16, "text": " model that learns synthetic attention weights without token-token interactions." }, { "start": 130.16, "end": 134.6, "text": " Our experimental results show that synthesizer is competitive against even" }, { "start": 134.6, "end": 137.28, "text": " NILA transformer models across a range of tasks." }, { "start": 137.28, "end": 146.4, "text": " Okay, so let's dive in. So what is different here? They're basically" }, { "start": 146.4, "end": 155.56, "text": " saying look in each transformer layer boils down to something like" }, { "start": 155.56, "end": 163.36, "text": " this, where you have an input sequence X right here and you want to get an output" }, { "start": 163.36, "end": 169.84, "text": " sequence Y. And in order to do that you need some sort of this thing, which is" }, { "start": 169.84, "end": 175.44, "text": " the attention matrix, multiplied by this thing, which are called the values. And" }, { "start": 175.44, "end": 181.52, "text": " we'll explore that a bit deeper over here. So in these transformers it's" }, { "start": 181.52, "end": 187.16, "text": " always kind of helpful to visualize yourself the input sequence as sort of" }, { "start": 187.16, "end": 195.64000000000001, "text": " nodes. And so this would be one layer, we have a five length sequence and we" }, { "start": 195.64000000000001, "end": 199.76000000000002, "text": " want to transform it into the next length five sequence. And maybe it even" }, { "start": 199.76000000000002, "end": 207.60000000000002, "text": " helps to label maybe like A, B, C, D, E. You can just imagine kind of these, of course as" }, { "start": 207.6, "end": 211.6, "text": " you go up the layers it doesn't necessarily always correspond to the same" }, { "start": 211.6, "end": 217.51999999999998, "text": " input token. But the position labeling them is still pretty helpful, I find," }, { "start": 217.51999999999998, "end": 221.6, "text": " especially for things like BERT or something like this. So you want to" }, { "start": 221.6, "end": 228.95999999999998, "text": " transform the sequence that's incoming here into another sequence. And the" }, { "start": 228.95999999999998, "end": 234.6, "text": " basic mechanism in a transformer, if you go up the layers, is the routing" }, { "start": 234.6, "end": 240.04, "text": " of information. So you want to route information around the sequence and" }, { "start": 240.04, "end": 246.35999999999999, "text": " basically such that at the end the whole sequence knows about every word in the" }, { "start": 246.35999999999999, "end": 250.48, "text": " sentence, knows about every other word that there is in the sentence, knows" }, { "start": 250.48, "end": 254.76, "text": " about the associations between the other words and so on, such that you gain sort" }, { "start": 254.76, "end": 259.8, "text": " of, you start out with individual words and that the end, what you want, is sort" }, { "start": 259.8, "end": 264.6, "text": " of that every word has a pretty good idea of what's going on with every other" }, { "start": 264.6, "end": 269.64, "text": " word. And that's why you continuously, as you go up the layer, route around" }, { "start": 269.64, "end": 275.36, "text": " this information. Now the question is how do you route this information? How do you" }, { "start": 275.36, "end": 281.6, "text": " know which word goes to which other word? And here maybe the sentence starts with" }, { "start": 281.6, "end": 290.12, "text": " the word, let's call Sarah, okay? Sarah and then it goes on and at some point it" }, { "start": 290.12, "end": 302.12, "text": " says she. So she is the pronoun and we can also label these Sarah, she. So if we" }, { "start": 302.12, "end": 306.98, "text": " want to, if we think how do we route information, it would be" }, { "start": 306.98, "end": 313.20000000000005, "text": " beneficial for us if the information that there is a word Sarah here in the" }, { "start": 313.20000000000005, "end": 318.32, "text": " sentence would be routed to the word she, because the word she, it's a pronoun, it" }, { "start": 318.32, "end": 324.08000000000004, "text": " knows I'm a pronoun and if there is like a person in the sentence that would be" }, { "start": 324.08000000000004, "end": 327.68, "text": " valuable information for me, like to know what's kind of going on and to" }, { "start": 327.68, "end": 332.72, "text": " understand myself better. Basically every word wants to understand itself and it" }, { "start": 332.72, "end": 337.44000000000005, "text": " kind of calls out for information from the other words. In a transformer this is" }, { "start": 337.44000000000005, "end": 341.28000000000003, "text": " done via what this paper calls this dot product attention and that's the" }, { "start": 341.28000000000003, "end": 349.04, "text": " follows. Every word, every token emits what is called a key and a value and the" }, { "start": 349.04, "end": 353.06, "text": " key and the value are just two vectors. So every word is going to emit two" }, { "start": 353.06, "end": 359.12, "text": " vectors. I'm going to draw one at the bottom here and I'm going to draw one at" }, { "start": 359.12, "end": 368.64, "text": " the top. Like that. So you can imagine the key as sort of the word advertising" }, { "start": 368.64, "end": 375.12, "text": " what it is to other words and so these are the keys down here and you, sorry, the" }, { "start": 375.12, "end": 380.72, "text": " top, I think I called it value, that's wrong, it's called a query. You can" }, { "start": 380.72, "end": 386.64, "text": " imagine the query as a word asking, describing what it wants from others to" }, { "start": 386.64, "end": 392.96, "text": " know. So in that case you'll see that the vector here and the vector here," }, { "start": 392.96, "end": 398.88, "text": " these are now routed by dot product. So the ones that align in the dot product," }, { "start": 398.88, "end": 403.2, "text": " in the angle, they will be routed to each other. So this would be routed here and" }, { "start": 403.2, "end": 410.36, "text": " maybe, you know, okay I drew this, this one would be routed here and the others" }, { "start": 410.36, "end": 418.2, "text": " would be kind of routed some a bit here and a bit here maybe. Okay it gets" }, { "start": 418.2, "end": 422.72, "text": " fuzzy but you get the concept. But in order to do that you basically need to" }, { "start": 422.72, "end": 430, "text": " pull to put the dot product from every single key with every value, sorry, query." }, { "start": 430, "end": 435, "text": " And that gives you basically this quadratic dot product that these" }, { "start": 435, "end": 442.44, "text": " transformers have and that's expensive. Okay so they have a little picture here." }, { "start": 442.44, "end": 449.4, "text": " This is what a vanilla transformer does. Every input here emits two things, a" }, { "start": 449.4, "end": 454.8, "text": " query and a key and then there's the dot product attention to decide what's this" }, { "start": 454.8, "end": 461.88, "text": " attention matrix. Okay now this attention matrix is then used to aggregate these" }, { "start": 461.88, "end": 467.6, "text": " values. So actually every token emits three things, also this value here, which" }, { "start": 467.6, "end": 474.84, "text": " is basically, it's not that important but this just describes the information that" }, { "start": 474.84, "end": 479.28, "text": " you want to pass on to the next layer and then it goes through this routing" }, { "start": 479.28, "end": 484, "text": " right here that routes the information to the correct output places and you get" }, { "start": 484, "end": 489.96, "text": " your output. Now what they propose is something different. They propose this" }, { "start": 489.96, "end": 494.64, "text": " dense synthesizer right here where instead of the dot product attention" }, { "start": 494.64, "end": 503.84, "text": " every single input here emits a basically a row of this matrix" }, { "start": 503.84, "end": 509.52, "text": " directly without having to go through the dot product. That helps a bit if you" }, { "start": 509.52, "end": 516.28, "text": " imagine it in our little framework here. So let's draw this again and let's see" }, { "start": 516.28, "end": 521.24, "text": " what this synthesizer, by the way they call this the dense synthesizer because" }, { "start": 521.24, "end": 526.04, "text": " they have another variant as well. Okay here is our sequence, the lower" }, { "start": 526.04, "end": 530.0799999999999, "text": " layer we want to transform it in the upper layer. This is the Sarah node" }, { "start": 530.0799999999999, "end": 540.4399999999999, "text": " and this is the she node. So how do we route information now?" }, { "start": 540.44, "end": 549.4000000000001, "text": " Okay I missed that. In the dense synthesizer framework every token just" }, { "start": 549.4000000000001, "end": 556.72, "text": " gets to output, basically it already gets to output where it wants information" }, { "start": 556.72, "end": 567.8000000000001, "text": " from. So every single token here gets to output where it wants information to" }, { "start": 567.8, "end": 573.4399999999999, "text": " come from and by where because in the original transformer the where was" }, { "start": 573.4399999999999, "end": 578.68, "text": " basically defined by these inner product. Now the where is just defined by the" }, { "start": 578.68, "end": 585.76, "text": " position. So it just says I want information from position 2 and 3 or" }, { "start": 585.76, "end": 591.12, "text": " this node here could say I want information from position 5 and 3." }, { "start": 591.12, "end": 597.4399999999999, "text": " And this is dependent on which token there is. So each token looks at" }, { "start": 597.44, "end": 603.36, "text": " itself and in the case here of she you can imagine this token says well I'm a" }, { "start": 603.36, "end": 610.08, "text": " pronoun therefore I may be referring to a person and I know that in the English" }, { "start": 610.08, "end": 614.6400000000001, "text": " language a person is often at the beginning of the sentence and therefore I" }, { "start": 614.6400000000001, "end": 621.36, "text": " certainly want information from token from position 0. It doesn't see that" }, { "start": 621.36, "end": 628.8000000000001, "text": " there is this word Sarah here. It simply can see only the positions 0, 1, 2, 3, 4." }, { "start": 628.8000000000001, "end": 635.4, "text": " So it will output, it will basically output, each token here will output an" }, { "start": 635.4, "end": 641.6, "text": " L dimensional vector and L here is the length of the sequence. An L dimensional" }, { "start": 641.6, "end": 646.76, "text": " vector that already defines the distribution of how you want the" }, { "start": 646.76, "end": 650.52, "text": " information. So I want lots of that and then not much of that and maybe it wants" }, { "start": 650.52, "end": 655.4399999999999, "text": " a bit of that and then not much of that. So each word up here is going to" }, { "start": 655.4399999999999, "end": 662.56, "text": " emit this L dimensional vector. So each word, each token decides for itself" }, { "start": 662.56, "end": 668.6999999999999, "text": " where it wants information to come from based purely on what the token" }, { "start": 668.6999999999999, "end": 674, "text": " itself is. And of course in the higher layers this information, like the" }, { "start": 674, "end": 677.56, "text": " information of what the token is and what else is there gets aggregated and" }, { "start": 677.56, "end": 682.4799999999999, "text": " that's how computation happens. But in a fundamental level each node looks at" }, { "start": 682.4799999999999, "end": 687.92, "text": " itself and decides where do I want information from just given what I am" }, { "start": 687.92, "end": 694.76, "text": " and not what others are. So this results in you not having to do this" }, { "start": 694.76, "end": 698.8, "text": " dot product attention. But of course you lose the information of what's down here." }, { "start": 698.8, "end": 709.7199999999999, "text": " You simply go on the positions of the nodes and they formalize this" }, { "start": 709.7199999999999, "end": 714.56, "text": " like this. So they basically say okay each transformer mechanism needs" }, { "start": 714.56, "end": 721.64, "text": " some sort of a softmax over this matrix B right here. This is" }, { "start": 721.64, "end": 727.8, "text": " this routing matrix and then G of X is just the values of X. So G is often just" }, { "start": 727.8, "end": 733.4, "text": " a linear function. And they say well this B here in the classic transformer is" }, { "start": 733.4, "end": 738.7199999999999, "text": " computed via this dot product attention. Can't we just simply have a function" }, { "start": 738.7199999999999, "end": 747.3599999999999, "text": " right here that just outputs the B given an X. So you see here XI" }, { "start": 747.3599999999999, "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.12, "text": " is L. So if you imagine this is the sequence length, every XI" }, { "start": 762.12, "end": 769.6, "text": " is a vector here of dimension D. Sort of like a word embedding." }, { "start": 769.6, "end": 776.4399999999999, "text": " Now what you want to do is you want to take each individually, run it through" }, { "start": 776.44, "end": 786.1600000000001, "text": " the function F and then get out an L dimensional vector." }, { "start": 786.1600000000001, "end": 792.5600000000001, "text": " This is of dimension L. And if you do this with enough of the with all of the X's" }, { "start": 792.5600000000001, "end": 799.6400000000001, "text": " you'll get an L by L matrix which basically is now your routing matrix." }, { "start": 799.6400000000001, "end": 805.6400000000001, "text": " So this thing tells you that this particular piece in the input" }, { "start": 805.64, "end": 810.8, "text": " sequence wants how much information from this particular piece in the output" }, { "start": 810.8, "end": 815.6, "text": " sequence or vice versa. See this is the problem here. They don't really" }, { "start": 815.6, "end": 823.3199999999999, "text": " specify this B, how this B matrix will be composed from the B I." }, { "start": 823.3199999999999, "end": 830, "text": " Is B I a column or a row of this B matrix? I don't know. And therefore it" }, { "start": 830, "end": 835.84, "text": " could actually be the other way around. That's the information, it's not the" }, { "start": 835.84, "end": 842.44, "text": " sort of the tokens deciding where they want information from but it could be" }, { "start": 842.44, "end": 847.88, "text": " the tokens deciding where they want to send information to. But just from the" }, { "start": 847.88, "end": 853.52, "text": " notation I can sort of guess that it's the way that I described right here. But" }, { "start": 853.52, "end": 858, "text": " I hope you see the difference here. Before we had this dot product" }, { "start": 858, "end": 863.52, "text": " here each of these columns basically is an independent evaluation of this" }, { "start": 863.52, "end": 869.52, "text": " function that only considers X I and doesn't consider any of the X J that it" }, { "start": 869.52, "end": 875.4, "text": " wants information from. It simply goes by position. And they use for this, they use" }, { "start": 875.4, "end": 882.96, "text": " this basically this two layer, one hidden layer neural network right here. Two" }, { "start": 882.96, "end": 889.84, "text": " weight matrices and a non-linearity, a ReLU non-linearity. So they replace the" }, { "start": 889.84, "end": 895.1600000000001, "text": " dot product by simply learning what the attention pattern is going to be per" }, { "start": 895.1600000000001, "end": 901.84, "text": " individual token. Now they do it one step further. They say okay so we've" }, { "start": 901.84, "end": 907.9200000000001, "text": " already lost the dependency basically on what the input sequence" }, { "start": 907.9200000000001, "end": 912.84, "text": " tokens here are. Can't we also just kind of lose the dependency of what the" }, { "start": 912.84, "end": 918.08, "text": " output token sequences here are? So what they propose in their second variant," }, { "start": 918.08, "end": 928.9200000000001, "text": " this random synthesizer, is the following. Why don't we just learn how" }, { "start": 928.9200000000001, "end": 934.76, "text": " the information is going to be routed, irrespective of which tokens come in?" }, { "start": 934.76, "end": 939.0400000000001, "text": " We're just gonna learn this and it's going to be one routing" }, { "start": 939.04, "end": 945.5999999999999, "text": " pattern for all of the possible input output sequences. It's just going" }, { "start": 945.5999999999999, "end": 949.7199999999999, "text": " to be this routing pattern. So they have actually two variants. First one where it" }, { "start": 949.7199999999999, "end": 953.92, "text": " is really just random, like they just leave it random and they don't even" }, { "start": 953.92, "end": 958.7199999999999, "text": " train it. And the second one where they train this thing. But these things now" }, { "start": 958.7199999999999, "end": 965.7199999999999, "text": " have nothing to do with the tokens. They're just fixed and they are just" }, { "start": 965.72, "end": 972.12, "text": " global. So this would directly be, you learn this L by L" }, { "start": 972.12, "end": 978.36, "text": " matrix. So if this strikes you a bit in an odd way, because you kind of" }, { "start": 978.36, "end": 983.84, "text": " lose the dependency on your data in this routing pattern and it's not really" }, { "start": 983.84, "end": 988.96, "text": " routing anymore, and if you think that you've seen this before somewhere" }, { "start": 988.96, "end": 997.36, "text": " and you think, hey that looks like a feet forward layer from your" }, { "start": 997.36, "end": 1003.48, "text": " very first MLP, then you would be absolutely correct. And I'm not sure why" }, { "start": 1003.48, "end": 1008.8000000000001, "text": " they don't point this out. I have a really hard time believing that" }, { "start": 1008.8000000000001, "end": 1014.9200000000001, "text": " they themselves tricked them into such a thing right here. So I can" }, { "start": 1014.92, "end": 1022.88, "text": " actually show it. So the question is how is this here, this dense" }, { "start": 1022.88, "end": 1028.36, "text": " synthesizer, is this still different or the same as a feet" }, { "start": 1028.36, "end": 1034.1599999999999, "text": " forward layer? And is this different or the same as a feet forward layer? So if" }, { "start": 1034.1599999999999, "end": 1040.32, "text": " you do the math and you look at what a feet forward layer is, in a" }, { "start": 1040.32, "end": 1047.24, "text": " feet forward layer, yi, my i-th entry in the output, is going to be a sum" }, { "start": 1047.24, "end": 1057.6599999999999, "text": " over all the inputs xj multiplied by a weight ij. So whenever I can" }, { "start": 1057.6599999999999, "end": 1062.52, "text": " represent something in this fashion, where I have a sum and then I have like" }, { "start": 1062.52, "end": 1068.6, "text": " a fixed weight that I learn and that has nothing to do with x, that is not" }, { "start": 1068.6, "end": 1074.56, "text": " dependent on x, multiplied by x, then it is a feet forward layer basically, or" }, { "start": 1074.56, "end": 1081.28, "text": " like a fancy feet forward layer. So let's look at the dense synthesizer. What does" }, { "start": 1081.28, "end": 1086.6, "text": " the dense synthesizer do? The dense synthesizer says yi is equal to a sum." }, { "start": 1086.6, "end": 1096.7199999999998, "text": " Okay we're starting off, we're starting off well. And so it says g of xj," }, { "start": 1096.72, "end": 1103.24, "text": " but this g usually is just a weight matrix where we compute the values." }, { "start": 1103.24, "end": 1109.48, "text": " We said this was the values of x. So g is usually just a matrix, let's call it" }, { "start": 1109.48, "end": 1120.28, "text": " vw. And then here we have like some softmax thing. We have some softmax" }, { "start": 1120.28, "end": 1125.6000000000001, "text": " and the softmax is going to be over this dense pattern right here that we" }, { "start": 1125.6, "end": 1143.9199999999998, "text": " described here. And this pattern is going to be f of xj. So no, xi, f of" }, { "start": 1143.92, "end": 1156.6000000000001, "text": " xi. Is that correct? Xi and here is a j. Maybe. Yes, that's correct. And f, okay," }, { "start": 1156.6000000000001, "end": 1163.64, "text": " it's like two, it's two layers, but we can basically say it's like a weight" }, { "start": 1163.64, "end": 1169.24, "text": " matrix. Because ultimately if we learn a neural network or a single layer, it" }, { "start": 1169.24, "end": 1177.68, "text": " doesn't really matter to the discussion here. So let's call this wb xi. So you" }, { "start": 1177.68, "end": 1186.68, "text": " see right here we do have a weighted sum over the xjs, but the weight that the" }, { "start": 1186.68, "end": 1194.1200000000001, "text": " weighted sum is using is dependent on xi right here. And therefore you can't" }, { "start": 1194.12, "end": 1201.1599999999999, "text": " represent this as just a feet forward layer right here. Of course if you have" }, { "start": 1201.1599999999999, "end": 1207.1999999999998, "text": " the full dot product attention, then in here would actually be a dot product" }, { "start": 1207.1999999999998, "end": 1216.6799999999998, "text": " between xj and xi, right? So xj transposed xi or something like this. So" }, { "start": 1216.68, "end": 1225.48, "text": " what about this random synthesizer? So the random synthesizer has yi, has a" }, { "start": 1225.48, "end": 1237.8400000000001, "text": " weighted sum over this wv xi, that's the values, softmax over this matrix R. And R" }, { "start": 1237.8400000000001, "end": 1243.68, "text": " is simply this L by L matrix right here. Now you can immediately see that this" }, { "start": 1243.68, "end": 1249.8400000000001, "text": " part right here is static, it doesn't depend on any x and it is learned as a" }, { "start": 1249.8400000000001, "end": 1260.2, "text": " joint function, right? So this, if I just call this w, wij, then I'm back to my" }, { "start": 1260.2, "end": 1272.0800000000002, "text": " formulation, right? I'm sorry, ij. Then I basically have my feet forward layer. So" }, { "start": 1272.08, "end": 1277.08, "text": " the random synthesizer is just a fancy way of writing a feet forward layer. Now" }, { "start": 1277.08, "end": 1279.6399999999999, "text": " of course if you're going to have the softmax you maybe have some different" }, { "start": 1279.6399999999999, "end": 1285.96, "text": " inductive biases in learning it, but ultimately it is a straightforward" }, { "start": 1285.96, "end": 1292.96, "text": " feet forward layer. At least that's what it looks like to me. I am very open to be" }, { "start": 1292.96, "end": 1298.72, "text": " convinced otherwise. Okay so they have this drawing right here on the left you" }, { "start": 1298.72, "end": 1303.72, "text": " see the vanilla transformer, the dense synthesizer in the middle where you kind" }, { "start": 1303.72, "end": 1308.1200000000001, "text": " of learn how to produce this matrix and then route the value through it. And on" }, { "start": 1308.1200000000001, "end": 1312.76, "text": " the right where you simply output this in a learned or actually completely" }, { "start": 1312.76, "end": 1319.2, "text": " random fashion and then route your values through that to the output. Okay" }, { "start": 1319.2, "end": 1325.24, "text": " now the question of course is, okay they also do factorize it, but this is not" }, { "start": 1325.24, "end": 1331.72, "text": " really the... this is more of a point where now you can actually, if you have such a" }, { "start": 1331.72, "end": 1336.84, "text": " matrix or you produce such a matrix, you can then factorize it into sort of" }, { "start": 1336.84, "end": 1340.72, "text": " lower dimensional matrices. And that is first of all to save space and it is" }, { "start": 1340.72, "end": 1344.76, "text": " also a regularizer because what you're essentially saying is you're applying an" }, { "start": 1344.76, "end": 1350.16, "text": " inductive prior to say I think these matrices have like some low level" }, { "start": 1350.16, "end": 1356.5600000000002, "text": " structure to them and if you factorize them that's a prior on that" }, { "start": 1356.5600000000002, "end": 1362.4, "text": " exactly. So you can factorize the dense and the random synthesizer into smaller" }, { "start": 1362.4, "end": 1368.0400000000002, "text": " matrices and that will save you parameters. And you can actually also" }, { "start": 1368.0400000000002, "end": 1375.0600000000002, "text": " mix two. So you can for example mix the random and the dense synthesizer. Now you" }, { "start": 1375.0600000000002, "end": 1379.0400000000002, "text": " have to pay attention it's not like an interpolation. If you mix random and" }, { "start": 1379.04, "end": 1383.56, "text": " dense you will have to learn the parameters of the random end of the" }, { "start": 1383.56, "end": 1389.04, "text": " dense synthesizer. So that's going to be like strictly more powerful than either" }, { "start": 1389.04, "end": 1395.72, "text": " one alone. They list everything here where they say the standard dot product" }, { "start": 1395.72, "end": 1400.36, "text": " attention. What we have is we have this formula right here you can actually" }, { "start": 1400.36, "end": 1408.08, "text": " formulate it in their framework. You condition on all the Xj for any Xi and" }, { "start": 1408.08, "end": 1420.4399999999998, "text": " ah see here I wrote this as Xj I was dumb. It should be the entire X. And there" }, { "start": 1420.4399999999998, "end": 1424.76, "text": " is interaction between the tokens and it's going to cost you 2d squared" }, { "start": 1424.76, "end": 1430.48, "text": " parameters. Now parameters are different from computation which if you don't do" }, { "start": 1430.48, "end": 1433.9199999999998, "text": " the dot product you also save a bunch of computation but here they look at a" }, { "start": 1433.92, "end": 1443.4, "text": " number of parameters. So in this random synthesizer you simply output this" }, { "start": 1443.4, "end": 1450.52, "text": " matrix R. It's global. There's no interaction and you are you are it's" }, { "start": 1450.52, "end": 1460.1200000000001, "text": " cost you L squared memory in L squared parameters. Now often in these models L" }, { "start": 1460.12, "end": 1465.56, "text": " and D are actually pretty similar. So L might be something like 512 tokens the" }, { "start": 1465.56, "end": 1470.4799999999998, "text": " length and the dimension right here might also be something like 512. So per" }, { "start": 1470.4799999999998, "end": 1477, "text": " se this is not really a saving in parameters only when you go to the to" }, { "start": 1477, "end": 1482.1599999999999, "text": " the factorized models right here. Can you bring in this K and K is this lower" }, { "start": 1482.1599999999999, "end": 1487.6, "text": " dimension of factorization and if K is much much smaller than L then you save a" }, { "start": 1487.6, "end": 1493.9599999999998, "text": " bunch of parameters. The dense synthesizer formula is like this. This" }, { "start": 1493.9599999999998, "end": 1499.3999999999999, "text": " is how you produce the attention matrix. You condition on XI but not Xj right?" }, { "start": 1499.3999999999999, "end": 1509.4399999999998, "text": " For each YI you condition on XI and you do not care about the Xjs. It is" }, { "start": 1509.4399999999998, "end": 1516.7199999999998, "text": " local that means it depends on XI so the routing actually depends on" }, { "start": 1516.72, "end": 1520.44, "text": " the information that goes through but there is no interaction and you're going" }, { "start": 1520.44, "end": 1528.6000000000001, "text": " into D squared plus DL which is also pretty much 2D squared. Or you" }, { "start": 1528.6000000000001, "end": 1535.6000000000001, "text": " go to this lower number here if you choose a good K. Alright now" }, { "start": 1535.6000000000001, "end": 1542.3600000000001, "text": " experiments. So they apply this and we are absolutely stoked how this is going" }, { "start": 1542.36, "end": 1549.76, "text": " to turn out. So they go on machine translation. Now okay before we go into" }, { "start": 1549.76, "end": 1556.6, "text": " the results do you think machine translation is a good or a bad task for" }, { "start": 1556.6, "end": 1563.56, "text": " this model? Okay I think it is a good task for this model. It is a very favorable" }, { "start": 1563.56, "end": 1569.6399999999999, "text": " task for this model. Why? Why is machine translation a favorable task? Well mostly" }, { "start": 1569.64, "end": 1574.3200000000002, "text": " in machine translation if you think about how information is routed. So I" }, { "start": 1574.3200000000002, "end": 1584.6000000000001, "text": " have a sequence of German. Let's call it or English let's call it" }, { "start": 1584.6, "end": 1600.28, "text": " the dog barks. And I have a sequence of German. Der Hund belt. Come on. Hund belt." }, { "start": 1600.28, "end": 1605.1999999999998, "text": " Now okay first of all I know they are only talking about self-attention so" }, { "start": 1605.1999999999998, "end": 1608.76, "text": " this example here actually makes little sense in the actual practical" }, { "start": 1608.76, "end": 1613.36, "text": " applications but I just want to demonstrate why machine translation" }, { "start": 1613.36, "end": 1619.9599999999998, "text": " specifically has... So how would you route information here if you have to route" }, { "start": 1619.9599999999998, "end": 1623.32, "text": " information between the two things? What you would do is pretty" }, { "start": 1623.32, "end": 1629.32, "text": " deterministically do this right? So in machine translation what is very very" }, { "start": 1629.32, "end": 1636, "text": " very often the case is that mostly you're going to align the positions in" }, { "start": 1636, "end": 1640.76, "text": " the same way independent of the input. Specifically here you would always most" }, { "start": 1640.76, "end": 1644.4, "text": " of the time align the beginning with the beginning the end with the end and so on" }, { "start": 1644.4, "end": 1649.08, "text": " because for most languages especially similar languages like English and" }, { "start": 1649.08, "end": 1654.64, "text": " German the order of sentences and number of words per thing you need to express" }, { "start": 1654.64, "end": 1661.32, "text": " is going to be roughly the same. So if you did not know about even about what" }, { "start": 1661.32, "end": 1668.6, "text": " the sequences were or you only knew one of them like you only knew there and you" }, { "start": 1668.6, "end": 1672.6399999999999, "text": " have to guess where should information come from well I know in English you" }, { "start": 1672.6399999999999, "end": 1680.6799999999998, "text": " also start with like this what's this called an article yeah it yes this is an" }, { "start": 1680.6799999999998, "end": 1685.9199999999998, "text": " article showing my linguistic skills here you you would also you would also" }, { "start": 1685.9199999999998, "end": 1690.9599999999998, "text": " start with that right you would say I want most information from position zero" }, { "start": 1690.9599999999998, "end": 1697.1999999999998, "text": " obviously I don't care what there what what is there so I and again I know they" }, { "start": 1697.2, "end": 1700.0800000000002, "text": " only do it in self-attention so it actually makes no sense that I have two" }, { "start": 1700.0800000000002, "end": 1705.72, "text": " different languages here but machine translation is probably a task that lends" }, { "start": 1705.72, "end": 1712.64, "text": " itself very much to sort of global globally learned or only partially" }, { "start": 1712.64, "end": 1718.24, "text": " partial observably learned attention patterns because just because of the" }, { "start": 1718.24, "end": 1726, "text": " nature of the task right so let's keep that in mind and go to the go to the" }, { "start": 1726, "end": 1731, "text": " results right here now they first of all what they do is they list the original" }, { "start": 1731, "end": 1735.52, "text": " transformer paper and actually have it here because they have to they have this" }, { "start": 1735.52, "end": 1742.72, "text": " same experiment now this is the kind of transformer we're talking about right" }, { "start": 1742.72, "end": 1747.36, "text": " here and it is notable that this paper only proposes to replace the self" }, { "start": 1747.36, "end": 1752.72, "text": " attention that means the attention that would be within one of these two columns" }, { "start": 1752.72, "end": 1758.32, "text": " and not the attention that goes across from the left to the right right but" }, { "start": 1758.32, "end": 1762.64, "text": " still you can see that the attention that goes from the left to the right then" }, { "start": 1762.64, "end": 1769.84, "text": " in the next layer is going to end up as self-attention information right so my I" }, { "start": 1769.84, "end": 1774.76, "text": " think my argument still counts in the in this case in the machine translation" }, { "start": 1774.76, "end": 1784.56, "text": " case alright so they have this same experiment right here here yes they have" }, { "start": 1784.56, "end": 1791.4, "text": " English German translation and they their base model gets twenty seven point" }, { "start": 1791.4, "end": 1794.8, "text": " three and that's what they evaluate right here they list this twenty seven" }, { "start": 1794.8, "end": 1801.2, "text": " point three but they also say when we train it we get a bit of a higher" }, { "start": 1801.2, "end": 1806.24, "text": " number twenty seven point six seven and especially on English French they get a" }, { "start": 1806.24, "end": 1813.32, "text": " higher number than that but let's stick to English German for now now they also" }, { "start": 1813.32, "end": 1819.96, "text": " do language modeling which the original paper didn't do and record the perplexity" }, { "start": 1819.96, "end": 1826.96, "text": " right here okay so the first thing they point out is if we train the synthesizer" }, { "start": 1826.96, "end": 1834.44, "text": " with a fixed random matrix that means we just put a random routing and we do not" }, { "start": 1834.44, "end": 1840.28, "text": " we do not ever change it what's there to learn so if you want to learn something" }, { "start": 1840.28, "end": 1842.8, "text": " in the transformer there's still many things to learn there's the feet" }, { "start": 1842.8, "end": 1851.16, "text": " forward layers right there is the the value encoder and so on so it is it is" }, { "start": 1851.16, "end": 1854.8400000000001, "text": " reasonable to assume that the transformer could sort of learn to just" }, { "start": 1854.84, "end": 1859.76, "text": " handle the attend the routing pattern that is in place that did the rest of" }, { "start": 1859.76, "end": 1865.48, "text": " the model can sort of absorb that shock and interestingly you get on to twenty" }, { "start": 1865.48, "end": 1871.72, "text": " three point nine so almost twenty four blue points and I mean it seems they" }, { "start": 1871.72, "end": 1877.56, "text": " point out that it's fairly close if you look here this twenty four is actually" }, { "start": 1877.56, "end": 1882.76, "text": " pretty far away it's the worst the worst baseline right here in the original" }, { "start": 1882.76, "end": 1889.16, "text": " paper despite net had this twenty four blue I mean it's I guess it's cool to" }, { "start": 1889.16, "end": 1895.64, "text": " point out that it works as such but you know in these tasks actually many things" }, { "start": 1895.64, "end": 1901.44, "text": " work right with with if you distill this down to some sort of a bag of words" }, { "start": 1901.44, "end": 1906.04, "text": " model and so on I'm pretty sure you can get pretty pretty good results as well" }, { "start": 1906.04, "end": 1912.28, "text": " and you can get you know fairly you can go to twenty four blue actually have no" }, { "start": 1912.28, "end": 1916.48, "text": " clue of this field but I just want to point out just because the number is in" }, { "start": 1916.48, "end": 1923.28, "text": " the same ballpark doesn't mean that it is very astonishing it's maybe just you" }, { "start": 1923.28, "end": 1929.68, "text": " have so many parameters that the rest of the model can sort of absorb this shock" }, { "start": 1929.68, "end": 1934.2, "text": " of not of not being able to learn this and can just handle whatever pattern you" }, { "start": 1934.2, "end": 1936.48, "text": " put there it can just kind of work with it" }, { "start": 1936.48, "end": 1942.44, "text": " that's many people have observed if you like put just random junk in the lower" }, { "start": 1942.44, "end": 1947.04, "text": " layers of a CNN like random filters never train them you can still the rest" }, { "start": 1947.04, "end": 1952.04, "text": " of the network can adapt so that's basically this effect right here I don't" }, { "start": 1952.04, "end": 1956.76, "text": " think it's a testament to we don't need the dot product attention it's more like" }, { "start": 1956.76, "end": 1965.04, "text": " this this just happens in deep learning then however they say if we now learn" }, { "start": 1965.04, "end": 1971.52, "text": " this one matrix so we learn this routing but globally we get into twenty seven" }, { "start": 1971.52, "end": 1977.76, "text": " point two seven blue and this already seems fairly close right and you mainly" }, { "start": 1977.76, "end": 1982.68, "text": " need to compare with this number right here because that's actually the same" }, { "start": 1982.68, "end": 1989.8799999999999, "text": " training run and so on so but still it is quite it is quite a bit away it's" }, { "start": 1989.8799999999999, "end": 1995, "text": " point four blue points away and that is a sort of significant difference I think" }, { "start": 1995, "end": 2005.8, "text": " then they go further if they go to the dense synthesizer you can see right here" }, { "start": 2005.8, "end": 2014.72, "text": " the model size is lower than this one and they get twenty seven point four three" }, { "start": 2014.72, "end": 2022.52, "text": " now they get even closer right and they are actually on par if they mix random" }, { "start": 2022.52, "end": 2031.04, "text": " and dense right here and you can see that it's also almost the same amount of" }, { "start": 2031.04, "end": 2038.8799999999999, "text": " parameters and when they mix these random and vanilla so what they now have" }, { "start": 2038.8799999999999, "end": 2045.04, "text": " is the dot product attention plus a purely global feed-forward sort of like" }, { "start": 2045.04, "end": 2051.92, "text": " a bias of what to route where then they can out compete this original model but" }, { "start": 2051.92, "end": 2058.16, "text": " also now they have more parameters right so this model you would expect it to be" }, { "start": 2058.16, "end": 2062.48, "text": " you know strictly better than either of the two alone and it is and it is" }, { "start": 2062.48, "end": 2068.96, "text": " actually astounding that the synthesizer that mixes the vanilla with the dense" }, { "start": 2068.96, "end": 2074.36, "text": " even though it has even more parameters it does worse so with these sort of" }, { "start": 2074.36, "end": 2078.8, "text": " results especially then you go fiddle with like point one you know between" }, { "start": 2078.8, "end": 2084.5600000000004, "text": " this and that I know I said point four blow is a lot so point one must be" }, { "start": 2084.5600000000004, "end": 2089.92, "text": " something and it surely is but also it's always the question of how many hyper" }, { "start": 2089.92, "end": 2096.32, "text": " parameter tunings you put into something like this and generally you you should" }, { "start": 2096.32, "end": 2101.7200000000003, "text": " always sort of look at this if you were a researcher had to put the best possible" }, { "start": 2101.7200000000003, "end": 2106.52, "text": " numbers here what would you do and then you correct for that in your mind for" }, { "start": 2106.52, "end": 2112.68, "text": " how much it might actually work if you if you are to if you are to you know go" }, { "start": 2112.68, "end": 2119.6, "text": " ahead and and train that on your data but nevertheless it gives some cool" }, { "start": 2119.6, "end": 2127.12, "text": " insights right what I'm a bit confused by is that if you sort of look at the" }, { "start": 2127.12, "end": 2131.6, "text": " original paper and you look at the perplexities and they have a table down" }, { "start": 2131.6, "end": 2135.88, "text": " here where they compare a bunch of their instantiations of their model and you" }, { "start": 2135.88, "end": 2142.56, "text": " compare the comparison the perplexity on a language modeling task and the" }, { "start": 2142.56, "end": 2147.04, "text": " perplexity here seems to correlate extremely well with the blue score" }, { "start": 2147.04, "end": 2152.08, "text": " right where as the perplexity here if you look at the perplexities over here" }, { "start": 2152.08, "end": 2159.2400000000002, "text": " they do correlate but I somehow I have the feeling they don't really correlate" }, { "start": 2159.2400000000002, "end": 2164.8, "text": " as much here which sort of speaks to the fact that you're going to see in the" }, { "start": 2164.8, "end": 2171.2000000000003, "text": " rest of the paper that these models they tend to sometimes be able to do well but" }, { "start": 2171.2000000000003, "end": 2177.6400000000003, "text": " then other times not and it's not really clear super clear when so look at this" }, { "start": 2177.6400000000003, "end": 2184.1600000000003, "text": " for example they now apply their models to summarization and dialogue generation" }, { "start": 2184.1600000000003, "end": 2189.44, "text": " right these are two tasks where you need to output text and you can see that the" }, { "start": 2189.44, "end": 2194.1600000000003, "text": " results are all over the place so in this metric Rouge to and Rouge is sort" }, { "start": 2194.16, "end": 2199.44, "text": " of an engram overlap metric between gold standards and what you produce in this" }, { "start": 2199.44, "end": 2206.04, "text": " metric the original transformer is best but in Rouge one this synthesizer mixed" }, { "start": 2206.04, "end": 2211.72, "text": " here is the best and in Rouge L this one is the best and in dialogue generation" }, { "start": 2211.72, "end": 2216.56, "text": " all of them are actually not as good as this one right here where it's just the" }, { "start": 2216.56, "end": 2221.52, "text": " dense which is strictly less powerful than the ones on the bottom but so as" }, { "start": 2221.52, "end": 2226.8, "text": " you as you can see yeah I think what you should take away from this is that it it" }, { "start": 2226.8, "end": 2233.04, "text": " is interesting that it sometimes works but it seems to be a fair bit of" }, { "start": 2233.04, "end": 2240.92, "text": " shakiness to these to these results okay now they go on and they test this on" }, { "start": 2240.92, "end": 2246.16, "text": " super glue and this is a benchmark so glue and super glue they consist of" }, { "start": 2246.16, "end": 2252.08, "text": " these different tasks right here and now we are out of the text generation game" }, { "start": 2252.08, "end": 2256.44, "text": " we are in the game of for example you have two sentences and you need to" }, { "start": 2256.44, "end": 2262, "text": " decide which which one is like which one entails the other or are they" }, { "start": 2262, "end": 2266.2799999999997, "text": " contradictory or things like this so it's more of a late say a classification" }, { "start": 2266.2799999999997, "end": 2271.44, "text": " task and people apply different models so it's no longer a text generation task" }, { "start": 2271.44, "end": 2276.2400000000002, "text": " so they switch model instead of the vanilla transformer from the attention" }, { "start": 2276.2400000000002, "end": 2282.48, "text": " is all you need paper they now go on to the t5 the text to text transformer and" }, { "start": 2282.48, "end": 2287.08, "text": " they change they simply take the architecture and they change the" }, { "start": 2287.08, "end": 2294.44, "text": " attention in there with their attention and you can see right here that the" }, { "start": 2294.44, "end": 2301.12, "text": " results are quite different than before so in every single case either the t5" }, { "start": 2301.12, "end": 2307.3599999999997, "text": " model the base model with the dot product attention is the best model or" }, { "start": 2307.3599999999997, "end": 2315.08, "text": " the synthesizer but including V so plus V means plus vanilla means it also has" }, { "start": 2315.08, "end": 2322.56, "text": " the dot product attention plus this learned thing right here okay so our is" }, { "start": 2322.56, "end": 2326.44, "text": " now the learned I think the learned right I would be surprised if it was the" }, { "start": 2326.44, "end": 2332.52, "text": " random random but it could also be but in any case it's strictly better right" }, { "start": 2332.52, "end": 2337.88, "text": " it's strictly more powerful model and the only way you can actually perform" }, { "start": 2337.88, "end": 2341.92, "text": " worse is when you know it's too many parameters and so on and they kind of" }, { "start": 2341.92, "end": 2346.04, "text": " take stuff from each other and there is effects where more parameters can hurt" }, { "start": 2346.04, "end": 2352.6, "text": " you but never is any model that doesn't have the dot product attention on on top" }, { "start": 2352.6, "end": 2360.8399999999997, "text": " and these authors here argue that that's this can be largely attributed to the" }, { "start": 2360.8399999999997, "end": 2365.7599999999998, "text": " fact that the encoder self-attention in the t5 setting also functions as a" }, { "start": 2365.7599999999998, "end": 2372.68, "text": " cross-sentence attention so what do they mean here if in the t5 is just as I" }, { "start": 2372.68, "end": 2379.04, "text": " understand it this is just like an encoder like Bert so imagine imagine" }, { "start": 2379.04, "end": 2384.04, "text": " maybe this is Bert right what Bert is simply an encoder only transformer that" }, { "start": 2384.04, "end": 2390, "text": " means you here you put in your sequence and out again comes a sequence and you" }, { "start": 2390, "end": 2393.88, "text": " have like a special token that you use for classification and so on so this is" }, { "start": 2393.88, "end": 2401.04, "text": " less when you have to generate text but more when you want to classify text or" }, { "start": 2401.04, "end": 2406.2799999999997, "text": " things like this find something in a text and what you would do if you have" }, { "start": 2406.28, "end": 2409.28, "text": " two sentences you need to decide something about them you put the first" }, { "start": 2409.28, "end": 2415.4, "text": " sentence here and then you say you put like a separator token here this usually" }, { "start": 2415.4, "end": 2419.32, "text": " called like a separator token and then you put the second sentence here is you" }, { "start": 2419.32, "end": 2423.26, "text": " just concatenate them and you let them go into the transformer and they argue" }, { "start": 2423.26, "end": 2428.2400000000002, "text": " that if you do self-attention on this entire sequence then you get attention" }, { "start": 2428.2400000000002, "end": 2433.2000000000003, "text": " patterns like this and this is sort of like cross-attention between sequences" }, { "start": 2433.2, "end": 2437.96, "text": " right it's not really self-attention and that's why their method doesn't work" }, { "start": 2437.96, "end": 2443.24, "text": " because it basically deals with self-attention but I'm not really buying" }, { "start": 2443.24, "end": 2447.7999999999997, "text": " that argument I mean if this is a sequence it is if this is one sequence" }, { "start": 2447.7999999999997, "end": 2452.72, "text": " this is self-attention and if you were going to argue that out of the blue a" }, { "start": 2452.72, "end": 2461.3399999999997, "text": " token in your case like in your original formulation can simply you know just by" }, { "start": 2461.34, "end": 2465.52, "text": " looking at itself know where where which position it wants the information from" }, { "start": 2465.52, "end": 2469.92, "text": " and certainly here this token could also learn that it wants information from" }, { "start": 2469.92, "end": 2474.08, "text": " over here or from the first word here I don't I don't really see the difference" }, { "start": 2474.08, "end": 2480.6400000000003, "text": " maybe maybe you need to somehow standardize where this separator token" }, { "start": 2480.6400000000003, "end": 2485.2400000000002, "text": " is so that it's always in the same place and that the second sentence always" }, { "start": 2485.2400000000002, "end": 2489.56, "text": " starts at the same place but if you have that then I really don't see any" }, { "start": 2489.56, "end": 2495.48, "text": " difference in the argument you can make here that this shouldn't work as much as" }, { "start": 2495.48, "end": 2501.24, "text": " the others what I think is happening is that this task is simply involves more" }, { "start": 2501.24, "end": 2506.36, "text": " difficult reasoning involves more routing of information like dynamic" }, { "start": 2506.36, "end": 2510.2799999999997, "text": " routing that's actually dependent on what's in the tasks rather than" }, { "start": 2510.2799999999997, "end": 2515.88, "text": " something like machine translation which most of the time has some global" }, { "start": 2515.88, "end": 2523.7200000000003, "text": " routing bias like like some some pattern that works pretty well across all alright" }, { "start": 2523.7200000000003, "end": 2529.6, "text": " so the last part here is where they kind of introspect the model and in the in" }, { "start": 2529.6, "end": 2534.92, "text": " the first thing they say okay we look at the distribution of weights so these are" }, { "start": 2534.92, "end": 2540.7200000000003, "text": " the weights the weights in the decoder at the beginning of training and you can" }, { "start": 2540.72, "end": 2546.9599999999996, "text": " already see that the standard transformer weights are and the" }, { "start": 2546.9599999999996, "end": 2551.9199999999996, "text": " synthesizer weights are different from the sorry the dense synthesizer weights" }, { "start": 2551.9199999999996, "end": 2556.24, "text": " are different from the random synthesizer weights and this probably is" }, { "start": 2556.24, "end": 2559.52, "text": " mostly due to the fact of how you initialize like these deep learning" }, { "start": 2559.52, "end": 2564.04, "text": " frameworks if you have a matrix they will look at what's this dimension" }, { "start": 2564.04, "end": 2568.3999999999996, "text": " what's this dimension and calculate how they have to initialize it such that" }, { "start": 2568.4, "end": 2573.36, "text": " sort of the the total norm of a random vector that goes through stays the same" }, { "start": 2573.36, "end": 2578.52, "text": " sorry the vector would go through like it would go in here and out there so you" }, { "start": 2578.52, "end": 2584.2000000000003, "text": " see if it changes dimension then if you just randomly initialize with all the" }, { "start": 2584.2000000000003, "end": 2590.6800000000003, "text": " same like every matrix with the same number then like with the normal" }, { "start": 2590.6800000000003, "end": 2596.52, "text": " distribution then the in this case the vector would gain in norm and to account" }, { "start": 2596.52, "end": 2602.16, "text": " for that you initialize the matrices such that the vector norms approximately" }, { "start": 2602.16, "end": 2606.16, "text": " stay the same and this is why there I guess why there are different" }, { "start": 2606.16, "end": 2612.96, "text": " initializations here and you can see this at the end of the training now these" }, { "start": 2612.96, "end": 2617.08, "text": " in in different layers right here it's pretty much always the same pattern that" }, { "start": 2617.08, "end": 2621.88, "text": " they they say they just remark it so this this is what I find weird they just" }, { "start": 2621.88, "end": 2627.6800000000003, "text": " say what the graphs show they don't interpret it like I would expect" }, { "start": 2627.6800000000003, "end": 2632.76, "text": " something like oh this pattern is exactly what we would expect from our" }, { "start": 2632.76, "end": 2637.04, "text": " model because something something something right like if they claim that" }, { "start": 2637.04, "end": 2642.52, "text": " this attention is being able to be learned I just don't see why they do this" }, { "start": 2642.52, "end": 2646.76, "text": " stuff they simply point out oh yeah this this is higher here and this is higher" }, { "start": 2646.76, "end": 2652, "text": " here but I don't even see that as too interesting given that is this is how" }, { "start": 2652, "end": 2656.1200000000003, "text": " you initialize it like if you shift everything to the left of it and you" }, { "start": 2656.1200000000003, "end": 2661.36, "text": " know this is a wall so it like this piles up here then this is exactly what" }, { "start": 2661.36, "end": 2667.7200000000003, "text": " turns out I don't I don't see you know what what this is supposed to mean" }, { "start": 2667.7200000000003, "end": 2671.0400000000004, "text": " especially since they don't make any claim of what it is supposed to mean and" }, { "start": 2671.0400000000004, "end": 2676.5600000000004, "text": " the same here they say the effect of the number of heads okay we we investigate" }, { "start": 2676.56, "end": 2681.68, "text": " the effect and the number of heads on the random synthesizer models you know" }, { "start": 2681.68, "end": 2687.96, "text": " and they train the number of heads now somewhere in the text they say I remember" }, { "start": 2687.96, "end": 2694.12, "text": " they say since you know since we don't dynamically route it is very important" }, { "start": 2694.12, "end": 2698.16, "text": " for our models very crucial to have many attention heads right such that" }, { "start": 2698.16, "end": 2702.48, "text": " basically you don't have one routing pattern you have many routing patterns" }, { "start": 2702.48, "end": 2707.76, "text": " that you learn globally so they say it's very important for our model to have" }, { "start": 2707.76, "end": 2712.2400000000002, "text": " many attention heads and I guess that's what they're trying to demonstrate here" }, { "start": 2712.2400000000002, "end": 2718.72, "text": " but again they simply say what's happening they don't interpret it and" }, { "start": 2718.72, "end": 2724.92, "text": " and they don't compare it to anything they just you know put it here they just" }, { "start": 2724.92, "end": 2731.4, "text": " put the number and I don't like is this good is this is this bad can you compare" }, { "start": 2731.4, "end": 2736.88, "text": " it to something and also here in the so here in the original paper they do the" }, { "start": 2736.88, "end": 2741.7200000000003, "text": " same thing here as you can see the number H is the heads and they do ablate" }, { "start": 2741.7200000000003, "end": 2746.52, "text": " this but at the same time they adjust the dimensions of the key and value" }, { "start": 2746.52, "end": 2751.04, "text": " vectors such that in total they have the same amount of parameters right so they" }, { "start": 2751.04, "end": 2756.6800000000003, "text": " can really investigate is one big attention head better or worse than many" }, { "start": 2756.68, "end": 2762, "text": " small attention heads is there a trade-off and they find here that there" }, { "start": 2762, "end": 2766.08, "text": " is a bit of a trade-off like there is a sweet spot you don't want too many don't" }, { "start": 2766.08, "end": 2772.52, "text": " want too much because they get too small something like this but first we like we" }, { "start": 2772.52, "end": 2776.3599999999997, "text": " don't know whether or not have they simply changed the heads but left every" }, { "start": 2776.3599999999997, "end": 2780.24, "text": " other parameter the same or have they also adjusted the dimension because if" }, { "start": 2780.24, "end": 2784.6, "text": " they haven't adjusted the dimensions then this this increase would be" }, { "start": 2784.6, "end": 2789.08, "text": " absolutely expected because you now have more parameters and if they have" }, { "start": 2789.08, "end": 2795.52, "text": " adjusted then it can we compare this to you know something because this here is" }, { "start": 2795.52, "end": 2801.48, "text": " the this is the t5 small this is not the original transformer like is this big is" }, { "start": 2801.48, "end": 2809.64, "text": " this small and what does it say about the claim that you made that the number" }, { "start": 2809.64, "end": 2814.2, "text": " of heads is so important for your model can you validate this using this so it's" }, { "start": 2814.2, "end": 2819.3199999999997, "text": " just a bit of like this entire page here it's just they just measure some things" }, { "start": 2819.3199999999997, "end": 2825.08, "text": " and then they state them here and you're somehow supposed to guess what they mean" }, { "start": 2825.08, "end": 2833.2799999999997, "text": " by stating that here okay but that was enough for me ranting so they give some" }, { "start": 2833.2799999999997, "end": 2838.64, "text": " supplementary material right here but in essence what I like about the paper is" }, { "start": 2838.64, "end": 2844.12, "text": " sort of the thinking that goes into this thinking outside the box asking the" }, { "start": 2844.12, "end": 2847.96, "text": " fundamental questions about these models do we really need this what do they do I" }, { "start": 2847.96, "end": 2853.7999999999997, "text": " don't think it's super well investigated really from a scientific point like the" }, { "start": 2853.7999999999997, "end": 2858.04, "text": " formulation of hypotheses it simply trains these things and then make some" }, { "start": 2858.04, "end": 2862.3599999999997, "text": " claims but the claims interact you know with the number of parameters here and so" }, { "start": 2862.3599999999997, "end": 2869.04, "text": " on so and they're sort of noisy all around and of course the fact that this" }, { "start": 2869.04, "end": 2874.2799999999997, "text": " thing here turns out to be a fully connected layer in disguise is also" }, { "start": 2874.2799999999997, "end": 2879.72, "text": " pretty funny but I get it it's a fan it's like it's it's more it's not exactly" }, { "start": 2879.72, "end": 2885.88, "text": " the same thing but it you know yeah all right so that was my take on this paper" }, { "start": 2885.88, "end": 2891.68, "text": " if you have a different one let me know in the comments for sure I read all of" }, { "start": 2891.68, "end": 2898.8, "text": " them and at least I try and I've always succeeded so far all right I'll see you" }, { "start": 2898.8, "end": 2901.52, "text": " next time bye bye" } ]
LfUsGv-ESbc
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Code] How to use Facebook's DETR object detection algorithm in Python (Full Tutorial)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "facebook", "fair", "fb", "facebook ai", "object detection", "coco", "bounding boxes", "hungarian", "matching", "bipartite", "cnn", "transformer", "attention", "encoder", "decoder", "images", "vision", "pixels", "segmentation", "classes", "stuff", "things", "attention mechanism", "squared", "unrolled", "overlap", "threshold", "rcnn", "code", "pytorch", "colab", "notebook", "ipython", "python", "torch", "hub", "torchvision", "bounding box", "image", "computer vision" ]
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
Howdy ho, 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 weights 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 colab but 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 colab that I will share at the end and I've imported torch 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 the pre-trained please. Shag-a-boom! You now have a model. So if we look at that model this is going to be this entire 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 to find an image than Google? So let's find an image of dogs because dogs is one of the classes in this Coco 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? Cool better. Now we need to load this. For that we're gonna use the requests 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 bytes. No, oh sorry. Get URL streamed. Stream. Yeah so this will get you the sort of the bytes of the image and then use just say image.open and of course we need the image from 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 Coco 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 gonna we're gonna steal that part right here. People last time were some found it really funny that I called copy pasting to go serage. So we'll from now on we'll call it just seraging. What we also need are the class labels because that's in defining the Coco dataset right. So these are the class labels. Let's take those and okay so this T here these are torch vision transforms. We're gonna 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 so you can see that. So this is what the image net antivirus looks like. So now in terms of pans right here for example What we need are the fx 800 and I believe if you rescale the 640 to 800 you get 600 here. Fairly sure. And then let's display it just because we can. 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. So from now on it should be a breeze. So what these transforms do is they resize the image. 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 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 unsqueeze 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-index 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.cuda. 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. Let's not print giant tensors anymore. Cool. So since this was a batch of one, we should probably go with the zero. 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'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 going to do next? What we want to do is for each of the logit predictions, we want to find which class it corresponds to. So what we're going to do is we're going to take the argmax of the last dimension. 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 do is for logits and boxes in, let's just zip them together. And like this. Okay. Class is oops. Class is the logits argmax. If that's 92 or let's say, if 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 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 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 going to 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 going to 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 text. 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 boxes 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 are the kind of the boundaries, or it could be x, y width height. Now from the paper, I know that they predict the center and the width and the height. So I'm going to go with that, and I'm just going to 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, no clue 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 is 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. We're going to 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. Coolio. 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 pill 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. Okay, let's do I think fill. Yes. Red. And let's go for width five or so. Five seems like a good width. Oh god, five is a terrible width. Oh, it's not fill. I think it's it's outline. Yeah, yeah, yeah. Okay. Okay. Let's still go with five. Cool, we got our dogs. Now we need to put like 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, no cheating. Let's just go with regular fonts. It won't look as fancy, but we'll be fine. So where where is 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. Did we just not see it? I'm dumb enough. 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 image is this. Maybe this is like an RGBA image. I think if this is RGBA, we should just convert it to like an RGB. Pretty sure you can do something like this right here. This should work. If it has an alpha channel, then that will remove it. Yes, now it works. Okay, let's see what the model thinks of this. 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 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 Rorschach inkblots, because those are always lots and lots of fun. So which one should we go for? This one looks like fun. So we'll put this into here. And it's astonishing, right? This Cocoa data set, it only has these 90 classes. Like it doesn't have anything else. So it's a cake. And this here, what is it? Okay, we'll have to go maybe with blue. What is it? Pop sign. Okay, but so you might think, what if we want more? Like what if we want more predictions? So there is 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 100 predictions, right? So you see where this is going. So yes, 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 logits 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 logits, right? So we'll look at the logits. And the logits are 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. Alright, so now we have 91. Actually, let's make it more generic. Whatever is in however many classes are 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 want to find the max over this, and that will give us a max output. So we don't want to plot all the 100 predictions, because that would just be like squares all over the place, and we'd have no clue what's happening. So this max output right here, 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 a 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 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 KKKKKKK. 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. Let's actually put that here. Okay. So now we have five by 91. And now it should 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 Jackson 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 one. Yes. Yes. Absolutely. Love it. So we copy image address. And beam boom. More birds. Wow. There's a lot of birds in these 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. Bang. 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 read as well. Now that's terrible. White. Back to white. How about back to white? Okay, clock. We got horse right here and house 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 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 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, "end": 8.64, "text": " Howdy ho, how's it going? So today we are going to try out the DETR, the end-to-end object detection" }, { "start": 8.64, "end": 14.64, "text": " with transformers from Facebook AI research. And they have a github repo and they pretty much give" }, { "start": 14.64, "end": 19.44, "text": " you everything like the model, the pre-trained weights and so on. So today we're going to check" }, { "start": 19.44, "end": 26.64, "text": " out how easy it is to get started with that. So in order to do that they have like a colab but" }, { "start": 26.64, "end": 33.28, "text": " we won't look at it too much. I've glanced at it and we'll basically see how far can we go" }, { "start": 33.84, "end": 39.760000000000005, "text": " without looking at it too much and how easy is that. So what I've done is I've spun up a colab" }, { "start": 39.760000000000005, "end": 44.64, "text": " that I will share at the end and I've imported torch and just loaded the model so you don't have" }, { "start": 44.64, "end": 52.56, "text": " to wait for that to happen. So I've loaded that up and now we have it in the cache. So now we can" }, { "start": 52.56, "end": 59.120000000000005, "text": " basically go ahead and load an image into the model and try to detect objects in the image. So" }, { "start": 59.120000000000005, "end": 65.68, "text": " first of all this is super easy, right? You simply load this from torch hub. It's kind of like the" }, { "start": 65.68, "end": 70.88, "text": " the tensorflow hub. You simply give the name of the model. You say I want the pre-trained please." }, { "start": 70.88, "end": 76.80000000000001, "text": " Shag-a-boom! You now have a model. So if we look at that model this is going to be this entire" }, { "start": 76.8, "end": 84.72, "text": " entire DETR model right here with all the transformer and ResNet and whatnot. Okay this" }, { "start": 84.72, "end": 89.6, "text": " is almost a bit too much right here. So what we want is an image. So let's go find an image." }, { "start": 91.44, "end": 97.36, "text": " Where better to find an image than Google? So let's find an image of dogs because dogs is one of the" }, { "start": 97.36, "end": 103.6, "text": " classes in this Coco dataset. This one's nice, right? Okay so we want the image address. We want" }, { "start": 103.6, "end": 112.47999999999999, "text": " to load it in here somehow. So let the URL is... Let's make this into some sort of" }, { "start": 114.47999999999999, "end": 121.19999999999999, "text": " like an input thing where we can paste the URL right here. Okay there we go." }, { "start": 121.2, "end": 133.84, "text": " So we have this right here and that's the URL. All right no that's not the URL at all. Is it?" }, { "start": 138.48000000000002, "end": 145.44, "text": " Cool better. Now we need to load this. For that we're gonna use the requests library." }, { "start": 145.44, "end": 157.28, "text": " Always a pleasure. Requests, requests. So the way to load a binary file is you can" }, { "start": 158.4, "end": 166.64, "text": " put the URL here and you can say streamed here. I glanced this from the other thing and the raw" }, { "start": 166.64, "end": 179.2, "text": " entry will get you the bytes. No, oh sorry. Get URL streamed. Stream. Yeah so this will get you the" }, { "start": 179.2, "end": 187.83999999999997, "text": " sort of the bytes of the image and then use just say image.open and of course we need the image from" }, { "start": 187.84, "end": 200.32, "text": " the pill library, the python image library. So import image. We got that and we can open that" }, { "start": 200.32, "end": 210.24, "text": " image up and with a bit of luck. Yeah yeah. So this model expects I think Coco dataset is" }, { "start": 210.24, "end": 216.96, "text": " 640 by 480 images but they if you can see right here and we're going to take a quick glance at" }, { "start": 216.96, "end": 225.20000000000002, "text": " their transforming they resize it to 800 so we're gonna we're gonna steal that part right here." }, { "start": 227.68, "end": 236, "text": " People last time were some found it really funny that I called copy pasting to go serage. So" }, { "start": 236, "end": 242.32, "text": " we'll from now on we'll call it just seraging. What we also need are the class labels because" }, { "start": 242.32, "end": 248.48, "text": " that's in defining the Coco dataset right. So these are the class labels. Let's take those" }, { "start": 249.35999999999999, "end": 256.32, "text": " and okay so this T here these are torch vision transforms. We're gonna need that so from" }, { "start": 257.92, "end": 259.44, "text": " let's say" }, { "start": 262, "end": 266, "text": " so if you don't know torch vision it's kind of an addition to PyTorch" }, { "start": 266, "end": 270.88, "text": " that just helps you with with images and has a lot of datasets and these transforms they're really" }, { "start": 270.88, "end": 280.64, "text": " helpful because so let's call this image because you can you know resize but they have much more" }, { "start": 280.64, "end": 285.52, "text": " like random cropping and rotating images and so on pretty much everything you need for pre-training" }, { "start": 285.52, "end": 290.4, "text": " and this here is just the standard image net I believe the image net normalization so these" }, { "start": 290.4, "end": 295.84, "text": " are the means and these are the standard deviations so you can see that. So this is" }, { "start": 295.84, "end": 309.28, "text": " what the image net antivirus looks like. So now in terms of pans right here for example" }, { "start": 311.28, "end": 302.38, "text": " What we need are the fx" }, { "start": 302.38, "end": 311.9, "text": " 800 and I believe if you rescale the 640 to 800 you get 600 here." }, { "start": 311.9, "end": 316.06, "text": " Fairly sure." }, { "start": 316.06, "end": 320.52, "text": " And then let's display it just because we can." }, { "start": 320.52, "end": 323.36, "text": " It's a bit squished but we don't care." }, { "start": 323.36, "end": 328.46, "text": " And let's put that up here so we only need to execute it once." }, { "start": 328.46, "end": 330.5, "text": " Nice." }, { "start": 330.5, "end": 334.02, "text": " So from now on it should be a breeze." }, { "start": 334.02, "end": 337.98, "text": " So what these transforms do is they resize the image." }, { "start": 337.98, "end": 340.46, "text": " We don't need that anymore." }, { "start": 340.46, "end": 346.06, "text": " They make it into a tensor and then they normalize by that." }, { "start": 346.06, "end": 352.06, "text": " So if we run our image through this, because our image right now is this pill image, right?" }, { "start": 352.06, "end": 363.58, "text": " So our image is this pill image but if we run it through the transforms then we'll get" }, { "start": 363.58, "end": 365.38, "text": " a tensor." }, { "start": 365.38, "end": 367.44, "text": " So that's pretty cool." }, { "start": 367.44, "end": 371.36, "text": " So the model as it is a deep learning model it expects batches." }, { "start": 371.36, "end": 376.3, "text": " So we'll unsqueeze that in the first dimension and then we get batches." }, { "start": 376.3, "end": 382.26, "text": " So shape, let's see, we don't have unskies." }, { "start": 382.26, "end": 385.98, "text": " No, of course we don't." }, { "start": 385.98, "end": 391.78000000000003, "text": " So this is a one image of three channels of 600 by 800." }, { "start": 391.78000000000003, "end": 395.46000000000004, "text": " So this is the y-index coordinates I guess are shifted." }, { "start": 395.46000000000004, "end": 397.86, "text": " Yes, in PyTorch." }, { "start": 397.86, "end": 398.86, "text": " Cool." }, { "start": 398.86, "end": 404.6, "text": " So we'll call this our image tensor." }, { "start": 404.6, "end": 407.3, "text": " Now we just need to put it into the model." }, { "start": 407.3, "end": 411.92, "text": " So model, we put that in there." }, { "start": 411.92, "end": 416.54, "text": " And since we don't, let's actually up here put the model in eval mode." }, { "start": 416.54, "end": 423.94, "text": " I don't know if that's already done but you know you can never be sure enough that the" }, { "start": 423.94, "end": 428.66, "text": " batch norms aren't, but I think it probably doesn't have batch norms." }, { "start": 428.66, "end": 431.98, "text": " Okay, you're not utilizing the GPU." }, { "start": 431.98, "end": 433.06, "text": " We'll do that." }, { "start": 433.06, "end": 434.06, "text": " We'll do that." }, { "start": 434.06, "end": 435.06, "text": " Thanks." }, { "start": 435.06, "end": 440.66, "text": " So, how do we use the GPU?" }, { "start": 440.66, "end": 442.7, "text": " We put our model on the GPU." }, { "start": 442.7, "end": 445.3, "text": " Model equals model.cuda." }, { "start": 445.3, "end": 451.3, "text": " Yes, yes, yes." }, { "start": 451.3, "end": 452.3, "text": " I think so." }, { "start": 452.3, "end": 453.3, "text": " This is gonna work." }, { "start": 453.3, "end": 454.3, "text": " Okay." }, { "start": 454.3, "end": 459.22, "text": " We're gonna come back to this later." }, { "start": 459.22, "end": 466.02000000000004, "text": " So we forward our image, of course we also need that on the GPU." }, { "start": 466.02000000000004, "end": 468.82000000000005, "text": " And this worked." }, { "start": 468.82000000000005, "end": 469.82000000000005, "text": " This worked." }, { "start": 469.82000000000005, "end": 470.82000000000005, "text": " This worked." }, { "start": 470.82000000000005, "end": 471.82000000000005, "text": " Nice." }, { "start": 471.82000000000005, "end": 472.82000000000005, "text": " Okay." }, { "start": 472.82000000000005, "end": 478.98, "text": " And since this is just for evaluation, we should probably go with no grad right here" }, { "start": 478.98, "end": 483.42, "text": " because we don't need this whole gradient stuff if we do that." }, { "start": 483.42, "end": 484.62, "text": " Okay." }, { "start": 484.62, "end": 487.3, "text": " I'm dumb." }, { "start": 487.3, "end": 488.86, "text": " There you go." }, { "start": 488.86, "end": 494.90000000000003, "text": " And nothing happens of course because we need to capture the output somehow." }, { "start": 494.90000000000003, "end": 496.66, "text": " Let's look at that." }, { "start": 496.66, "end": 497.66, "text": " Output." }, { "start": 497.66, "end": 498.66, "text": " Wow." }, { "start": 498.66, "end": 499.90000000000003, "text": " Wow." }, { "start": 499.90000000000003, "end": 500.90000000000003, "text": " Just wow." }, { "start": 500.90000000000003, "end": 507.42, "text": " So the output is a dictionary, right, because we get back class labels and bounding boxes." }, { "start": 507.42, "end": 511.72, "text": " So let's look at the pred boxes." }, { "start": 511.72, "end": 515.26, "text": " Let's look at that tensor." }, { "start": 515.26, "end": 516.26, "text": " That's a tensor." }, { "start": 516.26, "end": 517.26, "text": " Very nice." }, { "start": 517.26, "end": 521.02, "text": " Let's look at its shape." }, { "start": 521.02, "end": 523.86, "text": " Let's not print giant tensors anymore." }, { "start": 523.86, "end": 525.62, "text": " Cool." }, { "start": 525.62, "end": 530.54, "text": " So since this was a batch of one, we should probably go with the zero." }, { "start": 530.54, "end": 535.86, "text": " And you can see right here, there is a hundred bounding boxes and each one has four numbers." }, { "start": 535.86, "end": 542.66, "text": " And if you go with the other thing that's in there, the logits, then you'll see that" }, { "start": 542.66, "end": 553.38, "text": " there are also should be a hundred logits and hello, there should be a hundred logits" }, { "start": 553.38, "end": 560.38, "text": " and each one is of size 92 because there are 92 different classes." }, { "start": 560.38, "end": 562.78, "text": " 92." }, { "start": 562.78, "end": 564.4599999999999, "text": " We'll see about that." }, { "start": 564.4599999999999, "end": 568.86, "text": " Well one is going to be the nothing class, right?" }, { "start": 568.86, "end": 572.7, "text": " By the way, how many classes do we have?" }, { "start": 572.7, "end": 575.26, "text": " We have 91 classes." }, { "start": 575.26, "end": 576.26, "text": " Okay." }, { "start": 576.26, "end": 577.3000000000001, "text": " Cool." }, { "start": 577.3000000000001, "end": 579.46, "text": " We can deal with that." }, { "start": 579.46, "end": 580.46, "text": " All right." }, { "start": 580.46, "end": 584.22, "text": " So what are we going to do next?" }, { "start": 584.22, "end": 594.82, "text": " What we want to do is for each of the logit predictions, we want to find which class it" }, { "start": 594.82, "end": 596.04, "text": " corresponds to." }, { "start": 596.04, "end": 601.62, "text": " So what we're going to do is we're going to take the argmax of the last dimension." }, { "start": 601.62, "end": 608.78, "text": " So you can see here, almost all of these things correspond to class 91 and class 91 is not" }, { "start": 608.78, "end": 611.9399999999999, "text": " in our classes because our class is only length 91." }, { "start": 611.9399999999999, "end": 614.6999999999999, "text": " So that must be the nothing class." }, { "start": 614.6999999999999, "end": 625.3399999999999, "text": " So what we can technically do is for logits and boxes in, let's just zip them together." }, { "start": 625.34, "end": 635.4200000000001, "text": " And like this." }, { "start": 635.4200000000001, "end": 637.46, "text": " Okay." }, { "start": 637.46, "end": 639.94, "text": " Class is oops." }, { "start": 639.94, "end": 646.38, "text": " Class is the logits argmax." }, { "start": 646.38, "end": 652.86, "text": " If that's 92 or let's say, if that's larger than the length of our classes, we'll just" }, { "start": 652.86, "end": 655.58, "text": " skip it for now." }, { "start": 655.58, "end": 657.78, "text": " Okay." }, { "start": 657.78, "end": 661.42, "text": " So that should work somehow." }, { "start": 661.42, "end": 672.0600000000001, "text": " And if not, then our label should be the class index right here." }, { "start": 672.0600000000001, "end": 676.64, "text": " So let's just see what the detector detects right here." }, { "start": 676.64, "end": 683.9399999999999, "text": " It detects nothing." }, { "start": 683.9399999999999, "end": 691.02, "text": " Why does it detect nothing?" }, { "start": 691.02, "end": 696.42, "text": " That doesn't seem good." }, { "start": 696.42, "end": 700.7, "text": " What are we doing wrong?" }, { "start": 700.7, "end": 708.22, "text": " We zip together the logits." }, { "start": 708.22, "end": 714.74, "text": " Oh yeah, of course, we still need the zero with entry." }, { "start": 714.74, "end": 720.1800000000001, "text": " We are cool." }, { "start": 720.1800000000001, "end": 726.94, "text": " So so so so we can delete this." }, { "start": 726.94, "end": 733.0200000000001, "text": " And now finally, beautiful dogs, two dogs detected." }, { "start": 733.0200000000001, "end": 734.0200000000001, "text": " Excellent." }, { "start": 734.0200000000001, "end": 737.7, "text": " So now for each of these dogs, we want the bounding box." }, { "start": 737.7, "end": 738.7, "text": " Okay." }, { "start": 738.7, "end": 744.22, "text": " So now we somehow need to think of how are we going to draw this on an image." }, { "start": 744.22, "end": 750.62, "text": " And well, let's, let's actually make a copy of that image, because I don't really trust" }, { "start": 750.62, "end": 752.3000000000001, "text": " myself." }, { "start": 752.3, "end": 757.9399999999999, "text": " And then at the end of this, we're just going to display that image, right." }, { "start": 757.9399999999999, "end": 763.02, "text": " Now actually, the reason I make a copy is because in these in this pillow library, you" }, { "start": 763.02, "end": 764.5, "text": " can actually draw on these images." }, { "start": 764.5, "end": 767.2199999999999, "text": " And we're going to use that to draw these bounding boxes." }, { "start": 767.2199999999999, "end": 774.06, "text": " So for that, we need an image draw, if I remember correctly." }, { "start": 774.06, "end": 777.02, "text": " And I think later, we also want some text." }, { "start": 777.02, "end": 780.42, "text": " So we need an image font." }, { "start": 780.42, "end": 782.4599999999999, "text": " Yes." }, { "start": 782.4599999999999, "end": 784.26, "text": " All right." }, { "start": 784.26, "end": 793.3399999999999, "text": " So let's draw a bounding box right here, where, so first of all, let's look at that bounding" }, { "start": 793.3399999999999, "end": 796.18, "text": " box." }, { "start": 796.18, "end": 805.38, "text": " Let's call this box box, print box dot shape and break right here." }, { "start": 805.38, "end": 806.38, "text": " What's happening?" }, { "start": 806.38, "end": 813.74, "text": " Let's not do this right now." }, { "start": 813.74, "end": 816.66, "text": " So this is a boxes of size four." }, { "start": 816.66, "end": 818.26, "text": " Now this could be two things." }, { "start": 818.26, "end": 822.52, "text": " It could be x zero, y zero, x one, y one." }, { "start": 822.52, "end": 828.02, "text": " So the two corner points are the kind of the boundaries, or it could be x, y width height." }, { "start": 828.02, "end": 832.48, "text": " Now from the paper, I know that they predict the center and the width and the height." }, { "start": 832.48, "end": 837.7, "text": " So I'm going to go with that, and I'm just going to guess that it's like x, y, w, h," }, { "start": 837.7, "end": 841.1800000000001, "text": " and not some other way around." }, { "start": 841.1800000000001, "end": 845.1, "text": " If this is a bad guess, then yeah, we'll see." }, { "start": 845.1, "end": 847.58, "text": " We can just print out one of these boxes." }, { "start": 847.58, "end": 850.94, "text": " And honestly, no clue that looks reason." }, { "start": 850.94, "end": 853.38, "text": " Oh, by the way, we should scale that up." }, { "start": 853.38, "end": 854.38, "text": " Yeah." }, { "start": 854.38, "end": 856.72, "text": " So these are normalized coordinates, probably between zero and one." }, { "start": 856.72, "end": 858.38, "text": " So we should scale that up." }, { "start": 858.38, "end": 865.9, "text": " So we should probably the x coordinates, which is scale by 800 and the y by 600." }, { "start": 865.9, "end": 867.9399999999999, "text": " So let's do it." }, { "start": 867.9399999999999, "end": 879.9, "text": " So first of all, we scale our box by 800 in the x and here is a y and the width is the" }, { "start": 879.9, "end": 883.18, "text": " x direction and this is the y direction." }, { "start": 883.18, "end": 884.18, "text": " Boom." }, { "start": 884.18, "end": 885.22, "text": " Okay." }, { "start": 885.22, "end": 889.82, "text": " We should probably get that on CPU." }, { "start": 889.82, "end": 892.38, "text": " We'll just hack together a bunch of things right here." }, { "start": 892.38, "end": 894.5, "text": " Okay, so now this isn't the correct." }, { "start": 894.5, "end": 902.6800000000001, "text": " So we so our x and y and w and h are going to be this box." }, { "start": 902.6800000000001, "end": 905.62, "text": " So now we need to actually draw on the image." }, { "start": 905.62, "end": 908.32, "text": " We're going to do that." }, { "start": 908.32, "end": 920.2600000000001, "text": " 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" }, { "start": 920.2600000000001, "end": 926.5400000000001, "text": " for y with h plus h half." }, { "start": 926.5400000000001, "end": 928.1, "text": " Coolio." }, { "start": 928.1, "end": 930.38, "text": " Now we need an image draw object." }, { "start": 930.38, "end": 936.7600000000001, "text": " So I think draw on this image." }, { "start": 936.76, "end": 940.34, "text": " So whatever you draw on the draw object will end up on the image." }, { "start": 940.34, "end": 944.54, "text": " So we can use that to draw a bounding box and let's just quickly look it up." }, { "start": 944.54, "end": 951.38, "text": " So pill Python draw rectangle, maybe." }, { "start": 951.38, "end": 952.62, "text": " There we go." }, { "start": 952.62, "end": 955.62, "text": " Okay, so there's this rectangle." }, { "start": 955.62, "end": 959.7, "text": " Yeah, there's the rectangle function." }, { "start": 959.7, "end": 966.94, "text": " And you can see you put in a shape x y here and with height like this." }, { "start": 966.94, "end": 971.4200000000001, "text": " Wait for real, we wouldn't even have to need to transform it." }, { "start": 971.4200000000001, "end": 973.3000000000001, "text": " I'm pretty sure you can go x." }, { "start": 973.3000000000001, "end": 980.26, "text": " I thought I remember you could do the different thing as well." }, { "start": 980.26, "end": 981.26, "text": " But it's called rectangle." }, { "start": 981.26, "end": 982.5, "text": " Okay, so let's do that." }, { "start": 982.5, "end": 998.94, "text": " So draw rectangle and we'll go we'll go x zero or we'll go x, y with height." }, { "start": 998.94, "end": 1002.7, "text": " Let's display that down here." }, { "start": 1002.7, "end": 1009.3, "text": " Yeah, that looks that looks nothing like we want." }, { "start": 1009.3, "end": 1013.4399999999999, "text": " But it's you know, it's a start." }, { "start": 1013.4399999999999, "end": 1016.74, "text": " Maybe actually we need the other thing here." }, { "start": 1016.74, "end": 1024.3799999999999, "text": " We need x zero, y zero, x one, y one." }, { "start": 1024.3799999999999, "end": 1029.02, "text": " Yes, yes, doggy." }, { "start": 1029.02, "end": 1032.7, "text": " Okay, we still have the break in here." }, { "start": 1032.7, "end": 1035.5, "text": " Now we get both dogs." }, { "start": 1035.5, "end": 1037.5, "text": " Nice." }, { "start": 1037.5, "end": 1043.22, "text": " Okay, let's do I think fill." }, { "start": 1043.22, "end": 1044.22, "text": " Yes." }, { "start": 1044.22, "end": 1045.72, "text": " Red." }, { "start": 1045.72, "end": 1049.06, "text": " And let's go for width five or so." }, { "start": 1049.06, "end": 1050.38, "text": " Five seems like a good width." }, { "start": 1050.38, "end": 1054.46, "text": " Oh god, five is a terrible width." }, { "start": 1054.46, "end": 1058.7, "text": " Oh, it's not fill." }, { "start": 1058.7, "end": 1060.7, "text": " I think it's it's outline." }, { "start": 1060.7, "end": 1062.7, "text": " Yeah, yeah, yeah." }, { "start": 1062.7, "end": 1063.7, "text": " Okay." }, { "start": 1063.7, "end": 1064.7, "text": " Okay." }, { "start": 1064.7, "end": 1067.6200000000001, "text": " Let's still go with five." }, { "start": 1067.6200000000001, "end": 1069.78, "text": " Cool, we got our dogs." }, { "start": 1069.78, "end": 1073.22, "text": " Now we need to put like some snappy text labels." }, { "start": 1073.22, "end": 1078.94, "text": " I think there is actually a pill image draw text." }, { "start": 1078.94, "end": 1084.18, "text": " I think that exists because I've this font thing." }, { "start": 1084.18, "end": 1085.18, "text": " Yeah, exactly." }, { "start": 1085.18, "end": 1087.74, "text": " So you need the font thing." }, { "start": 1087.74, "end": 1090.74, "text": " Get a font in there." }, { "start": 1090.74, "end": 1094.9, "text": " And then Yeah, exactly." }, { "start": 1094.9, "end": 1096.54, "text": " You could put a text like this." }, { "start": 1096.54, "end": 1102.7, "text": " Okay, so you probably need the x and y coordinates of the text." }, { "start": 1102.7, "end": 1104.98, "text": " So let's do that." }, { "start": 1104.98, "end": 1106.94, "text": " W dot text." }, { "start": 1106.94, "end": 1111.78, "text": " And let's just go with x and y right here, put it right in the middle." }, { "start": 1111.78, "end": 1115.02, "text": " And the text is going to be our label, of course." }, { "start": 1115.02, "end": 1120.02, "text": " And we want the fill that's now going to be the color of the text." }, { "start": 1120.02, "end": 1124.9, "text": " Let's go with white and the font." }, { "start": 1124.9, "end": 1130.62, "text": " We're going to load some font right here." }, { "start": 1130.62, "end": 1131.62, "text": " Font dot." }, { "start": 1131.62, "end": 1133.86, "text": " How are we doing this?" }, { "start": 1133.86, "end": 1135.66, "text": " True type, true type." }, { "start": 1135.66, "end": 1136.66, "text": " Okay." }, { "start": 1136.66, "end": 1139.86, "text": " Ah, no, no cheating." }, { "start": 1139.86, "end": 1141.34, "text": " Let's just go with regular fonts." }, { "start": 1141.34, "end": 1149.06, "text": " It won't look as fancy, but we'll be fine." }, { "start": 1149.06, "end": 1158.94, "text": " So where where is our text?" }, { "start": 1158.94, "end": 1159.94, "text": " You see it?" }, { "start": 1159.94, "end": 1162.94, "text": " I don't see it." }, { "start": 1162.94, "end": 1175.62, "text": " Red, let's make it red." }, { "start": 1175.62, "end": 1178.54, "text": " Yes, there we go." }, { "start": 1178.54, "end": 1181.8999999999999, "text": " Okay, so it wasn't red enough." }, { "start": 1181.8999999999999, "end": 1182.8999999999999, "text": " This should work." }, { "start": 1182.8999999999999, "end": 1184.58, "text": " Did we just not see it?" }, { "start": 1184.58, "end": 1185.58, "text": " I'm dumb enough." }, { "start": 1185.58, "end": 1186.58, "text": " Cool." }, { "start": 1186.58, "end": 1187.58, "text": " So we have two dogs." }, { "start": 1187.58, "end": 1188.58, "text": " How easy was that?" }, { "start": 1188.58, "end": 1193.5, "text": " Actually, we wasted the most time with like bounding boxes and stuff." }, { "start": 1193.5, "end": 1194.82, "text": " Absolutely cool." }, { "start": 1194.82, "end": 1195.8999999999999, "text": " Right." }, { "start": 1195.8999999999999, "end": 1199.94, "text": " Okay, so now we can have some fun with it." }, { "start": 1199.94, "end": 1204.26, "text": " I'm going to scale this down for a bit because you don't need to see the actual code anymore" }, { "start": 1204.26, "end": 1207.18, "text": " so much so you can see the image more." }, { "start": 1207.18, "end": 1209.46, "text": " So we'll go to the images." }, { "start": 1209.46, "end": 1214.66, "text": " And the first thing I want to do is the dress." }, { "start": 1214.66, "end": 1217.22, "text": " What does this think of the dress?" }, { "start": 1217.22, "end": 1221.3400000000001, "text": " Okay, so we'll copy that." }, { "start": 1221.3400000000001, "end": 1228.38, "text": " And we'll go into our colab and just paste this right here." }, { "start": 1228.38, "end": 1236.8600000000001, "text": " But a boom, but a beam sounds nice." }, { "start": 1236.86, "end": 1239.26, "text": " And what is wrong?" }, { "start": 1239.26, "end": 1242.9399999999998, "text": " The size of a tensor must match the size of a tensor." }, { "start": 1242.9399999999998, "end": 1251.9399999999998, "text": " We do something wrong." }, { "start": 1251.9399999999998, "end": 1253.3799999999999, "text": " Transform image." }, { "start": 1253.3799999999999, "end": 1261.1, "text": " Our image is this." }, { "start": 1261.1, "end": 1264.6999999999998, "text": " Maybe this is like an RGBA image." }, { "start": 1264.7, "end": 1271.7, "text": " I think if this is RGBA, we should just convert it to like an RGB." }, { "start": 1271.7, "end": 1277.54, "text": " Pretty sure you can do something like this right here." }, { "start": 1277.54, "end": 1278.54, "text": " This should work." }, { "start": 1278.54, "end": 1285.14, "text": " If it has an alpha channel, then that will remove it." }, { "start": 1285.14, "end": 1289.38, "text": " Yes, now it works." }, { "start": 1289.38, "end": 1292.3400000000001, "text": " Okay, let's see what the model thinks of this." }, { "start": 1292.34, "end": 1299.6599999999999, "text": " Okay, apparently there's a car and there's a surfboard and there's a person and there's" }, { "start": 1299.6599999999999, "end": 1301.4599999999998, "text": " a person." }, { "start": 1301.4599999999998, "end": 1303.86, "text": " Nice, see?" }, { "start": 1303.86, "end": 1309.6599999999999, "text": " Well we didn't figure out whether the dress was blue or white or gold." }, { "start": 1309.6599999999999, "end": 1312.54, "text": " It was just a person." }, { "start": 1312.54, "end": 1321.34, "text": " Now you could actually like threshold by how sure you are of a given class." }, { "start": 1321.34, "end": 1324.02, "text": " But where's the fun in that?" }, { "start": 1324.02, "end": 1325.8999999999999, "text": " So let's go further." }, { "start": 1325.8999999999999, "end": 1333.8999999999999, "text": " Let's do some Rorschach inkblots, because those are always lots and lots of fun." }, { "start": 1333.8999999999999, "end": 1338.58, "text": " So which one should we go for?" }, { "start": 1338.58, "end": 1342.54, "text": " This one looks like fun." }, { "start": 1342.54, "end": 1351.74, "text": " So we'll put this into here." }, { "start": 1351.74, "end": 1353.26, "text": " And it's astonishing, right?" }, { "start": 1353.26, "end": 1355.98, "text": " This Cocoa data set, it only has these 90 classes." }, { "start": 1355.98, "end": 1359, "text": " Like it doesn't have anything else." }, { "start": 1359, "end": 1362.8999999999999, "text": " So it's a cake." }, { "start": 1362.8999999999999, "end": 1364.8999999999999, "text": " And this here, what is it?" }, { "start": 1364.8999999999999, "end": 1370.34, "text": " Okay, we'll have to go maybe with blue." }, { "start": 1370.34, "end": 1371.54, "text": " What is it?" }, { "start": 1371.54, "end": 1373.62, "text": " Pop sign." }, { "start": 1373.62, "end": 1378.26, "text": " Okay, but so you might think, what if we want more?" }, { "start": 1378.26, "end": 1380.46, "text": " Like what if we want more predictions?" }, { "start": 1380.46, "end": 1381.98, "text": " So there is a hack, right?" }, { "start": 1381.98, "end": 1387.34, "text": " Right now the model can always assign mass to this not a class thing, like right here," }, { "start": 1387.34, "end": 1390.3, "text": " this class 91." }, { "start": 1390.3, "end": 1394.12, "text": " In order for it to say, I don't think there's anything there." }, { "start": 1394.12, "end": 1397.3799999999999, "text": " But generally we have 100 predictions, right?" }, { "start": 1397.3799999999999, "end": 1400.86, "text": " So you see where this is going." }, { "start": 1400.86, "end": 1409.6599999999999, "text": " So yes, let's change it up a bit." }, { "start": 1409.6599999999999, "end": 1413.6999999999998, "text": " And let's go here." }, { "start": 1413.6999999999998, "end": 1420.74, "text": " Let's first extract these tensors and boxes." }, { "start": 1420.74, "end": 1429.78, "text": " Okay, so we have the boxes and this and logits and boxes." }, { "start": 1429.78, "end": 1433.06, "text": " Okay, so we got that." }, { "start": 1433.06, "end": 1439.26, "text": " What we want to do is basically we want to filter the, we want to basically just remove" }, { "start": 1439.26, "end": 1442.26, "text": " the last class before we do the argmax." }, { "start": 1442.26, "end": 1447.7, "text": " And thereby we want to force the model to make a prediction." }, { "start": 1447.7, "end": 1451.74, "text": " It won't be a very good prediction, because of course, this is only the second highest" }, { "start": 1451.74, "end": 1454.3, "text": " class and it's arguable how much that counts." }, { "start": 1454.3, "end": 1458.78, "text": " But still, it'll do something." }, { "start": 1458.78, "end": 1462.42, "text": " So this must be done in the logits, right?" }, { "start": 1462.42, "end": 1466.62, "text": " So we'll look at the logits." }, { "start": 1466.62, "end": 1468.94, "text": " And the logits are of shape 100." }, { "start": 1468.94, "end": 1471.46, "text": " So we have 100 predictions of 92 classes." }, { "start": 1471.46, "end": 1474.36, "text": " Now the first thing we want to do is just remove the last class." }, { "start": 1474.36, "end": 1479.22, "text": " So let's go everything here until the last class." }, { "start": 1479.22, "end": 1481.3799999999999, "text": " Alright, so now we have 91." }, { "start": 1481.3799999999999, "end": 1485.5, "text": " Actually, let's make it more generic." }, { "start": 1485.5, "end": 1488.42, "text": " Whatever is in however many classes are okay." }, { "start": 1488.42, "end": 1490.96, "text": " So we don't have this class anymore." }, { "start": 1490.96, "end": 1499.5600000000002, "text": " So now if we do the softmax over the last thing, we can technically we get 91." }, { "start": 1499.5600000000002, "end": 1502.42, "text": " But now they're normalized, so they add up to one." }, { "start": 1502.42, "end": 1507.5, "text": " So it's kind of a probability distribution." }, { "start": 1507.5, "end": 1519.18, "text": " Next, we want to find the max over this, and that will give us a max output." }, { "start": 1519.18, "end": 1524.26, "text": " So we don't want to plot all the 100 predictions, because that would just be like squares all" }, { "start": 1524.26, "end": 1527.46, "text": " over the place, and we'd have no clue what's happening." }, { "start": 1527.46, "end": 1538.5, "text": " So this max output right here, what we're trying to find is we're trying to find a," }, { "start": 1538.5, "end": 1543.54, "text": " let's say the five best predictions or so the five ones where the model thinks where" }, { "start": 1543.54, "end": 1545.6200000000001, "text": " the model is most confident." }, { "start": 1545.6200000000001, "end": 1550.26, "text": " It's not really a good metric, but you know." }, { "start": 1550.26, "end": 1556.94, "text": " So these are the probability values of all of the 100 predictions." }, { "start": 1556.94, "end": 1559.42, "text": " So what we want is like the top K." }, { "start": 1559.42, "end": 1564.38, "text": " Okay, so let's go with five." }, { "start": 1564.38, "end": 1568.42, "text": " And again, we'll get like a top K output." }, { "start": 1568.42, "end": 1572.98, "text": " Let's call that top K." }, { "start": 1572.98, "end": 1577.9, "text": " And I think it also has like values and indices." }, { "start": 1577.9, "end": 1578.9, "text": " Yes." }, { "start": 1578.9, "end": 1590.46, "text": " So now we simply need to filter from the logits and the boxes where these top ones are." }, { "start": 1590.46, "end": 1601.5800000000002, "text": " So we'll filter the logits." }, { "start": 1601.58, "end": 1616.1, "text": " We'll filter the logits by that top K indices, and we'll also filter the I am not very gifted" }, { "start": 1616.1, "end": 1618.54, "text": " today." }, { "start": 1618.54, "end": 1622.78, "text": " Boxes." }, { "start": 1622.78, "end": 1627.34, "text": " By the way, I'm using a colab just because it's nice to kind of play around with a model," }, { "start": 1627.34, "end": 1631.8999999999999, "text": " because if I were to use a file, I'd have to restart and reload the model over and over" }, { "start": 1631.8999999999999, "end": 1632.8999999999999, "text": " again." }, { "start": 1632.8999999999999, "end": 1633.8999999999999, "text": " Just not as nice." }, { "start": 1633.8999999999999, "end": 1634.8999999999999, "text": " Right." }, { "start": 1634.8999999999999, "end": 1639.02, "text": " So now we have the logits and the boxes." }, { "start": 1639.02, "end": 1644.12, "text": " And if we do that right now, we get always the top five predictions." }, { "start": 1644.12, "end": 1645.8999999999999, "text": " How nice is that?" }, { "start": 1645.8999999999999, "end": 1652.74, "text": " And you can see the top five predictions are probably still KKKKKKK." }, { "start": 1652.74, "end": 1659.42, "text": " Just to verify that." }, { "start": 1659.42, "end": 1664.6200000000001, "text": " And we can put its shape." }, { "start": 1664.6200000000001, "end": 1670.94, "text": " See, this is what I don't like about this stuff." }, { "start": 1670.94, "end": 1671.94, "text": " Yes." }, { "start": 1671.94, "end": 1672.94, "text": " Okay." }, { "start": 1672.94, "end": 1677.22, "text": " So we just have five predictions of 92 things." }, { "start": 1677.22, "end": 1680.84, "text": " And we don't want the 92 we've already said." }, { "start": 1680.84, "end": 1684.36, "text": " So we just want the 91." }, { "start": 1684.36, "end": 1695.22, "text": " Let's actually put that here." }, { "start": 1695.22, "end": 1698.6999999999998, "text": " Okay." }, { "start": 1698.6999999999998, "end": 1700.62, "text": " So now we have five by 91." }, { "start": 1700.62, "end": 1701.8999999999999, "text": " And now it should give us the top five." }, { "start": 1701.8999999999999, "end": 1703, "text": " Ah, there we go." }, { "start": 1703, "end": 1707.1799999999998, "text": " So many cakes and many stop signs." }, { "start": 1707.1799999999998, "end": 1708.1799999999998, "text": " That's fine." }, { "start": 1708.1799999999998, "end": 1709.1799999999998, "text": " That's cool." }, { "start": 1709.18, "end": 1714.26, "text": " So the ultimate test right here is going to be." }, { "start": 1714.26, "end": 1718.8200000000002, "text": " Yes." }, { "start": 1718.8200000000002, "end": 1723.22, "text": " The human adversarial example." }, { "start": 1723.22, "end": 1724.5, "text": " Let's check it out." }, { "start": 1724.5, "end": 1731.5, "text": " So we'll put in a Jackson Pollock image and we'll see what the model says." }, { "start": 1731.5, "end": 1734.42, "text": " Now we're actually forcing it to make predictions, right?" }, { "start": 1734.42, "end": 1737.14, "text": " So it can't escape." }, { "start": 1737.14, "end": 1740.3400000000001, "text": " It will need to do something." }, { "start": 1740.3400000000001, "end": 1742.5, "text": " Okay, I made another mistake." }, { "start": 1742.5, "end": 1750.3200000000002, "text": " I would need to copy the image address right here." }, { "start": 1750.3200000000002, "end": 1752.0800000000002, "text": " Like this." }, { "start": 1752.0800000000002, "end": 1755.8200000000002, "text": " That's what happens when you're not an idiot." }, { "start": 1755.8200000000002, "end": 1757.7800000000002, "text": " You get the actual image." }, { "start": 1757.7800000000002, "end": 1762.22, "text": " So what does the model think of our pretty image?" }, { "start": 1762.22, "end": 1763.22, "text": " Okay." }, { "start": 1763.22, "end": 1765.0200000000002, "text": " I can't even read that." }, { "start": 1765.02, "end": 1770.1, "text": " So let's make this into white." }, { "start": 1770.1, "end": 1772.1399999999999, "text": " Bird." }, { "start": 1772.1399999999999, "end": 1774.1399999999999, "text": " Bird." }, { "start": 1774.1399999999999, "end": 1775.1399999999999, "text": " Bird." }, { "start": 1775.1399999999999, "end": 1776.1399999999999, "text": " Okay." }, { "start": 1776.1399999999999, "end": 1777.42, "text": " Lots of birds in this image." }, { "start": 1777.42, "end": 1779.9, "text": " Clearly, clearly lots of birds in this image." }, { "start": 1779.9, "end": 1781.94, "text": " Let's try another one." }, { "start": 1781.94, "end": 1789.34, "text": " Let's go with this." }, { "start": 1789.34, "end": 1790.34, "text": " This one." }, { "start": 1790.34, "end": 1791.34, "text": " Yes." }, { "start": 1791.34, "end": 1792.34, "text": " Yes." }, { "start": 1792.34, "end": 1793.34, "text": " Absolutely." }, { "start": 1793.34, "end": 1794.34, "text": " Love it." }, { "start": 1794.34, "end": 1800.8999999999999, "text": " So we copy image address." }, { "start": 1800.8999999999999, "end": 1814.74, "text": " And beam boom." }, { "start": 1814.74, "end": 1815.74, "text": " More birds." }, { "start": 1815.74, "end": 1816.74, "text": " Wow." }, { "start": 1816.74, "end": 1821.22, "text": " There's a lot of birds in these Pollock images." }, { "start": 1821.22, "end": 1823.02, "text": " Just so many birds." }, { "start": 1823.02, "end": 1826.9, "text": " Okay, let's try one last." }, { "start": 1826.9, "end": 1833.1399999999999, "text": " How about this one?" }, { "start": 1833.1399999999999, "end": 1838.78, "text": " This one is a bit more human friendly, right?" }, { "start": 1838.78, "end": 1844.42, "text": " Put it in here." }, { "start": 1844.42, "end": 1847.46, "text": " Bang." }, { "start": 1847.46, "end": 1849.98, "text": " And and." }, { "start": 1849.98, "end": 1853.42, "text": " Okay, we get some detections." }, { "start": 1853.42, "end": 1855.74, "text": " There's a clock right here." }, { "start": 1855.74, "end": 1858.22, "text": " There is a." }, { "start": 1858.22, "end": 1859.22, "text": " What's that?" }, { "start": 1859.22, "end": 1860.22, "text": " House?" }, { "start": 1860.22, "end": 1861.22, "text": " Horses?" }, { "start": 1861.22, "end": 1864.7, "text": " Let's print." }, { "start": 1864.7, "end": 1867.22, "text": " Let's print the labels." }, { "start": 1867.22, "end": 1869.6200000000001, "text": " So just so we know what they are." }, { "start": 1869.6200000000001, "end": 1873.42, "text": " Cake, horse, car, horse and clock." }, { "start": 1873.42, "end": 1874.42, "text": " Okay." }, { "start": 1874.42, "end": 1876.42, "text": " So I see the clock." }, { "start": 1876.42, "end": 1879.94, "text": " Like this here is clearly a clock." }, { "start": 1879.94, "end": 1889.02, "text": " Then this rectangle on the right side must be something." }, { "start": 1889.02, "end": 1893.3400000000001, "text": " Let's put this to read as well." }, { "start": 1893.3400000000001, "end": 1894.3400000000001, "text": " Now that's terrible." }, { "start": 1894.3400000000001, "end": 1895.3400000000001, "text": " White." }, { "start": 1895.3400000000001, "end": 1898.3400000000001, "text": " Back to white." }, { "start": 1898.3400000000001, "end": 1900.9, "text": " How about back to white?" }, { "start": 1900.9, "end": 1903.8600000000001, "text": " Okay, clock." }, { "start": 1903.86, "end": 1911.4199999999998, "text": " We got horse right here and house probably." }, { "start": 1911.4199999999998, "end": 1915.86, "text": " And the entire image is again a cake." }, { "start": 1915.86, "end": 1917.9399999999998, "text": " Yes." }, { "start": 1917.9399999999998, "end": 1919.24, "text": " Okay." }, { "start": 1919.24, "end": 1925.1399999999999, "text": " So as you can see, it is a pretty, pretty good system." }, { "start": 1925.1399999999999, "end": 1929.1399999999999, "text": " But of course, it is only these 90 classes." }, { "start": 1929.1399999999999, "end": 1931.84, "text": " But it's for now it's a it's pretty cool." }, { "start": 1931.84, "end": 1937.58, "text": " And it works pretty well and just the easiness with which you get which which you can get" }, { "start": 1937.58, "end": 1945.4199999999998, "text": " this stuff elephants in Kruger National Park." }, { "start": 1945.4199999999998, "end": 1947.98, "text": " Just the easiness is astonishing." }, { "start": 1947.98, "end": 1956.06, "text": " You can just load it up, kind of have this bit of a notebook and with a bit of like a" }, { "start": 1956.06, "end": 1963.1399999999999, "text": " very few lines of code, you can put something together that detects these bounding boxes." }, { "start": 1963.1399999999999, "end": 1964.1399999999999, "text": " Lots of elephants." }, { "start": 1964.1399999999999, "end": 1967.26, "text": " And remember, we only have the top five elephants right here." }, { "start": 1967.26, "end": 1969.84, "text": " So what happens if we go for more?" }, { "start": 1969.84, "end": 1971.28, "text": " Where is our top K?" }, { "start": 1971.28, "end": 1975.52, "text": " So here we can maybe say the top 15 predictions." }, { "start": 1975.52, "end": 1982.06, "text": " And as always, if we want to make the model to make its own decision, we can simply revert" }, { "start": 1982.06, "end": 1986.78, "text": " back and add back the no class label." }, { "start": 1986.78, "end": 1990, "text": " All right, with that, I hope you like this video." }, { "start": 1990, "end": 1995.94, "text": " If you did, then maybe tell YouTube that you liked it, share it out." }, { "start": 1995.94, "end": 2002.1399999999999, "text": " And I will share this notebook in the description for you to find and play around with." }, { "start": 2002.1399999999999, "end": 2003.1399999999999, "text": " All right, thanks for watching." }, { "start": 2003.14, "end": 2012.3400000000001, "text": " Bye bye." } ]
SY5PvZrJhLE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
GPT-3: Language Models are Few-Shot Learners (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "transformers", "attention", "nlp", "natural language processing", "gpt3", "gpt-3", "gpt2", "gpt-2", "openai", "language model", "mlm", "autoregressive", "heads", "bert", "turing", "microsoft", "question answering", "news", "glue", "superglue", "sota", "preplexity", "corpus", "common crawl", "wikipedia", "natural questions", "boolq", "math", "strings", "context", "deep language", "zero shot", "few shot", "training data" ]
#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 are few-shot learners by Tom B Brown, Benjamin Mann, Nick Ryder and Melanie Sabaya and a whole slew of authors from OpenAI. This paper also called GPT-3 just came out recently. GPT-3 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. Now 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. 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. 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 large supervised datasets to learn most language tasks. 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 datasets. 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 datasets they use. They use this common crawl dataset which they filter down for quality and this is basically a crawl of the entire internet if you will together with these books datasets and the web text dataset and the Wikipedia dataset. 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 GPT-3 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 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 Turing NLG of Microsoft had something like 17 billion parameters so it would be comparable to this right here whereas GPT-3 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 GPT-2 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 GPT-3 XL model right here they train 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 train 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 BERT 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 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 but essentially this is an autoregressive language model so it's not like BERT it's not bi-directional it is autoregressive it goes from left to right always produces the next word it is like GPT-2 they even say this they say we use the same model and architecture as GPT-2 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 it so it's not even something fancy like BERT. The interesting part is when you do the now the the single tasks so what you usually did with something like BERT so with something like BERT you would do first pre-train so there you would this is the language modeling right here this pre-training phase where you teach BERT 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 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 all 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 sea otter is called Luther de Mer and in and 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 right 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 data 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 simply ask the model as a language model to predict the next work 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 the 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 it 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 this is enough if you've trained a good language model that this is enough to to 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 you the general model of the internet now they trend 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 Luther de Mer 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 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 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 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 it 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 so I get 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 from a from a 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 which to French new line see order goes to loot the name 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 right 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 hold 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 shop or it's from us 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 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 these 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 they basically say as you go up with the parameters you see the more yellow ones 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 perplexity and that the this basically follows a trend oh no this is a log scale this 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 a power law 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 so now they're 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 her friend and then it's like what's the next word okay is Bob and George bought some baseball equipment a ball a glove and a what's the next word and I guess this should be hat 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 facts 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 results 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 example is going to be something like this you have a task description like answer the following questions answer the question and then you have your examples in zero shot that's zero and one shot it's one that's what I'd like and then you say how tall who sorry who I don't know who climbed Everest the first the rest 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 how tall is the Empire State building and then you have like some number here and at the end you say what was it was it was a question from before I don't know who is the Queen of England yeah 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 outperforms it by simply having a lot of language so this here is the results on on these open domain QA tasks and you you see right here it the this this few shot it outperforms this open domain and 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 under performs 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 an 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 tasks 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 fifty 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'll 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 write 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 year 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 K 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 the things that sort of pattern match sort of regex 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 and it comes out a certain class car I like the explainability should be which part of this image was it the wheels was it the the hood which part of the image which part of the input image is responsible for making that determination what I think in especially in 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 site me site 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 interpret ability 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 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 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 outperform 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 task specific but don't have a supervised training set and this model right here it just learns whatever it learns and it it just it just does it just does this 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 you know good okay okay the next thing is these um Winograd 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 large but will not out produce a fine-tuned 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 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 asks common-sense question about how the physical word work 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 right here even though 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 issue so what they found was there was a significant overlap between the data set this data set and their training data set and they even they only realized this too late because there was a bug in their deduplication code and then they couldn't change it anymore like I 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 built the the International Space Station or something like this where it's 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 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 even 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 at the the fine tuned state-of-the-art model outperform the GPT-3 quite a bit so and also the 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 what 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 these coca tasks 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 setting 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 and interpret because you have to do actual reasoning and I think that's why the model performs poorly here they do measure this on 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 BERT model slightly the BERT model is fine tuned on these things whereas GPT-3 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 bool 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 bool 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 okay this 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 these 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 and then you 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 kind of 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 there 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 fine-tune the model you don't have to turn 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 to digit addition so what the model would see would so 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 even 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 inference is if the model can do this it must have learned you know some kind of reasoning ability it must have learned to like perform some logic inside so they go into two-digit addition three-digit addition four-digit addition five-digit addition 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 percent in three-digit addition 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 addition 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 addition with zero shot you already get 76 percent but with one shot you get 99 percent and with few shot you get a hundred percent so if you interpret this model as 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 erased our example again so you have like 48 plus 72 equals blah blah blah you have these of 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 d duplication stuff because what can appear actually is not the what can appear is a table and in 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 70 I believe at least and I can find now Google makes it hard because they localize and everything but you can still find what you're going to find our tables and tables and tables and tables and now I actually went to doc.go to basically say you know they 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 model is 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 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 percent of the math things are in their training data is 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 word scrambling tasks where they basically scramble words and they ask the model to unscramble it 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 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 the words in in sorry that 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 count it 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 the training data the this is a sat analogy so the SAT or this test that the US high schoolers take to get into college and the the this they say a typical example this is dying on me no it's scrolled okay a typical example is the following this I find I find pretty hilarious all Dacius 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 while 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 percent in the few shot setting and 59 percent in the one shot setting 53 percent is zero shot setting whereas the average score among college applicants was 57 percent 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 it was barely above chance at 52 percent 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 do this in a few short setting such that the model basically knows that it's if you give it a few 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 it's learned to reason keep context and 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 do 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 the ban on the ordination of just this substring and I've put it into Google and Babidi bah 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 author is 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 Associated 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 to strengthen the faiths divisive bands on same-sex 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 Starr talks promise draws Megyn Kelly's sarcasm and it says a year ago joking Phoenix made headlines when he appeared on the red carpet at the Golden Globes wearing a tuxedo with a paper bag over his head that read I'm a shape-shifter blah blah you you would guess that joking Phoenix would do something like this but they say their human raiders were US based right and you see right here it says Megyn Kelly was not impressed and she let him have it on the tonight show now that tonight show is not what Megyn 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 made it such that this person is on this show which that they aren't and the humans noticed right but it doesn't change the fact that it probably just went to the training data filtered a 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 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 my machine learning research ideas and what will output will be sort of an abstract of a paper that is 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 scree is something sorry to screech something is to swing a sword at it an example of a sentence that uses the word screech 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 so dictionaries then it's going to not know that word but it's you can interpolate it from interpolated from all this data right here and the so the cool thing is it actually conjugates the word we screed at each other for several minutes and then we went outside and ate 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 the input always here is poor English good English poor English good 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 I'd be I'd be actually impressed but yes nothing task specific is provided aside from the examples from few example as conditioning and the poor English input good English output framing so the good English output thing here should not be in boldface 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 the 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 it's a good English language model so yeah that so they measure this overfitting the degree to which their 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 deduplication is so weak they do like n-gram deduplication whereas I think you should really like in the news articles you should really do much more fuzzy deduplication much more of a meaning deduplication 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 grad 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 deduplication 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 input this broader impact statement is 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 tasks 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 the context is actually in there I 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 are 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 leave it a like tell me in the comments what you think of it whether you think it's actually a GI or not and I'll see you next time bye bye
[ { "start": 0, "end": 4.6000000000000005, "text": " Hello there! Today we're looking at language models are few-shot learners by" }, { "start": 4.6000000000000005, "end": 12.040000000000001, "text": " Tom B Brown, Benjamin Mann, Nick Ryder and Melanie Sabaya and a whole slew of" }, { "start": 12.040000000000001, "end": 19.44, "text": " authors from OpenAI. This paper also called GPT-3 just came out recently." }, { "start": 19.44, "end": 26.64, "text": " GPT-3 is a language model and it comes out of a succession of" }, { "start": 26.64, "end": 30.96, "text": " language models of OpenAI. This paper is basically an investigation into what" }, { "start": 30.96, "end": 35.52, "text": " you can do with giant language models. Now this language model is an order of" }, { "start": 35.52, "end": 41.04, "text": " magnitude larger than anyone has ever built a language model and it can do" }, { "start": 41.04, "end": 46.519999999999996, "text": " some absolutely crazy things. So we'll basically go over the architecture, over" }, { "start": 46.519999999999996, "end": 51.480000000000004, "text": " what the model does and over the experimental results. It turns out that" }, { "start": 51.48, "end": 58.31999999999999, "text": " if you train a language model on enough data it is able to solve NLP tasks that" }, { "start": 58.31999999999999, "end": 64.08, "text": " it has never seen just out of the box. We're going to look into this very" }, { "start": 64.08, "end": 69.02, "text": " cool kind of formulation of the problem. As you can see here the paper is 40" }, { "start": 69.02, "end": 74.24, "text": " pages long without the appendix. It needs its own table of contents which is crazy." }, { "start": 74.24, "end": 79.4, "text": " So we're going to skip a fair bit of things. First of all what is a" }, { "start": 79.4, "end": 84.5, "text": " language model? For those of you who don't know I've done a bunch of videos and you" }, { "start": 84.5, "end": 88.52000000000001, "text": " can see those in my natural language processing playlist about language" }, { "start": 88.52000000000001, "end": 93.2, "text": " models and specifically about transformer language models. So a language model" }, { "start": 93.2, "end": 98.24000000000001, "text": " let's just take an example this sentence right here. Just the sentence as such" }, { "start": 98.24000000000001, "end": 103.2, "text": " like third humans do not require large supervised" }, { "start": 103.2, "end": 107.88000000000001, "text": " datasets to learn most language tasks. This is an English sentence and a" }, { "start": 107.88, "end": 113.03999999999999, "text": " language model would be a model that if you cross out a portion from the end" }, { "start": 113.03999999999999, "end": 119.72, "text": " here like this right here it would be able to tell you what comes next. So in" }, { "start": 119.72, "end": 125.32, "text": " a language model you would input this part right here and it will tell you the" }, { "start": 125.32, "end": 130.64, "text": " next word is datasets. So that's basically all the language model does and" }, { "start": 130.64, "end": 135.56, "text": " once you've trained one you can basically generate word after word after" }, { "start": 135.56, "end": 141.08, "text": " word from it or you can ask it a question like which word is most likely" }, { "start": 141.08, "end": 146.44, "text": " to come next or more likely. So a language model is nothing but a model" }, { "start": 146.44, "end": 151.2, "text": " that can kind of generate language in a probabilistic way and the cool thing" }, { "start": 151.2, "end": 156.32, "text": " about language models is that you can train it on any sort of text data and" }, { "start": 156.32, "end": 162.8, "text": " that's what they do here. So they train a language model on giant amounts of data" }, { "start": 162.8, "end": 168.08, "text": " specifically right here they go into the datasets they use. They use this" }, { "start": 168.08, "end": 176.48000000000002, "text": " common crawl dataset which they filter down for quality and this is" }, { "start": 176.48000000000002, "end": 182.92000000000002, "text": " basically a crawl of the entire internet if you will together with these books" }, { "start": 182.92000000000002, "end": 188.84, "text": " datasets and the web text dataset and the Wikipedia dataset. So they throw all" }, { "start": 188.84, "end": 192.24, "text": " of this text that they scrape from the internet together and then train a" }, { "start": 192.24, "end": 201.08, "text": " language model on that. Now the language model right here is called" }, { "start": 201.08, "end": 206.4, "text": " GPT-3 and they train various sizes of it and we'll get into how it's built in a" }, { "start": 206.4, "end": 213.32000000000002, "text": " second but just compare this to a language model like BERT. BERT required" }, { "start": 213.32000000000002, "end": 220.24, "text": " this much flops to train and this is a log scale so this is right here" }, { "start": 220.24, "end": 225.84, "text": " this is several orders of magnitude larger and bigger model and is trained" }, { "start": 225.84, "end": 231.12, "text": " for way longer on this text so naturally it is going to be a lot better at" }, { "start": 231.12, "end": 237.72, "text": " language modeling. You can see right here the size of these models that they" }, { "start": 237.72, "end": 244.60000000000002, "text": " trained on. Remember the previous largest language model the Turing NLG of" }, { "start": 244.60000000000002, "end": 248.60000000000002, "text": " Microsoft had something like 17 billion parameters so it would be comparable to" }, { "start": 248.6, "end": 257.24, "text": " this right here whereas GPT-3 has 175 billion parameters which this is" }, { "start": 257.24, "end": 261.56, "text": " absolutely crazy. This is an order of magnitude higher than anything that's" }, { "start": 261.56, "end": 268.24, "text": " ever existed and if you look at the last GPT the GPT-2 model that if you remember" }, { "start": 268.24, "end": 272.96, "text": " I've made a video about it is too dangerous to be released well now it has" }, { "start": 272.96, "end": 278.48, "text": " been released but was too dangerous to be released it clocked in at about 1.5" }, { "start": 278.48, "end": 285.64000000000004, "text": " billion parameters so compared to this GPT-3 XL model right here they train" }, { "start": 285.64000000000004, "end": 289.6, "text": " these multiple models to basically estimate the effect of the model size" }, { "start": 289.6, "end": 297.16, "text": " and you can see here the largest model has 96 attention layers. Each layer" }, { "start": 297.16, "end": 306.72, "text": " has 96 attention heads and each head is 128 dimensional and it trains on batches" }, { "start": 306.72, "end": 312.52000000000004, "text": " of size 3.2 million. This is the batch size absolutely crazy so they train" }, { "start": 312.52000000000004, "end": 319.16, "text": " this on a giant distributed cluster that apparently is provided by Microsoft and" }, { "start": 319.16, "end": 326.32000000000005, "text": " yes crazy crazy things. So how does this model look? This model is a transformer" }, { "start": 326.32000000000005, "end": 331.04, "text": " model and right here we don't even have like a description of a transformer" }, { "start": 331.04, "end": 335.72, "text": " model it's just assumed you know what that is. I have made several videos on" }, { "start": 335.72, "end": 340.08000000000004, "text": " transformer models and especially things like attention is all you need or BERT" }, { "start": 340.08000000000004, "end": 344.92, "text": " or something like this but for those who don't know if I have a transformer" }, { "start": 344.92, "end": 349.44000000000005, "text": " model and I want to build a language model from it let's take this sentence" }, { "start": 349.44000000000005, "end": 355.56, "text": " right here I would input a what's called a context which is the thing I already" }, { "start": 355.56, "end": 360.20000000000005, "text": " have right I would input that into a transformer model and a transformer" }, { "start": 360.20000000000005, "end": 365.12, "text": " model is just several layers of attention mechanism. Now an attention" }, { "start": 365.12, "end": 369.6, "text": " mechanism is basically a way where information is routed in between the" }, { "start": 369.6, "end": 375.8, "text": " different tokens right here and as it goes up the layer basically the the" }, { "start": 375.8, "end": 379.96, "text": " information is routed around and the model can make various inferences and at" }, { "start": 379.96, "end": 386, "text": " the end the model is supposed to come up with the next word that you're going to" }, { "start": 386, "end": 392.04, "text": " put here. Specifically in this paper they use sub words like word piece tokens" }, { "start": 392.04, "end": 397.44, "text": " like it is common in NLP right now but essentially this is an autoregressive" }, { "start": 397.44, "end": 401.52000000000004, "text": " language model so it's not like BERT it's not bi-directional it is" }, { "start": 401.52000000000004, "end": 406.24, "text": " autoregressive it goes from left to right always produces the next word it" }, { "start": 406.24, "end": 412.24, "text": " is like GPT-2 they even say this they say we use the same model and" }, { "start": 412.24, "end": 420.88, "text": " architecture as GPT-2 they just have more layers and wider layers and more" }, { "start": 420.88, "end": 429.48, "text": " data to train it on. So how do they train it? Okay that's we already said they" }, { "start": 429.48, "end": 435.08, "text": " train it in simply in simply a language modeling way just next word prediction" }, { "start": 435.08, "end": 439.71999999999997, "text": " that's it okay it so it's not even something fancy like BERT. The" }, { "start": 439.71999999999997, "end": 445.52, "text": " interesting part is when you do the now the the single tasks so what you usually" }, { "start": 445.52, "end": 451.59999999999997, "text": " did with something like BERT so with something like BERT you would do first" }, { "start": 451.59999999999997, "end": 457.08, "text": " pre-train so there you would this is the language modeling right here this" }, { "start": 457.08, "end": 461.52, "text": " pre-training phase where you teach BERT about the English language by just" }, { "start": 461.52, "end": 468.24, "text": " feeding it a lot of data and then second you had a step called fine-tuning fine I" }, { "start": 468.24, "end": 474.59999999999997, "text": " can't even write tuning so on the second one you'd have something like the task" }, { "start": 474.6, "end": 477.6, "text": " you're actually interested in and let's say the task you're actually interested" }, { "start": 477.6, "end": 481.72, "text": " in is sentiment classification so in sentiment classification you have like a" }, { "start": 481.72, "end": 488.40000000000003, "text": " sentence like blah blah blah and you want to know is that a positive" }, { "start": 488.40000000000003, "end": 492.8, "text": " sentiment like is a happy sentence or is it a sad sentence and you would have a" }, { "start": 492.8, "end": 498.6, "text": " database of labeled instances of that so in this database you'd have a bunch of" }, { "start": 498.6, "end": 502.92, "text": " sentences and for each one you would know is it good is it is it positive or" }, { "start": 502.92, "end": 508.56, "text": " is it negative and then you'd have like a smaller test set right here and you" }, { "start": 508.56, "end": 513.2, "text": " would you would train you would basically take this pre-trained model" }, { "start": 513.2, "end": 518.36, "text": " train it on this data set in a supervised machine learning way and then" }, { "start": 518.36, "end": 522.8000000000001, "text": " test it on this test set right here this is called fine-tuning that's what they" }, { "start": 522.8000000000001, "end": 530, "text": " display here so in fine-tuning the model is trained via repeated gradient updates" }, { "start": 530, "end": 536.56, "text": " using a large corpus of example tasks all right so the example task right here" }, { "start": 536.56, "end": 540.44, "text": " could be translating to French so in your training database of the" }, { "start": 540.44, "end": 545.28, "text": " translation task would be this would be sea otter is called Luther de Mer and" }, { "start": 545.28, "end": 552.12, "text": " in and and then you'd actually change your model you do a gradient update I" }, { "start": 552.12, "end": 557.44, "text": " mean if if you're in the NLP world this seems very natural but they are going to" }, { "start": 557.44, "end": 563, "text": " argue in a second that this isn't the only way that you can teach a model a" }, { "start": 563, "end": 568.5600000000001, "text": " task right so this this seems very natural right you're going to change" }, { "start": 568.5600000000001, "end": 572.48, "text": " your model you take your pre-trained model and you're going to fine-tune it" }, { "start": 572.48, "end": 576, "text": " on this task and if you have a different task right if you have now" }, { "start": 576, "end": 580.72, "text": " question answering task you're going to have a different data set right here" }, { "start": 580.72, "end": 586.96, "text": " with a train and test data set and you're going to take the pre-trained" }, { "start": 586.96, "end": 592.0400000000001, "text": " model and then fine-tune it on that data set and evaluate it on that test set so" }, { "start": 592.0400000000001, "end": 596.8000000000001, "text": " this gives you basically with as many models as you have tasks and you for" }, { "start": 596.8000000000001, "end": 601.64, "text": " each one you need a big big training data set in order to perform well" }, { "start": 601.64, "end": 605.88, "text": " sometimes we have this sometimes we don't what they are interested in is" }, { "start": 605.88, "end": 611.36, "text": " basically to take the pre-trained model and directly go and evaluate it on the" }, { "start": 611.36, "end": 616.5600000000001, "text": " test data set in a sort of a zero-shot fashion now it is not zero shot as they" }, { "start": 616.56, "end": 622.0799999999999, "text": " will argue so what are they doing in a true zero-shot fashion you would just" }, { "start": 622.0799999999999, "end": 627.92, "text": " take your your language model that you pre-trained and you just input the" }, { "start": 627.92, "end": 633.88, "text": " following text you input what they call a task description and a prompt so this" }, { "start": 633.88, "end": 639.52, "text": " is the input and you simply ask the model as a language model to predict the" }, { "start": 639.52, "end": 644.04, "text": " next work it's just what comes here now what you're counting on is basically" }, { "start": 644.04, "end": 649.4, "text": " that in the training data the model has seen a structure like this enough to" }, { "start": 649.4, "end": 653.36, "text": " understand what's going on so that in the training data somewhere in the" }, { "start": 653.36, "end": 658.28, "text": " internet there was the structure of translate something to something and" }, { "start": 658.28, "end": 663.48, "text": " then there would be a word here of something and you know it kind of has to" }, { "start": 663.48, "end": 667.8, "text": " realize that this goes here like that the next word so basically what you're" }, { "start": 667.8, "end": 675.52, "text": " asking it is if you were to find this text on a website or on Wikipedia or in" }, { "start": 675.52, "end": 681.8, "text": " any of the books data set if you were to find this piece of text what would be" }, { "start": 681.8, "end": 688.8399999999999, "text": " the next word in that piece of text and you kind of hope that this this is" }, { "start": 688.8399999999999, "end": 695.88, "text": " enough if you've trained a good language model that this is enough to to to" }, { "start": 695.88, "end": 700, "text": " actually produce the French translation here now before I realize I've said the" }, { "start": 700, "end": 703.56, "text": " language modeling is to teach the model the English language actually not true" }, { "start": 703.56, "end": 708.2, "text": " in this common crawl corpus you also have many foreign languages so you" }, { "start": 708.2, "end": 716.56, "text": " basically teach you the general model of the internet now they trend they they" }, { "start": 716.56, "end": 722.92, "text": " contrast this to what they call one-shot learning so in one-shot learning you not" }, { "start": 722.92, "end": 726.76, "text": " only do you have the task description right here and this is this is a string" }, { "start": 726.76, "end": 730.5999999999999, "text": " right you don't specifically tell the model that this is now a translation" }, { "start": 730.5999999999999, "end": 734.76, "text": " task you simply input this as a string so not only do you have the task" }, { "start": 734.76, "end": 740.76, "text": " description and the prompt right here but you also have one example and the" }, { "start": 740.76, "end": 746.7199999999999, "text": " example and this is where they this is where they bring in the where they say" }, { "start": 746.7199999999999, "end": 751.28, "text": " it's not exactly zero shot where's my little drawing here so the example is" }, { "start": 751.28, "end": 758.12, "text": " going to come from the training data set of the task that you're interested in" }, { "start": 758.12, "end": 765.28, "text": " but the important part is you never train on it you never explicitly train" }, { "start": 765.28, "end": 769.52, "text": " on that example you simply put it in the context so you simply put this string so" }, { "start": 769.52, "end": 776.8399999999999, "text": " translate English to French new line see order is Luther de Mer new line cheese" }, { "start": 776.84, "end": 782.72, "text": " is what you simply input that string into the model as a language model and" }, { "start": 782.72, "end": 789.32, "text": " you ask it what's the next word right here okay so I hope I hope this is clear" }, { "start": 789.32, "end": 795.32, "text": " this is what they call kind of one-shot generalization and by one shot they" }, { "start": 795.32, "end": 801.08, "text": " basically mean you simply provide this thing in the context of the model as a" }, { "start": 801.08, "end": 807.0400000000001, "text": " language model now the the advantage here is immediately clear that you only" }, { "start": 807.0400000000001, "end": 813.44, "text": " have to train one model then and then basically at inference time you can just" }, { "start": 813.44, "end": 820.64, "text": " input the task description and the sort of training data for the task into its" }, { "start": 820.64, "end": 828.48, "text": " its evaluation context and the task itself and it will if if it is if it" }, { "start": 828.48, "end": 834.4, "text": " really does what they claim it does it would be able to sort of understand the" }, { "start": 834.4, "end": 838.5600000000001, "text": " prompt here understand what it means to translate from English to French it" }, { "start": 838.5600000000001, "end": 844.12, "text": " would look at this example and say oh that's what you want me to do okay and" }, { "start": 844.12, "end": 849.6800000000001, "text": " then it would be able to generalize to this input right here to say okay from" }, { "start": 849.6800000000001, "end": 854.48, "text": " the task description and the example I so I get I get what you want me to do I" }, { "start": 854.48, "end": 861.8000000000001, "text": " will the next word here is cheese what's cheese in French I don't remember from" }, { "start": 861.8000000000001, "end": 868.6, "text": " a from a now the way the language model is going to interpret that is slightly" }, { "start": 868.6, "end": 872.08, "text": " different as we said before the way the language model is going to interpret is" }, { "start": 872.08, "end": 878.24, "text": " if you were to find the following text on a website somewhere the text is" }, { "start": 878.24, "end": 882.88, "text": " called translating which to French new line see order goes to loot the name new" }, { "start": 882.88, "end": 888.64, "text": " line cheese goes to what would be the next word on that website so that's what" }, { "start": 888.64, "end": 891.68, "text": " the model sees right you have to differentiate between what the human" }, { "start": 891.68, "end": 895.52, "text": " wants and what the model sees the model is just a language model that is going" }, { "start": 895.52, "end": 899.92, "text": " to take the next that is just going to determine if I were to see this text" }, { "start": 899.92, "end": 904.56, "text": " somewhere what will be the most likely next word so you have to phrase your" }, { "start": 904.56, "end": 910.4, "text": " tasks in a way that makes sense in that thing and they also have this few shot" }, { "start": 910.4, "end": 914.72, "text": " thing where you not only provide one context but you provide a bunch of" }, { "start": 914.72, "end": 922.0799999999999, "text": " context to basically tell the model more of what it what it should do right now" }, { "start": 922.0799999999999, "end": 927.52, "text": " this doesn't only work in a free mode where you basically say what's the next" }, { "start": 927.52, "end": 930.88, "text": " word here what you can also do if you have such a language hold with the exact" }, { "start": 930.88, "end": 935.4, "text": " same model you can give it basically a couple of possibilities so you can give" }, { "start": 935.4, "end": 942.84, "text": " it it's you can say like it's either shop or it's from us or it's hotel I" }, { "start": 942.84, "end": 949, "text": " think that has like this so you can you can basically restrict it to only" }, { "start": 949, "end": 954.1999999999999, "text": " produce one of these three things so in translation this might not be you know" }, { "start": 954.1999999999999, "end": 960.24, "text": " the the way to go but in if you have like yes no answers questions you can" }, { "start": 960.24, "end": 964.96, "text": " restrict it to that so in a lot of these NLP tasks you have some options given" }, { "start": 964.96, "end": 969, "text": " for a given question and you can also restrict it so don't you know you always" }, { "start": 969, "end": 974.24, "text": " have to go with the task at hand but this is in essence what the model does" }, { "start": 974.24, "end": 980.2800000000001, "text": " and this is I think this is the new well not the new per se but this is one of" }, { "start": 980.2800000000001, "end": 984.32, "text": " the core ideas of this paper if you take anything from it there's no new" }, { "start": 984.32, "end": 988.9200000000001, "text": " architecture right here there's no new wisdom in training they train in a" }, { "start": 988.9200000000001, "end": 993.4000000000001, "text": " standard way in a standard language modeling fashion a standard transformer" }, { "start": 993.4, "end": 997.52, "text": " architecture this just happens to be ginormous okay this right here this" }, { "start": 997.52, "end": 1001.76, "text": " thing where they say most of these things would fine-tune and then" }, { "start": 1001.76, "end": 1007.24, "text": " basically end up with one model per task and you need a big data set per task but" }, { "start": 1007.24, "end": 1013.64, "text": " we simply can do this since we have such a large language model it is basically" }, { "start": 1013.64, "end": 1018, "text": " already basically already knows how to do these tasks as long as we formulate" }, { "start": 1018, "end": 1023.8, "text": " them in a language model way we can have the model perform these tasks and they" }, { "start": 1023.8, "end": 1029.96, "text": " will show that this works surprisingly well throughout this paper now we get" }, { "start": 1029.96, "end": 1036.64, "text": " into the experimental results right here and the experimental results first of" }, { "start": 1036.64, "end": 1043.48, "text": " all on language modeling as you can see here they basically say as you go up" }, { "start": 1043.48, "end": 1048.24, "text": " with the parameters you see the more yellow ones are the parameters you go" }, { "start": 1048.24, "end": 1053.72, "text": " into your validation loss goes down and down and down and down and I believe" }, { "start": 1053.72, "end": 1059.6, "text": " this is sort of a log scale as well so this is the log probability so the" }, { "start": 1059.6, "end": 1067.56, "text": " perplexity and that the this basically follows a trend oh no this is a log" }, { "start": 1067.56, "end": 1074.04, "text": " scale this this is a log scale it follows a trend where as you scale up" }, { "start": 1074.04, "end": 1078.3999999999999, "text": " the model and as you scale up the compute that the model gets and we know" }, { "start": 1078.3999999999999, "end": 1082, "text": " for these big language models we basically know you have to scale up model" }, { "start": 1082, "end": 1088.1599999999999, "text": " size compute time and data set size in the same fashion for them to make these" }, { "start": 1088.1599999999999, "end": 1094.76, "text": " gains but if you do that it follows like a a power law where as you scale up" }, { "start": 1094.76, "end": 1097.8799999999999, "text": " these things the model basically gets better and better and better and the" }, { "start": 1097.8799999999999, "end": 1103.08, "text": " question of course is you know how far how far can we go with this but for now" }, { "start": 1103.08, "end": 1107.64, "text": " it seems to hold quite well that you can just make improvements by scaling up" }, { "start": 1107.64, "end": 1116.68, "text": " your model on language modeling at least so where do we where do we basically go" }, { "start": 1116.68, "end": 1122.32, "text": " from here so before we dive into the actual results of the individual tasks" }, { "start": 1122.32, "end": 1126.72, "text": " so now they're going to formulate these individual tasks so they have like pure" }, { "start": 1126.72, "end": 1130.6399999999999, "text": " language modeling tasks right here like Alice was friends with Bob Alice went to" }, { "start": 1130.6399999999999, "end": 1135.08, "text": " visit her friend and then it's like what's the next word okay is Bob and" }, { "start": 1135.08, "end": 1139.76, "text": " George bought some baseball equipment a ball a glove and a what's the next word" }, { "start": 1139.76, "end": 1147.8799999999999, "text": " and I guess this should be hat sorry bat right here but we're going to go into" }, { "start": 1147.88, "end": 1155.4, "text": " the into the tasks and one of them is for example question answering so in" }, { "start": 1155.4, "end": 1160.2, "text": " question answering you simply get either you get just a pure question or a" }, { "start": 1160.2, "end": 1168.64, "text": " context and a question and they do the facts they test where a situation where" }, { "start": 1168.64, "end": 1172.72, "text": " you just get the question so you just get I don't know who is the queen of" }, { "start": 1172.72, "end": 1179.08, "text": " England or something like this and the model is simply to produce either the" }, { "start": 1179.08, "end": 1185.08, "text": " results direct or to choose from a bunch of answers which one is the most likely" }, { "start": 1185.08, "end": 1192.1200000000001, "text": " as a language model and as you can see as you scale up the language model the" }, { "start": 1192.1200000000001, "end": 1197.68, "text": " zero shot one shot and few shot predictions so in few shot you give 64" }, { "start": 1197.68, "end": 1203.3600000000001, "text": " different examples from the training set in the context so you always have so" }, { "start": 1203.3600000000001, "end": 1208.2, "text": " your context is going to look something like this and they have examples at the" }, { "start": 1208.2, "end": 1213.0800000000002, "text": " bottom and haven't looked at the QA task but the the example is going to be" }, { "start": 1213.0800000000002, "end": 1217.28, "text": " something like this you have a task description like answer the following" }, { "start": 1217.28, "end": 1223.48, "text": " questions answer the question and then you have your examples in zero shot" }, { "start": 1223.48, "end": 1228.96, "text": " that's zero and one shot it's one that's what I'd like and then you say how tall" }, { "start": 1228.96, "end": 1239.32, "text": " who sorry who I don't know who climbed Everest the first the rest the first and" }, { "start": 1239.32, "end": 1246.84, "text": " then you say Hillary I think it was Hillary no I don't remember and then you" }, { "start": 1246.84, "end": 1252.88, "text": " say I don't know how how tall is the Empire State building and then you have" }, { "start": 1252.88, "end": 1260.24, "text": " like some number here and at the end you say what was it was it was a question" }, { "start": 1260.24, "end": 1264.92, "text": " from before I don't know who is the Queen of England yeah who is the Queen" }, { "start": 1264.92, "end": 1271.68, "text": " of England and then you ask the model to predict the next word right here okay" }, { "start": 1271.68, "end": 1279.0400000000002, "text": " and you do this in a closed book setting which means you have no access to" }, { "start": 1279.04, "end": 1283.72, "text": " Wikipedia or whatever like usually these systems they can go and query Wikipedia" }, { "start": 1283.72, "end": 1289.04, "text": " but this system doesn't so you just you just want to know what has the model" }, { "start": 1289.04, "end": 1294.92, "text": " learned about the world by simply absorbing giant amounts of text so if" }, { "start": 1294.92, "end": 1299.84, "text": " somewhere in the training data the fact that the Queen of England is Elizabeth" }, { "start": 1299.84, "end": 1305.3999999999999, "text": " the second is present it should complete this right here and it performs" }, { "start": 1305.4, "end": 1311.64, "text": " surprisingly well as you can see here so it manages to outperform a fine-tuned" }, { "start": 1311.64, "end": 1316.0800000000002, "text": " state-of-the-art model that is actually that is fine-tuned on question" }, { "start": 1316.0800000000002, "end": 1319.72, "text": " answering right this has it has been built for question answering and this" }, { "start": 1319.72, "end": 1327.48, "text": " model outperforms it by simply having a lot of language so this here is the" }, { "start": 1327.48, "end": 1336.92, "text": " results on on these open domain QA tasks and you you see right here it the this" }, { "start": 1336.92, "end": 1343.88, "text": " this few shot it outperforms this open domain and open domain means that the" }, { "start": 1343.88, "end": 1356.32, "text": " model can go and look at some Wikipedia page and yeah so so this is pretty cool" }, { "start": 1356.32, "end": 1361.28, "text": " but there are other things like the natural questions where it under" }, { "start": 1361.28, "end": 1367.3999999999999, "text": " performs compared to this open domain thing and they say this is mainly due to" }, { "start": 1367.3999999999999, "end": 1372.56, "text": " the natural questions being like it's very much about factual Wikipedia" }, { "start": 1372.56, "end": 1377.52, "text": " knowledge and so on maybe like the question we just made maybe is more of a" }, { "start": 1377.52, "end": 1383.04, "text": " natural question type of thing and since and the model is apparently not as good" }, { "start": 1383.04, "end": 1388.3999999999999, "text": " at that but it's still impressive that the model is able to do this out of the" }, { "start": 1388.3999999999999, "end": 1395.68, "text": " box okay so before I said something like before we go into the experiments I want" }, { "start": 1395.68, "end": 1401.32, "text": " the following so I have like some sort of hypothesis it's not it's an it's not" }, { "start": 1401.32, "end": 1407.56, "text": " an uncommon hypothesis that basically these things these giant language models" }, { "start": 1407.56, "end": 1411.72, "text": " right they're just these transformers layer after layer after layer with their" }, { "start": 1411.72, "end": 1417.88, "text": " connections in here what I think is happening is they are simply storing the" }, { "start": 1417.88, "end": 1423.24, "text": " training data right they are simply storing the training data in these" }, { "start": 1423.24, "end": 1428.08, "text": " connections right here so usually you think of storing the training data in" }, { "start": 1428.08, "end": 1432.16, "text": " some form of maybe we have like some module right here some database module" }, { "start": 1432.16, "end": 1437.28, "text": " in the neural network and it learns to query the module but ultimately if you" }, { "start": 1437.28, "end": 1443.16, "text": " train a neural network what you have is data and you train a function with" }, { "start": 1443.16, "end": 1449.3999999999999, "text": " parameters on that data and ultimately what you're doing is you're distilling" }, { "start": 1449.3999999999999, "end": 1455.28, "text": " the data into these parameters and you kind of hope to learn some regularities" }, { "start": 1455.28, "end": 1460.08, "text": " from it but ultimately the information about your training data influences or" }, { "start": 1460.08, "end": 1465.68, "text": " determines your final parameters of your function now I can imagine that if you" }, { "start": 1465.68, "end": 1472, "text": " have such a giant neural network with so many weights like 17 sorry 170 billion" }, { "start": 1472, "end": 1478.48, "text": " weights that you can pretty efficiently actually store the training data in that" }, { "start": 1478.48, "end": 1486.04, "text": " model and when you ask this model now to do something what it basically does is" }, { "start": 1486.04, "end": 1491.04, "text": " what these people sort of argue is that it has learned these language tasks is" }, { "start": 1491.04, "end": 1495.92, "text": " learned to reason over language and so on what I think is happening much more" }, { "start": 1495.92, "end": 1501.84, "text": " is it will simply go to the training data since it has stored the entire" }, { "start": 1501.84, "end": 1507.2, "text": " training data in its weights and it will sort of pull out the five to ten to fifty" }, { "start": 1507.2, "end": 1513.48, "text": " training examples that are most relevant to what you put in and it will sort of" }, { "start": 1513.48, "end": 1517.56, "text": " interpolate right you go to the training data and it'll pull out a bunch of" }, { "start": 1517.56, "end": 1521.8, "text": " training samples that are relevant to the context you put in right now and" }, { "start": 1521.8, "end": 1526.9199999999998, "text": " then it will sort of integrate those into the next word that's going to come" }, { "start": 1526.9199999999998, "end": 1533.3999999999999, "text": " out right here and I think if you look at this paper in terms of this so you" }, { "start": 1533.3999999999999, "end": 1538.84, "text": " always write you input a context and the context is split into a task" }, { "start": 1538.84, "end": 1545.52, "text": " description and then it is split into k different examples and then it is it is" }, { "start": 1545.52, "end": 1549.44, "text": " it has a prompt sorry this year this is the prompt so the task description is" }, { "start": 1549.44, "end": 1553.56, "text": " please translate from English to French and the k different things are k" }, { "start": 1553.56, "end": 1557.8799999999999, "text": " different translations and then the prompt is you know what what you should" }, { "start": 1557.8799999999999, "end": 1563.34, "text": " do so it's like half of a K half of one of these boxes right here so these boxes" }, { "start": 1563.34, "end": 1567.4, "text": " are have blah blah blah turns to blah blah blah and then the prompt is simply" }, { "start": 1567.4, "end": 1574.6399999999999, "text": " without the the right side I think what it does is it will simply take all of" }, { "start": 1574.64, "end": 1581.16, "text": " this and it will go to its own training data which it has stored in its weights" }, { "start": 1581.16, "end": 1587, "text": " and it will filter the training data and basically take out the the things that" }, { "start": 1587, "end": 1593, "text": " sort of pattern match sort of regex match in a fuzzy way to this context and" }, { "start": 1593, "end": 1597.6000000000001, "text": " then it will kind of interpolate these training examples in order to come up" }, { "start": 1597.6, "end": 1604.9199999999998, "text": " with the answer I don't think there is reasoning happening here and we're going" }, { "start": 1604.9199999999998, "end": 1610.36, "text": " to if you go through the paper with this view then you can a lot of things" }, { "start": 1610.36, "end": 1615.9199999999998, "text": " actually make sense and I actually I think that we need we need what we need" }, { "start": 1615.9199999999998, "end": 1620.74, "text": " when think people think of like explainable machine learning they often" }, { "start": 1620.74, "end": 1624.12, "text": " think that if I'm going to input something like I'm going to input an" }, { "start": 1624.12, "end": 1630.2399999999998, "text": " image into a classifier and it comes out a certain class car I like the" }, { "start": 1630.2399999999998, "end": 1635.36, "text": " explainability should be which part of this image was it the wheels was it the" }, { "start": 1635.36, "end": 1639.6399999999999, "text": " the hood which part of the image which part of the input image is responsible" }, { "start": 1639.6399999999999, "end": 1644.04, "text": " for making that determination what I think in especially in these language" }, { "start": 1644.04, "end": 1649.56, "text": " models what we should do is if the model predicts something right here the next" }, { "start": 1649.56, "end": 1655.24, "text": " word I think we should somehow have a method of determining which of the" }, { "start": 1655.24, "end": 1661.08, "text": " training examples that the model used to interpolate given this context" }, { "start": 1661.08, "end": 1666.36, "text": " because I'm pretty sure these training is you will find so if you'll find that" }, { "start": 1666.36, "end": 1670.84, "text": " for example this weight and this weight and this weight was very responsible for" }, { "start": 1670.84, "end": 1676.72, "text": " making this prediction happen I'm pretty sure you can somehow during training" }, { "start": 1676.72, "end": 1682.08, "text": " build an index of which of the which five training examples had most influence" }, { "start": 1682.08, "end": 1685.96, "text": " on that particular weight or on this combination of weights and then you can" }, { "start": 1685.96, "end": 1691.88, "text": " sort of go backwards and say you made this decision right here model please" }, { "start": 1691.88, "end": 1696.68, "text": " tell me which of the training data samples were responsible for making that" }, { "start": 1696.68, "end": 1702.08, "text": " decision actually pretty sure that already exists like I'm never the first" }, { "start": 1702.08, "end": 1709.76, "text": " one to think of these things though if I am site me site the channel no but just" }, { "start": 1709.76, "end": 1715.1999999999998, "text": " an interesting way to think about this model and an interesting way to think" }, { "start": 1715.1999999999998, "end": 1719.6799999999998, "text": " about kind of what does what would explain ability even mean in a model" }, { "start": 1719.6799999999998, "end": 1725.1999999999998, "text": " like this and my argument is since it interpolates the training data the" }, { "start": 1725.1999999999998, "end": 1730.1599999999999, "text": " interpret ability should come from the fact of which training samples does it" }, { "start": 1730.16, "end": 1737.28, "text": " interpolate okay let's go to translation so in translation as we said they simply" }, { "start": 1737.28, "end": 1748, "text": " input the like the task and then the few examples and then and then the output" }, { "start": 1748, "end": 1753.68, "text": " okay and you can see right here what you can see is that again as the model goes" }, { "start": 1753.68, "end": 1760.16, "text": " up in parameters the performance generally increases and also you can see" }, { "start": 1760.16, "end": 1765.5600000000002, "text": " that the performance is pretty good every time that this model goes to" }, { "start": 1765.5600000000002, "end": 1771.72, "text": " English so it goes if it if the target language is English which sort of makes" }, { "start": 1771.72, "end": 1777.0800000000002, "text": " sense because like a large part of the corpus they train on is English so being" }, { "start": 1777.0800000000002, "end": 1782.5600000000002, "text": " an English language model it should be pretty good if it is asked to produce" }, { "start": 1782.56, "end": 1787.12, "text": " English and it's not as good if it is asked to go into the different direction" }, { "start": 1787.12, "end": 1793.8799999999999, "text": " now what you also see is that it is not really a difference whether you translate" }, { "start": 1793.8799999999999, "end": 1800.08, "text": " from from which language you translate but if you go to English but it very" }, { "start": 1800.08, "end": 1807.6, "text": " much matters to which language you go if it is from English so this sort of makes" }, { "start": 1807.6, "end": 1812.9599999999998, "text": " sense in that it is just trained on a lot of English data and right here" }, { "start": 1812.9599999999998, "end": 1821.28, "text": " sometimes they are on par with the with the state-of-the-art supervised methods" }, { "start": 1821.28, "end": 1825.1599999999999, "text": " and also other times they outperform these methods right here and these" }, { "start": 1825.1599999999999, "end": 1829.1599999999999, "text": " methods are unsupervised but are specifically so they don't have a" }, { "start": 1829.1599999999999, "end": 1833.6799999999998, "text": " supervised training data set that goes let's say from English to French but" }, { "start": 1833.68, "end": 1839.3200000000002, "text": " they are built with this in mind that they need to translate later so they are" }, { "start": 1839.3200000000002, "end": 1844.52, "text": " sort of task specific but don't have a supervised training set and this model" }, { "start": 1844.52, "end": 1853.3600000000001, "text": " right here it just learns whatever it learns and it it just it just does it" }, { "start": 1853.3600000000001, "end": 1857.2, "text": " just does this this language model learning and at the end just because it" }, { "start": 1857.2, "end": 1862.88, "text": " has seen some websites where language of both things appear it can now translate" }, { "start": 1862.88, "end": 1873.7600000000002, "text": " reasonably well okay now yeah so the results here are a bit noisy but it is" }, { "start": 1873.7600000000002, "end": 1876.48, "text": " still interesting to see that it sometimes even gets close to the" }, { "start": 1876.48, "end": 1882.3200000000002, "text": " supervised thing though they say that they are not familiar with the literature" }, { "start": 1882.3200000000002, "end": 1889.22, "text": " and are not sure that these models that these numbers are you know good okay okay" }, { "start": 1889.22, "end": 1897.4, "text": " the next thing is these um Winograd schemes where you do have where is the" }, { "start": 1897.4, "end": 1903.6000000000001, "text": " text here is a classic NLP task that involves determining which word a" }, { "start": 1903.6000000000001, "end": 1909.92, "text": " pronoun refers to when the pronoun is grammatically ambiguous but semantically" }, { "start": 1909.92, "end": 1916.68, "text": " unambiguous to a human so these are sort of human produced sentences where" }, { "start": 1916.68, "end": 1923.04, "text": " it's kind of a pronoun could refer to multiple things I don't have a example" }, { "start": 1923.04, "end": 1931.96, "text": " present but where do we have the right here you can see that this model will" }, { "start": 1931.96, "end": 1939.88, "text": " out produce a fine-tuned large but will not out produce a fine-tuned Roberto" }, { "start": 1939.88, "end": 1947.3200000000002, "text": " large so it is going to it is going to come it is competing at least with the" }, { "start": 1947.3200000000002, "end": 1953.3200000000002, "text": " fine-tuned models that were made specifically for that task right again" }, { "start": 1953.3200000000002, "end": 1960.1200000000001, "text": " this is pretty pretty interesting and you also see that the larger models here" }, { "start": 1960.1200000000001, "end": 1964.68, "text": " it starts to make a difference whether or not you give it one zero or one or" }, { "start": 1964.68, "end": 1976.92, "text": " more examples okay so we'll get into we'll get into the the more interesting" }, { "start": 1976.92, "end": 1986.3600000000001, "text": " things right here in this thing right here where is it yes this is the kind of" }, { "start": 1986.36, "end": 1995.1599999999999, "text": " a physical physical question physical QA where it is a bit of common-sense" }, { "start": 1995.1599999999999, "end": 2004.8799999999999, "text": " reasoning so you're asked to I don't yeah these are like science questions" }, { "start": 2004.8799999999999, "end": 2010.6, "text": " multiple-choice questions collected from a third to ninth grade exams and the" }, { "start": 2010.6, "end": 2019.1599999999999, "text": " physical QA is physical QA asks common-sense question about how the" }, { "start": 2019.1599999999999, "end": 2024.32, "text": " physical word work world works and is intended as a probe of grounded" }, { "start": 2024.32, "end": 2030.24, "text": " understanding of the world so it has questions as I understand it it has" }, { "start": 2030.24, "end": 2035.9599999999998, "text": " questions like if a drop a ball will it fall on the ground or where will it fall" }, { "start": 2035.96, "end": 2042.6000000000001, "text": " or something like this and they say that they can outperform a fine-tuned state" }, { "start": 2042.6000000000001, "end": 2048.92, "text": " of the art model on this if they go just high enough and you can also see that" }, { "start": 2048.92, "end": 2055.6, "text": " there isn't much of a difference between zero one and few shot the methods of" }, { "start": 2055.6, "end": 2060.56, "text": " this model right here even though zero shot is even higher than one shot so" }, { "start": 2060.56, "end": 2066.56, "text": " this is probably just noise but then you find out that they have an asterisk here" }, { "start": 2066.56, "end": 2075.08, "text": " and this means that this is potentially a contaminated data set so they have" }, { "start": 2075.08, "end": 2079.56, "text": " potential contamination issue so what they found was there was a significant" }, { "start": 2079.56, "end": 2085.72, "text": " overlap between the data set this data set and their training data set and" }, { "start": 2085.72, "end": 2092.16, "text": " they even they only realized this too late because there was a bug in their" }, { "start": 2092.16, "end": 2099.08, "text": " deduplication code and then they couldn't change it anymore like I because" }, { "start": 2099.08, "end": 2103.9599999999996, "text": " this model is so large that they couldn't restart the training because" }, { "start": 2103.9599999999996, "end": 2108.3599999999997, "text": " they've already spent like so much money and energy on it this is crazy I think" }, { "start": 2108.3599999999997, "end": 2112.24, "text": " these language models are getting so large that we should building them we" }, { "start": 2112.24, "end": 2118.04, "text": " should more think of it like we built the the International Space Station or" }, { "start": 2118.04, "end": 2122.8799999999997, "text": " something like this where it's a project where humanity sort of collaborates or" }, { "start": 2122.8799999999997, "end": 2126.3199999999997, "text": " there's a big effort and you build it once and whatever you have you have" }, { "start": 2126.3199999999997, "end": 2135.3999999999996, "text": " right so these these good numbers here are simply or not simply are because or" }, { "start": 2135.3999999999996, "end": 2139.9599999999996, "text": " could be influenced by this contamination and I think that's what's" }, { "start": 2139.96, "end": 2143.92, "text": " happening right here even though they will make the case that this" }, { "start": 2143.92, "end": 2150.16, "text": " contamination isn't really an issue I can probably show you that it might be" }, { "start": 2150.16, "end": 2156.32, "text": " it may be actually is an issue because on the other data sets at the the fine" }, { "start": 2156.32, "end": 2165.88, "text": " tuned state-of-the-art model outperform the GPT-3 quite a bit so and also the" }, { "start": 2165.88, "end": 2170, "text": " the fact that the you know if you provide a demonstration or many" }, { "start": 2170, "end": 2173.84, "text": " demonstrations it doesn't actually change that much it kind of tells me" }, { "start": 2173.84, "end": 2177.6, "text": " that the model sort of already knows what the answer is and doesn't really" }, { "start": 2177.6, "end": 2181.44, "text": " need demonstrations because it doesn't help if you have the training data" }, { "start": 2181.44, "end": 2192.04, "text": " stored or the test data you don't really have to get demonstrations right so they" }, { "start": 2192.04, "end": 2197.84, "text": " have a few other a few other things right here where on these coca tasks they" }, { "start": 2197.84, "end": 2204.08, "text": " perform pretty poorly compared to others or poorly let's say they perform well" }, { "start": 2204.08, "end": 2213.88, "text": " but not particularly more well than a state-of-the-art and they perform" }, { "start": 2213.88, "end": 2217.88, "text": " especially poorly on the reading comprehension sorry that's the that's" }, { "start": 2217.88, "end": 2225.28, "text": " the cocoa so in reading comprehension what you have to do is abstractive" }, { "start": 2225.28, "end": 2230.28, "text": " multiple choice and span based answer formats in both dialogue and single" }, { "start": 2230.28, "end": 2235.52, "text": " question setting so basically have to read a piece of text like this and then" }, { "start": 2235.52, "end": 2241.6400000000003, "text": " answer a question about the piece of text now this is something where I think" }, { "start": 2241.64, "end": 2248.92, "text": " you cannot really interpolate the training data super well and therefore" }, { "start": 2248.92, "end": 2252.8399999999997, "text": " so you can't really just pattern match and interpret because you have to do" }, { "start": 2252.8399999999997, "end": 2259.52, "text": " actual reasoning and I think that's why the model performs poorly here they do" }, { "start": 2259.52, "end": 2267.8599999999997, "text": " measure this on on super glue which is a NLP benchmark and also here you can see" }, { "start": 2267.86, "end": 2273.76, "text": " it doesn't outperform a fine-tuned state-of-the-art model on these tasks" }, { "start": 2273.76, "end": 2280.08, "text": " but it does outperform a fine-tuned BERT model slightly the BERT model is fine" }, { "start": 2280.08, "end": 2284.84, "text": " tuned on these things whereas GPT-3 isn't but notice the tasks in which it" }, { "start": 2284.84, "end": 2290.04, "text": " does well and in which it doesn't do well compared to the state-of-the-art" }, { "start": 2290.04, "end": 2296.9, "text": " model so for example in the bool queue it doesn't do particularly well right" }, { "start": 2296.9, "end": 2301.32, "text": " the state-of-the-art is 91 and only has 76 that's quite a large difference and" }, { "start": 2301.32, "end": 2307.12, "text": " actually have the glue benchmark open here and you can see this is the" }, { "start": 2307.12, "end": 2314.12, "text": " bool queue so an example here would be is France the same time zone as the UK" }, { "start": 2314.12, "end": 2319.28, "text": " and then there is like a passage and you need to reason about from this passage" }, { "start": 2319.28, "end": 2326.56, "text": " about whether or not this answer is true or false okay this this is very much not" }, { "start": 2326.56, "end": 2331.36, "text": " language modeling this is reasoning and that's why the model is doing poorly" }, { "start": 2331.36, "end": 2336.52, "text": " here whereas in another thing you see these for example this copa right here" }, { "start": 2336.52, "end": 2342.32, "text": " the model is doing almost as good as a fine-tuned state-of-the-art and I have to" }, { "start": 2342.32, "end": 2347.2799999999997, "text": " stress this model has never actually learned this task in a supervised way" }, { "start": 2347.2799999999997, "end": 2353.72, "text": " it's simply a language model and I have this copa task right here and these are" }, { "start": 2353.72, "end": 2359.9199999999996, "text": " the examples so one example is the premise the man broke his toe what was" }, { "start": 2359.9199999999996, "end": 2364.9199999999996, "text": " the cause of this and you have two different things that it could be either" }, { "start": 2364.9199999999996, "end": 2370.7599999999998, "text": " he got a hole in his sock or he dropped a hammer on his foot and the way you" }, { "start": 2370.7599999999998, "end": 2374.7599999999998, "text": " phrase it in this model is you would give the premise as the context and then" }, { "start": 2374.7599999999998, "end": 2379.24, "text": " you simply ask the model since it's a language model which of these two things" }, { "start": 2379.24, "end": 2386, "text": " is more probable to come and of course it is going to select the thing that" }, { "start": 2386, "end": 2393, "text": " kind of happened more often in the training data and you know broke his toe" }, { "start": 2393, "end": 2398.2799999999997, "text": " the cause of breaking his toe that is a hammer this is entirely conceivable that" }, { "start": 2398.2799999999997, "end": 2403.8399999999997, "text": " a language model would know this and with enough training data could sort of" }, { "start": 2403.8399999999997, "end": 2408.3999999999996, "text": " pull from the training data examples where hammer on foot and broke toe" }, { "start": 2408.4, "end": 2414.96, "text": " appear a bunch of times and hole in sock would be rather unrelated so as long as" }, { "start": 2414.96, "end": 2419.38, "text": " these questions are not too adversarial constructed specifically that a language" }, { "start": 2419.38, "end": 2424.28, "text": " model can't solve them there the model is going to perform pretty well right" }, { "start": 2424.28, "end": 2430, "text": " here right so it is very interesting to see that if you view this as" }, { "start": 2430, "end": 2434, "text": " interpolating the training data it suddenly makes sense where it's good and" }, { "start": 2434, "end": 2446.6, "text": " where it isn't good so this was the super glue and and NLI it is performing" }, { "start": 2446.6, "end": 2453.12, "text": " particularly poorly on NLI which is the ability to understand the relationship" }, { "start": 2453.12, "end": 2458.88, "text": " between two sentences right so where the model classifies whether the second" }, { "start": 2458.88, "end": 2462.68, "text": " sentence logically follows from the first contradicts the first or is" }, { "start": 2462.68, "end": 2469.96, "text": " possibly true neutral okay so this is the reasoning part of this model is not" }, { "start": 2469.96, "end": 2475.3199999999997, "text": " given it is simply recalling the training data and doing language modeling" }, { "start": 2475.3199999999997, "end": 2481.12, "text": " now they say oh we can test this we can test this with synthetic and qualitative" }, { "start": 2481.12, "end": 2485.8799999999997, "text": " tasks so they invent some own tasks since you know now it's pretty easy since" }, { "start": 2485.8799999999997, "end": 2489.3199999999997, "text": " you don't have to fine-tune the model you don't have to turn to generate an" }, { "start": 2489.32, "end": 2496.04, "text": " actual training set for a task so you can focus on generating a test set and" }, { "start": 2496.04, "end": 2504.1200000000003, "text": " and you know that's what they do so they do something like arithmetic so they say" }, { "start": 2504.1200000000003, "end": 2509.4, "text": " okay can we come up with a bunch of arithmetic tasks for example to digit" }, { "start": 2509.4, "end": 2514.92, "text": " addition so what the model would see would so this is an example and what the" }, { "start": 2514.92, "end": 2522.36, "text": " model would see is simply this as a context right here for the prompt and if" }, { "start": 2522.36, "end": 2530.04, "text": " you give it examples so if this is like one-shot learning you would input add" }, { "start": 2530.04, "end": 2535.08, "text": " the following numbers the following numbers as a string right then a new" }, { "start": 2535.08, "end": 2544.28, "text": " line and then you would give it one example like what is 11 plus 12 and with" }, { "start": 2544.28, "end": 2550.6800000000003, "text": " the answer together with the answer answer is I don't even know 23 and then" }, { "start": 2550.6800000000003, "end": 2559.76, "text": " you the prompt goes here so what is 48 plus 76 and then you ask what is the" }, { "start": 2559.76, "end": 2566.1600000000003, "text": " next word right here what is the next string token that comes here now the the" }, { "start": 2566.1600000000003, "end": 2571.48, "text": " inference here is that if the model manages to do this it can't simply" }, { "start": 2571.48, "end": 2575.56, "text": " because these are all strings the model basically has no clue how to do math" }, { "start": 2575.56, "end": 2579.64, "text": " these are numbers to the model these are just tokens as strings and the" }, { "start": 2579.64, "end": 2584, "text": " inference is if the model can do this it must have learned you know some kind of" }, { "start": 2584, "end": 2590.48, "text": " reasoning ability it must have learned to like perform some logic inside so" }, { "start": 2590.48, "end": 2594.12, "text": " they go into two-digit addition three-digit addition four-digit" }, { "start": 2594.12, "end": 2601.52, "text": " addition five-digit addition and even multiplication and subtraction and the" }, { "start": 2601.52, "end": 2609.6, "text": " results are right here so as you can see the lower parameter models they perform" }, { "start": 2609.6, "end": 2614.68, "text": " pretty poorly but as you go up the parameters the big model is performing" }, { "start": 2614.68, "end": 2621.48, "text": " really well in the two-digit range is performing also really well so accuracy" }, { "start": 2621.48, "end": 2627.4, "text": " of look that accuracy 80 90 percent in three-digit addition and subtraction but" }, { "start": 2627.4, "end": 2631.2, "text": " then if as soon as you get to the four-digit or the two-digit multiplication" }, { "start": 2631.2, "end": 2637.3, "text": " and so on the performance drops now they say that's because multiplication is" }, { "start": 2637.3, "end": 2642.32, "text": " harder and you know it's is logically very computationally you know but the" }, { "start": 2642.32, "end": 2647.08, "text": " two-digit addition and so on model has learned something about the world I" }, { "start": 2647.08, "end": 2658, "text": " disagree because so here's the because what you will do is you will simply and" }, { "start": 2658, "end": 2664.12, "text": " this you simply recall the training data so look at the two-digit addition with" }, { "start": 2664.12, "end": 2669.36, "text": " zero shot you already get 76 percent but with one shot you get 99 percent and" }, { "start": 2669.36, "end": 2675.84, "text": " with few shot you get a hundred percent so if you interpret this model as simply" }, { "start": 2675.84, "end": 2682.96, "text": " filtering the training data to pattern match then it makes a lot of sense that" }, { "start": 2682.96, "end": 2688.76, "text": " the one shot would like the examples here would give you a much improvement" }, { "start": 2688.76, "end": 2696.36, "text": " because if you have a bunch of examples where please add right add and then oh I" }, { "start": 2696.36, "end": 2703.08, "text": " erased our example again so you have like 48 plus 72 equals blah blah blah you" }, { "start": 2703.08, "end": 2709.44, "text": " have these of this if you give more and more example all of a sudden this looks" }, { "start": 2709.44, "end": 2715.84, "text": " like a table and they say we made sure that the strings here these particular" }, { "start": 2715.84, "end": 2719.88, "text": " strings were not in our training data right so these strings never appeared" }, { "start": 2719.88, "end": 2725.3199999999997, "text": " but I just have an issue with this d duplication stuff because what can" }, { "start": 2725.32, "end": 2734.56, "text": " appear actually is not the what can appear is a table and in table often you" }, { "start": 2734.56, "end": 2739.8, "text": " have columns and then another column will be the sum of these columns on the" }, { "start": 2739.8, "end": 2744.6800000000003, "text": " left and if you are asked to pattern match you'll naturally find websites" }, { "start": 2744.6800000000003, "end": 2748.56, "text": " right if you have a few of these examples you'll find websites where the" }, { "start": 2748.56, "end": 2754.1200000000003, "text": " columns exactly refer to these things and then you'll find the sum here and if" }, { "start": 2754.12, "end": 2759.8199999999997, "text": " you filter for websites that appear to match your scheme in the examples you'll" }, { "start": 2759.8199999999997, "end": 2764.56, "text": " find all the website with a table on them where the column one column is an" }, { "start": 2764.56, "end": 2770.7999999999997, "text": " addition of the others and I can actually do that so I went and I typed in" }, { "start": 2770.7999999999997, "end": 2779.24, "text": " just a bunch of these things so 98 plus 45 is 143 18 plus 55 is 70 I believe at" }, { "start": 2779.24, "end": 2784.8399999999997, "text": " least and I can find now Google makes it hard because they localize and" }, { "start": 2784.8399999999997, "end": 2789.68, "text": " everything but you can still find what you're going to find our tables and" }, { "start": 2789.68, "end": 2797.8799999999997, "text": " tables and tables and tables and now I actually went to doc.go to basically say" }, { "start": 2797.8799999999997, "end": 2802.9199999999996, "text": " you know they they don't you know really personalize it to me and what's the" }, { "start": 2802.9199999999996, "end": 2807.7599999999998, "text": " first thing I find when I type in just these numbers is math skip counting" }, { "start": 2807.76, "end": 2815.0800000000004, "text": " missing sequence number and a website where basically the answers are already" }, { "start": 2815.0800000000004, "end": 2820.1600000000003, "text": " given look at that so all the model has to do is recall this particular training" }, { "start": 2820.1600000000003, "end": 2826.6800000000003, "text": " example from the samples it already has right and it will it will basically be" }, { "start": 2826.6800000000003, "end": 2831.48, "text": " able in quotes to perform addition like this is financial data and another one" }, { "start": 2831.48, "end": 2837.1600000000003, "text": " where you have to subtract stuff right so I'm pretty sure all the model is doing" }, { "start": 2837.16, "end": 2843.92, "text": " here is interpolating the training data and that's also why it performs worse if" }, { "start": 2843.92, "end": 2850.8799999999997, "text": " if you up the digits because longer digit numbers are simply less frequent" }, { "start": 2850.8799999999997, "end": 2857.2, "text": " in the in in the training data multiplication is first of all less" }, { "start": 2857.2, "end": 2861.2799999999997, "text": " frequent and second of all it also results in larger numbers which are less" }, { "start": 2861.28, "end": 2870.6400000000003, "text": " frequent right so it explains a lot so I yeah I have my issues with people" }, { "start": 2870.6400000000003, "end": 2877, "text": " saying yeah this this shows some reasoning I don't think it does the same" }, { "start": 2877, "end": 2882.52, "text": " thing here with word scramble so in word scramble they have different things you" }, { "start": 2882.52, "end": 2889.6800000000003, "text": " see okay they they they look whether or not only 17 matches 0.8 percent of the" }, { "start": 2889.68, "end": 2893.7999999999997, "text": " math things are in their training data is like no you haven't searched well" }, { "start": 2893.7999999999997, "end": 2899.44, "text": " enough and the rest of their deduplication by the way is also pretty" }, { "start": 2899.44, "end": 2904.3599999999997, "text": " weak I would say because they just look for like 13 gram overlaps between the" }, { "start": 2904.3599999999997, "end": 2911, "text": " training data and the in the and their their test data so they have these word" }, { "start": 2911, "end": 2917.52, "text": " scrambling tasks where they basically scramble words and they ask the model to" }, { "start": 2917.52, "end": 2923.8, "text": " unscramble it for example this word is inevitably scrambled so they always you" }, { "start": 2923.8, "end": 2928.32, "text": " know they give like anagrams and they give random insertion into the word like" }, { "start": 2928.32, "end": 2935.92, "text": " this word right here or they reverse the word and they say so this I think this" }, { "start": 2935.92, "end": 2944.48, "text": " is the thing at the very beginning but if you can see right here also as the" }, { "start": 2944.48, "end": 2949.72, "text": " model goes up then this this improves and they also say well this means maybe" }, { "start": 2949.72, "end": 2956.2, "text": " some kind of reasoning but I think this is just it's learning the language and" }, { "start": 2956.2, "end": 2963.44, "text": " it's learning that you know the the words in in sorry that the letters make" }, { "start": 2963.44, "end": 2969.2400000000002, "text": " up a word and the letters correspond to word pieces or are associated with word" }, { "start": 2969.24, "end": 2975.12, "text": " pieces and it always learns to English a good task to check this would actually" }, { "start": 2975.12, "end": 2979.7999999999997, "text": " be to scramble words so if you unscramble words you always end up with" }, { "start": 2979.7999999999997, "end": 2983.4799999999996, "text": " an English word so all it has to do is basically check which word has the" }, { "start": 2983.4799999999996, "end": 2989, "text": " highest overlap in word pieces but you could do something like please scramble" }, { "start": 2989, "end": 2993.2, "text": " this word and then always count it correctly when any of the scrambling of" }, { "start": 2993.2, "end": 2999.22, "text": " the words so instead of going from this to this which you can simply solve by" }, { "start": 2999.22, "end": 3004.64, "text": " knowing the English language but you would have basically no clue what the" }, { "start": 3004.64, "end": 3008.52, "text": " task is that you don't have to understand that as a model you could ask" }, { "start": 3008.52, "end": 3013.04, "text": " it to go from this to this given a few examples right then it would really need" }, { "start": 3013.04, "end": 3018.3599999999997, "text": " to understand what the task is that it's supposed to actually scramble a word and" }, { "start": 3018.3599999999997, "end": 3023.6, "text": " would need to learn that from its context given examples but they as far" }, { "start": 3023.6, "end": 3030.52, "text": " as I see they don't do that and again I think it's recalling the the training" }, { "start": 3030.52, "end": 3037.68, "text": " data the this is a sat analogy so the SAT or this test that the US high" }, { "start": 3037.68, "end": 3044.44, "text": " schoolers take to get into college and the the this they say a typical example" }, { "start": 3044.44, "end": 3052.48, "text": " this is dying on me no it's scrolled okay a typical example is the following" }, { "start": 3052.48, "end": 3059.92, "text": " this I find I find pretty hilarious all Dacius is to boldness as sanctimonious" }, { "start": 3059.92, "end": 3064.96, "text": " is to hypocrisy anonymous is to identity remorseful is to misdeed" }, { "start": 3064.96, "end": 3069.96, "text": " deleterious is to result or impressionable is to temptation this is a" }, { "start": 3069.96, "end": 3075.4, "text": " as as a okay I'm not a native speaker but this is a hard question right and" }, { "start": 3075.4, "end": 3080, "text": " you have to you know see that these these high schoolers they're stressed" }, { "start": 3080, "end": 3083.8, "text": " like this is very much a time-based test so you need to make a decision quickly" }, { "start": 3083.8, "end": 3087.92, "text": " while the model of course is basically able to sift through its entire training" }, { "start": 3087.92, "end": 3092.8, "text": " data in the time it takes the GPUs to perform inference but it's still funny" }, { "start": 3092.8, "end": 3101.24, "text": " that GPT-3 achieves 50 65 percent in the few shot setting and 59 percent in the" }, { "start": 3101.24, "end": 3106.24, "text": " one shot setting 53 percent is zero shot setting whereas the average score among" }, { "start": 3106.24, "end": 3110.9199999999996, "text": " college applicants was 57 percent so it outperforms the average college applicant" }, { "start": 3110.9199999999996, "end": 3114.8399999999997, "text": " it's pretty funny but you would expect the language model to have a pretty good" }, { "start": 3114.8399999999997, "end": 3120.56, "text": " grasp of these kind of synonyms and relations between words because these" }, { "start": 3120.56, "end": 3127.68, "text": " are just absolutely statistical associations between words so yeah this" }, { "start": 3127.68, "end": 3132.6, "text": " I found this to be pretty pretty funny and the last thing and this is what" }, { "start": 3132.6, "end": 3138.92, "text": " everyone's freaking out over is this news article generation where basically" }, { "start": 3138.92, "end": 3146.72, "text": " they give it the beginning of a few of a news article and then they let humans" }, { "start": 3146.72, "end": 3152.04, "text": " decide whether or not the news article is written by a machine or by a human" }, { "start": 3152.04, "end": 3159.44, "text": " and they say here by contrast mean human accuracy at detecting articles that were" }, { "start": 3159.44, "end": 3165.2000000000003, "text": " produced by the 175 billion parameter model it was barely above chance at 52" }, { "start": 3165.2000000000003, "end": 3171.36, "text": " percent human abilities to detect model generated text appear to decrease as" }, { "start": 3171.36, "end": 3176.4, "text": " model size increases there appears to be a trend towards chance accuracy with" }, { "start": 3176.4, "end": 3184.32, "text": " model size and human detection of GPT-3 is close to chance okay so what they do" }, { "start": 3184.32, "end": 3190.1600000000003, "text": " is they give and they have some examples right here they give the model the" }, { "start": 3190.1600000000003, "end": 3196.44, "text": " following input the title the subtitle of an article and then this word article" }, { "start": 3196.44, "end": 3200.6400000000003, "text": " and the model is supposed to complete the rest of the article right here and" }, { "start": 3200.6400000000003, "end": 3205.36, "text": " you can also you know give do this in a few short setting such that the model" }, { "start": 3205.36, "end": 3211.32, "text": " basically knows that it's if you give it a few a few examples the model knows it" }, { "start": 3211.32, "end": 3218.44, "text": " is supposed to produce a news article right okay so there are two two ways" }, { "start": 3218.44, "end": 3223.96, "text": " that you can think of this first way the model has learned the language so well" }, { "start": 3223.96, "end": 3228.88, "text": " and it writes code it has learned to write coherent language and so on it's" }, { "start": 3228.88, "end": 3235.32, "text": " learned to reason keep context and blah blah blah okay second way the model sees" }, { "start": 3235.32, "end": 3242.34, "text": " this thing right here it sees the few you know K few shot examples that it has" }, { "start": 3242.34, "end": 3248.4, "text": " before in the context it will take them filter the training data to in this case" }, { "start": 3248.4, "end": 3252.0800000000004, "text": " it just sees news articles so do just news articles it will take this thing" }, { "start": 3252.0800000000004, "end": 3256.44, "text": " filter the training data even more to just the news articles that pertain" }, { "start": 3256.44, "end": 3262.96, "text": " largely to topics or words that appear in here and then lastly will interpolate" }, { "start": 3262.96, "end": 3267.52, "text": " the few training examples to produce this thing now they argue that this" }, { "start": 3267.52, "end": 3273.4, "text": " isn't really possible because they have actually checked that this news article" }, { "start": 3273.4, "end": 3282.12, "text": " is not in the training data but I have simply gone and taken a I've really" }, { "start": 3282.12, "end": 3286.28, "text": " taken a random substring here I've taken this substring voted to strengthen the" }, { "start": 3286.28, "end": 3293.6400000000003, "text": " ban on the ordination of just this substring and I've put it into Google and" }, { "start": 3293.6400000000003, "end": 3300.88, "text": " Babidi bah I find a book with voted to strengthen prohibitions to ban LGBTQ" }, { "start": 3300.88, "end": 3305.76, "text": " people from being ordained and ministers so it's you know I find this it's not" }, { "start": 3305.76, "end": 3310.5, "text": " the same article but it's talking about the same incident the article talks" }, { "start": 3310.5, "end": 3315.1600000000003, "text": " about and it is using the same language probably read the article and the" }, { "start": 3315.16, "end": 3319.92, "text": " author is like I can't really you know copy paste that would be you know not" }, { "start": 3319.92, "end": 3325.72, "text": " really cool so I'll just kind of you know write it in my own words but largely" }, { "start": 3325.72, "end": 3331.72, "text": " the same thing the Associated Press here also a different article you know see" }, { "start": 3331.72, "end": 3338.8399999999997, "text": " different title than this one right here but about the same thing and also with" }, { "start": 3338.8399999999997, "end": 3343.48, "text": " the same language right here voted to stay to strengthen the faiths divisive" }, { "start": 3343.48, "end": 3350.2400000000002, "text": " bands on same-sex marriage and ordination of LGBT clergy and generally" }, { "start": 3350.2400000000002, "end": 3355.6, "text": " so the argument this article wasn't in the training data is just not really" }, { "start": 3355.6, "end": 3364.4, "text": " something I buy in this in this case so I think it the article as such wasn't" }, { "start": 3364.4, "end": 3369, "text": " there but many articles about this topics were and I think this will just" }, { "start": 3369, "end": 3374.32, "text": " interpolate these now they say this was the hardest article for the humans to" }, { "start": 3374.32, "end": 3382.24, "text": " decide and this here was the easiest so it's it says I don't know" }, { "start": 3382.24, "end": 3387.12, "text": " Starr talks promise draws Megyn Kelly's sarcasm and it says a year ago joking" }, { "start": 3387.12, "end": 3389.76, "text": " Phoenix made headlines when he appeared on the red carpet at the Golden Globes" }, { "start": 3389.76, "end": 3393.36, "text": " wearing a tuxedo with a paper bag over his head that read I'm a shape-shifter" }, { "start": 3393.36, "end": 3396.88, "text": " blah blah you you would guess that joking Phoenix would do something like" }, { "start": 3396.88, "end": 3401.2400000000002, "text": " this but they say their human raiders were US based right and you see right" }, { "start": 3401.2400000000002, "end": 3405.08, "text": " here it says Megyn Kelly was not impressed and she let him have it on the" }, { "start": 3405.08, "end": 3410.36, "text": " tonight show now that tonight show is not what Megyn Kelly is and US based" }, { "start": 3410.36, "end": 3415.6800000000003, "text": " people would I guess know something like this and would immediately feel like" }, { "start": 3415.6800000000003, "end": 3426, "text": " this is wrong so I think this thing is interpolated from is interpolated from a" }, { "start": 3426, "end": 3431.48, "text": " bunch of different news articles about this and the interpolation just let it" }, { "start": 3431.48, "end": 3436.4, "text": " like made it such that this person is on this show which that they aren't and the" }, { "start": 3436.4, "end": 3440.76, "text": " humans noticed right but it doesn't change the fact that it probably just" }, { "start": 3440.76, "end": 3445, "text": " went to the training data filtered a bunch of articles about these words and" }, { "start": 3445, "end": 3449.08, "text": " then interpolated like mash them together it is a good language model" }, { "start": 3449.08, "end": 3453.48, "text": " right it can grammar it's very good at grammar so we can interpolate different" }, { "start": 3453.48, "end": 3460.8, "text": " passages of text and I feel that the the really really useful application of this" }, { "start": 3460.8, "end": 3465.2, "text": " will be sort of as a search engine as a fuzzy search engine so now I can like" }, { "start": 3465.2, "end": 3471.6, "text": " input for example my my machine learning research ideas and what will output will" }, { "start": 3471.6, "end": 3475.4, "text": " be sort of an abstract of a paper that is kind of a mush together of other" }, { "start": 3475.4, "end": 3481.28, "text": " papers on the same thing and that that you know you can think of many" }, { "start": 3481.28, "end": 3487.2400000000002, "text": " applications I don't think we have built something really intelligent here and" }, { "start": 3487.2400000000002, "end": 3492.96, "text": " what this is this is though is pretty cool they they give examples like this" }, { "start": 3492.96, "end": 3497.28, "text": " here where they make up a word and then ask the model to use the word in a" }, { "start": 3497.28, "end": 3503.6000000000004, "text": " sentence so to scree is something sorry to screech something is to swing a" }, { "start": 3503.6000000000004, "end": 3508, "text": " sword at it an example of a sentence that uses the word screech is and of" }, { "start": 3508, "end": 3511.96, "text": " course the model what's the model is going to do is it's going to take this" }, { "start": 3511.96, "end": 3517.2, "text": " it's going to filter the training data for all of the instances where sort of" }, { "start": 3517.2, "end": 3521.32, "text": " this construction appears like an example of using the words which is" }, { "start": 3521.32, "end": 3526.2, "text": " mostly so dictionaries then it's going to not know that word but it's you can" }, { "start": 3526.2, "end": 3531.56, "text": " interpolate it from interpolated from all this data right here and the so the" }, { "start": 3531.56, "end": 3537, "text": " cool thing is it actually conjugates the word we screed at each other for several" }, { "start": 3537, "end": 3543.8, "text": " minutes and then we went outside and ate ice cream so you can see how this is" }, { "start": 3543.8, "end": 3548.4, "text": " comes to be but I think it would really be fun to have a model that tells us" }, { "start": 3548.4, "end": 3554.56, "text": " which training data samples were used here it can also correct English grammar" }, { "start": 3554.56, "end": 3562.84, "text": " which is pretty obvious though again it can never correct so the the input" }, { "start": 3562.84, "end": 3569.08, "text": " always here is poor English good English poor English good English poor good poor" }, { "start": 3569.08, "end": 3574.4, "text": " English and then good English and that's what the model is asked to to output and" }, { "start": 3574.4, "end": 3581.92, "text": " I'm actually not sure pretty sure this here shouldn't be bold I'm fairly sure" }, { "start": 3581.92, "end": 3585.28, "text": " this shouldn't be bold this is given to the model the model is only asked to" }, { "start": 3585.28, "end": 3593.6800000000003, "text": " produce this otherwise I'd be I'd be actually impressed but yes nothing task" }, { "start": 3593.6800000000003, "end": 3597.4, "text": " specific is provided aside from the examples from few example as" }, { "start": 3597.4, "end": 3602.96, "text": " conditioning and the poor English input good English output framing so the good" }, { "start": 3602.96, "end": 3607.2400000000002, "text": " English output thing here should not be in boldface authors if you're listening" }, { "start": 3607.2400000000002, "end": 3615.1200000000003, "text": " this should not be bold thank you okay but again it is always as you can" }, { "start": 3615.12, "end": 3619.7999999999997, "text": " see it's too good English it's always the target is the good English whereas" }, { "start": 3619.7999999999997, "end": 3625.52, "text": " if the model really understood the task it should also be able to do the inverse" }, { "start": 3625.52, "end": 3629.2, "text": " it should be able to to produce something poor from something good" }, { "start": 3629.2, "end": 3633.7599999999998, "text": " because then you eliminate the fact that it's just a good English language model" }, { "start": 3633.7599999999998, "end": 3640.16, "text": " right because it can basically produce something like this without having a" }, { "start": 3640.16, "end": 3645.48, "text": " clue what the task is it will simply you condition on this input and it will" }, { "start": 3645.48, "end": 3650.8399999999997, "text": " simply output this sentence because it's very likely because it's already almost" }, { "start": 3650.8399999999997, "end": 3656.16, "text": " here and it will output it in better English because it's a good language" }, { "start": 3656.16, "end": 3665.2799999999997, "text": " model right it's it's a good English language model so yeah that so they" }, { "start": 3665.28, "end": 3670.6000000000004, "text": " measure this overfitting the degree to which their training to which their test" }, { "start": 3670.6000000000004, "end": 3676.0400000000004, "text": " data is in this common crawl thing and they say they have a conservative bound" }, { "start": 3676.0400000000004, "end": 3681.0400000000004, "text": " on how many percent of the data in the data set are clean and as you can see" }, { "start": 3681.0400000000004, "end": 3686.2000000000003, "text": " here they measure then how much the performance differs to to up or down if" }, { "start": 3686.2000000000003, "end": 3691.36, "text": " you only evaluate on the clean portion of this data set but again their" }, { "start": 3691.36, "end": 3696.1200000000003, "text": " deduplication is so weak they do like n-gram deduplication whereas I think you" }, { "start": 3696.1200000000003, "end": 3700.6800000000003, "text": " should really like in the news articles you should really do much more fuzzy" }, { "start": 3700.6800000000003, "end": 3707.04, "text": " deduplication much more of a meaning deduplication if you then want to argue" }, { "start": 3707.04, "end": 3710.6400000000003, "text": " that the model has learned to reason like if you simply want to argue that" }, { "start": 3710.6400000000003, "end": 3716.88, "text": " the model is a good language model fine right but yeah and also look at this" }, { "start": 3716.88, "end": 3722.88, "text": " like I would expect of a data set a test data set if you know if you have like a" }, { "start": 3722.88, "end": 3726.6400000000003, "text": " natural questions data set is constructed from Wikipedia pages and you" }, { "start": 3726.6400000000003, "end": 3732.2000000000003, "text": " have the Wikipedia page in there you can either either the entire thing is clean" }, { "start": 3732.2000000000003, "end": 3738.48, "text": " or none of it is clean and also these we know grad data set if this data set" }, { "start": 3738.48, "end": 3742.1600000000003, "text": " somehow leaked into the common crawl corpus either the entire thing is clean" }, { "start": 3742.16, "end": 3747.08, "text": " or none of it is clean I just have kind of problems with the fact that there are" }, { "start": 3747.08, "end": 3756.3599999999997, "text": " so many in between things right here and yeah so I'm not I'm not convinced here" }, { "start": 3756.3599999999997, "end": 3763.3999999999996, "text": " that this deduplication I still think it's a cool thing but I don't I think" }, { "start": 3763.3999999999996, "end": 3769, "text": " it's mostly a training data filter and interpolator rather than actual" }, { "start": 3769, "end": 3774.44, "text": " reasoning and they go through some of the limitations here and the broader" }, { "start": 3774.44, "end": 3780.84, "text": " input this broader impact statement is like five pages long and yeah okay you" }, { "start": 3780.84, "end": 3789.04, "text": " can do you can you know bad people take the model to do bad things okay and" }, { "start": 3789.04, "end": 3794.44, "text": " that's pretty much it so what I appreciate here is at the bottom they" }, { "start": 3794.44, "end": 3799.7200000000003, "text": " have basically all the results but also a lot of tasks descriptions like how" }, { "start": 3799.7200000000003, "end": 3805.4, "text": " they framed each tasks more outputs and they give more outputs on their website" }, { "start": 3805.4, "end": 3809.32, "text": " right so you can see here how each of the tasks was framed where you always" }, { "start": 3809.32, "end": 3814.04, "text": " have this is what this here is what the model sees and then this is what it's" }, { "start": 3814.04, "end": 3821.92, "text": " asked to produce right so you have this for for all many of these things and so" }, { "start": 3821.92, "end": 3828.4, "text": " on squad you have this context and the question okay so the the context is" }, { "start": 3828.4, "end": 3833.56, "text": " actually in there I didn't know that but you have the context and the question" }, { "start": 3833.56, "end": 3838.8, "text": " and the model is asked to complete something right here so you can look at" }, { "start": 3838.8, "end": 3843.64, "text": " how the model sees tasks and maybe you can evaluate for yourself how you think" }, { "start": 3843.64, "end": 3850, "text": " how difficult you think these tasks are all right I hope this was informative it" }, { "start": 3850, "end": 3854.6, "text": " is a long paper therefore it is a long video if you're still here and haven't" }, { "start": 3854.6, "end": 3862.32, "text": " subscribed yet do maybe if you like this if you want more leave it a like tell me" }, { "start": 3862.32, "end": 3867.04, "text": " in the comments what you think of it whether you think it's actually a GI or" }, { "start": 3867.04, "end": 3881.64, "text": " not and I'll see you next time bye bye" } ]
T35ba_VXkMY
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
DETR: End-to-End Object Detection with Transformers (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "facebook", "fair", "fb", "facebook ai", "object detection", "coco", "bounding boxes", "hungarian", "matching", "bipartite", "cnn", "transformer", "attention", "encoder", "decoder", "images", "vision", "pixels", "segmentation", "classes", "stuff", "things", "attention mechanism", "squared", "unrolled", "overlap", "threshold", "rcnn" ]
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, Francisco Massa 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 hyper parameters. 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 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 and so on. So there used to be very complicated architectures that solve these problems and this paper here comes up with a super simple architecture and will 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 CNNs just work so well for images. So this gives us this set of image features and I think this vector here is not really representative of what's happening. So let's actually take this picture right here and draw 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. 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 in the image those features are. 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 outcomes, 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. So an example for this could be bird at x equals 2, y equals 5. That's an example. Another example of this could also be there is nothing at x equals 7, y equals 9. So 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. 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 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 and the second one is this bird then it's good but then you know that the ordering shouldn't matter. You 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... where can we go? Let's say your classifier, so here is an image. I have to wait for this to catch up. Here is an image and we put it through this entire pipeline and we get a set of predictions and they're going to be class bounding box, class bounding box, class bounding box. Now the first thing you need to know is that there are always the same amount of predictions. There are always this size here is fixed, that's large n. 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 database you get out an image with its bounding box annotations that are made by human labellers. Let's say these two. And you also do class bounding box, class bounding box. But now you see we only have 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, 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 the one bird is very prominent, you don't want to encourage your classifier 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 stronger 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 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 will 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 classes agree and the two bounding boxes agree then it's very good right? Then we maybe even give like some negative loss or give loss zero. But 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 everything disagrees it's the worst. What you're basically saying is if these two would correspond to each other, if the thing on the left were the prediction for the thing on the right, which we don't know, 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 the same. But you say if these were corresponding to each other 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 to things on the right. A one-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. 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. I give you the maximum benefit of the doubt by aligning these things. So in the best possible case what's the loss? 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 a bird very close to the bird here in the in a ground truth label. That's this here. So I'm going to connect these two because that's sort of 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. 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 swap with it. If you output the same bird multiple times only one of these is going to be assigned. So 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 output let's say diverse bounding boxes, different bounding boxes for things. So this solves these problems and it's very clever. And there are algorithms to compute these minimum matchings. 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 when it shouldn't, 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 class, it's going to be penalized. Okay so this is a pretty pretty cool thing. 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. Alright that's the algorithm in a high level. They do show their loss here. You see the loss ultimately is going to be over this matching right here. That's the minimum bipartite assignment that basically minimizes this total loss over your prediction and label matchings. And the loss they come up with here, 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 loss on the class labels I think is 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 two 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 much do the labels agree and how much do the bounding boxes agree. Again this is only possible because after that you compute this matching otherwise you would have no clue 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 I already said the you should look at 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 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 it's channel size. So basically you have a sequence here of C dimensional feature vectors that you then put into your encoder. 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 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 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 a language processing because in a sentence let's look at this sentence the input images are batched together. Applying blah blah blah blah blah blah blah blah blah and then there's 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 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 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 going to 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 BERT BERT 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 autoregressively 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 out you output the sequence of a sequence of four things and it's important to see what they're going to 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 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 n outputs 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 so 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 in 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 these object queries which at the beginning are just n random vectors and what you're going to do you are also going to feature encode 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 Q you have the opportunity to look at the image features right and that's how do 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 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 in dependent of the input image you're going to learn n 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 end is 100 but they show 20 of these object queries that they learn and so 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 images 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 of the different colors here is referred 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 want 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 n 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 getting drawing 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 interested in those things and those things so at first it will focus on these things but then it says on 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 Q 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 data set 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 he basically learned 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 I'm 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 a tension 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 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 ah there's a bow here there's a bow here and there is 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 10 10 10 11 11 12 I saw this olig skit 100 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 11 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 height times width times height times width 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 are 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 height times width unrolled images are uniquely well conducive to these bounding box prediction tasks I'm 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 gonna 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 they are on par with these other much much much more complex architectures these faster are CNN 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 eight GPUs 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 on 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 it 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 is 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 they these things really sort of understand or they learn these things like occlusion and just hard 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 data set 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 you remember we had these different people here that it 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 haven't they do quantitative analysis of course but I'm just impressed by the examples right here alright that was sort of it I really enjoyed reading this papers the 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 collab 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, "end": 4.34, "text": " Hi there! Today we're going to look at end-to-end object detection with" }, { "start": 4.34, "end": 9.42, "text": " transformers by Nicolas Carillon, Francisco Massa and others at Facebook AI" }, { "start": 9.42, "end": 16.740000000000002, "text": " Research. So on a high level this paper does object detection in images using" }, { "start": 16.740000000000002, "end": 22.82, "text": " first a CNN and then a transformer to detect objects and it does so via a" }, { "start": 22.82, "end": 28.46, "text": " bipartite matching training objective. And this leaves you basically with an" }, { "start": 28.46, "end": 33.2, "text": " architecture that is super super simple compared to the previous architectures" }, { "start": 33.2, "end": 38.660000000000004, "text": " that had all kinds of engineering hurdles and thresholds and hyper" }, { "start": 38.660000000000004, "end": 44.08, "text": " parameters. So really excited for this. As always if you like content like this" }, { "start": 44.08, "end": 50.96, "text": " consider leaving a like comment or subscribing. Let's get into it. So let's" }, { "start": 50.96, "end": 54.72, "text": " say you have a picture like this here and you're supposed to detect all the" }, { "start": 54.72, "end": 59.64, "text": " objects in it and also where they are and what they are. This task is called" }, { "start": 59.64, "end": 65.24, "text": " object detection. So a good classifier here would say there's a bird right here" }, { "start": 65.24, "end": 74.44, "text": " and so this is a bird and then this here is also a bird. Right? They can be" }, { "start": 74.44, "end": 79.72, "text": " overlapping these bounding boxes so this is you see the the first problem that" }, { "start": 79.72, "end": 85.52, "text": " bird why is that green? Nevermind. Okay and those are the only two objects. So" }, { "start": 85.52, "end": 89.76, "text": " there's a number of very difficult things here. First of all you need to" }, { "start": 89.76, "end": 94.06, "text": " sort of detect the objects. You need to know how many there are. It's all it's" }, { "start": 94.06, "end": 97.75999999999999, "text": " not always the same in each image. There can be multiple objects of the same" }, { "start": 97.75999999999999, "end": 102, "text": " class. There can be multiple objects of different classes. They can be anywhere" }, { "start": 102, "end": 107.32, "text": " of any size. They can be overlapping in the background small or across the" }, { "start": 107.32, "end": 111.75999999999999, "text": " entire image. They can occlude each other partially. So the problem is a very very" }, { "start": 111.75999999999999, "end": 117.94, "text": " difficult problem and previous work has done a lot of engineering on this like" }, { "start": 117.94, "end": 123.03999999999999, "text": " building detectors and then kind of you want to classify every single pixel here" }, { "start": 123.03999999999999, "end": 127.69999999999999, "text": " and then you get like two detections right here that are very close for the" }, { "start": 127.69999999999999, "end": 132.4, "text": " same class. You say ah that must maybe be the same instance. Right? So there's only" }, { "start": 132.4, "end": 138.52, "text": " one thing here and not two things and so on. So there used to be very" }, { "start": 138.52, "end": 142.12, "text": " complicated architectures that solve these problems and this paper here comes" }, { "start": 142.12, "end": 147.06, "text": " up with a super simple architecture and will kind of go from the high level to" }, { "start": 147.06, "end": 151.28, "text": " the low to the implementation of each of the parts. So what does this paper" }, { "start": 151.28, "end": 157.28, "text": " propose? How do we solve a task like this? First of all we put the image and the" }, { "start": 157.28, "end": 161.88, "text": " image here without the labels of course. We put it through a convolutional neural" }, { "start": 161.88, "end": 166.32, "text": " network encoder. Since this is an image task it's you know kind of understandable" }, { "start": 166.32, "end": 175.07999999999998, "text": " that we do this mostly because CNNs just work so well for images. So this gives us" }, { "start": 175.07999999999998, "end": 179.64, "text": " this set of image features and I think this vector here is not really" }, { "start": 179.64, "end": 184.24, "text": " representative of what's happening. So let's actually take this picture right" }, { "start": 184.24, "end": 190.56, "text": " here and draw it in kind of an angled way and what we'll do with CNN is we'll" }, { "start": 190.56, "end": 195.48, "text": " simply sort of scale it down but have it multiple. So here it's three channels" }, { "start": 195.48, "end": 201.48, "text": " right? It's red, green and blue like this. Three channels but we'll scale it down" }, { "start": 201.48, "end": 215.4, "text": " but we make it more channels. So yeah so more channels. Okay but it's still sort" }, { "start": 215.4, "end": 221.04, "text": " of an image right here. It still has the image form. So the CNN" }, { "start": 221.04, "end": 225.56, "text": " basically gives us this thing which is sort of a higher level representation of" }, { "start": 225.56, "end": 230.28, "text": " the image with many more feature channels but still kind of information" }, { "start": 230.28, "end": 234.36, "text": " where in the image those features are. This is going to be important in a" }, { "start": 234.36, "end": 240.36, "text": " second because now this thing which is this set of image features goes into a" }, { "start": 240.36, "end": 248.28, "text": " transformer encoder decoder and this is sort of the magic thing here as a" }, { "start": 248.28, "end": 254.04000000000002, "text": " component. We'll look into that in a second but what they get out right" }, { "start": 254.04000000000002, "end": 260.28000000000003, "text": " here is this set of box predictions. So outcomes, each of these boxes here is" }, { "start": 260.28000000000003, "end": 265.36, "text": " going to be consisting of a tuple and the tuple is going to be the class and" }, { "start": 265.36, "end": 274.8, "text": " the bounding box. So an example for this could be bird at x equals 2, y" }, { "start": 274.8, "end": 281.8, "text": " equals 5. That's an example. Another example of this could also be there is" }, { "start": 281.8, "end": 292.24, "text": " nothing at x equals 7, y equals 9. So the nothing class is a valid class" }, { "start": 292.24, "end": 297.76, "text": " right here and that's also important. But safe to say there is this set of box" }, { "start": 297.76, "end": 303.68, "text": " predictions and then that is basically your output. These things are" }, { "start": 303.68, "end": 307.64, "text": " your output. If you have those things you can draw these bounding boxes, you can" }, { "start": 307.64, "end": 312.08, "text": " assign the labels. The question is how do you train it? Now what you're given is a" }, { "start": 312.08, "end": 317.86, "text": " database of images and these images as you see here on the right, these images" }, { "start": 317.86, "end": 323.68, "text": " already have by human annotators drawn these bounding boxes in and also labels." }, { "start": 323.68, "end": 328.76, "text": " So this here would be annotated with bird and this here would be annotated" }, { "start": 328.76, "end": 334.12, "text": " with bird. But it doesn't have any of these like it doesn't annotate the" }, { "start": 334.12, "end": 341.28000000000003, "text": " nothing classes and so on. So the question is how do you compare the two?" }, { "start": 341.28, "end": 349.4, "text": " Can you simply say okay if the first one here is the bird and then and the second" }, { "start": 349.4, "end": 353.23999999999995, "text": " one is this bird then it's good but then you know that the ordering shouldn't" }, { "start": 353.23999999999995, "end": 356.67999999999995, "text": " matter. You simply care whether you have the correct bounding boxes, you" }, { "start": 356.67999999999995, "end": 362, "text": " don't care whether you output them in the correct order. And also what if your" }, { "start": 362, "end": 366.96, "text": " classifier does something like this? It outputs those two boxes we see here but" }, { "start": 366.96, "end": 373, "text": " it also outputs this here and says bird or like one that is slightly off and" }, { "start": 373, "end": 380.2, "text": " says bird and so on. So how do you deal with all of these cases? So the way that" }, { "start": 380.2, "end": 385.2, "text": " this paper deals with all of these cases is with their bipartite matching loss" }, { "start": 385.2, "end": 392, "text": " this thing right here. So how does it work? Let's say your... where can we go?" }, { "start": 392, "end": 398.8, "text": " Let's say your classifier, so here is an image. I have to wait for this to catch" }, { "start": 398.8, "end": 403.56, "text": " up. Here is an image and we put it through this entire pipeline and we" }, { "start": 403.56, "end": 410.44, "text": " get a set of predictions and they're going to be class bounding box, class" }, { "start": 410.44, "end": 415.6, "text": " bounding box, class bounding box. Now the first thing you need to know is that" }, { "start": 415.6, "end": 421.36, "text": " there are always the same amount of predictions. There are always this" }, { "start": 421.36, "end": 427.72, "text": " size here is fixed, that's large n. That's kind of a maximum" }, { "start": 427.72, "end": 431.88, "text": " of predictions. Since you can always predict either a class or the nothing" }, { "start": 431.88, "end": 436.84000000000003, "text": " class, in this case you could predict anywhere from zero to five objects in" }, { "start": 436.84000000000003, "end": 443.84000000000003, "text": " the scene. And then the second thing is from your database you" }, { "start": 443.84000000000003, "end": 449.62, "text": " get out an image with its bounding box annotations that are made by human" }, { "start": 449.62, "end": 458.56, "text": " labellers. Let's say these two. And you also do class bounding box, class bounding" }, { "start": 458.56, "end": 464.6, "text": " box. But now you see we only have two instances, so here we just pad with" }, { "start": 464.6, "end": 468.68, "text": " the nothing class. So I don't know what the bounding box should be for the" }, { "start": 468.68, "end": 474.88, "text": " nothing class. It doesn't really matter. Nothing, no bounding box, nothing, no" }, { "start": 474.88, "end": 484.48, "text": " bounding box, no bounding box. So your ground truth labels, if you will, are also" }, { "start": 484.48, "end": 491.92, "text": " of size n. So you always compare n things here on the left that your classifier" }, { "start": 491.92, "end": 498.32, "text": " output with n things on the right. Now as we already said the question is how do" }, { "start": 498.32, "end": 503.88, "text": " you deal with... you can't simply compare one by one because the ordering should" }, { "start": 503.88, "end": 509.4, "text": " not be important. But also you don't want to encourage your classifier to always" }, { "start": 509.4, "end": 514.24, "text": " kind of... if the one bird is very prominent, you don't want to" }, { "start": 514.24, "end": 518.56, "text": " encourage your classifier to say, here's a bird, here's a bird, there's a bird" }, { "start": 518.56, "end": 521.72, "text": " right here, hey, hey, there's a bird, there's a bird, there's a bird. And" }, { "start": 521.72, "end": 525.4399999999999, "text": " basically just because the signal for that bird is stronger and basically" }, { "start": 525.4399999999999, "end": 529.72, "text": " ignore the other bird, what you want to do is you want to encourage some sort of" }, { "start": 529.72, "end": 534.44, "text": " your classifier to detect if it has already detected an object, it shouldn't" }, { "start": 534.44, "end": 541.84, "text": " detect it again in a slightly different place. So the way you do this is" }, { "start": 541.84, "end": 546.1600000000001, "text": " with this bipartite matching loss. So at the time when you compute a loss," }, { "start": 546.1600000000001, "end": 552.6800000000001, "text": " you go here and you compute what's called a maximum matching. Now what you" }, { "start": 552.6800000000001, "end": 559.64, "text": " have to provide is a loss function. So we can... there's a loss function L and L" }, { "start": 559.64, "end": 565.64, "text": " will take two of these things. L will take the red, the predicted thing of your" }, { "start": 565.64, "end": 573.72, "text": " model and L will take the true under... one of the true underlying things and L" }, { "start": 573.72, "end": 582, "text": " will compute a number and will say how well do these two agree. So you can say" }, { "start": 582, "end": 588.08, "text": " for example if either of them is the nothing class then I have no loss, like I" }, { "start": 588.08, "end": 592.84, "text": " don't care about them, that gives you no loss. But if the two classes" }, { "start": 592.84, "end": 597.96, "text": " agree and the two bounding boxes agree then it's very good right? Then we maybe" }, { "start": 597.96, "end": 602.36, "text": " even give like some negative loss or give loss zero. But if the bounding" }, { "start": 602.36, "end": 609.8000000000001, "text": " boxes agree but the classes don't agree then you say that's bad. Or the other way" }, { "start": 609.8000000000001, "end": 614, "text": " around if the classes agree in the bounding... or even if everything disagrees it's" }, { "start": 614, "end": 620.56, "text": " the worst. What you're basically saying is if these two would" }, { "start": 620.56, "end": 625.52, "text": " correspond to each other, if the thing on the left were the prediction for" }, { "start": 625.52, "end": 628.76, "text": " the thing on the right, which we don't know, it could be that the thing on" }, { "start": 628.76, "end": 633.28, "text": " the right refers to the bird on the right and the thing on the left refers to" }, { "start": 633.28, "end": 637.52, "text": " the bird on the left. So it would be natural that the bounding boxes are the" }, { "start": 637.52, "end": 644.8, "text": " same. But you say if these were corresponding to each other what would" }, { "start": 644.8, "end": 650.24, "text": " the loss be? How well would they do? And now if you compute this bipartite" }, { "start": 650.24, "end": 654.68, "text": " matching, what you want, I guess it's a it's a minimum matching in this case," }, { "start": 654.68, "end": 658.64, "text": " what you want is you want to find an assignment of things on the left to" }, { "start": 658.64, "end": 663.96, "text": " things on the right. A one-to-one assignment. This is an example of a" }, { "start": 663.96, "end": 668, "text": " one-to-one assignment. Everything on the left is assigned exactly one thing on" }, { "start": 668, "end": 675, "text": " the right such that the total loss is minimized. So you're going to say I'm" }, { "start": 675, "end": 680.48, "text": " going to align the things on the left with the things on the right such that" }, { "start": 680.48, "end": 686, "text": " it's maximally favorable. I give you the maximum benefit of the doubt by" }, { "start": 686, "end": 693.84, "text": " aligning these things. So in the best possible case what's the loss?" }, { "start": 693.84, "end": 699, "text": " This is somehow clear. So this you're trying to find the assignment" }, { "start": 699, "end": 704.1600000000001, "text": " from the left to the right that makes that basically is the best case for this" }, { "start": 704.1600000000001, "end": 711.6, "text": " output right here. Where you really say oh okay here you output a bird" }, { "start": 711.6, "end": 716.64, "text": " very close to the bird here in the in a ground truth label. That's this here. So" }, { "start": 716.64, "end": 722.6, "text": " I'm going to connect these two because that's sort of it's" }, { "start": 722.6, "end": 728.08, "text": " it gives a model the most benefit of the doubt. And the loss that you have at the" }, { "start": 728.08, "end": 733.84, "text": " end of that matching, so this loss here would only then count wherever these" }, { "start": 733.84, "end": 741.12, "text": " connections are, that loss is going to be your training loss. So this solves" }, { "start": 741.12, "end": 744.5600000000001, "text": " the problems we had before. It is not dependent on the order because if you" }, { "start": 744.5600000000001, "end": 749.88, "text": " reorder the things your minimum matching will simply swap" }, { "start": 749.88, "end": 757.52, "text": " with it. If you output the same bird multiple times only one of" }, { "start": 757.52, "end": 763.72, "text": " these is going to be assigned. So if this here is that bird only one of them," }, { "start": 763.72, "end": 767.48, "text": " only this one maybe, is going to be assigned to that one. And the other ones" }, { "start": 767.48, "end": 772.08, "text": " can't be assigned to that one, are forced to be assigned to a different one. Let's" }, { "start": 772.08, "end": 776.6, "text": " say this one here and are going to incur a loss. So you encourage your model to" }, { "start": 776.6, "end": 782.44, "text": " output let's say diverse bounding boxes, different bounding boxes for things." }, { "start": 782.44, "end": 787.6800000000001, "text": " So this solves these problems and it's very clever. And there are" }, { "start": 787.6800000000001, "end": 792.2, "text": " algorithms to compute these minimum matchings. They use the Hungarian" }, { "start": 792.2, "end": 796.16, "text": " algorithm which will give you exactly such a matching. Again this is possible" }, { "start": 796.16, "end": 802.64, "text": " because you have n things on each side and the n is in effect here is the" }, { "start": 802.64, "end": 807.68, "text": " maximum of objects that you can detect at once. I guess if there is less you can" }, { "start": 807.68, "end": 813.96, "text": " simply pad right here. And then the model of course is encouraged to come up with" }, { "start": 813.96, "end": 821.76, "text": " the equal number of no class predictions. Because if it outputs a prediction when" }, { "start": 821.76, "end": 826.12, "text": " it shouldn't, if it already predicts two things and these are assigned to" }, { "start": 826.12, "end": 830.3199999999999, "text": " these two things and then it outputs one more thing it is going to be penalized" }, { "start": 830.32, "end": 836.1600000000001, "text": " because it should output three things with no class but it has output one too" }, { "start": 836.1600000000001, "end": 845.6400000000001, "text": " many with a class, it's going to be penalized. Okay so this is a pretty" }, { "start": 845.6400000000001, "end": 850.96, "text": " pretty cool thing. Again it relies on the fact that you have n on both sides" }, { "start": 850.96, "end": 857.1600000000001, "text": " but you can make n so large that basically it covers all of the cases. So" }, { "start": 857.16, "end": 864.28, "text": " you can make n like 50. So you can detect up to 50 things in a scene. Alright" }, { "start": 864.28, "end": 871.8399999999999, "text": " that's the algorithm in a high level. They do show their loss here. You see the" }, { "start": 871.8399999999999, "end": 876.68, "text": " loss ultimately is going to be over this matching right here." }, { "start": 876.68, "end": 883, "text": " That's the minimum bipartite assignment that basically minimizes this total loss" }, { "start": 883, "end": 891.4, "text": " over your prediction and label matchings. And the loss they come up with here, I" }, { "start": 891.4, "end": 899.04, "text": " said you have to give the algorithm a loss, is this one. And they kind of go" }, { "start": 899.04, "end": 904.32, "text": " into how they do it. I don't think it's super important so the class algorithm," }, { "start": 904.32, "end": 910.44, "text": " sorry the loss on the class labels I think is going to be a softmax or a" }, { "start": 910.44, "end": 915.48, "text": " sorry a cross entropy loss like an usual classification. And the loss on the to" }, { "start": 915.48, "end": 921.44, "text": " say whether two bounding boxes agree is a mixture of the L1 loss that compares" }, { "start": 921.44, "end": 927.4200000000001, "text": " two bounding boxes and this IOU loss which is not dependent on the scale of" }, { "start": 927.4200000000001, "end": 931.8000000000001, "text": " the bounding boxes. It kind of computes how much fraction of the two bounding" }, { "start": 931.8000000000001, "end": 938.2800000000001, "text": " boxes overlap. But in any case the loss basically consists of saying how" }, { "start": 938.28, "end": 942.52, "text": " how much do the labels agree and how much do the bounding boxes agree." }, { "start": 942.52, "end": 947.04, "text": " Again this is only possible because after that you compute this matching" }, { "start": 947.04, "end": 951, "text": " otherwise you would have no clue which predictions to" }, { "start": 951, "end": 956.0799999999999, "text": " compare to which other predictions. So let's look at this architecture a bit" }, { "start": 956.0799999999999, "end": 961.24, "text": " more in detail. As we said you have this what they call the backbone which is a" }, { "start": 961.24, "end": 967.64, "text": " convolutional neural network. And with that you put in some positional encodings." }, { "start": 967.64, "end": 974.24, "text": " Now I already said the you should look at these features right here as just" }, { "start": 974.24, "end": 980.16, "text": " smaller feature versions of the image but they still have some image nature." }, { "start": 980.16, "end": 986.36, "text": " Then they are flattened. So once they are put in the transformer encoder" }, { "start": 986.36, "end": 994, "text": " because the transformer is naturally a sequence processing unit okay so it" }, { "start": 994, "end": 998.84, "text": " takes in just a sequence of vectors right here. And since an image is not a" }, { "start": 998.84, "end": 1004.12, "text": " sequence what you'll do is if you have your image features and we said we have" }, { "start": 1004.12, "end": 1007.76, "text": " a bunch of channels let's say we have four channels and they're height and" }, { "start": 1007.76, "end": 1018.7, "text": " width and C you're going to unroll and flatten that into one sequence. So this" }, { "start": 1018.7, "end": 1025.0800000000002, "text": " is height times width you basically unroll across these axis right here into" }, { "start": 1025.0800000000002, "end": 1035.68, "text": " this axis and it's channel size. So basically you have a sequence here of" }, { "start": 1035.68, "end": 1043.04, "text": " C dimensional feature vectors that you then put into your encoder. So" }, { "start": 1043.04, "end": 1049.36, "text": " your encoder will now transform this sequence into an equally long sequence" }, { "start": 1049.36, "end": 1056.52, "text": " yet again of features. And the good thing about a transformer because why do you" }, { "start": 1056.52, "end": 1060.76, "text": " use a transformer? The good thing about the transformer is that in such a" }, { "start": 1060.76, "end": 1065.6, "text": " sequence and I've done videos on transformers you can basically mainly" }, { "start": 1065.6, "end": 1070.52, "text": " look at the video attention is all you need if you want to understand this more" }, { "start": 1070.52, "end": 1078.8, "text": " fully. This thing can basically have attention so it has attention layers it" }, { "start": 1078.8, "end": 1086.28, "text": " can attend from each position to each position in a one-shot manner. So as it" }, { "start": 1086.28, "end": 1092.28, "text": " transforms this representation up the transformer layers at each step it can" }, { "start": 1092.28, "end": 1096.92, "text": " basically aggregate information from everywhere in the sequence to anywhere" }, { "start": 1096.92, "end": 1103.8400000000001, "text": " else and therefore it's very it's very powerful if you have a sequence and you" }, { "start": 1103.8400000000001, "end": 1108.8000000000002, "text": " need sort of global connections across the sequence. This is very good for a" }, { "start": 1108.8000000000002, "end": 1113.76, "text": " language processing because in a sentence let's look at this sentence the" }, { "start": 1113.76, "end": 1121.28, "text": " input images are batched together. Applying blah blah blah blah blah blah" }, { "start": 1121.28, "end": 1127.16, "text": " blah blah blah and then there's they right the word they and you need you" }, { "start": 1127.16, "end": 1133, "text": " need to know that they refers to the input images okay and but you see this" }, { "start": 1133, "end": 1139.2, "text": " is very very far away in the sentence so you need a model that makes use of long" }, { "start": 1139.2, "end": 1143.6, "text": " range dependencies and they make the case that in such a task right here you" }, { "start": 1143.6, "end": 1148.18, "text": " also need the long range dependencies because these bounding boxes as you see" }, { "start": 1148.18, "end": 1154, "text": " right here they can be quite large so if you have an image you need that this" }, { "start": 1154, "end": 1158.76, "text": " part here communicates with these and this and this and this part basically" }, { "start": 1158.76, "end": 1163.68, "text": " anywhere in the bounding box and these bounding boxes can be quite large so the" }, { "start": 1163.68, "end": 1168.88, "text": " transformer architecture actually makes sense here. Now I want to go a bit later" }, { "start": 1168.88, "end": 1173.6000000000001, "text": " into why I think it actually makes even more sense for bounding box detection" }, { "start": 1173.6, "end": 1178.8799999999999, "text": " but right now I just want to keep going through this through this architecture" }, { "start": 1178.8799999999999, "end": 1186.52, "text": " right here so if my computer here decides to come back yes we can go on so" }, { "start": 1186.52, "end": 1195.3999999999999, "text": " what we'll get out is yet another so in here we put this thing we put down here" }, { "start": 1195.3999999999999, "end": 1200, "text": " we put into the transformer encoder and we get an equally sized equally shaped" }, { "start": 1200, "end": 1205.4, "text": " sequence out of the transformer encoder and you see that this thing here goes as" }, { "start": 1205.4, "end": 1210.84, "text": " a side input into this transformer decoder so the transformer encoder here" }, { "start": 1210.84, "end": 1215.68, "text": " is just a bit more of a feature mapping technically just for the architecture" }, { "start": 1215.68, "end": 1220.34, "text": " you could think of just putting this into here but of course it's going to go" }, { "start": 1220.34, "end": 1226.2, "text": " better with the transformer encoder the transformer decoder now does something" }, { "start": 1226.2, "end": 1231.48, "text": " similar but you see it has the encoder as a side input this is very much like" }, { "start": 1231.48, "end": 1237.48, "text": " this is not like BERT BERT is like a only encoder transformer whereas this" }, { "start": 1237.48, "end": 1242.48, "text": " is much like the original attention is all you need transformer that has an" }, { "start": 1242.48, "end": 1247.2, "text": " encoder and then the decoder as a side input basically as conditioning" }, { "start": 1247.2, "end": 1253.52, "text": " information has the encoder output what does the decoder do again since it's a" }, { "start": 1253.52, "end": 1257.96, "text": " transformer it's going to take a sequence and output a sequence the" }, { "start": 1257.96, "end": 1263.84, "text": " sequence it takes is right here is what they call object queries and this also" }, { "start": 1263.84, "end": 1266.72, "text": " is different from the attention is all you need papers and they don't do it" }, { "start": 1266.72, "end": 1271.32, "text": " autoregressively they just do it one shot what does it mean it means that you" }, { "start": 1271.32, "end": 1276.8, "text": " start with a sequence here of four things and these are these are the this" }, { "start": 1276.8, "end": 1283.04, "text": " is this big N and you out you output the sequence of a sequence of four things" }, { "start": 1283.04, "end": 1288.6, "text": " and it's important to see what they're going to end up so these things are then" }, { "start": 1288.6, "end": 1296.1599999999999, "text": " directly going through a classifier that now outputs the so these things here are" }, { "start": 1296.1599999999999, "end": 1304.44, "text": " these class label bounding box outputs okay so each of these things is going to" }, { "start": 1304.44, "end": 1309.04, "text": " after transformation end up being one of these bounding boxes either defining an" }, { "start": 1309.04, "end": 1313.8, "text": " object or saying that there isn't an object somewhere okay you see here this" }, { "start": 1313.8, "end": 1318.56, "text": " bounding box refers to this bird this bounding box refers to this bird so each" }, { "start": 1318.56, "end": 1327.12, "text": " of these things is going to be one bounding box and the what they call" }, { "start": 1327.12, "end": 1331.84, "text": " object queries is the question of course is what do you input here right I" }, { "start": 1331.84, "end": 1335.48, "text": " actually I want to transform this image information that comes from the left" }, { "start": 1335.48, "end": 1339.8, "text": " here I want to transform that into the bounding boxes what do I input here and" }, { "start": 1339.8, "end": 1346.3600000000001, "text": " the answer is you just input at the start you just input n random vectors" }, { "start": 1346.3600000000001, "end": 1351.72, "text": " because what's that gonna give you is basically n outputs you want an outputs" }, { "start": 1351.72, "end": 1357.68, "text": " because you want n of these bounding box classifications so you need n things and" }, { "start": 1357.68, "end": 1362.72, "text": " if I input n things into a transformer it's going to give me n things as an" }, { "start": 1362.72, "end": 1366.84, "text": " output and then in each step I can simply condition on the information that" }, { "start": 1366.84, "end": 1372.84, "text": " comes in the images and it it'll give me right then I can incorporate that" }, { "start": 1372.84, "end": 1377.2, "text": " information it's a very deep learning way of thinking about it actually so that" }, { "start": 1377.2, "end": 1381.2, "text": " you just need the information somewhere in there and I need n things now they go" }, { "start": 1381.2, "end": 1387.24, "text": " more into detail into this transformer architecture help help in a helpful" }, { "start": 1387.24, "end": 1394.32, "text": " fashion in the appendix and we'll go there quickly so this I think here makes" }, { "start": 1394.32, "end": 1400.28, "text": " more sense so the image features come in here right and you see this is just a" }, { "start": 1400.28, "end": 1405.52, "text": " transformer stack an encoder stack of multi-head self-attention and feed" }, { "start": 1405.52, "end": 1414.1200000000001, "text": " forward in instance wise or like token wise feed forward network and then that" }, { "start": 1414.12, "end": 1421.4799999999998, "text": " information is taken and is given as conditioning information over here now" }, { "start": 1421.4799999999998, "end": 1425.9199999999998, "text": " in here as I said you input these object queries which at the beginning are just" }, { "start": 1425.9199999999998, "end": 1432.4799999999998, "text": " n random vectors and what you're going to do you are also going to feature" }, { "start": 1432.4799999999998, "end": 1438.12, "text": " encode them and then you combine it with this image information so ultimately if" }, { "start": 1438.12, "end": 1442.84, "text": " you think of this one of these things one of these things is going to be a" }, { "start": 1442.84, "end": 1449, "text": " vector right and then that vector is going to be transformed and then it" }, { "start": 1449, "end": 1454.76, "text": " will have as it is transformed it will have the opportunity to basically look" }, { "start": 1454.76, "end": 1459.9199999999998, "text": " at features that come from here the arrow is in the wrong direction so you" }, { "start": 1459.9199999999998, "end": 1465, "text": " have already taken the image and you've transformed it into a feature" }, { "start": 1465, "end": 1469.6, "text": " representation which is also a vector right you have the features of the image" }, { "start": 1469.6, "end": 1476.8, "text": " right here now as you transform this vector this object query Q you have the" }, { "start": 1476.8, "end": 1482.9599999999998, "text": " opportunity to look at the image features right and that's how do you get" }, { "start": 1482.9599999999998, "end": 1488.32, "text": " the image information in there so the image features will come in here" }, { "start": 1488.32, "end": 1493.76, "text": " transform that through attention so this is an attention mechanism on the image" }, { "start": 1493.76, "end": 1500.68, "text": " and then what you will output is a bounding box and a class label it's" }, { "start": 1500.68, "end": 1507.92, "text": " really hard to explain I would guess you need to understand really what attention" }, { "start": 1507.92, "end": 1512.68, "text": " mechanisms are and of course the crucial part of course is what what's this what" }, { "start": 1512.68, "end": 1517.4, "text": " do you input at the beginning and these object queries aren't actually random as" }, { "start": 1517.4, "end": 1523.68, "text": " I said they are learned so what you're going to do is you're going to learn in" }, { "start": 1523.68, "end": 1529, "text": " dependent of the input image you're going to learn n different object" }, { "start": 1529, "end": 1536, "text": " queries and these object queries now it's very it's very interesting because" }, { "start": 1536, "end": 1542.88, "text": " these object queries are sort of going to be different it's like you have" }, { "start": 1542.88, "end": 1548.96, "text": " different people that can ask the input image different questions right and this" }, { "start": 1548.96, "end": 1557.04, "text": " they have so their end is 100 but they show 20 of these object queries that" }, { "start": 1557.04, "end": 1562.64, "text": " they learn and so they have visualization of all bounding box" }, { "start": 1562.64, "end": 1569.44, "text": " predictions on all images so it's it's sort of like you have n different people" }, { "start": 1569.44, "end": 1574.88, "text": " at your disposal and you train these n different people to kind of ask" }, { "start": 1574.88, "end": 1581.16, "text": " different questions of the input image okay you say this person up here will" }, { "start": 1581.16, "end": 1585.68, "text": " always ask irrespective of what the input images will always ask sort of hey" }, { "start": 1585.68, "end": 1590.5600000000002, "text": " input image what's what's on your bottom left right that's I'm really interested" }, { "start": 1590.5600000000002, "end": 1595.8000000000002, "text": " what's on your bottom left and sometimes I'm a bit interested in what's here but" }, { "start": 1595.8000000000002, "end": 1599.68, "text": " I'm mainly interested what's on the bottom left of the image whereas this" }, { "start": 1599.68, "end": 1605.5600000000002, "text": " person right here sorry this person right here is more interested in what's" }, { "start": 1605.5600000000002, "end": 1611.52, "text": " in the center of the different colors here is referred to different sizes of" }, { "start": 1611.52, "end": 1616.6000000000001, "text": " bounding boxes so this person is also interested so the person on the top left" }, { "start": 1616.6000000000001, "end": 1622.1200000000001, "text": " is interested mainly in I think small bounding boxes that are on the bottom" }, { "start": 1622.1200000000001, "end": 1627.48, "text": " left and the person here is mostly interested in what's I'm really" }, { "start": 1627.48, "end": 1631.6, "text": " interested what's in the center what's large in the center I want give me large" }, { "start": 1631.6, "end": 1638.48, "text": " things that are in the center right and then this person right here is really" }, { "start": 1638.48, "end": 1643.6, "text": " interested on stuff that's on the right side of the image so you see in order to" }, { "start": 1643.6, "end": 1648.8, "text": " get different sort of a difference in bounding box predictions you train n" }, { "start": 1648.8, "end": 1656, "text": " different people to ask different questions of the of the input image and" }, { "start": 1656, "end": 1661.28, "text": " this asking of questions is exactly what an attention mechanism is so this" }, { "start": 1661.28, "end": 1668.76, "text": " person right here let's let's take this this person and I'm saying person these" }, { "start": 1668.76, "end": 1674.84, "text": " are vectors these are learned object queries but this person first they will" }, { "start": 1674.84, "end": 1680.12, "text": " simply ask the question what's on what's on the right side and then the the image" }, { "start": 1680.12, "end": 1688.6, "text": " features right getting drawing the image features it will have an attention" }, { "start": 1688.6, "end": 1694.6399999999999, "text": " mechanism to this part of the image features and then it will get back some" }, { "start": 1694.6399999999999, "end": 1700.8, "text": " signal right and then it will transform that with its own signal up and then it" }, { "start": 1700.8, "end": 1706.3999999999999, "text": " will ask maybe again okay now that I know more because you see that person is" }, { "start": 1706.3999999999999, "end": 1709.1999999999998, "text": " interested in multiple things it's interested in those things and those" }, { "start": 1709.2, "end": 1713.96, "text": " things so at first it will focus on these things but then it says on now I'm" }, { "start": 1713.96, "end": 1718.92, "text": " now I know more right there is there I know I see there is actually something" }, { "start": 1718.92, "end": 1723.24, "text": " on the right side so in the higher layers it can then go back and ask the" }, { "start": 1723.24, "end": 1728.52, "text": " image more questions by sending these Q vectors of the attention mechanism and" }, { "start": 1728.52, "end": 1734.48, "text": " it will get back the V vectors from the image features that correspond to these" }, { "start": 1734.48, "end": 1740.72, "text": " Q things so up and up the layers this person can ask more refined questions" }, { "start": 1740.72, "end": 1745.6, "text": " about what that particular person is interested in okay and since you have" }, { "start": 1745.6, "end": 1752.4, "text": " the different people here that ask different questions you basically learn" }, { "start": 1752.4, "end": 1758.44, "text": " the people in a way such that across the data set they all together they cover" }, { "start": 1758.44, "end": 1763.76, "text": " every possible image pretty well again these people what they're interested in" }, { "start": 1763.76, "end": 1767.76, "text": " initially is not dependent on the picture you simply learn this in a" }, { "start": 1767.76, "end": 1773.56, "text": " global manner all right this is the best way I have of describing it he basically" }, { "start": 1773.56, "end": 1779.8799999999999, "text": " learned and people that are each one is interested in different things different" }, { "start": 1779.8799999999999, "end": 1784.48, "text": " classes and different regions in the image and each one of these people is" }, { "start": 1784.48, "end": 1791.8, "text": " going to output their best guess of what is where based on what they're interested" }, { "start": 1791.8, "end": 1796.72, "text": " in so that person might say I'm you know I'm the person that's interested kind of" }, { "start": 1796.72, "end": 1801.6, "text": " in the left side of things so I I'm going to output that there is a bird" }, { "start": 1801.6, "end": 1806.68, "text": " right here now these people if this is a transformer right and everything can" }, { "start": 1806.68, "end": 1811.6, "text": " attend to everything they can actually communicate with each other as they" }, { "start": 1811.6, "end": 1817.6, "text": " incorporate information from the image so in each layer they can do both they" }, { "start": 1817.6, "end": 1821.28, "text": " can incorporate information from the image and they can communicate with each" }, { "start": 1821.28, "end": 1824.6399999999999, "text": " other and then in the next layer they can do it again and again and again and" }, { "start": 1824.6399999999999, "end": 1830.28, "text": " thereby they can sort of they can sort of say well you already got the left side" }, { "start": 1830.28, "end": 1835.32, "text": " I will take the right side you already got the bird class I will take the" }, { "start": 1835.32, "end": 1840.68, "text": " elephant class and so on so you see here how the the architecture of the" }, { "start": 1840.68, "end": 1847.08, "text": " transformer actually is also very conducive to doing this bounding box" }, { "start": 1847.08, "end": 1851.24, "text": " prediction in that these different things can sort of attend to each other" }, { "start": 1851.24, "end": 1857.52, "text": " and therefore communicate with each other all right I hope that sort of" }, { "start": 1857.52, "end": 1861.6799999999998, "text": " makes sense now before we get into the experiments I want to list a third" }, { "start": 1861.6799999999998, "end": 1868.04, "text": " reason of why the transformer especially the encoders might actually also make a" }, { "start": 1868.04, "end": 1875.1599999999999, "text": " giant amount of sense here since you unroll the image into height and width" }, { "start": 1875.16, "end": 1880.3200000000002, "text": " and you have to imagine what does the transformer do the transformer as we" }, { "start": 1880.3200000000002, "end": 1885.28, "text": " said here has this notion of a tension where from any point in the sequence it" }, { "start": 1885.28, "end": 1890.3200000000002, "text": " can gather information from any other point in the sequence and this that's" }, { "start": 1890.3200000000002, "end": 1895.8600000000001, "text": " usually one of the downsides of the transformers is done via a quadratic" }, { "start": 1895.8600000000001, "end": 1901.52, "text": " attention mechanism so if I just list one feature channel go over here if I" }, { "start": 1901.52, "end": 1908.08, "text": " just list one feature channel right here this is height times width of the image" }, { "start": 1908.08, "end": 1914.08, "text": " right this is this is the entire image unrolled in one vector height times" }, { "start": 1914.08, "end": 1922.28, "text": " width and here I unroll it again height times width then this this matrix that I" }, { "start": 1922.28, "end": 1929.08, "text": " can build right here which is called the attention matrix right here it will tell" }, { "start": 1929.08, "end": 1934.6799999999998, "text": " me which parts of the sequence attend to which other parts okay so if you have an" }, { "start": 1934.6799999999998, "end": 1940.3999999999999, "text": " image that has the let's say the number three and you really want to figure out" }, { "start": 1940.3999999999999, "end": 1945.6399999999999, "text": " whether or not this is a three then the bow up here must communicate with the" }, { "start": 1945.6399999999999, "end": 1949.36, "text": " bow down here right they need to share information is it ah there's a bow here" }, { "start": 1949.36, "end": 1954.84, "text": " there's a bow here and there is a spiky thing here that must be a three so you" }, { "start": 1954.84, "end": 1959, "text": " want something this is rather at the beginning of the sequence you want this" }, { "start": 1959, "end": 1963.32, "text": " to attend first of all it will attend itself so you get fairly high values" }, { "start": 1963.32, "end": 1973.4, "text": " along the diagonal maybe 10 10 10 11 11 12 I saw this olig skit 100 million nine" }, { "start": 1973.4, "end": 1978.96, "text": " nine but it also like this this part here at the beginning of the sequence" }, { "start": 1978.96, "end": 1982.58, "text": " let's say it's here because this is unrolled right needs to attend to the" }, { "start": 1982.58, "end": 1988.72, "text": " end so this needs to attend to the end which we will put an 11 here and" }, { "start": 1988.72, "end": 1994.04, "text": " the other way around doesn't always need to be symmetrical by the way okay but in" }, { "start": 1994.04, "end": 2001.52, "text": " any case this is going to be a h times w squared matrix because everything can" }, { "start": 2001.52, "end": 2005.72, "text": " attend to everything and that's the attention mechanism why do I think this" }, { "start": 2005.72, "end": 2010.92, "text": " is so good for bounding boxes because let's let's imagine you actually have a" }, { "start": 2010.92, "end": 2016, "text": " matrix that is like this okay height times width times height times width" }, { "start": 2016, "end": 2021.04, "text": " every single point in here actually defines a bounding box because this" }, { "start": 2021.04, "end": 2028, "text": " point this point right here in this dimension corresponds to one location in" }, { "start": 2028, "end": 2032.88, "text": " the image and on this axis it corresponds to another location now in" }, { "start": 2032.88, "end": 2036.96, "text": " the attention matrix simply means these two points need to communicate but if" }, { "start": 2036.96, "end": 2042, "text": " you have two pixels you actually have defined a bounding box right here right" }, { "start": 2042, "end": 2048.84, "text": " you you are actually you're defining a bounding box and the the fact that this" }, { "start": 2048.84, "end": 2054.52, "text": " is happening in the exact same matrices could mean that the transformers are" }, { "start": 2054.52, "end": 2059.64, "text": " uniquely well the transformers across sequences of these height times width" }, { "start": 2059.64, "end": 2066.04, "text": " unrolled images are uniquely well conducive to these bounding box" }, { "start": 2066.04, "end": 2071.76, "text": " prediction tasks I'm actually a bit astounded because when I first just read" }, { "start": 2071.76, "end": 2075.44, "text": " the title this immediately popped to my mind I'm like oh yes of course and" }, { "start": 2075.44, "end": 2080.2000000000003, "text": " they're going to predict the bounding boxes by simply training so what you" }, { "start": 2080.2000000000003, "end": 2084, "text": " would do what I thought this was gonna be is out you output an actual matrix" }, { "start": 2084, "end": 2090.84, "text": " like this and then you simply each point you can you can simply classify right so" }, { "start": 2090.84, "end": 2097.6800000000003, "text": " you can classify here whether whether or not like at in this direction there is a" }, { "start": 2097.68, "end": 2103.96, "text": " bird right and then if you have two points like this for example you and you" }, { "start": 2103.96, "end": 2107.52, "text": " also classify whether in this direction there is a bird right and this naturally" }, { "start": 2107.52, "end": 2111.6, "text": " defines a bounding box or you could like take this matrix and actually just" }, { "start": 2111.6, "end": 2117.56, "text": " classify individual points in this matrix to be the bounding boxes because" }, { "start": 2117.56, "end": 2123.3599999999997, "text": " they already define bounding boxes so I just I think these these quadratic" }, { "start": 2123.36, "end": 2127.52, "text": " things are are uniquely I mean someone must have thought of this or if not" }, { "start": 2127.52, "end": 2132.44, "text": " cite the YouTube channel it would be funny first paper ever to actually have" }, { "start": 2132.44, "end": 2139.36, "text": " to cite the YouTube channel but again yeah so transformers seem to be a good" }, { "start": 2139.36, "end": 2146.1, "text": " idea for these kinds of things so how do they do of course they do well they are" }, { "start": 2146.1, "end": 2152.48, "text": " on par with these other much much much more complex architectures these faster" }, { "start": 2152.48, "end": 2158.2400000000002, "text": " are CNN models they are apparently much more complex but they are on par with" }, { "start": 2158.2400000000002, "end": 2164.56, "text": " this they do however train forever I think they train for like six days on" }, { "start": 2164.56, "end": 2169.28, "text": " eight GPUs is not that much if you compare to like language models on" }, { "start": 2169.28, "end": 2175.6, "text": " hundreds of TPUs but still okay I don't want to go into the numbers of" }, { "start": 2175.6, "end": 2180.64, "text": " experiments but what is pretty cool is that they can now visualize this sort of" }, { "start": 2180.64, "end": 2186.7599999999998, "text": " attention and you can see right here that if they look at a particular point" }, { "start": 2186.7599999999998, "end": 2192.16, "text": " in the image and visualize the attention it will actually attend to the instance" }, { "start": 2192.16, "end": 2196.3599999999997, "text": " itself so it will like these are usually the problems for these detection" }, { "start": 2196.3599999999997, "end": 2201.2, "text": " algorithms when things overlap and are partially occluded but you can see right" }, { "start": 2201.2, "end": 2206, "text": " here that the attention is on the part of the image that makes the instance in" }, { "start": 2206, "end": 2210.24, "text": " the back and the attention here is on the part of this and it doesn't sort of" }, { "start": 2210.24, "end": 2216.3999999999996, "text": " overlap into the others so that is one thing that's pretty impressive about" }, { "start": 2216.3999999999996, "end": 2221.12, "text": " these architectures the other thing they show is for example it can generalize to" }, { "start": 2221.12, "end": 2227, "text": " many many instances so here it has never seen 24 giraffes in one image but yet it" }, { "start": 2227, "end": 2235.3199999999997, "text": " can absolutely do that and giraffe giraffe giraffe giraffe giraffe and the" }, { "start": 2235.32, "end": 2242.1600000000003, "text": " one of the coolest images I find are these here where you can see right here" }, { "start": 2242.1600000000003, "end": 2249, "text": " again attention visualization and you see that even within the bounding box" }, { "start": 2249, "end": 2257.56, "text": " of the front elephant here you see that the attention on this foot of the back" }, { "start": 2257.56, "end": 2264.2000000000003, "text": " elephant is is is assigned to this blue bounding box so this is the blue" }, { "start": 2264.2, "end": 2270.72, "text": " basically the blue bounding box person that is attending to that back foot that" }, { "start": 2270.72, "end": 2277.3199999999997, "text": " means they they these things really sort of understand or they learn these things" }, { "start": 2277.3199999999997, "end": 2286.04, "text": " like occlusion and just hard I have a hard time describing it but you can see" }, { "start": 2286.04, "end": 2289.58, "text": " it visually here right like how it clearly learns that these are two" }, { "start": 2289.58, "end": 2295.08, "text": " instances that are sort of occluding each other but this this this instance can" }, { "start": 2295.08, "end": 2300.6, "text": " actually appear within the bounding box of the other instance and the same goes" }, { "start": 2300.6, "end": 2305.3199999999997, "text": " for the zebra here that are partially occluding each other and you can see that" }, { "start": 2305.3199999999997, "end": 2311.2, "text": " the attention is correctly like even here that this back foot of this zebra" }, { "start": 2311.2, "end": 2320.24, "text": " is correctly labeled so all in all that is pretty cool and they take it a step" }, { "start": 2320.24, "end": 2324.3199999999997, "text": " further and they say well with this architecture we can actually pretty" }, { "start": 2324.3199999999997, "end": 2330.04, "text": " easily do pixel wise classification so this is this cocoa stuff and things data" }, { "start": 2330.04, "end": 2335.96, "text": " set where I don't know which one is the stuff and which one is the things I" }, { "start": 2335.96, "end": 2340.68, "text": " think things is the objects and stuff is like sky and mountains and so on and" }, { "start": 2340.68, "end": 2346.44, "text": " so this is a classification task where you actually have to label every single" }, { "start": 2346.44, "end": 2350.9199999999996, "text": " pixel so what they do is they simply input this through their detector and" }, { "start": 2350.9199999999996, "end": 2357.48, "text": " they detect the instances they take the attention maps of the instances and then" }, { "start": 2357.48, "end": 2363.3599999999997, "text": " they scale it up this right here is just a CNN sort of in reverse that scales up" }, { "start": 2363.3599999999997, "end": 2368.3999999999996, "text": " the image because they have scaled it down as we said they scale it up again" }, { "start": 2368.4, "end": 2376.7200000000003, "text": " and then they can simply classify each pixel where each of these you remember" }, { "start": 2376.7200000000003, "end": 2380.64, "text": " we had these different people here that it that cared about different things in" }, { "start": 2380.64, "end": 2385.56, "text": " the image each of these people will classify their respective pixels the" }, { "start": 2385.56, "end": 2389.64, "text": " pixels they feel responsible for and then you simply merge all of these" }, { "start": 2389.64, "end": 2396.12, "text": " people's predictions together into this prediction and again this gives pretty" }, { "start": 2396.12, "end": 2403.3199999999997, "text": " pretty impressive results I am I mean this is this is fun this looks like it" }, { "start": 2403.3199999999997, "end": 2408.52, "text": " sort of works haven't they do quantitative analysis of course but I'm" }, { "start": 2408.52, "end": 2411.7999999999997, "text": " just impressed by the examples right here" }, { "start": 2411.7999999999997, "end": 2417.3599999999997, "text": " alright that was sort of it I really enjoyed reading this papers the" }, { "start": 2417.3599999999997, "end": 2422, "text": " simplicity is pretty cool they do have not only do they have code in the paper" }, { "start": 2422, "end": 2428.16, "text": " to show how ridiculously easy it is to get this to run this is all you need in" }, { "start": 2428.16, "end": 2433.64, "text": " pytorch but they do actually have code and as I understand they also have" }, { "start": 2433.64, "end": 2438.4, "text": " pre-trained models so they have this model zoo right here where they give you" }, { "start": 2438.4, "end": 2442.68, "text": " the pre-trained models so you can play with it and you can even load it from" }, { "start": 2442.68, "end": 2448.08, "text": " torch hub yourself and you can train it yourself they have a collab all is there" }, { "start": 2448.08, "end": 2453.2, "text": " all right again if you enjoyed this video consider leaving a like" }, { "start": 2453.2, "end": 2482.08, "text": " subscribing and I'll see you next time bye bye" } ]
a-VQfQqIMrE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
mixup: Beyond Empirical Risk Minimization (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "classifier", "dnn", "cnn", "high dimensions", "class boundaries", "mixing", "interpolation", "latent", "beta", "regularizer", "regularization", "generalization", "adversarial examples", "smooth" ]
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 Cheng, Mustafa Sis, Jan Endauphin and David Lopez-Paz. So this paper is actually pretty simple, but it introduces a technique that apparently helps with training classifiers, and I haven't 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. Your neural network has parameters theta. You get some output y hat, and along with the X you also have a y, a 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 think that your X comes 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 a data set of a finite amount of data that you can sample X and Y from. So instead of minimizing your true risk, you minimize your empirical risk, the empirical misc-renimization 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 class 1, this is class 2, your network is going to maybe make decision boundaries like this, and like this, where it says okay, here is class 1 and here is class 2. But it's very conceivable that here it says, here is class 4, and over here is class 7, and right here through is class 9, and by the way, here, class 4 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 and it's a little bit B. And now you think, what are the labels here if A belongs to class 1 and B belongs to class 2? And of course the label of this data point is 0.1 times the class of B, which is 2, plus 0.9 times the class of A, which is 1. Ultimately, because what you do is you input a class like class number 2, if you want to input this into a machine learning model, you don't just say it's class number 2. What you input is a distribution that basically has zeros everywhere. So these small things, they're 0, 0, 0, 1, 0. And this here is at class number 2. So this would be class number 1, class number 2, class number 3, right? You input a distribution like this if you want to express class number 2. Now in our sample right here, what we would input as a label is simply a mix between class 1, so 0.9, so 0.9 of class 1, 0.1 of class 2, and then 0 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. Formally, 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. So the model on the left here is class number 1, right? That's class number 1. The thing on the right is class number 2. This here is half of class 1 and half of class 2. 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 2 and around class 1 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 1 or class 2. And they say that can help the generalization performance. And it's visible. Why? Right? It's just the only thing that's not clear from the beginning is that this kind of interpolation actually makes sense. Because 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. And 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 a natural 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 data set 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. Whereas if you use mixup, your border is much, much, much more fuzzy. It's like, yeah, it's only really sure here. And 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 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. I have seemed to lost the ability to zoom. Oh, no, it's back. OK. 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 mixup 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. They 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 on stabilized 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 counted 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, this they also say that the gradient norm of the gradients of the model with respect to input in between training data, it happens the same thing. The norm of the gradients in the middle is also much, much lower. And this investigation I find pretty cool. I have to say I've 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 a 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. All right. So if you like this, I invite you to read the paper. If you like the video, please subscribe and like and comment. And yeah, have a nice day. Bye bye.
[ { "start": 0, "end": 6.7, "text": " Hi there! Today we'll look at Mix-Up Beyond Empirical Risk Minimization by Hongyi Cheng," }, { "start": 6.7, "end": 11.66, "text": " Mustafa Sis, Jan Endauphin and David Lopez-Paz." }, { "start": 11.66, "end": 22, "text": " So this paper is actually pretty simple, but it introduces a technique that apparently helps with training classifiers," }, { "start": 22, "end": 29.5, "text": " and I haven't seen it used in practice, so there must be at least something to it." }, { "start": 29.5, "end": 32.5, "text": " It is ultimately very simple." }, { "start": 32.5, "end": 41, "text": " So usually you input a data point X into your neural network in deep learning." }, { "start": 41, "end": 48, "text": " So f of X, that's your neural network. Your neural network has parameters theta." }, { "start": 48, "end": 56, "text": " You get some output y hat, and along with the X you also have a y, a true label," }, { "start": 56, "end": 62, "text": " and then you have a loss function that compares what you output with your true label," }, { "start": 62, "end": 65, "text": " and then you just try to make that loss smaller." }, { "start": 65, "end": 75, "text": " 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." }, { "start": 75, "end": 82, "text": " And we call this empirical risk minimization," }, { "start": 82, "end": 90, "text": " because you don't actually think that your X comes from some data distribution D," }, { "start": 90, "end": 94, "text": " like the space of all natural images or the space of all of language," }, { "start": 94, "end": 104, "text": " but what you actually have is a data set of a finite amount of data that you can sample X and Y from." }, { "start": 104, "end": 116, "text": " So instead of minimizing your true risk, you minimize your empirical risk, the empirical misc-renimization right here." }, { "start": 116, "end": 118, "text": " Now what's the problem with that?" }, { "start": 118, "end": 124, "text": " The problem is that you can get overly confident about your data points and nothing else," }, { "start": 124, "end": 126, "text": " and that will hurt your generalization." }, { "start": 126, "end": 132, "text": " So if you have a data point, let's say right here, and another one right here," }, { "start": 132, "end": 138, "text": " your network is basically, so this is class 1, this is class 2," }, { "start": 138, "end": 143, "text": " your network is going to maybe make decision boundaries like this, and like this," }, { "start": 143, "end": 146, "text": " where it says okay, here is class 1 and here is class 2." }, { "start": 146, "end": 155, "text": " But it's very conceivable that here it says, here is class 4, and over here is class 7," }, { "start": 155, "end": 161, "text": " and right here through is class 9, and by the way, here, class 4 again." }, { "start": 161, "end": 170, "text": " So the empirical risk minimization leaves everything in between the data points open." }, { "start": 170, "end": 179, "text": " Now what this paper proposes is that we should not only train our classifier on these data points," }, { "start": 179, "end": 185, "text": " but on all the data points sort of in between the two." }, { "start": 185, "end": 190, "text": " And this is the mix-up data points." }, { "start": 190, "end": 195, "text": " So this data point here might be constructed, if this is A and this is B," }, { "start": 195, "end": 208, "text": " from 0.1 times B, right, and plus 0.9 times A, because it's mostly A and it's a little bit B." }, { "start": 208, "end": 214, "text": " And now you think, what are the labels here if A belongs to class 1 and B belongs to class 2?" }, { "start": 214, "end": 222, "text": " And of course the label of this data point is 0.1 times the class of B, which is 2," }, { "start": 222, "end": 227, "text": " plus 0.9 times the class of A, which is 1." }, { "start": 227, "end": 233, "text": " Ultimately, because what you do is you input a class like class number 2," }, { "start": 233, "end": 238, "text": " if you want to input this into a machine learning model, you don't just say it's class number 2." }, { "start": 238, "end": 245, "text": " What you input is a distribution that basically has zeros everywhere." }, { "start": 245, "end": 250, "text": " So these small things, they're 0, 0, 0, 1, 0." }, { "start": 250, "end": 252, "text": " And this here is at class number 2." }, { "start": 252, "end": 255, "text": " So this would be class number 1, class number 2, class number 3, right?" }, { "start": 255, "end": 261, "text": " You input a distribution like this if you want to express class number 2." }, { "start": 261, "end": 269, "text": " Now in our sample right here, what we would input as a label is simply a mix between class 1," }, { "start": 269, "end": 278, "text": " so 0.9, so 0.9 of class 1, 0.1 of class 2, and then 0 everywhere else." }, { "start": 278, "end": 284, "text": " So this would be our label for the data point that we construct right here." }, { "start": 284, "end": 288, "text": " This would be our, sorry, the top one would be our data point." }, { "start": 288, "end": 297, "text": " Formally, you take two data points and you mix them using this lambda mixing factor." }, { "start": 297, "end": 301, "text": " That'll give you a new data point that's in between the other data points." }, { "start": 301, "end": 305, "text": " And you take the two corresponding labels and you mix them accordingly as well." }, { "start": 305, "end": 308, "text": " And that will give you the label for that data point." }, { "start": 308, "end": 314, "text": " And now your model will learn to basically smoothly interpolate." }, { "start": 314, "end": 316, "text": " So you will teach your model." }, { "start": 316, "end": 320, "text": " So the model on the left here is class number 1, right?" }, { "start": 320, "end": 321, "text": " That's class number 1." }, { "start": 321, "end": 323, "text": " The thing on the right is class number 2." }, { "start": 323, "end": 330, "text": " This here is half of class 1 and half of class 2." }, { "start": 330, "end": 335, "text": " So the model basically learns a smooth interpolation where the situation that's here on top" }, { "start": 335, "end": 337, "text": " is probably not going to happen anymore." }, { "start": 337, "end": 344, "text": " But what it would do is it would sort of create these iso lines around class 2" }, { "start": 344, "end": 351, "text": " and around class 1 where it's sort of smoothly getting less and less sure about the class of the data points." }, { "start": 351, "end": 354, "text": " But on the way, it is always either class 1 or class 2." }, { "start": 354, "end": 357, "text": " And they say that can help the generalization performance." }, { "start": 357, "end": 359, "text": " And it's visible. Why? Right?" }, { "start": 359, "end": 367, "text": " It's just the only thing that's not clear from the beginning is that this kind of interpolation actually makes sense." }, { "start": 367, "end": 372, "text": " Because this means we sort of linearly interpolate between two images." }, { "start": 372, "end": 375, "text": " So if we have two images, we just take half of one and half of the other." }, { "start": 375, "end": 377, "text": " And that will be not a natural image." }, { "start": 377, "end": 379, "text": " It will be kind of a blurry thing." }, { "start": 379, "end": 382, "text": " Otherwise, you know, all our problems would be solved." }, { "start": 382, "end": 385, "text": " And we could just linearly classify things." }, { "start": 385, "end": 389, "text": " But in any case, in practice, it actually seems to help." }, { "start": 389, "end": 393, "text": " Probably because interpolations of two images, linear interpolations," }, { "start": 393, "end": 401, "text": " are still much more like something like a natural image than any random noise you could come up with." }, { "start": 401, "end": 406, "text": " So they say this in code right here." }, { "start": 406, "end": 407, "text": " Code is pretty simple." }, { "start": 407, "end": 410, "text": " Simply want to mix the two things." }, { "start": 410, "end": 414, "text": " And the mixing factor, this lambda here, comes from a beta distribution." }, { "start": 414, "end": 418, "text": " And they use a beta, I believe, of 0.4 or something." }, { "start": 418, "end": 421, "text": " Just want to quickly show you. This is the red line here." }, { "start": 421, "end": 427, "text": " So the red line, as you can see, mostly, most of the time," }, { "start": 427, "end": 433, "text": " they're going to either sample the thing on the very left or the thing on the very right." }, { "start": 433, "end": 437, "text": " That means they either sample the first or the second data point." }, { "start": 437, "end": 441, "text": " But some of the time, they actually sample something in the middle." }, { "start": 441, "end": 445, "text": " And it's fairly uniform in the middle." }, { "start": 445, "end": 451, "text": " So it appears like a good distribution to sample from if you want to sample these mixing coefficients." }, { "start": 451, "end": 456, "text": " And by adjusting the actual number of alpha and beta here," }, { "start": 456, "end": 464, "text": " you can determine how many times you sample the original data points versus how many times you sample something in the middle." }, { "start": 464, "end": 466, "text": " OK." }, { "start": 466, "end": 472, "text": " On this toy data set right here, they showcase what mixup can do." }, { "start": 472, "end": 476, "text": " So in a classic model, you have the orange and the green data points." }, { "start": 476, "end": 480, "text": " And blue is basically where the classifier believes it's class one." }, { "start": 480, "end": 482, "text": " You see this very hard border here." }, { "start": 482, "end": 484, "text": " It's quite a hard border." }, { "start": 484, "end": 486, "text": " Now, you only have two classes here." }, { "start": 486, "end": 494, "text": " And so the hard border is sort of a problem in itself, because if you think of, for example, adversarial examples," }, { "start": 494, "end": 499, "text": " all they have to do is basically get over that one inch." }, { "start": 499, "end": 505, "text": " And the classifier is already super duper sure it's the orange class." }, { "start": 505, "end": 509, "text": " Whereas if you use mixup, your border is much, much, much more fuzzy." }, { "start": 509, "end": 513, "text": " It's like, yeah, it's only really sure here." }, { "start": 513, "end": 516, "text": " And out here everywhere." }, { "start": 516, "end": 520, "text": " But in the middle, it's sort of like, I don't know." }, { "start": 520, "end": 524, "text": " And so that's kind of a more desirable situation." }, { "start": 524, "end": 530, "text": " Now, of course, this here works particularly in this in this linear 2D setting." }, { "start": 530, "end": 540, "text": " But as we can see, the same reasoning applies to sort of higher, higher layers and higher dimensionality data points." }, { "start": 540, "end": 543, "text": " I have seemed to lost the ability to zoom." }, { "start": 543, "end": 545, "text": " Oh, no, it's back." }, { "start": 545, "end": 546, "text": " OK." }, { "start": 546, "end": 549, "text": " And that's basically it for this paper." }, { "start": 549, "end": 550, "text": " This is all they do." }, { "start": 550, "end": 554, "text": " They propose this method and then they test it." }, { "start": 554, "end": 561, "text": " They say something interesting here that mixup converges to the classical method as alpha approaches zero." }, { "start": 561, "end": 565, "text": " So that would push your beta distribution basically in the middle all the way down." }, { "start": 565, "end": 570, "text": " And you would only sample from the very left or the very right." }, { "start": 570, "end": 577, "text": " So you can smoothly interpolate between this mixing and the classic method." }, { "start": 577, "end": 584, "text": " They so their main results are we apply this to classifiers." }, { "start": 584, "end": 588, "text": " And what I like is, since again, is also a classifier." }, { "start": 588, "end": 589, "text": " So the discriminator is a classifier." }, { "start": 589, "end": 595, "text": " They also apply it to GANs and they outperform on stabilized the classic training on GANs." }, { "start": 595, "end": 604, "text": " They show that it's more robust towards adversarial attacks because it's not so sure about intermediate things." }, { "start": 604, "end": 608, "text": " And they generally outperform other methods." }, { "start": 608, "end": 617, "text": " But also they do this nice investigation here where they measure the prediction error of in between data." }, { "start": 617, "end": 624, "text": " And what it means is they say a prediction is counted as a miss if it does not belong to YI or YJ." }, { "start": 624, "end": 629, "text": " So you have a sample right here, XI and a sample right here XJ." }, { "start": 629, "end": 635, "text": " And you look at what the classifier says in between the two data points." }, { "start": 635, "end": 639, "text": " So you just interpolate the two data points and just measure what the classifier says." }, { "start": 639, "end": 646, "text": " And whenever the classifier either says YI or YJ, either either label of those two data points," }, { "start": 646, "end": 652, "text": " you count it as correct and you only counted as incorrect if it says something else." }, { "start": 652, "end": 659, "text": " And you can see here if you train with the classic method ERM, these errors happen much more often." }, { "start": 659, "end": 665, "text": " That's exactly the situation I pointed out at the beginning where in the high dimensions," }, { "start": 665, "end": 671, "text": " it can occur that all sorts of decision boundaries sneak here in between the two data points." }, { "start": 671, "end": 681, "text": " And by interpolating between them during training, you sort of much reduce that." }, { "start": 681, "end": 686, "text": " You reduce that effect a lot." }, { "start": 686, "end": 695, "text": " Now, this they also say that the gradient norm of the gradients of the model with respect to input in between training data," }, { "start": 695, "end": 702, "text": " it happens the same thing. The norm of the gradients in the middle is also much, much lower." }, { "start": 702, "end": 711, "text": " And this investigation I find pretty cool. I have to say I've seen mix up in practice, so it might be useful." }, { "start": 711, "end": 716, "text": " I've read a paper where they basically say, oh, it was a big transfer paper." }, { "start": 716, "end": 722, "text": " Yeah, where they basically say it is useful if you have, for example, if you have little data and a big model," }, { "start": 722, "end": 728, "text": " so you can sort of regularize the model and is also useful to know that they did test this with dropout." }, { "start": 728, "end": 734, "text": " So they compared it with dropout. And the conclusion is basically that this is something else than dropout." }, { "start": 734, "end": 743, "text": " So it's not doing the same thing. Dropout, of course, it means you drop out some of the data points in intermediate activations." }, { "start": 743, "end": 747, "text": " And that sort of gives you a noisy version of the data point." }, { "start": 747, "end": 754, "text": " This here can actually be combined with dropout, which means that it gives you an additional benefit." }, { "start": 754, "end": 760, "text": " You see right here, most of the best numbers happen when you use mix up plus dropout." }, { "start": 760, "end": 766, "text": " So it seems to be just an additional regularization on top of dropout." }, { "start": 766, "end": 774, "text": " Pretty cool, pretty cool investigation also. All right. So if you like this, I invite you to read the paper." }, { "start": 774, "end": 781, "text": " If you like the video, please subscribe and like and comment. And yeah, have a nice day. Bye bye." } ]
l5he9JNJqHA
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
A critical analysis of self-supervision, or what we can learn from a single image (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "investigation", "linear probes", "usefulness", "representations", "intermediate", "hidden layers", "self-supervised", "rotnet", "crop", "augmentation", "color jitter", "dataset" ]
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
Alright, 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, byGAN, RotNet and DeepCluster, 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 statistics of natural images, that second such low-level statistics can be learned through self-supervision just as well as through strong supervision and that three the low-level statistics can be captured via synthetic transformations instead of using large image data set. 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 in 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 this 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 3 in handwritten digit recognition, but you flip it to its side. So it's the number 3 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. 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 know 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. Almost causing to question this you have a giant data set of unlabeled things notion that is often presented including by me. Okay so what 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. There's people, there's objects, there is lighting and so on. There's you know 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 to research how does a natural image compared to a artificial image. And then in C they have this as sort of a control because there is 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 or letter C has large areas where there's nothing going on. Okay 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. So for ImageNet and for C410 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 okay so how do they investigate this? They have this five layer neural network right here so this five convolutional I'm gonna 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 ten or a hundred or a thousand classes whatever you want. The way they 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 no how 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 successively 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 these 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 it's and it's just meh 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 so that's how much how much percent of supervised performance do you get oh single single image self-supervision we show that several self-supervision methods can be used to train the 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 how well does it perform after and this is after the network has been self supervised with rot net 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 rot net 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 rot net 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 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 probe at 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 gonna 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 an all-powerful function approximator which is a neural network and then of course you're probably not going to get supervised performance and 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 a lots and lots of data augmentation since 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 1 36 after layer 2 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 like 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 it 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 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 young 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 right 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 soup 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 and 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 a 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 ah 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 image net 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 image net but maybe this is their thing but if they do this on top of the on top of the these self supervised methods they do get a fairly good okay they get a 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 would put this into a training procedure how you exactly make use of this during training if you already know that it's not gonna 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 supervise 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, "end": 6.4, "text": " Alright, today we'll look at a critical analysis of self-supervision or what we" }, { "start": 6.4, "end": 12.48, "text": " can learn from a single image by Yuki M. Asano, Christian Ruprecht and Andrea" }, { "start": 12.48, "end": 23.16, "text": " Vidaldi. This paper, I really was excited when I saw this paper because the" }, { "start": 23.16, "end": 29.92, "text": " outset is so cool and the experiments have a very promising. So we'll take a" }, { "start": 29.92, "end": 36.2, "text": " look. Basically we show that three different and representative methods," }, { "start": 36.2, "end": 43.2, "text": " byGAN, RotNet and DeepCluster, so this is self-supervision techniques, can learn" }, { "start": 43.2, "end": 48.52, "text": " the first few layers of a convolutional network from a single image as well as" }, { "start": 48.52, "end": 53.760000000000005, "text": " using millions of images and manual labels, provided that strong data" }, { "start": 53.76, "end": 60.68, "text": " augmentation is used. However, for deeper layers the gap with manual supervision" }, { "start": 60.68, "end": 65.72, "text": " cannot be closed even if millions of unlabeled images are used for training." }, { "start": 65.72, "end": 70.28, "text": " We conclude that first the weights of the early layers of deep networks" }, { "start": 70.28, "end": 74.12, "text": " contain limited information about statistics of natural images, that" }, { "start": 74.12, "end": 78.84, "text": " second such low-level statistics can be learned through self-supervision just" }, { "start": 78.84, "end": 84.2, "text": " as well as through strong supervision and that three the low-level statistics" }, { "start": 84.2, "end": 87.86, "text": " can be captured via synthetic transformations instead of using large" }, { "start": 87.86, "end": 97.32000000000001, "text": " image data set. As I said, I was kind of excited when I saw this and what" }, { "start": 97.32000000000001, "end": 101.32000000000001, "text": " they're talking about is self-supervision. So really quickly for" }, { "start": 101.32000000000001, "end": 106.60000000000001, "text": " those who don't know, self-supervision is a technique where if you have images but" }, { "start": 106.6, "end": 110.83999999999999, "text": " no labels and you would still like to learn something from them, you can do" }, { "start": 110.83999999999999, "end": 115.91999999999999, "text": " a pre-training step for your network. So basically you have your neural" }, { "start": 115.91999999999999, "end": 121.96, "text": " network F and what you would like to do is you would like F of X to be close to" }, { "start": 121.96, "end": 128.48, "text": " Y for X and Y to in your training data set. But you can if you have a much" }, { "start": 128.48, "end": 134.44, "text": " larger data set of just X's, right here you have pairs of X and Y of just X," }, { "start": 134.44, "end": 140.52, "text": " that are sort of similar to the X in your label data set. You can" }, { "start": 140.52, "end": 146.72, "text": " kind of get your network used to the data by doing this self-supervision." }, { "start": 146.72, "end": 151.16, "text": " So what you would do is you would sort of come up with your own labels for the" }, { "start": 151.16, "end": 158.16, "text": " data points and one way is this, we'll take just this rot net as an example. So" }, { "start": 158.16, "end": 164.64, "text": " what you'll do is you'll input an image, so maybe an image of the number 3 in" }, { "start": 164.64, "end": 170, "text": " handwritten digit recognition, but you flip it to its side." }, { "start": 170, "end": 174.2, "text": " So it's the number 3 right here and then you ask the network to come up with" }, { "start": 174.2, "end": 179.12, "text": " an answer. Is it upright? Is it flipped to the right? Is it flipped to the left? Or" }, { "start": 179.12, "end": 184.32, "text": " is it turned on its head? Which one is it? And of course you who did the" }, { "start": 184.32, "end": 188.44, "text": " transformation know the correct label. So this is how you come up with sort" }, { "start": 188.44, "end": 193.12, "text": " of fake labels for your data and this works surprisingly well and what this" }, { "start": 193.12, "end": 199.79999999999998, "text": " paper basically says is that you do not actually need this giant database here." }, { "start": 199.79999999999998, "end": 205.18, "text": " It's actually sufficient sometimes if you have one single image where you do" }, { "start": 205.18, "end": 213.68, "text": " this on. Now the claim is a bit of a cheat I have to say, but we'll go into" }, { "start": 213.68, "end": 219.24, "text": " that. And further they say okay it's enough to have one single image is to" }, { "start": 219.24, "end": 223.56, "text": " learn the features of the lower layers of the neural network because they" }, { "start": 223.56, "end": 228.36, "text": " usually tend to extract low level features that you know you can learn" }, { "start": 228.36, "end": 232.64000000000001, "text": " from a single image but the higher level features you really need the supervised" }, { "start": 232.64000000000001, "end": 238.04000000000002, "text": " data set. It's not enough to have these self-supervision techniques and" }, { "start": 238.04, "end": 244.4, "text": " even if you have many many many self-supervision samples, so if you" }, { "start": 244.4, "end": 247.64, "text": " actually do have this giant data set it still doesn't help you for the higher" }, { "start": 247.64, "end": 253.35999999999999, "text": " layers. Almost causing to question this you have a giant data set of unlabeled" }, { "start": 253.35999999999999, "end": 263.71999999999997, "text": " things notion that is often presented including by me. Okay so what do they do?" }, { "start": 263.72, "end": 270.44000000000005, "text": " They take either single images or just very few images so they also" }, { "start": 270.44000000000005, "end": 275.08000000000004, "text": " have a setting where they take 10 images. For the single image they hand select" }, { "start": 275.08000000000004, "end": 280.36, "text": " it. So they hand select the following three images. So this image right here" }, { "start": 280.36, "end": 285.76000000000005, "text": " they select because it's very crowded there's a lot going on. There's" }, { "start": 285.76000000000005, "end": 293.08000000000004, "text": " people, there's objects, there is lighting and so on. There's you know houses, these" }, { "start": 293.08, "end": 300.08, "text": " lines, there's perspective. So that's why they select image A. Image B" }, { "start": 300.08, "end": 304.52, "text": " here they also experiment with image B is a drawn image as you can see there's" }, { "start": 304.52, "end": 310.47999999999996, "text": " also lots of stuff going on but they basically want to to research how does a" }, { "start": 310.47999999999996, "end": 317.53999999999996, "text": " natural image compared to a artificial image. And then in C they have this as" }, { "start": 317.53999999999996, "end": 321.88, "text": " sort of a control because there is lots of parts here where there's not much" }, { "start": 321.88, "end": 326.2, "text": " going on compared to here and most of the image there's lots of stuff going on" }, { "start": 326.2, "end": 332.76, "text": " and this image on the image number C or letter C has large areas where there's" }, { "start": 332.76, "end": 338.88, "text": " nothing going on. Okay so these are the single images. Now why I say it's a bit" }, { "start": 338.88, "end": 344.68, "text": " of a cheat is that these images are actually super large. So for" }, { "start": 344.68, "end": 352.44, "text": " ImageNet and for C410 this might be one of the samples of the C410" }, { "start": 352.44, "end": 357.12, "text": " or ImageNet classifier. Now of course C410 is a lot smaller than ImageNet" }, { "start": 357.12, "end": 362.4, "text": " but still for ImageNet these are you know there are many pictures here not" }, { "start": 362.4, "end": 368.32, "text": " just one. So to say this is from a single image it's technically true but" }, { "start": 368.32, "end": 374.71999999999997, "text": " then if you split it into multiple images it's technically not true. So it" }, { "start": 374.71999999999997, "end": 378.76, "text": " would have been fun to see what actually happens with a single image when you" }, { "start": 378.76, "end": 384.68, "text": " downscale it. But okay so how do they investigate this? They have this five layer" }, { "start": 384.68, "end": 388.76, "text": " neural network right here so this five convolutional I'm gonna guess there's" }, { "start": 388.76, "end": 393.12, "text": " five convolutional layer after each convolutional layer I think there is" }, { "start": 393.12, "end": 399.8, "text": " some batch norm and relu and then to the next convolutional layer and so on and" }, { "start": 399.8, "end": 405.28000000000003, "text": " then at the end maybe there is or there's also some pooling here max pool" }, { "start": 405.28000000000003, "end": 411.64, "text": " at the end there is going to be some linear classifier that classifies it into" }, { "start": 411.64, "end": 416.12, "text": " either a ten or a hundred or a thousand classes whatever you want. The way they" }, { "start": 416.12, "end": 423.28000000000003, "text": " investigate this is through linear probes so-called. Now linear probes are" }, { "start": 423.28000000000003, "end": 430.12, "text": " somewhat of a technique to inspect how much each of the layers learn. So if we" }, { "start": 430.12, "end": 435.92, "text": " again draw our network right here and this is the input X right so you have" }, { "start": 435.92, "end": 440.2, "text": " the hidden representation one hidden representation two hidden representation" }, { "start": 440.2, "end": 447.03999999999996, "text": " three and here you output it to the y hat and that you compare with the y from" }, { "start": 447.03999999999996, "end": 451.88, "text": " your data set right the X is from your data set and the Y is from your data set." }, { "start": 451.88, "end": 458.28, "text": " Now linear probe wants to investigate how useful a given hidden representation" }, { "start": 458.28, "end": 462.84, "text": " is to classify the output. So what a linear probe would do is it would take" }, { "start": 462.84, "end": 469.52, "text": " the hidden representation here and learn one single linear classifier to classify" }, { "start": 469.52, "end": 477.24, "text": " that hidden representation to come up with a y hat given h1 or something like" }, { "start": 477.24, "end": 484, "text": " this. So the important part here is that this is linear right this is a this is a" }, { "start": 484, "end": 491.44, "text": " linear classifier. You do nothing more you take the representation and instead" }, { "start": 491.44, "end": 495.44, "text": " of this entire giant neural network on top of it you simply build a linear" }, { "start": 495.44, "end": 500.44, "text": " classifier and you can build these linear probes from any layer right here." }, { "start": 500.44, "end": 505.12, "text": " You can build a linear classifier on top of this on top of this and then you" }, { "start": 505.12, "end": 511.52, "text": " basically look how good is your linear classifier when trained on that" }, { "start": 511.52, "end": 516.12, "text": " hidden representation that the network comes up with and that's how you" }, { "start": 516.12, "end": 524.16, "text": " estimate how much information about the target or let's say no how how optimal" }, { "start": 524.16, "end": 529.28, "text": " the representation already is because at the end of the network right you do have" }, { "start": 529.28, "end": 533.9599999999999, "text": " a linear classifier. So at some point this representation must go into a form" }, { "start": 533.9599999999999, "end": 539.68, "text": " where it is now linearly well classifiable and the assumption is" }, { "start": 539.68, "end": 545.36, "text": " basically that these layers of the neural network successively make a" }, { "start": 545.36, "end": 552.56, "text": " representation that is more and more linearly classifiable and that is a" }, { "start": 552.56, "end": 560.04, "text": " strong assumption right and this paper here uses linear probes" }, { "start": 560.04, "end": 565.28, "text": " exclusively and that is a bit worrisome to me because I have my troubles with" }, { "start": 565.28, "end": 571.04, "text": " these linear probe approach because this strong assumption that more linearly" }, { "start": 571.04, "end": 577.52, "text": " classifiable is better it just rubs me in the wrong way right. We know that the" }, { "start": 577.52, "end": 583.68, "text": " information content can never increase from layer to layer about the" }, { "start": 583.68, "end": 590.68, "text": " label so any information about the label that is in H1 sorry that is in H2 must" }, { "start": 590.68, "end": 595, "text": " also have been present in H1 so technically if we just built the correct" }, { "start": 595, "end": 601.4, "text": " classifier we could predict from H1 just as well as from H2 right because we're" }, { "start": 601.4, "end": 605.84, "text": " actually doing it we're building the neural network but the fact that we" }, { "start": 605.84, "end": 612.8000000000001, "text": " cannot predict linearly as well using H1 so the fact that this classifier here" }, { "start": 612.8000000000001, "end": 620.2800000000001, "text": " performs worse than this classifier here because H1 is a less optimal" }, { "start": 620.2800000000001, "end": 626.2, "text": " representation in a linear sense it's and it's just meh and the fact that I" }, { "start": 626.2, "end": 632.2, "text": " mean yes but then to use that and to estimate oh how useful is a" }, { "start": 632.2, "end": 638, "text": " representation you're equating usefulness with linearly classifiable and" }, { "start": 638, "end": 645.08, "text": " that I disagree a representation can be extremely useful if the following layers" }, { "start": 645.08, "end": 649.72, "text": " manage to do something useful with it and that can be something completely" }, { "start": 649.72, "end": 657.0400000000001, "text": " different or it can even be the opposite of the linear classifiability right so" }, { "start": 657.04, "end": 664.24, "text": " this is kind of my problem here and they don't do a good work of convincing me" }, { "start": 664.24, "end": 669.64, "text": " otherwise so they don't employ different techniques other than these linear probes" }, { "start": 669.64, "end": 681.16, "text": " in any case when they do this linear probe you can see right here that the" }, { "start": 681.16, "end": 688.9599999999999, "text": " percent supervised performance so that's how much how much percent of supervised" }, { "start": 688.9599999999999, "end": 691.9599999999999, "text": " performance do you get" }, { "start": 693.16, "end": 697.8, "text": " oh single single image self-supervision we show that several self-supervision" }, { "start": 697.8, "end": 701.9599999999999, "text": " methods can be used to train the first few layers of a deep neural networks" }, { "start": 701.9599999999999, "end": 707.36, "text": " using a single training image such as this image a B or even C provided that" }, { "start": 707.36, "end": 712.64, "text": " sufficient data augmentation is used so what they do here is they use this" }, { "start": 712.64, "end": 717.8000000000001, "text": " self-supervision then they take the signal from the convolutional layer one" }, { "start": 717.8000000000001, "end": 723, "text": " the hidden representation that's h1 right here they train this linear probe" }, { "start": 723, "end": 730.36, "text": " on it and they see how how well does it perform after and this is after the" }, { "start": 730.36, "end": 735.6800000000001, "text": " network has been self supervised with rot net for example and then they" }, { "start": 735.68, "end": 743.3599999999999, "text": " compare that to the linear probe at layer one of the supervised network" }, { "start": 743.3599999999999, "end": 749.16, "text": " right so you take the supervised network and you do the same thing and there they" }, { "start": 749.16, "end": 758.64, "text": " find okay this rot net and all the other techniques they perform very well and" }, { "start": 758.64, "end": 766.3199999999999, "text": " especially if you only do a single image they perform better as you can see right" }, { "start": 766.3199999999999, "end": 770.8, "text": " here I mean if I interpret this correctly this one rot net one by again one deep" }, { "start": 770.8, "end": 776.92, "text": " cluster these are these top things right here and the 100 is the comparison to" }, { "start": 776.92, "end": 782.4399999999999, "text": " the supervised performance right so 100 means 100% of the performance of the" }, { "start": 782.44, "end": 791.08, "text": " supervised representation this is absolutely crazy to me and this in fact" }, { "start": 791.08, "end": 797.0400000000001, "text": " so let's just interpret it from their perspective right so you also have" }, { "start": 797.0400000000001, "end": 802.72, "text": " random so if you I guess if you randomly initialize a network then with the" }, { "start": 802.72, "end": 807.0400000000001, "text": " linear with training a linear classifier on the hidden representation one you" }, { "start": 807.04, "end": 817.56, "text": " could reach something like 60% accuracy which is impressive okay but if you do" }, { "start": 817.56, "end": 824, "text": " the linear probe at layer two you reach a lower accuracy now remember this is" }, { "start": 824, "end": 832.04, "text": " lower accuracy compared to the supervised performance right so the the" }, { "start": 832.04, "end": 837.12, "text": " there are two effects at play here the supervised performance is gonna go up" }, { "start": 837.12, "end": 842.28, "text": " because the well if you believe the assumption that the successive layers" }, { "start": 842.28, "end": 848.64, "text": " make the representation more and more linear linearly classifiable but also it" }, { "start": 848.64, "end": 853.64, "text": " could be that just at the same time the self supervised performance the" }, { "start": 853.64, "end": 859.48, "text": " performance of the self supervised representation is going down so the" }, { "start": 859.48, "end": 865.4, "text": " graph here is sort of I don't really know how to interpret it and it really" }, { "start": 865.4, "end": 871.38, "text": " goes down after that that's why they say you can learn the first layers fairly" }, { "start": 871.38, "end": 878.4200000000001, "text": " well with self supervision even from a single image but you cannot learn the" }, { "start": 878.4200000000001, "end": 884.4, "text": " upper layers and they're basically just measuring this using this linear probe" }, { "start": 884.4, "end": 889.3199999999999, "text": " method compared to the supervised performance what I would somewhat like" }, { "start": 889.3199999999999, "end": 895.4399999999999, "text": " to see is that you train let's say you train a self supervised network fine but" }, { "start": 895.4399999999999, "end": 902.28, "text": " then you freeze this layer and then you fine-tune the rest of your network on" }, { "start": 902.28, "end": 906.22, "text": " top of that representation that would actually give you an estimate of how" }, { "start": 906.22, "end": 912.3199999999999, "text": " useful is that representation if I had an you know an all-powerful function" }, { "start": 912.32, "end": 916.5200000000001, "text": " approximator which is a neural network and then of course you're probably not" }, { "start": 916.5200000000001, "end": 921.48, "text": " going to get supervised performance and by the way you'd have to compare that" }, { "start": 921.48, "end": 927.9200000000001, "text": " also to supervised with and without pre training using self supervision and" }, { "start": 927.9200000000001, "end": 933.6, "text": " then you actually get a good estimate of what how well what kind of a" }, { "start": 933.6, "end": 938.8000000000001, "text": " representation do these things learn in this case all we you know all we get out" }, { "start": 938.8, "end": 943.3199999999999, "text": " of this is this linear probe thing compared to the supervised" }, { "start": 943.3199999999999, "end": 949.3599999999999, "text": " representation and it just seems a bit uninterpretable honestly and the fact" }, { "start": 949.3599999999999, "end": 955.04, "text": " that here you can go beyond 100% you can actually be better than supervised" }, { "start": 955.04, "end": 960.92, "text": " should already tell you that the linear this linear probe thing might not be a" }, { "start": 960.92, "end": 968.24, "text": " good instrument to might not be such a good instrument especially in the lower" }, { "start": 968.24, "end": 972.8, "text": " layers the lower layers will be most inaccurate with these linear probe" }, { "start": 972.8, "end": 977.36, "text": " measurement but that's that's their finding basically they can learn the" }, { "start": 977.36, "end": 984.16, "text": " features of the lower layers as well in terms of this linear probe formulation" }, { "start": 984.16, "end": 990.16, "text": " as the supervised learning again they never compare this to fine-tuning on top" }, { "start": 990.16, "end": 996.6800000000001, "text": " of these representation or compare it to self supervision plus supervision which" }, { "start": 996.68, "end": 1004.56, "text": " I would really expect all right so they say they do a lots and lots of data" }, { "start": 1004.56, "end": 1007.7199999999999, "text": " augmentation since of course they only have a single image they basically" }, { "start": 1007.7199999999999, "end": 1015.16, "text": " supercharge data augmentation and they show that this helps now I don't want to" }, { "start": 1015.16, "end": 1021.92, "text": " actually go into the into the very into the very details of what they're doing" }, { "start": 1021.92, "end": 1027.1599999999999, "text": " because they just have different methods of augmentation they just have different" }, { "start": 1027.1599999999999, "end": 1038.24, "text": " networks but here are the results so if this is on on image net if we use full" }, { "start": 1038.24, "end": 1043.92, "text": " supervision we use the entire data set and we do these linear probe evaluation" }, { "start": 1043.92, "end": 1051.84, "text": " we get a 20% accuracy after layer 1 36 after layer 2 and so on this goes" }, { "start": 1051.84, "end": 1055.84, "text": " up as we go through the layer so this kind of gives credence to the hypothesis" }, { "start": 1055.84, "end": 1062.84, "text": " that these layers sort of make the representation more linear then they" }, { "start": 1062.84, "end": 1071.8799999999999, "text": " have a bunch of scattering and random networks and K means pre training which" }, { "start": 1071.8799999999999, "end": 1078.9199999999998, "text": " doesn't get you a lot like but that's what they compare it to basically the" }, { "start": 1078.92, "end": 1084.8000000000002, "text": " self supervision to just the scattering transforms and things like that but then" }, { "start": 1084.8000000000002, "end": 1090.3600000000001, "text": " they get into their methods and here we'll look at for example this rod net" }, { "start": 1090.3600000000001, "end": 1099.88, "text": " so if you train on just one image this image a of course if you have one image" }, { "start": 1099.88, "end": 1109.64, "text": " then you get this many this this much of the layer one now okay so now that I see" }, { "start": 1109.64, "end": 1118.8000000000002, "text": " this here they have this column right here which uses the full data set what I" }, { "start": 1118.8000000000002, "end": 1129.0800000000002, "text": " think this is is the self supervised training using this many images so what" }, { "start": 1129.08, "end": 1135.6799999999998, "text": " if you do rod net self supervision on this many it could also be the" }, { "start": 1135.6799999999998, "end": 1142.04, "text": " performance after supervised training after pre training with this method but" }, { "start": 1142.04, "end": 1147.6399999999999, "text": " I think it is the performance after just after self supervision again with no" }, { "start": 1147.6399999999999, "end": 1153.6399999999999, "text": " fine-tuning on top and then evaluating these linear probes that's why this" }, { "start": 1153.64, "end": 1159.68, "text": " number is lower than this number right here but astonishingly after you do it" }, { "start": 1159.68, "end": 1167.3200000000002, "text": " with just one image you get a higher number and if you do it with a thousand" }, { "start": 1167.3200000000002, "end": 1174.0800000000002, "text": " images you get an even higher number but if you do it with many more images you" }, { "start": 1174.0800000000002, "end": 1181.8000000000002, "text": " do you you somehow don't get a higher number this all seems a bit it seems a" }, { "start": 1181.8, "end": 1189.2, "text": " bit weird honestly basically means that okay it is more important to augment the" }, { "start": 1189.2, "end": 1193.68, "text": " same thing over and over and over in different ways than it is to incorporate" }, { "start": 1193.68, "end": 1199.56, "text": " different images I mean there's ways I can believe that but I'm not sure but" }, { "start": 1199.56, "end": 1207.8, "text": " you basically see that after a while the performance compared to the first of all" }, { "start": 1207.8, "end": 1215.12, "text": " to the supervised method so yes if you look for example here up here drops" }, { "start": 1215.12, "end": 1221.72, "text": " dramatically and even if you have the full young now I'm convinced that this" }, { "start": 1221.72, "end": 1226.04, "text": " this is just self supervision using the full data set even if you have the full" }, { "start": 1226.04, "end": 1231.12, "text": " data set but only do self supervision your performance still suffers compared" }, { "start": 1231.12, "end": 1238.32, "text": " to the supervised training so that's why they claim they have these two claims" }, { "start": 1238.32, "end": 1243.6599999999999, "text": " you can learn the first layer representations fairly well with self" }, { "start": 1243.6599999999999, "end": 1250.4799999999998, "text": " supervision that's comparing this number to this number you can do so even from a" }, { "start": 1250.4799999999998, "end": 1256.8799999999999, "text": " single image that's comparing this number to this number right and noticing" }, { "start": 1256.88, "end": 1262.0800000000002, "text": " that it's almost the same these two numbers are almost the same actually one" }, { "start": 1262.0800000000002, "end": 1270.5600000000002, "text": " is a bit higher you can learn that fairly well but if you go down the layers" }, { "start": 1270.5600000000002, "end": 1277.8400000000001, "text": " you will basically suffer with your single image and with your full image" }, { "start": 1277.8400000000001, "end": 1282.6000000000001, "text": " soup self supervision so you need the supervised signal to learn the features" }, { "start": 1282.6, "end": 1289.36, "text": " of these later layers and that's all evaluated with these linear probe things" }, { "start": 1289.36, "end": 1296.04, "text": " yeah so that is their main claims right here and they kind of analyze image a" }, { "start": 1296.04, "end": 1300.8, "text": " and image B so they come to the conclusion that image a works much" }, { "start": 1300.8, "end": 1307.08, "text": " better because it's natural and image B is not working so well but this depends" }, { "start": 1307.08, "end": 1317.6, "text": " on the self supervision used and image C still apparently works quite well even" }, { "start": 1317.6, "end": 1322.32, "text": " though it has these large areas of nothing which all of this is a bit weird" }, { "start": 1322.32, "end": 1327.72, "text": " but it's definitely cool to see these results now again I would like to see" }, { "start": 1327.72, "end": 1330.8799999999999, "text": " something like you freeze these representations and then you actually" }, { "start": 1330.8799999999999, "end": 1335.36, "text": " train a neural network on top of that and look how that performs that would" }, { "start": 1335.36, "end": 1340.6399999999999, "text": " actually be an interesting thing though maybe they've done this and I'm just" }, { "start": 1340.6399999999999, "end": 1350.28, "text": " unaware right here they look at the filters that these methods have learned" }, { "start": 1350.28, "end": 1354.12, "text": " just from self supervision on a single image and you can see these are the types" }, { "start": 1354.12, "end": 1359.4799999999998, "text": " of filters that we would see using even supervised learning if you look at the" }, { "start": 1359.4799999999998, "end": 1365, "text": " filters they turn out to look pretty much like this of course I can't decide" }, { "start": 1365, "end": 1371.6, "text": " if these particular things are good or bad filters or not they do some" }, { "start": 1371.6, "end": 1382.16, "text": " qualitative analysis and here they have fine-tuning okay ah fine-tuning" }, { "start": 1382.16, "end": 1388.04, "text": " experiments the pre-trained models first two convolutions are left frozen or" }, { "start": 1388.04, "end": 1393.72, "text": " replaced by the scattering transform and the network is retrained using image" }, { "start": 1393.72, "end": 1401.88, "text": " net training set okay here we go so if you do this fully supervised you get to" }, { "start": 1401.88, "end": 1413.6000000000001, "text": " a 59.4 now okay this seems very low accuracy honestly for even like for" }, { "start": 1413.6000000000001, "end": 1420.84, "text": " image net but maybe this is their thing but if they do this on top of the on top" }, { "start": 1420.84, "end": 1426.56, "text": " of the these self supervised methods they do get a fairly good okay they get" }, { "start": 1426.56, "end": 1431.6399999999999, "text": " a fairly good accuracy right here I would have liked to have this evaluation" }, { "start": 1431.6399999999999, "end": 1436.4399999999998, "text": " right here be applied in the table above and not these linear probes they just" }, { "start": 1436.4399999999998, "end": 1446.24, "text": " seem kind of kind of wonky but you can see that it is possible to learn this to" }, { "start": 1446.24, "end": 1451.48, "text": " learn this using just a single image to learn the features of the lower layers" }, { "start": 1451.48, "end": 1459.16, "text": " now how you exactly would would put this into a training procedure how you" }, { "start": 1459.16, "end": 1463.68, "text": " exactly make use of this during training if you already know that it's not gonna" }, { "start": 1463.68, "end": 1469.72, "text": " help for the deeper layers I'm not so sure because at least you always have" }, { "start": 1469.72, "end": 1475.68, "text": " your own data set right so you always have at least that many images that you" }, { "start": 1475.68, "end": 1481.72, "text": " can self supervise train on but it's certainly interesting interesting" }, { "start": 1481.72, "end": 1492.2, "text": " results and with that I think I'm going to leave it at that and thanks for" }, { "start": 1492.2, "end": 1507.88, "text": " listening I hope you enjoyed this and bye bye" } ]
YrO1v7-KcXs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Deep image reconstruction from human brain activity (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "fmri", "mind reading", "thoughts", "visual cortex", "vc", "v1", "v4", "vgg", "reconstruction", "iterative", "deep dream", "microscope", "activity", "imagine", "visualize", "introspection", "human", "telepathy" ]
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 image reconstruction from human brain activity by Gwa-wa Shen, Tomoyasu Horikawa, Kai Majima and Yuki Yazu Kamitani. This is like the 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. Then they will reconstruct the image that is closest to those features in the neural network. By reconstruction they get basically 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 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. Let's break it down to the individual parts. The individual parts here, the fMRI, that is a machine. We cannot control. So you measure the fMRI activity and that basically measures which of these 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 brains are active. 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 nonlinearities 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. 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. Then you want to put the same image through the human and then you observe the MRI features. 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 a regression 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, 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. 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 give the human, let's say this works, you can give the human an arbitrary image and the human will basically interpret it through its visual cortex. You measure the activity in the visual 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. 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. 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. Then you can look at it. It usually looks something like this. We're used to these kind of things from neural networks. If I invite you to look at something like the OpenAI Atlas, if you want to understand how this is done. But basically we can get the image that most faithfully corresponds to these features. This doesn't always work super well because there are actually, since the neural network is sort of a dimensional 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 fMRI 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 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 to 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 like a shell, like a muscle. So I'm 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%. 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 can determine it correctly counts as a hit. So the baseline probability here is 50%. So basically, right, is 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, 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 this kind of prior over natural images. But the prior, I think the prior here comes through a bit much because I 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 network, so you're basically trying to match to predict many layers of signal different layers, then the reconstruction gets really good. And, 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 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 no, that is interesting. And I think the novel thing here is one of the novel thing is that they actually use multiple layers of the neural network to reconstruct. The interesting thing is, I think this is 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 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 even 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. 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 the plus kind of it sort of comes through. And so these are the high accuracy, these are actually the samples where where it worked. And there are also samples where it didn't work, like here, where you see it doesn't really come through. So there, 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. But 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. Suffice to say that sometimes it actually can read your thoughts. Because if you just think so this is the 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. But 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, "end": 6.72, "text": " Hi there! Today we're looking at deep image reconstruction from human brain activity by" }, { "start": 6.72, "end": 19.68, "text": " Gwa-wa Shen, Tomoyasu Horikawa, Kai Majima and Yuki Yazu Kamitani. This is like the reading thoughts." }, { "start": 19.68, "end": 27.82, "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" }, { "start": 27.82, "end": 34.3, "text": " beginning of last year. So I'm sure there have been developments in this area. But basically what this" }, { "start": 34.3, "end": 42.480000000000004, "text": " paper does is it will have a human look at a picture as you can see for example right up here." }, { "start": 42.480000000000004, "end": 50.56, "text": " It will measure the MRI activity. Then it will use a what they call a feature decoder in order to" }, { "start": 50.56, "end": 60.480000000000004, "text": " map that MRI activity to features of a deep neural network. Then they will reconstruct the image that" }, { "start": 60.480000000000004, "end": 68.4, "text": " is closest to those features in the neural network. By reconstruction they get basically" }, { "start": 68.4, "end": 76.88, "text": " an image of what the human sees. So we're going to explore this pipeline right here. But it's pretty" }, { "start": 76.88, "end": 84.83999999999999, "text": " cool and if it works it basically means that we can read someone's thoughts. But of course there's" }, { "start": 84.83999999999999, "end": 90.44, "text": " going to be issues and problems. So first of all this is all visual. They measure the activity in" }, { "start": 90.44, "end": 102.16, "text": " the visual cortex right here. Let's break it down to the individual parts. The individual parts here," }, { "start": 102.16, "end": 109.75999999999999, "text": " the fMRI, that is a machine. We cannot control. So you measure the fMRI activity and that basically" }, { "start": 109.75999999999999, "end": 118, "text": " measures which of these cells in your brain use oxygen. It's functional fMRI, it's not structural." }, { "start": 118, "end": 124.36, "text": " So it measures which ones are active and that's how you would see which parts of the brains are" }, { "start": 124.36, "end": 130.92, "text": " active. I think the resolution on these things has gotten very very good. So you can make out very" }, { "start": 130.92, "end": 138.07999999999998, "text": " fine grained activation patterns in the neurons. And they measure the visual cortex which is the" }, { "start": 138.07999999999998, "end": 147.23999999999998, "text": " part responsible for basically visual stimuli. So for seeing things. Now they need this feature" }, { "start": 147.23999999999998, "end": 153.56, "text": " decoder but because ultimately what they want to do is they want to have these features correspond" }, { "start": 153.56, "end": 162.04, "text": " to features in a neural network. This DNN here is like a VGG, I think a VGG-16 or a VGG-19. It's" }, { "start": 162.04, "end": 168.48, "text": " called a VGG-16 network. This is a couple of years ago these architectures were very popular for" }, { "start": 168.48, "end": 177.76, "text": " ImageNet and they're fairly basic. So what that means it's not like a super duper inception net" }, { "start": 177.76, "end": 182.64000000000001, "text": " where you have like layers within layers and so on. They're pretty straightforward convolutional" }, { "start": 182.64, "end": 190.32, "text": " neural networks with nonlinearities and pooling here. You can see there is a bunch of layers," }, { "start": 190.32, "end": 196.64, "text": " then there's pooling, there is a bunch of layers, there's pooling and so on. So what you want to" }, { "start": 196.64, "end": 204.48, "text": " look at are these layers of the deep neural network. The individual layers and you want to" }, { "start": 204.48, "end": 213.32, "text": " basically put an image right here into the neural network and then observe its features in the" }, { "start": 213.32, "end": 218.88, "text": " neural network. Then you want to put the same image through the human and then you observe the" }, { "start": 218.88, "end": 228.12, "text": " MRI features. You know that this is the same image so you can basically learn a feature decoder. This" }, { "start": 228.12, "end": 233.12, "text": " is going to be another sort of machine learned maybe in neural network. I haven't actually read" }, { "start": 233.12, "end": 240.36, "text": " this could be just like a linear regression or a neural network. Just a regression that maps the" }, { "start": 240.36, "end": 247.08, "text": " fMRI to the features. So this is what you have to learn. Basically they took a bunch of humans," }, { "start": 247.08, "end": 255.08, "text": " stuck them in an MRI machine, got out their their fMRI data for the same image. So for a given image" }, { "start": 255.08, "end": 270.88, "text": " X they got the human fMRI data and they got the VGG. They got the features when they put the X," }, { "start": 270.88, "end": 278.44, "text": " the image through the neural network and now they learn a function that minimizes the error. So there" }, { "start": 278.44, "end": 287.56, "text": " is an error. So basically they run this on a test set of images and then you end up with a function" }, { "start": 287.56, "end": 296.15999999999997, "text": " that can basically map fMRI features to neural network features. Now the second step, now you" }, { "start": 296.15999999999997, "end": 302.24, "text": " can give the human, let's say this works, you can give the human an arbitrary image and the" }, { "start": 302.24, "end": 308.32, "text": " human will basically interpret it through its visual cortex. You measure the activity in the" }, { "start": 308.32, "end": 315.72, "text": " visual cortex and then you can predict the neural network features if that image were given to the" }, { "start": 315.72, "end": 322.84000000000003, "text": " neural network. But now you don't give the image to the neural network. Instead of what you do," }, { "start": 322.84000000000003, "end": 330.68, "text": " you do something like deep dream does. That means you start from a noisy image at the beginning and" }, { "start": 330.68, "end": 338.92, "text": " you try to find the image. So you start from this noisy image right here and through iterative" }, { "start": 338.92, "end": 346.92, "text": " gradient descent you refine this image. That's this arrow right here. You try to find the image" }, { "start": 346.92, "end": 352.96000000000004, "text": " that as closely as possible in the internal representation matches the features that you" }, { "start": 352.96000000000004, "end": 359.84000000000003, "text": " predict from the fMRI signal. Because these are the features that the neural network should see." }, { "start": 359.84, "end": 365.47999999999996, "text": " If your feature decoder is good, these are the features that the neural network should output" }, { "start": 365.47999999999996, "end": 372.23999999999995, "text": " for that image. So you're basically trying to find this image right here but you're not looking at" }, { "start": 372.23999999999995, "end": 378.67999999999995, "text": " it. You only look at the features that should be in the neural network. So after a bunch of steps" }, { "start": 378.67999999999995, "end": 385.44, "text": " of refining that image, you hope you basically end up with an image that corresponds to these" }, { "start": 385.44, "end": 393.76, "text": " features. Then you can look at it. It usually looks something like this. We're used to these" }, { "start": 393.76, "end": 399.68, "text": " kind of things from neural networks. If I invite you to look at something like the OpenAI Atlas," }, { "start": 399.68, "end": 407.15999999999997, "text": " if you want to understand how this is done. But basically we can get the image that most" }, { "start": 407.15999999999997, "end": 415.2, "text": " faithfully corresponds to these features. This doesn't always work super well because there" }, { "start": 415.2, "end": 421.4, "text": " are actually, since the neural network is sort of a dimensional reduction technique, there are many" }, { "start": 421.4, "end": 427.44, "text": " images that correspond to the same features and they often end up like really weird. So what they" }, { "start": 427.44, "end": 433.8, "text": " do is they have this deep generator network as a prior. Basically this is the generator from a GAN," }, { "start": 433.8, "end": 440.68, "text": " from a Generative Adversarial Network. So this network right here is really good at just producing" }, { "start": 440.68, "end": 449.56, "text": " naturally looking images. And now because we have that, our task is not going to be to start from" }, { "start": 449.56, "end": 456.64, "text": " this image right here. Our task will be to do the exact same thing but with the input to the deep" }, { "start": 456.64, "end": 462.04, "text": " generator network. So basically what we're trying to do is we're trying to find the input vector to" }, { "start": 462.04, "end": 470.08, "text": " the deep generator network such that these features right here correspond to the features that we" }, { "start": 470.08, "end": 477.32, "text": " predict from the fMRI activity. And because the deep generator network is trained to produce" }, { "start": 477.32, "end": 484.91999999999996, "text": " natural looking images, this will always give us sort of a natural looking image no matter what" }, { "start": 484.91999999999996, "end": 490.52, "text": " our input vector is. So thereby we basically constrain the optimization procedure to only" }, { "start": 490.52, "end": 499.12, "text": " output natural looking images. So let's see how well this works. So these are the reconstructions." }, { "start": 499.12, "end": 504.76, "text": " I have to say they're training set, they're training and testing set. So up here, this" }, { "start": 504.76, "end": 510.16, "text": " procedure where we learned right here, this would be done on a training set of images. And then they" }, { "start": 510.16, "end": 515.4, "text": " expose the humans to testing set of images. So this reconstruction right here would happen on" }, { "start": 515.4, "end": 522.24, "text": " images that the feature decoder wasn't trained on. But the humans are looking at it. So the humans" }, { "start": 522.24, "end": 528.8, "text": " would be looking at the picture here on the left. And then this would be to the right you'll see" }, { "start": 528.8, "end": 535.56, "text": " as more and more iterations of this process of reconstructing happens, the image gets basically" }, { "start": 535.56, "end": 542.3199999999999, "text": " clearer and clearer. And you can see on the right you get pretty good looking images for the ones on" }, { "start": 542.3199999999999, "end": 550, "text": " the left. Now, these researchers they tend to they tout the success like to say, oh, look, look at" }, { "start": 550, "end": 569.4, "text": " this. But you know, honestly, like this is a leopard. This is a dog sheep. This is an owl. This" }, { "start": 569.4, "end": 581.36, "text": " is a dog. So, so, you know, this is a fish. And this is a like a shell, like a muscle. So I'm and" }, { "start": 581.36, "end": 594.84, "text": " you can go through these. And basically, you know, this is a sled. And then this is a truck. So they" }, { "start": 594.84, "end": 600.96, "text": " go basically, and they say, wow, the accuracy is really good. So they do a pixel correlation" }, { "start": 600.96, "end": 605.8000000000001, "text": " accuracy, which is, you know, you just try to pixel correlate things, but they have human" }, { "start": 605.8000000000001, "end": 614.2, "text": " judgment, the accuracy via human judgment is over 95%. That's crazy. But how do they do it? So" }, { "start": 614.2, "end": 621.4000000000001, "text": " basically, they tell you, okay, see, this is the image at the beginning, no, sorry, they give you" }, { "start": 621.4, "end": 628.0799999999999, "text": " this image right here as a human radar. And then they give you two other images, they say, okay," }, { "start": 628.0799999999999, "end": 636.0799999999999, "text": " here are two images, let's say these two, which one did it come from? And if the human can can" }, { "start": 636.0799999999999, "end": 643, "text": " determine it correctly counts as a hit. So the baseline probability here is 50%. So basically," }, { "start": 643, "end": 652.72, "text": " right, is so this right here, is it rather the owl? Or is it rather the VCR? And I mean, in that" }, { "start": 652.72, "end": 659.16, "text": " respect, it's pretty impressive what you can read from a brain, but in no way, like zero way, this" }, { "start": 659.16, "end": 667.68, "text": " is reading your thoughts. This isn't like, it seems to basically just reconstruct a example from the" }, { "start": 667.68, "end": 674.0799999999999, "text": " ImageNet training set. And the ImageNet Explorer is down right now. So I, I try to look at this." }, { "start": 674.0799999999999, "end": 682.8399999999999, "text": " But it seems to me it's just kind of reconstructing something it knows that sort of bit resembles the" }, { "start": 682.8399999999999, "end": 689.4399999999999, "text": " image on the left. Yeah, but it is not it is not reconstructing that image. Not at all. Like look," }, { "start": 689.44, "end": 700.84, "text": " like a bit, but vaguely, vaguely. But they do some more investigation into this. Okay, so well," }, { "start": 700.84, "end": 705.5600000000001, "text": " first of all, here you can see what happens without this deep generator network. So when you have" }, { "start": 705.5600000000001, "end": 714.9200000000001, "text": " unconstrained search, then it is even worse, right? You get like big pixel meshes right here. So you" }, { "start": 714.92, "end": 722.4, "text": " need this this kind of prior over natural images. But the prior, I think the prior here comes through" }, { "start": 722.4, "end": 729.5999999999999, "text": " a bit much because I the prior might be in part responsible for why the images just show something" }, { "start": 729.5999999999999, "end": 738.64, "text": " else than you see. They go into an investigation of if and they discover if you use more layers to" }, { "start": 738.64, "end": 744.28, "text": " reconstruct, the reconstruction gets better. So here, according to human judgment, if you just" }, { "start": 744.28, "end": 750.36, "text": " reconstruct from the first layer, you don't get very good reconstruction. But if you incorporate" }, { "start": 750.36, "end": 756.12, "text": " the signal across many layers of the neural network, so you're basically trying to match to" }, { "start": 756.12, "end": 762.3199999999999, "text": " predict many layers of signal different layers, then the reconstruction gets really good. And," }, { "start": 762.3199999999999, "end": 768.88, "text": " you know, we know this from things like style transfer, you can modify how close you are to" }, { "start": 768.88, "end": 775.36, "text": " the original or to the target by basically seeing which layers and how many you reconstruct to which" }, { "start": 775.36, "end": 782.08, "text": " accuracy. So this makes kind of sense. So if you if you only take the first layer to match the" }, { "start": 782.08, "end": 787.32, "text": " features, then you get basically this blob here. But if you get layers one through seven, you get" }, { "start": 787.32, "end": 795.4, "text": " pretty pretty okay ish thing that looks like this thing. I guess these are without the deep generator" }, { "start": 795.4, "end": 802.3199999999999, "text": " network so far. But no, that is interesting. And I think the novel thing here is one of the novel" }, { "start": 802.3199999999999, "end": 811.76, "text": " thing is that they actually use multiple layers of the neural network to reconstruct. The interesting" }, { "start": 811.76, "end": 818.68, "text": " thing is, I think this is this is pretty cool. They can now do this with these shapes. So these" }, { "start": 818.68, "end": 825.04, "text": " shapes aren't natural images, and they have not been seen in training. But still, as you can see," }, { "start": 825.04, "end": 830.92, "text": " when the human sees, for example, the plus shape, it will get you pretty clear plus shape. And it" }, { "start": 830.92, "end": 837.0799999999999, "text": " happens for a lot of these things right here. So these are actually, I would say, fairly okay ish" }, { "start": 837.0799999999999, "end": 847.4399999999999, "text": " reconstructions of what the human sees. Here neuron, that is fairly neat. And for the alphabetical" }, { "start": 847.4399999999999, "end": 852.4, "text": " letters and shapes, you see again, the even the pixel correlation now is pretty high, but the human" }, { "start": 852.4, "end": 859.56, "text": " judgment again high. And here the human judgment kind of makes sense, right? If you ask, is it like" }, { "start": 859.56, "end": 868, "text": " this shape or this shape? Then it makes more sense to evaluate it like this. So the shapes, I am" }, { "start": 868, "end": 876.1999999999999, "text": " fairly impressed that they can reconstruct these shapes. And what they're now trying to do is they're" }, { "start": 876.2, "end": 885.2, "text": " trying to infer imagined images. So basically, they're telling a human, please imagine an image," }, { "start": 885.2, "end": 890.5600000000001, "text": " and they show it to the human. It's not really imagining, it's basically recalling, they show" }, { "start": 890.5600000000001, "end": 895.5200000000001, "text": " you this image. And then you whatever close your eyes, they take the image away, and you just try" }, { "start": 895.5200000000001, "end": 903.32, "text": " to imagine that. And you can see through the reconstruction process, that works out, you know," }, { "start": 903.32, "end": 911.0400000000001, "text": " sort of ish, right? You can see that the cross here, it kind of comes through. And this the plus" }, { "start": 911.0400000000001, "end": 919.24, "text": " kind of it sort of comes through. And so these are the high accuracy, these are actually the samples" }, { "start": 919.24, "end": 925.36, "text": " where where it worked. And there are also samples where it didn't work, like here, where you see it" }, { "start": 925.36, "end": 930.1600000000001, "text": " doesn't really come through. So there, either there is, you know, really a difference between" }, { "start": 930.16, "end": 940.3199999999999, "text": " imagining something and seeing something, or this method just isn't very good, per se, and you" }, { "start": 940.3199999999999, "end": 946.36, "text": " actually need or humans aren't really good at imagining, like there's lots of explanations. And" }, { "start": 946.36, "end": 953.8399999999999, "text": " here is the same thing if you imagine these images. Now they report that if humans just recall or" }, { "start": 953.84, "end": 961.6800000000001, "text": " imagine these images, then the reconstruction doesn't work at all. So that might be to the fact" }, { "start": 961.6800000000001, "end": 966.32, "text": " that, you know, you cannot in your recollection, you basically just remember the important things" }, { "start": 966.32, "end": 972.5600000000001, "text": " about something, you don't remember the exact pixel values, and therefore, your visual cortex" }, { "start": 972.5600000000001, "end": 978.48, "text": " doesn't respond in the same way. But I mean, it's interesting, even per se to think about it. But I" }, { "start": 978.48, "end": 984.24, "text": " have my doubts about you know, this entire system. So I don't want to make too many conclusions here" }, { "start": 984.24, "end": 992.64, "text": " about these things. Suffice to say that sometimes it actually can read your thoughts. Because if you" }, { "start": 992.64, "end": 1000, "text": " just think so this is the stuff up here, if you just think of a shape, it can sort of kind of a" }, { "start": 1000, "end": 1008.12, "text": " bit make out the shape that you're thinking about. Alright, this was it for this paper. I'm basically" }, { "start": 1008.12, "end": 1014.16, "text": " mainly wanted to show you what I found. And I'm I have to say I'm pretty impressed with this, even" }, { "start": 1014.16, "end": 1025, "text": " though like, this is a laptop. This is not a VCR. This is a VCR. It's, it's more of a nearest neighbor" }, { "start": 1025, "end": 1035.88, "text": " thing, really, than I reconstruction, I think. But that's my opinion, right? Yes. So if you like this," }, { "start": 1035.88, "end": 1043.3200000000002, "text": " give it a like, subscribe if you're still here. And I look forward to next time. Bye bye." } ]
UjJU13GdL94
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Regularizing Trajectory Optimization with Denoising Autoencoders (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "reinforcement learning", "model predictive control", "dae", "denoising autoencoders", "trajectory", "trajectory optimization", "planning", "adversarial attack", "errors", "open loop", "closed loop", "joint", "probability", "derivative", "gaussian", "experience", "learned model", "world model", "model predictive", "mpc" ]
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 autoencoders by Renu Bonet, Norman DiPaolo 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 going to 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, you 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 a 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 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 going to fill in your blanks, you do your first explorations, and you've had there's a bit of a wall here, right. And there might be some wall here, I crashed into that, right, you're going into here, you crash into a wall, you saw there's a wall here and here, 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. All right, so right now, you have, okay, you go here, 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 not 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. All right, 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 your 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? Then 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 whatnot. So you're going to look at horizon H, you're going to look H 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 rooms case 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. And now this reward relies on your environment model. So here's the algorithm. First you collect some data, okay, that's how you start off. That 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 add this data to D. So 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 done an episode, right? You went somewhere, you put all of this into your training data to make the world model better. Something 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 these blue arrow finder can now go away 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. And they have 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 in it. And there are 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 another valve right here. So you can control these three valves, the 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 nonlinear and has maybe like time shifts. So when you open a valve, it's going to take a while and then it's very nonlinear. 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. People have been doing this stuff in industry and they basically build controllers for it. And 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 nonlinear 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 this is some sort of a 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 its potential reward. With 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, via 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 taken path. So this here, as you can see, this is observation action and so on, observation action. So this is the future. This right here is the future. So this sequence here is what is going to give me the reward right here. So G is also dependent on these things, but it's not said explicitly here. So G is dependent on your plan. Maybe let's not call this the future. This is the plan. 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 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 data set, 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 up here somewhere, if we go back to our rooms example, right, 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 it 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, crash into a wall right here, right? 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. We 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 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. 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 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. 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 denoising function for zero mean Gaussian corruption is this thing right here. So it is, if you give me X and you tell me X has been corrupted by zero mean Gaussian noise of size sigma n, then the best, 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 I can, if I have a model of the log probability. So that's the best thing I can do. And that's the best denoising function. And now you have to think a bit in reverse. If we train a denoising autoencoder, that is going to approximate this best function that there is. 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 divided by the 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 thing. So if we train a denoising autoencoder and we suppose it 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 these things right here. 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 a bit, but not too much. 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. Because if I take the first step into this direction, then after that, I'm going to have to, if once I crash here, I'm going to have to correct really hard. And that's exactly what's going to give you this super jittery 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 they're experiments. Basically I actually want to go down here to this industry, sorry, not the industrial control process, but to the mojo co experiments. So these are kind of continuous control tasks. You might have seen it. There's some like one is a, a, the ant here is basically this 3d and is 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 pets thing is a previous baseline to do, to 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 faster. 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. Now 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 point surpass 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, where did I draw it? Since we only plan where we know, we basically do much less exploration than others. We kind of stick to what we know when we plan. So inherently we do less exploration and in our conversation with Hari, he basically said this, 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 exploration phase, you would explicitly go there rather than intermingle your planning with your exploration and basically rely on your planning to screw up and you're exploring. Because if your plan, 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 their 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 going to 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, "end": 6.26, "text": " Hi there, today we're looking at regularizing trajectory optimization with denoising autoencoders" }, { "start": 6.26, "end": 14.16, "text": " by Renu Bonet, Norman DiPaolo and others of various places, but a lot of the people are" }, { "start": 14.16, "end": 16.2, "text": " from Curious AI." }, { "start": 16.2, "end": 22.98, "text": " And we actually had a discussion with Hari, who is the CEO of Curious AI." }, { "start": 22.98, "end": 26.52, "text": " And this was on our Machine Learning Street Talk podcast." }, { "start": 26.52, "end": 31.38, "text": " So this is another YouTube channel for those of you who don't know, where every week or" }, { "start": 31.38, "end": 37.66, "text": " so we try to have either an interesting discussion or a guest, like sort of an interview or talk" }, { "start": 37.66, "end": 40.28, "text": " about comment on the talk." }, { "start": 40.28, "end": 44.3, "text": " So if it is not out yet, I'll link to it as soon as it comes out." }, { "start": 44.3, "end": 49.22, "text": " But if you're watching this video later, make sure to check out our conversation with Hari" }, { "start": 49.22, "end": 52.64, "text": " because it was absolutely fantastic." }, { "start": 52.64, "end": 57.84, "text": " And in general, if you like videos like this, consider subscribing, liking, sharing if you're" }, { "start": 57.84, "end": 61, "text": " still here at the end and liked it." }, { "start": 61, "end": 67.12, "text": " Okay, so this paper on a high level deals with model based reinforcement learning." }, { "start": 67.12, "end": 73.24000000000001, "text": " Model based reinforcement learning means that you are using a model of the world to do reinforcement" }, { "start": 73.24000000000001, "end": 74.24000000000001, "text": " learning." }, { "start": 74.24000000000001, "end": 82, "text": " So in essence, if you have your reinforcement learning setup where you are an agent, and" }, { "start": 82, "end": 87.24, "text": " you have to interact with the world, you have to do so in many steps in like a round trip" }, { "start": 87.24, "end": 88.24, "text": " fashion." }, { "start": 88.24, "end": 93.08, "text": " So you put an action you act and the world gives you back an observation." }, { "start": 93.08, "end": 99.06, "text": " And you have to act in the world over and over and over such that you will be able to" }, { "start": 99.06, "end": 101.3, "text": " maximize your reward." }, { "start": 101.3, "end": 104.34, "text": " Now what is model based reinforcement learning?" }, { "start": 104.34, "end": 111.64, "text": " Model based reinforcement learning basically means that the agent here has internally" }, { "start": 111.64, "end": 113.48, "text": " a model of the world." }, { "start": 113.48, "end": 118.72, "text": " So it sort of understands how the world works." }, { "start": 118.72, "end": 122.36, "text": " Situations where you have a accurate model of the world are things like chess." }, { "start": 122.36, "end": 127.32, "text": " So in chess, the rules are very clear, you know how the world's going to behave if you" }, { "start": 127.32, "end": 129.04, "text": " perform a certain action." }, { "start": 129.04, "end": 134.32, "text": " But in real world applications, it's very, very hard to actually make a model." }, { "start": 134.32, "end": 137.28, "text": " So people usually rely on learned models." }, { "start": 137.28, "end": 142.32, "text": " So what does it mean you basically learn a neural network that tries to predict how the" }, { "start": 142.32, "end": 144.38, "text": " world is going to act." }, { "start": 144.38, "end": 150.28, "text": " So this here is going to be a deep neural network that you learn from what you see in" }, { "start": 150.28, "end": 151.36, "text": " the world." }, { "start": 151.36, "end": 159.06, "text": " Now trajectory optimization basically means that you are now you now have this world model," }, { "start": 159.06, "end": 164.2, "text": " and you use it to look ahead, as I said, so you are in the state like here, and you can" }, { "start": 164.2, "end": 166.52, "text": " do let's say three different actions." }, { "start": 166.52, "end": 170.48000000000002, "text": " And you use your world model here, world." }, { "start": 170.48000000000002, "end": 175.44, "text": " And you see, you think how's the world going to react if I do either of those three things," }, { "start": 175.44, "end": 177.66000000000003, "text": " and then you get into three different states." }, { "start": 177.66000000000003, "end": 182.84, "text": " And then again, you after each one, you consider three actions, three actions here, three actions" }, { "start": 182.84, "end": 184.36, "text": " here, and so on." }, { "start": 184.36, "end": 190.12, "text": " So ultimately, you're going to kind of have an overview over a planning horizon, which" }, { "start": 190.12, "end": 196.48000000000002, "text": " here we call H, you kind of look ahead a couple of steps, or there are various ways of doing" }, { "start": 196.48, "end": 197.48, "text": " this." }, { "start": 197.48, "end": 202.35999999999999, "text": " But ultimately, you will basically find that this this path here is really good." }, { "start": 202.35999999999999, "end": 208.32, "text": " So I think I'm going to take this as a first action." }, { "start": 208.32, "end": 215.48, "text": " So trajectory optimization considers finding the best green path here in this tree of possibilities" }, { "start": 215.48, "end": 218.76, "text": " that your your world model gives you." }, { "start": 218.76, "end": 220.16, "text": " Okay." }, { "start": 220.16, "end": 223.04, "text": " Now, what does what do these people say?" }, { "start": 223.04, "end": 230.79999999999998, "text": " They say this procedure often suffers from exploiting inaccuracies of the learned model." }, { "start": 230.79999999999998, "end": 231.92, "text": " What does that mean?" }, { "start": 231.92, "end": 236.95999999999998, "text": " That basically means that if I have a world model, and it is not accurate, then it is" }, { "start": 236.95999999999998, "end": 243.32, "text": " basically, basically the thing that tries to find the best green path here, the optimizer" }, { "start": 243.32, "end": 249.64, "text": " is sort of trying to find the the best path against this world model." }, { "start": 249.64, "end": 255.04, "text": " Now, if that world model is inaccurate, that can lead to devastating consequences." }, { "start": 255.04, "end": 256.44, "text": " So what do we mean by this?" }, { "start": 256.44, "end": 258.96, "text": " I'll give you an example." }, { "start": 258.96, "end": 267.47999999999996, "text": " If you have a room, right, and the room is, let's take our classic room like this." }, { "start": 267.47999999999996, "end": 272.28, "text": " And you are here and you would like to go here." }, { "start": 272.28, "end": 276.91999999999996, "text": " And so you're a reinforcement learning agent, you do some exploration, right, you explore" }, { "start": 276.92, "end": 281.6, "text": " a bit here, the next episode, you might go here, and you might go here, and so on." }, { "start": 281.6, "end": 285.68, "text": " And over time, in this framework, you're going to build a model of the world." }, { "start": 285.68, "end": 290.36, "text": " So at the beginning, we won't tell you how these rooms look, you have to discover it" }, { "start": 290.36, "end": 291.56, "text": " by yourself." }, { "start": 291.56, "end": 296.12, "text": " So maybe at the beginning, we only tell you, there's these four walls, the rest you have" }, { "start": 296.12, "end": 297.36, "text": " to figure out." }, { "start": 297.36, "end": 302.16, "text": " So on and on, you're going to fill in your blanks, you do your first explorations, and" }, { "start": 302.16, "end": 305.36, "text": " you've had there's a bit of a wall here, right." }, { "start": 305.36, "end": 309.68, "text": " And there might be some wall here, I crashed into that, right, you're going into here," }, { "start": 309.68, "end": 313.92, "text": " you crash into a wall, you saw there's a wall here and here, there's a wall here, you go" }, { "start": 313.92, "end": 316.04, "text": " maybe here, oh, there's no wall." }, { "start": 316.04, "end": 320.76, "text": " So you go further, there's no wall anywhere here, you crash here, okay, we already knew" }, { "start": 320.76, "end": 322.28000000000003, "text": " there's a wall." }, { "start": 322.28000000000003, "end": 323.28000000000003, "text": " Maybe you crash here." }, { "start": 323.28000000000003, "end": 329.24, "text": " All right, so right now, you have, okay, you go here, you have a model of the world in" }, { "start": 329.24, "end": 333.68, "text": " this situation, where there's a wall here, a wall down." }, { "start": 333.68, "end": 340.3, "text": " And if you now try to do trajectory optimization, remember, you have to go from here to here." }, { "start": 340.3, "end": 344.6, "text": " If you try to do trajectory optimization, what is it going to turn out?" }, { "start": 344.6, "end": 348.48, "text": " It's going to turn out like, look, there you go." }, { "start": 348.48, "end": 350.36, "text": " That works just fine." }, { "start": 350.36, "end": 353.4, "text": " And that's not because you're so good at planning." }, { "start": 353.4, "end": 358.58, "text": " I mean, you are good at planning, but because your model is inaccurate here, because it" }, { "start": 358.58, "end": 364.03999999999996, "text": " has never seen this, your entire training distribution that you trained the world model" }, { "start": 364.03999999999996, "end": 366.91999999999996, "text": " on, only explored the area over here." }, { "start": 366.91999999999996, "end": 372.52, "text": " All right, so you see how the more efficient this planning algorithm is, like the blue" }, { "start": 372.52, "end": 377.79999999999995, "text": " arrow, the thing that finds the blue arrow, the more efficient that is, the more consequential" }, { "start": 377.79999999999995, "end": 385.03999999999996, "text": " it is when your learned world model has mistakes, because it will exactly exploit these mistakes" }, { "start": 385.04, "end": 392.04, "text": " in order to get the shortest path possible or the highest reward in that case." }, { "start": 392.04, "end": 397.64000000000004, "text": " And this, they call this like almost an adversarial attack on the world model, which is a pretty" }, { "start": 397.64000000000004, "end": 403.40000000000003, "text": " good way of framing it." }, { "start": 403.40000000000003, "end": 406.8, "text": " They propose actually to solve this problem." }, { "start": 406.8, "end": 412.28000000000003, "text": " They say we propose to regularize trajectory optimization by means of a denoising autoencoder" }, { "start": 412.28, "end": 416.52, "text": " that is trained on the same trajectories as the model of the environment." }, { "start": 416.52, "end": 421.44, "text": " We show that the proposed regularization leads to improve planning with both gradient based" }, { "start": 421.44, "end": 423.64, "text": " and gradient free optimizers." }, { "start": 423.64, "end": 428.73999999999995, "text": " We also demonstrate that using regularized trajectory optimization leads to rapid initial" }, { "start": 428.73999999999995, "end": 434.47999999999996, "text": " learning in a set of popular motor control tasks, which suggests that the proposed approach" }, { "start": 434.47999999999996, "end": 439.09999999999997, "text": " can be useful tool for improving sample efficiency." }, { "start": 439.1, "end": 442.48, "text": " So in essence, what do they do?" }, { "start": 442.48, "end": 450.26000000000005, "text": " They basically say, okay, we want to regularize this using a denoising autoencoder." }, { "start": 450.26000000000005, "end": 456.48, "text": " And I think it's best if we if we look at the at the math for doing this." }, { "start": 456.48, "end": 464.40000000000003, "text": " So the math here starts off as follows, saying you want to learn a world model." }, { "start": 464.40000000000003, "end": 465.40000000000003, "text": " This is F here." }, { "start": 465.40000000000003, "end": 466.48, "text": " F is the world model." }, { "start": 466.48, "end": 472.64000000000004, "text": " It takes in a state and an action and it gives you the next state or an approximation to" }, { "start": 472.64000000000004, "end": 473.64000000000004, "text": " it." }, { "start": 473.64000000000004, "end": 477.56, "text": " And the parameters here indicate that this is some sort of function that you learn like" }, { "start": 477.56, "end": 479.56, "text": " a deep neural network." }, { "start": 479.56, "end": 484.96000000000004, "text": " You can do this in fully or partially observed environments." }, { "start": 484.96000000000004, "end": 492.36, "text": " Now when you plan, what you want to do is you say I have a planning horizon H, right?" }, { "start": 492.36, "end": 498.36, "text": " Then I have a reward function, and the reward function is going to give me a reward for" }, { "start": 498.36, "end": 499.96000000000004, "text": " each state action pair." }, { "start": 499.96000000000004, "end": 505.28000000000003, "text": " So if I'm in a state and I do a certain action, I'm going to get some reward." }, { "start": 505.28000000000003, "end": 510.12, "text": " This could be you have reached the target or this could be you know how much money you've" }, { "start": 510.12, "end": 512.24, "text": " collected or whatnot." }, { "start": 512.24, "end": 517.5600000000001, "text": " So you're going to look at horizon H, you're going to look H steps into the future, and" }, { "start": 517.5600000000001, "end": 521.64, "text": " you want to maximize the sum of all the rewards here." }, { "start": 521.64, "end": 527.4399999999999, "text": " So in the limit, this reduces to simply like, for example, reaching the target in our rooms" }, { "start": 527.4399999999999, "end": 532.16, "text": " case if H is infinite." }, { "start": 532.16, "end": 533.96, "text": " But you can consider a lower planning horizon." }, { "start": 533.96, "end": 541.88, "text": " So you want to find the action sequence that maximizes this reward in the future." }, { "start": 541.88, "end": 549.86, "text": " And now this reward relies on your environment model." }, { "start": 549.86, "end": 553.4, "text": " So here's the algorithm." }, { "start": 553.4, "end": 556.92, "text": " First you collect some data, okay, that's how you start off." }, { "start": 556.92, "end": 563.24, "text": " That train the dynamics model, the world model, using the data you've already collected." }, { "start": 563.24, "end": 568, "text": " Then for each time step T, you want to optimize this trajectory." }, { "start": 568, "end": 573.02, "text": " So you want to find the best next action sequence and take the first action, implement the first" }, { "start": 573.02, "end": 575.84, "text": " action and get the new observation." }, { "start": 575.84, "end": 580.76, "text": " And do you do this in a loop until the end and at the end you say add this data to D." }, { "start": 580.76, "end": 582.36, "text": " So that's what you do." }, { "start": 582.36, "end": 588, "text": " You use your world model to get the best action sequence." }, { "start": 588, "end": 590.52, "text": " That's how you optimize the trajectory." }, { "start": 590.52, "end": 594.48, "text": " And then at the end of the episode, you've done an episode, right?" }, { "start": 594.48, "end": 599.6, "text": " You went somewhere, you put all of this into your training data to make the world model" }, { "start": 599.6, "end": 601.88, "text": " better." }, { "start": 601.88, "end": 608.04, "text": " Something to note here is that the world model will only learn about things that you have" }, { "start": 608.04, "end": 610.08, "text": " done, right?" }, { "start": 610.08, "end": 611.96, "text": " So there is kind of an interaction effect." }, { "start": 611.96, "end": 613.6, "text": " That's the green area here." }, { "start": 613.6, "end": 618.68, "text": " The world model only knows the paths, the world model only can accurately estimate the" }, { "start": 618.68, "end": 622.52, "text": " world where you have been." }, { "start": 622.52, "end": 629.24, "text": " And that's going to turn out to be the entire problem because these blue arrow finder can" }, { "start": 629.24, "end": 636.12, "text": " now go away from that." }, { "start": 636.12, "end": 637.6800000000001, "text": " That's explained here." }, { "start": 637.6800000000001, "end": 642.5600000000001, "text": " Potential inaccuracies of the trained model cause substantial difficulties for the planning" }, { "start": 642.5600000000001, "end": 644.38, "text": " process." }, { "start": 644.38, "end": 649.02, "text": " Rather than optimizing what really happens, planning can easily end up exploiting the" }, { "start": 649.02, "end": 652.04, "text": " weaknesses of the predictive model." }, { "start": 652.04, "end": 656.36, "text": " Planning is effectively an adversarial attack against the agent's own forward model." }, { "start": 656.36, "end": 664.24, "text": " This results in a wide gap between expectations based on the model and what actually happens." }, { "start": 664.24, "end": 669.76, "text": " And they have this example here where it's like an industrial control process." }, { "start": 669.76, "end": 675.24, "text": " And what you have to imagine, there's like some sort of a container here with a liquid" }, { "start": 675.24, "end": 676.6, "text": " in it." }, { "start": 676.6, "end": 683.32, "text": " And there are two pipes that lead to this container, pipe one and pipe two." }, { "start": 683.32, "end": 684.94, "text": " And there are valves here." }, { "start": 684.94, "end": 690.36, "text": " So there's this valve right here and there's this valve right here." }, { "start": 690.36, "end": 692.9000000000001, "text": " So these are valve one and valve two." }, { "start": 692.9000000000001, "end": 698.5, "text": " And there is also an output pipe right here and that's another valve right here." }, { "start": 698.5, "end": 703.7, "text": " So you can control these three valves, the two inputs and one output." }, { "start": 703.7, "end": 709.5, "text": " And you have to somehow optimize the reaction in here." }, { "start": 709.5, "end": 714.44, "text": " So this is a chemical reaction made up out of the two liquids that flow in here." }, { "start": 714.44, "end": 716.9200000000001, "text": " And you have to somehow optimize a property of that." }, { "start": 716.9200000000001, "end": 721.1, "text": " And that's highly nonlinear and has maybe like time shifts." }, { "start": 721.1, "end": 726.1400000000001, "text": " So when you open a valve, it's going to take a while and then it's very nonlinear." }, { "start": 726.1400000000001, "end": 729.46, "text": " And then you are not supposed to break the pressure limit." }, { "start": 729.46, "end": 732.82, "text": " So you have to also outflow some stuff." }, { "start": 732.82, "end": 737.34, "text": " And if you just do this with a learned model, it looks like this." }, { "start": 737.34, "end": 740.9000000000001, "text": " So first of all, here is a classic controller." }, { "start": 740.9, "end": 747.54, "text": " People have been doing this stuff in industry and they basically build controllers for it." }, { "start": 747.54, "end": 752.02, "text": " And you can do that and that works out really okay-ish." }, { "start": 752.02, "end": 756.9, "text": " As you can see right here, this is the product rate, what you're supposed to optimize." }, { "start": 756.9, "end": 760.54, "text": " And you see some sort of a smooth..." }, { "start": 760.54, "end": 764.5799999999999, "text": " You're supposed to actually bring it to this dashed line right here." }, { "start": 764.5799999999999, "end": 768.18, "text": " And this is some sort of smooth thing, right?" }, { "start": 768.18, "end": 773.54, "text": " And you're supposed to, I guess, bring the pressure here and the A in purge." }, { "start": 773.54, "end": 776.7399999999999, "text": " I don't know what these quantities are, but you're supposed to bring them to the dashed" }, { "start": 776.7399999999999, "end": 782.02, "text": " line and it's very nonlinear and very time dependent." }, { "start": 782.02, "end": 783.02, "text": " So that works." }, { "start": 783.02, "end": 786.5, "text": " And you see here kind of the smoothness by which the variables are manipulated." }, { "start": 786.5, "end": 794.8199999999999, "text": " Now, if you just learn a world model and then do this trajectory optimization, basically" }, { "start": 794.82, "end": 801.2600000000001, "text": " this is some sort of a planning-based reinforcement learning with a world model." }, { "start": 801.2600000000001, "end": 806.22, "text": " You see right here, it works, but it's super jittery." }, { "start": 806.22, "end": 810.38, "text": " The pressure spikes here and apparently this here is a pressure limit." }, { "start": 810.38, "end": 812.62, "text": " So it spikes the pressure limit." }, { "start": 812.62, "end": 816.38, "text": " And you can see that the manipulated variables are up and down and up and down and up and" }, { "start": 816.38, "end": 822.98, "text": " down because at each step, it basically completely overestimates its potential reward." }, { "start": 822.98, "end": 827.14, "text": " With things like, wow, this is really good, but all it does is find a weakness in the" }, { "start": 827.14, "end": 830.86, "text": " model and not a really good action per se." }, { "start": 830.86, "end": 837.34, "text": " Now with their method to already take it away, you can see that now the control task super" }, { "start": 837.34, "end": 842.26, "text": " smoothly and very quickly converges to these optimal things." }, { "start": 842.26, "end": 848.22, "text": " And you can see that the variables being manipulated are also rather smoothly manipulated." }, { "start": 848.22, "end": 856.6600000000001, "text": " And that's an indication that the model is accurately estimating their rewards." }, { "start": 856.6600000000001, "end": 860.5400000000001, "text": " Okay, so how do they do it?" }, { "start": 860.5400000000001, "end": 866.98, "text": " Via what they call trajectory, via regularization of trajectory optimization." }, { "start": 866.98, "end": 869.86, "text": " So in essence, what do we want to regularize here?" }, { "start": 869.86, "end": 875.46, "text": " There are many things we could do to solve this, but the way this paper goes is they" }, { "start": 875.46, "end": 886.6600000000001, "text": " say we not only do we want the most return, we also want a high log probability of our" }, { "start": 886.6600000000001, "end": 888.4200000000001, "text": " taken path." }, { "start": 888.4200000000001, "end": 894.7800000000001, "text": " So this here, as you can see, this is observation action and so on, observation action." }, { "start": 894.7800000000001, "end": 896.74, "text": " So this is the future." }, { "start": 896.74, "end": 902.24, "text": " This right here is the future." }, { "start": 902.24, "end": 911.1800000000001, "text": " So this sequence here is what is going to give me the reward right here." }, { "start": 911.1800000000001, "end": 915.98, "text": " So G is also dependent on these things, but it's not said explicitly here." }, { "start": 915.98, "end": 918.38, "text": " So G is dependent on your plan." }, { "start": 918.38, "end": 919.86, "text": " Maybe let's not call this the future." }, { "start": 919.86, "end": 922.8, "text": " This is the plan." }, { "start": 922.8, "end": 925.1800000000001, "text": " This is the plan you came up with." }, { "start": 925.1800000000001, "end": 929.04, "text": " So this is directly going to influence G and G is the reward you're going to get under" }, { "start": 929.04, "end": 930.04, "text": " your model." }, { "start": 930.04, "end": 935.2199999999999, "text": " But also you want the log probability of the plan itself to be high." }, { "start": 935.2199999999999, "end": 940.0999999999999, "text": " Now there, I think there is a bit, there is something missing here and that is conditioned" }, { "start": 940.0999999999999, "end": 943.9, "text": " on your training distribution right here." }, { "start": 943.9, "end": 947.0999999999999, "text": " And I think that's a actually rather crucial part." }, { "start": 947.0999999999999, "end": 949.8199999999999, "text": " Now that's, that's the KL thing." }, { "start": 949.8199999999999, "end": 951.78, "text": " So this is conditioned on your training." }, { "start": 951.78, "end": 960.5799999999999, "text": " So what you want is you want the plan to be basically in your training distribution." }, { "start": 960.5799999999999, "end": 967.4399999999999, "text": " So you, you want what you, you want your plan that you're going to execute." }, { "start": 967.4399999999999, "end": 973.9399999999999, "text": " If that is actually part of your training data set, then you know, I have already executed" }, { "start": 973.9399999999999, "end": 981.1, "text": " this once before and it's reasonable to assume that therefore my world model has learned" }, { "start": 981.1, "end": 985.62, "text": " from this experience and is going to give me an accurate reward." }, { "start": 985.62, "end": 993.26, "text": " If we go back to our rooms example, then up here somewhere, if we go back to our rooms" }, { "start": 993.26, "end": 999.1, "text": " example, right, you see that anywhere in the green area where I have already explored the" }, { "start": 999.1, "end": 1002, "text": " world model is fairly good, right?" }, { "start": 1002, "end": 1005.0600000000001, "text": " It's going to give me accurate reflection of the world." }, { "start": 1005.0600000000001, "end": 1009.5400000000001, "text": " But as soon as it go outside the green area, it is not." }, { "start": 1009.54, "end": 1014.3199999999999, "text": " And inside the green area is basically where my training data is." }, { "start": 1014.3199999999999, "end": 1020.9, "text": " Now if I in the future actually take a path here, crash into a wall right here, right?" }, { "start": 1020.9, "end": 1025.6, "text": " You saw in the algorithm at the end of an episode, I'm going to add my trajectory to" }, { "start": 1025.6, "end": 1027.7, "text": " the training data for the world model." }, { "start": 1027.7, "end": 1031.94, "text": " So this green part here expands to include that." }, { "start": 1031.94, "end": 1039.42, "text": " And now if I go here again, if my plan goes there again, now I can trust the world model." }, { "start": 1039.42, "end": 1043.14, "text": " But also now it has it is actually correct because it has a wall here." }, { "start": 1043.14, "end": 1048.98, "text": " So you see that the regularization basically you not only do I want the biggest reward" }, { "start": 1048.98, "end": 1055.78, "text": " possible under my world model, I also want that the plan that I'm about to execute is" }, { "start": 1055.78, "end": 1059.7, "text": " has a high probability under my training distribution." }, { "start": 1059.7, "end": 1060.7, "text": " Okay." }, { "start": 1060.7, "end": 1068.8200000000002, "text": " And the way we do this is by denoising auto encoders." }, { "start": 1068.82, "end": 1074.86, "text": " We want the log probability here to be high and you do this via a denoising auto encoder." }, { "start": 1074.86, "end": 1077.06, "text": " What's a denoising auto encoder?" }, { "start": 1077.06, "end": 1086.06, "text": " A denoising auto encoder is basically so if you have, for example, an image and the image" }, { "start": 1086.06, "end": 1095.46, "text": " is of a trusty cat whiskers and a denoising auto encoder is an unsupervised method where" }, { "start": 1095.46, "end": 1097.76, "text": " you have it's basically an auto encoder." }, { "start": 1097.76, "end": 1104.02, "text": " So there is a bunch of layers compressing to a hidden representation, then uncompressing" }, { "start": 1104.02, "end": 1105.54, "text": " it again." }, { "start": 1105.54, "end": 1107.54, "text": " Okay." }, { "start": 1107.54, "end": 1113.62, "text": " And at the end, you want to output the same as at the beginning." }, { "start": 1113.62, "end": 1115.96, "text": " So it's basically an auto encoder." }, { "start": 1115.96, "end": 1122.3, "text": " But the special part about the denoising auto encoder is that first, you take your input" }, { "start": 1122.3, "end": 1125.06, "text": " and you know, you put some noise on it." }, { "start": 1125.06, "end": 1128.46, "text": " So that could mean could mean anything here." }, { "start": 1128.46, "end": 1133.34, "text": " But here, what they do is they do they make some Gaussian noise on it." }, { "start": 1133.34, "end": 1138.1799999999998, "text": " Now, I can't really draw Gaussian noise here, but it would be kind of convolved with Gaussian" }, { "start": 1138.1799999999998, "end": 1139.1799999999998, "text": " Gaussian noise." }, { "start": 1139.1799999999998, "end": 1142.3799999999999, "text": " So I'm just going to add some noise like this." }, { "start": 1142.3799999999999, "end": 1145.3799999999999, "text": " So noise, noise, noise." }, { "start": 1145.3799999999999, "end": 1150.72, "text": " So there's some noise, you see, and then you feed that." }, { "start": 1150.72, "end": 1153.3799999999999, "text": " That's now what you feed in here." }, { "start": 1153.38, "end": 1158.8600000000001, "text": " And the algorithm is supposed to reconstruct this, this original image." }, { "start": 1158.8600000000001, "end": 1163.7800000000002, "text": " So the algorithm is basically supposed to take away the noise, it doesn't see the original" }, { "start": 1163.7800000000002, "end": 1166.38, "text": " image, but it's supposed to produce it." }, { "start": 1166.38, "end": 1168.3400000000001, "text": " And you do this with your training data." }, { "start": 1168.3400000000001, "end": 1169.3400000000001, "text": " What does that mean?" }, { "start": 1169.3400000000001, "end": 1176.8600000000001, "text": " Ultimately, for our trajectory optimization, it means that if I have a trajectory that" }, { "start": 1176.8600000000001, "end": 1181.5, "text": " I did before, and it maybe goes here, right?" }, { "start": 1181.5, "end": 1189.34, "text": " What I can do is I can make a noisy version of it, which would be the black one right" }, { "start": 1189.34, "end": 1190.34, "text": " here." }, { "start": 1190.34, "end": 1193.1, "text": " So I put some noise on it, some noise." }, { "start": 1193.1, "end": 1196.82, "text": " Right, it's kind of the same, but okay." }, { "start": 1196.82, "end": 1201.36, "text": " And the denoising autoencoder is supposed to give me back the red one." }, { "start": 1201.36, "end": 1207.38, "text": " This will simply give me some sort of a probabilistic model of my training distribution." }, { "start": 1207.38, "end": 1211.16, "text": " So they go through the math here and show that these denoising autoencoders actually" }, { "start": 1211.16, "end": 1219.02, "text": " naturally output this log probability, sorry, the gradient of the log probability." }, { "start": 1219.02, "end": 1226.8600000000001, "text": " Because optimal denoising theory says that for zero mean and Gaussian noise, the optimal" }, { "start": 1226.8600000000001, "end": 1234.6200000000001, "text": " denoising function, the optimal denoising function for zero mean Gaussian corruption" }, { "start": 1234.6200000000001, "end": 1237.46, "text": " is this thing right here." }, { "start": 1237.46, "end": 1248.06, "text": " So it is, if you give me X and you tell me X has been corrupted by zero mean Gaussian" }, { "start": 1248.06, "end": 1257.74, "text": " noise of size sigma n, then the best, and you simply tell me, give me back the original" }, { "start": 1257.74, "end": 1264.7, "text": " image, the best thing I can do is to take what you gave me and add this gradient of" }, { "start": 1264.7, "end": 1272.38, "text": " the log probability of X if I can, if I have a model of the log probability." }, { "start": 1272.38, "end": 1276.82, "text": " So that's the best thing I can do." }, { "start": 1276.82, "end": 1279.5, "text": " And that's the best denoising function." }, { "start": 1279.5, "end": 1281.5, "text": " And now you have to think a bit in reverse." }, { "start": 1281.5, "end": 1290.5, "text": " If we train a denoising autoencoder, that is going to approximate this best function" }, { "start": 1290.5, "end": 1292.18, "text": " that there is." }, { "start": 1292.18, "end": 1297.8200000000002, "text": " So we know that the best possible denoising function is this, we train a denoising autoencoder," }, { "start": 1297.8200000000002, "end": 1303.0600000000002, "text": " which in the optimal case is going to converge to the best denoising function." }, { "start": 1303.0600000000002, "end": 1314.8200000000002, "text": " So if we then reformulate and we do denoising autoencoder of X minus or X tilde minus X" }, { "start": 1314.8200000000002, "end": 1319.22, "text": " tilde, that is divided by the standard deviation." }, { "start": 1319.22, "end": 1321.74, "text": " Sorry, the variance." }, { "start": 1321.74, "end": 1330.1, "text": " That is going to give us this quantity right here, the gradient of the log probability." }, { "start": 1330.1, "end": 1337.3, "text": " And the gradient of the log probability of X is exactly what we need to run gradient" }, { "start": 1337.3, "end": 1339.42, "text": " descent on our function." }, { "start": 1339.42, "end": 1343.3, "text": " So here is our function again, G plus this regularization." }, { "start": 1343.3, "end": 1347.86, "text": " Now they don't regularize over the entire future, but over these windows." }, { "start": 1347.86, "end": 1352.06, "text": " But in essence it's G plus the log probability of your plan." }, { "start": 1352.06, "end": 1356.02, "text": " If you take the gradient of that, of course you take the gradient of the sum." }, { "start": 1356.02, "end": 1363.6999999999998, "text": " So it's the gradient of G plus the gradient of the log probability with respect to the" }, { "start": 1363.6999999999998, "end": 1364.6999999999998, "text": " actions." }, { "start": 1364.6999999999998, "end": 1370.7199999999998, "text": " And here simple application of the chain rule will tell you that you have to propagate through" }, { "start": 1370.7199999999998, "end": 1372.3, "text": " the input, through the X." }, { "start": 1372.3, "end": 1373.9399999999998, "text": " And you need this quantity." }, { "start": 1373.94, "end": 1379.42, "text": " The gradient of the log probability with respect to its inputs." }, { "start": 1379.42, "end": 1390.3400000000001, "text": " Now as we just saw, the optimal denoising autoencoder is going to output that thing." }, { "start": 1390.3400000000001, "end": 1396.8200000000002, "text": " So if we train a denoising autoencoder and we suppose it reaches a good accuracy, then" }, { "start": 1396.8200000000002, "end": 1400.74, "text": " we can obtain this quantity basically for free." }, { "start": 1400.74, "end": 1404.22, "text": " And that's the entire trick here." }, { "start": 1404.22, "end": 1408.02, "text": " So in essence, what does it mean?" }, { "start": 1408.02, "end": 1414.38, "text": " In essence what it means is that if we are in our room again, and we have our partial" }, { "start": 1414.38, "end": 1420.58, "text": " model of the world, let's say we have this model, because we are here and all we've ever" }, { "start": 1420.58, "end": 1429.78, "text": " explored is these things right here." }, { "start": 1429.78, "end": 1434.94, "text": " Now when I go and do my trajectory optimization, and my trajectory optimization wants to go" }, { "start": 1434.94, "end": 1439.44, "text": " here, I simply say, no, I don't know that, I haven't seen that yet." }, { "start": 1439.44, "end": 1445.26, "text": " You can only plan basically within the space where we have already been." }, { "start": 1445.26, "end": 1449.58, "text": " So you can plan like here." }, { "start": 1449.58, "end": 1456.1399999999999, "text": " So here now there is of course, there is going to be some exploration, so some probability" }, { "start": 1456.1399999999999, "end": 1459.5, "text": " that you can go away a bit, but not too much." }, { "start": 1459.5, "end": 1465.18, "text": " So in this case, it would result in the planning only to happen in spaces where we've actually" }, { "start": 1465.18, "end": 1466.18, "text": " been." }, { "start": 1466.18, "end": 1471.54, "text": " So it might go here, and then here, because okay, here we haven't been anywhere." }, { "start": 1471.54, "end": 1478.24, "text": " But then that would lead me to take the first step in this direction, and not in this direction." }, { "start": 1478.24, "end": 1484.1, "text": " And if I take my first step in this first direction, then of course, I'm going to be" }, { "start": 1484.1, "end": 1486.98, "text": " already a bit on the correct path right here." }, { "start": 1486.98, "end": 1490.98, "text": " Because if I take the first step into this direction, then after that, I'm going to have" }, { "start": 1490.98, "end": 1495.22, "text": " to, if once I crash here, I'm going to have to correct really hard." }, { "start": 1495.22, "end": 1499.94, "text": " And that's exactly what's going to give you this super jittery control." }, { "start": 1499.94, "end": 1505.14, "text": " Whereas if you only plan where you've already been, you won't, the probability that you're" }, { "start": 1505.14, "end": 1510.98, "text": " going to have to do like a 180 is going to be much, much lower." }, { "start": 1510.98, "end": 1513.64, "text": " Okay." }, { "start": 1513.64, "end": 1519.44, "text": " That seems like that's about it." }, { "start": 1519.44, "end": 1521.64, "text": " Let's look at the experiments." }, { "start": 1521.64, "end": 1526.14, "text": " So they're experiments." }, { "start": 1526.14, "end": 1531.88, "text": " Basically I actually want to go down here to this industry, sorry, not the industrial" }, { "start": 1531.88, "end": 1536.5600000000002, "text": " control process, but to the mojo co experiments." }, { "start": 1536.5600000000002, "end": 1539.42, "text": " So these are kind of continuous control tasks." }, { "start": 1539.42, "end": 1540.42, "text": " You might have seen it." }, { "start": 1540.42, "end": 1551.98, "text": " There's some like one is a, a, the ant here is basically this 3d and is like a blob and" }, { "start": 1551.98, "end": 1555.46, "text": " it has I think four legs and each leg has two joints." }, { "start": 1555.46, "end": 1560.14, "text": " And it just needs to walk as far as possible or reach some sort of goal." }, { "start": 1560.14, "end": 1567, "text": " And the half cheetah is like a 2d thing where I think it's something like this." }, { "start": 1567, "end": 1572.6, "text": " It also has these two legs and it's supposed to walk forward and not fall over." }, { "start": 1572.6, "end": 1579.06, "text": " And you can put force basically on each of the, of the joints here." }, { "start": 1579.06, "end": 1584.72, "text": " So you see that their baselines are Gaussian processes." }, { "start": 1584.72, "end": 1593.7, "text": " And this pets thing is a previous baseline to do, to also do model based control with" }, { "start": 1593.7, "end": 1596.04, "text": " a learned model." }, { "start": 1596.04, "end": 1602.72, "text": " And here they, there's is the main, their main one is the red one." }, { "start": 1602.72, "end": 1606.72, "text": " And as you can see that it goes much faster." }, { "start": 1606.72, "end": 1613.28, "text": " Well it basically outperforms the rest in these high, in these more complicated tasks." }, { "start": 1613.28, "end": 1619.3999999999999, "text": " And then card pole or something like this is, is lower dimensional, easier tasks." }, { "start": 1619.3999999999999, "end": 1623.04, "text": " And you can see that at least it does not hurt." }, { "start": 1623.04, "end": 1630.84, "text": " Now they make, they say here something they don't, they don't show in the plots." }, { "start": 1630.84, "end": 1639.74, "text": " They say that if you let this run for a while, then basically the, their method doesn't make" }, { "start": 1639.74, "end": 1641.8, "text": " any improvement anymore." }, { "start": 1641.8, "end": 1647.82, "text": " Whereas the baseline methods will sort of at some point surpass it." }, { "start": 1647.82, "end": 1653.02, "text": " And the reason that is, and I'm not sure if it's on this exact task, but they mentioned" }, { "start": 1653.02, "end": 1661.2, "text": " that which it's, it's I respect so far is because they say since we only plan where" }, { "start": 1661.2, "end": 1665.82, "text": " we know, where did I draw it?" }, { "start": 1665.82, "end": 1672.6399999999999, "text": " Since we only plan where we know, we basically do much less exploration than others." }, { "start": 1672.6399999999999, "end": 1676, "text": " We kind of stick to what we know when we plan." }, { "start": 1676, "end": 1680.68, "text": " So inherently we do less exploration and in our conversation with Hari, he basically said" }, { "start": 1680.68, "end": 1684.48, "text": " this, this is intended." }, { "start": 1684.48, "end": 1690.48, "text": " And the base, the intention is that you want to do your planning where you know, and then" }, { "start": 1690.48, "end": 1694.2, "text": " explicitly add a component that does exploration." }, { "start": 1694.2, "end": 1700.96, "text": " So you have control over, so you can basically say, huh, I, I've never been here sort of." }, { "start": 1700.96, "end": 1707.18, "text": " Now you would be in an exploration phase, you would explicitly go there rather than" }, { "start": 1707.18, "end": 1715.2, "text": " intermingle your planning with your exploration and basically rely on your planning to screw" }, { "start": 1715.2, "end": 1717.5600000000002, "text": " up and you're exploring." }, { "start": 1717.5600000000002, "end": 1724.1200000000001, "text": " Because if your plan, if you're planning never screws up, then you won't explore either," }, { "start": 1724.1200000000001, "end": 1725.1200000000001, "text": " right?" }, { "start": 1725.1200000000001, "end": 1728.04, "text": " Then you will always reach your goal or your planning will always be correct." }, { "start": 1728.04, "end": 1733.0800000000002, "text": " And these other methods that don't have this explicitly, they explore every time their" }, { "start": 1733.0800000000002, "end": 1735.2, "text": " planning screws up and you don't want that." }, { "start": 1735.2, "end": 1738.24, "text": " You want your planning to be as good as possible." }, { "start": 1738.24, "end": 1740.8, "text": " And they do that by sticking to what they know." }, { "start": 1740.8, "end": 1745.14, "text": " And then they the next step, which is not in this paper would be to add an explicit" }, { "start": 1745.14, "end": 1750.72, "text": " exploration policy to reach areas they've never reached before." }, { "start": 1750.72, "end": 1757.48, "text": " Okay, so that's the reason why they don't ultimately reach the best accuracy, but they" }, { "start": 1757.48, "end": 1766.44, "text": " do reach a the initial accuracy much faster than the other tasks, because they plan better." }, { "start": 1766.44, "end": 1774.18, "text": " They have a long discussion here of what still problems are like local minima or the planning" }, { "start": 1774.18, "end": 1780.44, "text": " horizon problem, open loop versus closed loop compounding errors in planning." }, { "start": 1780.44, "end": 1783.18, "text": " But I'm going to leave this out for now." }, { "start": 1783.18, "end": 1785.6, "text": " And I thank you for being here." }, { "start": 1785.6, "end": 1789.24, "text": " I very much invite you to check out the paper for more details." }, { "start": 1789.24, "end": 1791.48, "text": " It's pretty cool, pretty easy to read, actually." }, { "start": 1791.48, "end": 1793.76, "text": " It's very written very well." }, { "start": 1793.76, "end": 1795.8799999999999, "text": " And with that, see you next time." }, { "start": 1795.88, "end": 1816.2, "text": " Bye bye." } ]
wcHQ3IutSJg
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[News] The NeurIPS Broader Impact Statement
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "neurips", "conference", "ethics", "society", "impact", "statement", "submission", "authors", "accept", "reject", "flag", "review", "double blind" ]
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 NURIPS 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 NURIPS 2020 announcement on Medium by the conference organizers. Shortly after that, in an email to VentureBeat, Michael Lippman, the communications chair of NURIPS 2020, told VentureBeat 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 goes on to say, reviewers and area chairs assessment will be done on the basis of technical contributions only. However, if a paper is flagged 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 will have nothing to do with this statement. Let's dive in a bit deeper. In the NURIPS 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 foreseen, 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 rate 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 submission. 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, potential impact and clarity. But one could still think that the potential impact here is a potential technical impact. It 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? And 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 the 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, reviewers 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, if 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, NURIBS organizer. Well, hello. So you've decided to make everyone include a broader impact statement, but the broader impact statement will only be visible after the reviewing process. Correct. But the reviewers should check its adequacy during the review process. Yes, while 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 enough 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. 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 being some sort of super honest person that has no incentives and also no strong opinions on these things and 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 NURiBS website actually links to a blog post of Brent Hecht, suggestions for writing the NURiBS 2020 broader impact statements. So we can reasonably assume that this is at least in agreement with the organizers of the conference. Brent here says understanding the societal impacts of your work is going to be hard. It is going to take lots of effort to write NURiBS 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 subawards, 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 in 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 gets on 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 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 impacts 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. Because they're kind of the same, right? And they also say that this might spark a conversation is 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 then 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 proposal's 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 disclose their impacts. So again, 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 expected outcomes. 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 go on 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. Crowdwork, a researcher who invents a new crowdwork framework, likely motivates her work by highlighting the problem the framework solves. But they go on to say that crowdwork also has negative externalities, such as incentivizing very low pay. And the researcher should find ways to engineer her crowdwork framework such that these externalities are structurally mitigated and or she might advocate for minimum wage laws to be adapted. So this researcher working out a problem in crowdworking now has to basically solve millennia old problems in structural economics that have 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 to serve you ads of better kitty stickers. 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 downstreams 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 NURIPS. Either the downstreams 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 Guide to Writing the NURIPS Impact Statement that is not linked by NURIPS, 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, read 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 in official communication says if this doesn't apply, you're doing something wrong. And by the way, we're evaluate 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 here. Pluribus, a superhuman AI for multiplayer poker, they say they 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. Gee, 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 to large institutions who can actually afford to spend a lot of time and work into crafting beautiful statements. And 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 VentureBeat 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, "end": 18, "text": " As many of you might be familiar with, the NURIPS 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, "end": 25, "text": " That was announced in the Getting Started with NURIPS 2020 announcement on Medium by the conference organizers." }, { "start": 25, "end": 38, "text": " Shortly after that, in an email to VentureBeat, Michael Lippman, the communications chair of NURIPS 2020, told VentureBeat that these statements will be published with each paper." }, { "start": 38, "end": 48, "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, "end": 56, "text": " But then goes on to say, reviewers and area chairs assessment will be done on the basis of technical contributions only." }, { "start": 56, "end": 67, "text": " However, if a paper is flagged for potential ethical concerns, then the paper will be sent to another set of reviewers with expertise in ethics and machine learning." }, { "start": 67, "end": 76, "text": " The final acceptance of these papers is contingent on the positive assessment by these second set of reviewers as well." }, { "start": 76, "end": 85, "text": " So this seems a bit odd. For one, the broader impact statement is only published after the double blind reviewing process is over." }, { "start": 85, "end": 89, "text": " But the papers will be assessed based on their ethical and societal impact." }, { "start": 89, "end": 97, "text": " So maybe the assessment will have nothing to do with this statement. Let's dive in a bit deeper." }, { "start": 97, "end": 103, "text": " In the NURIPS 2020 FAQ, do I have to complete the broader impact section?" }, { "start": 103, "end": 107, "text": " The answer is yes. Please include the section." }, { "start": 107, "end": 120, "text": " But they say, however, if your work is very theoretical or is general enough that there is no particular application foreseen, then you are free to write a broader impact discussion is not applicable." }, { "start": 120, "end": 127, "text": " So until now, I genuinely feel that the conference organizers view this as some sort of experiment." }, { "start": 127, "end": 137, "text": " 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": 137, "end": 144, "text": " Can my submission be rejected solely on the basis of the broader impact section? Answer, no." }, { "start": 144, "end": 151, "text": " Reviewers will be asked to rate a submission based on the evaluation criteria, not your broader impact section." }, { "start": 151, "end": 157, "text": " They will also be asked to check whether the broader impact section is adequately addressed." }, { "start": 157, "end": 167, "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." }, { "start": 167, "end": 176, "text": " But they only have to say whether it's adequately addressed and they will not be able to reject a paper on that basis." }, { "start": 176, "end": 186, "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, "end": 198, "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 submission." }, { "start": 198, "end": 210, "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": 210, "end": 217, "text": " Papers that violate the style have already been published or have fatal flaws may be rejected on that basis." }, { "start": 217, "end": 226, "text": " Other submissions will be judged on the basis of their technical quality, novelty, potential impact and clarity." }, { "start": 226, "end": 231, "text": " But one could still think that the potential impact here is a potential technical impact." }, { "start": 231, "end": 239, "text": " It has nothing to do with this broader impact section. That has nothing to do with you being accepted or rejected." }, { "start": 239, "end": 247, "text": " They go on to say submissions will also be considered on ethical grounds, regardless of scientific quality or contribution." }, { "start": 247, "end": 253, "text": " And they say a submission may be rejected for ethical considerations." }, { "start": 253, "end": 262, "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, "end": 274, "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." }, { "start": 274, "end": 281, "text": " And these reviewers can actually reject your paper. So it seems like there is a bit of a mixed message here." }, { "start": 281, "end": 286, "text": " The entire question sort of hinges on who makes the decision and based on what." }, { "start": 286, "end": 291, "text": " And one of the questions is what kind of decisions do the reviewers make?" }, { "start": 291, "end": 295, "text": " So where else better to go than the reviewer guidelines?" }, { "start": 295, "end": 297, "text": " Question 11 to the reviewers." }, { "start": 297, "end": 307, "text": " Have the authors adequately address the broader impact of their work, including potential negative ethical and societal implications of their work?" }, { "start": 307, "end": 311, "text": " And indicate whether you believe the broader impact section was adequate." }, { "start": 311, "end": 322, "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, "end": 337, "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, "end": 340, "text": " The entire writing here seems like it should." }, { "start": 340, "end": 346, "text": " But then also it seems like the reviewers assessment should have nothing to do with the broader impact section." }, { "start": 346, "end": 353, "text": " Question 12 of the reviewer guidelines says, does the submission raise potential ethical concerns?" }, { "start": 353, "end": 360, "text": " Note that this is a different question from question 11, where you're simply asked to judge adequacy." }, { "start": 360, "end": 365, "text": " The reviewer guidelines say, note that your rating should be independent of this." }, { "start": 365, "end": 376, "text": " If the AC also shares this concern, dedicated reviewers with expertise at the intersection of ethics and machine learning will further review the submission." }, { "start": 376, "end": 379, "text": " And your duty is to flag the papers." }, { "start": 379, "end": 394, "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, "end": 400, "text": " And it also contradicts the statement that your paper cannot be rejected based on the broader impact section." }, { "start": 400, "end": 411, "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, "end": 419, "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, "end": 429, "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, "end": 446, "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, "end": 454, "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, "end": 460, "text": " And they again repeat reviewers will also confirm whether the broader impact statement is inadequate." }, { "start": 460, "end": 464, "text": " But this assessment will not affect the overall rating." }, { "start": 464, "end": 472, "text": " However, reviewers have the option to flag a paper for ethical concerns, which may relate to the content of the broader impact section." }, { "start": 472, "end": 485, "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": 485, "end": 489, "text": " We expect very few, if any, papers to need such further assessment." }, { "start": 489, "end": 497, "text": " So the official communication makes a divide between on one hand, adequacy and on the other hand, real ethical concerns." }, { "start": 497, "end": 508, "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, "end": 515, "text": " Now, what's not really clear is the messaging that reviewers should not base their judgment on the broader impact section." }, { "start": 515, "end": 522, "text": " But then where does this adequacy rating go into the process of rejecting or accepting a paper?" }, { "start": 522, "end": 530, "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, "end": 533, "text": " Oh, hey, NURIBS organizer. Well, hello." }, { "start": 533, "end": 540, "text": " So you've decided to make everyone include a broader impact statement, but the broader impact statement will only be visible after the reviewing process." }, { "start": 540, "end": 545, "text": " Correct. But the reviewers should check its adequacy during the review process." }, { "start": 545, "end": 548, "text": " Yes, while they can't see it." }, { "start": 548, "end": 553, "text": " Correct. But it should in no way influence their judgment and you can't be rejected because of that." }, { "start": 553, "end": 559, "text": " That is correct. But if it is found to be inadequate or problematic, it is sent to a second set of reviewers," }, { "start": 559, "end": 568, "text": " which on the basis of the paper and the broader impact statement will decide if the paper is of ethical concern." }, { "start": 568, "end": 575, "text": " Yes. And if the paper is of enough ethical concern and the broader impact statement doesn't convince the special reviewers otherwise," }, { "start": 575, "end": 580, "text": " they will be able to reject that paper. That is indeed correct." }, { "start": 580, "end": 587, "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, "end": 592, "text": " Well, as we said, no one's able to see it until the paper is released. Obviously." }, { "start": 592, "end": 599, "text": " Let's talk about these special reviewers. And for that, we broadly have to talk about incentives." }, { "start": 599, "end": 608, "text": " 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" }, { "start": 608, "end": 616, "text": " 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, "end": 623, "text": " One might almost think that then this program will be abolished in the next year because it's useless." }, { "start": 623, "end": 630, "text": " So the more problems the special reviewers find, the more justified their position is." }, { "start": 630, "end": 641, "text": " I wonder where that leads. I guess we are very dependent on pretty much every single person in these special reviewers being some sort of super honest person" }, { "start": 641, "end": 652, "text": " that has no incentives and also no strong opinions on these things and and generally has gone into this ML ethics just out of interest and not to actually make an impact." }, { "start": 652, "end": 655, "text": " I'm sure that will work out just fine." }, { "start": 655, "end": 665, "text": " Now, the official NURiBS website actually links to a blog post of Brent Hecht, suggestions for writing the NURiBS 2020 broader impact statements." }, { "start": 665, "end": 671, "text": " So we can reasonably assume that this is at least in agreement with the organizers of the conference." }, { "start": 671, "end": 677, "text": " Brent here says understanding the societal impacts of your work is going to be hard." }, { "start": 677, "end": 685, "text": " It is going to take lots of effort to write NURiBS broader impact statements. Tons of work has already been done for you." }, { "start": 685, "end": 691, "text": " Check out the literature from communities that have studied societal impacts of AI for a long while." }, { "start": 691, "end": 698, "text": " Even better, bring a social scientist onto your research team. Remember, though, they don't work for free." }, { "start": 698, "end": 706, "text": " Hire them into your company, give them subawards, recruit them as PhD students through interdisciplinary programs." }, { "start": 706, "end": 714, "text": " So are you saying the more problems these people find, the more of them will get hired?" }, { "start": 714, "end": 720, "text": " And again, look at these statements in general. It seems to really be about how much work are you able to put into this?" }, { "start": 720, "end": 723, "text": " So here's your average PhD student." }, { "start": 723, "end": 731, "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, "end": 735, "text": " And they have to do all their experiments and they don't have enough resources." }, { "start": 735, "end": 741, "text": " And now they're also asked to spend considerable amount of time not only writing this very hard statement," }, { "start": 741, "end": 746, "text": " but also reading up on all the literature that there is to read up on." }, { "start": 746, "end": 756, "text": " Or alternatively, if you don't want to do that, well, just hire someone, of course, because budgets and salaries in universities and for PhD students is notoriously loose." }, { "start": 756, "end": 758, "text": " We can just hire someone that does that." }, { "start": 758, "end": 772, "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, "end": 787, "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": 787, "end": 797, "text": " I'm wondering, it just gets on the tip of my tongue, but I was going to have to leave that for another time." }, { "start": 797, "end": 802, "text": " For people who do more theoretical work, it is going to be more difficult." }, { "start": 802, "end": 809, "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, "end": 813, "text": " But here it basically saying it's going to be more work for you." }, { "start": 813, "end": 817, "text": " Find something that is both rigorous and practical for your research." }, { "start": 817, "end": 827, "text": " And the argument is to get funding for any theoretical work, someone had to make an argument about positive societal impacts at some point." }, { "start": 827, "end": 832, "text": " Not true. Some universities simply get money and academic freedom." }, { "start": 832, "end": 840, "text": " If that argument is possible, it is probably also possible to make a rigorous statement about some negative societal impacts." }, { "start": 840, "end": 844, "text": " You might be tempted to write boilerplate low information statements." }, { "start": 844, "end": 850, "text": " Don't do this. It will undermine the rigor in the rest of your paper." }, { "start": 850, "end": 856, "text": " The public will roll its eyes and reviewers may and often should call you out." }, { "start": 856, "end": 867, "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, "end": 883, "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, "end": 885, "text": " Because they're kind of the same, right?" }, { "start": 885, "end": 898, "text": " And they also say that this might spark a conversation is 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, "end": 909, "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": 909, "end": 921, "text": " And then 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": 921, "end": 928, "text": " Our proposal's view is that it's not your job as a reviewer to judge submissions for their impact." }, { "start": 928, "end": 933, "text": " Rather, you should evaluate the rigor with which they disclose their impacts." }, { "start": 933, "end": 936, "text": " So again, it's about putting work into it." }, { "start": 936, "end": 942, "text": " If you go to the full proposal behind this blog post, you'll find the following snippets." }, { "start": 942, "end": 950, "text": " So there is a list of expected outcomes of introducing such mandatory broader impact statements." }, { "start": 950, "end": 953, "text": " Now, have a look at this expected outcomes." }, { "start": 953, "end": 960, "text": " We expect that action on the above recommendations will lead to a number of desirable outcomes." }, { "start": 960, "end": 963, "text": " And they're all positive outcomes." }, { "start": 963, "end": 974, "text": " 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, "end": 990, "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, "end": 997, "text": " They go on to give a list of examples of how you could do such positive and negative aspects of technology." }, { "start": 997, "end": 1000, "text": " One of them is social media." }, { "start": 1000, "end": 1005, "text": " And I would agree that there are ethical considerations if you invent social media." }, { "start": 1005, "end": 1014, "text": " 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, "end": 1024, "text": " But it goes on. Crowdwork, a researcher who invents a new crowdwork framework, likely motivates her work by highlighting the problem the framework solves." }, { "start": 1024, "end": 1031, "text": " But they go on to say that crowdwork also has negative externalities, such as incentivizing very low pay." }, { "start": 1031, "end": 1044, "text": " And the researcher should find ways to engineer her crowdwork framework such that these externalities are structurally mitigated and or she might advocate for minimum wage laws to be adapted." }, { "start": 1044, "end": 1059, "text": " So this researcher working out a problem in crowdworking now has to basically solve millennia old problems in structural economics that have thousands of moving parts and no clear consensus on how to solve." }, { "start": 1059, "end": 1072, "text": " 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." }, { "start": 1072, "end": 1083, "text": " 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, "end": 1094, "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, "end": 1101, "text": " While allowing for impressive new capabilities, this trend also presents tremendous risks to privacy." }, { "start": 1101, "end": 1109, "text": " Researchers working in storage and GPU processing should consider these and other foreseeable potential risks in their papers." }, { "start": 1109, "end": 1123, "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, "end": 1136, "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, "end": 1142, "text": " And not only that, now you're also required to propose improvements to GDPR like policies." }, { "start": 1142, "end": 1157, "text": " 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." }, { "start": 1157, "end": 1163, "text": " How long does this chain of causality go? How do you have to think ahead? This gets ridiculous." }, { "start": 1163, "end": 1170, "text": " It's 200,000 BC and Nuno in his cave just invented fire." }, { "start": 1170, "end": 1187, "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, enable massive progress, industrialization," }, { "start": 1187, "end": 1203, "text": " 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 to serve you ads of better kitty stickers." }, { "start": 1203, "end": 1215, "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": 1215, "end": 1222, "text": " Look, I'm not saying that you should not consider the downstreams effect of your inventions. Of course you should." }, { "start": 1222, "end": 1227, "text": " But at some point it gets ridiculous for most of the work handed into a conference like NURIPS." }, { "start": 1227, "end": 1238, "text": " Either the downstreams effect are so far away that is almost impossible to foresee or as any technology you can use it for good and for bad." }, { "start": 1238, "end": 1246, "text": " 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, "end": 1253, "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." }, { "start": 1253, "end": 1263, "text": " 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, "end": 1275, "text": " Another release called A Guide to Writing the NURIPS Impact Statement that is not linked by NURIPS, but as they say was in communication with some of the organizers of the conference." }, { "start": 1275, "end": 1279, "text": " So it's reasonable to assume they also largely agree with these positions here." }, { "start": 1279, "end": 1292, "text": " Says you should discuss, read and reflect time permitting impact assessment will benefit from broad intellectual reflection, discuss potential impacts, follow public discussion, read case studies and read the scholarly literature." }, { "start": 1292, "end": 1295, "text": " On tech governance, of course, time permitting." }, { "start": 1295, "end": 1303, "text": " 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." }, { "start": 1303, "end": 1306, "text": " So maybe time must permit for this one." }, { "start": 1306, "end": 1310, "text": " And they again say, think about impacts even for theoretical work." }, { "start": 1310, "end": 1316, "text": " So the official communication always says that if you don't feel this applies to you, you're very free to write." }, { "start": 1316, "end": 1317, "text": " This doesn't apply to me." }, { "start": 1317, "end": 1322, "text": " But the in official communication says if this doesn't apply, you're doing something wrong." }, { "start": 1322, "end": 1328, "text": " And by the way, we're evaluate the rest of your paper based on the amount of work you put into that statement." }, { "start": 1328, "end": 1337, "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 here." }, { "start": 1337, "end": 1353, "text": " Pluribus, a superhuman AI for multiplayer poker, they say they 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." }, { "start": 1353, "end": 1357, "text": " This technology may be socially harmful or beneficial." }, { "start": 1357, "end": 1363, "text": " If access to this capability is mostly available to the wealthy, it could plausibly promote concentration of wealth." }, { "start": 1363, "end": 1369, "text": " And further on the other side, increased skill could increase total welfare." }, { "start": 1369, "end": 1374, "text": " Gee, if that doesn't apply to every single technology ever, I don't know." }, { "start": 1374, "end": 1381, "text": " Again, my general assessment of this is not that it is absolutely wrong to do this or very useless." }, { "start": 1381, "end": 1389, "text": " It is just shifting the balance a bit more on to large institutions who can actually afford to spend a lot of time and work into crafting beautiful statements." }, { "start": 1389, "end": 1398, "text": " And 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": 1398, "end": 1400, "text": " I guess we'll see how it turns out." }, { "start": 1400, "end": 1409, "text": " In this VentureBeat article, they link someone named Joe Redmond saying, I stopped doing CV research because I saw the impact my work was having." }, { "start": 1409, "end": 1416, "text": " I love the work, but the military applications and privacy concerns eventually became impossible to ignore, which I respect a lot." }, { "start": 1416, "end": 1424, "text": " But I would ask, did Joe Redmond realize this after being forced to write a broader impact statement or at some other point?" }, { "start": 1424, "end": 1426, "text": " That was my two cents." }, { "start": 1426, "end": 1448, "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." } ]
IIebBjbBevs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
When BERT Plays the Lottery, All Tickets Are Winning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "bert", "nlp", "lottery ticket", "good", "bad", "winning", "pruning", "weights", "attention", "transformer", "heads", "multi-head", "fine-tuning", "glue", "benchmark" ]
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 Sy, Prasanna, Anna Rogers and Anna Rumschiski. 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 fine tune BERT on different downstream tasks, then the lottery ticket winners you're going to find are different between the tasks. And also the claim 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 sub network. So that was the high level overview for those of you 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 sentence. So a vector embedding of it. We'll 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. So that is basically BERT fine tuning on different tasks. And there is 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 the notable difference here, too, let's say a computer vision, like an ImageNet 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 going to draw them like this. And at the end, right, I can classify it into like 10 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 is 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 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 BERT in terms of this lottery ticket hypothesis. Now it's a bit more complicated than just in these feed forward networks because BERT is not a feed forward network. BERT 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 BERT and it goes, the signal goes like this. So each layer consists of two things. First of all, of many attention heads, that's called. Now I'm going to draw these as blocks right here. So four, let's call them four 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 feed 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, four of these and then one of these and so on with the skip connection. All right. So the pruning in BERT is different than pruning in the feed forward or convolutional layer that we looked at. Pruning in BERT 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. This 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 things you can do. You can leave away heads or you can leave away entire MLPs or 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 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? That uses less memory and 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 cut out one weight here or one weight here, 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 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 BERT, 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 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 I were an author and I say I want to look at BERT 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, they're supposed 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 whole entire module level. Okay, so this was BERT 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 NLP is due to the large transformer based models such as BERT. 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 BERT 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 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, 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 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 BERT 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 parts of the network that have low scores for pruning and we retrain those then we can achieve a good performance. So further they say we also show that the good sub networks vary considerably across glue tasks. This is this benchmark opening up the possibilities to learn what knowledge BERT actually uses at inference time. Alright so 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 some sort of here was 100% accuracy and here was how much you prune. Of course you start at 100% if you prune nothing but then as you prune the interesting thing is it kind of goes up and then it goes down. So this is the first thing here it goes up to a certain amount 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 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 I'm pretty sure this just goes down here and not up first. So qualitatively it seems different. Alright so here they introduce what they do again ERT is made up of these attention heads and MLPs. 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 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 they are 0 the layers or the head is basically inactive, no propagation. If they are 1 they are active. And they determine what value to set them to by computing important scores. Basically determining how important is a head or a layer for the network. And that's pretty simple. You simply take the gradient of the loss. I think they go after this paper right here that's supposed to be the following. You derive the loss 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. So they here determine 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 tune the full model on this task and then they set themselves a budget of 90% and they simply prune until the model reaches 90%. Once it goes lower they stop. So they have three methods of pruning. One is heads only where they only cut away 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. Then 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%. Then we continue pruning heads alone and then MLPs alone. This I guess until again they are no longer in the 90% so until they reach their budget. 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 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. This strategy seems to be the viable strategy here. A last thing here is fine tuning. So the other difference between this paper and the lottery ticket hypothesis is that we said that in the original paper here these are randomly initialized weights. Like you train a class for an ImageNet or something, you start from randomly initialized weights and the lottery ticket papers 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-train with masked language modeling first and then second you train the entire thing. Let's skip the color here. 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 authors say that since we trained with masked language modeling and people sort of claim 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 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. Alright, 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, 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 BERT, they fine tune it on these nine tasks and for each of the nine tasks they determine the winning tickets. 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, red on red, this head right here survives in seven out of the nine tasks. So it should be fairly, it should probably encode something fairly substantial about language that is shared across these seven tasks. 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, that one's 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 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 the 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, it's darker than here. So on the right side more stuff survives but also you have more things to prune, right? You can prune the heads and the MLPs. And they claim before that the masking heads and MLP strategy results in more things being pruned which 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 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 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 measure. But it just seems 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... This is cut off. Haha. Yeah this is annoying. This is like trying to get LoTeC to do things and it doesn't comply. Alright so what you can... Another thing you can see in 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 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 pruned because the signal travels this way. So 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 falls up on a study by this that showed that only a few transformer heads in machine translation tasks did the heavy lifting while the rest could be pruned. And this paper similarly showed that most of BERT 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 is 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 are the good self-nerve works and they basically look at these kinds of graphs right here which are pretty interesting. So we've got 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 QNLI a head survives it gets a 1 here and if it doesn't survive it gets a 0. So on average 85 out of the 144 heads survive right 85 heads survive. 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 percent 85 of the 144 heads survive. Now they look at the other tasks so for QNLI they would look at maybe MNLI task here and ask which of the heads that survived in QNLI also survives in MNLI. So that gets you the shared heads and again the lower numbers is standard deviation. So 62 heads survive in QNLI and MNLI 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 linguistic knowledge. So different linguistic knowledge could be relevant 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, these tasks don't really have much in common. So they do this for the heads and the MLPs here. Now 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 prune just about anything away on these MLPs because they have the skip connections you don't need them to predict 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 survived 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. So they make this sort of statement again here that the good sub network have little in common and it might seem like that for the figure initially. But if you look at this figure it actually shows 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 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 7 times 7 is whatever 49. Let's go 7 times 8 about this so that's 5, 6. Do I need to get out the calculator? I want to do this calculator. I'm going to 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? I probably did it wrong. 78 times 74 divided by 144. Alright 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 sort of I mean 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 it's sort of an investigation into why we see considerable difference between tasks here in terms of that. So these numbers are always over what you would assume for independence. That seems to be pretty interesting. Alright so they say they here go into this figure two and this pairwise comparison and they analyze a couple of the different tasks here and what you would expect and I don't want to go too much into these tasks because honestly 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. Alright the last thing they do right here is the good and the bad subnetworks in BERT fine tuning. So they say our final experiment puts the above evidence of good subnetworks in BERT fine tuned from the perspective of lottery ticket hypothesis which predicts that the lucky subnetworks can be retrained from scratch to match the performance of the full network. To test this hypothesis we experiment with the following subnetworks. 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 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 importance scores as described 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. Then they're also going to evaluate bad subnetworks. The elements sampled from those that did not survive the pruning plus a random sample of elements with high importance score so as to match the size of the good subnetworks. So because the good subnetworks are 50% or more of the network they want to sample from the things that did not survive so from the bad ones and they plus a random sample of the good subnetworks to just match the size. 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 subnetworks. Simple inversion of the good subnetworks. So these would be just anything but the good. They are 5 to 18% smaller in size than the sampled bad subnetworks but they do not contain any elements with high importance 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 subnetwork 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 highest probability class. This is the, like this is sort of the idiot's baseline. Okay. This here is the full model. This here is the good pruned and this here is the good after it's retrained again. Okay. So you see by retraining you can basically gain. Now 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 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 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 Matthews correlation and not the accuracy. So the score is a bit different there. But you can see here the good plus bad also gets a fairly high accuracy. So the authors claim this is pretty 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 a part of and I would like to show you this right here when I ask them this question. Another question from Reddit, Imnemo 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 that was not 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 us take the MNIST example. So suppose that we find a winning ticket on MNIST. It is going to be about 3% of the original size of the network. So that means that if you remove it you still get 97% of the weights left. And so my guess is that if you were to train those 97% of weights you will get to the same accuracy as you got with 100% of weights because you have barely pruned the network at all. You could randomly prune by 3% and it would not affect it. And then you could go and find another lottery ticket that is mutually exclusive with the first. You still have 94% of the weights and you could probably iterate this for a very long time. You could probably this way find 10, 15 lottery tickets like this, maybe more, that are all mutually exclusive and still leave you with a remaining 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 is left is large enough that I am sure there is another lottery ticket in there and another lottery ticket in there and so on and so on and so on. So it is 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 just find more lottery tickets. You can even probably, I am guessing, swap out one weight from a lottery ticket with another weight and it would not matter or swap out a handful of weights. And so combinatorially the number of lottery tickets is massive and we are 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 is left is only 50%. So this is substantially different. Now two things I have to remark here. First of all, because we are pruning modules and not individual weights for the good one, it is the reason that we do get these big winning tickets, right? But also what I think is happening is that because we are pruning these entire modules we are actually not fine-grained enough. So that means every time we eliminate a module we actually kill some good ones and some bad ones. So in here I am going to guess there are some good ones and there are some bad ones. But since we can only kill entire modules, we sort of, we simply kill the one that on average has the most good ones. But I am guessing that in the thing we kill there are simply, 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 believe the original lottery ticket hypothesis that means that these, actually these very few weights in those modules can still train to full accuracy. So actually 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 a very small subset of them, the original hypothesis 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 is kind of the first thing. And the second thing, in general, you heard Jonathan, I do not 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. It simply says something about the winning ticket. It does not say anything about the non-winning ticket. So those are the two comments. And I think the question and the investigation, even though it is interesting, I think it is sort of maybe not thought through, at least in the perspective of what they go for here. 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 could not train them. And then they say it is surprising that you can. But I would say that the original hypothesis would in fact predict that you could train those things because you have pruned away these entire modules, which is very coarse-grained and 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 for many tasks. 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 is the task we looked at because they claim that is so small, which makes sense, right? So discussion. Say, does BERT have bad subnetworks? The key result of this study is that as far as fine-tuning is concerned, BERT does not seem to have bad subnetworks that cannot be retrained to relatively good performance level, suggesting that the weight that do not survive pruning are not just inactive. However, it is important to remember that we consider elements of BERT architecture as atomic units, while the original lottery ticket work relied on magnitude pruning of individual weights. So they're well aware here of these differences, and they can see which, and they can see to that right here. So that's good. On that level, BERT probably does have bad subnetworks, and they show that can be found in the transformer model with global iterative pruning. We'll leave it to future research to find out to what extent the effective subnetworks overlap with the effective architectural blocks, and what that says about the architecture of BERT and the other transformers. So as you see, they're well aware that all of what I said is the case. So 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 light of which a reader goes through it is just a bit such that you come off, if you don't read until here, you come off thinking something else. Our results suggest that most architecture blocks of BERT 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. 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 BERT components do in the different things. So again, I think this work here is actually most relevant for investigating this question, what do BERT components, the different BERT components do for the different tasks, to look which tasks use which things. And the actual recognition that none of these modules is useless, I would consider pretty pretty cool finding. Okay, so in conclusion, they say prior work shows that it was possible to prune most self-attention ads. We extend this to the fully connected layers. We show fine tune purses good and bad top networks, where the good heads and MOPs 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 tuned separately to reach comparable performance. We also show that 86% of heads and 57% of MOPs and good sub networks are not universally useful. Cross-glue tasks and overlap between good and sub networks do not necessarily correspond to task types. So that's where we didn't go into. This raises questions about the degree to which fine tune BERT relies on task specific or general linguistic knowledge and opens up the possibility of studying the good sub networks to see what types of knowledge BERT 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, "end": 5.5600000000000005, "text": " Hi there. Today we're looking at when BERT plays the lottery. All tickets are winning" }, { "start": 5.5600000000000005, "end": 12.68, "text": " by Sy, Prasanna, Anna Rogers and Anna Rumschiski. So a high level overview of this paper is" }, { "start": 12.68, "end": 18.92, "text": " the following. The paper basically looks at BERT in terms of the lottery ticket hypothesis" }, { "start": 18.92, "end": 26.68, "text": " and it says that if you fine tune BERT on different downstream tasks, then the lottery" }, { "start": 26.68, "end": 34.56, "text": " ticket winners you're going to find are different between the tasks. And also the claim all" }, { "start": 34.56, "end": 40.6, "text": " tickets are winning refers to the fact that if you remove the winning tickets, then you" }, { "start": 40.6, "end": 47.32, "text": " can still train the rest to relatively good performance. Therefore, all tickets are winning," }, { "start": 47.32, "end": 54.4, "text": " not just the sub network. So that was the high level overview for those of you who just" }, { "start": 54.4, "end": 59.28, "text": " want to be interested, if you want to continue watching this video. If you do like videos" }, { "start": 59.28, "end": 66.68, "text": " like this, consider sharing, liking, subscribing, telling your mother, father, brother and friends" }, { "start": 66.68, "end": 74.36, "text": " about it. Alright, let's dive in. So BERT, it is a language model. Basically, if you" }, { "start": 74.36, "end": 78.64, "text": " don't know what BERT is, I've done a video on BERT, but really quickly, what you can" }, { "start": 78.64, "end": 85, "text": " do with BERT is you can take a sentence, something like hello there, and you can put it through" }, { "start": 85, "end": 91.32, "text": " this multi-layer neural network. And what you'll get out is basically an embedding of" }, { "start": 91.32, "end": 101.84, "text": " that sentence. So a vector embedding of it. We'll make it really easy. And what is usually" }, { "start": 101.84, "end": 107.24000000000001, "text": " done is this is pre-trained on a task called masked language modeling. This is unsupervised" }, { "start": 107.24, "end": 112.67999999999999, "text": " training. And then you take this embedding and you fine tune. Basically, you put on a" }, { "start": 112.67999999999999, "end": 118.67999999999999, "text": " classifier head. Basically, say, let's take sentiment classification. So you have two" }, { "start": 118.67999999999999, "end": 126.25999999999999, "text": " output classes. And you want to say, is this sentence I put in positive or negative sentiment?" }, { "start": 126.25999999999999, "end": 133.07999999999998, "text": " So you would train this classifier by basically taking this part from the pre-trained masked" }, { "start": 133.08, "end": 139.56, "text": " language modeling and then training the part here that does the sentiment classification." }, { "start": 139.56, "end": 146.42000000000002, "text": " You would sort of add that on top and then fine tune the entire network to solve this" }, { "start": 146.42000000000002, "end": 154, "text": " task. So that is basically BERT fine tuning on different tasks. And there is this benchmark" }, { "start": 154, "end": 161, "text": " called GLUE, where it has a number of tasks. In this case, I think they look at nine tasks" }, { "start": 161, "end": 168.24, "text": " of GLUE. It has nine of these tasks. One is the, an example is the sentiment classification." }, { "start": 168.24, "end": 174.4, "text": " And it basically gets a score for each one. And thereby, you can sort of estimate how" }, { "start": 174.4, "end": 179.92000000000002, "text": " good your language model is by how well it is performing on each of those individual" }, { "start": 179.92000000000002, "end": 186.28, "text": " tasks. But the notable difference here, too, let's say a computer vision, like an ImageNet" }, { "start": 186.28, "end": 192.16, "text": " classifier is the fact that first it is pre-trained, right? This part here is pre-trained on a" }, { "start": 192.16, "end": 202.04, "text": " large corpus. And second, there are different downstream tasks that you fine tune on. So" }, { "start": 202.04, "end": 208.44, "text": " the second part that is important is the lottery ticket hypothesis. So I've also done a video" }, { "start": 208.44, "end": 215.4, "text": " on the lottery ticket hypothesis. And if you very quickly what the lottery ticket hypothesis" }, { "start": 215.4, "end": 221.8, "text": " is the following. So let's say you have an image classifier. And I have a bunch of layers" }, { "start": 221.8, "end": 228.22, "text": " in my neural network. I'm going to draw them like this. And at the end, right, I can classify" }, { "start": 228.22, "end": 234.72, "text": " it into like 10 different or a thousand different classes, whatever. And the input here is an" }, { "start": 234.72, "end": 240.64000000000001, "text": " image. So my neural network is going to have weights. So every one of these neurons is" }, { "start": 240.64, "end": 246.73999999999998, "text": " connected to each other. Now this can be a convolutional network or a MLP. So all is" }, { "start": 246.73999999999998, "end": 253.11999999999998, "text": " connected to all and as well here, right, everything is connected to pretty much everything." }, { "start": 253.11999999999998, "end": 260.64, "text": " So we know, first of all, we know that we can train these big networks to relatively" }, { "start": 260.64, "end": 268.2, "text": " good accuracy. And then second of all, so first, we can train them. Second, we know" }, { "start": 268.2, "end": 274.96, "text": " we can prune them after training. What pruning means is the fact that after I have trained" }, { "start": 274.96, "end": 279.84, "text": " such a thing, I can then go and I can figure out which one which of these connections that" }, { "start": 279.84, "end": 285.71999999999997, "text": " I have learned are the important ones. And maybe I'll say, ah, these these here, actually" }, { "start": 285.71999999999997, "end": 291.96, "text": " these these five, I don't need more than those. Let's actually connect them to the end. These" }, { "start": 291.96, "end": 296.8, "text": " seven or so. I don't need all of the other ones. I just need those. And I can pretty" }, { "start": 296.8, "end": 302.68, "text": " much get the same accuracy as the full network. Now, the important part here is that you can" }, { "start": 302.68, "end": 308.44, "text": " only do pruning after you've trained a network. If you try to prune at the beginning, it doesn't" }, { "start": 308.44, "end": 314.76, "text": " work. So what the lottery ticket hypothesis says is basically, so how does training work?" }, { "start": 314.76, "end": 318.88, "text": " First you have your parameters. Let's let's tell them as a list. So each of these weights" }, { "start": 318.88, "end": 328.96, "text": " is an entry in the list here. First, you initialize these randomly, then through training, training," }, { "start": 328.96, "end": 337.2, "text": " you get to your train state, right? You get each of the ones into your these are now trained." }, { "start": 337.2, "end": 343.24, "text": " And in the train state, you can select the ones you think are important. The lottery" }, { "start": 343.24, "end": 349.40000000000003, "text": " ticket hypothesis says if I take those that are important and basically go back to the" }, { "start": 349.40000000000003, "end": 357.64, "text": " beginning, like here, here, and here, and I basically roll them back to that state that" }, { "start": 357.64, "end": 362.76, "text": " they were in when they were initialized. So I put the same random number there that I" }, { "start": 362.76, "end": 371.24, "text": " got at initialization. I can then make a network where I only have those. I can train that" }, { "start": 371.24, "end": 379.72, "text": " network and I can get a good accuracy. So this basically wasn't possible in the pruning" }, { "start": 379.72, "end": 385.68, "text": " framework because we said we can't prune, we can only prune after training because only" }, { "start": 385.68, "end": 390.72, "text": " then do we know which ones are the important ones. In fact, the lottery ticket hypothesis" }, { "start": 390.72, "end": 396.36, "text": " or the paper shows that you can train the smaller neural network from the beginning," }, { "start": 396.36, "end": 401.64, "text": " but the catch of course is you have to know which ones those are and you have to know" }, { "start": 401.64, "end": 406.44, "text": " what value to set them on at the beginning. And you only know that after you've trained" }, { "start": 406.44, "end": 413.40000000000003, "text": " the full network. But still it kind of gives the, it tells you that you don't need all" }, { "start": 413.40000000000003, "end": 419.68, "text": " these connections for training. You basically only need so many connections such that somewhere" }, { "start": 419.68, "end": 423.52000000000004, "text": " in there, there's going to be the good ones, right? And if you knew the good ones from" }, { "start": 423.52, "end": 429.96, "text": " the beginning, you could just train those and then only train the smaller sub network." }, { "start": 429.96, "end": 435.28, "text": " So that's the lottery ticket hypothesis. Naturally these connections here, this small network" }, { "start": 435.28, "end": 442.4, "text": " is called the winning, a winning ticket because if you knew what it was, you could basically" }, { "start": 442.4, "end": 448.64, "text": " train a much smaller network and reach the same accuracy. So this paper looks at BERT" }, { "start": 448.64, "end": 454.12, "text": " in terms of this lottery ticket hypothesis. Now it's a bit more complicated than just" }, { "start": 454.12, "end": 459.74, "text": " in these feed forward networks because BERT is not a feed forward network. BERT is a transformer." }, { "start": 459.74, "end": 466.08, "text": " So what does that mean? A transformer consists of many layers and each layer, let's expand" }, { "start": 466.08, "end": 474.96, "text": " the layer here. So each layer consists of, let's go over there, need some space. So again," }, { "start": 474.96, "end": 481.28, "text": " we have our layers of BERT and it goes, the signal goes like this. So each layer consists" }, { "start": 481.28, "end": 487.84, "text": " of two things. First of all, of many attention heads, that's called. Now I'm going to draw" }, { "start": 487.84, "end": 493.12, "text": " these as blocks right here. So four, let's call them four attention heads. Individual" }, { "start": 493.12, "end": 499.08, "text": " attention heads are all parameterized by individual matrices. And then on top of that, there is" }, { "start": 499.08, "end": 505.68, "text": " an MLP. So this is the multi-layer perceptron. This is one, basically a feed forward layer," }, { "start": 505.68, "end": 512.8, "text": " residual actually. And so there is a skip connection right here. And these are the attention" }, { "start": 512.8, "end": 520.36, "text": " heads. Okay. And then the next layer would again have the same structure, four of these" }, { "start": 520.36, "end": 528.76, "text": " and then one of these and so on with the skip connection. All right. So the pruning in BERT" }, { "start": 528.76, "end": 533.96, "text": " is different than pruning in the feed forward or convolutional layer that we looked at." }, { "start": 533.96, "end": 540.2, "text": " Pruning in BERT to what this paper looks at is pruning either an entire attention head" }, { "start": 540.2, "end": 546.68, "text": " like this. So kind of leaving out in the entire head away, which is, this is an entire matrix." }, { "start": 546.68, "end": 552.3199999999999, "text": " This is not a single weight, right? This is many, many weights or even more drastically" }, { "start": 552.3199999999999, "end": 558.48, "text": " leaving away an entire MLP and basically only relying on the skip connection. All right." }, { "start": 558.48, "end": 565.12, "text": " So this, you have these two things you can do. You can leave away heads or you can leave" }, { "start": 565.12, "end": 571.66, "text": " away entire MLPs or you can combine these things in some way. Right. So the notable" }, { "start": 571.66, "end": 579.5600000000001, "text": " difference here to the lottery ticket hypothesis pruning is the fact that here over up here," }, { "start": 579.5600000000001, "end": 587.9200000000001, "text": " what we prune are connections. So prune connections, individual connections, individual connections." }, { "start": 587.92, "end": 597.64, "text": " And here we prune entire modules. Now this is a, in my opinion, this is a qualitative" }, { "start": 597.64, "end": 604.5999999999999, "text": " difference, a very large qualitative difference actually. Why would you do this? So this paper" }, { "start": 604.5999999999999, "end": 610.92, "text": " basically doesn't invent this kind of pruning. They go after already existing literature." }, { "start": 610.92, "end": 615.9399999999999, "text": " So what's the advantage in pruning modules? Well, you have to see what's the advantage" }, { "start": 615.94, "end": 622.8800000000001, "text": " in pruning per se. So in pruning, what you're trying to do is obtain a smaller network that" }, { "start": 622.8800000000001, "end": 629.2, "text": " gives you the same accuracy, but that you can run faster, right? That uses less memory" }, { "start": 629.2, "end": 636.32, "text": " and you can run it faster. And if you prune like this, like we did in the lottery ticket" }, { "start": 636.32, "end": 640.6400000000001, "text": " hypothesis paper, you don't really gain anything because if you have a matrix, if you have" }, { "start": 640.64, "end": 649.72, "text": " a matrix, matrix multiply, right? I have two matrices and I multiply them right here. If" }, { "start": 649.72, "end": 655.72, "text": " I cut out one weight here or one weight here, it doesn't help me because I have GPUs and" }, { "start": 655.72, "end": 662.86, "text": " those will parallelize these matrix procedures. And it doesn't really help me because we don't" }, { "start": 662.86, "end": 669.2, "text": " really have good hardware for sparse or matrix, matrix multiplication or matrix, matrix multiplication" }, { "start": 669.2, "end": 674.5200000000001, "text": " with holes or things like this. So it almost gains me nothing. The lottery ticket hypothesis" }, { "start": 674.5200000000001, "end": 683.6400000000001, "text": " paper is very much a kind of more of a scientific curiosity paper. And once we have sparse matrix" }, { "start": 683.6400000000001, "end": 690.48, "text": " multiply hardware, which I think already exists, but is not super widely distributed, once" }, { "start": 690.48, "end": 696, "text": " we have that, we will be able to make use of this. Whereas the people that prune BERT," }, { "start": 696, "end": 702.16, "text": " so these are more, let's say, industry people. If you prune an entire module, well, that's" }, { "start": 702.16, "end": 708.88, "text": " an entire matrix that falls away. So I have to, I can basically save an entire matrix," }, { "start": 708.88, "end": 715.52, "text": " matrix multiply in the forward pass here and the backward pass. Well, okay, I don't prune" }, { "start": 715.52, "end": 721.38, "text": " during training, but I can basically save an entire matrix multiply here by pruning" }, { "start": 721.38, "end": 728.76, "text": " an entire module. So I'm not sure if I were an author and I say I want to look at BERT" }, { "start": 728.76, "end": 734.36, "text": " in terms of the lottery ticket hypothesis, I would find a way, I would go away from this" }, { "start": 734.36, "end": 739.16, "text": " literature and find a way to also just prune here individual weights. It's not going to" }, { "start": 739.16, "end": 745.36, "text": " be faster, but the lottery ticket investigations aren't supposed to be faster, they're supposed" }, { "start": 745.36, "end": 751.36, "text": " to tell you something about the nature of the things you're investigating. And of course" }, { "start": 751.36, "end": 759.48, "text": " how you do this is simply by masking, right? You simply force these entries to be zero" }, { "start": 759.48, "end": 764.6800000000001, "text": " and therefore you don't have forward signal, you don't have gradient. Interestingly, they" }, { "start": 764.6800000000001, "end": 770.24, "text": " actually do the masking, but they do it on the whole entire module level. Okay, so this" }, { "start": 770.24, "end": 775.96, "text": " was BERT and the lottery ticket hypothesis and the all tickets are winning, we're going" }, { "start": 775.96, "end": 782.72, "text": " to investigate later. Let's see what they say in the abstract. Say much of the recent" }, { "start": 782.72, "end": 788.84, "text": " success in NLP is due to the large transformer based models such as BERT. Okay, they say" }, { "start": 788.84, "end": 793.48, "text": " however these models have been shown to be reducible to a smaller number of self-attention" }, { "start": 793.48, "end": 799.24, "text": " heads and layers. So this would be pruning. We consider this phenomenon from the perspective" }, { "start": 799.24, "end": 804, "text": " of the lottery ticket hypothesis. For fine-tuned BERT we show that, here's the contributions," }, { "start": 804, "end": 810.4, "text": " A, it is possible to find a sub network of elements that achieves performance comparable" }, { "start": 810.4, "end": 815.32, "text": " with that of the full model. So basically this is the pruning objective, right? You" }, { "start": 815.32, "end": 820.56, "text": " want to prune it such that the performance holds and in terms of the lottery ticket hypothesis" }, { "start": 820.56, "end": 826.76, "text": " you want to prune, reset to the beginning and then also and then train again and that" }, { "start": 826.76, "end": 833.48, "text": " will give you, actually in the lottery ticket hypothesis you can gain performance if you" }, { "start": 833.48, "end": 843.9200000000001, "text": " prune by a certain amount. In this case here they always lose performance but yeah. So" }, { "start": 843.9200000000001, "end": 850.08, "text": " second of all similarly sized sub networks sampled from the rest of the model so the" }, { "start": 850.08, "end": 859.2, "text": " non-winning ticket perform worse. So if you just prune away the good parts then the bad" }, { "start": 859.2, "end": 867.44, "text": " parts perform worse of course. However the bad sub networks can be fine-tuned separately" }, { "start": 867.44, "end": 873.6600000000001, "text": " to achieve only slightly worse performance than the good ones indicating that most weights" }, { "start": 873.6600000000001, "end": 880.6800000000001, "text": " in the pre-trained BERT are potentially useful. So this is interesting. If they be fine-tuned" }, { "start": 880.6800000000001, "end": 886.2, "text": " separately this is exactly what the lottery ticket hypothesis is doing, right? It's basically" }, { "start": 886.2, "end": 893.8000000000001, "text": " fine-tuning only a sub part of the network and here they say even if we take the parts" }, { "start": 893.8000000000001, "end": 902.48, "text": " of the network that have low scores for pruning and we retrain those then we can achieve a" }, { "start": 902.48, "end": 911.7, "text": " good performance. So further they say we also show that the good sub networks vary considerably" }, { "start": 911.7, "end": 917.6800000000001, "text": " across glue tasks. This is this benchmark opening up the possibilities to learn what" }, { "start": 917.6800000000001, "end": 926.12, "text": " knowledge BERT actually uses at inference time. Alright so this is the overview of the" }, { "start": 926.12, "end": 932.88, "text": " paper. So a last thing to say which I've already kind of alluded to is the fact that in the" }, { "start": 932.88, "end": 938.48, "text": " original lottery ticket hypothesis as I said you had a graph and you had some sort of here" }, { "start": 938.48, "end": 945.16, "text": " was 100% accuracy and here was how much you prune. Of course you start at 100% if you" }, { "start": 945.16, "end": 950.88, "text": " prune nothing but then as you prune the interesting thing is it kind of goes up and then it goes" }, { "start": 950.88, "end": 958, "text": " down. So this is the first thing here it goes up to a certain amount if you don't prune" }, { "start": 958, "end": 964.5, "text": " and in the original lottery ticket hypothesis here somewhere here would be 50% of the network" }, { "start": 964.5, "end": 972.56, "text": " I think. And then once you go down let's say here to 90% of performance you are at something" }, { "start": 972.56, "end": 980.8, "text": " like 5% of the network size or 3%. So you can prune away most things and still be like" }, { "start": 980.8, "end": 988.2, "text": " extremely extremely powerful. Now we're going to see what these essentially what these people" }, { "start": 988.2, "end": 996.12, "text": " do here is here is 100% and they simply prune until they reach 90%. So we don't necessarily" }, { "start": 996.12, "end": 1002.8000000000001, "text": " know what happens in the middle we just know they start here and somehow they get to 90%" }, { "start": 1002.8000000000001, "end": 1009.3000000000001, "text": " and what they end up with is something like 50% of the network still remaining. So again" }, { "start": 1009.3000000000001, "end": 1015.4000000000001, "text": " see the qualitative difference here between the 5% of the lottery tickets in the original" }, { "start": 1015.4, "end": 1022.24, "text": " paper and the 50-ish or so percent or considerable amount more in this paper right here and I'm" }, { "start": 1022.24, "end": 1028.16, "text": " pretty sure that is due to the fact that they prune entire modules here so they don't prune" }, { "start": 1028.16, "end": 1035.16, "text": " on a fine-grained enough level to investigate these phenomenon because as I said we don't" }, { "start": 1035.16, "end": 1041.92, "text": " know but I'm pretty sure this just goes down here and not up first. So qualitatively it" }, { "start": 1041.92, "end": 1052.88, "text": " seems different. Alright so here they introduce what they do again ERT is made up of these" }, { "start": 1052.88, "end": 1059.76, "text": " attention heads and MLPs. The MLPs have a skip connection as you can see here and the" }, { "start": 1059.76, "end": 1066, "text": " attention head attention layers are basically made up each of N of these attention heads." }, { "start": 1066, "end": 1072.36, "text": " What they will do is they will look at 12 layer networks. Each layer will have 12 of" }, { "start": 1072.36, "end": 1080.84, "text": " these attention heads and one of the MLPs. So you have in total 144 heads and 12 MLP" }, { "start": 1080.84, "end": 1086.8, "text": " layers. The way they determine which ones to prune is pretty easy. In front of each" }, { "start": 1086.8, "end": 1093.52, "text": " attention head and in front of each MLP they put one of these binary variables right here." }, { "start": 1093.52, "end": 1101.48, "text": " These variables can take values 0 or 1. If they are 0 the layers or the head is basically" }, { "start": 1101.48, "end": 1108.36, "text": " inactive, no propagation. If they are 1 they are active. And they determine what value" }, { "start": 1108.36, "end": 1114.4, "text": " to set them to by computing important scores. Basically determining how important is a head" }, { "start": 1114.4, "end": 1120.12, "text": " or a layer for the network. And that's pretty simple. You simply take the gradient of the" }, { "start": 1120.12, "end": 1127.36, "text": " loss. I think they go after this paper right here that's supposed to be the following." }, { "start": 1127.36, "end": 1134.52, "text": " You derive the loss by these variables right here and therefore you get these important" }, { "start": 1134.52, "end": 1140.08, "text": " scores. And then you can simply prune the layers with the lowest important scores because" }, { "start": 1140.08, "end": 1145.4799999999998, "text": " that means that the gradient with respect to them is the smallest. That means your loss" }, { "start": 1145.48, "end": 1158.2, "text": " changes the least if you were to leave them away. So they here determine their pruning" }, { "start": 1158.2, "end": 1165.68, "text": " strategy. Their constraint here is as I said 90% of the performance of the full model." }, { "start": 1165.68, "end": 1172.76, "text": " So they train the full model, fine tune the full model on this task and then they set" }, { "start": 1172.76, "end": 1179.68, "text": " themselves a budget of 90% and they simply prune until the model reaches 90%. Once it" }, { "start": 1179.68, "end": 1187.92, "text": " goes lower they stop. So they have three methods of pruning. One is heads only where they only" }, { "start": 1187.92, "end": 1195.04, "text": " cut away these attention heads. As I said there are 144 of them. They have the pruning" }, { "start": 1195.04, "end": 1201.16, "text": " strategy of MLPs only where they only prune the MLPs, leave all the attention heads alone." }, { "start": 1201.16, "end": 1208.3600000000001, "text": " Then they have this heads and MLPs. They say we compute head and MLP important scores in" }, { "start": 1208.3600000000001, "end": 1215.44, "text": " a single backward pass, pruning 10% heads and one MLP with the smallest scores until" }, { "start": 1215.44, "end": 1224, "text": " the performance on the dev set is within 90%. Then we continue pruning heads alone and then" }, { "start": 1224, "end": 1231.6, "text": " MLPs alone. This I guess until again they are no longer in the 90% so until they reach" }, { "start": 1231.6, "end": 1238.64, "text": " their budget. So this is a combined strategy. This strategy results in a larger number of" }, { "start": 1238.64, "end": 1245.28, "text": " total components pruned within our performance threshold. So this is the thing we should" }, { "start": 1245.28, "end": 1249.96, "text": " focus on right because in pruning the name of the game is how much can you take away" }, { "start": 1249.96, "end": 1260.28, "text": " and still be within your budget. This strategy seems to be the viable strategy here." }, { "start": 1260.28, "end": 1268.32, "text": " A last thing here is fine tuning. So the other difference between this paper and the lottery" }, { "start": 1268.32, "end": 1275.96, "text": " ticket hypothesis is that we said that in the original paper here these are randomly" }, { "start": 1275.96, "end": 1279.88, "text": " initialized weights. Like you train a class for an ImageNet or something, you start from" }, { "start": 1279.88, "end": 1286.52, "text": " randomly initialized weights and the lottery ticket papers they all kind of presuppose" }, { "start": 1286.52, "end": 1292.1200000000001, "text": " random initializations. Whereas BERT, when you do the same thing for BERT, these are" }, { "start": 1292.1200000000001, "end": 1300, "text": " not random initializations. We said in BERT what you usually do is you train the encoder" }, { "start": 1300, "end": 1307.16, "text": " part here. You pre-train with masked language modeling first and then second you train the" }, { "start": 1307.16, "end": 1314.76, "text": " entire thing. Let's skip the color here. Second you train the entire thing. You fine tune" }, { "start": 1314.76, "end": 1325.52, "text": " the entire thing. So if we talk about initializations in the BERT task then the initialization would" }, { "start": 1325.52, "end": 1331.2, "text": " be at this point right here after the masked language modeling would be the initialization." }, { "start": 1331.2, "end": 1338.2, "text": " So the weights are not random. The weights are actually pre-trained on the masked language" }, { "start": 1338.2, "end": 1345.72, "text": " modeling task which is also a qualitative difference and sort of lets us inspect. So" }, { "start": 1345.72, "end": 1352.44, "text": " the authors say that since we trained with masked language modeling and people sort of" }, { "start": 1352.44, "end": 1358.76, "text": " claim that masked language modeling learned something about the language, we can now investigate" }, { "start": 1358.76, "end": 1366.72, "text": " kind of which attention heads, which modules in BERT are encoding which parts of the language." }, { "start": 1366.72, "end": 1371.8, "text": " And this is going to be interesting once we look at which attention heads and which modules" }, { "start": 1371.8, "end": 1377.96, "text": " survive in the individual tasks, we can sort of compare tasks across each other by seeing" }, { "start": 1377.96, "end": 1385.64, "text": " which of the heads they share in their winning tickets. Alright, so they produce these graphs" }, { "start": 1385.64, "end": 1390.2, "text": " here. These are sort of one of the central graphs here and the way to read this is on" }, { "start": 1390.2, "end": 1399.48, "text": " the left side here you have the layer, you have the layer index and on the x-axis you" }, { "start": 1399.48, "end": 1406.88, "text": " simply have the index of the head. There are 144 boxes here. Each one corresponds to one" }, { "start": 1406.88, "end": 1414.2, "text": " of the attention heads. The top number is always the mean number of glue tasks that" }, { "start": 1414.2, "end": 1420.3600000000001, "text": " this head survived in. So what they do is they take the pre-trained BERT, they fine" }, { "start": 1420.3600000000001, "end": 1426.1200000000001, "text": " tune it on these nine tasks and for each of the nine tasks they determine the winning" }, { "start": 1426.1200000000001, "end": 1436.8400000000001, "text": " tickets. And the number here says how many, in how many of these nine tasks is this particular" }, { "start": 1436.84, "end": 1442.08, "text": " attention head a part of the winning ticket. Now they repeat it for different random seats," }, { "start": 1442.08, "end": 1447.6799999999998, "text": " that's why you have floating point numbers and the lower part is the standard deviation" }, { "start": 1447.6799999999998, "end": 1455.1999999999998, "text": " across that. So you can see quite a number of heads make it into a lot of these tasks." }, { "start": 1455.1999999999998, "end": 1462.36, "text": " So you can say this part, this thing right here, red on red, this head right here survives" }, { "start": 1462.36, "end": 1469.6, "text": " in seven out of the nine tasks. So it should be fairly, it should probably encode something" }, { "start": 1469.6, "end": 1476.24, "text": " fairly substantial about language that is shared across these seven tasks. You can see" }, { "start": 1476.24, "end": 1481.6799999999998, "text": " some of the heads like this one here doesn't survive in almost any task which basically" }, { "start": 1481.6799999999998, "end": 1488.1599999999999, "text": " means that it's, you know, that one's not really super important for these tasks. It" }, { "start": 1488.16, "end": 1494.0400000000002, "text": " might have been, you know, important for the pre-training but not for these particular" }, { "start": 1494.0400000000002, "end": 1499.64, "text": " tasks. What's interesting, so what you can see is that the mean or median or so is like" }, { "start": 1499.64, "end": 1509.0800000000002, "text": " three, four or five. And that means that a lot of the heads are sort of somewhat important" }, { "start": 1509.0800000000002, "end": 1513.68, "text": " for some of the tasks. And you can see the qualitative difference. If this were the like" }, { "start": 1513.68, "end": 1518.92, "text": " original lottery ticket paper, most of these numbers would be at zero because the lottery" }, { "start": 1518.92, "end": 1525.24, "text": " ticket size is just so much smaller. Here you can directly see that you are going to" }, { "start": 1525.24, "end": 1532.1200000000001, "text": " retain a large number of things in your network in order to get 90% of the performance. And" }, { "start": 1532.1200000000001, "end": 1539.92, "text": " that's probably because you prune entire modules again. So they have this for two variants" }, { "start": 1539.92, "end": 1546.16, "text": " here. First for the strategy of masking heads only. And the right one is for masking heads" }, { "start": 1546.16, "end": 1551.92, "text": " and MLPs. And the same here on the bottom. These are the same numbers but not for attention" }, { "start": 1551.92, "end": 1558.4, "text": " heads but for MLP layers. And you see again this is masking MLPs only. This is masking" }, { "start": 1558.4, "end": 1568.66, "text": " heads and MLPs. So if you compare the two, you see that for example this here and this" }, { "start": 1568.66, "end": 1576.24, "text": " here are substantially darker which means more of this stuff survives. Now we can't" }, { "start": 1576.24, "end": 1583.8000000000002, "text": " really... It seems like here for example, it's darker than here. So on the right side" }, { "start": 1583.8000000000002, "end": 1589.24, "text": " more stuff survives but also you have more things to prune, right? You can prune the" }, { "start": 1589.24, "end": 1597.0800000000002, "text": " heads and the MLPs. And they claim before that the masking heads and MLP strategy results" }, { "start": 1597.08, "end": 1605.1599999999999, "text": " in more things being pruned which isn't really congruent with here generally more things" }, { "start": 1605.1599999999999, "end": 1613.04, "text": " surviving. But it could be because of the fact maybe the sum of the two is still lower" }, { "start": 1613.04, "end": 1620.28, "text": " than the sum of each individual thing here. Though it doesn't really look like it. So" }, { "start": 1620.28, "end": 1627.8799999999999, "text": " I'm a bit confused about this but I'm just going to assume that the sum of the two is" }, { "start": 1627.8799999999999, "end": 1636.16, "text": " lower. Does that make sense if both are darker? Well it shouldn't be the sum... It should" }, { "start": 1636.16, "end": 1642.86, "text": " be the sum of this plus a completely dark this in terms of masking heads only or vice" }, { "start": 1642.86, "end": 1649.86, "text": " versa versus the sum of those two, right? So that should be the measure. But it just seems" }, { "start": 1649.86, "end": 1657.12, "text": " a bit doesn't work out too much. But okay that's what they say. So by the way if the" }, { "start": 1657.12, "end": 1665.36, "text": " authors are here you have... This is cut off. Haha. Yeah this is annoying. This is like trying" }, { "start": 1665.36, "end": 1674.28, "text": " to get LoTeC to do things and it doesn't comply. Alright so what you can... Another thing you" }, { "start": 1674.28, "end": 1681.28, "text": " can see in the authors point out here is that if you mask heads and MLPs you sort of shift" }, { "start": 1681.28, "end": 1687.32, "text": " more things to the back of the network to the higher up layers. And they reason now" }, { "start": 1687.32, "end": 1695.84, "text": " because you also mask the heads basically they can't do as much work so the heads would" }, { "start": 1695.84, "end": 1702.8799999999999, "text": " be masked somewhere here. So all that work is going to shift upon the MLPs and mostly" }, { "start": 1702.88, "end": 1709.5200000000002, "text": " to the back of the network because this thing here cannot take over work that this attention" }, { "start": 1709.5200000000002, "end": 1714.6000000000001, "text": " head here is now not performing anymore because it was pruned because the signal travels this" }, { "start": 1714.6000000000001, "end": 1721.7600000000002, "text": " way. So the authors kind of interpret these results right here and I think the most important" }, { "start": 1721.7600000000002, "end": 1727.0800000000002, "text": " thing to see is simply the variance of things. So most heads are actually important for at" }, { "start": 1727.08, "end": 1735.04, "text": " least two or three tasks and no head is important for all the tasks consistently. I think that's" }, { "start": 1735.04, "end": 1744.8799999999999, "text": " the take home message right here. Okay and they contrast this to previous research that" }, { "start": 1744.8799999999999, "end": 1750.36, "text": " has basically said this experiment falls up on a study by this that showed that only a" }, { "start": 1750.36, "end": 1756.6399999999999, "text": " few transformer heads in machine translation tasks did the heavy lifting while the rest" }, { "start": 1756.64, "end": 1762.0800000000002, "text": " could be pruned. And this paper similarly showed that most of BERT self-attention head" }, { "start": 1762.0800000000002, "end": 1767.48, "text": " in MNLI task could be pruned and that the good heads were mostly shared between the" }, { "start": 1767.48, "end": 1774.8000000000002, "text": " MNLI matched and mismatched. And they basically say yeah that's correct but that is only within" }, { "start": 1774.8000000000002, "end": 1781.1200000000001, "text": " one task right if you go beyond if you go to several tasks then the heads that are important" }, { "start": 1781.12, "end": 1797, "text": " differ quite a bit. Okay so let's continue and go here. They ask how task independent" }, { "start": 1797, "end": 1805.1399999999999, "text": " are the good self-nerve works and they basically look at these kinds of graphs right here which" }, { "start": 1805.14, "end": 1813.16, "text": " are pretty interesting. So we've got this. This is heads shared between tasks. So what" }, { "start": 1813.16, "end": 1821.16, "text": " this measures is these are the different tasks in the glue benchmark and they basically look" }, { "start": 1821.16, "end": 1828.3600000000001, "text": " at each task look at its winning lottery ticket and look at which heads survive in the winning" }, { "start": 1828.36, "end": 1837.12, "text": " ticket. And then they put that here on the diagonal. So if in QNLI a head survives it" }, { "start": 1837.12, "end": 1845, "text": " gets a 1 here and if it doesn't survive it gets a 0. So on average 85 out of the 144" }, { "start": 1845, "end": 1851.9199999999998, "text": " heads survive right 85 heads survive. That's pretty as I said this is somewhat like over" }, { "start": 1851.9199999999998, "end": 1857.56, "text": " 50% of the network. It's entirely different than the original lottery ticket hypothesis" }, { "start": 1857.56, "end": 1866.6399999999999, "text": " paper. So 85% not percent 85 of the 144 heads survive. Now they look at the other tasks" }, { "start": 1866.6399999999999, "end": 1874.1599999999999, "text": " so for QNLI they would look at maybe MNLI task here and ask which of the heads that" }, { "start": 1874.1599999999999, "end": 1880.3799999999999, "text": " survived in QNLI also survives in MNLI. So that gets you the shared heads and again the" }, { "start": 1880.38, "end": 1890.0800000000002, "text": " lower numbers is standard deviation. So 62 heads survive in QNLI and MNLI and the authors" }, { "start": 1890.0800000000002, "end": 1896.0800000000002, "text": " here are sort of arguing that from these sort of numbers you should be able to see which" }, { "start": 1896.0800000000002, "end": 1904.0800000000002, "text": " of the tasks share different linguistic knowledge. So different linguistic knowledge could be" }, { "start": 1904.08, "end": 1912.72, "text": " relevant for different tasks but if some tasks share a lot of the attention heads that survive" }, { "start": 1912.72, "end": 1918.8799999999999, "text": " in the winning tickets that basically means that the model is using that information that" }, { "start": 1918.8799999999999, "end": 1924.32, "text": " is in that head for both tasks. This could be good in that you say oh yeah these tasks" }, { "start": 1924.32, "end": 1930.4399999999998, "text": " really are used similar linguistic features or it could be something that you don't expect" }, { "start": 1930.44, "end": 1934.8400000000001, "text": " and then you might be able to investigate maybe the model is doing something shady here" }, { "start": 1934.8400000000001, "end": 1941.92, "text": " because it really shouldn't, these tasks don't really have much in common. So they do this" }, { "start": 1941.92, "end": 1949.28, "text": " for the heads and the MLPs here. Now if you ask why the WNLI here has a bunch of zeros" }, { "start": 1949.28, "end": 1954.3600000000001, "text": " that's because it's a wonky task and basically the best thing you can do is predict the most" }, { "start": 1954.3600000000001, "end": 1960.2, "text": " frequent class. So you can prune just about anything away on these MLPs because they have" }, { "start": 1960.2, "end": 1967.8, "text": " the skip connections you don't need them to predict the most frequent class. What I want" }, { "start": 1967.8, "end": 1980.88, "text": " to go into is the following statement right here. So, note that figure one, so the figure" }, { "start": 1980.88, "end": 1987.3600000000001, "text": " before, shows very few heads or MLPs that are universally useless. Only seven heads" }, { "start": 1987.36, "end": 1993.9199999999998, "text": " that survived in less than two tasks. 86% of heads and 67% of MLPs survived in two to" }, { "start": 1993.9199999999998, "end": 2000.24, "text": " seven tasks with relatively high standard deviation. They say this means that the good" }, { "start": 2000.24, "end": 2011.12, "text": " sub networks for different tasks have relatively little in common. So they make this sort of" }, { "start": 2011.12, "end": 2018.52, "text": " statement again here that the good sub network have little in common and it might seem like" }, { "start": 2018.52, "end": 2027.04, "text": " that for the figure initially. But if you look at this figure it actually shows something" }, { "start": 2027.04, "end": 2036.76, "text": " pretty interesting I think. So if you look at a number, let's say for example this here," }, { "start": 2036.76, "end": 2046.2, "text": " this 74 and I haven't actually tried. Yeah let's look at the 74 and this here. So let's" }, { "start": 2046.2, "end": 2056.92, "text": " look at these tasks QQP and RTE. Okay, so if you look at QQP and RTE you could see that" }, { "start": 2056.92, "end": 2063.56, "text": " these are tasks that already they don't have a lot of heads in common right and you might" }, { "start": 2063.56, "end": 2071.16, "text": " be able to say well if what they're saying is true that the tasks share relatively little" }, { "start": 2071.16, "end": 2079.2, "text": " you would expect them to be relatively independent. But if I look at this 78 here it means that" }, { "start": 2079.2, "end": 2090.88, "text": " 78 out of 144 heads survive and here it means that 74 out of 144 heads survive. So if I" }, { "start": 2090.88, "end": 2098.44, "text": " now would think that okay generally for different tasks things are different how many heads" }, { "start": 2098.44, "end": 2105.1400000000003, "text": " would I expect there to be surviving in both if the tasks are independent. So that's these" }, { "start": 2105.1400000000003, "end": 2114.08, "text": " two things multiplied right times 144. So I can scratch this here and the 7 times 7 is" }, { "start": 2114.08, "end": 2125.4, "text": " whatever 49. Let's go 7 times 8 about this so that's 5, 6. Do I need to get out the calculator?" }, { "start": 2125.4, "end": 2136.7999999999997, "text": " I want to do this calculator. I'm going to do this the right way. Okay I hope you can" }, { "start": 2136.8, "end": 2148.2400000000002, "text": " see that so that's 78 times 74 divided by 144. Did I do it right? I probably did it" }, { "start": 2148.2400000000002, "end": 2161.32, "text": " wrong. 78 times 74 divided by 144. Alright so that's 40 heads and you see that there's" }, { "start": 2161.32, "end": 2166.6800000000003, "text": " 43 heads and I've actually gone through a bunch of these numbers before not these ones" }, { "start": 2166.6800000000003, "end": 2174.92, "text": " but generally the shared number of heads is higher than what one would expect if you assume" }, { "start": 2174.92, "end": 2182.32, "text": " that the tasks are independent. And I'm sort of missing sort of an analysis of that here" }, { "start": 2182.32, "end": 2190.0800000000004, "text": " because that I find to be a pretty interesting finding of these things and sort of I mean" }, { "start": 2190.08, "end": 2197.2, "text": " I get the fact that they say based on the graphics up here that the tasks are sort of" }, { "start": 2197.2, "end": 2201.7999999999997, "text": " seem to be relatively independent with respect to the heads that survive and of course relatively" }, { "start": 2201.7999999999997, "end": 2212.2, "text": " independent is a relative term but it's sort of an investigation into why we see considerable" }, { "start": 2212.2, "end": 2220.2, "text": " difference between tasks here in terms of that. So these numbers are always over what" }, { "start": 2220.2, "end": 2230.24, "text": " you would assume for independence. That seems to be pretty interesting. Alright so they" }, { "start": 2230.24, "end": 2238.7599999999998, "text": " say they here go into this figure two and this pairwise comparison and they analyze" }, { "start": 2238.76, "end": 2246.2000000000003, "text": " a couple of the different tasks here and what you would expect and I don't want to go too" }, { "start": 2246.2000000000003, "end": 2250.76, "text": " much into these tasks because honestly I also don't know all of these tasks. I don't know" }, { "start": 2250.76, "end": 2255.92, "text": " which tasks should share a lot of things, which ones shouldn't but it is a good way." }, { "start": 2255.92, "end": 2261.48, "text": " Like it is a very smart way to investigate if the model really learns similar tasks to" }, { "start": 2261.48, "end": 2267.88, "text": " use similar information. Alright the last thing they do right here is the good and the" }, { "start": 2267.88, "end": 2274.6400000000003, "text": " bad subnetworks in BERT fine tuning. So they say our final experiment puts the above evidence" }, { "start": 2274.6400000000003, "end": 2280.6800000000003, "text": " of good subnetworks in BERT fine tuned from the perspective of lottery ticket hypothesis" }, { "start": 2280.6800000000003, "end": 2285.7200000000003, "text": " which predicts that the lucky subnetworks can be retrained from scratch to match the" }, { "start": 2285.7200000000003, "end": 2292.56, "text": " performance of the full network. To test this hypothesis we experiment with the following" }, { "start": 2292.56, "end": 2298.44, "text": " subnetworks. So that means I wasn't really sure when I read it the first time but now" }, { "start": 2298.44, "end": 2307.56, "text": " I'm fairly sure that all of the results so far were just pruning and maybe not retraining." }, { "start": 2307.56, "end": 2315.68, "text": " So just sort of doing the pruning thing and not doing this lottery ticket retraining which" }, { "start": 2315.68, "end": 2322.48, "text": " shouldn't make a lot of the difference as we're going to see but just for the understanding." }, { "start": 2322.48, "end": 2328.68, "text": " Because it seems like pruning and retraining doesn't do that much for the winning tickets" }, { "start": 2328.68, "end": 2337.92, "text": " as you'll see right now. But yeah so now they actually retrain from scratch. So good networks" }, { "start": 2337.92, "end": 2343.8, "text": " the elements selected from the full model by importance scores as described in the previous" }, { "start": 2343.8, "end": 2349.32, "text": " section. So here they're going to evaluate these good networks. First of all they're" }, { "start": 2349.32, "end": 2354.7200000000003, "text": " going to evaluate them pruned and they're going to evaluate them retrained in the lottery" }, { "start": 2354.7200000000003, "end": 2362.84, "text": " ticket style. Then they're also going to evaluate bad subnetworks. The elements sampled from" }, { "start": 2362.84, "end": 2369.6000000000004, "text": " those that did not survive the pruning plus a random sample of elements with high importance" }, { "start": 2369.6000000000004, "end": 2375.2000000000003, "text": " score so as to match the size of the good subnetworks. So because the good subnetworks" }, { "start": 2375.2, "end": 2386.04, "text": " are 50% or more of the network they want to sample from the things that did not survive" }, { "start": 2386.04, "end": 2392, "text": " so from the bad ones and they plus a random sample of the good subnetworks to just match" }, { "start": 2392, "end": 2399.9199999999996, "text": " the size. So we would expect these to perform maybe worse but maybe we can also train them" }, { "start": 2399.92, "end": 2407.4, "text": " to achieve good performance. And then they investigate bad subnetworks. Simple inversion" }, { "start": 2407.4, "end": 2412.36, "text": " of the good subnetworks. So these would be just anything but the good. They are 5 to" }, { "start": 2412.36, "end": 2419.3, "text": " 18% smaller in size than the sampled bad subnetworks but they do not contain any elements with" }, { "start": 2419.3, "end": 2426.1, "text": " high importance scores. And they say okay for all of them they evaluate their performance" }, { "start": 2426.1, "end": 2432.24, "text": " on all tasks simply after pruning and with fine tuning the same subnetwork with the same" }, { "start": 2432.24, "end": 2437.2, "text": " random seeds and with the rest of the model of masks. So this is really what the lottery" }, { "start": 2437.2, "end": 2443.56, "text": " ticket hypothesis does except they of course mask entire modules and not individual weights." }, { "start": 2443.56, "end": 2449.64, "text": " And here you can see the general results. So the general results look like something" }, { "start": 2449.64, "end": 2458.72, "text": " like this. This is a typical example. So this is the, let's go out, oh yeah, this here is" }, { "start": 2458.72, "end": 2465.08, "text": " simply the dumb classifier that always tells the highest probability class. This is the," }, { "start": 2465.08, "end": 2473.7999999999997, "text": " like this is sort of the idiot's baseline. Okay. This here is the full model. This here" }, { "start": 2473.8, "end": 2482.04, "text": " is the good pruned and this here is the good after it's retrained again. Okay. So you see" }, { "start": 2482.04, "end": 2486.7400000000002, "text": " by retraining you can basically gain. Now the original lottery ticket this would sometimes" }, { "start": 2486.7400000000002, "end": 2491.8, "text": " even go up here depending on how much was pruned but you can see that there is a slight" }, { "start": 2491.8, "end": 2499.8, "text": " gain after you retrain the pruned part. Okay. And the other thing to note here is that you" }, { "start": 2499.8, "end": 2507.5600000000004, "text": " don't lose much. Basically you only drop a little bit by pruning which that's what makes" }, { "start": 2507.5600000000004, "end": 2514.4, "text": " it the good part. You only drop a little bit. However, if you have the bad part which are" }, { "start": 2514.4, "end": 2522.0800000000004, "text": " these and let's say the good plus bad. These are the bad plus some of the good ones. You" }, { "start": 2522.08, "end": 2530.24, "text": " see that the performance drops pretty heavily almost to the baseline of the most frequent" }, { "start": 2530.24, "end": 2539.04, "text": " class and also here. So I would actually, I would go with this one right here if, because" }, { "start": 2539.04, "end": 2545.3199999999997, "text": " that's just the bad ones. You see the performance drops considerably but then, and that's what" }, { "start": 2545.3199999999997, "end": 2551.08, "text": " the authors claim is pretty interesting. If you retrain that part, the bad part, so to" }, { "start": 2551.08, "end": 2557.96, "text": " say, you can achieve sort of a very comparable performance to what you can achieve with the" }, { "start": 2557.96, "end": 2565.84, "text": " good parts. And this appears to be true for most of the results right here. There are" }, { "start": 2565.84, "end": 2570.68, "text": " some outliers like this one but there the score is also, so this is the Matthews correlation" }, { "start": 2570.68, "end": 2576.68, "text": " and not the accuracy. So the score is a bit different there. But you can see here the" }, { "start": 2576.68, "end": 2584.52, "text": " good plus bad also gets a fairly high accuracy. So the authors claim this is pretty surprising" }, { "start": 2584.52, "end": 2589.6, "text": " which I guess it is if you look at this. But what I want to do is I actually want, I have" }, { "start": 2589.6, "end": 2596.74, "text": " asked the author of the lottery ticket hypothesis this question. So this is from our machine" }, { "start": 2596.74, "end": 2604.96, "text": " learning street talk with Jonathan Franco and this is another channel that I am a part" }, { "start": 2604.96, "end": 2613.4, "text": " of and I would like to show you this right here when I ask them this question." }, { "start": 2613.4, "end": 2619.5, "text": " Another question from Reddit, Imnemo asks, suppose you try to construct a lottery ticket" }, { "start": 2619.5, "end": 2626.28, "text": " by taking all the weights that were not part of a winning ticket and retraining from those," }, { "start": 2626.28, "end": 2631.32, "text": " will that model be unable to learn the task or might there be another winning ticket hiding" }, { "start": 2631.32, "end": 2636.28, "text": " among them or one that was not originally used?" }, { "start": 2636.28, "end": 2642.44, "text": " So this is the most common question I get by people who read the original paper and" }, { "start": 2642.44, "end": 2647.8, "text": " I hope that by answering it here in a public forum I can answer it once and for all. The" }, { "start": 2647.8, "end": 2652.0800000000004, "text": " challenge in doing this experiment is let us take the MNIST example. So suppose that" }, { "start": 2652.0800000000004, "end": 2656.6000000000004, "text": " we find a winning ticket on MNIST. It is going to be about 3% of the original size of the" }, { "start": 2656.6, "end": 2661.72, "text": " network. So that means that if you remove it you still get 97% of the weights left." }, { "start": 2661.72, "end": 2665.56, "text": " And so my guess is that if you were to train those 97% of weights you will get to the same" }, { "start": 2665.56, "end": 2669.04, "text": " accuracy as you got with 100% of weights because you have barely pruned the network at all." }, { "start": 2669.04, "end": 2672.3199999999997, "text": " You could randomly prune by 3% and it would not affect it. And then you could go and find" }, { "start": 2672.3199999999997, "end": 2676.6, "text": " another lottery ticket that is mutually exclusive with the first. You still have 94% of the" }, { "start": 2676.6, "end": 2681.24, "text": " weights and you could probably iterate this for a very long time. You could probably this" }, { "start": 2681.24, "end": 2689.2, "text": " way find 10, 15 lottery tickets like this, maybe more, that are all mutually exclusive" }, { "start": 2689.2, "end": 2695.04, "text": " and still leave you with a remaining residual that is capable of training to full accuracy." }, { "start": 2695.04, "end": 2699.16, "text": " So the challenge with this experiment is that the lottery tickets are small, which is great," }, { "start": 2699.16, "end": 2702.7999999999997, "text": " but it means that whatever is left is large enough that I am sure there is another lottery" }, { "start": 2702.7999999999997, "end": 2706.56, "text": " ticket in there and another lottery ticket in there and so on and so on and so on. So" }, { "start": 2706.56, "end": 2714.12, "text": " it is an interesting idea in principle, but once you kind of look at the sizes of things" }, { "start": 2714.12, "end": 2718.6, "text": " you still got so much over-parameterization left that I think you just find more lottery" }, { "start": 2718.6, "end": 2722.16, "text": " tickets. You can even probably, I am guessing, swap out one weight from a lottery ticket" }, { "start": 2722.16, "end": 2725.88, "text": " with another weight and it would not matter or swap out a handful of weights. And so combinatorially" }, { "start": 2725.88, "end": 2730.88, "text": " the number of lottery tickets is massive and we are just finding one." }, { "start": 2730.88, "end": 2740.08, "text": " All right, so as you saw this is kind of the most common question that Jonathan gets here." }, { "start": 2740.08, "end": 2746.2000000000003, "text": " And as you can see the difference here of course is that our original tickets are already" }, { "start": 2746.2000000000003, "end": 2753.7200000000003, "text": " sort of 50% of the network, so what is left is only 50%. So this is substantially different." }, { "start": 2753.72, "end": 2763.8399999999997, "text": " Now two things I have to remark here. First of all, because we are pruning modules and" }, { "start": 2763.8399999999997, "end": 2771.2, "text": " not individual weights for the good one, it is the reason that we do get these big winning" }, { "start": 2771.2, "end": 2778.04, "text": " tickets, right? But also what I think is happening is that because we are pruning these entire" }, { "start": 2778.04, "end": 2785.64, "text": " modules we are actually not fine-grained enough. So that means every time we eliminate a module" }, { "start": 2785.64, "end": 2792.84, "text": " we actually kill some good ones and some bad ones. So in here I am going to guess there" }, { "start": 2792.84, "end": 2800.68, "text": " are some good ones and there are some bad ones. But since we can only kill entire modules," }, { "start": 2800.68, "end": 2808, "text": " we sort of, we simply kill the one that on average has the most good ones. But I am guessing" }, { "start": 2808, "end": 2817.28, "text": " that in the thing we kill there are simply, sorry, we kill the one that has on average" }, { "start": 2817.28, "end": 2822.28, "text": " the least good ones. But there are still some good weights in there. And if you believe" }, { "start": 2822.28, "end": 2829.48, "text": " the original lottery ticket hypothesis that means that these, actually these very few" }, { "start": 2829.48, "end": 2839.16, "text": " weights in those modules can still train to full accuracy. So actually what these authors" }, { "start": 2839.16, "end": 2843.88, "text": " claim is surprising in light of the original lottery ticket hypothesis. I think if you" }, { "start": 2843.88, "end": 2849.48, "text": " look at it from the perspective of the actual hypothesis which considers individual weight" }, { "start": 2849.48, "end": 2857.72, "text": " and a very small subset of them, the original hypothesis would pretty much predict that" }, { "start": 2857.72, "end": 2865.12, "text": " you could train something where you pruned away a bunch of modules entirely. Or you could" }, { "start": 2865.12, "end": 2872.8399999999997, "text": " train these bad modules because they are still going to contain a small-sized lottery ticket" }, { "start": 2872.8399999999997, "end": 2878.4399999999996, "text": " that is going to be responsible for the good performance. So that is kind of the first" }, { "start": 2878.4399999999996, "end": 2883.48, "text": " thing. And the second thing, in general, you heard Jonathan, I do not think that is actually" }, { "start": 2883.48, "end": 2890.6, "text": " even a question of the size of the tickets. Nothing in the original hypothesis forbids" }, { "start": 2890.6, "end": 2896.2400000000002, "text": " the non-winning ticket from also being trained to good accuracy. It simply says something" }, { "start": 2896.2400000000002, "end": 2902.96, "text": " about the winning ticket. It does not say anything about the non-winning ticket. So" }, { "start": 2902.96, "end": 2908.76, "text": " those are the two comments. And I think the question and the investigation, even though" }, { "start": 2908.76, "end": 2917.88, "text": " it is interesting, I think it is sort of maybe not thought through, at least in the perspective" }, { "start": 2917.88, "end": 2925.2400000000002, "text": " of what they go for here. The result is very interesting. But again, I think they claim" }, { "start": 2925.2400000000002, "end": 2929.8, "text": " the original hypothesis would sort of say these are the bad parts and you could not" }, { "start": 2929.8, "end": 2936.5200000000004, "text": " train them. And then they say it is surprising that you can. But I would say that the original" }, { "start": 2936.52, "end": 2941.96, "text": " hypothesis would in fact predict that you could train those things because you have" }, { "start": 2941.96, "end": 2948.28, "text": " pruned away these entire modules, which is very coarse-grained and that leaves still" }, { "start": 2948.28, "end": 2954.84, "text": " good weights in the bad parts. Okay. So they conclude. However, we can see that both good" }, { "start": 2954.84, "end": 2961, "text": " and bad networks can be retrained with comparable performance for many tasks. The inverted bad" }, { "start": 2961, "end": 2965.16, "text": " networks perform worse than the sampled ones, but that could be due to them being smaller" }, { "start": 2965.16, "end": 2974.52, "text": " in size. Performance of all inverted bad networks on call is almost zero. Okay. Yeah, okay. Very" }, { "start": 2974.52, "end": 2980.44, "text": " little remains when that mask is inverted. That is the task we looked at because they" }, { "start": 2980.44, "end": 2987.56, "text": " claim that is so small, which makes sense, right? So discussion. Say, does BERT have" }, { "start": 2987.56, "end": 2992.8399999999997, "text": " bad subnetworks? The key result of this study is that as far as fine-tuning is concerned," }, { "start": 2992.84, "end": 2997.96, "text": " BERT does not seem to have bad subnetworks that cannot be retrained to relatively good" }, { "start": 2997.96, "end": 3003.4, "text": " performance level, suggesting that the weight that do not survive pruning are not just inactive." }, { "start": 3003.4, "end": 3007.2400000000002, "text": " However, it is important to remember that we consider elements of BERT architecture" }, { "start": 3007.2400000000002, "end": 3011.6400000000003, "text": " as atomic units, while the original lottery ticket work relied on magnitude pruning of" }, { "start": 3011.6400000000003, "end": 3017.48, "text": " individual weights. So they're well aware here of these differences, and they can see" }, { "start": 3017.48, "end": 3023.72, "text": " which, and they can see to that right here. So that's good. On that level, BERT probably" }, { "start": 3023.72, "end": 3029.48, "text": " does have bad subnetworks, and they show that can be found in the transformer model with global" }, { "start": 3029.48, "end": 3034.2, "text": " iterative pruning. We'll leave it to future research to find out to what extent the effective" }, { "start": 3034.2, "end": 3039.48, "text": " subnetworks overlap with the effective architectural blocks, and what that says about the architecture" }, { "start": 3039.48, "end": 3047.2400000000002, "text": " of BERT and the other transformers. So as you see, they're well aware that all of what I" }, { "start": 3047.24, "end": 3056.04, "text": " said is the case. So it's not like I'm criticizing and saying they're wrong. It's just that if you" }, { "start": 3056.04, "end": 3066.52, "text": " read it, you sort of get the impression that this is what they're saying. And I think the light of" }, { "start": 3066.52, "end": 3073.64, "text": " which a reader goes through it is just a bit such that you come off, if you don't read until here," }, { "start": 3073.64, "end": 3080.92, "text": " you come off thinking something else. Our results suggest that most architecture blocks of BERT are" }, { "start": 3080.92, "end": 3085.24, "text": " potentially usable in fine tuning. This should not be interpreted as proof that they all encode" }, { "start": 3085.24, "end": 3092.68, "text": " potentially irrelevant linguistic information. That's absolutely true. It is also possible that" }, { "start": 3092.68, "end": 3097.8799999999997, "text": " pre-training somehow simply made them more amenable to optimization, which is another question for" }, { "start": 3097.88, "end": 3105, "text": " future research. And they go into what do different BERT components do in the different things. So" }, { "start": 3105, "end": 3111.1600000000003, "text": " again, I think this work here is actually most relevant for investigating this question, what do" }, { "start": 3111.1600000000003, "end": 3116.76, "text": " BERT components, the different BERT components do for the different tasks, to look which tasks use" }, { "start": 3116.76, "end": 3126.84, "text": " which things. And the actual recognition that none of these modules is useless, I would consider pretty" }, { "start": 3126.84, "end": 3133.2400000000002, "text": " pretty cool finding. Okay, so in conclusion, they say prior work shows that it was possible to prune" }, { "start": 3133.2400000000002, "end": 3137.48, "text": " most self-attention ads. We extend this to the fully connected layers. We show fine tune purses" }, { "start": 3137.48, "end": 3141.48, "text": " good and bad top networks, where the good heads and MOPs alone reach performance comparable with" }, { "start": 3141.48, "end": 3146.2000000000003, "text": " the full network, and the bad ones do not perform well. However, this pattern does not quite conform" }, { "start": 3146.2000000000003, "end": 3151.1600000000003, "text": " to lottery ticket hypothesis. Both good and bad networks can be fine tuned separately to reach" }, { "start": 3151.16, "end": 3159.64, "text": " comparable performance. We also show that 86% of heads and 57% of MOPs and good sub networks are" }, { "start": 3159.64, "end": 3164.52, "text": " not universally useful. Cross-glue tasks and overlap between good and sub networks do not" }, { "start": 3164.52, "end": 3171.64, "text": " necessarily correspond to task types. So that's where we didn't go into. This raises questions" }, { "start": 3171.64, "end": 3176.68, "text": " about the degree to which fine tune BERT relies on task specific or general linguistic knowledge" }, { "start": 3176.68, "end": 3181.24, "text": " and opens up the possibility of studying the good sub networks to see what types of knowledge BERT" }, { "start": 3181.24, "end": 3187.56, "text": " actually relies on at inference time. So this is sort of future research direction. And with that," }, { "start": 3187.56, "end": 3193.8799999999997, "text": " I think we've gone through the paper. I hope you got something useful out of this. I think it's a" }, { "start": 3193.8799999999997, "end": 3199.7999999999997, "text": " pretty cool paper. It's a pretty cool methodology, and I think a lot of work can build upon this to" }, { "start": 3199.8, "end": 3206.6000000000004, "text": " do interesting analysis of these language models. Again, if you like this video, consider sharing it," }, { "start": 3206.6, "end": 3231.4, "text": " subscribing, liking, and bye bye." } ]
utuz7wBGjKM
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[News] OpenAI Model Generates Python Code
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "microsoft", "openai", "msbuild", "build", "code", "gpt2", "language model", "completion", "intellisense", "intellicode", "vscode", "github", "python", "code completion", "smart", "generate", "function body", "docstring", "name", "arguments", "programmer", "stackoverflow", "dataset", "interpolate" ]
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 GPT-2 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 palindrome, 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 palindrome, 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 palindromes, so return a list indices for elements that are palindromes 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 palindrome 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 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 of the order class. And they stop here. So this is what the human enters. The 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 palindrome. 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 palindrome 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 to see, it adds up the total price per item. And it basically discounts every item. Now it cannot work out that palindrome discount should mean that every item should be a palindrome. 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 are palindromes. Now the model is again asked to complete this and absolutely crazy. If it's a palindrome, then multiply it with the discount. And if it's not a palindrome, then just add the price. And this final touch here, that's one minus the palindrome 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 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 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 actually sort of make use of. 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 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 whatnot. So it's just learned 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 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 wanted to show you that this already is available, even though not in as big of a form, it can't write giant functions for you, you can't write function bodies, but there are some machine learning based completions already available. So kite is one of them. And tab 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 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 auto generated. So when you look at the video, you get tab nine is correct. But that 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 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 the price of five and the name of hello. And we can print CC 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? Price, total price equals zero for order in. Wow, did you see that? In, 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. How can I, 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 be a very, very, very, very, very, very, very interesting, very, very, very interesting thing to come more. And yeah, with that, bye bye.
[ { "start": 0, "end": 8, "text": " Hi there. So I saw this and probably many of you have seen this. OpenAI was demonstrating at MSBuild" }, { "start": 8, "end": 14.88, "text": " basically a GPT-2 language model but trained not on language but on code, on Python code," }, { "start": 14.88, "end": 21.28, "text": " open source code from GitHub. And so the idea is that the model learns to produce code. And" }, { "start": 21.28, "end": 27.04, "text": " we'll just have a short look at the clip they have here. I'll link the entire clip down. So this is" }, { "start": 27.04, "end": 32.32, "text": " what the human types. Def is palindrome, so the function name, the argument, and the doc string." }, { "start": 32.32, "end": 36.4, "text": " And now the model is asked to produce the rest of the function and check out." }, { "start": 38.64, "end": 43.44, "text": " So it's pretty good, right? This is actually to check whether, this is a basic check, whether a" }, { "start": 43.44, "end": 49.2, "text": " string is a palindrome, as long as you can ensure that s is a string and so on. So the model learned" }, { "start": 49.2, "end": 53.68, "text": " this. You can still say maybe that's just interpolating from, you know, something like" }, { "start": 53.68, "end": 59.44, "text": " this is surely in a GitHub repo somewhere. So they go further and they try to say, okay, please give" }, { "start": 59.44, "end": 67.36, "text": " me a function where the palindromes, so return a list indices for elements that are palindromes and" }, { "start": 67.36, "end": 71.84, "text": " at least seven characters. And I personally have searched for this function on GitHub and it does" }, { "start": 71.84, "end": 78.48, "text": " not exist. So what does the model produce? Pretty cool. So this is first of all a list comprehension" }, { "start": 78.48, "end": 84, "text": " in Python, which is reasonably complicated, right? And you can see there is this length filter" }, { "start": 84, "end": 90.24000000000001, "text": " that is greater or equal to seven. And it refers actually back to the is palindrome function that" }, { "start": 90.24000000000001, "end": 96.08000000000001, "text": " it wrote before. That's pretty cool. Now, this is not like a language model producing, as far as I" }, { "start": 96.08000000000001, "end": 101.28, "text": " understand, producing this basically letter by letter or word by word. This goes over the" }, { "start": 101.28, "end": 107.52000000000001, "text": " constraints of abstract syntax trees. So it is, I think that's what's happening. They don't have a" }, { "start": 107.52, "end": 113.52, "text": " paper to go along, though I will look into more papers of that sort. They do kind of constrain" }, { "start": 113.52, "end": 118, "text": " the model to actually produce valid code. But of course, which variables go where and so on that" }, { "start": 118, "end": 125.36, "text": " that's that is completely up to the model. And you see here it understands completely what the user" }, { "start": 125.36, "end": 129.6, "text": " wants. Now, of course, these examples might be cherry picked, right? But it's even for cherry" }, { "start": 129.6, "end": 135.04, "text": " picked examples, still pretty impressive. As I said, I could not find this particular function." }, { "start": 135.04, "end": 142.16, "text": " So they post two classes here data classes, item and order. And now the model is asked to compute" }, { "start": 142.16, "end": 151.04, "text": " the total order price, which is a method of the of the of the order class. And they stop here. So" }, { "start": 151.04, "end": 157.68, "text": " this is what the human enters. The human enters that just the name of the function, not even the" }, { "start": 157.68, "end": 163.04, "text": " doc string. And the model comes up with the following, compute the total price of the order," }, { "start": 163.04, "end": 169.76, "text": " including the palindrome. So it does all of that by itself, including the doc string, just from" }, { "start": 169.76, "end": 173.76, "text": " the method. Now you can see pretty much what's happening here. It's kind of like the GPT-2" }, { "start": 173.76, "end": 178.64, "text": " language model. So what it does is probably it from the method name, it derives this doc string" }, { "start": 178.64, "end": 184.23999999999998, "text": " compute total price, right? That's a lot of programmers do this of the order. Order is," }, { "start": 184.23999999999998, "end": 189.68, "text": " of course, the name of the class of self. And here it says including the palindrome discount." }, { "start": 189.68, "end": 195.44, "text": " And that is probably somewhat pattern match to other functions that have some sort of discount" }, { "start": 195.44, "end": 202.8, "text": " or something like this or one argument that is a number. But the fact that it is also able to see," }, { "start": 202.8, "end": 212.4, "text": " it adds up the total price per item. And it basically discounts every item. Now it cannot" }, { "start": 212.4, "end": 217.44, "text": " work out that palindrome discount should mean that every item should be a palindrome. That's the only" }, { "start": 217.44, "end": 222.96, "text": " thing it can't work out. It just applies a discount to every single item. Now they go ahead and kind" }, { "start": 222.96, "end": 228.32, "text": " of change that and write the doc strings themselves such that it is clear that apply the discount to" }, { "start": 228.32, "end": 235.92, "text": " items whose name are palindromes. Now the model is again asked to complete this and absolutely crazy." }, { "start": 235.92, "end": 240.07999999999998, "text": " If it's a palindrome, then multiply it with the discount. And if it's not a palindrome," }, { "start": 240.07999999999998, "end": 244.96, "text": " then just add the price. And this final touch here, that's one minus the palindrome discount" }, { "start": 244.96, "end": 251.84, "text": " is added by the programmer. So you can see that this goes towards kind of a symbiosis of human and" }, { "start": 251.84, "end": 258.96000000000004, "text": " machine in this way. I don't think the AI will replace programmers, but it certainly is going" }, { "start": 258.96000000000004, "end": 264.8, "text": " to be very helpful to automate some of the things or give you suggestions for things that you have" }, { "start": 264.8, "end": 270.64, "text": " to do over and over again. Now I think a lot of these rely on the fact that a lot of programming" }, { "start": 270.64, "end": 276.56, "text": " is redundant still. A lot of people name the function and then in the doc string, they basically" }, { "start": 276.56, "end": 280.4, "text": " repeat the function because they've already intelligently named the function. So technically" }, { "start": 280.4, "end": 284.32, "text": " there doesn't need to be a doc string, but then whatever your style guide comes in, it says there" }, { "start": 284.32, "end": 289.28, "text": " needs to be a doc string. Every argument must be described. Every argument must have a description" }, { "start": 289.28, "end": 296.47999999999996, "text": " and a help string and a type, even though it is completely obvious from the names what they do." }, { "start": 296.48, "end": 302.32, "text": " So if it is completely obvious, I would argue you don't need a doc string. And this is kind" }, { "start": 302.32, "end": 310.64000000000004, "text": " of additional information that this model is able to actually sort of make use of. So the fact that" }, { "start": 310.64000000000004, "end": 314.96000000000004, "text": " a lot of these functions, you can already, the doc string is sort of already the implementation" }, { "start": 314.96000000000004, "end": 320.64000000000004, "text": " of the function almost. So the distance there is not, it's not like you can say whatever you want." }, { "start": 320.64, "end": 328.08, "text": " And yeah, so you can see here when it's asked to print the receipt, it just works out. So it's" }, { "start": 328.08, "end": 332.88, "text": " printing, it's doing format strings and whatnot. So it's just learned to do that. I would argue," }, { "start": 332.88, "end": 337.68, "text": " again, this works. You couldn't just put anything like doc string language is a very specific type" }, { "start": 337.68, "end": 341.91999999999996, "text": " of language that programmers use where they basically already sort of implement the method" }, { "start": 341.91999999999996, "end": 348.71999999999997, "text": " in the doc string. And then the body of the method is just the then really specific code." }, { "start": 348.72, "end": 354.24, "text": " But as of that, yeah, there's a lot of information already in the doc string in the naming of the" }, { "start": 354.24, "end": 362, "text": " function. And it's still pretty impressive, right? So yeah, I just wanted to show you that this" }, { "start": 362, "end": 369.6, "text": " already is available, even though not in as big of a form, it can't write giant functions for you," }, { "start": 369.6, "end": 374.08000000000004, "text": " you can't write function bodies, but there are some machine learning based completions" }, { "start": 374.08, "end": 380.88, "text": " already available. So kite is one of them. And tab nine is the other one that I use for now." }, { "start": 381.68, "end": 386.96, "text": " Both are close sources, I understand it. So that's a bit of a downer there. But these are" }, { "start": 386.96, "end": 392.79999999999995, "text": " exactly kind of GPT language models learned on a lot of code. So they can kind of guess what you" }, { "start": 392.79999999999995, "end": 397.76, "text": " want and interpolate with your variables in there and so on. I also found this when I searched this" }, { "start": 397.76, "end": 404, "text": " comparison here kite versus tab nine. And you see it starts off Yeah, but these are I think these" }, { "start": 404, "end": 408.88, "text": " are kind of auto generated. So when you look at the video, you get tab nine is correct. But that" }, { "start": 408.88, "end": 417.84, "text": " kite, it's an actual video review of a kite. Yeah, so, you know, who knows. But what I wanted to do" }, { "start": 417.84, "end": 425.03999999999996, "text": " is basically show you a bit of the power of tab nine. Let me get this out of the way. So" }, { "start": 425.04, "end": 432, "text": " a while back ago, I live coded this session right here where I where I implemented a sentiment" }, { "start": 432, "end": 437.28000000000003, "text": " classifier from scratch using hugging face libraries. And I thought we would just play around in here a" }, { "start": 437.28000000000003, "end": 443.76, "text": " bit to see what the tab nine could do for us. Alright, so I have tab nine in here together with" }, { "start": 443.76, "end": 449.20000000000005, "text": " 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" }, { "start": 449.2, "end": 461.44, "text": " we wanted to compute the loss here. Let's say we wanted to compute square loss, square loss, you see" }, { "start": 461.44, "end": 470.08, "text": " that tab nine immediately kind of turns up. I've not tried this, I'm impressed. So it says it" }, { "start": 470.08, "end": 479.76, "text": " estimates loss here. And no, that's maybe not what I want. So I'll go with square. Now this is a" }, { "start": 479.76, "end": 486.96, "text": " language server suggestion. So and you can see right here, even though I don't have these" }, { "start": 486.96, "end": 492.47999999999996, "text": " variables, kind of tab nine will suggest train loss and validation loss. So let me start a new" }, { "start": 492.48, "end": 502.56, "text": " file right here. Just to see what we can get this thing to do without doing anything. So and so" }, { "start": 502.56, "end": 513.9200000000001, "text": " let's say we'll import OS and we'll say if name. So tab nine auto suggests that. And it auto" }, { "start": 513.92, "end": 521.36, "text": " suggests that we should write main here, right. And it knows that a lot of people then call a" }, { "start": 521.36, "end": 529.5999999999999, "text": " function called main. So we should probably do that def main, right. Sorry. Okay, let's go with" }, { "start": 529.5999999999999, "end": 536.88, "text": " the following, we'll say, we'll try the same thing they did, right. So we'll say we have a data class" }, { "start": 536.88, "end": 548.4, "text": " order, it has, let's say price float and a name string. And order one is an order with the price" }, { "start": 548.4, "end": 558.48, "text": " of five and the name of hello. And we can print CC tab nine, tab nine, if you can see that," }, { "start": 558.48, "end": 564.8000000000001, "text": " it's closely suggested to print order dot price order one dot price. So it can it can see that" }, { "start": 564.8000000000001, "end": 577.12, "text": " we kind of want that. How do I select that? Right here. See, order two equals so we'll get another" }, { "start": 577.12, "end": 587.28, "text": " order right here. Seven. Hello. Let's get it with order two. Let's do that. Orders equals order one," }, { "start": 587.28, "end": 600.64, "text": " order two. So total price, total price equals zero for order in. Wow, did you see that?" }, { "start": 600.64, "end": 607.28, "text": " Price, total price equals zero for order in. Wow, did you see that?" }, { "start": 608.56, "end": 617.84, "text": " In, I can't get it anymore. In orders, that's what tab nine says. Total price plus equals" }, { "start": 618.96, "end": 624.3199999999999, "text": " order dot price. So it is already pretty smart, I would argue." }, { "start": 624.32, "end": 631.6800000000001, "text": " Print. And there you saw that total price was suggested. How can I, I don't know how to select" }, { "start": 631.6800000000001, "end": 638.4000000000001, "text": " this. But I'll figure it out. I'm not that advanced yet. So you can see this already sort of works." }, { "start": 638.4000000000001, "end": 644, "text": " And I think it's pretty cool already. And I'm very excited to see what kind of how far people" }, { "start": 644, "end": 648.4000000000001, "text": " can push this because I think this code generation kind of inferring what you want is only at the" }, { "start": 648.4000000000001, "end": 654.08, "text": " beginning right now. And it's for sure going to be a very, very, very, very, very, very, very" }, { "start": 654.08, "end": 664.1600000000001, "text": " interesting, very, very, very interesting thing to come more. And yeah, with that, bye bye." } ]
Nfry2b4RFI4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Investigating Human Priors for Playing Video Games (Paper & Demo)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "reinforcement learning", "deep rl", "human", "prior", "objects", "game", "video game", "key", "visuals", "enemy", "ladder", "gravity", "ablation" ]
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 Rachid Duby, Pulkit Agrawal, Deepak Patak, Tom Griffiths and Alexei Aeferos. 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. They'll 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 bada boom. Cool. So let's try out. So they basically ablate different things here. Mask semantics means that you don't know what the objects are anymore. So you might go over here and you might be like, what's this green 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. I do this ice cream cone. You realize, OK, 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 masked. So basically you don't know what's like a relevant object and what isn't. So I know that there is like a bad thing here and a bad thing down to the left. So I'm going to guess these light. These light pink things are the bad things. Yeah. Yeah. These are the ladders. Cool. Bad thing right here. We are rocking this. OK. Key. Where's that? That'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 get really actually it's going to here. So masked affordances. What they're saying is that, OK, you can kind of from the way something looks, you can tell what you can do with it. For example, the platforms you can 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 OK, so these these green ones are these green ones are the platforms right here. So I can still see that that must be the latter. 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 can you can do the same things with. Like we said, the green ones are probably the platforms. So they took it away. Gee. OK, so that must be OK. Can't go here. Fell down. Let's try again. This is a platform. Is this one here? Yes. These are platforms. Ah, that was easy. Too easy. Too easy running into that bad blob there. OK, the ladders are still like this, but then OK. Yeah, this gets harder as as you can. Gee. OK, I'm too dumb to remember from before. I'm like the ideal subject because I don't remember. How did this work? 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. OK, here we can. OK, see my short term memory is so bad. OK, we got the key. Now just get over to the door. Doors over there. Yeah. OK, now let's wipe the short term memory again. Here changed ladder interaction where they basically say, OK, one of the things that you could know from the real world is how 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. OK. 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 that's necessarily super hard. And now it feels a bit like, you know, the Super Mario maker thing where 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 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 OK, no, no, no, this is so unintuitive for real. Yeah, got it. Got it. OK. Really? Try this out. This is crazy. Yeah. Yeah. OK, 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. OK, so we figured out where the blue. Cool. So where's the next? This is the next platform. Where's the OK. There must be like a yeah, take that. OK, 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. OK. The white done this. I know there's a bad thing here, but we'd 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 our. No spikes. This is what you're doing to our algorithms. If you're 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 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. No, there is a there's like a bad thing here. Right. No spikes. OK. So either we build these priors into the 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 onto a paper or I don't know. Or we just take it that algorithms 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 trying it for the first time and they're just like, oh, an ice cream. So it can also hurt. Right. The 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 would 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 RL agent. And you see here the RL agent just don't care about any of these things except visual similarity. So visual similarity helps the RL 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 convolutional neural 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 RL agent because the RL agent will actually try those things out. And the human having the prior that the black thing is like 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 RL 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. They're a lot of fun, especially if you try them first time. And bye bye.
[ { "start": 0, "end": 11, "text": " Hey there, what's going on today? We're looking at investigating human priors for playing video games by Rachid Duby, Pulkit Agrawal, Deepak Patak, Tom Griffiths and Alexei Aeferos." }, { "start": 11, "end": 19, "text": " 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." }, { "start": 19, "end": 26, "text": " But basically they're trying to investigate what makes video games work for humans. So what do humans pay attention to?" }, { "start": 26, "end": 34, "text": " What priors bring humans into a video game? And the fun thing is they've created these games where they ablate these individual priors." }, { "start": 34, "end": 42, "text": " 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." }, { "start": 42, "end": 48, "text": " So you only need the arrow keys. If you go to a bad blob like this, then you die." }, { "start": 48, "end": 53, "text": " And you can jump on them and you can use the ladders and the spikes. They'll hurt you if you jump on them." }, { "start": 53, "end": 62, "text": " 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 bada boom." }, { "start": 62, "end": 69, "text": " Cool. So let's try out. So they basically ablate different things here." }, { "start": 69, "end": 74, "text": " Mask semantics means that you don't know what the objects are anymore." }, { "start": 74, "end": 78, "text": " So you might go over here and you might be like, what's this green thing? Can I jump on it? Oh." }, { "start": 78, "end": 83, "text": " So we're probably a bit biased because we've seen the game before." }, { "start": 83, "end": 90, "text": " So we know that these are the pink ones are the bad ones. And that's the key. So we should probably get it." }, { "start": 90, "end": 95, "text": " But you can imagine that it is a bit harder, but you could still solve it right." }, { "start": 95, "end": 104, "text": " 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." }, { "start": 104, "end": 109, "text": " But I think humans could probably still figure it out with like some minimal trial and error." }, { "start": 109, "end": 121, "text": " I do this ice cream cone. You realize, OK, 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." }, { "start": 121, "end": 126, "text": " But now these are masked. So basically you don't know what's like a relevant object and what isn't." }, { "start": 126, "end": 135, "text": " So I know that there is like a bad thing here and a bad thing down to the left. So I'm going to guess these light." }, { "start": 135, "end": 143, "text": " These light pink things are the bad things. Yeah. Yeah. These are the ladders. Cool. Bad thing right here." }, { "start": 143, "end": 149, "text": " We are rocking this. OK. Key. Where's that? That's the key and the door." }, { "start": 149, "end": 156, "text": " 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." }, { "start": 156, "end": 163, "text": " Still, still solvable. So let's jump over these on the left because these get really actually it's going to here." }, { "start": 163, "end": 171, "text": " So masked affordances. What they're saying is that, OK, you can kind of from the way something looks, you can tell what you can do with it." }, { "start": 171, "end": 179, "text": " For example, the platforms you can jump on them and the background is sort of empty space. So you know that there's nothing much happening there." }, { "start": 179, "end": 187, "text": " 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." }, { "start": 187, "end": 197, "text": " And it does get significantly harder because OK, so these these green ones are these green ones are the platforms right here." }, { "start": 197, "end": 202, "text": " So I can still see that that must be the latter. Right." }, { "start": 202, "end": 211, "text": " 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." }, { "start": 211, "end": 216, "text": " We got this. Now it gets harder. Masked visual similarity." }, { "start": 216, "end": 228, "text": " 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 can you can do the same things with." }, { "start": 228, "end": 233, "text": " Like we said, the green ones are probably the platforms. So they took it away." }, { "start": 233, "end": 237, "text": " Gee. OK, so that must be OK. Can't go here." }, { "start": 237, "end": 246, "text": " Fell down. Let's try again. This is a platform. Is this one here? Yes. These are platforms." }, { "start": 246, "end": 252, "text": " Ah, that was easy. Too easy. Too easy running into that bad blob there." }, { "start": 252, "end": 258, "text": " OK, the ladders are still like this, but then OK." }, { "start": 258, "end": 265, "text": " Yeah, this gets harder as as you can. Gee. OK, I'm too dumb to remember from before." }, { "start": 265, "end": 269, "text": " I'm like the ideal subject because I don't remember." }, { "start": 269, "end": 273, "text": " How did this work?" }, { "start": 273, "end": 280, "text": " 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." }, { "start": 280, "end": 286, "text": " OK, here we can. OK, see my short term memory is so bad." }, { "start": 286, "end": 292, "text": " OK, we got the key. Now just get over to the door. Doors over there. Yeah." }, { "start": 292, "end": 296, "text": " OK, now let's wipe the short term memory again." }, { "start": 296, "end": 306, "text": " Here changed ladder interaction where they basically say, OK, one of the things that you could know from the real world is how these objects work in the real world." }, { "start": 306, "end": 313, "text": " So there's not really any pink blobs with evil faces. There might be spikes. Yes. But ladder is something, you know, that works." }, { "start": 313, "end": 318, "text": " So if you want to go up here, that doesn't work. So you kind of have to figure. OK." }, { "start": 318, "end": 326, "text": " 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." }, { "start": 326, "end": 330, "text": " I think humans are able to figure that out fairly quickly because you kind of on the ladder, right?" }, { "start": 330, "end": 335, "text": " You can actually go down easily. You're on the ladder and then it kind of doesn't work." }, { "start": 335, "end": 343, "text": " And then you kind of try to wiggle because there's two of them. I don't think that's that's necessarily super hard." }, { "start": 343, "end": 355, "text": " And now it feels a bit like, you know, the Super Mario maker thing where where people just try to make levels as hard as possible and trick you with trick blocks and invisible stuff." }, { "start": 355, "end": 362, "text": " This is hard. So the direction of gravity. So now the left key jumps right here, this key." }, { "start": 362, "end": 373, "text": " So this is like this is extremely, extremely hard because I have to like think about every move I make before I do it." }, { "start": 373, "end": 381, "text": " And OK, no, no, no, this is so unintuitive for real." }, { "start": 381, "end": 391, "text": " Yeah, got it. Got it. OK. Really? Try this out. This is crazy. Yeah. Yeah." }, { "start": 391, "end": 398, "text": " OK, so the last thing is we combine all of it, I guess, except the changed gravity and changed interaction." }, { "start": 398, "end": 403, "text": " So now all the priors, all the visual object priors removed." }, { "start": 403, "end": 411, "text": " This is this is King's Discipline right here. OK, so we figured out where the blue. Cool." }, { "start": 411, "end": 416, "text": " So where's the next? This is the next platform. Where's the OK." }, { "start": 416, "end": 422, "text": " There must be like a yeah, take that. OK, but we know the next." }, { "start": 422, "end": 428, "text": " So we can't really generalize from this because we know the next bad blob isn't going to be the same color." }, { "start": 428, "end": 434, "text": " Right. OK. The white done this." }, { "start": 434, "end": 438, "text": " I know there's a bad thing here, but we'd have to figure this out." }, { "start": 438, "end": 444, "text": " So basically kind of the point of the paper, I think, is to say that this is what you're doing to our." }, { "start": 444, "end": 449, "text": " No spikes. This is what you're doing to our algorithms." }, { "start": 449, "end": 460, "text": " If you're 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." }, { "start": 460, "end": 466, "text": " Now, of course, the algorithms can also exhibit like can also use the visual similarity." }, { "start": 466, "end": 472, "text": " That was the key. Yeah. Yeah. Let's go to the door door door. No, there is a there's like a bad thing here." }, { "start": 472, "end": 477, "text": " Right. No spikes." }, { "start": 477, "end": 499, "text": " OK." }, { "start": 499, "end": 515, "text": " So either we build these priors into the 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 onto a paper or I don't know." }, { "start": 515, "end": 521, "text": " Or we just take it that algorithms have to figure all of this out by themselves." }, { "start": 521, "end": 532, "text": " 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." }, { "start": 532, "end": 538, "text": " Reverse semantics. I believe these are humans that are trying it for the first time and they're just like, oh, an ice cream." }, { "start": 538, "end": 544, "text": " So it can also hurt. Right. The algorithm wouldn't be super impressed by it looking like an ice cream." }, { "start": 544, "end": 557, "text": " 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." }, { "start": 557, "end": 565, "text": " This is just mad. Like no freaking way. I would actually like love to see video games like this coming out." }, { "start": 565, "end": 578, "text": " This would 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." }, { "start": 578, "end": 587, "text": " So here they have another game and they do this same thing on an RL agent. And you see here the RL agent just don't care about any of these things except visual similarity." }, { "start": 587, "end": 596, "text": " So visual similarity helps the RL agent to generalize across the game. So if you see a bad blob, the next bad blob will look similar." }, { "start": 596, "end": 603, "text": " And that's sort of kind of an invariance that we know they can exploit since they're using convolutional neural networks and so on." }, { "start": 603, "end": 610, "text": " But I think it is really drawing attention to the importance of priors prior knowledge in reinforcement learning and human knowledge." }, { "start": 610, "end": 623, "text": " 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 RL agent because the RL agent will actually try those things out." }, { "start": 623, "end": 632, "text": " And the human having the prior that the black thing is like they don't see the yellow boxes that the black thing is just empty space." }, { "start": 632, "end": 640, "text": " They won't even explore that. So maybe, you know, that is something to think about with respect to building RL agents." }, { "start": 640, "end": 646, "text": " 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." }, { "start": 646, "end": 652, "text": " Check out the website. Try these games for yourself. They're a lot of fun, especially if you try them first time." }, { "start": 652, "end": 662, "text": " And bye bye." } ]
u5BkO8XMS2I
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
iMAML: Meta-Learning with Implicit Gradients (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper" ]
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 Arwind Rajeshwaran, Chelsea Finn, Shamka Khod 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, which gives 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. These are all perfectly fine independent tasks. For 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 the 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 ImageNet. I have this giant database ImageNet with labeled images. What I can do is I can use this to train a neural network. These are the bunch of layers of neural network and I can train the neural network on this big database and get parameters theta. 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 phi. So phi one 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 a 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 multitask learning. What we do in multitask learning is we say, well see probably a neural network that can segment the grounds is also pretty good at doing bounding boxes. It will use some of the same features. So can't we just kind of pull together these datasets into one bigger dataset and then train on, like if it's an image from task one we'll train on the loss of task one and if it's an image from task two we'll 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. So this is called multitask learning. We 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 in 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 fully gear to one task because it also 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 multitask learning. Now meta learning goes a different direction. Meta learning is like transfer learning but it says well what if we don't have this giant data set right here? What if we find a way to learn these initial parameters? 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 fine-tuning to come up with their own parameters starting at theta 0. So this is phi 1 started from theta 0 and we'll also give it to task 2 and to task 3. 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. 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 1? 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? And even more so there could be task 4 which we are not seeing during this training phase right? This is kind of our... so these up here could be our 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 meta learning is basically to come up with a learning procedure to generate to iteratively generate better and better and better initial parameters. And what better way to do this than using gradient descent? So this is this is meta learning using gradient descent 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 meta learning using gradients was done in this technique called MAML. And essentially what you can see here is that if 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 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. 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. So this thing here is the neural network that finally determines the loss function. So if we want to back propagate we can back propagate this loss function through the neural network the f 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 shift it up here so something like this and then I will end up here but that's not guaranteed like this is a super nonlinear 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 nonlinear 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 nonlinear 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 and 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 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 nonlinear 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 meta learning parameters and they call this the outer level so on an outer level you want to run gradient descent to find the best meta 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 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 dependence on the task here there is no I 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 meta 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 just 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 they do 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 ALG that's the inner optimization procedure needs to incorporate some form of regularization right so 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 Bayesian 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 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 Phi I on the meta parameters shrinks and vanishes as the number of gradient steps in our growth 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 its dependence and especially for gradient descent its 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 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 the we don't just want to find the minimum of this inner loss function that's a 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 L2 norm so it's a quadratic regularizer on how close you might know from you know initial supervised learning or something that sometimes you do something like plus lambda times the L2 norm of the weight so this would be called weight regularization weight decay L2 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 ALG star we denote it so if ALG 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 ALG 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 the Phi 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 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 ALG star here minimizes this function G right now G has two arguments G as G has these parameters which are the local parameters and these are the meta parameters and we only optimize the local parameters right 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 have 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 ALG 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 team 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 ALG 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 backprop 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 problem 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 in 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 the question right how do we derive the the algorithmic procedure this thing rear 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 shagada 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 closed 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 simply one backward prop through the network the second thing we can also do pretty easily this is an L2 norm all right we know how to derive a square so the 2 comes down and the 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 F we will always optimize to the end we will always optimize this to its minimum right this star denotes 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 its gradient at that particular point is zero 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 um let's take this to the right side so we'll have this gradient right here and I'm just gonna write L 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 these parameters aren't just you know parameters per se 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 I'm just 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 closed 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're just let SGD run it would go there but now since you have this regularizer SGD needs to find a trade-off 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 not go to any isoline 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 there back here so we can express this Jacobian enclosed form because this is a quadratic and 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 Farin Hussar's blog post 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 converge to do sample a batch 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 pretty easy how do you do this how do you do this implicit implicit meta gradient this is this procedure right here so what you are going to do is met the parameters theta you initialize your parameters with the theta by the way it they don't need to be initializations they can be actually any sort of hyper parameters that this algorithm takes any parameter ization of this algorithm will do fine I just always said initial parameters such that it gets easier but it can be any sort of hyper parameters of the inner task obtain task parameters using iterative optimization solver such that the 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 datasets this is one back prop 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 invert it 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 integral 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 meta gradient okay so two approximations here first approximation you don't actually have to solve to the very end you can solve it Delta close and second approximation you don't actually have to compute the inverse of that final gradient 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 oh you cannot you can't actually see that here that 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 optimized to the end how close are you getting of course the problem with this method right here is that you do these approximations 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 nonlinear 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 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 also a bit 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 reach a much lower error and ten steps isn't that much for an algorithm like this as you can see here the ten steps your computation time will still in in the 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 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 bye bye
[ { "start": 0, "end": 4.94, "text": " Hi there! Today we're looking at meta-learning with implicit gradients by" }, { "start": 4.94, "end": 10.84, "text": " Arwind Rajeshwaran, Chelsea Finn, Shamka Khod and Sergei Levine." }, { "start": 10.84, "end": 16.080000000000002, "text": " So this paper deals with the task of meta-learning. Now if you don't know what" }, { "start": 16.080000000000002, "end": 20.76, "text": " meta-learning is, let me quickly introduce the term. So in meta-learning" }, { "start": 20.76, "end": 25.64, "text": " you assume you have some sort of a distribution of tasks ahead. So let's" }, { "start": 25.64, "end": 31.28, "text": " make some examples. For example, task one could be you get an image, you have a" }, { "start": 31.28, "end": 39.68, "text": " data set of images and you want to classify them into cats or dogs. And you" }, { "start": 39.68, "end": 43.08, "text": " know you have a little data set with labeled images and you can train, test," }, { "start": 43.08, "end": 49.64, "text": " split that and that's one task. Now task two is going to be, again you have a" }, { "start": 49.64, "end": 54.96, "text": " small data set of different images, but let's just all make image examples here." }, { "start": 54.96, "end": 60.84, "text": " But you want to locate the pedestrian, so you want to locate the human in the" }, { "start": 60.84, "end": 70.84, "text": " image. So where is the human? And the task three could be again a small" }, { "start": 70.84, "end": 78.6, "text": " database of tasks, sorry of images and in each of the image you want to visually" }, { "start": 78.6, "end": 86.28, "text": " question answer. Or let's say you want to point out, there is a" }, { "start": 86.28, "end": 90.88, "text": " ground, there is a tree and there is a question about it. Yeah let's say visual" }, { "start": 90.88, "end": 95.56, "text": " question answering, which gives you yes or no questions, something" }, { "start": 95.56, "end": 102.39999999999999, "text": " like this. Now let's just say you have to segment, you have to segment that image." }, { "start": 102.39999999999999, "end": 107, "text": " So down here would be ground, you have to segment the ground. Okay so these are" }, { "start": 107, "end": 113.48, "text": " all image tasks. These are all perfectly fine independent tasks. For" }, { "start": 113.48, "end": 119.08, "text": " each one you have a small data set. Now sometimes these data sets are very very" }, { "start": 119.08, "end": 124.24000000000001, "text": " small, such that you cannot really train a state-of-the-art model on them. For" }, { "start": 124.24000000000001, "end": 129.6, "text": " example if you have medical images, oftentimes the labels of these are very" }, { "start": 129.6, "end": 133.96, "text": " hard to get. I mean there's privacy concerns and then you know doctors have" }, { "start": 133.96, "end": 139.12, "text": " to look at it to produce the images, costs money and so on. So it's not like" }, { "start": 139.12, "end": 145.20000000000002, "text": " you have a lot of images and you could profit from more images. So one method" }, { "start": 145.20000000000002, "end": 149.52, "text": " that people come up with is called transfer learning. So in transfer" }, { "start": 149.52, "end": 154.24, "text": " learning you say I have this giant database of images. Let's say" }, { "start": 154.24, "end": 159.16, "text": " this is ImageNet. I have this giant database ImageNet with labeled" }, { "start": 159.16, "end": 165.88, "text": " images. What I can do is I can use this to train a neural network." }, { "start": 165.88, "end": 170.04, "text": " These are the bunch of layers of neural network and I can train the neural" }, { "start": 170.04, "end": 176.51999999999998, "text": " network on this big database and get parameters theta. These are the" }, { "start": 176.51999999999998, "end": 180.56, "text": " parameters of the neural network and then I will basically adapt these" }, { "start": 180.56, "end": 186.28, "text": " parameters to each task individually. So in task one, sorry about that, I would" }, { "start": 186.28, "end": 191.16, "text": " then take these parameters as an input to the neural network. I would initialize" }, { "start": 191.16, "end": 197.4, "text": " the neural network with these parameters and then I would use this training set" }, { "start": 197.4, "end": 204.16, "text": " in order to fine-tune, this is what's called fine-tuning, to the task specific" }, { "start": 204.16, "end": 210.64, "text": " parameters here phi. So phi one because it's task one. For task two I would" }, { "start": 210.64, "end": 217.27999999999997, "text": " also take these as a starting point in order to train its neural network to" }, { "start": 217.27999999999997, "end": 223.2, "text": " fine-tune it on this bounding box task in order to obtain the parameters for" }, { "start": 223.2, "end": 228.48, "text": " task two. So you can see that there's a pre-training stage here to" }, { "start": 228.48, "end": 234.45999999999998, "text": " obtain good initial parameters and then we adapt these initial parameters for" }, { "start": 234.45999999999998, "end": 240.16, "text": " each task separately in a fine-tuning stage. So this is one way we can do it." }, { "start": 240.16, "end": 245.35999999999999, "text": " Another way we can do it is called multitask learning. What we do in" }, { "start": 245.35999999999999, "end": 252.07999999999998, "text": " multitask learning is we say, well see probably a neural network that" }, { "start": 252.07999999999998, "end": 256.84, "text": " can segment the grounds is also pretty good at doing bounding boxes. It will" }, { "start": 256.84, "end": 261.52, "text": " use some of the same features. So can't we just kind of pull together these" }, { "start": 261.52, "end": 269.08, "text": " datasets into one bigger dataset and then train on, like if it's an" }, { "start": 269.08, "end": 273.12, "text": " image from task one we'll train on the loss of task one and if it's an image" }, { "start": 273.12, "end": 277.44, "text": " from task two we'll train on the loss of task two and so on. But we'll sort of use" }, { "start": 277.44, "end": 282.47999999999996, "text": " the same neural network basis. We just have kind of different heads on top of" }, { "start": 282.47999999999996, "end": 286.59999999999997, "text": " them. So this is called multitask learning. We have one" }, { "start": 286.59999999999997, "end": 292.52, "text": " shared neural network with different outputs for the different tasks and" }, { "start": 292.52, "end": 298.52, "text": " basically counting on the fact that you can sort of learn from one task what's" }, { "start": 298.52, "end": 303.88, "text": " useful in the other. Now this is a good method to combine the tasks and to" }, { "start": 303.88, "end": 309.88, "text": " basically share data information but it will also limit you because you now have" }, { "start": 309.88, "end": 314.96, "text": " to trade off between the tasks. Like this neural network right here, this joint" }, { "start": 314.96, "end": 322.68, "text": " encoder, will never be able to fully gear to one task because it" }, { "start": 322.68, "end": 329.12, "text": " also has to perform for the other tasks as well. So you kind of" }, { "start": 329.12, "end": 334.44, "text": " limit yourself in your top-out accuracy. Now maybe the regularization effect is" }, { "start": 334.44, "end": 339.64, "text": " good. So these are two methods. The first is called transfer learning here on the" }, { "start": 339.64, "end": 346.8, "text": " left and the other is called multitask learning. Now meta learning goes a" }, { "start": 346.8, "end": 351.88, "text": " different direction. Meta learning is like transfer learning but it says well" }, { "start": 351.88, "end": 359.15999999999997, "text": " what if we don't have this giant data set right here? What if we" }, { "start": 359.15999999999997, "end": 365.92, "text": " find a way to learn these initial parameters? So what we'll do is we'll" }, { "start": 365.92, "end": 371.32, "text": " start out with a guess. A guess of good initial parameters. Let's call that theta" }, { "start": 371.32, "end": 379.24, "text": " zero. And now we have all of these three tasks take theta zero and run their" }, { "start": 379.24, "end": 386.52, "text": " fine-tuning to come up with their own parameters starting at theta 0." }, { "start": 386.52, "end": 392.92, "text": " So this is phi 1 started from theta 0 and we'll also give it to task 2 and to" }, { "start": 392.92, "end": 400.6, "text": " task 3. And each of these tasks is going to train on its own training data" }, { "start": 400.6, "end": 406.96000000000004, "text": " set and then evaluate on its own validation data set and then report back" }, { "start": 406.96, "end": 412.28, "text": " a number. So we do this for every task and every task basically trains this," }, { "start": 412.28, "end": 417, "text": " runs through the validation data set, reports back a generalization error and" }, { "start": 417, "end": 421.35999999999996, "text": " then we know once we get all the information from all the tasks we know" }, { "start": 421.35999999999996, "end": 427.64, "text": " how good were these initial parameters. We get a measure of how easy is it" }, { "start": 427.64, "end": 434.64, "text": " for the tasks to adapt these initial parameters to their own data set. And" }, { "start": 434.64, "end": 441.15999999999997, "text": " then we somehow need to figure out a way. Okay these parameters were on average" }, { "start": 441.15999999999997, "end": 448.15999999999997, "text": " 81% good. Can we come up with a better set of initial parameters theta 1? In" }, { "start": 448.15999999999997, "end": 453.64, "text": " some way can we somehow find a better set of initial parameters such that it" }, { "start": 453.64, "end": 460.08, "text": " is easier for the tasks to adapt these initial parameters? And even more so" }, { "start": 460.08, "end": 466.59999999999997, "text": " there could be task 4 which we are not seeing during this training phase right?" }, { "start": 466.59999999999997, "end": 471.71999999999997, "text": " This is kind of our... so these up here could be our training tasks and" }, { "start": 471.71999999999997, "end": 476.15999999999997, "text": " this down here could be our validation task. So basically we're trying to come" }, { "start": 476.15999999999997, "end": 481.71999999999997, "text": " up with a set of initial parameters that if a new task comes along and it takes" }, { "start": 481.71999999999997, "end": 489.2, "text": " this thing as its initial parameters it will be able to adapt very quickly these" }, { "start": 489.2, "end": 495.4, "text": " initial parameters to its own data set. And most importantly it can do that it" }, { "start": 495.4, "end": 500.12, "text": " will result in a much better model than had the task just trained on its own" }, { "start": 500.12, "end": 507.36, "text": " small data set from scratch. So our task is in meta learning is basically to come" }, { "start": 507.36, "end": 511.4, "text": " up with a learning procedure to generate to iteratively generate better and" }, { "start": 511.4, "end": 517.8, "text": " better and better initial parameters. And what better way to do this than using" }, { "start": 517.8, "end": 524.5999999999999, "text": " gradient descent? So this is this is meta learning using gradient descent is" }, { "start": 524.5999999999999, "end": 532.3199999999999, "text": " the core of this paper basically. Now what do you need for gradient descent?" }, { "start": 532.3199999999999, "end": 538.04, "text": " So if you want to try to go from one task to the next using SGD or even GD" }, { "start": 538.04, "end": 542.24, "text": " gradient descent you need to come up with a gradient. Now why is this a" }, { "start": 542.24, "end": 548.52, "text": " problem in this case? So this is in this figure. So this meta learning using" }, { "start": 548.52, "end": 554, "text": " gradients was done in this technique called MAML. And essentially what you can" }, { "start": 554, "end": 559.5600000000001, "text": " see here is that if you have this set of initial parameters this is your" }, { "start": 559.5600000000001, "end": 563.6800000000001, "text": " current best guess of these good initial parameters and you want to come up with" }, { "start": 563.6800000000001, "end": 568.16, "text": " a gradient of how to get an even better set. Now this gradient here is indicated" }, { "start": 568.16, "end": 573.56, "text": " by this arrow. So you don't let's imagine you don't know the gradient yet you want" }, { "start": 573.56, "end": 578.6, "text": " to come up with a gradient. So what you'll need to do is you'll basically" }, { "start": 578.6, "end": 583.6, "text": " have to compute the loss function and you have to differentiate that loss" }, { "start": 583.6, "end": 587.9599999999999, "text": " function with respect to your parameters. That's down here what the description of" }, { "start": 587.9599999999999, "end": 592.04, "text": " the orange arrow. So the your loss function of your meta parameters is" }, { "start": 592.04, "end": 598.3199999999999, "text": " going to be the average or the sum of the loss functions across all of the" }, { "start": 598.3199999999999, "end": 603.36, "text": " different tasks individually. So the gradient is going to be the sum of the" }, { "start": 603.36, "end": 609.68, "text": " gradients of these loss functions with respect to your original parameter. Now" }, { "start": 609.68, "end": 615.5, "text": " this is the difference right? Usually we differentiate with respect to the" }, { "start": 615.5, "end": 620.5999999999999, "text": " parameters that we input into the loss function. But not here. What we input" }, { "start": 620.6, "end": 626.0400000000001, "text": " into the loss function is what is at the end of the task adapting to its own" }, { "start": 626.0400000000001, "end": 632.64, "text": " parameters. So this thing we input here is a function of our initial parameters" }, { "start": 632.64, "end": 637.2, "text": " but it's not our initial parameters. So what we have is initial parameters we" }, { "start": 637.2, "end": 644.76, "text": " give them to a task. This task runs SGD for k steps it runs it for a" }, { "start": 644.76, "end": 652.64, "text": " number of steps comes up with the adapted version to its own problem that" }, { "start": 652.64, "end": 660.96, "text": " goes into a loss function. So this thing here is the" }, { "start": 660.96, "end": 664.98, "text": " neural network that finally determines the loss function. So if we want to" }, { "start": 664.98, "end": 669.04, "text": " back propagate we can back propagate this loss function through the" }, { "start": 669.04, "end": 673.04, "text": " neural network the f the neural network is right here is parameterized by these" }, { "start": 673.04, "end": 676.9599999999999, "text": " things we can back propagate through that but then we'll have to back" }, { "start": 676.9599999999999, "end": 681.56, "text": " propagate through the optimization procedure that was used to derive these" }, { "start": 681.56, "end": 688.1999999999999, "text": " things. So that's the the problem right here. You can see this here you start" }, { "start": 688.1999999999999, "end": 692.52, "text": " out with the initial parameters and let's say you give them to task one. Task" }, { "start": 692.52, "end": 698.4, "text": " one is going to take these as initialization and then run SGD so maybe" }, { "start": 698.4, "end": 705.88, "text": " it will perturb these parameters to come up with here phi one these parameters" }, { "start": 705.88, "end": 712.16, "text": " these parameters are the adapted version for task one and then at the end of task" }, { "start": 712.16, "end": 716.8, "text": " one you use these characterizing neural network and you can calculate a" }, { "start": 716.8, "end": 722.9399999999999, "text": " gradient. So how would you need to update these parameters in order to make the" }, { "start": 722.9399999999999, "end": 727.84, "text": " loss go down and the neural network or sorry the computation will maybe result" }, { "start": 727.84, "end": 734.12, "text": " well you need to go up a bit. Well this is too strong. It will maybe say you need" }, { "start": 734.12, "end": 740.02, "text": " to go into this direction right here with respect to these parameters but now" }, { "start": 740.02, "end": 745.76, "text": " the question is how do you have to adjust your initial parameters such that" }, { "start": 745.76, "end": 750.48, "text": " your your final parameters will go into that direction and that's not really" }, { "start": 750.48, "end": 753.94, "text": " clear you could make a guess right you could make a guess and say well if my" }, { "start": 753.94, "end": 758.96, "text": " initial parameters just go up a bit maybe the optimization procedure will" }, { "start": 758.96, "end": 764.0400000000001, "text": " just you know sort of look the same but shift it up here so something like this" }, { "start": 764.0400000000001, "end": 768.84, "text": " and then I will end up here but that's not guaranteed like this is a super" }, { "start": 768.84, "end": 773.5600000000001, "text": " nonlinear procedure that you're running it through this SGD thing and it will" }, { "start": 773.5600000000001, "end": 779.36, "text": " basically it's an iterative recursive procedure so it will sort of accumulate" }, { "start": 779.36, "end": 785.96, "text": " its own nonlinear errors and that's why what you have to do is basically you" }, { "start": 785.96, "end": 791.6800000000001, "text": " forward propagate through SGD and then you have to back propagate this gradient" }, { "start": 791.6800000000001, "end": 795.32, "text": " right here you have to back propagate this through the entire SGD" }, { "start": 795.32, "end": 800.5600000000001, "text": " optimization procedure and that is computationally very expensive because" }, { "start": 800.5600000000001, "end": 804.02, "text": " if you have to compute the loss once here for a neural network you have to" }, { "start": 804.02, "end": 809.4399999999999, "text": " forward pass once and the back propagation will cost as much as the forward" }, { "start": 809.4399999999999, "end": 814.36, "text": " propagation or maybe twice as much constant number but if you run k steps" }, { "start": 814.36, "end": 820.28, "text": " of SGD you basically have to trace back those k steps via back propagating it" }, { "start": 820.28, "end": 826.4399999999999, "text": " through each step so basically this is k times a back propagation step and then" }, { "start": 826.4399999999999, "end": 832.16, "text": " computationally that's just not feasible for more than very few steps and so you" }, { "start": 832.16, "end": 835.9399999999999, "text": " can only ever do very few steps you basically accumulate your nonlinear" }, { "start": 835.9399999999999, "end": 840.7199999999999, "text": " error because gradient descent is a linear procedure and then you get some" }, { "start": 840.7199999999999, "end": 845.3199999999999, "text": " estimation of the gradient at the end now if you do that for all of your tasks" }, { "start": 845.3199999999999, "end": 850.64, "text": " then finally you can decide so maybe for a task one here the result will be in" }, { "start": 850.64, "end": 855.9599999999999, "text": " order to make this go up a bit you need to shift this a bit to up and the right" }, { "start": 855.9599999999999, "end": 861.4, "text": " right because then the gradient descent will kind of sort of end up here and you" }, { "start": 861.4, "end": 867.4399999999999, "text": " do this for all tasks and you average the gradient like here then you can come" }, { "start": 867.4399999999999, "end": 873.52, "text": " up with a final gradient for your inner sorry for your outer model for your" }, { "start": 873.52, "end": 881.12, "text": " initial parameters so this is a big load of computation that mammal does here now" }, { "start": 881.12, "end": 885.56, "text": " there is a naive approximation and this is exactly what we said at the beginning" }, { "start": 885.56, "end": 890.96, "text": " right this first-order mammal is the guess that if we want to go up a bit at" }, { "start": 890.96, "end": 896.6800000000001, "text": " the end here why don't we shift the beginning up a bit right and so the" }, { "start": 896.6800000000001, "end": 901.0400000000001, "text": " first-order mammal would just result in basically looking at the gradients at" }, { "start": 901.0400000000001, "end": 905.88, "text": " the end and sort of aggregating them right here and then coming up with a" }, { "start": 905.88, "end": 912.12, "text": " gradient but this is very inaccurate and generally doesn't work well because you" }, { "start": 912.12, "end": 919.6800000000001, "text": " have to understand how your end gradient is connected to your initial gradient" }, { "start": 919.68, "end": 926.8, "text": " because this is very nonlinear you can't just basically transfer it over now" }, { "start": 926.8, "end": 932.04, "text": " implicit mammal this paper right here circumvents that it circumvents the step" }, { "start": 932.04, "end": 938.04, "text": " to have to explicitly back propagate this gradient along the forward pass but" }, { "start": 938.04, "end": 944.28, "text": " it's still able to come up with an expression for how the final gradient" }, { "start": 944.28, "end": 952.8399999999999, "text": " relates to the initial gradient so this is quite cool and we're in this video I" }, { "start": 952.8399999999999, "end": 958.3199999999999, "text": " would basically like to explore how this comes about and why this comes about we" }, { "start": 958.3199999999999, "end": 961.88, "text": " won't go through all the theory and the proofs but I would like you to" }, { "start": 961.88, "end": 966.52, "text": " understand that this comes about by basically them imposing a quadratic" }, { "start": 966.52, "end": 972.4, "text": " regularizer and therefore this quadratic regularizer makes a very it kind of" }, { "start": 972.4, "end": 977.04, "text": " gives rise to a very strong connection between this final gradient and this" }, { "start": 977.04, "end": 981.4399999999999, "text": " initial gradient so they can basically transform one into the other and" }, { "start": 981.4399999999999, "end": 988.76, "text": " therefore they can compute the initial gradient in a closed form setting or at" }, { "start": 988.76, "end": 996.04, "text": " least in theory all right this was this now let's go into the problem formulation" }, { "start": 996.04, "end": 1003.28, "text": " as they see it the entire problem formulation is you want to find these" }, { "start": 1003.28, "end": 1009.24, "text": " best meta learning parameters and they call this the outer level so on an" }, { "start": 1009.24, "end": 1013.1999999999999, "text": " outer level you want to run gradient descent to find the best meta learning" }, { "start": 1013.1999999999999, "end": 1020.68, "text": " parameters to minimize this function F right here now what is F F is the average" }, { "start": 1020.68, "end": 1025.52, "text": " of the validation loss function so here this is the loss function on the test" }, { "start": 1025.52, "end": 1032.24, "text": " sets of the individual tasks and the neural network that we evaluate on the" }, { "start": 1032.24, "end": 1038.36, "text": " test set is the neural network that is trained the algorithm is" }, { "start": 1038.36, "end": 1043.8799999999999, "text": " a training algorithm is trained on the training set of that particular task" }, { "start": 1043.8799999999999, "end": 1049.84, "text": " while starting from these parameters theta now you see there is no" }, { "start": 1049.84, "end": 1055.04, "text": " dependence on the task here there is no I down here for these meta" }, { "start": 1055.04, "end": 1059.12, "text": " parameters because these are always the same right that's the crucial point all" }, { "start": 1059.12, "end": 1065.52, "text": " the tasks start from the same initial parameters then they optimize on their" }, { "start": 1065.52, "end": 1070.52, "text": " own training data set and then they evaluate on their own test data set and" }, { "start": 1070.52, "end": 1075.44, "text": " that will give you the loss for that particular task and your goal is to find" }, { "start": 1075.44, "end": 1080.48, "text": " the meta parameters such that this function here the average loss that" }, { "start": 1080.48, "end": 1093.28, "text": " results from this procedure is minimal okay so where they say right here the" }, { "start": 1093.28, "end": 1098.72, "text": " inner level is this algorithm component so the algorithm starts from these from" }, { "start": 1098.72, "end": 1105.32, "text": " these meta parameters and runs gradient steps on the training data set loss now" }, { "start": 1105.32, "end": 1110.4, "text": " this is just the first step right here of this procedure of course in the next" }, { "start": 1110.4, "end": 1116.96, "text": " step these are going to be replaced by the by the Phi that by the Phi I that" }, { "start": 1116.96, "end": 1121.0800000000002, "text": " results from the previous step so the first step is run on the meta parameters" }, { "start": 1121.0800000000002, "end": 1127, "text": " and then subsequently the task specific parameters are updated the important" }, { "start": 1127, "end": 1131.1200000000001, "text": " thing here is that this doesn't need to be gradient descent actually with their" }, { "start": 1131.1200000000001, "end": 1135.02, "text": " method because their method doesn't need to back propagate through the" }, { "start": 1135.02, "end": 1140.3600000000001, "text": " optimization you can think of any inner optimization procedure that you want it" }, { "start": 1140.36, "end": 1146.8, "text": " can be like a black box solver whatever you want I'm going to be just" }, { "start": 1146.8, "end": 1151.56, "text": " interesting to see how this is going to affect something like reinforcement" }, { "start": 1151.56, "end": 1155, "text": " learning and so on this might have already happened and I have not looked" }, { "start": 1155, "end": 1162.52, "text": " up this so the crucial part of the paper I think is right here and it's sort of" }, { "start": 1162.52, "end": 1168.1999999999998, "text": " like you know section 2.2 but I would I would want to point out that I think" }, { "start": 1168.2, "end": 1173.76, "text": " this is the crucial part this is why the method works ultimately why it's in why" }, { "start": 1173.76, "end": 1177.8, "text": " it's able to build this implicit gradient so they do section is called" }, { "start": 1177.8, "end": 1182.48, "text": " proximal regularization in the inner level and we'll go through this with a" }, { "start": 1182.48, "end": 1187.2, "text": " bit of detail to have sufficient learning in the inner level while also" }, { "start": 1187.2, "end": 1192.3, "text": " avoiding overfitting ALG that's the inner optimization procedure needs to" }, { "start": 1192.3, "end": 1199.52, "text": " incorporate some form of regularization right so their their sort their goal" }, { "start": 1199.52, "end": 1204.8799999999999, "text": " here or their point here is that if especially if these individual tasks" }, { "start": 1204.8799999999999, "end": 1213.08, "text": " have small training data set you need to have some kind of protection against" }, { "start": 1213.08, "end": 1220.68, "text": " overfitting and that and that and they say since mammal uses a small number of" }, { "start": 1220.68, "end": 1225.4, "text": " gradient steps this corresponds to early stopping and can be interpreted as a" }, { "start": 1225.4, "end": 1231.28, "text": " form of regularization and Bayesian prior so mammal is this this previous" }, { "start": 1231.28, "end": 1236.28, "text": " method this basic method that back propagates through the optimization" }, { "start": 1236.28, "end": 1240.96, "text": " procedure and since it does this since it back propagates through the" }, { "start": 1240.96, "end": 1247.02, "text": " optimization procedure it's computationally limited to only run very" }, { "start": 1247.02, "end": 1252, "text": " few forward optimization steps because it then has to back propagate through" }, { "start": 1252, "end": 1257.56, "text": " each one right needs to store each one so it's computationally limited so by" }, { "start": 1257.56, "end": 1264.28, "text": " necessity it uses only a small number of gradient steps and therefore this is" }, { "start": 1264.28, "end": 1268.68, "text": " kind of early stopping and we know to prevent overfitting one thing you can do" }, { "start": 1268.68, "end": 1275.04, "text": " is to stop before your training accuracy reaches full zero and you can stop" }, { "start": 1275.04, "end": 1279.44, "text": " earlier than that ideally at a point when your validation accuracy reaches" }, { "start": 1279.44, "end": 1285.8799999999999, "text": " the low point but they say basically this this limited number of steps is a" }, { "start": 1285.8799999999999, "end": 1293, "text": " form of regularization now of course in in this new method we we don't have this" }, { "start": 1293, "end": 1298.28, "text": " constraint anymore we can run our inner optimization to super convergence and" }, { "start": 1298.28, "end": 1304.28, "text": " therefore we we don't have this implicit regularizer anymore and we'll have to" }, { "start": 1304.28, "end": 1310, "text": " make up for that they say in cases like ill-conditioned optimization landscapes" }, { "start": 1310, "end": 1315.6399999999999, "text": " and medium-shot learning we may want to take many gradient steps which poses two" }, { "start": 1315.6399999999999, "end": 1320.6399999999999, "text": " challenges for mammal first we need to store and differentiate through the long" }, { "start": 1320.6399999999999, "end": 1325.44, "text": " optimization path of ALG which imposes a considerable computation and memory" }, { "start": 1325.44, "end": 1330.44, "text": " burden right that's what we said second the dependence of the model parameters" }, { "start": 1330.44, "end": 1336.8, "text": " Phi I on the meta parameters shrinks and vanishes as the number of gradient steps" }, { "start": 1336.8, "end": 1342.4, "text": " in our growth making meta learning difficult so what they're saying is if" }, { "start": 1342.4, "end": 1349.04, "text": " you optimize your inner optimization algorithm to the very end then it is not" }, { "start": 1349.04, "end": 1354, "text": " very it's its dependence and especially for gradient descent its linear" }, { "start": 1354, "end": 1361.08, "text": " dependence on the initial parameters so on the meta parameters shrinks the more" }, { "start": 1361.08, "end": 1365.8, "text": " optimization steps you do because the more and more you're going to basically" }, { "start": 1365.8, "end": 1369.88, "text": " forget about your initialization move away from that and move to a local" }, { "start": 1369.88, "end": 1374.6, "text": " optimum from which you could reach you know from many many different" }, { "start": 1374.6, "end": 1379.36, "text": " initializations so that's still a question whether that's happening but" }, { "start": 1379.36, "end": 1383.16, "text": " this that's the idea here right if you're at the local optimum you could" }, { "start": 1383.16, "end": 1387.92, "text": " have reached that from any sort of point and there's going to be very little" }, { "start": 1387.92, "end": 1392.0800000000002, "text": " information about the end of the procedure from the beginning and" }, { "start": 1392.0800000000002, "end": 1395.52, "text": " therefore if you want to calculate the gradient that's going to be like super" }, { "start": 1395.52, "end": 1402.4, "text": " inaccurate and they say to overcome these limitations so they they solve" }, { "start": 1402.4, "end": 1408.88, "text": " these two things in one right here we consider a more explicitly regularized" }, { "start": 1408.88, "end": 1416.3200000000002, "text": " algorithm so what they'll say is they'll say we don't just want to optimize this" }, { "start": 1416.3200000000002, "end": 1421.6000000000001, "text": " inner objective so this would be here so the we don't just want to find the" }, { "start": 1421.6000000000001, "end": 1426.6000000000001, "text": " minimum of this inner loss function that's a one goal we have but the other" }, { "start": 1426.6000000000001, "end": 1431.7600000000002, "text": " goal we have is to stay close to the initial parameters and that's where this" }, { "start": 1431.7600000000002, "end": 1437.3600000000001, "text": " regularizer in comes in here so this basically says we we want with our" }, { "start": 1437.36, "end": 1442.04, "text": " parameters here that we are optimizing we want to find them such that they" }, { "start": 1442.04, "end": 1447.08, "text": " minimize this loss function right you know really minimize it find the best" }, { "start": 1447.08, "end": 1455.28, "text": " point but also with a trade-off of lambda we want to stay close to the to" }, { "start": 1455.28, "end": 1460.1599999999999, "text": " the initial parameters that we started from right this is this is the initial" }, { "start": 1460.1599999999999, "end": 1464.32, "text": " parameters and the closeness is measured in the L2 norm so it's a quadratic" }, { "start": 1464.32, "end": 1470.4399999999998, "text": " regularizer on how close you might know from you know initial supervised" }, { "start": 1470.4399999999998, "end": 1474.6, "text": " learning or something that sometimes you do something like plus lambda times the" }, { "start": 1474.6, "end": 1480.52, "text": " L2 norm of the weight so this would be called weight regularization weight" }, { "start": 1480.52, "end": 1485.6799999999998, "text": " decay L2 normalization something like this where you regularize your weights" }, { "start": 1485.6799999999998, "end": 1491.4399999999998, "text": " such that you stay close to the zero point right implicitly in this there is" }, { "start": 1491.44, "end": 1500.04, "text": " a minus zero given but here you want to stay close to your initial parameters so" }, { "start": 1500.04, "end": 1505.16, "text": " the inner optimization is no longer just minimizing the loss on the training" }, { "start": 1505.16, "end": 1511.68, "text": " data set the inner optimization is that and with ALG star we denote it so if ALG" }, { "start": 1511.68, "end": 1518.52, "text": " has a star we say that the this is this is referring not to the procedure of the" }, { "start": 1518.52, "end": 1524.76, "text": " algorithm but to the minimum that the algorithm has found right so ALG star" }, { "start": 1524.76, "end": 1530.52, "text": " means the algorithm has optimized this inner procedure to its minimum which is" }, { "start": 1530.52, "end": 1535.6399999999999, "text": " a balance of the training loss of that task and staying close to the original" }, { "start": 1535.6399999999999, "end": 1544.44, "text": " parameters and this I think this they say that here the proximal regularization" }, { "start": 1544.44, "end": 1551.8, "text": " term in equation three encourages the Phi I to remain close to theta thereby" }, { "start": 1551.8, "end": 1558.88, "text": " retaining a strong dependence throughout this is why their method works and we're" }, { "start": 1558.88, "end": 1568.0800000000002, "text": " going to see in the math right soon how exactly this this how exactly they're" }, { "start": 1568.0800000000002, "end": 1574.1200000000001, "text": " able through this to establish this implicit gradient correspondence so they" }, { "start": 1574.12, "end": 1580.8, "text": " formulate their entire algorithm as follows we want to find the best metal" }, { "start": 1580.8, "end": 1589.6, "text": " learning parameters by minimizing the function F where F is the average losses" }, { "start": 1589.6, "end": 1597.84, "text": " and L here now that's the test set loss the average validation loss for each" }, { "start": 1597.84, "end": 1606.32, "text": " task of the parameters that the inner optimization procedure finds when it" }, { "start": 1606.32, "end": 1610.8799999999999, "text": " runs to its optimum that is you can see here this is already different from the" }, { "start": 1610.8799999999999, "end": 1615.1999999999998, "text": " original mammal the original mammal was simply running it for a number of steps" }, { "start": 1615.1999999999998, "end": 1621.4399999999998, "text": " and now we're really running it to the optimum at least in the ideal case what" }, { "start": 1621.4399999999998, "end": 1626.76, "text": " does the inner optimization algorithm do the ALG star here minimizes this" }, { "start": 1626.76, "end": 1634.44, "text": " function G right now G has two arguments G as G has these parameters" }, { "start": 1634.44, "end": 1637.92, "text": " which are the local parameters and these are the meta parameters and we only" }, { "start": 1637.92, "end": 1643.8799999999999, "text": " optimize the local parameters right we take these as initial and then fine-tune" }, { "start": 1643.8799999999999, "end": 1650.92, "text": " them where the function G is defined as the training loss of the local" }, { "start": 1650.92, "end": 1659.8400000000001, "text": " parameters plus this closeness regularizer okay cool now the question" }, { "start": 1659.8400000000001, "end": 1665.3600000000001, "text": " of course is how does that lead to gradient descent so ultimately we want" }, { "start": 1665.3600000000001, "end": 1671.1200000000001, "text": " to minimize this function F right here so we have we're going to have to do" }, { "start": 1671.1200000000001, "end": 1678.2, "text": " something like DF by D theta right to in order to run gradient descent we need to" }, { "start": 1678.2, "end": 1683.48, "text": " calculate this gradient because we need to do gradient descent so what's that" }, { "start": 1683.48, "end": 1691.8, "text": " going to be that's going to be of course since F is a is this one over M up here" }, { "start": 1691.8, "end": 1697.72, "text": " right the the gradient simply distributes over that sum now it's the" }, { "start": 1697.72, "end": 1707.24, "text": " gradient or sorry the derivative of each of these inner loss functions let's go" }, { "start": 1707.24, "end": 1716.24, "text": " with this ALG star I theta that's basically what you have right here okay" }, { "start": 1716.24, "end": 1721.56, "text": " so in order to take the gradient of F we need to be able to take the team we" }, { "start": 1721.56, "end": 1725.84, "text": " need to be able to derive these loss functions and you can see right here" }, { "start": 1725.84, "end": 1730.64, "text": " theta is not the argument to the loss function theta is the argument to this" }, { "start": 1730.64, "end": 1736.84, "text": " inner procedure so by the chain rule right now this gives us this so the" }, { "start": 1736.84, "end": 1742.9599999999998, "text": " chain rule says we derive the outer thing with respect to its input that's" }, { "start": 1742.9599999999998, "end": 1749.32, "text": " this part right here the gradient of the loss with respect to the neural network" }, { "start": 1749.32, "end": 1757.36, "text": " and that thing here that's the ALG star so we need to gradient of the loss" }, { "start": 1757.36, "end": 1761.8, "text": " function with respect to the end parameters of the optimization procedure" }, { "start": 1761.8, "end": 1767.52, "text": " now that's easy that's we know how to do that that is the or that is the so if" }, { "start": 1767.52, "end": 1775.12, "text": " you remember the drawing at the beginning this gradient is the end arrow" }, { "start": 1775.12, "end": 1780.8799999999999, "text": " right here this is easy this is one backward propagation this is regular" }, { "start": 1780.8799999999999, "end": 1785, "text": " supervised learning backprop right you have parameters of a neural network a" }, { "start": 1785, "end": 1792.12, "text": " gradient for the loss function cool the hard part is to have the derivative of" }, { "start": 1792.12, "end": 1798.96, "text": " the algorithm itself with respect to the problem to the meta parameters so this" }, { "start": 1798.96, "end": 1806.08, "text": " is going to be this here is going to be a vector it's the gradient with respect" }, { "start": 1806.08, "end": 1811.6, "text": " to these parameters and this is going to be a matrix and the matrix will relate" }, { "start": 1811.6, "end": 1819.6399999999999, "text": " basically one dimension each dimension of this vector sorry this is going to" }, { "start": 1819.6399999999999, "end": 1825.12, "text": " be a product between this thing and this thing and it will result in this thing" }, { "start": 1825.12, "end": 1831.6, "text": " so the left thing is the gradient we want this is the derivative of the" }, { "start": 1831.6, "end": 1838.04, "text": " entire thing that's this now the right thing is the gradient at the end of the" }, { "start": 1838.04, "end": 1844.6399999999999, "text": " optimization procedure and this matrix here relates the individual dimension of" }, { "start": 1844.6399999999999, "end": 1852, "text": " this end gradient to the gradient that we want right this is a matrix that" }, { "start": 1852, "end": 1858.24, "text": " relates the two in a linear fashion this is what we're looking how if how do we" }, { "start": 1858.24, "end": 1865.68, "text": " need to change the initial parameters in order to change the end parameters by a" }, { "start": 1865.68, "end": 1869.68, "text": " certain in a certain way because we only need we only know this but we want to" }, { "start": 1869.68, "end": 1875.04, "text": " know this so how do we calculate this thing here this Jacobian that's the" }, { "start": 1875.04, "end": 1881.2, "text": " question right how do we derive the the algorithmic procedure this thing rear" }, { "start": 1881.2, "end": 1890.24, "text": " here and the paper goes on to say well okay yeah so we need to do this this is" }, { "start": 1890.24, "end": 1896.24, "text": " the entire gradient descent optimization procedure so we must compute this thing" }, { "start": 1896.24, "end": 1903.32, "text": " right here and they just throw it in your face it's this boom shagada bomb" }, { "start": 1903.32, "end": 1913.52, "text": " this thing here done let's go on no so you can you can see it's it's basically" }, { "start": 1913.52, "end": 1918.56, "text": " putting this just right here but we kind of want to explore where that comes from" }, { "start": 1918.56, "end": 1924.84, "text": " so the fact you can see here you can derive this gradient as a closed form" }, { "start": 1924.84, "end": 1930, "text": " expression of the inverse of a matrix that contains this is the identity" }, { "start": 1930, "end": 1934.9199999999998, "text": " matrix contains somehow this lambda factor that we saw before and it" }, { "start": 1934.9199999999998, "end": 1942.48, "text": " contains this Hessian matrix of the training loss right so this is this end" }, { "start": 1942.48, "end": 1947.24, "text": " gradient that we can calculate easily and the second derivative of that is" }, { "start": 1947.24, "end": 1952, "text": " the Hessian which is basically the curvature in the landscape of that loss" }, { "start": 1952, "end": 1959, "text": " but nowhere in this thing is the is the SGD procedure showing up even though" }, { "start": 1959, "end": 1964.36, "text": " this thing here is the SGD procedure and that's pretty impressive and we're going" }, { "start": 1964.36, "end": 1978.76, "text": " to look at how that comes about so so where where do we start first let's take" }, { "start": 1978.76, "end": 1987.84, "text": " this let's take this G right here this G function right and let's calculate the" }, { "start": 1987.84, "end": 1994.32, "text": " derivative with respect to the in these parameters right here so let's go for" }, { "start": 1994.32, "end": 2000, "text": " this end gradient what's this end gradient going to be so we'll derive the" }, { "start": 2000, "end": 2012.32, "text": " G with respect to the these parameters all right so this is a sum this first" }, { "start": 2012.32, "end": 2018.28, "text": " thing is pretty easy it's going to be the gradient of this loss function loss" }, { "start": 2018.28, "end": 2027.36, "text": " function is a scalar right so we can this we can count this is the simply one" }, { "start": 2027.36, "end": 2032.16, "text": " backward prop through the network the second thing we can also do pretty" }, { "start": 2032.16, "end": 2038.24, "text": " easily this is an L2 norm all right we know how to derive a square so the 2" }, { "start": 2038.24, "end": 2046.44, "text": " comes down and the the this will simply result in the this vector right here so" }, { "start": 2046.44, "end": 2056.68, "text": " it's going to be lambda times Phi minus theta okay now this was relatively easy" }, { "start": 2056.68, "end": 2063.96, "text": " now imagine what happens when in this particular thing we have one additional" }, { "start": 2063.96, "end": 2075, "text": " information namely that F the inside of F F we will always optimize to the end" }, { "start": 2075, "end": 2081.72, "text": " we will always optimize this to its minimum right this star denotes that the" }, { "start": 2081.72, "end": 2087.32, "text": " inner optimization procedure will always go to the minimum of that function so" }, { "start": 2087.32, "end": 2091.8, "text": " what do we know about the minimum of a function we know that its gradient at" }, { "start": 2091.8, "end": 2098.36, "text": " that particular point is zero right this is the this is an important part so now" }, { "start": 2098.36, "end": 2103.52, "text": " we can restructure so if we take one to the right I might actually use black" }, { "start": 2103.52, "end": 2110.96, "text": " here because it's kind of burning my eyes we can isolate this part right here so" }, { "start": 2110.96, "end": 2119.4, "text": " we say the Phi is equal to first of all let's um let's take this to the right" }, { "start": 2119.4, "end": 2126, "text": " side so we'll have this gradient right here and I'm just gonna write L Phi" }, { "start": 2126, "end": 2133.24, "text": " let's keep the hat alive we'd have to divide this by lambda right and then" }, { "start": 2133.24, "end": 2140.2, "text": " bring over the theta so we have a close we have an expression that says at the" }, { "start": 2140.2, "end": 2145.7599999999998, "text": " optimum the parameters Phi the inner parameters are going to be given by this" }, { "start": 2145.7599999999998, "end": 2156.04, "text": " expression now that's pretty pretty cool but we know also that these parameters" }, { "start": 2156.04, "end": 2163.04, "text": " aren't just you know parameters per se they depend on these parameters right" }, { "start": 2163.04, "end": 2167.72, "text": " the end parameters depend on the initial parameters because the we use the" }, { "start": 2167.72, "end": 2171.72, "text": " initial parameters to initialize these end parameters so these are actually a" }, { "start": 2171.72, "end": 2177.12, "text": " function of the initial parameters so what we can do is we can derive this" }, { "start": 2177.12, "end": 2185.16, "text": " using red again let's use blue we can derive this thing by the initial" }, { "start": 2185.16, "end": 2189.44, "text": " parameters right how do the end parameters relate to the initial" }, { "start": 2189.44, "end": 2193.4, "text": " parameters now this is our basic question all along but we now have an" }, { "start": 2193.4, "end": 2198.2000000000003, "text": " exact expression for the end parameters which we didn't have before before we" }, { "start": 2198.2000000000003, "end": 2204.08, "text": " just knew they came about by SGD so important to say this only works at the" }, { "start": 2204.08, "end": 2209.4, "text": " optimum right this is at the optimum that this relation counts not anywhere" }, { "start": 2209.4, "end": 2216.64, "text": " and the paper is abusing this quite a bit right here so what does this do if" }, { "start": 2216.64, "end": 2220.8799999999997, "text": " we derive this thing here with respect to theta it's simply giving us the" }, { "start": 2220.8799999999997, "end": 2226.4, "text": " identity matrix right this is now our our Jacobian that appears here it's" }, { "start": 2226.4, "end": 2234.2, "text": " simply giving us this then this one divided by lambda is going to stay and" }, { "start": 2234.2, "end": 2243.68, "text": " now it gets a bit tricky because these things right here of course are also a" }, { "start": 2243.68, "end": 2250.72, "text": " function of theta so essentially this means we this thing right here is a" }, { "start": 2250.72, "end": 2258.16, "text": " gradient of a function of another function of theta so we can apply the" }, { "start": 2258.16, "end": 2262.72, "text": " chain rule again since this is already the first derivative it will give us" }, { "start": 2262.72, "end": 2273.3999999999996, "text": " the second derivative with respect to the loss function right here of with" }, { "start": 2273.4, "end": 2283, "text": " whatever goes into the loss function so that times the inner derivative now the" }, { "start": 2283, "end": 2297.32, "text": " inner derivative is simply how to derive again the Phi by the theta okay now I'm" }, { "start": 2297.32, "end": 2306.1600000000003, "text": " just okay yes so you can see first of all interesting that the expression here" }, { "start": 2306.1600000000003, "end": 2312.2400000000002, "text": " or the expression that we are looking to find appears in the expression itself" }, { "start": 2312.2400000000002, "end": 2317.7200000000003, "text": " right since since these parameters appear over here as a function argument" }, { "start": 2317.7200000000003, "end": 2323.6800000000003, "text": " as well we'll get basically this expression here twice but we can" }, { "start": 2323.68, "end": 2335.08, "text": " reformulate that and find that the the this term this Jacobian is basically" }, { "start": 2335.08, "end": 2341.3199999999997, "text": " this here inverted so the matrix we're looking for is sorry the inverse" }, { "start": 2341.3199999999997, "end": 2345.7999999999997, "text": " Jacobian the matrix we're looking for is given by this quantity right here the" }, { "start": 2345.8, "end": 2354.6800000000003, "text": " identity matrix minus this Hessian term right here okay and this is exactly what" }, { "start": 2354.6800000000003, "end": 2362.6800000000003, "text": " you see appearing here this is exactly that so the derivative we're looking for" }, { "start": 2362.6800000000003, "end": 2368.5600000000004, "text": " sorry this is actually the Jacobian not the inverse that's my bad what you're" }, { "start": 2368.56, "end": 2378.4, "text": " looking for is given by this expression now my eraser got stuck hello" }, { "start": 2378.4, "end": 2386.6, "text": " cool so that's how that appears you see it's the same thing if I had done" }, { "start": 2386.6, "end": 2395.6, "text": " everything correctly and so this this you do by simply shipping this to the" }, { "start": 2395.6, "end": 2400.52, "text": " other side which will make it the the inverse right so you divide you" }, { "start": 2400.52, "end": 2407.48, "text": " basically divide both sides by this and then you get this as an inverse now why" }, { "start": 2407.48, "end": 2414, "text": " does this work again I want to stress why did we get this identity here why" }, { "start": 2414, "end": 2421.52, "text": " were we able to express get a closed form solution to the for the inner thing" }, { "start": 2421.52, "end": 2427.08, "text": " or sorry for the end parameters in terms of the beginning parameters that doesn't" }, { "start": 2427.08, "end": 2433, "text": " have SGD first reason because we optimized to the end to the optimum" }, { "start": 2433, "end": 2438.92, "text": " that's why we got the equal zero right here second reason because we have this" }, { "start": 2438.92, "end": 2445.36, "text": " regularizer you see this directly comes from from this expression right here if" }, { "start": 2445.36, "end": 2450.44, "text": " we wouldn't have this regularizer then we could not make this expression we" }, { "start": 2450.44, "end": 2455.52, "text": " could not get Phi as a standalone quantity here and therefore this" }, { "start": 2455.52, "end": 2462.7200000000003, "text": " derivation wouldn't work now why is this important because if you look back into" }, { "start": 2462.7200000000003, "end": 2468.96, "text": " your drawing what you're basically doing is you are imposing a quadratic" }, { "start": 2468.96, "end": 2478.04, "text": " regularizer around this initial point right here and that creates this very" }, { "start": 2478.04, "end": 2484.2799999999997, "text": " strong connection between the end gradient and the initial gradient so now" }, { "start": 2484.2799999999997, "end": 2488.4, "text": " when you're optimizing when you have a training loss of the inner task and" }, { "start": 2488.4, "end": 2494.4, "text": " maybe the training loss looks something like it looks something like like this" }, { "start": 2494.4, "end": 2504, "text": " right here so SGD will it would go right to the very inner point right here if" }, { "start": 2504, "end": 2508.72, "text": " you're just let SGD run it would go there but now since you have this" }, { "start": 2508.72, "end": 2513.4, "text": " regularizer SGD needs to find a trade-off point between the two so what" }, { "start": 2513.4, "end": 2517.88, "text": " it will do is it will probably go somewhere and stop somewhere here so it" }, { "start": 2517.88, "end": 2523.24, "text": " will now have two forces pulling on it the first force will be this quantity" }, { "start": 2523.24, "end": 2531.84, "text": " right here and the second force will be pulling it back towards this and you can" }, { "start": 2531.84, "end": 2539.2400000000002, "text": " pretty much count so now SGD cannot just go to any point right here it cannot not" }, { "start": 2539.2400000000002, "end": 2544.2000000000003, "text": " go to any isoline these are not equal anymore maybe mainly it will go to the" }, { "start": 2544.2000000000003, "end": 2548.8, "text": " one point that points into the direction of this quadratic right here so since" }, { "start": 2548.8, "end": 2553.76, "text": " it's a quadratic we have closed form formulas for relating one gradient on" }, { "start": 2553.76, "end": 2559.7200000000003, "text": " the quadratic namely the one out here with the gradient there back here so we" }, { "start": 2559.72, "end": 2564.7599999999998, "text": " can express this Jacobian enclosed form because this is a quadratic and because" }, { "start": 2564.7599999999998, "end": 2569.48, "text": " we have this regularizer because you have these basically two forces pulling" }, { "start": 2569.48, "end": 2574.9199999999996, "text": " on this point in opposite direction one pointing towards the training loss and" }, { "start": 2574.9199999999996, "end": 2580.68, "text": " one pointing towards the inside of the quadratic so that's why this method" }, { "start": 2580.68, "end": 2589.56, "text": " works okay I can recommend Farin Hussar's blog post he has some very nice" }, { "start": 2589.56, "end": 2594.92, "text": " animations of why this basically restricts where gradient descent can go" }, { "start": 2594.92, "end": 2600.44, "text": " I can I can link to it in the description it's pretty cool to see I" }, { "start": 2600.44, "end": 2607, "text": " don't have it open right now so what does that give us the implicit model" }, { "start": 2607, "end": 2613.7999999999997, "text": " agnostic meta learning I mammal this is what this paper suggests while not" }, { "start": 2613.8, "end": 2619.44, "text": " converge to do sample a batch bunch of bunch of tasks right for each task" }, { "start": 2619.44, "end": 2625.84, "text": " compute the meta gradient G average these gradients to get a gradient for" }, { "start": 2625.84, "end": 2630.6400000000003, "text": " the outer parameters and then do gradient descent on the outer parameters" }, { "start": 2630.6400000000003, "end": 2635.04, "text": " pretty easy how do you do this how do you do this implicit implicit meta" }, { "start": 2635.04, "end": 2645.16, "text": " gradient this is this procedure right here so what you are going to do is met" }, { "start": 2645.16, "end": 2649.72, "text": " the parameters theta you initialize your parameters with the theta by the way it" }, { "start": 2649.72, "end": 2653.6, "text": " they don't need to be initializations they can be actually any sort of hyper" }, { "start": 2653.6, "end": 2658.48, "text": " parameters that this algorithm takes any parameter ization of this algorithm" }, { "start": 2658.48, "end": 2664.32, "text": " will do fine I just always said initial parameters such that it gets easier but" }, { "start": 2664.32, "end": 2673.28, "text": " it can be any sort of hyper parameters of the inner task obtain task parameters" }, { "start": 2673.28, "end": 2681.04, "text": " using iterative optimization solver such that the the inner parameters are close" }, { "start": 2681.04, "end": 2685.6000000000004, "text": " to the optimum of that algorithm so they actually extend this also in theory not" }, { "start": 2685.6000000000004, "end": 2689.76, "text": " so that you do not don't have to optimize the inner objective really to" }, { "start": 2689.76, "end": 2697, "text": " the optimum but you can be like Delta close to it that's pretty useful and" }, { "start": 2697, "end": 2701.1600000000003, "text": " that's in the part of the paper that we won't go over because this video would" }, { "start": 2701.1600000000003, "end": 2707.36, "text": " be like super long but I invite you to read it if you're interested then you" }, { "start": 2707.36, "end": 2715.0800000000004, "text": " compute the partial outer level gradient so this this would be your partial" }, { "start": 2715.08, "end": 2720.84, "text": " gradient your V would be this gradient at the end right the gradient at the end" }, { "start": 2720.84, "end": 2726.7599999999998, "text": " of the optimization procedure with respect to your validation datasets this" }, { "start": 2726.7599999999998, "end": 2732.6, "text": " is one back prop now we need to relate that end gradient to the beginning and" }, { "start": 2732.6, "end": 2738.6, "text": " that's and we do that by multiplying it with this matrix inverted right here now" }, { "start": 2738.6, "end": 2746.04, "text": " because obtaining the entire matrix this is the Hessian matrix and invert it is" }, { "start": 2746.04, "end": 2752.12, "text": " very memory and computation intensive because if you have D parameters in your" }, { "start": 2752.12, "end": 2757.04, "text": " neural network this is going to be a D by D matrix so if you have five million" }, { "start": 2757.04, "end": 2763.24, "text": " parameters this is going to be 25 million million size matrix is just not" }, { "start": 2763.24, "end": 2768.72, "text": " possible and that's why this paper extends this method to a second degree" }, { "start": 2768.72, "end": 2773.56, "text": " of approximation namely you don't have to compute the exact inverse you just" }, { "start": 2773.56, "end": 2778.7599999999998, "text": " have to compute something that is very close to the inverse times this" }, { "start": 2778.7599999999998, "end": 2786.64, "text": " integral this final gradient and a good method to do this is this conjugate" }, { "start": 2786.64, "end": 2794.2, "text": " gradient method and that method is able to to basically use the fact that you" }, { "start": 2794.2, "end": 2799.68, "text": " can compute Hessian vector products without having to compute the Hessian as" }, { "start": 2799.68, "end": 2805, "text": " a matrix this you can also do with a sort of modified back propagation" }, { "start": 2805, "end": 2813.64, "text": " algorithm also won't go in here but see you use iterative solver for example" }, { "start": 2813.64, "end": 2818, "text": " conjugate gradient along with reverse mode differentiation to compute Hessian" }, { "start": 2818, "end": 2825.52, "text": " vector products to compute GI so GI is going to be the final gradient pulled" }, { "start": 2825.52, "end": 2832.7999999999997, "text": " back through this matrix right here to give you the beginning gradient this" }, { "start": 2832.7999999999997, "end": 2838.96, "text": " meta gradient okay so two approximations here first approximation you don't" }, { "start": 2838.96, "end": 2844.44, "text": " actually have to solve to the very end you can solve it Delta close and second" }, { "start": 2844.44, "end": 2848.68, "text": " approximation you don't actually have to compute the inverse of that final gradient" }, { "start": 2848.68, "end": 2852.96, "text": " sorry compute the multiplication of the final gradient with the inverse of this" }, { "start": 2852.96, "end": 2857.7200000000003, "text": " matrix right here you can also find something that's a Delta prime close to" }, { "start": 2857.7200000000003, "end": 2865.2, "text": " that and they have a bunch of theory of that this still works they compare this" }, { "start": 2865.2, "end": 2871.48, "text": " of course to the other algorithms they observe that their algorithm uses" }, { "start": 2871.48, "end": 2878.3999999999996, "text": " substantially less memory and what substantially less memory and" }, { "start": 2878.3999999999996, "end": 2886.3599999999997, "text": " substantially less compute time once you go up to a number of inner gradient" }, { "start": 2886.3599999999997, "end": 2891.9199999999996, "text": " steps and it works better than this first-order mammal so this first-order" }, { "start": 2891.92, "end": 2895.64, "text": " mammal was our kind of initial guess of how we could do this this tends to" }, { "start": 2895.64, "end": 2905, "text": " perform very poorly as you can see there there oh you cannot you can't actually" }, { "start": 2905, "end": 2908.48, "text": " see that here that their method is better but their method is better and" }, { "start": 2908.48, "end": 2914.88, "text": " uses less time because you have this con inner conjugate gradient optimizer" }, { "start": 2914.88, "end": 2922.56, "text": " sorry this is the this is the outer optimizer okay so this is the error plot" }, { "start": 2922.56, "end": 2931.4, "text": " of how well are these methods are able to approximate the true gradient so if" }, { "start": 2931.4, "end": 2935.76, "text": " you could compute this true outer gradient you know that we did with" }, { "start": 2935.76, "end": 2943.1600000000003, "text": " mammal but we optimized to the end how close are you getting of course the" }, { "start": 2943.16, "end": 2950.72, "text": " problem with this method right here is that you do these approximations to you" }, { "start": 2950.72, "end": 2957.3199999999997, "text": " do these approximations and those could hurt you but the problem with mammal is" }, { "start": 2957.3199999999997, "end": 2961.7599999999998, "text": " that you're back propagating through the optimization procedure and that means" }, { "start": 2961.7599999999998, "end": 2969.08, "text": " the nonlinear errors could sort of accumulate and as you can see here even" }, { "start": 2969.08, "end": 2974.72, "text": " though both might eventually you know get to the to the zero error if you give" }, { "start": 2974.72, "end": 2980.04, "text": " them enough inner gradient steps especially at the low inner gradient" }, { "start": 2980.04, "end": 2986.3199999999997, "text": " step regime the implicit mammal is much better than mammal now I've just said" }, { "start": 2986.3199999999997, "end": 2992.24, "text": " the errors accumulate but the effect probably here is that the fact that with" }, { "start": 2992.24, "end": 2998.84, "text": " mammal you don't actually do good inner enough inner steps to reach a good" }, { "start": 2998.84, "end": 3003.56, "text": " enough optimum of the inner tasks so these inner gradient of the tasks their" }, { "start": 3003.56, "end": 3009.28, "text": " gradients when they're still very not optimized and therefore they are a very" }, { "start": 3009.28, "end": 3013.88, "text": " bad estimate for your outer gradient then when you do more gradient steps so" }, { "start": 3013.88, "end": 3020, "text": " that actually hurts you more which is also a bit surprising to me and then at" }, { "start": 3020, "end": 3026.1600000000003, "text": " the end you see this conjugate gradient steps this is when you approximate this" }, { "start": 3026.16, "end": 3031.16, "text": " matrix inverse if you just do two steps then at some point that error dominates" }, { "start": 3031.16, "end": 3037.04, "text": " but if you do more steps you can reach a much lower error and ten steps isn't" }, { "start": 3037.04, "end": 3044.2799999999997, "text": " that much for an algorithm like this as you can see here the ten steps your" }, { "start": 3044.2799999999997, "end": 3051.12, "text": " computation time will still in in the regime of many gradient steps will" }, { "start": 3051.12, "end": 3058.2, "text": " still be lower than the original mammal and then they actually test this thing" }, { "start": 3058.2, "end": 3064, "text": " and of course they're the best at pretty much everything I don't want to go into" }, { "start": 3064, "end": 3069.04, "text": " the exact details here I invite you to check out the paper for that check out" }, { "start": 3069.04, "end": 3074.8399999999997, "text": " if you're interested in the proofs and the approximation guarantees and with" }, { "start": 3074.84, "end": 3081.84, "text": " that bye bye" } ]
G3pOvrKkFuk
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Code] PyTorch sentiment classifier from scratch with Huggingface NLP Library (Full Tutorial)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "code", "pytorch", "bert", "pretrained", "lightning", "live", "tutorial", "pip", "nlp", "transformers", "tokenizers", "sequence", "sentiment", "imdb", "dataset", "full", "github" ]
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 do? So Hugging Face just released this NLP library right here and this is pretty cool because it allows you access to about a hundred NLP data sets and ten evaluation metrics pre-packaged. So knowing Hugging Face 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 Hugging Face stuff. So what we're trying to do is use this to load up the IMDB data set 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. So first of all if you like content like this let me know if you're not subscribed. 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 APSAL library and I'm using as you can see I'm using the tab 9 completion engine with CoC with Neo Vim. 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 as PL. We'll need the NLP library of course since we're gonna use that and we'll need the Transformers library. Now I know Hugging Face has this tokenizers 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 alright. 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. Alright 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. 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. 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 of for you when you use PyTorch Lightning. So last thing we need is maybe a prepare data. Let's put that more 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. I have downloaded the weights of a BERT model and the data set so we don't need to do that anymore. That's about it. Maybe I've forgotten something. Lightning examples. There's what we're going to do. We're going to look at it like an example of PyTorch Lightning and just to see whether we'll have it. Maybe here domain examples, ImageNet sounds good. We'll have these methods. This is way more than we need but down here. Basically what you do is you instantiate your model and we won't 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. Let's maybe copy this down here. This is our IMDB sentiment classifier and the trainer. The root here, let's call that logs. GPUs. We'll give it a GPU if CUDA is available. Else zero. Then we'll make a flag for the epochs. We don't need the rest of this. Then at the end we'll call fit model. If we had a classifier this would already run. Now what I like to do is to have this module called SH which gives you some sort of easy shell commands. At the beginning of each run whenever the file loads I remove the logs folder. I have a clean logs folder and then I make it again like this. It just deletes the logs and then runs them again. If we run this right now this is going to give us an error. We don't have an epochs flag. We need to define a flag. Let's call define integer. We'll go for 10 epochs right now. We haven't configured our optimizers. In PyTorch Lightning you need some sort of optimizer configuration. I'll just copy that from an example. I'm going full Siraj here people. We need to configure optimizers. I like the SGD for this. It tends to work well in neural networks. We don't need the scheduler. We don't need any of that. Let's just return the SGD optimizer with the parameters and we'll make a flag for the learning rate and we'll make a flag for the momentum. We don't need any weight decay. Let's put these. We'll make floats for the learning rate. Maybe start off with something like this. I never put help strings if the description is rather clear. Only losers need help. Don't be kidding yourself. If you put the help string you need help. That's how it works. I just don't like that this library forces you to put the help string because it somehow makes me feel bad. It's very opinionated. It says basically you should put something there. We have this and now when we run this we don't have anything to optimize yet. First of all we need the model. Do we need to prepare data first? Let's check. I have this short snippet here that embeds an IPython shell. I just plug this into anywhere so I can see if I reach it. I reach the prepare data. Let's care about the data set first. This NLP library as you can see right here. There's the usage right here. You can load a data set here with the appropriate split. It will basically just give it back. If you don't have it, it will download it. It's pretty cool. We'll just load the data set. I've already checked out what they have and they have the IMDB data set. In this split argument we can say give me the train split. As a string you can say give me whatever the first 5% of the train split. This is just my laptop here. We won't be able to train a super high grade model. We'll go for 5% of the train split. This is to train data set. Now if we run until here. If you had not downloaded this, it would download this. Given the train data set, I hope you can see this. It says it's a data set. It has 1250 rows. Each entry has a text and a label. You can just index this like a data set. That's the first sample. The label is 1 here. It means that we should predict the label that this is a good sentiment. It's either 1 or 0. I think so. Either good sentiment or bad sentiment. Our first task is going to be to get this into a form where BERT can consume it. How do we do this with this NLP library? That's the pretty cool part. Right now you see this is text. In NLP we need to map this text into token IDs. We need to tokenize and we need to map this to IDs. Huggingface of course has very nice libraries for that. They're called tokenizers. We'll have one of these tokenizers. We'll use this from the transformers library. I think this is called BERT tokenizer. That the BERT models can use. Let's check it out. We're at the documentation. BERT tokenizer. There we go. There's a BERT tokenizer. Fast. Yes, okay. We'll take the fast one. Maybe not. Yeah, we'll take the fast one. Come on. Be risky. BERT tokenizer fast. I think we can do this from pre-trained. They have these methods from pre-trained. We'll take this from pre-trained. We'll put the model name here. I want to make this a flag. Such that I'm not bound to a particular model. Oops. Cool. This is called model. This is our model. BERT based on case. We have a tokenizer right now. We can now tokenize these things. Every entry in the data set. In a classic setting we'd have to write a loop for that. With this data set library, with this nlp library, it's pretty cool that we can tokenize each of the samples. We can map this tokenizer function across the training data set. How do we do that? We have this tokenizer. I'm pretty sure it has a tokenizer, an encode or something method. There's forward. This is the BERT model. Where's the BERT tokenizer? Right here. It has this encode or something. Here. Oh yeah. Encode. Where is the definition of that? Can we click on this? This encode takes text and it takes a bunch of other arguments. I hope you can see this. There we go. 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. If you apply this encode function to a text of these samples. Let's just take the first sample here and let's take the text entry. Then what you're going to get is a list of these IDs. This is exactly what we want. The 101 here is this CLS token that BERT takes in. Then it's just the word pieces. You could also say instead of this say tokenize. I think. That will just give you the word pieces. Not the encodes yet. These are the word pieces right here. This is the tokenized text and with the encode function it does this. Then it maps these two IDs such that BERT can consume that. For this NLP, this library, has this convenient function called map in their data set. What we'll have to do first is define a tokenized function that takes in a single sample. Then it will run the tokenizer encode function across the text entry. We have already seen we need like... Add special tokens is true. This is cool. Max length, yes. We'll make a flag sequence length or something. We are going to pad to max length is true. Every single sample will be of the same size. In this function there's a number of ways what you can return here. 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. You see we have this tokenized function. It takes a sample, it takes the text, it tokenizes it, encodes it and puts this as the new attribute input IDs and returns it again. Now what we can do is we can map this function across the training data set. This will go over the training data set and basically for each entry do this thing. Hopefully after this operation we'll have a data set where each sample not only has a text and a label but also an input IDs attribute. We don't have this sequence length thing right here. Let's put that here. Let's just go with 32 since this is just my laptop. 32 samples should be fine. Here it says can't pickle tokenizer objects. What it tries to do right here is it tries to 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 data sets maybe. Naming, splits, builder, arrow, data set. Map right here. This function I think it will try to multiprocess and therefore it needs to basically pickle all of the things that go into the function. It pickles all of the things that go into the function which means this tokenizer right here it needs to be pickled. Maybe there's a way to get around this. 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. This tokenizer can actually be pickled. 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 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 multiprocess 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 int64 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. Now I know the tokenizers can already output PyTorch tensors but that's kind of cheating. So we want to use this library right here. We want the train data set. There is a method called set format right here and you say type equals torch. 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 debugging here I like to do a debug flag. So this is usually one of the first flags I do. It's define boolean debug. What this does is whenever this is active I try to be as fast as possible. So there in this PyTorch lightning trainer there's actually this fast def 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 one. We'll just load batch size samples if we are in debug mode. We don't actually have a batch size argument yet do we? If flags.debug else 5 percent. So we don't have batch size yet. We're surely gonna need that at some point. So let's go with a batch size of 8 just because we can. Now if we run this in debug we should... Ah okay yes this needs to be a string. Shag-a-boom! Cool so it says it's the fast def 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 data point. Okay then it crashes because it tries to convert these two PyTorch tensors and it 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 PyTorch 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 subclassed. This is a PyTorch data set right which we can load into a data loader. 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. The split name right like this and we'll just go with the split name here. That should do it and we just call it data set. Data set and return that. So now we can say train data set self dot test data set is prepare data set. For train and test. 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 easy so what we'll do is we'll do it in one line. Data loader so what does the data loader need? The data loader needs a data set. So the prepare data is called at the beginning so we have this data set right here and I think we can go with a batch size right here and we already have a flag for that and 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 PyTorch Lightning you have train validation and test and test is really only for like the final final test. If the test data set we have here is the would be called the validation data set in PyTorch 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 BERT model. So this forward thing here we're just going to leave not implemented. Maybe we can implement it. Okay so we do need a model as you can see right here 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 ultimate empty 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 BERT model right here so from transformers we can use the BERT model now they have a lot of BERT models and we'll go back right here to the BERT models because they as you know BERT is just an encoder so we need to build a classifier on top of BERT but they already have done this so they have a bunch of BERT different configurations and the one we're looking for here would be this this BERT for sequence classification right this is BERT BERT model transformer with a sequence classification or regression head on top right so this is exactly what we need a classifier on top of BERT 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 BERT for sequence classification 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 BERT if we put in data what what happens for that we quickly go back again so in the forward method we can in we can input the input ids right which 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 masks to avoid performing attention on padding token mask value selected in zero one one for tokens that are not masks zero 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 BERT 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 truncate 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 BERT are zero so basically your mask 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 BERT um it would actually uh BERT you it BERT you up it would download BERT right here but since i have it you can see here this is the smaller BERT model um pytorch 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 end function so usually in training you don't really care about epochs too much because you just have many batch after mini batch but in validation uh what you want is kind of one single metric across your entire test data set or validation data set 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 end function you aggregate them into one big number so um 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 can see 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 BERT 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 all 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 data set sorted into good and bad things because that would be that 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 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 we'll put it as a float tensor cool um right like this so our logits are going to be that and yeah tuple with one entry so 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 uh 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 fold this prepare data um loss is going to be a cross entropy loss yes that exists with read reduction i like to put reduction none i don't think there's like an a deprecated reduce and there is like a reduction where you can put mean or something i like to not reduce the loss at first because then i can agro 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 come on okay where is the cross entropy loss loss cross entropy loss it takes yes it's reduction ha tada and so the input to the function that we construct is going to be first 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 eight because we have reduction none none loss yes c vector of size eight very nice so we can just um basically return i'll say we can return this loss just as is and then in the validation epoch end 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 so losses is will concatenate them since they're going to be chunks of eight outputs at the dimension zero 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 it's 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 o in outputs so these are now going to be uh 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 pytorch lightning there there if you put validation accuracy select valac it selects the model according to this but i'm not sure so also in pytorch lightning i can now output this here but also if you have a log entry it will forward this to the logger which is 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 pytorch lightning is going to run through the data loader for each batch do this so we forward it through the bert model to get our log it's and then we compute our loss by the cross entropy loss of the log it's and the labels and we also compute our accuracy by seeing how much the log it's agree with the labels or the maximum log it 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 pytorch lightning logger dot and i think there is a tensor board logger uh pretty sure pytorch lightning is there tensor board no pytorch nying logger i'm pretty sure that exists that's not the newest version i hate these these old docs so latest come on oh this was called logging logger log loggers tensor board logger right here nice so our save dear 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 where if if if you don't put version zero it 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 though this is the bird configuration that we loaded and then we have no attribute logger pytorch lightning loggers loggers loggers okay again loading the weights very cool blah blah blah blah blah blah blah blah and we're in the night python shell and do we have a night python 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 these appear to be our tensor board logs so we are maybe able to run the tensor board here later um let's run it logs we don't have tensor board okay oh yeah i've uninstalled it because i was angry at it oh come on what's going on um tensor board i should have tensor board somewhere uh it's it's like in um in local bin or something um in local bin or something local bin no it's not in local bin oh oh we'll find it we'll figure it out uh how to get a tensor board maybe we need to install tensor flow well 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 a batch loss that we can back propagate on now in the training step you can either specify how you back propagate um 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 tensor board now please all right there we go and we can we can put this into a different uh thing right here um git uh lp demo yes um okay so this is running and if everything goes correctly 06 shaboom we have a tensor board 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 tensor board 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 backprop on this loss uh using the optimizer that we have defined okay and by outputting the log we instructed to put this into the tensor board so now we have a scalar entry and um you can see this it only contains the valid no it 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 oh now you go see epoch one epoch two go go go go go ah 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 bird model from the hogging face transformers library we've loaded in a pre-trained bird 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 it should 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 specified 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 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 crazy then we need 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 test data set with 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 input ids and label the input ids will put through the forward function of the model itself this is the forward function we'll construct a mask and run it through the model um 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 okay so we have a 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 tensorboard and unrecognized instruction format um okay who 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 1200 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 train data set the validation data 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 uh 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 burnt oh 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 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 it just seems like you know we could use a bit 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 load data set batched uh no keeping 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 split can we not shuffle anywhere we'll search shuffle builder okay so generate examples this function pre-processed examples key will be hashed okay we are not able to shuffle this um just like that and we can't do that 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 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 tensorflow 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 looking good looking good so far look at these models how large is that how large is the bert base case hugging face pre-trained models pre-trained models bert based on case that's the one we have 12 layers 110 million parameters easy easy easy oh 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 procedure actually that would be here right yes can we not map this asynchronously map i might be doing something really wrong with this library but i think that's that's how it should go so map def 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 build inputs create token type ids get special token mask save where is encode code 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 batch encode so let's see how fast this is with 100% where tokenizer has no but we just had batch encode oh but this might be we have batch encode plus batch encode plus or text pairs okay we need this batch encode plus but then that gives us a dictionary right this gives us a dictionary with the fields input ids 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 uh 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 will put this as is on github and i hope you can profit from that in any way you want the hugging face site has a tutorial on squad where they also use the metrics so they have basically these pre-defined metrics like blur or rouge i think and you can just use them as you use these data sets so it's very very very convenient 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 or if i should add a little bit more 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 all right bye bye
[ { "start": 0, "end": 6.96, "text": " How did it do? So Hugging Face just released this NLP library right here and" }, { "start": 6.96, "end": 13.48, "text": " this is pretty cool because it allows you access to about a hundred NLP data" }, { "start": 13.48, "end": 19.3, "text": " sets and ten evaluation metrics pre-packaged. So knowing Hugging Face" }, { "start": 19.3, "end": 24.18, "text": " this is going to be a breeze to work with. So what I thought we would do is we" }, { "start": 24.18, "end": 28.52, "text": " would try to use this. I have not used this yet and it's been a while since" }, { "start": 28.52, "end": 34.44, "text": " I've used any Hugging Face stuff. So what we're trying to do is use this to load" }, { "start": 34.44, "end": 41.32, "text": " up the IMDB data set and then use a BERT model maybe to build a sentiment" }, { "start": 41.32, "end": 48.16, "text": " classifier on top of that using PyTorch, specifically PyTorch Lightning. So all" }, { "start": 48.16, "end": 54.239999999999995, "text": " of that combined from scratch and basically if I can do it then so can you" }, { "start": 54.24, "end": 58.440000000000005, "text": " and we're going to make some mistakes and have to look at the" }, { "start": 58.440000000000005, "end": 64.92, "text": " documentation a bit and so on but that's the process. So first of all if" }, { "start": 64.92, "end": 70.48, "text": " you like content like this let me know if you're not subscribed. Let" }, { "start": 70.48, "end": 74.52000000000001, "text": " me know in the comments if you have any sort of criticism or tips. I'm always" }, { "start": 74.52000000000001, "end": 81.38, "text": " happy for Vim tips honestly. So I have a pretty empty repo, git repo here. I have" }, { "start": 81.38, "end": 86.96, "text": " a git ignore but that's about it. So we'll just dive right in, start up Vim" }, { "start": 86.96, "end": 101.03999999999999, "text": " and let's make a file. So first some boilerplate code. I'm terrible at" }, { "start": 101.03999999999999, "end": 106.19999999999999, "text": " talking and coding at the same time but you know. So I like to use this APSAL" }, { "start": 106.19999999999999, "end": 111.19999999999999, "text": " library and I'm using as you can see I'm using the tab 9 completion engine" }, { "start": 111.2, "end": 119.84, "text": " with CoC with Neo Vim. This is absolutely great. We maybe need apps, app flags" }, { "start": 119.84, "end": 128.64000000000001, "text": " logging. That sounds good. So we'll need Torch probably right and we'll" }, { "start": 128.64000000000001, "end": 137.84, "text": " need PyTorch Lightning as PL. We'll need the NLP library of course since" }, { "start": 137.84, "end": 142.6, "text": " we're gonna use that and we'll need the Transformers library. Now I know" }, { "start": 142.6, "end": 146.8, "text": " Hugging Face has this tokenizers library too but there are some tokenizers in the" }, { "start": 146.8, "end": 154.16, "text": " transformer library already and we'll just keep it light like this. So maybe" }, { "start": 154.16, "end": 161.32, "text": " NumPy, maybe not. Let's see. So we'll export, we'll have these flags object" }, { "start": 161.32, "end": 172.68, "text": " here. Maybe we'll do some flags later and the main function. Let's just call hello." }, { "start": 172.68, "end": 186.72, "text": " Actually let's log that info and alright. Run main. So this is our boilerplate" }, { "start": 186.72, "end": 195.6, "text": " and let's just quickly try it out just to see whether it works. So here we are." }, { "start": 195.6, "end": 202.64, "text": " Hello. That's fine. Alright so where do we go from here? So in PyTorch Lightning" }, { "start": 202.64, "end": 207.92, "text": " what you'll have to do is you have to build this kind of model class." }, { "start": 207.92, "end": 216.95999999999998, "text": " We'll build an IMDB sentiment classifier and that's going to extend this Lightning" }, { "start": 216.95999999999998, "end": 221.51999999999998, "text": " module of PyTorch Lightning. So you need different things in the PyTorch Lightning" }, { "start": 221.51999999999998, "end": 227.56, "text": " module. First of all you need the init and we'll just do like a very basic" }, { "start": 227.56, "end": 234.32, "text": " init. We'll call super on it and that's about it. And you need a forward method" }, { "start": 234.32, "end": 239.84, "text": " since this is a module. So in the forward method you're going to get a batch and" }, { "start": 239.84, "end": 247.04, "text": " you have to do something with it. What we also need is a training step method." }, { "start": 247.04, "end": 255.16, "text": " Training step which gets a batch and a batch index and we'll have to output" }, { "start": 255.16, "end": 261.76, "text": " some kind of loss or some kind of training procedure. Then we'll need a" }, { "start": 261.76, "end": 268.71999999999997, "text": " train data loader. So all of this you can look up in the" }, { "start": 268.71999999999997, "end": 272.71999999999997, "text": " documentation of PyTorch Lightning. Basically you implement these methods" }, { "start": 272.71999999999997, "end": 276.56, "text": " and it will do the rest for you. So it will do all the training loop and it" }, { "start": 276.56, "end": 285.58, "text": " will do the handling of GPUs and whatnot. The whole looping over epochs. All of" }, { "start": 285.58, "end": 289.96, "text": " that is basically taken care of for you when you use PyTorch Lightning. So last" }, { "start": 289.96, "end": 297.59999999999997, "text": " thing we need is maybe a prepare data. Let's put that more up here. Prepare data." }, { "start": 297.59999999999997, "end": 302.32, "text": " That method is optional but it gets called at the beginning and that's going" }, { "start": 302.32, "end": 306.79999999999995, "text": " to be pretty good for us. I have downloaded the weights of a BERT model" }, { "start": 306.79999999999995, "end": 310.91999999999996, "text": " and the data set so we don't need to do that anymore." }, { "start": 310.91999999999996, "end": 318.96, "text": " That's about it. Maybe I've forgotten something." }, { "start": 318.96, "end": 325.23999999999995, "text": " Lightning examples. There's what we're going to do. We're going to look at it" }, { "start": 325.23999999999995, "end": 330.96, "text": " like an example of PyTorch Lightning and just to see whether we'll have it." }, { "start": 330.96, "end": 337.76, "text": " Maybe here domain examples, ImageNet sounds good. We'll have these methods." }, { "start": 337.76, "end": 342, "text": " This is way more than we need but down here. Basically what you do is you" }, { "start": 342, "end": 347.15999999999997, "text": " instantiate your model and we won't have these hyper parameters here." }, { "start": 347.16, "end": 351.48, "text": " These will be our flags but then you'll implement this trainer and then you call" }, { "start": 351.48, "end": 363.16, "text": " fit on the model. Let's maybe copy this down here." }, { "start": 363.16, "end": 371.84000000000003, "text": " This is our IMDB sentiment classifier and the trainer." }, { "start": 371.84, "end": 383.32, "text": " The root here, let's call that logs. GPUs. We'll give it a GPU if CUDA is available." }, { "start": 384.44, "end": 392.23999999999995, "text": " Else zero. Then we'll make a flag for the epochs. We don't need the rest of this." }, { "start": 392.23999999999995, "end": 399.84, "text": " Then at the end we'll call fit model. If we had a classifier this" }, { "start": 399.84, "end": 411.59999999999997, "text": " would already run. Now what I like to do is to have this module" }, { "start": 411.59999999999997, "end": 418.67999999999995, "text": " called SH which gives you some sort of easy shell commands. At the beginning" }, { "start": 418.67999999999995, "end": 427.2, "text": " of each run whenever the file loads I remove the logs folder." }, { "start": 427.2, "end": 435.12, "text": " I have a clean logs folder and then I make it again like this." }, { "start": 435.12, "end": 440.28, "text": " It just deletes the logs and then runs them again. If we run this right now" }, { "start": 440.28, "end": 447.24, "text": " this is going to give us an error. We don't have an epochs flag." }, { "start": 447.24, "end": 459.36, "text": " We need to define a flag. Let's call define integer. We'll go for 10 epochs right now." }, { "start": 459.36, "end": 470.92, "text": " We haven't configured our optimizers." }, { "start": 470.92, "end": 476.12, "text": " In PyTorch Lightning you need some sort of optimizer configuration." }, { "start": 476.12, "end": 485, "text": " I'll just copy that from an example. I'm going full Siraj here people." }, { "start": 485, "end": 491.96, "text": " We need to configure optimizers. I like the SGD for this. It tends to work well in neural networks." }, { "start": 491.96, "end": 496.6, "text": " We don't need the scheduler. We don't need any of that." }, { "start": 496.6, "end": 505.72, "text": " Let's just return the SGD optimizer with the parameters and we'll make a flag for" }, { "start": 505.72, "end": 513.1600000000001, "text": " the learning rate and we'll make a flag for the momentum. We don't need any weight decay." }, { "start": 513.1600000000001, "end": 523.96, "text": " Let's put these. We'll make floats for the learning rate." }, { "start": 523.96, "end": 533, "text": " Maybe start off with something like this. I never put help strings if the description is rather clear." }, { "start": 533, "end": 542.36, "text": " Only losers need help. Don't be kidding yourself." }, { "start": 542.36, "end": 551.4, "text": " If you put the help string you need help. That's how it works." }, { "start": 551.4, "end": 557.64, "text": " I just don't like that this library forces you to put the help string because it somehow makes me feel bad." }, { "start": 557.64, "end": 565, "text": " It's very opinionated. It says basically you should put something there." }, { "start": 565, "end": 572.36, "text": " We have this and now when we run this we don't have anything to optimize yet." }, { "start": 572.36, "end": 583.3199999999999, "text": " First of all we need the model. Do we need to prepare data first?" }, { "start": 583.32, "end": 589.6400000000001, "text": " Let's check. I have this short snippet here that embeds an IPython shell." }, { "start": 589.6400000000001, "end": 593.48, "text": " I just plug this into anywhere so I can see if I reach it." }, { "start": 593.48, "end": 598.6800000000001, "text": " I reach the prepare data. Let's care about the data set first." }, { "start": 598.6800000000001, "end": 606.6, "text": " This NLP library as you can see right here. There's the usage right here." }, { "start": 606.6, "end": 614.44, "text": " You can load a data set here with the appropriate split." }, { "start": 614.44, "end": 619.08, "text": " It will basically just give it back. If you don't have it, it will download it." }, { "start": 619.08, "end": 624.6800000000001, "text": " It's pretty cool. We'll just load the data set." }, { "start": 624.6800000000001, "end": 634.0400000000001, "text": " I've already checked out what they have and they have the IMDB data set." }, { "start": 634.04, "end": 642.28, "text": " In this split argument we can say give me the train split." }, { "start": 642.28, "end": 648.92, "text": " As a string you can say give me whatever the first 5% of the train split." }, { "start": 648.92, "end": 652.52, "text": " This is just my laptop here." }, { "start": 652.52, "end": 656.68, "text": " We won't be able to train a super high grade model." }, { "start": 656.68, "end": 663.24, "text": " We'll go for 5% of the train split. This is to train data set." }, { "start": 663.24, "end": 668.36, "text": " Now if we run until here." }, { "start": 668.36, "end": 674.92, "text": " If you had not downloaded this, it would download this." }, { "start": 674.92, "end": 677.5600000000001, "text": " Given the train data set, I hope you can see this." }, { "start": 677.5600000000001, "end": 683.88, "text": " It says it's a data set. It has 1250 rows." }, { "start": 683.88, "end": 687.88, "text": " Each entry has a text and a label." }, { "start": 687.88, "end": 692.36, "text": " You can just index this like a data set." }, { "start": 692.36, "end": 696.36, "text": " That's the first sample. The label is 1 here." }, { "start": 696.36, "end": 704.12, "text": " It means that we should predict the label that this is a good sentiment." }, { "start": 704.12, "end": 707.32, "text": " It's either 1 or 0." }, { "start": 707.32, "end": 712.6800000000001, "text": " I think so. Either good sentiment or bad sentiment." }, { "start": 712.6800000000001, "end": 719.88, "text": " Our first task is going to be to get this into a form where BERT can consume it." }, { "start": 719.88, "end": 723.96, "text": " How do we do this with this NLP library? That's the pretty cool part." }, { "start": 723.96, "end": 726.36, "text": " Right now you see this is text." }, { "start": 726.36, "end": 730.92, "text": " In NLP we need to map this text into token IDs." }, { "start": 730.92, "end": 735.08, "text": " We need to tokenize and we need to map this to IDs." }, { "start": 735.08, "end": 738.6, "text": " Huggingface of course has very nice libraries for that." }, { "start": 738.6, "end": 742.36, "text": " They're called tokenizers." }, { "start": 742.36, "end": 746.52, "text": " We'll have one of these tokenizers." }, { "start": 746.52, "end": 751.3199999999999, "text": " We'll use this from the transformers library." }, { "start": 751.3199999999999, "end": 757, "text": " I think this is called BERT tokenizer." }, { "start": 757, "end": 761.48, "text": " That the BERT models can use. Let's check it out." }, { "start": 761.48, "end": 765.16, "text": " We're at the documentation." }, { "start": 765.16, "end": 769.3199999999999, "text": " BERT tokenizer. There we go. There's a BERT tokenizer." }, { "start": 769.3199999999999, "end": 772.36, "text": " Fast." }, { "start": 772.36, "end": 778.12, "text": " Yes, okay. We'll take the fast one." }, { "start": 778.12, "end": 780.76, "text": " Maybe not." }, { "start": 781.88, "end": 787.32, "text": " Yeah, we'll take the fast one. Come on. Be risky." }, { "start": 787.32, "end": 790.76, "text": " BERT tokenizer fast." }, { "start": 790.76, "end": 793.88, "text": " I think we can do this from pre-trained." }, { "start": 793.88, "end": 796.84, "text": " They have these methods from pre-trained." }, { "start": 796.84, "end": 802.6800000000001, "text": " We'll take this from pre-trained." }, { "start": 804.36, "end": 807.32, "text": " We'll put the model name here." }, { "start": 807.32, "end": 810.44, "text": " I want to make this a flag." }, { "start": 810.44, "end": 814.9200000000001, "text": " Such that I'm not bound to a particular model." }, { "start": 817.4, "end": 819.88, "text": " Oops." }, { "start": 820.84, "end": 823.64, "text": " Cool." }, { "start": 823.64, "end": 826.84, "text": " This is called model." }, { "start": 828.12, "end": 832.76, "text": " This is our model. BERT based on case." }, { "start": 832.76, "end": 835.72, "text": " We have a tokenizer right now." }, { "start": 835.72, "end": 838.36, "text": " We can now tokenize these things." }, { "start": 838.36, "end": 841.24, "text": " Every entry in the data set." }, { "start": 841.24, "end": 845.88, "text": " In a classic setting we'd have to write a loop for that." }, { "start": 845.88, "end": 848.92, "text": " With this data set library, with this nlp library," }, { "start": 848.92, "end": 852.52, "text": " it's pretty cool that we can tokenize" }, { "start": 852.52, "end": 855.4, "text": " each of the samples. We can map this" }, { "start": 855.4, "end": 861.72, "text": " tokenizer function across the training data set." }, { "start": 861.72, "end": 864.52, "text": " How do we do that?" }, { "start": 865, "end": 868.6, "text": " We have this tokenizer." }, { "start": 868.6, "end": 872.84, "text": " I'm pretty sure it has a tokenizer, an encode or something method." }, { "start": 872.84, "end": 876.76, "text": " There's forward. This is the BERT model." }, { "start": 876.76, "end": 879.8, "text": " Where's the BERT tokenizer?" }, { "start": 879.8, "end": 884.4399999999999, "text": " Right here." }, { "start": 884.4399999999999, "end": 892.3599999999999, "text": " It has this encode or something." }, { "start": 892.5999999999999, "end": 896.3599999999999, "text": " Here. Oh yeah. Encode." }, { "start": 896.52, "end": 899.56, "text": " Where is the definition of that?" }, { "start": 899.56, "end": 903.3199999999999, "text": " Can we click on this?" }, { "start": 903.3199999999999, "end": 907.56, "text": " This encode takes text and it takes a bunch of other arguments." }, { "start": 907.56, "end": 910.8399999999999, "text": " I hope you can see this." }, { "start": 910.8399999999999, "end": 913.4, "text": " There we go." }, { "start": 913.7199999999999, "end": 918.4399999999999, "text": " Whether or not you should add the special tokens" }, { "start": 918.4399999999999, "end": 922.3599999999999, "text": " or the max length. This is going to be pretty important." }, { "start": 922.3599999999999, "end": 926.4399999999999, "text": " And pad to max length. We want everything to be of the same length." }, { "start": 926.4399999999999, "end": 934.1199999999999, "text": " If you apply this encode function to a text of these samples." }, { "start": 934.12, "end": 938.2, "text": " Let's just take the first sample here and let's take the text entry." }, { "start": 938.2, "end": 942.6, "text": " Then what you're going to get is a list of these IDs." }, { "start": 942.6, "end": 944.84, "text": " This is exactly what we want." }, { "start": 944.84, "end": 949.16, "text": " The 101 here is this CLS token that BERT takes in." }, { "start": 949.16, "end": 952.04, "text": " Then it's just the word pieces." }, { "start": 952.04, "end": 957.08, "text": " You could also say instead of this say tokenize." }, { "start": 957.08, "end": 961.32, "text": " I think. That will just give you the word pieces." }, { "start": 961.32, "end": 964.84, "text": " Not the encodes yet." }, { "start": 964.84, "end": 967.72, "text": " These are the word pieces right here." }, { "start": 967.72, "end": 972.5200000000001, "text": " This is the tokenized text and with the encode function it does this." }, { "start": 972.5200000000001, "end": 978.0400000000001, "text": " Then it maps these two IDs such that BERT can consume that." }, { "start": 978.0400000000001, "end": 984.5200000000001, "text": " For this NLP, this library, has this convenient function called map in their data set." }, { "start": 984.5200000000001, "end": 991.24, "text": " What we'll have to do first is define a tokenized function that takes in a single sample." }, { "start": 991.24, "end": 1000.92, "text": " Then it will run the tokenizer encode function across the text entry." }, { "start": 1000.92, "end": 1003.88, "text": " We have already seen we need like..." }, { "start": 1003.88, "end": 1010.28, "text": " Add special tokens is true. This is cool. Max length, yes." }, { "start": 1010.28, "end": 1016.12, "text": " We'll make a flag sequence length or something." }, { "start": 1016.12, "end": 1023.24, "text": " We are going to pad to max length is true." }, { "start": 1023.24, "end": 1027.48, "text": " Every single sample will be of the same size." }, { "start": 1027.48, "end": 1030.84, "text": " In this function there's a number of ways what you can return here." }, { "start": 1030.84, "end": 1035.48, "text": " One way is to return the original sample and actually just set a new attribute." }, { "start": 1035.48, "end": 1038.68, "text": " I think." }, { "start": 1038.68, "end": 1042.68, "text": " Set a new attribute on this original sample right here." }, { "start": 1042.68, "end": 1047.48, "text": " Let's format this a bit nicer." }, { "start": 1047.48, "end": 1051, "text": " You see we have this tokenized function. It takes a sample, it takes the text," }, { "start": 1051, "end": 1057.3200000000002, "text": " it tokenizes it, encodes it and puts this as the new attribute input IDs and returns it again." }, { "start": 1057.3200000000002, "end": 1066.52, "text": " Now what we can do is we can map this function across the training data set." }, { "start": 1066.52, "end": 1072.6000000000001, "text": " This will go over the training data set and basically for each entry do this thing." }, { "start": 1072.6, "end": 1077.32, "text": " Hopefully after this operation we'll have a data set" }, { "start": 1077.32, "end": 1088.9199999999998, "text": " where each sample not only has a text and a label but also an input IDs attribute." }, { "start": 1088.9199999999998, "end": 1094.6, "text": " We don't have this sequence length thing right here." }, { "start": 1094.6, "end": 1098.1999999999998, "text": " Let's put that here." }, { "start": 1098.2, "end": 1104.44, "text": " Let's just go with 32 since this is just my laptop." }, { "start": 1104.44, "end": 1108.04, "text": " 32 samples should be fine." }, { "start": 1108.04, "end": 1113.4, "text": " Here it says can't pickle tokenizer objects." }, { "start": 1113.4, "end": 1120.2, "text": " What it tries to do right here is it tries to" }, { "start": 1120.76, "end": 1124.76, "text": " it tries to" }, { "start": 1124.76, "end": 1128.76, "text": " parallelize basically this thing right here." }, { "start": 1128.76, "end": 1134.92, "text": " If we look at this NLP thing, is there documentation to this?" }, { "start": 1136.12, "end": 1140.28, "text": " We can just look at the data sets maybe." }, { "start": 1140.28, "end": 1145.96, "text": " Naming, splits, builder, arrow, data set." }, { "start": 1146.92, "end": 1150.04, "text": " Map right here." }, { "start": 1150.04, "end": 1156.44, "text": " This function I think it will try to multiprocess and therefore it needs to basically" }, { "start": 1157.08, "end": 1167.6399999999999, "text": " pickle all of the things that go into the function." }, { "start": 1167.6399999999999, "end": 1172.2, "text": " It pickles all of the things that go into the function which means this tokenizer right here" }, { "start": 1172.2, "end": 1179.8, "text": " it needs to be pickled." }, { "start": 1179.8, "end": 1184.76, "text": " Maybe there's a way to get around this." }, { "start": 1187, "end": 1190.28, "text": " One thing we can try is we can try another tokenizer." }, { "start": 1192.28, "end": 1194.92, "text": " Maybe this one can be pickled." }, { "start": 1194.92, "end": 1198.76, "text": " This did library is pretty good but it can't pickle everything." }, { "start": 1198.76, "end": 1203.32, "text": " This tokenizer can actually be pickled." }, { "start": 1203.32, "end": 1210.6, "text": " I'm not entirely sure what you'd have to do honestly" }, { "start": 1210.6, "end": 1215.32, "text": " because I don't know the library but what you could do is make a thread or" }, { "start": 1215.32, "end": 1219.56, "text": " process local variable of this and basically make it a singleton in each" }, { "start": 1219.56, "end": 1223.08, "text": " process and then basically in here you call the function to get it" }, { "start": 1223.08, "end": 1227.96, "text": " and it returns the already instantiated object and so on." }, { "start": 1227.96, "end": 1230.52, "text": " If you really want to multiprocess all of this." }, { "start": 1230.52, "end": 1234.44, "text": " Anyway we have this train data set right now and you see the schema." }, { "start": 1235.24, "end": 1239.16, "text": " If you can see this the schema has been extended so there is now text, there is" }, { "start": 1239.16, "end": 1244.52, "text": " label and there is input IDs which is a list of int64 things." }, { "start": 1245.16, "end": 1246.2, "text": " That's pretty cool." }, { "start": 1247.16, "end": 1253.08, "text": " So now what we can do since this is still a python list right this is still a python list." }, { "start": 1253.08, "end": 1258.36, "text": " Now I know the tokenizers can already output PyTorch tensors but that's kind of cheating." }, { "start": 1258.36, "end": 1262.1999999999998, "text": " So we want to use this library right here." }, { "start": 1262.1999999999998, "end": 1264.36, "text": " We want the train data set." }, { "start": 1264.36, "end": 1270.6799999999998, "text": " There is a method called set format right here and you say type equals torch." }, { "start": 1271.48, "end": 1277.96, "text": " What that does and I think you need to say which columns you want." }, { "start": 1277.96, "end": 1282.52, "text": " So we want columns." }, { "start": 1282.52, "end": 1284.52, "text": " Maybe we should get all columns." }, { "start": 1284.52, "end": 1286.52, "text": " Can we output the text?" }, { "start": 1287.48, "end": 1292.68, "text": " So you can select from the sample which of the columns you want and let's check it out again." }, { "start": 1292.68, "end": 1298.92, "text": " For now as long as we're just debugging here I like to do a debug flag." }, { "start": 1300.04, "end": 1302.68, "text": " So this is usually one of the first flags I do." }, { "start": 1302.68, "end": 1308.3600000000001, "text": " It's define boolean debug." }, { "start": 1312.6000000000001, "end": 1316.92, "text": " What this does is whenever this is active I try to be as fast as possible." }, { "start": 1316.92, "end": 1322.68, "text": " So there in this PyTorch lightning trainer there's actually this fast def run argument." }, { "start": 1325.0800000000002, "end": 1330.8400000000001, "text": " Which does the same thing but I can push it a bit harder with this debug here." }, { "start": 1330.84, "end": 1337.24, "text": " So let me say this is like one." }, { "start": 1337.24, "end": 1345.3999999999999, "text": " We'll just load batch size samples if we are in debug mode." }, { "start": 1348.9199999999998, "end": 1352.9199999999998, "text": " We don't actually have a batch size argument yet do we?" }, { "start": 1352.92, "end": 1361.16, "text": " If flags.debug else 5 percent." }, { "start": 1361.16, "end": 1363.16, "text": " So we don't have batch size yet." }, { "start": 1363.16, "end": 1365.16, "text": " We're surely gonna need that at some point." }, { "start": 1365.16, "end": 1373.16, "text": " So let's go with a batch size of 8 just because we can." }, { "start": 1373.16, "end": 1384.44, "text": " Now if we run this in debug we should..." }, { "start": 1385.72, "end": 1388.28, "text": " Ah okay yes this needs to be a string." }, { "start": 1390.6000000000001, "end": 1391.24, "text": " Shag-a-boom!" }, { "start": 1392.0400000000002, "end": 1398.2, "text": " Cool so it says it's the fast def run and if we run it in debug it just loads very few data points." }, { "start": 1398.2, "end": 1401.8000000000002, "text": " So this map function here doesn't take this whole while." }, { "start": 1401.8, "end": 1404.68, "text": " Maybe there's a way you can stream that I don't know." }, { "start": 1404.68, "end": 1406.04, "text": " For now this is pretty good." }, { "start": 1406.04, "end": 1414.04, "text": " So if we look at the train data set again you can see that it has the same entry." }, { "start": 1414.04, "end": 1420.68, "text": " So this is still a list of 64 but if you index it right now if you go to the zero data point." }, { "start": 1421.56, "end": 1428.84, "text": " Okay then it crashes because it tries to convert these two PyTorch tensors" }, { "start": 1428.84, "end": 1436.12, "text": " and it can't convert the string so we'll have to say we just want the columns input IDs" }, { "start": 1436.12, "end": 1437.6399999999999, "text": " and we want the label." }, { "start": 1438.9199999999998, "end": 1440.9199999999998, "text": " Label can't spell." }, { "start": 1441.9599999999998, "end": 1444.36, "text": " Okay let's try it again." }, { "start": 1448.4399999999998, "end": 1456.1999999999998, "text": " So right here you see that what we get out is actually a PyTorch tensors for this" }, { "start": 1456.1999999999998, "end": 1458.6799999999998, "text": " and not kind of Python lists anymore." }, { "start": 1458.68, "end": 1464.76, "text": " So this is now pretty this is one-to-one so with duck typing maybe it's even subclassed." }, { "start": 1464.76, "end": 1470.2, "text": " This is a PyTorch data set right which we can load into a data loader." }, { "start": 1470.2, "end": 1480.1200000000001, "text": " So this is a perfectly fine data set so we can now say self train data set is this train data set." }, { "start": 1480.12, "end": 1488.36, "text": " Now we want to do this for the test as well but in order to do that we would have to write" }, { "start": 1488.36, "end": 1495.08, "text": " all of this code again which I'm not really in the mood so we'll just loop it." }, { "start": 1496.12, "end": 1504.28, "text": " We'll create a function prepare data set and we'll take in the split name." }, { "start": 1504.28, "end": 1512.36, "text": " The split name right like this and we'll just go with the split name here." }, { "start": 1517.48, "end": 1520.36, "text": " That should do it and we just call it data set." }, { "start": 1523, "end": 1527.96, "text": " Data set and return that." }, { "start": 1527.96, "end": 1538.68, "text": " So now we can say train data set self dot test data set is prepare data set." }, { "start": 1543.16, "end": 1544.8400000000001, "text": " For train and test." }, { "start": 1548.92, "end": 1552.8400000000001, "text": " Excellent so now we have a training data set and a testing data set." }, { "start": 1552.84, "end": 1559.08, "text": " So here in the train data loader we need to take the training data set" }, { "start": 1559.08, "end": 1568.52, "text": " and construct a data loader from it. This is super easy so what we'll do is we'll do it in one line." }, { "start": 1570.6799999999998, "end": 1574.84, "text": " Data loader so what does the data loader need? The data loader needs a data set." }, { "start": 1576.1999999999998, "end": 1581, "text": " So the prepare data is called at the beginning so we have this data set right here and I think we" }, { "start": 1581, "end": 1589.72, "text": " can go with a batch size right here and we already have a flag for that and I think there is like a" }, { "start": 1589.72, "end": 1597.16, "text": " drop last yes so the drop last will go for true we only want full batches during training and we'll" }, { "start": 1597.16, "end": 1608.52, "text": " also shuffle. Okay and the same goes for we need a validation data loader for our validation set." }, { "start": 1608.52, "end": 1613.8, "text": " So in PyTorch Lightning you have train validation and test and test is really only for like the" }, { "start": 1613.8, "end": 1621.32, "text": " final final test. If the test data set we have here is the would be called the validation data" }, { "start": 1621.32, "end": 1629.48, "text": " set in PyTorch Lightning so we false here false we don't want to shuffle particularly. Okay" }, { "start": 1630.44, "end": 1635.16, "text": " so we have a training data loader and a validation data loader." }, { "start": 1635.16, "end": 1639.0800000000002, "text": " Now what do we need? We have optimizer very good." }, { "start": 1641.48, "end": 1647.3200000000002, "text": " Now what do we need? All we need to do is to actually pass our data through the BERT model." }, { "start": 1647.3200000000002, "end": 1651.16, "text": " So this forward thing here we're just going to leave not implemented." }, { "start": 1652.76, "end": 1662.44, "text": " Maybe we can implement it. Okay so we do need a model as you can see right here this batch" }, { "start": 1662.44, "end": 1668.6000000000001, "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": 1668.6000000000001, "end": 1676.2, "text": " don't know what to do you just go to where you should be okay at ultimate empty parameter we" }, { "start": 1676.2, "end": 1685.0800000000002, "text": " don't have parameters yet all right so what do we do we go up here and we make a model we need to" }, { "start": 1685.08, "end": 1694.4399999999998, "text": " actually make the BERT model right here so from transformers we can use the BERT model now they" }, { "start": 1694.4399999999998, "end": 1704.04, "text": " have a lot of BERT models and we'll go back right here to the BERT models because they as you know" }, { "start": 1704.04, "end": 1710.6799999999998, "text": " BERT is just an encoder so we need to build a classifier on top of BERT but they already have" }, { "start": 1710.68, "end": 1716.6000000000001, "text": " done this so they have a bunch of BERT different configurations and the one we're looking for here" }, { "start": 1716.6000000000001, "end": 1722.44, "text": " would be this this BERT for sequence classification right this is BERT BERT model transformer with a" }, { "start": 1722.44, "end": 1729.16, "text": " sequence classification or regression head on top right so this is exactly what we need a classifier" }, { "start": 1729.16, "end": 1738.3600000000001, "text": " on top of BERT and we can um i think we can also load this with this from pre-trained and just put" }, { "start": 1738.36, "end": 1748.9199999999998, "text": " in the same name so we can this BERT for sequence classification and we'll load up the same model" }, { "start": 1748.9199999999998, "end": 1760.9199999999998, "text": " that we had okay so um this is our model easy as that so what do we what do we do with this BERT if" }, { "start": 1760.92, "end": 1768.52, "text": " we put in data what what happens for that we quickly go back again so in the forward method we can" }, { "start": 1768.52, "end": 1776.92, "text": " in we can input the input ids right which is batch size sequence length tensor we can input the" }, { "start": 1776.92, "end": 1782.92, "text": " attention mask that basically tells you where there's padding and where there isn't" }, { "start": 1782.92, "end": 1790.3600000000001, "text": " masks to avoid performing attention on padding token mask value selected in zero one one for tokens" }, { "start": 1790.3600000000001, "end": 1796.76, "text": " that are not masks zero for tokens that are masks then we can input the token type ids which we don't" }, { "start": 1796.76, "end": 1801.64, "text": " have here we just have one sentence but usually in BERT you have the capability of inputting two" }, { "start": 1801.64, "end": 1806.6000000000001, "text": " different types like a question and a paragraph or a first sentence and the second sentence" }, { "start": 1806.6, "end": 1816.9199999999998, "text": " um position ids are optional um blah blah blah blah blah blah blah none of that okay we could also" }, { "start": 1816.9199999999998, "end": 1825.8799999999999, "text": " input the labels these are optional and it would already compute a loss for us uh which we we don't" }, { "start": 1825.8799999999999, "end": 1831.8799999999999, "text": " this that's almost cheating so let's just focus on putting in the input ids and i think that's" }, { "start": 1831.88, "end": 1837.4, "text": " gonna be enough since we basically truncate our long text to 32 tokens we don't need to worry about" }, { "start": 1837.4, "end": 1845.4, "text": " masking right here otherwise you would input a mask for um actually we we can do it we can do it" }, { "start": 1846.1200000000001, "end": 1855.64, "text": " okay so what you could input a mask for basically where um your tokens are not pad tokens and the" }, { "start": 1855.64, "end": 1862.6000000000001, "text": " pad tokens in BERT are zero so basically your mask should just be whatever's non-zero uh but" }, { "start": 1863.3200000000002, "end": 1869.5600000000002, "text": " maybe also your model learns um to ignore the pad tokens i might be wrong here and it does it" }, { "start": 1869.5600000000002, "end": 1877.0800000000002, "text": " automatically right so in your forward pass what do you do actually let's go to the training step" }, { "start": 1877.08, "end": 1884.6799999999998, "text": " we'll put something here you can see it so if you if you didn't have BERT um it would actually" }, { "start": 1885.6399999999999, "end": 1890.6799999999998, "text": " uh BERT you it BERT you up it would download BERT right here but since i have it you can see here" }, { "start": 1890.6799999999998, "end": 1897.8799999999999, "text": " this is the smaller BERT model um pytorch lightning i don't have enough space in my console" }, { "start": 1897.8799999999999, "end": 1903.48, "text": " right here but it would give you a nice overview over your model how many parameters it has how" }, { "start": 1903.48, "end": 1910.28, "text": " what kind of layers it has and so on so uh we also need a validation step if we have a validation" }, { "start": 1910.28, "end": 1920.44, "text": " data loader validation step and we need the um validation epoch end function so" }, { "start": 1922.3600000000001, "end": 1927.88, "text": " usually in training you don't really care about epochs too much because you just have many batch" }, { "start": 1927.88, "end": 1934.0400000000002, "text": " after mini batch but in validation uh what you want is kind of one single metric across your entire" }, { "start": 1934.0400000000002, "end": 1940.6000000000001, "text": " test data set or validation data set and therefore you sort of in the validation step you'll just" }, { "start": 1940.6000000000001, "end": 1946.44, "text": " kind of output things you output local things per batch and then in the epoch end function you" }, { "start": 1946.44, "end": 1954.2800000000002, "text": " aggregate them into one big number so um we'll we'll we'll just put" }, { "start": 1954.28, "end": 1960.84, "text": " we'll put things into each thing thing thing so i'm pretty sure we're going to end up in the" }, { "start": 1960.84, "end": 1966.44, "text": " validation step first because if especially if we do this debug run it basically it tries to" }, { "start": 1966.44, "end": 1973.6399999999999, "text": " run a validation first uh at the very start of training so we can look at a batch right here" }, { "start": 1974.44, "end": 1980.36, "text": " so what's a batch um the batch seems to be a dictionary if you look at its keys we can see" }, { "start": 1980.36, "end": 1987.1599999999999, "text": " um the batch seems to be a dictionary if you look at its keys we have label and input ids okay so" }, { "start": 1987.1599999999999, "end": 1996.04, "text": " that's pretty cool so if we go for the input ids that gives us a tensor and the tensors of shape" }, { "start": 1996.04, "end": 2002.76, "text": " eight which is our batch size and 32 which is our sequence length and we should be able to pretty" }, { "start": 2002.76, "end": 2011.8799999999999, "text": " much input that into the BERT model that we created boom okay and what do we get out we get out a tuple" }, { "start": 2011.8799999999999, "end": 2018.2, "text": " and the first entry is going to be this looks like logits all right okay let's check the shape" }, { "start": 2019.08, "end": 2023.96, "text": " and this is eight so this is our batch size and two is the logit so one for the negative class" }, { "start": 2023.96, "end": 2030.6, "text": " and one for the positive class and this is this we can basically input into a cross entropy loss" }, { "start": 2030.6, "end": 2042.1999999999998, "text": " given our labels so we also have our label here and their label is all ones nice um is this maybe" }, { "start": 2042.1999999999998, "end": 2049.24, "text": " sorted is the data set sorted into good and bad things because that would be that would be bad" }, { "start": 2050.12, "end": 2059.7999999999997, "text": " 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" }, { "start": 2059.8, "end": 2068.04, "text": " say we get the input ids and we run this through our model and we can actually construct a mask" }, { "start": 2068.04, "end": 2080.28, "text": " here and the mask is going to be wherever the input ids are not zero and um that as a what does" }, { "start": 2080.28, "end": 2089.1600000000003, "text": " it need to be so these mask this attention mask is going to be a float tensor okay so we'll put it" }, { "start": 2089.16, "end": 2103.64, "text": " as a float tensor cool um right like this so our logits are going to be that and yeah tuple with" }, { "start": 2103.64, "end": 2109.48, "text": " one entry so the comma here is important we're going to return the logits so this is our forward" }, { "start": 2109.48, "end": 2115.3999999999996, "text": " function so in the validation and the training step the first thing we got to do is we got to" }, { "start": 2115.4, "end": 2122.12, "text": " uh call this forward function with the input ids and these of course are in our batch" }, { "start": 2124.44, "end": 2132.92, "text": " like this so these are going to be our logits and then in the validation what we want to do is we" }, { "start": 2132.92, "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": 2150.28, "text": " we can actually fold this prepare data um loss is going to be a cross entropy loss yes that exists" }, { "start": 2150.28, "end": 2160.36, "text": " with read reduction i like to put reduction none i don't think there's like an a deprecated reduce" }, { "start": 2160.36, "end": 2165.64, "text": " and there is like a reduction where you can put mean or something i like to not reduce the loss" }, { "start": 2165.64, "end": 2170.12, "text": " at first because then i can agro i can use the same thing for validation and training" }, { "start": 2171.64, "end": 2182.44, "text": " so in the validation step i just want to compute my loss right here with self so loss loss um and" }, { "start": 2183.3199999999997, "end": 2184.92, "text": " we'll have to cheat a bit" }, { "start": 2184.92, "end": 2192.92, "text": " so look up the cross entropy loss and" }, { "start": 2196.92, "end": 2202.92, "text": " come on okay where is the cross entropy loss" }, { "start": 2202.92, "end": 2215.48, "text": " loss cross entropy loss it takes yes it's reduction ha tada and" }, { "start": 2219.32, "end": 2224.28, "text": " so the input to the function that we construct is going to be first um" }, { "start": 2224.28, "end": 2231.48, "text": " n by c first the input and then the targets so first the logits and then the targets right" }, { "start": 2233, "end": 2243.4, "text": " criterion that combines logs of max and nl loss over a single class nice nice nice okay okay cool" }, { "start": 2243.4, "end": 2254.6800000000003, "text": " so first logits and then labels label okay that's our loss so if we check out what our loss is going" }, { "start": 2254.6800000000003, "end": 2264.28, "text": " to be it's probably going to be an vector of size eight because we have reduction none" }, { "start": 2264.28, "end": 2275.6400000000003, "text": " none loss yes c vector of size eight very nice so we can just um basically return" }, { "start": 2277.1600000000003, "end": 2285.0800000000004, "text": " i'll say we can return this loss just as is and then in the validation epoch end the outputs here" }, { "start": 2285.0800000000004, "end": 2291.7200000000003, "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.72, "end": 2301.72, "text": " for for one batch so we can aggregate those so losses is will concatenate them since they're" }, { "start": 2301.72, "end": 2313.64, "text": " going to be chunks of eight outputs at the dimension zero and then we can calculate the mean right so" }, { "start": 2313.64, "end": 2318.92, "text": " um we can do that and then" }, { "start": 2321.96, "end": 2332.92, "text": " we can oh no we need to do more we also want to know the accuracy right so um the accuracy is" }, { "start": 2332.92, "end": 2346.76, "text": " going to be whether or not the logits dot arg max is go is equal to the label label" }, { "start": 2347.7200000000003, "end": 2352.44, "text": " so the accuracy for each sample is going to be that it's either going to be one or zero and" }, { "start": 2352.44, "end": 2364.76, "text": " we want that as a float so here let's output a dictionary with loss um and accuracy all right" }, { "start": 2366.04, "end": 2375, "text": " excellent so here then we can aggregate so the loss is going to be and i like to have um like" }, { "start": 2375, "end": 2386.2, "text": " a construction here that aggregates this still so we go out loss for o in outputs so these are now" }, { "start": 2386.2, "end": 2394.44, "text": " going to be uh entries each one is going to be a dictionary right so our loss losses we have" }, { "start": 2394.44, "end": 2403.88, "text": " concatenation to the mean okay our accuracy is going to be the same thing for the accuracy" }, { "start": 2403.88, "end": 2408.04, "text": " nice so our output here is going to be a dictionary" }, { "start": 2412.2000000000003, "end": 2418.12, "text": " and i think in pytorch lightning there there if you put validation accuracy select valac" }, { "start": 2418.76, "end": 2425.88, "text": " it selects the model according to this but i'm not sure so also in pytorch lightning i can now" }, { "start": 2425.88, "end": 2433.48, "text": " output this here but also if you have a log entry it will forward this to the logger which is" }, { "start": 2433.48, "end": 2439.48, "text": " the logger which we can uh actually do and make a tensor board logger out of this so what have we" }, { "start": 2439.48, "end": 2446.2, "text": " done we have first of all set up the validation step so the the pytorch lightning is going to" }, { "start": 2446.2, "end": 2452.12, "text": " run through the data loader for each batch do this so we forward it through the bert model to" }, { "start": 2452.12, "end": 2457.8, "text": " get our log it's and then we compute our loss by the cross entropy loss of the log it's and the" }, { "start": 2457.8, "end": 2463.4, "text": " labels and we also compute our accuracy by seeing how much the log it's agree with the labels or the" }, { "start": 2463.4, "end": 2469.8, "text": " maximum log it and then we aggregate all of this over the entire epoch and output that now let's" }, { "start": 2469.8, "end": 2478.92, "text": " set up a logger so for the logger we can put this i think in the trainer here pytorch lightning" }, { "start": 2478.92, "end": 2489.48, "text": " logger dot and i think there is a tensor board logger uh pretty sure pytorch lightning is there" }, { "start": 2489.48, "end": 2494.04, "text": " tensor board no pytorch" }, { "start": 2495.4, "end": 2503.2400000000002, "text": " nying logger i'm pretty sure that exists that's not the newest version i hate these" }, { "start": 2503.96, "end": 2511.72, "text": " these old docs so latest come on oh this was called logging logger" }, { "start": 2511.72, "end": 2513.72, "text": " log" }, { "start": 2519.8799999999997, "end": 2520.3599999999997, "text": " loggers" }, { "start": 2523.48, "end": 2530.2799999999997, "text": " tensor board logger right here nice so our save dear is going to be called logs and then" }, { "start": 2530.28, "end": 2540.2000000000003, "text": " what we what do we want we want the name imdb and there's also this version thing" }, { "start": 2542.6000000000004, "end": 2548.76, "text": " where if if if you don't put version zero it will just make a new kind of folder each time but i" }, { "start": 2548.76, "end": 2552.76, "text": " guess we delete the logs anyway we delete the logs folder at the beginning so we don't have" }, { "start": 2552.76, "end": 2558.2000000000003, "text": " this problem but i generally like to overwrite my logs and not make new runs but if you like" }, { "start": 2558.2, "end": 2565.56, "text": " something different that's you know fine all right so let's run this again and we're cool" }, { "start": 2565.56, "end": 2573.08, "text": " though this is the bird configuration that we loaded and then we have no attribute logger" }, { "start": 2573.7999999999997, "end": 2577.3199999999997, "text": " pytorch lightning loggers loggers" }, { "start": 2577.32, "end": 2582.76, "text": " loggers" }, { "start": 2584.6800000000003, "end": 2592.6000000000004, "text": " okay again loading the weights very cool blah blah blah blah blah blah blah blah and we're in" }, { "start": 2592.6000000000004, "end": 2598.44, "text": " the night python shell and do we have a night python shell remaining only in the training step" }, { "start": 2598.44, "end": 2604.1200000000003, "text": " okay so we're at the training step right here and we can actually can we can check whether or not" }, { "start": 2604.12, "end": 2607.96, "text": " um ah now we have lightning logs and logs my" }, { "start": 2612.44, "end": 2618.2799999999997, "text": " okay so these appear to be our tensor board logs so we are maybe able to run the tensor board here" }, { "start": 2618.2799999999997, "end": 2626.8399999999997, "text": " later um let's run it logs we don't have tensor board okay" }, { "start": 2626.84, "end": 2636.6800000000003, "text": " oh yeah i've uninstalled it because i was angry at it oh come on what's going on um" }, { "start": 2639, "end": 2647.8, "text": " tensor board i should have tensor board somewhere uh it's it's like in um in local bin or something" }, { "start": 2647.8, "end": 2655.88, "text": " um in local bin or something local bin no it's not in local bin" }, { "start": 2657.8, "end": 2662.6000000000004, "text": " oh oh we'll find it we'll figure it out" }, { "start": 2664.92, "end": 2670.2000000000003, "text": " uh how to get a tensor board maybe we need to install tensor flow" }, { "start": 2672.92, "end": 2677.0800000000004, "text": " well that's gonna take a while okay so back to the training step in the training step we" }, { "start": 2677.08, "end": 2682.6, "text": " basically need to do the same as in the validation step so we'll need to forward our batch through" }, { "start": 2682.6, "end": 2687.56, "text": " the model but here we don't need to compute an accuracy but we do need to compute a actually a" }, { "start": 2687.56, "end": 2693.64, "text": " batch loss that we can back propagate on now in the training step you can either specify how you" }, { "start": 2693.64, "end": 2702.2, "text": " back propagate um per se or what you can do is you can just output this log loss attribute and then" }, { "start": 2702.2, "end": 2707.96, "text": " pytorch lightning will basically do the back propagation for you we have the tensor board" }, { "start": 2709.96, "end": 2720.12, "text": " now please all right there we go and we can we can put this into a different uh thing right here" }, { "start": 2720.12, "end": 2731.96, "text": " um git uh lp demo yes um" }, { "start": 2735.16, "end": 2740.6, "text": " okay so this is running and if everything goes correctly" }, { "start": 2740.6, "end": 2752.12, "text": " 06 shaboom we have a tensor board okay so we need to forward our training step and we need to" }, { "start": 2752.12, "end": 2758.36, "text": " calculate a loss for the batch so these loss here we do the same thing but here we call mean on it" }, { "start": 2758.36, "end": 2765.96, "text": " so this is the mean loss from this batch and we can now return um the loss right here and we can" }, { "start": 2765.96, "end": 2773.16, "text": " also in the training step you can also output a log dictionary and we'll output the loss again" }, { "start": 2773.8, "end": 2780.44, "text": " here in order so this is our going to be our training loss that we output right here um let's" }, { "start": 2780.44, "end": 2787.16, "text": " call it train loss and this also will go into the tensor board so if we run this right now we don't" }, { "start": 2787.16, "end": 2794.84, "text": " have an ipython shell simply by outputting this loss attribute we already instruct pytorch lightning" }, { "start": 2794.84, "end": 2800.84, "text": " to now run backprop on this loss uh using the optimizer that we have defined okay" }, { "start": 2802.84, "end": 2808.36, "text": " and by outputting the log we instructed to put this into the tensor board so now we have a scalar" }, { "start": 2808.36, "end": 2816.36, "text": " entry and um you can see this it only contains the valid no it contains everything very cool very very" }, { "start": 2816.36, "end": 2821.32, "text": " cool so let's remove the debug flag and we'll just see what happens" }, { "start": 2821.32, "end": 2831.48, "text": " so to recap right to recap we have um oh now you go see epoch one epoch two go go go go go" }, { "start": 2833.48, "end": 2841.1600000000003, "text": " ah very cool um what we've done is we've set up this pytorch lightning module it needs a bunch of" }, { "start": 2841.1600000000003, "end": 2846.52, "text": " functions but in the init we've basically just set up our bird model from the hogging face" }, { "start": 2846.52, "end": 2852.52, "text": " transformers library we've loaded in a pre-trained bird model that we're going to fine tune the main" }, { "start": 2852.52, "end": 2859.56, "text": " thing that the pytorch lightning module needs is a training step function where you define what it" }, { "start": 2859.56, "end": 2866.52, "text": " should do with the data and this data loader function so in the data loader function um we've" }, { "start": 2866.52, "end": 2874.12, "text": " loaded up a data set um and we basically specified the batch size this is very easy" }, { "start": 2874.12, "end": 2879.08, "text": " where does the data set come from we do it here in prepare data this is a special function in" }, { "start": 2879.08, "end": 2885.64, "text": " pytorch lightning that's basically called after the init but before anything else runs and here" }, { "start": 2886.3599999999997, "end": 2892.3599999999997, "text": " we are loading this data set from the nlp library and this is kind of the magic part" }, { "start": 2893.16, "end": 2899.16, "text": " we specify the split and the size that we want inside of the string and you can do this in percent" }, { "start": 2899.16, "end": 2904.68, "text": " or in a number of samples that you want i'm sort of sure you can do more things but i haven't" }, { "start": 2904.68, "end": 2910.68, "text": " explored that then we run map on the data set in order to tokenize it and that's right here" }, { "start": 2910.68, "end": 2919.24, "text": " and we use a tokenizer again from the pytorch lightning and um just run this encode function" }, { "start": 2919.24, "end": 2930.04, "text": " this is very simple like if how complicated was this just like a year ago crazy then we need to" }, { "start": 2930.04, "end": 2937, "text": " to put set format and set format tells the data set how it needs to output its samples and we tell" }, { "start": 2937, "end": 2943.56, "text": " it please output torch tensors and um we want these columns right here and we make a train and" }, { "start": 2943.56, "end": 2951.88, "text": " test data set with from the train and test split accordingly so we have this this goes into a data" }, { "start": 2951.88, "end": 2957.56, "text": " loader pytorch lightning will take the data loader and run training on it using this train step" }, { "start": 2957.56, "end": 2963.08, "text": " function in this train step function we get a batch um in the batch there are these two columns" }, { "start": 2963.08, "end": 2968.52, "text": " that we specified previously input ids and label the input ids will put through the forward function" }, { "start": 2968.52, "end": 2974.7599999999998, "text": " of the model itself this is the forward function we'll construct a mask and run it through the model" }, { "start": 2976.44, "end": 2981.56, "text": " um we wouldn't actually need to construct a mask but okay and we get back the logits of the" }, { "start": 2981.56, "end": 2988.36, "text": " classification and then we run this through a cross entropy loss uh get the mean of the batch" }, { "start": 2988.36, "end": 2994.92, "text": " and there we go in the validation step we do the same thing but also calculate the accuracy but" }, { "start": 2994.92, "end": 2999.88, "text": " don't calculate the mean we want to keep it per sample and only at the end we want to concatenate" }, { "start": 2999.88, "end": 3008.52, "text": " everything and calculate the mean if we've done everything correctly you see right here our train" }, { "start": 3008.52, "end": 3016.28, "text": " loss goes down down down until it is almost zero because we've just and the validation accuracy is" }, { "start": 3016.28, "end": 3022.12, "text": " super high is this is this because all the labels are equal okay so we have a" }, { "start": 3022.12, "end": 3031.7999999999997, "text": " all the labels are equal like for real um okay so we'll do something else we'll make an integer" }, { "start": 3031.7999999999997, "end": 3040.8399999999997, "text": " um with percent and this was five right so that we loaded five percent of the data set" }, { "start": 3040.84, "end": 3050.44, "text": " um but let's load some more and this might take longer but let's load" }, { "start": 3051.1600000000003, "end": 3054.6000000000004, "text": " 50 percent of the data set and just see what happens" }, { "start": 3057.1600000000003, "end": 3061.48, "text": " no present i called it present" }, { "start": 3066.28, "end": 3066.84, "text": " very good" }, { "start": 3066.84, "end": 3072.44, "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": 3072.44, "end": 3079.2400000000002, "text": " real time what happens in tensorboard and unrecognized instruction format um" }, { "start": 3083.8, "end": 3084.36, "text": " okay" }, { "start": 3085.96, "end": 3093.2400000000002, "text": " who can we make a format string in a format string this is nasty does it work" }, { "start": 3093.24, "end": 3101.24, "text": " please work we can make a format string in a format string absolutely bonkers okay so it takes a" }, { "start": 3101.24, "end": 3106.52, "text": " little bit longer and you could actually i think you can speed this up this mapping of the data set" }, { "start": 3107.08, "end": 3115.3999999999996, "text": " maybe you can stream it um i'm pretty sure you can batch it you can do a batch um processing of this" }, { "start": 3115.4, "end": 3124.92, "text": " but for our case right here uh we think it's enough so it was like what 1200 if we had five percent so" }, { "start": 3124.92, "end": 3134.12, "text": " now it should be something like 12 000 um so let's continue with the recap of what we did here" }, { "start": 3135.4, "end": 3140.12, "text": " we have the train data set the validation data set and on yes so we have everything like" }, { "start": 3140.12, "end": 3145.24, "text": " this the configure optimizers you can put an optimizer you can also put a learning rate" }, { "start": 3145.24, "end": 3152.8399999999997, "text": " scheduler if you want to and then in the main function we load this pytorch lightning module" }, { "start": 3153.24, "end": 3159.16, "text": " and we specify a trainer and the trainer we tell it you know the max epochs and so on" }, { "start": 3159.96, "end": 3164.8399999999997, "text": " and we set up the logger and we just run fit on this model and this runs" }, { "start": 3164.84, "end": 3171.96, "text": " epochs of the model and after each epoch it does a validation epoch and uh minimizes our loss" }, { "start": 3173.1600000000003, "end": 3185.96, "text": " very cool very effective so now if if please if you would all right here we go this is my laptop" }, { "start": 3185.96, "end": 3195.2400000000002, "text": " training burnt oh okay we don't seem to make too much progress" }, { "start": 3199.08, "end": 3200.36, "text": " let's check the tensor board" }, { "start": 3202.92, "end": 3206.28, "text": " training loss goes down training loss goes to zero" }, { "start": 3206.28, "end": 3214.52, "text": " training loss goes down training loss goes to zero i have the sneaking suspicion that this is not" }, { "start": 3214.92, "end": 3223.5600000000004, "text": " entirely shuffled so um is there like a shuffle like a shuffle thing" }, { "start": 3225, "end": 3230.52, "text": " because this seems a bit this seems a bit bit fishy um" }, { "start": 3230.52, "end": 3235.24, "text": " this imdb data set right here it just seems like" }, { "start": 3236.84, "end": 3244.2, "text": " you know we could use a bit of shuffling because all the labels yeah the training loss instantly" }, { "start": 3244.2, "end": 3254.6, "text": " goes to zero so maybe maybe it's not we" }, { "start": 3254.6, "end": 3262.6, "text": " can we shuffle here let's look at the load data set function" }, { "start": 3268.52, "end": 3277, "text": " load data set batched uh no keeping memory no none of that okay" }, { "start": 3277, "end": 3290.28, "text": " this does not seem to go to continue right here data sets nlp data sets" }, { "start": 3292.84, "end": 3299.64, "text": " i hope here we know we should find this load data set somewhere builder features load" }, { "start": 3299.64, "end": 3307, "text": " load data set split" }, { "start": 3309.7999999999997, "end": 3318.52, "text": " can we not shuffle anywhere we'll search shuffle builder" }, { "start": 3318.52, "end": 3327.48, "text": " okay so generate examples this function pre-processed examples key will be hashed" }, { "start": 3331.32, "end": 3338.92, "text": " okay we are not able to shuffle this um just like that and we can't do that" }, { "start": 3338.92, "end": 3351.7200000000003, "text": " okay we are not able to shuffle this um just like that but i hope this at least gives you an" }, { "start": 3351.7200000000003, "end": 3360.2000000000003, "text": " impression i guess if you were to take the full data set and map it then it would actually work" }, { "start": 3360.2, "end": 3367.56, "text": " we'll just try again with 10% of the data just uh to see it go down" }, { "start": 3368.9199999999996, "end": 3376.2, "text": " tensorboard see this is now good because we always delete the logs folder we don't have any uh remnant" }, { "start": 3377.96, "end": 3381.64, "text": " uh old tensorflow logs" }, { "start": 3381.64, "end": 3392.68, "text": " all right come on come on so 10% should be yeah about this about this okay" }, { "start": 3399.56, "end": 3405.7999999999997, "text": " train loss looking good looking good so far" }, { "start": 3405.8, "end": 3409.2400000000002, "text": " looking good looking good so far" }, { "start": 3413.96, "end": 3420.28, "text": " look at these models how large is that how large is the bert" }, { "start": 3420.28, "end": 3425.7200000000003, "text": " base case hugging face pre-trained models" }, { "start": 3425.72, "end": 3435.8799999999997, "text": " pre-trained models bert based on case that's the one we have 12 layers 110 million parameters easy" }, { "start": 3435.8799999999997, "end": 3437.8799999999997, "text": " easy easy" }, { "start": 3442.4399999999996, "end": 3449.48, "text": " oh no it's too large training loss goes to zero again okay so we've determined that this data set" }, { "start": 3449.48, "end": 3457.88, "text": " very probably isn't entirely shuffled it might just have all the good labels first and all the" }, { "start": 3457.88, "end": 3470.44, "text": " bad labels last and um yeah just to confirm let's confirm this uh right here let's go with 100%" }, { "start": 3471.08, "end": 3478.6, "text": " but let's put an ipython shell down um just before we map the data set so we don't have to go through" }, { "start": 3478.6, "end": 3489.08, "text": " the whole mapping procedure actually that would be here right yes" }, { "start": 3492.6, "end": 3496.36, "text": " can we not map this asynchronously map" }, { "start": 3499.08, "end": 3504.6, "text": " i might be doing something really wrong with this library but i think that's that's how it should go" }, { "start": 3504.6, "end": 3511.96, "text": " so map def" }, { "start": 3515, "end": 3524.44, "text": " map right here we can do batched we could do batched and then i think hugging face has a function to" }, { "start": 3526.52, "end": 3530.92, "text": " encode batched encode batch encode" }, { "start": 3530.92, "end": 3541.32, "text": " encode batch no um let's go to the tokenizer" }, { "start": 3546.52, "end": 3553.32, "text": " build inputs create token type ids get special token mask save where is encode" }, { "start": 3553.32, "end": 3556.36, "text": " code" }, { "start": 3559.96, "end": 3570.76, "text": " right here can we have batch encode build inputs no this might be it batch encode yes there is a" }, { "start": 3570.76, "end": 3578.6000000000004, "text": " batch encode where you have batches of these things so okay what if we do the negative one" }, { "start": 3578.6, "end": 3587.16, "text": " see here's the label zero um i'm pretty sure i'm pretty sure uh" }, { "start": 3589.72, "end": 3597.3199999999997, "text": " batch true let's do that and in our function here we'll say batch encode" }, { "start": 3597.32, "end": 3607.96, "text": " so let's see how fast this is with 100%" }, { "start": 3613, "end": 3614.28, "text": " where tokenizer has no" }, { "start": 3616.76, "end": 3618.44, "text": " but we just had batch encode" }, { "start": 3620.52, "end": 3623.7200000000003, "text": " oh but this might be we have batch encode plus" }, { "start": 3623.72, "end": 3633, "text": " batch encode plus or text pairs okay we need this batch encode plus" }, { "start": 3636.6, "end": 3645.72, "text": " but then that gives us a dictionary right this gives us a dictionary with the fields input ids" }, { "start": 3646.3599999999997, "end": 3647.8799999999997, "text": " right here so" }, { "start": 3647.88, "end": 3657.08, "text": " like this how about that and then we still might want to limit the actual data set um once we have" }, { "start": 3657.08, "end": 3659.08, "text": " once we have" }, { "start": 3661, "end": 3665.1600000000003, "text": " mapped it because we need to train on it as well" }, { "start": 3668.2000000000003, "end": 3672.12, "text": " but i just want to see how fast this batch uh encoding is" }, { "start": 3672.12, "end": 3675.64, "text": " yes" }, { "start": 3676.8399999999997, "end": 3685.24, "text": " okay reasonably fast but it takes like three minutes um yeah so we won't go on here i will put" }, { "start": 3685.24, "end": 3696.2799999999997, "text": " i will put this as is on um i'll put this as is on github and i will put this as is on github" }, { "start": 3696.28, "end": 3706.36, "text": " and i hope you can profit from that in any way you want the hugging face site has a tutorial on" }, { "start": 3706.36, "end": 3711.88, "text": " squad where they also use the metrics so they have basically these pre-defined metrics like blur" }, { "start": 3712.6000000000004, "end": 3721.4, "text": " or rouge i think and you can just use them as you use these data sets so" }, { "start": 3721.4, "end": 3727.2400000000002, "text": " it's very very very convenient to work with these things in nlp so nlp has come a long way" }, { "start": 3727.2400000000002, "end": 3735.32, "text": " absolutely invite you to check out the um the transformers and tokenizers and nlp repos" }, { "start": 3735.7200000000003, "end": 3741.88, "text": " and with that that's it for me i think i hope you enjoyed this again leave a comment if you" }, { "start": 3741.88, "end": 3747.8, "text": " see improvements or if i maybe should edit this a bit more or if i should add a little bit more" }, { "start": 3747.8, "end": 3753.4, "text": " see improvements or if i maybe should edit this a bit more i thought the entire process" }, { "start": 3753.4, "end": 3778.52, "text": " of just going through and making mistakes um would be entertaining to some all right bye bye" } ]
IiBFqnNu7A8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Planning to Explore via Self-Supervised World Models (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "deep rl", "deep reinforcement learning", "novelty", "curiosity", "intrinsic reward", "dreamer", "planet", "control", "walker", "run forward", "imaginary", "imagination", "planning", "google", "neural network", "actor", "critic", "uncertainty", "information gain", "mutual information", "model" ]
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 Rybkin, Kostas Danilidis, Peter Abil, Danijar Hafner and Depak Patak. So this is a paper that concerns reinforcement learning and specifically self-supervised reinforcement learning. So what do they mean? Here's a graphic right here. In reinforcement learning, usually you have an environment and an agent. 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. 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 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 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 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 this policy network 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 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. If your agent were to go down there again, it would sort of not really learn anything because it has now already gone there and has already learned from those states. So you might want to explore some different space, right, like here. And in the next episode, you might want to 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. 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 that usually, when you just have like an actor critic method, and that's what this paper here criticizes, if you have 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 a three C, 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 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 tasks, 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 the 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 a, 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 and sample 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 split here, you might think that there is a 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 while 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 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 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 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 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 deal out of basically their latent disagreement here agrees with minima, sorry, maximizing the expected information gain. 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, or 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 gain. 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 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 Gaussians here as our estimators, they somehow reduce to this total to this uncertainty, but only basically by taking Gaussians, 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, 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 tested 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, the second part, why this is a bit difficult is because you have to somehow keep this latent, sorry, this, 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 Gaussians here. But it is not said that these things, these things will actually give you the true disagreement among themselves. If you initialize them wrongly, they might miss like if, if your distribution has three modes, they act, they might just for all of them, focus on one of them. And then your disagreement will be completely out of whack, or you could initialize them not far enough for 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 the policy here tries to maximize these rewards. And that's 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. The planning objective is to maximize expected novelty, or it, which is this thing right here. However, I, I don't actually see why in that case, you'd 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 not don't maximize this, but somehow they maximize the future right of t prime of r t 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. Still exploring, do train the world model, train the latent disagreement ensemble, train the policy in imagination of like, rather, rather, 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 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, exactly is because of your retrospective data. 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 the 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 how well they call it zero shot, but it is how well can an algorithm that has explored 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 with the reward, because you would learn from the reward, and you would learn to seek out different, like your experience would be different. If you were going after a reward. So this is harder. So they compare this to dreamer, and dreamer 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 they're just zero shot offline reinforcement learning generalized to these methods. And you see the green is the plan to explore, and 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's seen pretty much every graphic that dreamer is the one that's able to cheat, right? So it is performing pretty well. But then the 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 you can see the 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 this 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. This many steps, you have this many steps where you can learn from the reward. So now we're no longer in this offline RL setting. This is now online RL. But we've been pre trained with all of this experience that we had without the reward. Again, the orange here is the cheater. So the orange is 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 RL offline RL 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 high 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 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? 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 sometimes 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 is just too much. And the states where you really were really something interesting happens are so few and far in between, and that 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's nothing interesting is going to happen just different things, which will screw over this method completely. In any case, they 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. 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. 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. Please subscribe and share this video if you liked it, and I'll see you next time. Bye bye.
[ { "start": 0, "end": 6.640000000000001, "text": " Hi there! Today we're looking at planning to explore via self-supervised world models" }, { "start": 6.640000000000001, "end": 17.04, "text": " by Ramanan Sekar, Ole Rybkin, Kostas Danilidis, Peter Abil, Danijar Hafner and Depak Patak." }, { "start": 17.04, "end": 25, "text": " So this is a paper that concerns reinforcement learning and specifically self-supervised" }, { "start": 25, "end": 26.44, "text": " reinforcement learning." }, { "start": 26.44, "end": 28.240000000000002, "text": " So what do they mean?" }, { "start": 28.24, "end": 30.4, "text": " Here's a graphic right here." }, { "start": 30.4, "end": 35.76, "text": " In reinforcement learning, usually you have an environment and an agent." }, { "start": 35.76, "end": 44.2, "text": " So you have this environment and let's ignore the without rewards for now." }, { "start": 44.2, "end": 48.64, "text": " And you have the agent and the agent needs to interact with the environment in order" }, { "start": 48.64, "end": 51.66, "text": " to achieve a maximum reward." }, { "start": 51.66, "end": 54.239999999999995, "text": " So the reward is given by a certain task." }, { "start": 54.239999999999995, "end": 56.8, "text": " You have to do something in this environment." }, { "start": 56.8, "end": 62.64, "text": " In this case, they consider these types of tasks where I think the top task might be" }, { "start": 62.64, "end": 64.24, "text": " called run forward." }, { "start": 64.24, "end": 69.2, "text": " So your reward is more the further you go with this walker." }, { "start": 69.2, "end": 76.96, "text": " And how you can influence the walker is you can sort of give a bit of force onto its joints" }, { "start": 76.96, "end": 78.88, "text": " right here and you have a bunch of sensors." }, { "start": 78.88, "end": 83.03999999999999, "text": " So the main task is actually to keep it to balance it on its feet and then sort of walk" }, { "start": 83.03999999999999, "end": 86.4, "text": " forward such that it never falls over." }, { "start": 86.4, "end": 88.56, "text": " Otherwise, you get negative reward." }, { "start": 88.56, "end": 90.88000000000001, "text": " You lose." }, { "start": 90.88000000000001, "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": 102.64000000000001, "text": " learning agent for each of these tasks individually, that will use a lot of data." }, { "start": 102.64000000000001, "end": 108.16000000000001, "text": " And basically, we can't reuse the learned reinforcement learning agent for each of these" }, { "start": 108.16000000000001, "end": 110, "text": " individual tasks." }, { "start": 110, "end": 115.64000000000001, "text": " It's sort of like if you have many, you know, image tasks or NLP tasks, you don't want to" }, { "start": 115.64, "end": 122, "text": " learn one model for each one individually, but you might do something like a common joint" }, { "start": 122, "end": 123, "text": " pre-training." }, { "start": 123, "end": 127, "text": " And this is exactly this for reinforcement learning." }, { "start": 127, "end": 129.6, "text": " And it's even called self supervised, right?" }, { "start": 129.6, "end": 135.86, "text": " Like we are used to in the in the classification setting, self supervised learning." }, { "start": 135.86, "end": 137.12, "text": " What does it mean?" }, { "start": 137.12, "end": 142.08, "text": " So it means that at first you're in an environment without rewards." }, { "start": 142.08, "end": 146.8, "text": " So basically, the agent is just dropped in an environment and there's no rewards." }, { "start": 146.8, "end": 152.78, "text": " It can just do actions and observes states from this environment." }, { "start": 152.78, "end": 158.12, "text": " And after that, after a while of that, then the tasks come in." }, { "start": 158.12, "end": 163.96, "text": " So task A, task B and task C are three different tasks, all in the same environment, but all" }, { "start": 163.96, "end": 169.28, "text": " requiring the agent to do different things like running forward or running backwards" }, { "start": 169.28, "end": 172.6, "text": " or do a front flip or things like this." }, { "start": 172.6, "end": 179.68, "text": " So the how fast the agent can adapt to these individual tasks very much depends on what" }, { "start": 179.68, "end": 185.58, "text": " it has learned during this phase where there were no rewards, right?" }, { "start": 185.58, "end": 191.04, "text": " So the agent is tasked to just explore the world via what they call here task agnostic" }, { "start": 191.04, "end": 196.2, "text": " exploration to explore the world to learn something about the world in order then to" }, { "start": 196.2, "end": 200.39999999999998, "text": " generalize to these tasks." }, { "start": 200.39999999999998, "end": 203.64, "text": " And in their case, they learn this global world model." }, { "start": 203.64, "end": 209.83999999999997, "text": " So the agent is supposed to learn somehow how the world works, right?" }, { "start": 209.83999999999997, "end": 218, "text": " And this is this is the way that this agent is then able to adapt really quickly." }, { "start": 218, "end": 220.98, "text": " So in essence, what does this agent do?" }, { "start": 220.98, "end": 223.76, "text": " The agent works as follows." }, { "start": 223.76, "end": 229.45999999999998, "text": " It gets an input observation, and it runs that through an encoder, which is usually" }, { "start": 229.45999999999998, "end": 232.6, "text": " something like a convolutional neural network." }, { "start": 232.6, "end": 236, "text": " And that will give you a set of features, right?" }, { "start": 236, "end": 241.16, "text": " So this is sort of an embedding of the state that you're in." }, { "start": 241.16, "end": 245.92, "text": " And that you can incorporate into a latent state at time t." }, { "start": 245.92, "end": 251.76, "text": " Now, usually in these RL algorithms, or what can happen is that you incorporate the last" }, { "start": 251.76, "end": 257.5, "text": " latent state, so the latent state from the step here also goes into the latent state" }, { "start": 257.5, "end": 259.15999999999997, "text": " of the next step, right?" }, { "start": 259.15999999999997, "end": 265.8, "text": " So here was the sorry, the last observation observation comes in features, latent state" }, { "start": 265.8, "end": 270.74, "text": " and so on, ultimately, and then and so on and comes in from here." }, { "start": 270.74, "end": 275.92, "text": " And there's usually like an RNN going over the time steps." }, { "start": 275.92, "end": 282.76, "text": " But ultimately here, the agent has to decide on an action using this policy network." }, { "start": 282.76, "end": 287, "text": " Now how is this trained this policy network has to come up with an action, but there are" }, { "start": 287, "end": 288.20000000000005, "text": " no rewards." }, { "start": 288.20000000000005, "end": 293.3, "text": " So usually, we would train this policy network with like an actor critic method." }, { "start": 293.3, "end": 298.3, "text": " So we would also train some sort of a value function, and then the policy would try to" }, { "start": 298.3, "end": 301.04, "text": " maximize the value function." }, { "start": 301.04, "end": 305.44, "text": " And if we don't have rewards, how are we going to do that?" }, { "start": 305.44, "end": 309.64, "text": " So people have thought about this for a bit." }, { "start": 309.64, "end": 314.46, "text": " And people have come up with things like intrinsic motivation." }, { "start": 314.46, "end": 320.88, "text": " Intrinsic motivation is a term where you're trying to say something like, if you're in" }, { "start": 320.88, "end": 330, "text": " a room right here, like this, your agent is right here, then you just you know, you do" }, { "start": 330, "end": 331.36, "text": " something." }, { "start": 331.36, "end": 334.88, "text": " And maybe your agent goes down here." }, { "start": 334.88, "end": 340.88, "text": " If your agent were to go down there again, it would sort of not really learn anything" }, { "start": 340.88, "end": 346.64, "text": " because it has now already gone there and has already learned from those states." }, { "start": 346.64, "end": 353.3, "text": " So you might want to explore some different space, right, like here." }, { "start": 353.3, "end": 356.64, "text": " And in the next episode, you might want to explore this room right here." }, { "start": 356.64, "end": 363.4, "text": " So this this notion of intrinsic motivation to explore, it has a bunch of different formulations" }, { "start": 363.4, "end": 366.2, "text": " of how exactly you can formulate it." }, { "start": 366.2, "end": 370.88, "text": " But just imagine basically, the entire state is filled with a bunch of coins, and I'm going" }, { "start": 370.88, "end": 375.67999999999995, "text": " to draw this as green dots, sort of like Pac-Man." }, { "start": 375.67999999999995, "end": 380.88, "text": " And everything is filled with these green dots, right?" }, { "start": 380.88, "end": 386.67999999999995, "text": " And what the agent wants to do if it has no rewards, it will simply collect those green" }, { "start": 386.67999999999995, "end": 387.79999999999995, "text": " dots." }, { "start": 387.79999999999995, "end": 392.23999999999995, "text": " And once one is collected, so if I go here, I'll collect all these green dots, these are" }, { "start": 392.24, "end": 394.16, "text": " now no longer there." }, { "start": 394.16, "end": 397.48, "text": " So that area doesn't give me any reward anymore." }, { "start": 397.48, "end": 401.84000000000003, "text": " So you can imagine sort of like this." }, { "start": 401.84000000000003, "end": 406.96000000000004, "text": " So as an intrinsic reward, you simply reward the agent every time it finds itself in a" }, { "start": 406.96000000000004, "end": 409.56, "text": " new state that it hasn't seen before." }, { "start": 409.56, "end": 416.40000000000003, "text": " So you train it to seek out novel states that usually, when you just have like an actor" }, { "start": 416.4, "end": 422.96, "text": " critic method, and that's what this paper here criticizes, if you have it's called retrospective" }, { "start": 422.96, "end": 424.67999999999995, "text": " novelty." }, { "start": 424.67999999999995, "end": 430.47999999999996, "text": " That means if you train a model free algorithm, which is an actor critic, right, if we just" }, { "start": 430.47999999999996, "end": 439.28, "text": " plug in into here, something like a three C, that will simply have a policy and a value" }, { "start": 439.28, "end": 440.35999999999996, "text": " function." }, { "start": 440.35999999999996, "end": 445.44, "text": " And in this case, if we train it on intrinsic reward, the policy will simply tell you where" }, { "start": 445.44, "end": 447.76, "text": " to go to find more green stuff." }, { "start": 447.76, "end": 449.48, "text": " But you can only train it." }, { "start": 449.48, "end": 454.32, "text": " So you use this to run an episode." }, { "start": 454.32, "end": 458.64, "text": " And then you observe how many green things you found in that episode, right, if your" }, { "start": 458.64, "end": 463.92, "text": " episode goes here, and then you put that back into your buffer to learn from." }, { "start": 463.92, "end": 466.96, "text": " But at that point, you've already collected the green things, right." }, { "start": 466.96, "end": 474.52, "text": " So the reward signal is actually a bit off because you want to train your agent that" }, { "start": 474.52, "end": 476.76, "text": " it should seek out novel things." }, { "start": 476.76, "end": 481, "text": " But as soon as you've explored them, they're not really novel anymore, because you have" }, { "start": 481, "end": 482.15999999999997, "text": " now explored them." }, { "start": 482.15999999999997, "end": 488.52, "text": " But still, you're going to train your agent, telling your agent that this area right here" }, { "start": 488.52, "end": 491.56, "text": " has lots of has given me lots of rewards." }, { "start": 491.56, "end": 496.02, "text": " So the agent is going to be encouraged to repeat that." }, { "start": 496.02, "end": 502.32, "text": " They say this right here, the retrospective novelty model free exploration methods not" }, { "start": 502.32, "end": 507.24, "text": " only require large amounts of experience to adapt to downstream tasks, they can also be" }, { "start": 507.24, "end": 509.52, "text": " inefficient during exploration." }, { "start": 509.52, "end": 517.48, "text": " These agents usually first act in the environment, collect trajectories, and then calculate an" }, { "start": 517.48, "end": 522.02, "text": " intrinsic reward as the agent's current estimate of novelty." }, { "start": 522.02, "end": 526.9399999999999, "text": " This approach misses out on efficiency by operating retrospectively." }, { "start": 526.94, "end": 534.5200000000001, "text": " That is, the novelty of inputs is computed after the agent has already reached them." }, { "start": 534.5200000000001, "end": 539.6400000000001, "text": " Hence it seeks out previously novel inputs that have already been visited and would not" }, { "start": 539.6400000000001, "end": 541.24, "text": " be novel anymore." }, { "start": 541.24, "end": 546.96, "text": " Instead, one should directly seek out future inputs that are expected to be novel." }, { "start": 546.96, "end": 554.48, "text": " Now, so what this paper is doing, it's basically saying, can we build a model that estimates" }, { "start": 554.48, "end": 560.36, "text": " the future novelty of a state that we maybe haven't seen so far?" }, { "start": 560.36, "end": 562.3000000000001, "text": " And here is where that goes." }, { "start": 562.3000000000001, "end": 565.16, "text": " So what do they do in this policy?" }, { "start": 565.16, "end": 570.72, "text": " So the policy isn't just trained to maximize the novelty in the world." }, { "start": 570.72, "end": 573.44, "text": " Instead, sorry, it uses planning." }, { "start": 573.44, "end": 576.64, "text": " It uses planning in latent space." }, { "start": 576.64, "end": 582.6800000000001, "text": " So what this model does is it learns a world model in latent space." }, { "start": 582.68, "end": 587.88, "text": " The world model takes as input these features that you saw right here that the encoder gives" }, { "start": 587.88, "end": 593.8, "text": " you and it predicts the future hidden latent states." }, { "start": 593.8, "end": 596.4399999999999, "text": " These are the things you saw here." }, { "start": 596.4399999999999, "end": 603.5999999999999, "text": " So these things that are always made by incorporating the new features with the old state, it tries" }, { "start": 603.5999999999999, "end": 604.9599999999999, "text": " to predict it." }, { "start": 604.9599999999999, "end": 610.7199999999999, "text": " So technically, these things here should have like some sort of a, no, this is actually" }, { "start": 610.72, "end": 617, "text": " exact here, but these here should have some sort of a tick or something to indicate these" }, { "start": 617, "end": 618.48, "text": " are estimated." }, { "start": 618.48, "end": 621.08, "text": " These are estimated future states." }, { "start": 621.08, "end": 623.76, "text": " And this model right here, this is an estimate." }, { "start": 623.76, "end": 625.96, "text": " This is a world model." }, { "start": 625.96, "end": 627.28, "text": " They use Dreamer for this." }, { "start": 627.28, "end": 630.0400000000001, "text": " And I have made a video about Dreamer." }, { "start": 630.0400000000001, "end": 631.5600000000001, "text": " Dreamer tries exactly that." }, { "start": 631.5600000000001, "end": 639.32, "text": " It tries to estimate what is the future, but not in actual world space, but in latent space." }, { "start": 639.32, "end": 646, "text": " And yeah, so it tries to estimate its own future." }, { "start": 646, "end": 650.8000000000001, "text": " And the cool thing here is that this is probabilistic or you can make it probabilistic." }, { "start": 650.8000000000001, "end": 656.4000000000001, "text": " So you can technically from this one age that you have here, you can run out many futures" }, { "start": 656.4000000000001, "end": 658.1600000000001, "text": " in your imagination." }, { "start": 658.1600000000001, "end": 663.0400000000001, "text": " And since you don't need the observations, you only need the latent space, you can simply" }, { "start": 663.0400000000001, "end": 668.84, "text": " forward roll your RNN and sample from it and you have many trajectories in the future." }, { "start": 668.84, "end": 675.96, "text": " Now the fact that you have many trajectories leads to even a different thing." }, { "start": 675.96, "end": 683.32, "text": " So what you can do for each of these hidden states, they have a head here that predicts" }, { "start": 683.32, "end": 686.38, "text": " the so-called latent disagreement." }, { "start": 686.38, "end": 687.38, "text": " What does this do?" }, { "start": 687.38, "end": 689.72, "text": " This consists of a whole bunch of models." }, { "start": 689.72, "end": 691.96, "text": " These are ensemble models." }, { "start": 691.96, "end": 694.76, "text": " They're the same for each time step." }, { "start": 694.76, "end": 705, "text": " But what they take in, they take in the latent state of the model and the action that you're" }, { "start": 705, "end": 709.28, "text": " about to do, the action that you imagine you would do." }, { "start": 709.28, "end": 714, "text": " So this is the imagined state and this is the imagined action in that state." }, { "start": 714, "end": 718.16, "text": " And then it will compute the next features." }, { "start": 718.16, "end": 723.4, "text": " So the next, whatever in the next step would be the age." }, { "start": 723.4, "end": 728.68, "text": " So right, right, where do we put it?" }, { "start": 728.68, "end": 739.4399999999999, "text": " Whatever in the next, so if I have this age and I have this state, it tells me if I do" }, { "start": 739.4399999999999, "end": 748.56, "text": " action A1 and if I were to execute this in the real world, what would be my next age" }, { "start": 748.56, "end": 749.68, "text": " that I would get?" }, { "start": 749.68, "end": 755.3199999999999, "text": " So basically by performing an action, I will get the next observation and I will encode" }, { "start": 755.3199999999999, "end": 757.76, "text": " that to get the next features." }, { "start": 757.76, "end": 765, "text": " And this small model would try to predict what are the features of the next state if" }, { "start": 765, "end": 770.2399999999999, "text": " I were to execute this action in this state." }, { "start": 770.2399999999999, "end": 775.24, "text": " Okay, so it's kind of a future predictor." }, { "start": 775.24, "end": 779.5999999999999, "text": " But also not in observation space, but in latent space." }, { "start": 779.6, "end": 786, "text": " So it tries to predict the latent features of the next observation." }, { "start": 786, "end": 791.8000000000001, "text": " And the split here, you might think that there is a bit of a, it's like almost the same," }, { "start": 791.8000000000001, "end": 794.76, "text": " this latent state here and the features." }, { "start": 794.76, "end": 801.12, "text": " But as we discussed before, the latent state can incorporate the last or the history of" }, { "start": 801.12, "end": 807.4, "text": " latent states while the features simply are only a function of the current observation." }, { "start": 807.4, "end": 809.48, "text": " And that's why they predict the features." }, { "start": 809.48, "end": 812.28, "text": " They really want to predict the observation." }, { "start": 812.28, "end": 817.16, "text": " But history has sort of shown that if you try to predict, for example, the pixels of" }, { "start": 817.16, "end": 821.36, "text": " the observation, that won't serve you really well." }, { "start": 821.36, "end": 826.8000000000001, "text": " And therefore, what you need to do is you need to predict the latent features of the" }, { "start": 826.8000000000001, "end": 830.32, "text": " observation that works much better." }, { "start": 830.32, "end": 832.52, "text": " So they have a bunch of these models right here." }, { "start": 832.52, "end": 836.08, "text": " They have a bunch of models with different parameterizations." }, { "start": 836.08, "end": 839.9000000000001, "text": " They instantiate k different models of that." }, { "start": 839.9000000000001, "end": 841.5, "text": " And they all run the same." }, { "start": 841.5, "end": 844.64, "text": " So these are all the same inputs through these different models." }, { "start": 844.64, "end": 848.32, "text": " Now, these different models have been initialized at different points." }, { "start": 848.32, "end": 851.36, "text": " So they will make slightly different predictions." }, { "start": 851.36, "end": 858.0400000000001, "text": " And the crucial part is, so if it's really deterministic what the next state is going" }, { "start": 858.0400000000001, "end": 859.0400000000001, "text": " to be, right?" }, { "start": 859.0400000000001, "end": 863.12, "text": " So say you're in this state, you perform this action." }, { "start": 863.12, "end": 867.76, "text": " And so if you have a ball in your hand and you drop the ball, then the ball is going" }, { "start": 867.76, "end": 869.48, "text": " to fall down." }, { "start": 869.48, "end": 870.74, "text": " Really deterministic." }, { "start": 870.74, "end": 877.2, "text": " That means these next these estimated next features, if the models are any good, they" }, { "start": 877.2, "end": 879.12, "text": " all agree." }, { "start": 879.12, "end": 885.5600000000001, "text": " And this variance here between the estimates is very, very small." }, { "start": 885.5600000000001, "end": 891.6800000000001, "text": " And now if if the uncertainty over the next state is very high, and this can be due to" }, { "start": 891.68, "end": 896.3599999999999, "text": " two facts either, it is actually uncertain what's going to happen." }, { "start": 896.3599999999999, "end": 901.52, "text": " So maybe you have a really a piece of paper and you drop that and due to the wind, you" }, { "start": 901.52, "end": 903.1999999999999, "text": " can't know what's happening." }, { "start": 903.1999999999999, "end": 908.28, "text": " Or because your model has simply not learned yet what's going to happen." }, { "start": 908.28, "end": 912.76, "text": " In either of those cases, you don't know what's going to happen." }, { "start": 912.76, "end": 921.28, "text": " Therefore, these these predictions here, sorry, are going to be very different from each other." }, { "start": 921.28, "end": 924.12, "text": " And because of that, this variance will be high." }, { "start": 924.12, "end": 928.14, "text": " And this variance you take as the intrinsic reward." }, { "start": 928.14, "end": 936.66, "text": " So in each step, you basically try to predict over the next actions you can do, which ones" }, { "start": 936.66, "end": 944.4, "text": " leads me to a leads me to a situation where I don't know what's going to happen, where" }, { "start": 944.4, "end": 949.72, "text": " I cannot really predict the variance in my prediction is high." }, { "start": 949.72, "end": 951.6, "text": " So I really don't know what's going to happen." }, { "start": 951.6, "end": 954.6800000000001, "text": " And that is going to be the states you seek out." }, { "start": 954.6800000000001, "end": 957.44, "text": " Okay, so this is the core of the paper." }, { "start": 957.44, "end": 964.84, "text": " Basically, you do this planning in latent space in order to find the states or action" }, { "start": 964.84, "end": 969.24, "text": " that leads you to a state where you don't know what's going to happen." }, { "start": 969.24, "end": 974.32, "text": " And you measure that by trying to predict it using slightly different models." }, { "start": 974.32, "end": 981.88, "text": " And if they disagree a whole bunch, then you can use you sort of you say, I don't know" }, { "start": 981.88, "end": 982.88, "text": " what's going to happen." }, { "start": 982.88, "end": 986.72, "text": " And therefore, I want to go there because I want to learn about that state." }, { "start": 986.72, "end": 990.5400000000001, "text": " Now this, this is the this is the entire thing." }, { "start": 990.5400000000001, "end": 994.6400000000001, "text": " It has a bunch of problems, as you can imagine." }, { "start": 994.6400000000001, "end": 997.6800000000001, "text": " So this is the reasoning behind it, right?" }, { "start": 997.68, "end": 1009.52, "text": " Now they try to make a deal out of basically their latent disagreement here agrees with" }, { "start": 1009.52, "end": 1015.2399999999999, "text": " minima, sorry, maximizing the expected information gain." }, { "start": 1015.2399999999999, "end": 1021.64, "text": " They go into the theory right here and say, okay, if I have a state and an action, and" }, { "start": 1021.64, "end": 1026.98, "text": " I had and this W are the dynamics parameters of the world." }, { "start": 1026.98, "end": 1030.92, "text": " So the W characterizes how the world works." }, { "start": 1030.92, "end": 1036.52, "text": " And the H here is the next state, or sorry, the features of the next observation." }, { "start": 1036.52, "end": 1043.76, "text": " And the I is the mutual information between H and W. So this right here measures how much" }, { "start": 1043.76, "end": 1051.48, "text": " information of the next state is contained in the dynamics of the world." }, { "start": 1051.48, "end": 1055.92, "text": " If this is really low, and I have a good world model, then I should be able to predict the" }, { "start": 1055.92, "end": 1060.3200000000002, "text": " next state really well." }, { "start": 1060.3200000000002, "end": 1067.14, "text": " And this, this, they say, okay, selecting the most promising data during exploration." }, { "start": 1067.14, "end": 1072.0800000000002, "text": " We want to select the action that maximizes this information gain." }, { "start": 1072.0800000000002, "end": 1079.88, "text": " So the, the, the more the mutual information here, we want to select the action that maximizes" }, { "start": 1079.88, "end": 1085.68, "text": " that they decompose this mutual information into two things." }, { "start": 1085.68, "end": 1093.64, "text": " They decompose it into this thing right here, which is simply the entropy of the next state" }, { "start": 1093.64, "end": 1095.76, "text": " given the current state and action." }, { "start": 1095.76, "end": 1102.92, "text": " This is simply the total uncertainty, including the fact that it could actually be stochastic" }, { "start": 1102.92, "end": 1107.54, "text": " like dropping a paper, and the fact that you haven't learned yet what happens like if you" }, { "start": 1107.54, "end": 1112.72, "text": " drop a ball, but you haven't learned that yet, that is also uncertain." }, { "start": 1112.72, "end": 1119.8, "text": " So this is that part, this is the total uncertainty minus this right here." }, { "start": 1119.8, "end": 1123.96, "text": " And this is the uncertainty if you know the dynamics, right?" }, { "start": 1123.96, "end": 1130.42, "text": " So this is the wind, basically, in the paper example." }, { "start": 1130.42, "end": 1138.56, "text": " So you want something where the total uncertainty is high, but the the kind of uncertainty of" }, { "start": 1138.56, "end": 1142.08, "text": " the of the stochasticity of the world is low." }, { "start": 1142.08, "end": 1150.24, "text": " If you maximize this quantity here, this total quantity, sorry, if you maximize this entire" }, { "start": 1150.24, "end": 1156.84, "text": " quantity, because I called one of them total, that means you are going to seek out actions" }, { "start": 1156.84, "end": 1162.8799999999999, "text": " where what's left is only the uncertainty that you yourself don't know, right?" }, { "start": 1162.8799999999999, "end": 1167.36, "text": " You say, well, this state has a pretty high total uncertainty, but it's not due to the" }, { "start": 1167.36, "end": 1170.26, "text": " fact that the world itself is uncertain." }, { "start": 1170.26, "end": 1174.2, "text": " It must be due to the fact that I don't know yet." }, { "start": 1174.2, "end": 1180.8, "text": " And they make the claim that their model is actually going after these things." }, { "start": 1180.8, "end": 1188.76, "text": " And they say, okay, because we have these these Gaussians here as our estimators, they" }, { "start": 1188.76, "end": 1196.32, "text": " somehow reduce to this total to this uncertainty, but only basically by taking Gaussians, they" }, { "start": 1196.32, "end": 1203.56, "text": " assume, they just assume that this quantity here is constant." }, { "start": 1203.56, "end": 1206.08, "text": " At least that's how I understand it." }, { "start": 1206.08, "end": 1211.12, "text": " They basically assume that every transition in the world has about the same amount of" }, { "start": 1211.12, "end": 1212.36, "text": " uncertainty." }, { "start": 1212.36, "end": 1216.54, "text": " And therefore, we can just focus on the total amount of uncertainty, right?" }, { "start": 1216.54, "end": 1223, "text": " So if we can't predict, if we can't predict the next state, a, we can predict the next" }, { "start": 1223, "end": 1230.52, "text": " state a better than the next state B, and both have about the same amount of intrinsic" }, { "start": 1230.52, "end": 1236.4, "text": " uncertainty, stochasticity in the world, that must mean we should go to B because that's" }, { "start": 1236.4, "end": 1238.16, "text": " where our model hasn't learned yet." }, { "start": 1238.16, "end": 1242.28, "text": " Now, of course, in the real world, that is absolutely not the case." }, { "start": 1242.28, "end": 1248.44, "text": " And I think this model works mainly because they tested in these transitions, or in these" }, { "start": 1248.44, "end": 1254.4, "text": " environments where that might be very close to accurate, that actually most of the transitions" }, { "start": 1254.4, "end": 1260.04, "text": " have the same stochasticity as any other transition." }, { "start": 1260.04, "end": 1267.4, "text": " The second, the second part, why this is a bit difficult is because you have to somehow" }, { "start": 1267.4, "end": 1275.8, "text": " keep this latent, sorry, this, this couple of models right here that make this disagreement" }, { "start": 1275.8, "end": 1278.76, "text": " prediction." }, { "start": 1278.76, "end": 1285.04, "text": " So you rely on the fact that you can capture disagreement by looking how those models disagree" }, { "start": 1285.04, "end": 1286.04, "text": " with each other." }, { "start": 1286.04, "end": 1289.02, "text": " And again, they employ Gaussians here." }, { "start": 1289.02, "end": 1296.08, "text": " But it is not said that these things, these things will actually give you the true disagreement" }, { "start": 1296.08, "end": 1297.08, "text": " among themselves." }, { "start": 1297.08, "end": 1303.36, "text": " If you initialize them wrongly, they might miss like if, if your distribution has three" }, { "start": 1303.36, "end": 1308.52, "text": " modes, they act, they might just for all of them, focus on one of them." }, { "start": 1308.52, "end": 1313.12, "text": " And then your disagreement will be completely out of whack, or you could initialize them" }, { "start": 1313.12, "end": 1319.26, "text": " not far enough for or too close together." }, { "start": 1319.26, "end": 1321.4799999999998, "text": " That's the same thing." }, { "start": 1321.4799999999998, "end": 1327.28, "text": " So it all depends on kind of how you manage to handle this uncertainty right here." }, { "start": 1327.28, "end": 1333.32, "text": " So all of this seems a bit problematic, but the whole setup is pretty cool." }, { "start": 1333.32, "end": 1336.92, "text": " Because imagine like all of this is shifting constantly, right?" }, { "start": 1336.92, "end": 1341.84, "text": " The the policy here tries to maximize these rewards." }, { "start": 1341.84, "end": 1343.96, "text": " And that's something I don't understand." }, { "start": 1343.96, "end": 1349.68, "text": " In the paper, they make it sort of explicitly clear that the policy tries to maximize this" }, { "start": 1349.68, "end": 1355.12, "text": " quantity right here, the next uncertainty." }, { "start": 1355.12, "end": 1364.8799999999999, "text": " The planning objective is to maximize expected novelty, or it, which is this thing right" }, { "start": 1364.8799999999999, "end": 1365.8799999999999, "text": " here." }, { "start": 1365.8799999999999, "end": 1374.56, "text": " However, I, I don't actually see why in that case, you'd need planning." }, { "start": 1374.56, "end": 1380.36, "text": " Because with planning, your goal is sort of to look ahead more than one step." }, { "start": 1380.36, "end": 1387.4399999999998, "text": " So what I would expect is that they somehow have the aggregated somehow that they not" }, { "start": 1387.4399999999998, "end": 1395, "text": " don't maximize this, but somehow they maximize the future right of t prime of r t prime," }, { "start": 1395, "end": 1403.34, "text": " I, they somehow maximize the yes, they somehow maximize the future, the total future, maybe" }, { "start": 1403.34, "end": 1408.78, "text": " with a disagreement, like if it was a reward, and you actually want to maximize the total" }, { "start": 1408.78, "end": 1416.52, "text": " reward across your episode, I would imagine they use planning to maximize the total future" }, { "start": 1416.52, "end": 1421.44, "text": " uncertainty that they encounter because right here you have your trajectories." }, { "start": 1421.44, "end": 1427.48, "text": " And as they say it, they only maximize the uncertainty after the first step." }, { "start": 1427.48, "end": 1431.8799999999999, "text": " So this here might be, you know, even intrinsically uncertain or a bit uncertain." }, { "start": 1431.8799999999999, "end": 1437.2, "text": " But if you go down the path here, there might be a state where that's super uncertain, and" }, { "start": 1437.2, "end": 1441.52, "text": " you would like to find that right through your different rollouts." }, { "start": 1441.52, "end": 1448.2, "text": " So I'm not sure that the paper is correct or consistent here, actually." }, { "start": 1448.2, "end": 1451.92, "text": " I might be wrong, though, they do have the code, which is a really good thing." }, { "start": 1451.92, "end": 1456.6000000000001, "text": " So I'll link to the code and you can go and explore that." }, { "start": 1456.6000000000001, "end": 1461.72, "text": " They do have this algorithm down here, which is pretty much I mean, this is saying just" }, { "start": 1461.72, "end": 1463.88, "text": " nothing." }, { "start": 1463.88, "end": 1469.6000000000001, "text": " Still exploring, do train the world model, train the latent disagreement ensemble, train" }, { "start": 1469.6000000000001, "end": 1476.88, "text": " the policy in imagination of like, rather, rather, it helps a bit." }, { "start": 1476.88, "end": 1477.88, "text": " Okay." }, { "start": 1477.88, "end": 1485.6000000000001, "text": " But one other thing right here, the policy that tries to maximize the reward, right," }, { "start": 1485.6000000000001, "end": 1489.0800000000002, "text": " so you use planning to look ahead where the uncertainty is." }, { "start": 1489.0800000000002, "end": 1491.5200000000002, "text": " But how do you do the planning?" }, { "start": 1491.52, "end": 1496.32, "text": " You need a policy in imagination space, right?" }, { "start": 1496.32, "end": 1505.2, "text": " This latent disagreement policy here is used to train how you act in latent space, right?" }, { "start": 1505.2, "end": 1511.8799999999999, "text": " How this action that you imagine comes to be, you can't plan in imagination space and" }, { "start": 1511.8799999999999, "end": 1516.22, "text": " in imagination space use planning again, it's just an infinite recursion." }, { "start": 1516.22, "end": 1519.22, "text": " At some point, you need a model that tells you what to do." }, { "start": 1519.22, "end": 1523.92, "text": " And in imagination, they just use an actor critic model, you see they have a value function" }, { "start": 1523.92, "end": 1524.92, "text": " here." }, { "start": 1524.92, "end": 1533.2, "text": " They just use an actor critic model to basically one shot predict the next best action to" }, { "start": 1533.2, "end": 1535.6000000000001, "text": " get you to the next step." }, { "start": 1535.6000000000001, "end": 1547.04, "text": " So as they themselves rag on these model free methods, because they only look ahead, how" }, { "start": 1547.04, "end": 1553.96, "text": " is that not exactly the same as me ragging on the fact that they use model free and imagination" }, { "start": 1553.96, "end": 1559.3999999999999, "text": " space, because your world model certainly is retrospective, your world model learns" }, { "start": 1559.3999999999999, "end": 1561.8799999999999, "text": " from the past, right?" }, { "start": 1561.8799999999999, "end": 1569.44, "text": " So the model free method that learns on your imagined world model learns from retrospective" }, { "start": 1569.44, "end": 1577.76, "text": " imagination. And therefore, it itself has sort of the same problem, just one layer deeper" }, { "start": 1577.76, "end": 1583.56, "text": " that it learns from retrospective data and not from data ahead, because your uncertainty" }, { "start": 1583.56, "end": 1589.3200000000002, "text": " about the future might just be because of your retrospect, exactly is because of your" }, { "start": 1589.3200000000002, "end": 1590.64, "text": " retrospective data." }, { "start": 1590.64, "end": 1595.14, "text": " I see the value in having this uncertainty." }, { "start": 1595.14, "end": 1601.44, "text": " But I think there are other methods that also do model free, and don't just maximize an" }, { "start": 1601.44, "end": 1606.3200000000002, "text": " intrinsic reward, but actually maximize a sort of uncertainty." }, { "start": 1606.3200000000002, "end": 1610.3600000000001, "text": " Okay, enough ragging, let's go to the experiment." }, { "start": 1610.3600000000001, "end": 1617.9, "text": " So the cool thing you can do with this is what's called zero shot performance." }, { "start": 1617.9, "end": 1625.3200000000002, "text": " So what they do is in the first step, they do this, they just learn task agnostic, just" }, { "start": 1625.3200000000002, "end": 1628.16, "text": " explorer." }, { "start": 1628.16, "end": 1634, "text": " Without task, then second, they go and into their buffer." }, { "start": 1634, "end": 1638.2, "text": " So when they explore, they all save, they save what they do, there is no reward, but" }, { "start": 1638.2, "end": 1642.24, "text": " they just save, they store their episodes, right?" }, { "start": 1642.24, "end": 1648.6, "text": " And then someone comes with a task, and the task is simply, they specify like you have" }, { "start": 1648.6, "end": 1654.88, "text": " to run forward, and they go to this buffer, and they now label every episode with its" }, { "start": 1654.88, "end": 1655.88, "text": " reward." }, { "start": 1655.88, "end": 1661.28, "text": " So this is different, this is like offline reinforcement learning, right?" }, { "start": 1661.28, "end": 1668.3, "text": " So basically, it is how well they call it zero shot, but it is how well can an algorithm" }, { "start": 1668.3, "end": 1680.48, "text": " that has explored with this kind of self supervision, perform in offline reinforcement learning" }, { "start": 1680.48, "end": 1688.08, "text": " on the trajectories that it has already experienced, which is different from performing the same" }, { "start": 1688.08, "end": 1693.96, "text": " trajectories with the reward, because you would learn from the reward, and you would" }, { "start": 1693.96, "end": 1698.1599999999999, "text": " learn to seek out different, like your experience would be different." }, { "start": 1698.16, "end": 1700.28, "text": " If you were going after a reward." }, { "start": 1700.28, "end": 1702.16, "text": " So this is harder." }, { "start": 1702.16, "end": 1709.76, "text": " So they compare this to dreamer, and dreamer is a fully supervised method, the dreamer" }, { "start": 1709.76, "end": 1714.92, "text": " is actually cheating, dreamer actually goes after the reward." }, { "start": 1714.92, "end": 1721, "text": " And all the other methods here, they don't have a reward, and they're just zero shot" }, { "start": 1721, "end": 1724.1200000000001, "text": " offline reinforcement learning generalized to these methods." }, { "start": 1724.12, "end": 1731.32, "text": " And you see the green is the plan to explore, and that outperforms almost all the other" }, { "start": 1731.32, "end": 1738.12, "text": " methods right here, down here, and even comes close to this, to the dreamer that goes up" }, { "start": 1738.12, "end": 1739.12, "text": " here." }, { "start": 1739.12, "end": 1744.36, "text": " It's seen pretty much every graphic that dreamer is the one that's able to cheat, right?" }, { "start": 1744.36, "end": 1747.7199999999998, "text": " So it is performing pretty well." }, { "start": 1747.72, "end": 1756.3600000000001, "text": " But then the the zero shot generalized plan to explore is sometimes on par and certainly" }, { "start": 1756.3600000000001, "end": 1761.88, "text": " outperforms the other intrinsic reward methods." }, { "start": 1761.88, "end": 1770.72, "text": " Now how does that go about when you try actually when you allow the model to fine tune on the" }, { "start": 1770.72, "end": 1771.72, "text": " task." }, { "start": 1771.72, "end": 1778, "text": " So you can see the performance on few shot adaptation from raw pixels without state space" }, { "start": 1778, "end": 1779, "text": " input." }, { "start": 1779, "end": 1786.64, "text": " So basically, you learn without reward for this many steps right here, until this shaded" }, { "start": 1786.64, "end": 1788.1200000000001, "text": " area back here." }, { "start": 1788.1200000000001, "end": 1794.84, "text": " This is how when you do no reward, and then all of a sudden, now you say, okay, now, I'll" }, { "start": 1794.84, "end": 1796.28, "text": " give you reward." }, { "start": 1796.28, "end": 1797.88, "text": " Now please learn." }, { "start": 1797.88, "end": 1804.5200000000002, "text": " This many steps, you have this many steps where you can learn from the reward." }, { "start": 1804.5200000000002, "end": 1806.8400000000001, "text": " So now we're no longer in this offline RL setting." }, { "start": 1806.8400000000001, "end": 1808.68, "text": " This is now online RL." }, { "start": 1808.68, "end": 1813.24, "text": " But we've been pre trained with all of this experience that we had without the reward." }, { "start": 1813.24, "end": 1816.8400000000001, "text": " Again, the orange here is the cheater." }, { "start": 1816.8400000000001, "end": 1822.4, "text": " So the orange is is cheating." }, { "start": 1822.4, "end": 1829.64, "text": " And now we don't so before the graphs were higher, because we've, we've actually at each" }, { "start": 1829.64, "end": 1835.5600000000002, "text": " step, for example, how this works is you train until here without reward, and then you do" }, { "start": 1835.5600000000002, "end": 1840.48, "text": " this offline RL offline RL training." }, { "start": 1840.48, "end": 1842.3600000000001, "text": " And that's how this point comes about." }, { "start": 1842.3600000000001, "end": 1847.6200000000001, "text": " Now, I think in the graph down here, they they don't do that." }, { "start": 1847.6200000000001, "end": 1851.88, "text": " So they just measure how well you're doing in the task." }, { "start": 1851.88, "end": 1857.94, "text": " And of course, if after this many steps, you've never looked at the reward, you haven't been" }, { "start": 1857.94, "end": 1863.8400000000001, "text": " able to look at the reward, your reward will be fairly low, right at the task, because" }, { "start": 1863.8400000000001, "end": 1867.2800000000002, "text": " you don't know what to do to get the high reward." }, { "start": 1867.2800000000002, "end": 1870.3200000000002, "text": " The dreamer again, this orange line is able to cheat." }, { "start": 1870.3200000000002, "end": 1874.8400000000001, "text": " That's why it just is basically straight line or goes up at the beginning, it's able to" }, { "start": 1874.8400000000001, "end": 1876.5200000000002, "text": " look at the reward from the beginning." }, { "start": 1876.5200000000002, "end": 1878.72, "text": " And it's here as a baseline comparison." }, { "start": 1878.72, "end": 1885.28, "text": " So you see as soon as you give the reward to the models, they generally shoot up." }, { "start": 1885.28, "end": 1890.84, "text": " And this plan to explore generally shoots up much harder than these others, as you can" }, { "start": 1890.84, "end": 1892.68, "text": " see, pretty much everywhere." }, { "start": 1892.68, "end": 1898.4, "text": " And again, it gets competitive and here even outperforms the dreamer." }, { "start": 1898.4, "end": 1902.08, "text": " Why could it outperform the supervised method?" }, { "start": 1902.08, "end": 1908.9199999999998, "text": " Maybe because this method here is sort of confused or is stuck in a local optimum, which" }, { "start": 1908.9199999999998, "end": 1912, "text": " can happen very easily in reinforcement learning." }, { "start": 1912, "end": 1917.28, "text": " Whereas the plan to explore has never seen the reward, therefore hasn't tried to just" }, { "start": 1917.28, "end": 1922.36, "text": " single mindedly maximize the reward and has explored a bunch of different things to do" }, { "start": 1922.36, "end": 1923.36, "text": " in the world." }, { "start": 1923.36, "end": 1930.6399999999999, "text": " And now we can use that knowledge to outperform the plan, the dreamer, the baseline." }, { "start": 1930.64, "end": 1936.0400000000002, "text": " So the other thing I would like to draw your attention to here is that sometimes you see" }, { "start": 1936.0400000000002, "end": 1945.5, "text": " that the plan to explore or the other curiosity methods actually get a reward before the reward" }, { "start": 1945.5, "end": 1950, "text": " kicks in as we saw here, right?" }, { "start": 1950, "end": 1952.44, "text": " For example, right here." }, { "start": 1952.44, "end": 1959.76, "text": " And this tells me that this is probably a property of the environment itself, namely" }, { "start": 1959.76, "end": 1964.16, "text": " these reinforcement learning environments, they don't really have much noise going on," }, { "start": 1964.16, "end": 1965.16, "text": " right?" }, { "start": 1965.16, "end": 1970.64, "text": " They pretty much just have, it's a simulator with one figure that can walk or not." }, { "start": 1970.64, "end": 1978.12, "text": " And therefore, it might be that the only interesting thing to do in these models is to actually" }, { "start": 1978.12, "end": 1979.72, "text": " perform one of these tasks." }, { "start": 1979.72, "end": 1986.04, "text": " And that's why it might be that sometimes they already get a reward." }, { "start": 1986.04, "end": 1995, "text": " So it's true that they don't see the reward for this entire duration, but also implicitly" }, { "start": 1995, "end": 2000.32, "text": " via the developers building the simulator, they have made it such that the only interesting" }, { "start": 2000.32, "end": 2005.44, "text": " thing to do is the same thing as getting a reward, right?" }, { "start": 2005.44, "end": 2013.44, "text": " So I'm sort of skeptical that this is like a general exploration policy, because also" }, { "start": 2013.44, "end": 2021.0800000000002, "text": " in the real world, there are just combinatorically hugely many, many actions to do many paths" }, { "start": 2021.0800000000002, "end": 2022.44, "text": " to follow." }, { "start": 2022.44, "end": 2030.72, "text": " And if you just go by what do I not know yet, I think you can't you can't put that all into" }, { "start": 2030.72, "end": 2032.76, "text": " one model is just too much." }, { "start": 2032.76, "end": 2040.16, "text": " And the states where you really were really something interesting happens are so few and" }, { "start": 2040.16, "end": 2045.76, "text": " far in between, and that it doesn't compare to the amount of states where you simply don't" }, { "start": 2045.76, "end": 2051.4, "text": " know most states, you don't know what's going to happen, but probably nothing's nothing" }, { "start": 2051.4, "end": 2056.52, "text": " interesting is going to happen just different things, which will screw over this method" }, { "start": 2056.52, "end": 2058.6, "text": " completely." }, { "start": 2058.6, "end": 2065.64, "text": " In any case, they Yeah, sorry, this is just this is another experiment." }, { "start": 2065.64, "end": 2072.2799999999997, "text": " They have a bunch of other experiments. And yeah, that that was my this was my review" }, { "start": 2072.2799999999997, "end": 2078.04, "text": " of the paper. Tell me if you agree or disagree or if I've misunderstood something that's" }, { "start": 2078.04, "end": 2079.6, "text": " entirely possible." }, { "start": 2079.6, "end": 2088, "text": " I'm just always a bit skeptical of these things a bit." }, { "start": 2088, "end": 2093.52, "text": " So the experiments, they're very compute intensive, of course, so you never know there and then" }, { "start": 2093.52, "end": 2096.28, "text": " these specific environments right here." }, { "start": 2096.28, "end": 2101.12, "text": " You never know there and then the fact that the real world actually has very different" }, { "start": 2101.12, "end": 2106.96, "text": " stochasticity, which they simply assume away right here." }, { "start": 2106.96, "end": 2112.08, "text": " Yeah, but other than that, big props to the fact that the code is out." }, { "start": 2112.08, "end": 2116.6, "text": " And as I said, leave a comment if you agree or disagree." }, { "start": 2116.6, "end": 2120.48, "text": " Please subscribe and share this video if you liked it, and I'll see you next time." }, { "start": 2120.48, "end": 2123.8, "text": " Bye bye." } ]
XvDzZwoQFcU
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[News] Facebook's Real-Time TTS system runs on CPUs only!
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "facebook", "fair", "tts", "text-to-speech", "real-time", "wavenet", "rnn", "spectrogram", "mel", "frequency", "vocoder", "linguistic", "features", "speaker", "soft", "style", "tone", "phonemes", "neural", "recurrent", "human", "assistant" ]
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. This is generated by a system that Facebook AI has built. 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. I think they built this into their products and it's mainly explaining on a high level what they did. They have a real-time text-to-speech system, which means that you have a text like this sentence here, share on Facebook. You give it to the system and the system comes up with a sound wave that says this sentence. If you listen to it, you'll hear share on Facebook. It has to do that in a 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. What you want to do for this is you want to have some sort of recurrent neural network or any sort of autoregressive network that outputs basically these samples here. One at a time. These points you're going to output one at a time. For one second of audio, it can require you to output 24,000 of these data points. 24,000 forward propagations of your autoregressive model. That's massive. If you want to do it in real-time, and that's why real-time is so impressive, you have to do this in less than one second. You have to do these 24,000 forward passes in less than a second. Even more so, this was already possible, I think, but it required a big data center with many, many, many, many GPUs in it. You basically would send your text to this and it would stream back the audio. They can do this just on CPUs. In fact, they can do this on a quad-core CPU in real-time. They can generate this many samples in half a second. Pretty impressive. Let's dive into how they do it. 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 visually impaired to visual reality experiences. First, they show this graph right here. What are they doing? This is their entire system. It is chunked in multiple parts. If you're a deep learning practitioner, you're very keen on taking this text and just like a giant neural network and just run it through and generate audio end-to-end. This doesn't really work in this case, first of all, because it would be 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. That's what they do. They have this linguistic front-end. The linguistic front-end generates two different things. It generates what needs to be said and how does it need to be said. What needs to be said, they call this linguistic features. The linguistic features are things like phonemes and so on. They don't even have a title for this one. The linguistic front-end converts the input text, probably it's a sentence by sentence thing. This is one sentence of text into a sequence of linguistic features such as phonemes and sentence type. These linguistic features, if it's like share on Facebook, it would be like, okay, is one and then a and then r. These are the phonemes of share, right? It would kind of chunk it into that. 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. We 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. This is different from if this would be a question. 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 a different word now. But the how would output, this is a question. 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. This linguistic front end, as you can see, it still deals with text. It deals with text and it outputs these how features and these linguistic, these what features. The what features now go into an acoustic model. What does the acoustic model do? The acoustic model is meant to generate a spectrum, a spectrogram of the sound. We'll skip this for the moment and go to the neural vocoder. The neural vocoder is a kind of a standard thing in 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 this axis and frequency on this axis. And then there is a, it's usually somewhat like color coded, but it's just intensity. 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 is a sort of a way to read the spectrogram. 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 this 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 too 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. This is learned, right? This is learned how this spectrogram 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 detail. See, there's only two connections here in this long stretch where there is many, many connections here at the very beginning. So right before you. So 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 that's they say they use something like this in order to then actually produce the final audio from the spectrograms. So actually, neural vocoder, you can 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 said? How? Come on. Well, this is an H. How does something need to be said? And it will transform it into features that the sort of neural network can understand. These 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 or a German 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 of the thing. OK, so about the prosody model, they say we use style embeddings that allow us to create new voice styles, including assistant soft fast project and formal using only a small amount of additional data with the existing data sets. 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 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. Here the they describe in essence how their acoustic model works. The fact that they output 13 dimensional MFCC features concatenated with the fundamental frequency and a five dimensional periodicity feature, which is much easier for the acoustic model to generate. So that's what the acoustic model generates. OK, and then here are conditional neural vocoders is the final part of the pipeline, consists of two components, a convolutional neural network that up samples or expands the input feature vectors from the frame rate 200 predictions per second. So that's not it's not 200 milliseconds. It would be 200 spectrograms a second to the sample rate 24000 predictions per second. And this similar to wave RNN, which synthesizes audio samples autoregressively. That means one sample at a time at 24000 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 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 pie torch JIT along with some. So these pie torches, these pie torch 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're they achieve sparsity 60, 96 percent. And this basically you do by some sort of teacher, teacher, student model. Or there are many ways to do this, but you can 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 this sparsity, they bring this down to five seconds per second. And 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 LAPOC 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 percent 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 heavy lifting to four CPU cores. And that doesn't divide it by four, of course, because there is 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 accented 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 out 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 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 assistance 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 assistance, 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, "end": 3, "text": " Hi there, check this out." }, { "start": 3, "end": 10, "text": " Modern text-to-speech systems have come a long way in using neural networks to mimic the nuances of human voice." }, { "start": 10, "end": 19, "text": " 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." }, { "start": 19, "end": 29, "text": " The size and complexity of state-of-the-art models require massive computation, which often needs to run on GPUs or other specialized hardware." }, { "start": 29, "end": 34, "text": " This is generated by a system that Facebook AI has built." }, { "start": 34, "end": 43, "text": " We're going to look at it. It's called a highly efficient real-time text-to-speech system deployed on CPUs." }, { "start": 43, "end": 49, "text": " There's a lot to unpack here, but this is not a paper. This is basically a technical blog post." }, { "start": 49, "end": 57, "text": " I think they built this into their products and it's mainly explaining on a high level what they did." }, { "start": 57, "end": 67, "text": " They have a real-time text-to-speech system, which means that you have a text like this sentence here, share on Facebook." }, { "start": 67, "end": 77, "text": " You give it to the system and the system comes up with a sound wave that says this sentence." }, { "start": 77, "end": 80, "text": " If you listen to it, you'll hear share on Facebook." }, { "start": 80, "end": 91, "text": " It has to do that in a credible way, such that it is a human-like voice, because people like hearing that." }, { "start": 91, "end": 99, "text": " Not these kind of robot, old-school telephone robot voices where they just chunk together words. It has to flow naturally." }, { "start": 99, "end": 109, "text": " What you want to do for this is you want to have some sort of recurrent neural network or any sort of autoregressive network that outputs basically these samples here." }, { "start": 109, "end": 116, "text": " One at a time. These points you're going to output one at a time." }, { "start": 116, "end": 127, "text": " For one second of audio, it can require you to output 24,000 of these data points." }, { "start": 127, "end": 133, "text": " 24,000 forward propagations of your autoregressive model. That's massive." }, { "start": 133, "end": 142, "text": " If you want to do it in real-time, and that's why real-time is so impressive, you have to do this in less than one second." }, { "start": 142, "end": 150, "text": " You have to do these 24,000 forward passes in less than a second." }, { "start": 150, "end": 163, "text": " Even more so, this was already possible, I think, but it required a big data center with many, many, many, many GPUs in it." }, { "start": 163, "end": 169, "text": " You basically would send your text to this and it would stream back the audio." }, { "start": 169, "end": 178, "text": " They can do this just on CPUs. In fact, they can do this on a quad-core CPU in real-time." }, { "start": 178, "end": 185, "text": " They can generate this many samples in half a second. Pretty impressive." }, { "start": 185, "end": 189, "text": " Let's dive into how they do it. They say," }, { "start": 189, "end": 195, "text": " It's deployed in Portal, our video calling service, and available for use across a range of other Facebook applications." }, { "start": 195, "end": 202, "text": " From reading support for the visually impaired to visual reality experiences." }, { "start": 202, "end": 209, "text": " First, they show this graph right here. What are they doing?" }, { "start": 209, "end": 213, "text": " This is their entire system. It is chunked in multiple parts." }, { "start": 213, "end": 226, "text": " If you're a deep learning practitioner, you're very keen on taking this text and just like a giant neural network and just run it through and generate audio end-to-end." }, { "start": 226, "end": 236, "text": " This doesn't really work in this case, first of all, because it would be too many parameters to evaluate this many times." }, { "start": 236, "end": 247, "text": " But also, especially text and audio are such different modalities that you'll have to basically chunk this into individual parts." }, { "start": 247, "end": 251, "text": " That's what they do. They have this linguistic front-end." }, { "start": 251, "end": 256, "text": " The linguistic front-end generates two different things." }, { "start": 256, "end": 263, "text": " It generates what needs to be said and how does it need to be said." }, { "start": 263, "end": 267, "text": " What needs to be said, they call this linguistic features." }, { "start": 267, "end": 276, "text": " The linguistic features are things like phonemes and so on." }, { "start": 276, "end": 282, "text": " They don't even have a title for this one." }, { "start": 282, "end": 289, "text": " The linguistic front-end converts the input text, probably it's a sentence by sentence thing." }, { "start": 289, "end": 299, "text": " This is one sentence of text into a sequence of linguistic features such as phonemes and sentence type." }, { "start": 299, "end": 310, "text": " These linguistic features, if it's like share on Facebook, it would be like, okay, is one and then a and then r." }, { "start": 310, "end": 314, "text": " These are the phonemes of share, right? It would kind of chunk it into that." }, { "start": 314, "end": 318, "text": " That is much closer to what we think of an audio signal." }, { "start": 318, "end": 322, "text": " This will make one sound, this will make a sound and this will make a sound." }, { "start": 322, "end": 329, "text": " We chunk it into that and then here the how is it said." }, { "start": 329, "end": 337, "text": " This would be, for example, the fact that share on Facebook is sort of an instruction." }, { "start": 337, "end": 341, "text": " This is different from if this would be a question." }, { "start": 341, "end": 345, "text": " If it said, do you want to share this on Facebook?" }, { "start": 345, "end": 352, "text": " Then the what would output much the same phonemes right here, except it's a different word now." }, { "start": 352, "end": 356, "text": " But the how would output, this is a question." }, { "start": 356, "end": 362, "text": " As you can see, the information flow right here informs the later stages." }, { "start": 362, "end": 370, "text": " This would then cause at the end of the sentence the voice to go up because it's a question." }, { "start": 370, "end": 375, "text": " This linguistic front end, as you can see, it still deals with text." }, { "start": 375, "end": 381, "text": " It deals with text and it outputs these how features and these linguistic, these what features." }, { "start": 381, "end": 385, "text": " The what features now go into an acoustic model." }, { "start": 385, "end": 387, "text": " What does the acoustic model do?" }, { "start": 387, "end": 394, "text": " The acoustic model is meant to generate a spectrum, a spectrogram of the sound." }, { "start": 394, "end": 399, "text": " We'll skip this for the moment and go to the neural vocoder." }, { "start": 399, "end": 405, "text": " The neural vocoder is a kind of a standard thing in text in any speech producing." }, { "start": 405, "end": 409, "text": " It takes a spectrogram of the sound and turns it into actual audio." }, { "start": 409, "end": 422, "text": " So this here, I think they achieve it with, they say something similar like a wave RNN based on plus like a CNN." }, { "start": 422, "end": 425, "text": " So we'll look into that quickly." }, { "start": 425, "end": 431, "text": " So the spectrum, the spectrogram of the sound is going to be a bit of an image." }, { "start": 431, "end": 439, "text": " And the image has time on this axis and frequency on this axis." }, { "start": 439, "end": 447, "text": " And then there is a, it's usually somewhat like color coded, but it's just intensity." }, { "start": 447, "end": 454, "text": " So whenever there is, whenever a frequency at a given time is expressed strongly, it will light up." }, { "start": 454, "end": 459, "text": " So it could be something like this." }, { "start": 459, "end": 465, "text": " So over time, the mid frequency is always there, but this frequency right here is not there." }, { "start": 465, "end": 467, "text": " And this is here at the beginning." }, { "start": 467, "end": 469, "text": " So there is a sort of a way to read the spectrogram." }, { "start": 469, "end": 479, "text": " But this represents maybe something like this represents the not even sure how much sound this represents," }, { "start": 479, "end": 487, "text": " but this can represent maybe something like 200 milliseconds of audio." }, { "start": 487, "end": 497, "text": " And you have to basically perform a Fourier transform to transform that into 200 milliseconds of actual wave audio." }, { "start": 497, "end": 508, "text": " But since the audio has to be output at what this 24,000 samples per second, what's coming in here is not that much." }, { "start": 508, "end": 515, "text": " The acoustic model outputs not 24,000 spectrums per second." }, { "start": 515, "end": 519, "text": " So first of all, this has to be up sampled." }, { "start": 519, "end": 522, "text": " So this time dimension here has just too few samples." }, { "start": 522, "end": 533, "text": " 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." }, { "start": 533, "end": 538, "text": " And basically, the CNN will have to impute." }, { "start": 538, "end": 541, "text": " This is learned, right?" }, { "start": 541, "end": 547, "text": " This is learned how this spectrogram would look if it were sampled much more densely." }, { "start": 547, "end": 552, "text": " And now it has basically the correct number of samples here." }, { "start": 552, "end": 559, "text": " And now this wave RNN can step through it and look at these slices and look at the last slices" }, { "start": 559, "end": 564, "text": " or actually also can look at the last spectrograms, maybe." }, { "start": 564, "end": 569, "text": " I don't know. They don't really say what the RNN exactly goes over." }, { "start": 569, "end": 570, "text": " But this is how I imagine it." }, { "start": 570, "end": 574, "text": " And the wave RNN is based on a wave net architecture." }, { "start": 574, "end": 582, "text": " 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." }, { "start": 582, "end": 585, "text": " But this would be too many connections, right?" }, { "start": 585, "end": 587, "text": " It would be too much memory." }, { "start": 587, "end": 595, "text": " So what you do is you can look back at the directions at the things right before you in very great detail." }, { "start": 595, "end": 600, "text": " But then as you go back further and further, you basically lose detail." }, { "start": 600, "end": 609, "text": " See, there's only two connections here in this long stretch where there is many, many connections here at the very beginning." }, { "start": 609, "end": 610, "text": " So right before you." }, { "start": 610, "end": 615, "text": " So that means you look in more detail what you've produced recently." }, { "start": 615, "end": 621, "text": " But you also sort of look back in a more blurry way at what you've produced a long time ago." }, { "start": 621, "end": 623, "text": " So this is a wave net architecture." }, { "start": 623, "end": 632, "text": " And that's they say they use something like this in order to then actually produce the final audio from the spectrograms." }, { "start": 632, "end": 636, "text": " So actually, neural vocoder, you can you can train this thing." }, { "start": 636, "end": 640, "text": " You can train it by itself." }, { "start": 640, "end": 644, "text": " Right. You simply feed spectrums and you make it go audio." }, { "start": 644, "end": 648, "text": " And you know, there's a lot of audio on the Internet." }, { "start": 648, "end": 654, "text": " You can simply produce spectrograms from that and then train the vocoder to produce the audio." }, { "start": 654, "end": 659, "text": " So the good thing about this pipeline here is you can train a lot of these things independently from each other." }, { "start": 659, "end": 664, "text": " I don't actually know whether they do that or not, but you can." }, { "start": 664, "end": 672, "text": " You see this box up here, this prosody model, and that will take in." }, { "start": 672, "end": 677, "text": " These how features. So how does something need to be said?" }, { "start": 677, "end": 682, "text": " How? Come on." }, { "start": 682, "end": 687, "text": " Well, this is an H. How does something need to be said?" }, { "start": 687, "end": 693, "text": " And it will transform it into features that the sort of neural network can understand." }, { "start": 693, "end": 698, "text": " These these neural networks, they need features like they need embeddings." }, { "start": 698, "end": 707, "text": " 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." }, { "start": 707, "end": 715, "text": " You would also get the information that the speaker should be, you know, kind of calm." }, { "start": 715, "end": 720, "text": " Sorry, that would be the style. The speaker should be maybe a woman voice." }, { "start": 720, "end": 727, "text": " And then the language should be it should have like an English sound or a German sound and so on." }, { "start": 727, "end": 736, "text": " So this model here will take in all of that and emit features that these neural networks here can understand." }, { "start": 736, "end": 747, "text": " 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." }, { "start": 747, "end": 749, "text": " And so does this acoustic model." }, { "start": 749, "end": 755, "text": " So the acoustic model is sort of along with the prosody model is a bit of the heart of the thing here." }, { "start": 755, "end": 757, "text": " It takes in these linguistic features." }, { "start": 757, "end": 759, "text": " So what needs to be said, right?" }, { "start": 759, "end": 767, "text": " The acoustic model, it takes into account the again, the speaker embedding, language embedding and so on." }, { "start": 767, "end": 776, "text": " It takes into account the output from the prosody model of the how you would like it to be said." }, { "start": 776, "end": 779, "text": " This includes what type of sentence this is." }, { "start": 779, "end": 788, "text": " And this it synthesizes it all in order to come up with the spectrum right here in order to come up with these spectrograms." }, { "start": 788, "end": 798, "text": " So this is sort of the heart of the of the thing." }, { "start": 798, "end": 807, "text": " OK, so about the prosody model, they say we use style embeddings that allow us to create new voice styles," }, { "start": 807, "end": 813, "text": " including assistant soft fast project and formal using only a small amount of additional data with the existing data sets." }, { "start": 813, "end": 816, "text": " We don't have to create a separate model for each style." }, { "start": 816, "end": 819, "text": " We need only 30 to 60 minutes of training data for each voice style." }, { "start": 819, "end": 828, "text": " So that happens because you you take into you take in actually an embedding of the feet of the speakers and you train these things independently." }, { "start": 828, "end": 836, "text": " So that means you can sort of generalize to a new style really quickly." }, { "start": 836, "end": 841, "text": " Here the they describe in essence how their acoustic model works." }, { "start": 841, "end": 851, "text": " The fact that they output 13 dimensional MFCC features concatenated with the fundamental frequency and a five dimensional periodicity feature," }, { "start": 851, "end": 854, "text": " which is much easier for the acoustic model to generate." }, { "start": 854, "end": 857, "text": " So that's what the acoustic model generates." }, { "start": 857, "end": 867, "text": " OK, and then here are conditional neural vocoders is the final part of the pipeline," }, { "start": 867, "end": 876, "text": " consists of two components, a convolutional neural network that up samples or expands the input feature vectors from the frame rate 200 predictions per second." }, { "start": 876, "end": 878, "text": " So that's not it's not 200 milliseconds." }, { "start": 878, "end": 888, "text": " It would be 200 spectrograms a second to the sample rate 24000 predictions per second. And this similar to wave RNN," }, { "start": 888, "end": 892, "text": " which synthesizes audio samples autoregressively." }, { "start": 892, "end": 896, "text": " That means one sample at a time at 24000 samples per second." }, { "start": 896, "end": 899, "text": " Crazy, right?" }, { "start": 899, "end": 903, "text": " So this all seems like it's a lot of computation." }, { "start": 903, "end": 912, "text": " And now they describe how they get this to run faster than real time." }, { "start": 912, "end": 918, "text": " And they list their their individual contributions here." }, { "start": 918, "end": 924, "text": " So if they just run this on one CPU core, you see it takes 80 seconds to produce one second of audio." }, { "start": 924, "end": 932, "text": " Then they do optimized inference operators, which means they basically use a pie torch JIT along with some." }, { "start": 932, "end": 946, "text": " So these pie torches, these pie torch 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." }, { "start": 946, "end": 948, "text": " And they also customize this." }, { "start": 948, "end": 952, "text": " So they get to 20 seconds per one second." }, { "start": 952, "end": 956, "text": " Then they do parameter reduction by sparsification." }, { "start": 956, "end": 960, "text": " And they are able to abuse the sparse matrix compute operator." }, { "start": 960, "end": 964, "text": " I think they implemented a custom one to do that." }, { "start": 964, "end": 973, "text": " So this here is very much like if you have a neural network and." }, { "start": 973, "end": 976, "text": " That's somehow connected, connected, connected." }, { "start": 976, "end": 985, "text": " 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." }, { "start": 985, "end": 994, "text": " 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." }, { "start": 994, "end": 996, "text": " So you don't have to compute that." }, { "start": 996, "end": 1003, "text": " So they're they achieve sparsity 60, 96 percent." }, { "start": 1003, "end": 1008, "text": " And this basically you do by some sort of teacher, teacher, student model." }, { "start": 1008, "end": 1023, "text": " Or there are many ways to do this, but you can 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." }, { "start": 1023, "end": 1025, "text": " So they supercharge this." }, { "start": 1025, "end": 1031, "text": " And with this sparsity, they bring this down to five seconds per second." }, { "start": 1031, "end": 1036, "text": " And then they go further and do blockwise sparsification and distillation." }, { "start": 1036, "end": 1042, "text": " So they distill it to an entirely smaller model that then is also blockwise sparse." }, { "start": 1042, "end": 1044, "text": " So they also enforce this blockwise sparsification." }, { "start": 1044, "end": 1057, "text": " 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." }, { "start": 1057, "end": 1064, "text": " They also in the text, they describe that it also optimizes cache access." }, { "start": 1064, "end": 1072, "text": " So if you know about CPUs, they have these level one, level two, level three caches and you can optimize your computations." }, { "start": 1072, "end": 1076, "text": " That's what libraries like LAPOC and BLAS do." }, { "start": 1076, "end": 1082, "text": " You can optimize your computations such that your cache access is optimized." }, { "start": 1082, "end": 1094, "text": " 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." }, { "start": 1094, "end": 1099, "text": " And that tends to be the slow part of the process when your cache misses." }, { "start": 1099, "end": 1108, "text": " So again, they achieve 94 percent block sparsity and that almost gets them to real time." }, { "start": 1108, "end": 1118, "text": " And it's still one CPU. So now they parallelize the operators that are doing the heavy heavy lifting to four CPU cores." }, { "start": 1118, "end": 1125, "text": " And that doesn't divide it by four, of course, because there is an overhead in parallelization and synchronization." }, { "start": 1125, "end": 1132, "text": " But that gets you to this one half a second needed to produce one second of audio." }, { "start": 1132, "end": 1138, "text": " So there you're at real time. And that is pretty impressive." }, { "start": 1138, "end": 1142, "text": " And they go on to describe so in detail how they did it." }, { "start": 1142, "end": 1151, "text": " But they also give some examples of what they can do and would like to achieve even better in the future." }, { "start": 1151, "end": 1160, "text": " So here is an example where they can adapt their model to a given style." }, { "start": 1160, "end": 1163, "text": " And here they have a British accent." }, { "start": 1163, "end": 1169, "text": " Recently, we successfully applied our new approach to create a British accented voice." }, { "start": 1169, "end": 1175, "text": " This is the first of more accents and languages to come." }, { "start": 1175, "end": 1178, "text": " And also you can adapt it." }, { "start": 1178, "end": 1188, "text": " Their idea is that you have sort of an assistant and this assistant will be able to adapt to, let's say, your mood." }, { "start": 1188, "end": 1194, "text": " We're also exploring features to make our voice respond intelligently with different styles of speaking based on the context." }, { "start": 1194, "end": 1199, "text": " For example, when you're rushing out the door in the morning and need to know the time, your assistant would match your hurried pace." }, { "start": 1199, "end": 1206, "text": " When you're in a quiet place and you are speaking softly, your assistant would reply to you in a quiet voice." }, { "start": 1206, "end": 1216, "text": " 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." }, { "start": 1216, "end": 1224, "text": " Right. So this ties in very much with sort of conversational AI, so assistance and so on." }, { "start": 1224, "end": 1227, "text": " But it also ties into wearables, I think." }, { "start": 1227, "end": 1236, "text": " So the fact that you are now smaller than real time means you can run this potentially directly on your smartphone." }, { "start": 1236, "end": 1244, "text": " You could run this on your fridge or something, on your stove, in your car without having to stream, basically." }, { "start": 1244, "end": 1250, "text": " So you'll get much more real time on device assistance, maybe even in your watch." }, { "start": 1250, "end": 1256, "text": " And I'm excited by this technology." }, { "start": 1256, "end": 1262, "text": " So far, it seems you can get it in Facebook products, but I'm sure this will come to places." }, { "start": 1262, "end": 1266, "text": " All right. If you enjoyed this, please consider subscribing." }, { "start": 1266, "end": 1269, "text": " Thank you for listening and watching." }, { "start": 1269, "end": 1276, "text": " Leave a like if you liked it and leave a comment if you have something to comment with that. Bye bye." } ]
p-zOeQCoG9c
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Weight Standardization (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "normalize", "batchnorm", "groupnorm", "layernorm", "mean", "center", "std", "standardize", "backpropagation", "convergence", "gradients", "norm", "convolution", "cnn", "convolutional neural networks", "filters", "kernel", "channel", "architecture" ]
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 Si Wen Jiao, Hu Yuh Wang, Xianqi Liu, Wei Shen, Alan Yuel 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 norm, 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 norm paper or some blog post because weight standardization is usually used together with group norm 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 they compare batch norm, group norm and weight standardization used with group norm then they can as you can see here they can outperform in the image net top one 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 norm and group norm 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 rcnn 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 you divide it 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 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 in each layer you have these transformations that center and standardize the data and usually for the longest time this was a 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. 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 batches still influence the gradient stochasticity 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 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 normalize each feature individually and takes it to the extreme. Basically normalizes a single image 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 what a neural network layer is. So if you have an image right here of our trusty cat. I've drawn whiskers in a while. That nose 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 going to 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 involve 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 layer's 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 in the intermediate layers you have even more. 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. It 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 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. It is characterized by two more numbers which is the CN, the 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 kernel. 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, 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 it 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 input output channel combination you have a two by two filter. 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. Weight standardization says, hey 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 author think it might be a good idea to normalize these weights. So just as you normalize the data you 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 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 convolution operation right here. Now you don't do this you do you have 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 how many of this is standard deviation of W and that entire thing you now 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 backprop signal here is interesting because the backprop signal comes in from here and splits up in two ways 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 backprop path here it introduces two new operation to the forward and to the backprop 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 effect it has on the Lipschitz 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 non 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 going to go into too much and they do also the so the Lipschitz constant of the loss and the Lipschitz 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 outperforms batch norm 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, "end": 7.8, "text": " Hi there! Today we're looking at weight standardization by Si Wen Jiao, Hu Yuh Wang," }, { "start": 7.8, "end": 16.32, "text": " Xianqi Liu, Wei Shen, Alan Yuel of John Hopkins University. So weight standardization" }, { "start": 16.32, "end": 23.22, "text": " is a normalization technique for training neural networks and it goes basically in" }, { "start": 23.22, "end": 28.18, "text": " conjunction with another technique called group normalization. So if you" }, { "start": 28.18, "end": 36.4, "text": " haven't group normalization norm, that is ugly, if you haven't seen my video on" }, { "start": 36.4, "end": 41.36, "text": " group normalization and don't know what it is I suggest you go watch that first" }, { "start": 41.36, "end": 46.64, "text": " or read the group norm paper or some blog post because weight standardization" }, { "start": 46.64, "end": 54.16, "text": " is usually used together with group norm in order to work well and that's what" }, { "start": 54.16, "end": 61.64, "text": " this paper also says. Even though it's pretty much independent but here you can" }, { "start": 61.64, "end": 69.64, "text": " see their main results. So they compare batch norm, group norm and weight" }, { "start": 69.64, "end": 75.47999999999999, "text": " standardization used with group norm then they can as you can see here they" }, { "start": 75.47999999999999, "end": 81.44, "text": " can outperform in the image net top one accuracy the other two models and the" }, { "start": 81.44, "end": 87.36, "text": " important part here as you can see is batch norm is trained with large batch" }, { "start": 87.36, "end": 93.08, "text": " sizes while group norm and group norm plus weight standardization are trained" }, { "start": 93.08, "end": 98.92, "text": " with one image per GPU so they have a multi GPU setup and this is just one" }, { "start": 98.92, "end": 107.36, "text": " image per GPU and these results over here are on a mask rcnn" }, { "start": 107.36, "end": 117.4, "text": " which I believe is a recurrent model where the model is large because the kind" }, { "start": 117.4, "end": 122.2, "text": " of the model is large and therefore you can only have very small batches per" }, { "start": 122.2, "end": 128.56, "text": " worker and that means batch norm will work less. Now again we've discussed why" }, { "start": 128.56, "end": 134.84, "text": " batch norm is not a good thing when you have to go to small batch sizes because" }, { "start": 134.84, "end": 141.08, "text": " basically what people have discovered is that it is very beneficial in machine" }, { "start": 141.08, "end": 144.92000000000002, "text": " learning to normalize your data before working with it. What do we mean by it?" }, { "start": 144.92000000000002, "end": 151.84, "text": " So if you have a bunch of data points right here and let's say like this it is" }, { "start": 151.84, "end": 157.68, "text": " it is usually beneficial to first center the data like this so basically" }, { "start": 157.68, "end": 163.96, "text": " calculate its mean and shift it and then to standardize the axis so basically" }, { "start": 163.96, "end": 168.48000000000002, "text": " you divide it by the standard deviation in each direction and your data will" }, { "start": 168.48000000000002, "end": 172.12, "text": " look something like this. Of many classical methods that will improve the" }, { "start": 172.12, "end": 178.28, "text": " conditioning numbers of the requirements to solve it and so on and even of deep" }, { "start": 178.28, "end": 182.52, "text": " learning methods we just know that if you standardize your data like this it" }, { "start": 182.52, "end": 188.20000000000002, "text": " works better. So people are basically have come up with these methods that" }, { "start": 188.20000000000002, "end": 192.84, "text": " where they say well if it helps for the data at the beginning of a neural" }, { "start": 192.84, "end": 200.16, "text": " network then if after a layer the data is kind of out of whack that can" }, { "start": 200.16, "end": 204.36, "text": " happen after a layer of neural network we should maybe first before we send it" }, { "start": 204.36, "end": 209.28, "text": " to the next layer do the same thing center it again and then send it through" }, { "start": 209.28, "end": 214.8, "text": " and if after the next layer again it's out of whack we should maybe center it" }, { "start": 214.8, "end": 219.44, "text": " and standardize it again before sending it through the next layer. So in each" }, { "start": 219.44, "end": 225.68, "text": " layer you have these transformations that center and standardize the data and" }, { "start": 225.68, "end": 230.32, "text": " usually for the longest time this was a batch norm. Batch norm does this across" }, { "start": 230.32, "end": 235.6, "text": " the mini batches of the data since you can't pass the entire data set. Now group" }, { "start": 235.6, "end": 240.92, "text": " norm has come and replaced batch norm because in batch norm it's very" }, { "start": 240.92, "end": 247, "text": " dependent on the batch size while group norm isn't. The group norm paper has" }, { "start": 247, "end": 252, "text": " sort of made it clear that in competitive batch sizes in the large" }, { "start": 252, "end": 256.48, "text": " batch size regime group norm is sorry batch norm is still the king batch norm" }, { "start": 256.48, "end": 260.2, "text": " still works better. It's only when you go to very small batch sizes that group" }, { "start": 260.2, "end": 265.12, "text": " norm takes over and that's what you can see here. So here okay it's a bit unfair" }, { "start": 265.12, "end": 268.88, "text": " because batch norm is trained with a larger batch size but even if group norm" }, { "start": 268.88, "end": 273.72, "text": " were to be trained with the large batch size it would still be in the same place" }, { "start": 273.72, "end": 283.56, "text": " because no it wouldn't it would not. Sorry that is that is not the case" }, { "start": 283.56, "end": 289.76000000000005, "text": " because the batches still influence the gradient stochasticity and so on. But" }, { "start": 289.76000000000005, "end": 293.84000000000003, "text": " still batch norm is better than group norm as you can see here but here over" }, { "start": 293.84000000000003, "end": 299.96000000000004, "text": " here where you kind of have to go to the small batch sizes then batch norm is all" }, { "start": 299.96, "end": 307.28, "text": " of a sudden worse than group norm. And the weight standardization is a technique" }, { "start": 307.28, "end": 313.32, "text": " to actually make group norm better than batch norm in any of these so even in" }, { "start": 313.32, "end": 320.67999999999995, "text": " these in the large batch regime. Okay so we'll now explore weight" }, { "start": 320.67999999999995, "end": 326.62, "text": " standardization. So in the group norm paper we've looked at the diagram on the" }, { "start": 326.62, "end": 331.96, "text": " left. So basically in batch norm here is the number of data points. This is your" }, { "start": 331.96, "end": 339.8, "text": " batch. This is the channels of the batch of the individual images. Channels. And" }, { "start": 339.8, "end": 343.78000000000003, "text": " this is the height and width of the image. So this is the image itself a" }, { "start": 343.78000000000003, "end": 347.32, "text": " single channel. So a single channel in the image would be a column in this" }, { "start": 347.32, "end": 353.72, "text": " thing right here. Batch norm normalizes across the data points in a single" }, { "start": 353.72, "end": 360.76000000000005, "text": " channel. Layer norm which is a precursor to group norm normalizes only in a single" }, { "start": 360.76000000000005, "end": 365.72, "text": " data point instance but across all of the channels as you can see here. Now" }, { "start": 365.72, "end": 370.20000000000005, "text": " that frees its dependence on the batch size. Each data point is treated" }, { "start": 370.20000000000005, "end": 375.32000000000005, "text": " individually but of course it sort of convolves all the channels with each" }, { "start": 375.32000000000005, "end": 381.64000000000004, "text": " other. It doesn't distinguish them. Instance norm tries to fix this. Instance" }, { "start": 381.64, "end": 386.28, "text": " norm down here tries to fix this by saying it was a good idea to" }, { "start": 386.28, "end": 390.36, "text": " normalize each feature individually and takes it to the extreme. Basically" }, { "start": 390.36, "end": 398.56, "text": " normalizes a single image by each of these single features. But that loses" }, { "start": 398.56, "end": 403.76, "text": " too much information. Group norm comes along and says maybe some of the" }, { "start": 403.76, "end": 409.15999999999997, "text": " features naturally depend on each other. Naturally exhibit the same responses." }, { "start": 409.16, "end": 414.72, "text": " Therefore we should normalize them in groups. So we take still a single image" }, { "start": 414.72, "end": 420.04, "text": " but we take groups in this case groups of three channels together and normalize" }, { "start": 420.04, "end": 428.28000000000003, "text": " across that. Now this here is all in data space. This all normalizes the data like" }, { "start": 428.28000000000003, "end": 433.18, "text": " we said up here when we drew this. This is all normalizing the data before" }, { "start": 433.18, "end": 437.90000000000003, "text": " passing it through the next layer. Now what actually happens in these layers? So" }, { "start": 437.9, "end": 444.35999999999996, "text": " what happens here? What happens here in a convolutional neural network is that the" }, { "start": 444.35999999999996, "end": 448.4, "text": " images get convolved with kernels. That's what a neural network" }, { "start": 448.4, "end": 455.4, "text": " layer is. So if you have an image right here of our trusty cat. I've drawn" }, { "start": 455.4, "end": 460.64, "text": " whiskers in a while. That nose is very high. The eyes must be like up here. Sorry" }, { "start": 460.64, "end": 466.44, "text": " cat. And the layer inherently has these things called kernels. Now I'm just" }, { "start": 466.44, "end": 471.16, "text": " going to draw one of these kernels right here. It's a three by three kernel and" }, { "start": 471.16, "end": 476.2, "text": " what you'll do is you'll slide the kernel across this right across like" }, { "start": 476.2, "end": 482.56, "text": " this. You slide it across across across across and for each point you convolve" }, { "start": 482.56, "end": 488.28, "text": " the kernel. So you can involve the values here with the pixels here and sum them" }, { "start": 488.28, "end": 494.28, "text": " up and that for each position in the image means that you'll basically get a" }, { "start": 494.28, "end": 502.88, "text": " new value at each point and that will be your next layer's data point. Now in" }, { "start": 502.88, "end": 508.23999999999995, "text": " these normalization techniques we usually normalize the data points. So" }, { "start": 508.23999999999995, "end": 512, "text": " here you have multiple channels maybe a red a green and a blue and so on and in" }, { "start": 512, "end": 518.12, "text": " the intermediate layers you have even more. But you also have multiple" }, { "start": 518.12, "end": 524.64, "text": " kernels. You can see here you have multiple of these kernels which will then" }, { "start": 524.64, "end": 533.48, "text": " result in multiple output channels. The old normalization methods batch norm," }, { "start": 533.48, "end": 543.12, "text": " layer norm, group norm, they all work in they all work in this or in this space" }, { "start": 543.12, "end": 549.24, "text": " in the space of data. Whereas weight standardization works on the kernel" }, { "start": 549.24, "end": 554.68, "text": " space. So weight standardization means you want to normalize the weights of the" }, { "start": 554.68, "end": 559.96, "text": " neural network not the data. And that's why it can be used in conjunction with" }, { "start": 559.96, "end": 564.24, "text": " something like group norm or actually batch norm or layer norm. It could be used" }, { "start": 564.24, "end": 569.08, "text": " with any of these but these authors use it in conjunction with group norm. So" }, { "start": 569.08, "end": 575.12, "text": " what does it do? If you have these kernels the kernels are characterized" }, { "start": 575.12, "end": 579.4000000000001, "text": " actually a kernel is characterized by four numbers. So first of all it's the" }, { "start": 579.4000000000001, "end": 586.08, "text": " height and width of the kernel which in our case was three by three. It is" }, { "start": 586.08, "end": 591.2800000000001, "text": " characterized by two more numbers which is the CN, the in channels and the out" }, { "start": 591.2800000000001, "end": 597.94, "text": " channels. So the in channels is the number of channels that come into the" }, { "start": 597.94, "end": 601.8800000000001, "text": " layer and the out channels are the number of channels that you want to" }, { "start": 601.8800000000001, "end": 607.96, "text": " transform that into. So here you can see the in channels are listed here and the" }, { "start": 607.96, "end": 612.08, "text": " out channels are listed here and in the up-down direction which is not labeled" }, { "start": 612.08, "end": 617.2800000000001, "text": " here is the height and width. So this here would be actually a two by two" }, { "start": 617.2800000000001, "end": 624, "text": " kernel. So each of these slivers here is a two by two kernel in the" }, { "start": 624, "end": 627.84, "text": " convolutional network and then that would be the orange sliver here and then the" }, { "start": 627.84, "end": 634.52, "text": " sliver behind that would be the next two by two kernel. Weight standardization" }, { "start": 634.52, "end": 644.44, "text": " says, hey it might be as we normalize the data it might be a good idea. Sorry I" }, { "start": 644.44, "end": 651, "text": " was that was wrong. One column here, one of these columns is a two by two filter" }, { "start": 651, "end": 656.56, "text": " and then the column behind it and the column next to it, they're all two by" }, { "start": 656.56, "end": 666.52, "text": " two filters right. So you have two by two filters in the output or and you also" }, { "start": 666.52, "end": 670.28, "text": " have two by two filters for each of the input output channel" }, { "start": 670.28, "end": 674.04, "text": " combination you have a two by two filter. So you have an entire matrix of" }, { "start": 674.04, "end": 679.48, "text": " two by two filters if you can imagine that. So across the out and across the" }, { "start": 679.48, "end": 687.04, "text": " in direction. Weight standardization says, hey it might be a good idea to see that" }, { "start": 687.04, "end": 694.84, "text": " the weights for a given output channel right. This is we take one output channel" }, { "start": 694.84, "end": 700.88, "text": " and we see all the filters that transform the input into that one output" }, { "start": 700.88, "end": 706.6, "text": " channel which is going to be this many times this many times this many numbers" }, { "start": 706.6, "end": 714.0400000000001, "text": " or this many filters. Maybe we should normalize all of these to be sort of to" }, { "start": 714.0400000000001, "end": 718.48, "text": " not get out of whack because one could imagine that during training right if we" }, { "start": 718.48, "end": 724.32, "text": " start we initialize our filters somewhere here you know maybe one number" }, { "start": 724.32, "end": 728.12, "text": " this this one number here we initialize it randomly right we draw it from random" }, { "start": 728.12, "end": 734.1600000000001, "text": " and then maybe as we train it actually gets very large because it's actually" }, { "start": 734.16, "end": 738.64, "text": " plausible because after that we we you know this is our neural network layer" }, { "start": 738.64, "end": 744.56, "text": " after that we have this procedure to recenter the data right. So I could make" }, { "start": 744.56, "end": 750.24, "text": " a very large weight here multiply the data by very large weight because it" }, { "start": 750.24, "end": 756.6, "text": " gets re-centered anyway but of course if my weights get large I'll basically" }, { "start": 756.6, "end": 762.48, "text": " increase the variance and the instability and the gradients might be" }, { "start": 762.48, "end": 768, "text": " high and and so on. So these author think it might be a good idea to normalize" }, { "start": 768, "end": 773.2, "text": " these weights. So just as you normalize the data you normalize the weights and" }, { "start": 773.2, "end": 778.48, "text": " this actually turns out to be fairly easy in the sense of how you would do it." }, { "start": 778.48, "end": 787.4, "text": " So instead of transforming X which is the input to a layer into Y using W so" }, { "start": 787.4, "end": 792.04, "text": " this is W this is your actual parameter using W you won't do this right" }, { "start": 792.04, "end": 799.0799999999999, "text": " now so this this was usually you just do you just do X times W and that gives you" }, { "start": 799.0799999999999, "end": 806.0799999999999, "text": " Y this is a convolution operation right here. Now you don't do this you do you" }, { "start": 806.0799999999999, "end": 813.16, "text": " have take W and first you subtract the mean of W this is now for a single" }, { "start": 813.16, "end": 817.92, "text": " output channel and then you divide by the standard deviation how many of this is" }, { "start": 817.92, "end": 825.0799999999999, "text": " standard deviation of W and that entire thing you now multiply by X. Now since" }, { "start": 825.0799999999999, "end": 831.64, "text": " these things here are sorry about that since these things here are just you" }, { "start": 831.64, "end": 835.4, "text": " know deterministic operation you can actually back propagate through it so" }, { "start": 835.4, "end": 843.92, "text": " the forward path of data now looks as follows you come you start you say okay" }, { "start": 843.92, "end": 852.28, "text": " my data comes in I will take my weights that my layer weights and I will first" }, { "start": 852.28, "end": 858.4799999999999, "text": " center them then scale them with its standard deviation and then I will use" }, { "start": 858.4799999999999, "end": 864.16, "text": " that thing and X in order to obtain my layer output and then I'll send that to" }, { "start": 864.16, "end": 868.68, "text": " the next layer. Now the backprop signal here is interesting because the backprop" }, { "start": 868.68, "end": 874.12, "text": " signal comes in from here and splits up in two ways it splits up into the back" }, { "start": 874.12, "end": 883.16, "text": " prop signal basically you have to back prop through the X times W hat operation" }, { "start": 883.16, "end": 887.88, "text": " we know how to do that that's just a convolutional back prop that you back" }, { "start": 887.88, "end": 895.24, "text": " prop through the convolution operation back to the last layer. Now usually when" }, { "start": 895.24, "end": 899.72, "text": " you back prop through the convolution operation you get two things you get the" }, { "start": 899.72, "end": 904.92, "text": " derivative with respect to X and you get the derivative with respect to the" }, { "start": 904.92, "end": 911.08, "text": " weights W and you can send both on and you would update your weights with that" }, { "start": 911.08, "end": 917.6, "text": " gradient but now what you'll have to do because this is not your actual" }, { "start": 917.6, "end": 925.22, "text": " parameter of the network you have to take that particular signal and you have" }, { "start": 925.22, "end": 930.6, "text": " to basically reverse the standardization and the centering before you can apply" }, { "start": 930.6, "end": 936, "text": " the gradient but that's all doable the actually modern frameworks will do it by" }, { "start": 936, "end": 943.08, "text": " themselves but it's just that the backprop path here it introduces two new" }, { "start": 943.08, "end": 948.36, "text": " operation to the forward and to the backprop path that you didn't have" }, { "start": 948.36, "end": 953.36, "text": " before but I can imagine this will actually not take you won't even notice" }, { "start": 953.36, "end": 961.76, "text": " that this is happening this is so fast so they the idea is basically pretty" }, { "start": 961.76, "end": 966.52, "text": " basic especially since the entire discussion around normalization has" }, { "start": 966.52, "end": 972.88, "text": " already happened I enjoy that this paper does go into the theory a bit more so" }, { "start": 972.88, "end": 979.36, "text": " they analyze what this weight standardization what effect it has on the" }, { "start": 979.36, "end": 985.04, "text": " Lipschitz constant of the loss for example and they also research what what" }, { "start": 985.04, "end": 991.92, "text": " what contributes more the centering of the weights or the standardization so" }, { "start": 991.92, "end": 996.32, "text": " they kind of run all these ablations where they figure out okay if we just do" }, { "start": 996.32, "end": 1001.6800000000001, "text": " group norm we have one we you know we have this trajectory here and if we run" }, { "start": 1001.6800000000001, "end": 1006.04, "text": " group non plus equation five which is subtracting the mean you can see the" }, { "start": 1006.04, "end": 1013.28, "text": " blue and the orange that is quite a bit and if we only do the dividing by the" }, { "start": 1013.28, "end": 1017.8399999999999, "text": " standard deviation you can see it's pretty close together but there is a" }, { "start": 1017.8399999999999, "end": 1022.98, "text": " difference if you do both then again there is a difference to only doing the" }, { "start": 1022.98, "end": 1027.82, "text": " centering so they they say even though you know probably subtracting the mean" }, { "start": 1027.82, "end": 1035, "text": " gives you most of the benefit since it is so easy you should just do both and I" }, { "start": 1035, "end": 1041.48, "text": " honestly think and here in the in the in the validation error that makes" }, { "start": 1041.48, "end": 1047.44, "text": " basically no difference at all and they do quite a number of these ablations" }, { "start": 1047.44, "end": 1054.68, "text": " which I'm not going to go into too much and they do also the so the Lipschitz" }, { "start": 1054.68, "end": 1058.56, "text": " constant of the loss and the Lipschitz constant of the gradients they basically" }, { "start": 1058.56, "end": 1064.84, "text": " show that the loss and the gradients are behaved more more well-behaved when you" }, { "start": 1064.84, "end": 1069.1599999999999, "text": " use this weight standardization technique together with group norm they" }, { "start": 1069.1599999999999, "end": 1075.24, "text": " also do quite a bit of experiments where they show that their method outperforms" }, { "start": 1075.24, "end": 1080.3999999999999, "text": " batch norm and especially in the small batch size regime and that is something" }, { "start": 1080.3999999999999, "end": 1087.4399999999998, "text": " that I absolutely believe what happened here okay I we actually don't even need" }, { "start": 1087.4399999999998, "end": 1093.1999999999998, "text": " to go down there because if you want to read the paper I invite you to read the" }, { "start": 1093.2, "end": 1098.92, "text": " paper it's a very good paper I enjoyed reading it but ultimately they suggest" }, { "start": 1098.92, "end": 1103.68, "text": " this new method and also I have seen this one replicated across the community" }, { "start": 1103.68, "end": 1109.8400000000001, "text": " a number of times so it seems to be a thing that I would expect either it" }, { "start": 1109.8400000000001, "end": 1114.2, "text": " fizzes out and the community decides that it's about the same as batch norm" }, { "start": 1114.2, "end": 1120.64, "text": " and therefore not worth it or and that's what I believe since we also go into the" }, { "start": 1120.64, "end": 1125.64, "text": " direction of larger models which means smaller batches per worker and" }, { "start": 1125.64, "end": 1131.5200000000002, "text": " generally batch norm is a pain I believe this is just going to be rather" }, { "start": 1131.5200000000002, "end": 1137.68, "text": " standard in the future so I'll actually incorporate this if I can into my next" }, { "start": 1137.68, "end": 1144, "text": " projects so that was it for me if you like this consider subscribing consider" }, { "start": 1144, "end": 1149, "text": " leaving a like on the video thank you for listening if you have any comments I" }, { "start": 1149, "end": 1155.76, "text": " will very probably read them bye bye" } ]
zt_R85Ife_U
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Trash] Automated Inference on Criminality using Face Images
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "trash", "wrong", "phrenology", "physiognomy", "face", "facial", "criminal", "violent", "features", "body", "physical", "visible", "intuition", "smile", "micro", "expression" ]
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 an 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 Xiaolin Wu and Xi Cheng. 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 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 judgments of human observers. So they say we train a bunch of models, including, as you can see, a CNN, using facial images of one thousand eight hundred and fifty six 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 managed 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 two 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. Oh, I'm going to be canceled. I don't advocate 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 in facial appearance than non-criminals. So basically what they're saying is that the this kind of similarity among the non-criminals in their data set is larger than the similarity among the criminals. OK, so already the outset, right? Then they go into this introduction and in the introduction we won't go through it fully, but they basically introduce 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, OK, can facial features also be used not just for predicting the appearance, but to predict the actual personality trait? 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 pushed 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, OK, 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, like you steal the medicine from the old lady in your house and 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. 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 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 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 stopped 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 very quickly switch 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 no. It's like the Pekuk looks like, oh, no, we, you know, we have many social gatherings and our gut feeling is that people aren't really different. And the robes are actually personal protective equipment. It's all actually just a community thing. We all have, you know, good intentions. Oh, and every now and then we lynch you guys going into this with sort of a mixed bag of feelings where you'd 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 our experiments, they have one thousand eight hundred and fifty six ID photos. The following 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, S.N. for non criminals and S.C. for criminals. The non criminals contains ID photos of alone hundred twenty six non criminals that were acquired from the Internet using the web spider tool. They're from a wide gamut of professions and social status, including waiters, construction work, blah, blah, blah. OK. The subset of the criminals contains ID photos of seven hundred and thirty criminals of which three hundred and thirty 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, Liaoning, et cetera. The others are provided by city police department in China under a confidentiality agreement. We stress and here here's an important point. We stress that the criminal face images in S.C. are normal ID photos, not police mugshots. So they say they have violent crimes or nonviolent crimes. And so on. So they have 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 they mask away the colors. So they only extract the face part and the upper neck part. So these this white collar 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 will going to make up the criminals and this will make up the non criminals. And the herein lies the problem, right? You even though the white collars 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 they do data preparation as again, they mask, they resize and so on. They stress again, all our idea images with frontal lighting. So, yeah. And they OK, so now they test the classifiers. So they say we test logistic regression, logistic regression, KNN, 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 feature vector generated by a modular PCA. And the third is a facial feature vector based on local binary pattern histograms. So these are these are sort of face features that people use for recognizing faces. They concatenate them. That gives you a feature vector. You feed that 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 do you partition your data into 10 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. But 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 percent accuracy, as you can see here. And even their SVM and the other classifiers, they perform fairly well in recognizing these criminality faces. So. And they analyze 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 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 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, OK, 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 of a non-criminal, someone that was arrested, but then not convicted. And I can 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. 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 devil's 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 negative and positive instances with equal probability and redo all the above experiments of binary classification. Well, how crazy is this? All right, they're 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 criticism 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 a bug in 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, they say, in fact, we go much further along the self-critical path. All right, here it comes. And carry out 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 ID photos of Chinese female young middle-aged, or standard ID photos of Caucasian male young middle-aged, of Caucasian female young middle-aged nofacial. So basically, if you train on a randomly labeled data set on any sort of pictures, your classifier will not work. Thanks. 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... OK, the above experiments rule out that the good accuracies of the four evaluated classifiers in phase 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 no one criticizes that you over. 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 phase 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. OK, as different source cameras generated the ID photos in the set S, now they might be on the right track here. Different source cameras. Maybe they 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. OK, so they basically saying different cameras could generate different sort of artifacts. And 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. Gee, they were so close. They were so close to actually doing something useful. OK, 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 evidences for the validity of automated phase induced inference on criminality, one cannot resist the following intriguing questions. What features of a human face betray its owners propensity for crimes? OK, Shakespeare. And they basically they basically go and explain ability route 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. No surprise 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 abiding 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. Hmm. 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. Oh, yes. Ah, 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, oh, these are intrinsic facial features. But come on. All right. So they go on to say that they have some histogram differences of these features. So 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 are the actual average eigen faces. And the bottom is when you kind of shift the facial landmarks around. The seeming paradox that SC and SN can be classified, but the average faces appear almost the same can. Sorry, 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 difference at all. I don't see a difference. What could possibly be the difference? What could be the difference? I don't think 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 isomap here. So isomap uses the geodesic distance between two points on the manifold, which is defined between the sum of the weights. So they kind of washy washy isomap. But they then explain k-means in great detail with formulas. And again, I mean, OK, 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, why three and four? And usually, you 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, why three? 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. That makes no sense at all. Like, why? And they say, OK, these are the clusters right here. And these are the pictures I showed you at the beginning. What surprise? The bottom ones, the non-criminals, are smiling and the top ones aren't. Gee, I wonder why the method works. And the interesting part here is that how can we justify? 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, 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 paper is 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 same. Doesn't, no, no, 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 cue 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 driver 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, et cetera, for their website. You know what it always says when you take your picture for a government ID? Please don't smile. Imagine if your law firm comes to you and 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. Thank you.
[ { "start": 0, "end": 10.32, "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.32, "end": 12.32, "text": " I'll give you a second." }, { "start": 13.72, "end": 20.52, "text": " Okay, got it. So if you decided that these four here are the criminals, you would be correct." }, { "start": 20.52, "end": 23.92, "text": " And that makes these three the law-abiding citizens." }, { "start": 23.92, "end": 28.76, "text": " As for this one, maybe if the crime is being too cool." }, { "start": 28.76, "end": 31.720000000000002, "text": " Of course, none of these faces actually exist in real life." }, { "start": 31.720000000000002, "end": 38.6, "text": " These are compositions of eigenfaces, of datasets, of criminals and non-criminals." }, { "start": 38.6, "end": 45.8, "text": " Today's paper is an absolute controversy. This is going to get me into so much trouble." }, { "start": 45.8, "end": 51, "text": " So if you see something like this in the news, always, always, always go and check." }, { "start": 51, "end": 59.96, "text": " Now we're going to look at automated inference on criminality using face images by Xiaolin Wu and Xi Cheng." }, { "start": 59.96, "end": 66.84, "text": " On a high level, they're trying to separate criminals from non-criminals using face images." }, { "start": 66.84, "end": 71.6, "text": " So basically using classifiers on ID photos." }, { "start": 71.6, "end": 75.44, "text": " This, of course, has generated quite the uproar." }, { "start": 75.44, "end": 80.32, "text": " I suggest we just dive into the paper and look at what's happening right here." }, { "start": 80.32, "end": 88.24, "text": " We study for the first time automated inference on criminality based solely on still face images," }, { "start": 88.24, "end": 95.55999999999999, "text": " which is free of any biases and subjective judgments of human observers." }, { "start": 95.55999999999999, "end": 100.16, "text": " So they say we train a bunch of models, including, as you can see, a CNN," }, { "start": 100.16, "end": 109.32, "text": " using facial images of one thousand eight hundred and fifty six real persons controlled for race, gender, age and facial expressions." }, { "start": 109.32, "end": 117.96, "text": " Nearly half of whom were convicted criminals for discriminating between criminals and non-criminals." }, { "start": 117.96, "end": 122.32, "text": " So this is the outset. This is the kind of research question here." }, { "start": 122.32, "end": 128.12, "text": " Now, immediately you have people jumping up saying that's not possible." }, { "start": 128.12, "end": 130.32, "text": " And I would agree." }, { "start": 130.32, "end": 137.24, "text": " But I think actually there are very, very interesting lessons to be learned from this paper." }, { "start": 137.24, "end": 143.52, "text": " So they're saying they actually managed to do this with their classifiers, actually with all of these classifiers." }, { "start": 143.52, "end": 145.68, "text": " Of course, deep learning being the best." }, { "start": 145.68, "end": 152.68, "text": " Also, some discriminating structural features for predicting criminality have been found by machine learning." }, { "start": 152.68, "end": 154.96, "text": " So they even tell you why." }, { "start": 154.96, "end": 165.20000000000002, "text": " Above all, the most important discovery of this research is that criminal and non-criminal face images populate two quite distinctive manifolds." }, { "start": 165.2, "end": 172.32, "text": " The variation among criminal faces is significantly greater than that of non-criminal faces." }, { "start": 172.32, "end": 181.76, "text": " The two manifolds consisting of criminal and non-criminal faces appear to be concentric with the non-criminal manifold lying in the kernel" }, { "start": 181.76, "end": 190.95999999999998, "text": " with the smaller span exhibiting a law of normality for faces of non-criminals." }, { "start": 190.95999999999998, "end": 194.79999999999998, "text": " Oh, I'm going to be canceled." }, { "start": 194.8, "end": 196.48000000000002, "text": " I don't advocate for this." }, { "start": 196.48000000000002, "end": 200.56, "text": " This is not, this is not, I'm not a fan of this." }, { "start": 200.56, "end": 211.96, "text": " Just in other words, the faces of general law abiding public have a greater degree of resemblance compared with the faces of criminals." }, { "start": 211.96, "end": 217.56, "text": " Or criminals have a higher degree of dissimilarity in facial appearance than non-criminals." }, { "start": 217.56, "end": 228.08, "text": " So basically what they're saying is that the this kind of similarity among the non-criminals in their data set is larger than the similarity among the criminals." }, { "start": 228.08, "end": 231.76, "text": " OK, so already the outset, right?" }, { "start": 231.76, "end": 241.4, "text": " Then they go into this introduction and in the introduction we won't go through it fully, but they basically introduce the concept of facial recognition." }, { "start": 241.4, "end": 246.36, "text": " They try to build up kind of an argument where they say faces are different." }, { "start": 246.36, "end": 254.96, "text": " Some people have hypothesized that it's possible to infer personality traits from facial features." }, { "start": 254.96, "end": 261.52000000000004, "text": " Some studies exist that show that people agree on the perception of these traits." }, { "start": 261.52000000000004, "end": 269.44, "text": " So not the actual traits, but people will kind of agree that a face looks extroverted or more agreeable." }, { "start": 269.44, "end": 273, "text": " People tend to agree that the appearance exists." }, { "start": 273, "end": 286.08, "text": " And then they sort of make the next step and say, OK, can facial features also be used not just for predicting the appearance, but to predict the actual personality trait?" }, { "start": 286.08, "end": 297.16, "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.16, "end": 306.52000000000004, "text": " it would be hard pushed to find a more convincing experiment than examining the success rate of discriminating between criminals and non-criminals." }, { "start": 306.52000000000004, "end": 310.24, "text": " So actually, you could agree with this, right?" }, { "start": 310.24, "end": 319.8, "text": " 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": 319.8, "end": 322.48, "text": " There are like many, many hurdles in this." }, { "start": 322.48, "end": 325.88, "text": " In essence, the statement sort of makes sense." }, { "start": 325.88, "end": 335.88, "text": " 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": 335.88, "end": 344.44, "text": " People immediately jump to the conclusion that, OK, if such a thing were found, that means you could somehow precognate criminality," }, { "start": 344.44, "end": 354.56, "text": " 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.56, "end": 365.16, "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.16, "end": 371.08, "text": " One interpretation of me is that, let's say you break the law for whatever, it could be completely moral," }, { "start": 371.08, "end": 378.28, "text": " like you steal the medicine from the old lady in your house and but you know you broke the law," }, { "start": 378.28, "end": 383.64, "text": " you know you did something that society doesn't want you to do and that will exert stress on you." }, { "start": 383.64, "end": 386.32, "text": " You now have to lie to people about this." }, { "start": 386.32, "end": 389.15999999999997, "text": " You now have to sort of make sure you're not caught." }, { "start": 389.15999999999997, "end": 392.76, "text": " You have to worry. Maybe there's a security tape or something like this." }, { "start": 392.76, "end": 398.64, "text": " And the stress will, we know that stress will physically change you." }, { "start": 398.64, "end": 402.47999999999996, "text": " And that could be in turn made out by your features." }, { "start": 402.47999999999996, "end": 407.15999999999997, "text": " For example, the stress of being in jail could change your physical features." }, { "start": 407.15999999999997, "end": 413.36, "text": " And since these are all convicted criminals, one might think that it might be possible." }, { "start": 413.36, "end": 418.36, "text": " It might. Again, not saying it is, it might." }, { "start": 418.36, "end": 428.28000000000003, "text": " So if we throw away all of the kind of prejudgments on this, it could be an interesting research question, right?" }, { "start": 428.28000000000003, "end": 432.8, "text": " Could. Now, whether we want to pursue it or not, that's a different question." }, { "start": 432.8, "end": 437.6, "text": " But the way they build this up here is that they only have the best of intentions in mind." }, { "start": 437.6, "end": 440.44, "text": " I feel like this might not be the case." }, { "start": 440.44, "end": 442.92, "text": " So they say something like this right here." }, { "start": 442.92, "end": 454.24, "text": " 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," }, { "start": 454.24, "end": 458.08000000000004, "text": " although the outcomes turn out otherwise." }, { "start": 458.08000000000004, "end": 463.44, "text": " This and this is the part where I just stopped believing them that their intentions were like all good." }, { "start": 463.44, "end": 471.36, "text": " And it's just about disproving this so we can just lay it to rest because they then very quickly switch when they find something else." }, { "start": 471.36, "end": 480.48, "text": " Non criminals are the normals and the criminals are like the that just rubs me the wrong way where you'll have to say no." }, { "start": 480.48, "end": 488.6, "text": " It's like the Pekuk looks like, oh, no, we, you know, we have many social gatherings and our gut feeling is that people aren't really different." }, { "start": 488.6, "end": 492.04, "text": " And the robes are actually personal protective equipment." }, { "start": 492.04, "end": 494.52000000000004, "text": " It's all actually just a community thing." }, { "start": 494.52000000000004, "end": 497.6, "text": " We all have, you know, good intentions." }, { "start": 497.6, "end": 507.64000000000004, "text": " Oh, and every now and then we lynch you guys going into this with sort of a mixed bag of feelings where you'd have a hypothetically valid research question." }, { "start": 507.64000000000004, "end": 517.5600000000001, "text": " 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." }, { "start": 517.5600000000001, "end": 519.12, "text": " Not going to fall for it. Sorry." }, { "start": 519.12, "end": 524.8000000000001, "text": " They say in order to conduct our experiments, they have one thousand eight hundred and fifty six ID photos." }, { "start": 524.8, "end": 532.3199999999999, "text": " The following criteria, Chinese male between ages of 18 and 55, no facial hair, no facial scars or other markings." }, { "start": 532.3199999999999, "end": 534.52, "text": " And the data set is called S." }, { "start": 534.52, "end": 541.28, "text": " Then there's two subsets, S.N. for non criminals and S.C. for criminals." }, { "start": 541.28, "end": 552.1999999999999, "text": " The non criminals contains ID photos of alone hundred twenty six non criminals that were acquired from the Internet using the web spider tool." }, { "start": 552.2, "end": 557.5200000000001, "text": " They're from a wide gamut of professions and social status, including waiters, construction work, blah, blah, blah." }, { "start": 557.5200000000001, "end": 571.24, "text": " OK. The subset of the criminals contains ID photos of seven hundred and thirty criminals of which three hundred and thirty as are published as wanted suspects by the Ministry of Public Security of China" }, { "start": 571.24, "end": 580.32, "text": " and by the Departments of Public Security for the provinces of Guangdong, Jiangsu, Liaoning, et cetera." }, { "start": 580.32, "end": 586.48, "text": " The others are provided by city police department in China under a confidentiality agreement." }, { "start": 586.48, "end": 589.6800000000001, "text": " We stress and here here's an important point." }, { "start": 589.6800000000001, "end": 599.88, "text": " We stress that the criminal face images in S.C. are normal ID photos, not police mugshots." }, { "start": 599.88, "end": 608.2, "text": " So they say they have violent crimes or nonviolent crimes." }, { "start": 608.2, "end": 612.9200000000001, "text": " And so on. So they have these examples here of those images." }, { "start": 612.9200000000001, "end": 620.44, "text": " So the top ones are the criminals and the bottom ones are the non criminals." }, { "start": 620.44, "end": 625.24, "text": " Now, people immediately see differences here." }, { "start": 625.24, "end": 635.4000000000001, "text": " 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.4, "end": 638.3199999999999, "text": " Now, you're on the right path. You're not actually correct." }, { "start": 638.3199999999999, "end": 646, "text": " Correct. But you're on the right path here because actually what they do is they they mask away the colors." }, { "start": 646, "end": 651.64, "text": " So they only extract the face part and the upper neck part." }, { "start": 651.64, "end": 660.68, "text": " So these this white collar part will actually not be on the image that they analyze to control for clothing, which is good." }, { "start": 660.68, "end": 672.16, "text": " But it gives you sort of an indication that the origins of the two image groups might not actually be the same." }, { "start": 672.16, "end": 687.12, "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." }, { "start": 687.12, "end": 693.24, "text": " Let's call them W. These are released by the police for wanted criminals." }, { "start": 693.24, "end": 698.4, "text": " Then the others database is the convicted criminals." }, { "start": 698.4, "end": 709.76, "text": " 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.76, "end": 711.84, "text": " So you have three different databases." }, { "start": 711.84, "end": 718.88, "text": " And of course, these two make will going to make up the criminals and this will make up the non criminals." }, { "start": 718.88, "end": 724.12, "text": " And the herein lies the problem, right?" }, { "start": 724.12, "end": 735.12, "text": " You even though the white collars are masked out, you have to make sure that whatever you find isn't just a property of how you collected the data." }, { "start": 735.12, "end": 739.5600000000001, "text": " And this doesn't really come through in this paper." }, { "start": 739.56, "end": 745.52, "text": " So they they do data preparation as again, they mask, they resize and so on." }, { "start": 745.52, "end": 749.56, "text": " They stress again, all our idea images with frontal lighting." }, { "start": 749.56, "end": 756.9599999999999, "text": " So, yeah. And they OK, so now they test the classifiers." }, { "start": 756.9599999999999, "end": 768.1199999999999, "text": " So they say we test logistic regression, logistic regression, KNN, SVM and CNN on the image data set." }, { "start": 768.12, "end": 772.64, "text": " So for the CNN, you can just input the original image." }, { "start": 772.64, "end": 775.96, "text": " But for the other classifiers, you need a set of features." }, { "start": 775.96, "end": 781.28, "text": " And what they do is they concatenate three different image feature vectors." }, { "start": 781.28, "end": 787.72, "text": " So the first one is facial landmark points that you extract by some sort of tool." }, { "start": 787.72, "end": 792.36, "text": " You can extract whatever corners of mouth and so on." }, { "start": 792.36, "end": 805.44, "text": " Then the second facial feature vector generated by a modular PCA. And the third is a facial feature vector based on local binary pattern histograms." }, { "start": 805.44, "end": 811.24, "text": " So these are these are sort of face features that people use for recognizing faces." }, { "start": 811.24, "end": 815.8000000000001, "text": " They concatenate them. That gives you a feature vector. You feed that into the machine learning algorithm." }, { "start": 815.8, "end": 826.7199999999999, "text": " 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." }, { "start": 826.7199999999999, "end": 834.76, "text": " So they do a tenfold cross validation, right, which basically means you do you partition your data into 10 parts." }, { "start": 834.76, "end": 837.4799999999999, "text": " You take nine to train, predict the one." }, { "start": 837.4799999999999, "end": 841.4799999999999, "text": " Then you take the next nine to train, predict the one that you left out and so on." }, { "start": 841.48, "end": 851.64, "text": " But 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." }, { "start": 851.64, "end": 861.04, "text": " And they discover here that their CNN classifier performs at almost 90 percent accuracy, as you can see here." }, { "start": 861.04, "end": 873.76, "text": " And even their SVM and the other classifiers, they perform fairly well in recognizing these criminality faces." }, { "start": 873.76, "end": 879.56, "text": " So. And they analyze the ROC curves and the ROC curves." }, { "start": 879.56, "end": 882.8, "text": " This is a really this is a classifier that works right." }, { "start": 882.8, "end": 892.16, "text": " So you can see in the the the other models, but especially the CNN classifier here, works really well." }, { "start": 892.16, "end": 898.04, "text": " Of course, the question is, what does it work for?" }, { "start": 898.04, "end": 903.92, "text": " So they basically say, all right, we now have a classifier that distinguishes criminals from non-criminals." }, { "start": 903.92, "end": 912.52, "text": " And I would say you have a classifier that discriminates your particular pictures of criminals from your particular pictures of non-criminals." }, { "start": 912.52, "end": 924.1999999999999, "text": " And if this were submitted to me as a reviewer, I would expect that any sane author would then go and try to invalidate that." }, { "start": 924.1999999999999, "end": 930.56, "text": " 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." }, { "start": 930.56, "end": 939.4, "text": " You need to go and you need to basically say, OK, I have these different methods of collecting data right here." }, { "start": 939.4, "end": 947.68, "text": " Now, maybe I can go to the police and ask them for a picture from the same database of a non convicted," }, { "start": 947.68, "end": 952.52, "text": " not of a non-criminal, someone that was arrested, but then not convicted." }, { "start": 952.52, "end": 958.1999999999999, "text": " And I can have someone from from here." }, { "start": 958.1999999999999, "end": 965.1999999999999, "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." }, { "start": 965.2, "end": 970.2, "text": " And if it predicts it's a criminal, it's due to the data set." }, { "start": 970.2, "end": 978.5600000000001, "text": " You can also find one of the criminals, but find their picture on the Internet, like you collected the non-criminals." }, { "start": 978.5600000000001, "end": 983.0400000000001, "text": " And that will give you someone from this database in that data set." }, { "start": 983.0400000000001, "end": 988.1600000000001, "text": " And then you have to show me that your classifier correctly predicts that's a criminal." }, { "start": 988.16, "end": 998.56, "text": " You can further convince me that your classifier is neutral to this separation right here of the wanted and convicted criminals," }, { "start": 998.56, "end": 1001.36, "text": " because they all should be criminals." }, { "start": 1001.36, "end": 1007.8399999999999, "text": " So if your classifier is neutral to that, then it basically doesn't care where it comes from." }, { "start": 1007.8399999999999, "end": 1013.6, "text": " So this will be a weaker argument, but still one that one could investigate." }, { "start": 1013.6, "end": 1017.16, "text": " What do they do for validating their method?" }, { "start": 1017.16, "end": 1020.28, "text": " Here is where it gets funky." }, { "start": 1020.28, "end": 1028.48, "text": " So they say, given the high social sensitivities and repercussions of our topic and skeptics on physiognomy," }, { "start": 1028.48, "end": 1034.8, "text": " we try to exercise maximum caution before publishing our results." }, { "start": 1034.8, "end": 1036.56, "text": " Yeah, you failed." }, { "start": 1036.56, "end": 1047, "text": " In playing devil's advocate, we design and conduct the following experiments to challenge the validity of the tested classifiers." }, { "start": 1047, "end": 1050.6, "text": " For the task of discriminating between criminals and non-criminals." }, { "start": 1050.6, "end": 1052.52, "text": " All right, this is it right here." }, { "start": 1052.52, "end": 1059.04, "text": " Here is where you give us where you tell us it's not because of how we collected the data." }, { "start": 1059.04, "end": 1062.96, "text": " Which is the obvious explanation." }, { "start": 1062.96, "end": 1070.8, "text": " We randomly label the faces in the very sample set as negative and positive instances with equal probability" }, { "start": 1070.8, "end": 1080, "text": " and redo all the above experiments of binary classification." }, { "start": 1080, "end": 1081.84, "text": " Well, how crazy is this?" }, { "start": 1081.84, "end": 1088.68, "text": " All right, they're basically saying, well, if our classifier were not a criminality classifier," }, { "start": 1088.68, "end": 1093.1599999999999, "text": " that means we could invalidate it by shuffling the labels." }, { "start": 1093.16, "end": 1104.8000000000002, "text": " And if that comes out to 50-50, then our classifier obviously works because it's not 50-50 in this data set." }, { "start": 1104.8000000000002, "end": 1112.44, "text": " So basically, they're just validating that a classification algorithm can classify something." }, { "start": 1112.44, "end": 1118.6000000000001, "text": " The criticism here is never that they haven't actually trained a working classifier." }, { "start": 1118.6000000000001, "end": 1122.76, "text": " The criticism is what have they trained a classifier for?" }, { "start": 1122.76, "end": 1132.12, "text": " But their entire validation procedure is basically, we don't have a bug in our code." }, { "start": 1132.12, "end": 1141.16, "text": " The outcomes show that the randomly generated negative and positive instances cannot be distinguished at all." }, { "start": 1141.16, "end": 1143.4, "text": " Gee, who guessed?" }, { "start": 1143.4, "end": 1147, "text": " A classifier on random labels doesn't generalize." }, { "start": 1147, "end": 1155.88, "text": " Man, they say, in fact, we go much further along the self-critical path." }, { "start": 1155.88, "end": 1158.56, "text": " All right, here it comes." }, { "start": 1158.56, "end": 1173.08, "text": " And carry out the same experiments for random labeling on different samples of the same size and with the same variable control." }, { "start": 1173.08, "end": 1179.32, "text": " Only this time in the selection criteria are standard ID photos of Chinese female young middle-aged," }, { "start": 1179.32, "end": 1186.3999999999999, "text": " or standard ID photos of Caucasian male young middle-aged, of Caucasian female young middle-aged nofacial." }, { "start": 1186.3999999999999, "end": 1198, "text": " So basically, if you train on a randomly labeled data set on any sort of pictures, your classifier will not work." }, { "start": 1198, "end": 1200.12, "text": " Thanks. Thanks." }, { "start": 1200.12, "end": 1206.52, "text": " Maybe that's, I think that's the academically most valid statement in the entire paper." }, { "start": 1206.52, "end": 1217.36, "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.36, "end": 1222.32, "text": " So the classifier must be valid because..." }, { "start": 1222.32, "end": 1233.4399999999998, "text": " OK, the above experiments rule out that the good accuracies of the four evaluated classifiers in phase inference on criminality are due to data overfitting." }, { "start": 1233.4399999999998, "end": 1236.12, "text": " No." }, { "start": 1236.12, "end": 1246.9199999999998, "text": " 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": 1246.9199999999998, "end": 1249.2, "text": " But they did cross validation." }, { "start": 1249.2, "end": 1254.76, "text": " They did. The cross validation prevents the overfitting." }, { "start": 1254.76, "end": 1257.32, "text": " We no one criticizes that you over." }, { "start": 1257.32, "end": 1260.72, "text": " These people have no idea what they're doing." }, { "start": 1260.72, "end": 1263.0800000000002, "text": " They have no clue of machine learning." }, { "start": 1263.0800000000002, "end": 1267.3600000000001, "text": " They don't know what the problems with methods are." }, { "start": 1267.3600000000001, "end": 1277.8400000000001, "text": " They don't know what overfitting is and and how you control for it." }, { "start": 1277.84, "end": 1287.12, "text": " The big jump of the true positive rate from random labeling to truth labeling on the same set of phase images can only be explained by intrinsic separability of SC and SN." }, { "start": 1287.12, "end": 1289.24, "text": " That is true. That is true." }, { "start": 1289.24, "end": 1292.1599999999999, "text": " But why are they separable?" }, { "start": 1292.1599999999999, "end": 1293.6799999999998, "text": " That's the question." }, { "start": 1293.6799999999998, "end": 1300.9199999999998, "text": " OK, as different source cameras generated the ID photos in the set S, now they might be on the right track here." }, { "start": 1300.9199999999998, "end": 1303.3999999999999, "text": " Different source cameras." }, { "start": 1303.4, "end": 1311, "text": " Maybe they get the idea that different data sources lead to different things." }, { "start": 1311, "end": 1320.44, "text": " They might leave their signatures that, although below perception threshold in signal strength, could mislead machine learning." }, { "start": 1320.44, "end": 1326.72, "text": " OK, so they basically saying different cameras could generate different sort of artifacts." }, { "start": 1326.72, "end": 1338.6000000000001, "text": " And 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": 1338.6000000000001, "end": 1341.76, "text": " Gee, they were so close." }, { "start": 1341.76, "end": 1346.64, "text": " They were so close to actually doing something useful." }, { "start": 1346.64, "end": 1349.72, "text": " OK, this section is where it gets even more interesting." }, { "start": 1349.72, "end": 1358.44, "text": " Now they're trying to guess from their classifier what are the actual features that make criminals criminals." }, { "start": 1358.44, "end": 1361.8, "text": " So discriminating features right here." }, { "start": 1361.8, "end": 1369.1200000000001, "text": " Having obtained the above strong empirical evidences for the validity of automated phase induced inference on criminality," }, { "start": 1369.1200000000001, "end": 1373.04, "text": " one cannot resist the following intriguing questions." }, { "start": 1373.04, "end": 1383.8, "text": " What features of a human face betray its owners propensity for crimes?" }, { "start": 1383.8, "end": 1385.36, "text": " OK, Shakespeare." }, { "start": 1385.36, "end": 1392.56, "text": " And they basically they basically go and explain ability route where they see what the classifier pays attention to." }, { "start": 1392.56, "end": 1397.6, "text": " And it turns out the classifier pays attention to the following features on the left." }, { "start": 1397.6, "end": 1400.6399999999999, "text": " You can see where the classifier pays attention to." }, { "start": 1400.64, "end": 1409.68, "text": " No surprise here, it pays attention to face features, but they kind of parse out the following three features." }, { "start": 1409.68, "end": 1422, "text": " First of all, the D, the distance between the eyes in criminals tends to be smaller than in non criminals." }, { "start": 1422, "end": 1432.64, "text": " The angle between the nose and the corners of the mouth tends to be smaller in criminals than in non criminals." }, { "start": 1432.64, "end": 1440.04, "text": " And the curvature of the upper lip tends to be higher in criminals than in non criminals." }, { "start": 1440.04, "end": 1447.16, "text": " So let's let's try just from this information to draw the ultimate criminal and non criminal faces." }, { "start": 1447.16, "end": 1455.44, "text": " So first of all, the non criminal, let's draw the non criminal as just regular." }, { "start": 1455.44, "end": 1456.88, "text": " I'm not very good at this." }, { "start": 1456.88, "end": 1459.1200000000001, "text": " So here's the nose." }, { "start": 1459.1200000000001, "end": 1464, "text": " And then let's just draw the lips like this." }, { "start": 1464, "end": 1464.88, "text": " Non criminal." }, { "start": 1464.88, "end": 1465.68, "text": " Perfect." }, { "start": 1465.68, "end": 1468.5600000000002, "text": " Looks like a law abiding citizen to me." }, { "start": 1468.5600000000002, "end": 1471.0800000000002, "text": " Criminal." }, { "start": 1471.0800000000002, "end": 1472.44, "text": " Right here." }, { "start": 1472.44, "end": 1477.44, "text": " So the eyes are closer together." }, { "start": 1477.44, "end": 1480.24, "text": " Here's the nose." }, { "start": 1480.24, "end": 1483.52, "text": " And then the curvature of the upper lip is higher." }, { "start": 1483.52, "end": 1486.3600000000001, "text": " So." }, { "start": 1486.3600000000001, "end": 1488.16, "text": " Hmm." }, { "start": 1488.16, "end": 1496.16, "text": " And then the angle between the nose and the outer corners of the mouth is smaller." }, { "start": 1496.16, "end": 1498.88, "text": " How can I make the angle smaller?" }, { "start": 1498.88, "end": 1503.7600000000002, "text": " Could it be that if I." }, { "start": 1503.7600000000002, "end": 1505.8000000000002, "text": " Oh, yes." }, { "start": 1505.8000000000002, "end": 1511.48, "text": " Ah, that's the trick." }, { "start": 1511.48, "end": 1514.48, "text": " Criminal, ladies and gentlemen." }, { "start": 1514.48, "end": 1523.8000000000002, "text": " So are you telling me that all someone has to do to be a criminal is frown?" }, { "start": 1523.8000000000002, "end": 1528.68, "text": " Yeah, totally valid." }, { "start": 1528.68, "end": 1532.72, "text": " So they're so close, right?" }, { "start": 1532.72, "end": 1535.44, "text": " But they say, oh, these are intrinsic facial features." }, { "start": 1535.44, "end": 1537.5600000000002, "text": " But come on." }, { "start": 1537.5600000000002, "end": 1538.0800000000002, "text": " All right." }, { "start": 1538.0800000000002, "end": 1544.68, "text": " So they go on to say that they have some histogram differences of these features." }, { "start": 1544.68, "end": 1548.28, "text": " So they basically say these features are what's responsible for this." }, { "start": 1548.28, "end": 1551.96, "text": " And then they do face clustering, which is beautiful." }, { "start": 1551.96, "end": 1555.92, "text": " So first of all, what they do is they sort of take the average faces" }, { "start": 1555.92, "end": 1558.92, "text": " for criminals and non-criminals." }, { "start": 1558.92, "end": 1560.52, "text": " And these are the average faces." }, { "start": 1560.52, "end": 1562.88, "text": " So the top are the actual average eigen faces." }, { "start": 1562.88, "end": 1567.2, "text": " And the bottom is when you kind of shift the facial landmarks around." }, { "start": 1567.2, "end": 1573.52, "text": " The seeming paradox that SC and SN can be classified," }, { "start": 1573.52, "end": 1578.3600000000001, "text": " but the average faces appear almost the same can." }, { "start": 1578.3600000000001, "end": 1582.1200000000001, "text": " Sorry, average faces appear almost the same." }, { "start": 1582.1200000000001, "end": 1585.3600000000001, "text": " The average faces appear almost the same." }, { "start": 1585.36, "end": 1586.4799999999998, "text": " What a paradox." }, { "start": 1586.4799999999998, "end": 1588.12, "text": " These are almost the same." }, { "start": 1588.12, "end": 1594.8, "text": " I mean, if I just overlay them one over another, they're almost the same." }, { "start": 1594.8, "end": 1597.8, "text": " There is no difference at all." }, { "start": 1597.8, "end": 1599.9599999999998, "text": " I don't see a difference." }, { "start": 1599.9599999999998, "end": 1604.08, "text": " What could possibly be the difference?" }, { "start": 1604.08, "end": 1605.7199999999998, "text": " What could be the difference?" }, { "start": 1605.7199999999998, "end": 1609.32, "text": " I don't think these are the most honest of intentions." }, { "start": 1609.32, "end": 1614.6399999999999, "text": " So they basically do some clustering, which I find interesting." }, { "start": 1614.64, "end": 1618.48, "text": " I find interesting, for example, that they don't really explain isomap here." }, { "start": 1618.48, "end": 1623.1200000000001, "text": " So isomap uses the geodesic distance between two points on the manifold," }, { "start": 1623.1200000000001, "end": 1626.1200000000001, "text": " which is defined between the sum of the weights." }, { "start": 1626.1200000000001, "end": 1629.0400000000002, "text": " So they kind of washy washy isomap." }, { "start": 1629.0400000000002, "end": 1635.4, "text": " But they then explain k-means in great detail with formulas." }, { "start": 1635.4, "end": 1641.88, "text": " And again, I mean, OK, non-machine learning people" }, { "start": 1641.88, "end": 1642.8000000000002, "text": " can do machine learning." }, { "start": 1642.8000000000002, "end": 1643.4, "text": " That's fine." }, { "start": 1643.4, "end": 1647.68, "text": " But they're not really into the matter here." }, { "start": 1647.68, "end": 1650, "text": " And they try k-means clustering." }, { "start": 1650, "end": 1656.52, "text": " And they find, in their opinion, they find four clusters of criminals" }, { "start": 1656.52, "end": 1658.96, "text": " and three clusters of non-criminals." }, { "start": 1658.96, "end": 1661.8000000000002, "text": " Now, why three and four?" }, { "start": 1661.8000000000002, "end": 1664.16, "text": " And usually, you can do something like this by clustering" }, { "start": 1664.16, "end": 1667.0800000000002, "text": " and then measuring the residual variance in your data." }, { "start": 1667.0800000000002, "end": 1670.76, "text": " So how much does one cluster explain, two clusters, and so on?" }, { "start": 1670.76, "end": 1675, "text": " So here you can see the curves for non-criminals and criminals." }, { "start": 1675, "end": 1679.24, "text": " Now, they claim that the optimal number of clusters here for non-criminals" }, { "start": 1679.24, "end": 1683.04, "text": " is three, which makes no sense to me." }, { "start": 1683.04, "end": 1683.8799999999999, "text": " Like, why three?" }, { "start": 1683.8799999999999, "end": 1687.64, "text": " What you usually want to find is kind of a kink in your curve." }, { "start": 1687.64, "end": 1690.08, "text": " Like, if it's steep and then it gets flat," }, { "start": 1690.08, "end": 1694.48, "text": " that means that up until then, your clusters actually buy you something good." }, { "start": 1694.48, "end": 1698.32, "text": " And from then, they basically are useless." }, { "start": 1698.32, "end": 1704.4399999999998, "text": " So if I were to guess, I would divide the criminals into two clusters" }, { "start": 1704.4399999999998, "end": 1709.48, "text": " and the non-criminals into a single cluster, because that's pretty flat." }, { "start": 1709.48, "end": 1714.76, "text": " Certainly not the non-criminals into three and the criminals into four." }, { "start": 1714.76, "end": 1717.72, "text": " That makes no sense at all." }, { "start": 1717.72, "end": 1719.6399999999999, "text": " Like, why?" }, { "start": 1719.6399999999999, "end": 1723.12, "text": " And they say, OK, these are the clusters right here." }, { "start": 1723.12, "end": 1727.3999999999999, "text": " And these are the pictures I showed you at the beginning." }, { "start": 1727.4, "end": 1728.76, "text": " What surprise?" }, { "start": 1728.76, "end": 1735.5600000000002, "text": " The bottom ones, the non-criminals, are smiling and the top ones aren't." }, { "start": 1735.5600000000002, "end": 1739.64, "text": " Gee, I wonder why the method works." }, { "start": 1741.96, "end": 1748.52, "text": " And the interesting part here is that how can we justify?" }, { "start": 1748.52, "end": 1752.24, "text": " How can we say if we decide on one cluster for non-criminals" }, { "start": 1752.24, "end": 1755.44, "text": " and two clusters for criminals, what does" }, { "start": 1755.44, "end": 1758.64, "text": " that remind us of?" }, { "start": 1758.64, "end": 1764.56, "text": " Oh, yes, that is exactly how we collected the data." }, { "start": 1764.56, "end": 1768.96, "text": " That is exactly the fact that we collected the non-criminals" }, { "start": 1768.96, "end": 1773.56, "text": " with one procedure and the criminals with two different procedures." }, { "start": 1773.56, "end": 1779.92, "text": " Gee, their data set replicates exactly how they collected the data." }, { "start": 1779.92, "end": 1783.52, "text": " And that convinces me that it says absolutely nothing" }, { "start": 1783.52, "end": 1786.24, "text": " about the actual criminality of people." }, { "start": 1786.24, "end": 1792.4, "text": " It's just that police, even if it's ID photos, they don't smile." }, { "start": 1792.4, "end": 1797.56, "text": " And pictures on the internet, sometimes people smile." }, { "start": 1797.56, "end": 1799.76, "text": " The rest of the paper is pretty much garbage." }, { "start": 1799.76, "end": 1804.72, "text": " They did reply to critics and they kind of take issue with a number of things." }, { "start": 1804.72, "end": 1806.48, "text": " So first, name calling." }, { "start": 1806.48, "end": 1810.68, "text": " I don't mean to name call, but it's going to happen." }, { "start": 1810.68, "end": 1817.28, "text": " I don't get why people call them racist because it's all the same." }, { "start": 1817.28, "end": 1820.16, "text": " Doesn't, no, no, trouble." }, { "start": 1820.16, "end": 1822.28, "text": " And smiley." }, { "start": 1822.28, "end": 1822.78, "text": " Ha." }, { "start": 1826.28, "end": 1828.68, "text": " In our experiments, we did control facial expression," }, { "start": 1828.68, "end": 1832.5600000000002, "text": " but not faint micro expression." }, { "start": 1832.5600000000002, "end": 1834.5600000000002, "text": " The critique that our methods can be reduced" }, { "start": 1834.5600000000002, "end": 1837.24, "text": " to a simple discriminator of smiling versus not smiling" }, { "start": 1837.24, "end": 1842.68, "text": " has given us a new angle of scrutiny." }, { "start": 1842.68, "end": 1845.88, "text": " They say, well, Westerners think that this is smiling," }, { "start": 1845.88, "end": 1849.24, "text": " but our Chinese students and colleagues, even after being prompted" }, { "start": 1849.24, "end": 1855.04, "text": " to consider the cue of smile, fail to detect the same." }, { "start": 1855.04, "end": 1859.08, "text": " So basically, their answer is, yeah, you think so, but we don't." }, { "start": 1859.08, "end": 1863.08, "text": " And then they say instead, they only find the faces in the bottom row" }, { "start": 1863.08, "end": 1869.1999999999998, "text": " appearing somewhat more relaxed than those in the top row." }, { "start": 1869.1999999999998, "end": 1871.36, "text": " And then here's the crucial part." }, { "start": 1871.36, "end": 1875.6, "text": " All criminal ID photos are government issues, but not mock shots." }, { "start": 1875.6, "end": 1878.32, "text": " They are normal government issue ID portraits" }, { "start": 1878.32, "end": 1881, "text": " like those driver license in the USA." }, { "start": 1881, "end": 1883.98, "text": " In contrast, most of the non-criminal ID style photos" }, { "start": 1883.98, "end": 1886.3999999999999, "text": " are taken officially by some organizations," }, { "start": 1886.4, "end": 1893.44, "text": " such as real estate companies, law firms, et cetera, for their website." }, { "start": 1893.44, "end": 1896.8400000000001, "text": " You know what it always says when you take your picture for a government ID?" }, { "start": 1896.8400000000001, "end": 1898.44, "text": " Please don't smile." }, { "start": 1898.44, "end": 1900.3200000000002, "text": " Imagine if your law firm comes to you and say," }, { "start": 1900.3200000000002, "end": 1901.92, "text": " we want a picture for our website." }, { "start": 1901.92, "end": 1904, "text": " Please don't smile." }, { "start": 1904, "end": 1906, "text": " All right, this was it for this paper." }, { "start": 1906, "end": 1911.2800000000002, "text": " If you like this content, please consider subscribing and sharing it out." }, { "start": 1911.2800000000002, "end": 1913.0800000000002, "text": " This is absolute garbage." }, { "start": 1913.0800000000002, "end": 1916.0800000000002, "text": " And there is important lessons to learn here," }, { "start": 1916.08, "end": 1921.52, "text": " namely Occam's razor is a real problem in research." }, { "start": 1921.52, "end": 1925.12, "text": " People often fail to criticize themselves enough" }, { "start": 1925.12, "end": 1928.56, "text": " and to think, is there maybe a different explanation for why" }, { "start": 1928.56, "end": 1930.4399999999998, "text": " I'm getting the results that I'm getting?" }, { "start": 1930.4399999999998, "end": 1934.32, "text": " And how can I disprove that that is the case?" }, { "start": 1934.32, "end": 1938.6799999999998, "text": " And how can I make sure that the effect that I'm seeing actually" }, { "start": 1938.6799999999998, "end": 1942.76, "text": " comes from the place where I claim it comes from?" }, { "start": 1942.76, "end": 1946.6, "text": " I think this is a real threat throughout all of research." }, { "start": 1946.6, "end": 1949.08, "text": " I've seen many papers that I've reviewed that" }, { "start": 1949.08, "end": 1954.2, "text": " are exactly of the same fallacy, not as touchy subjects as this one," }, { "start": 1954.2, "end": 1956.36, "text": " but it definitely exists." }, { "start": 1956.36, "end": 1961, "text": " And I remind everyone that learn a lesson from this." }, { "start": 1961, "end": 1962.92, "text": " And have a good day." }, { "start": 1962.92, "end": 1973.0800000000002, "text": " Thank you." } ]
bFn2xcGi1TQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Faster Neural Network Training with Data Echoing (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "google", "brain", "pipeline", "bottleneck", "speed", "gpu", "tpu", "idle", "network", "distributed", "preprocessing", "augmentation" ]
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 Damme Choi, Alexander Passo, Christopher J. Shalu 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 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 in a database, it could be in the network somewhere. So if you have even something larger than ImageNet, you'll probably store it on a central server on an 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 gonna 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 points, you're gonna 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. 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. 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 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 update. It's called data augmentation. And you're gonna apply a whole bunch of these things. So you can crop, you can 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. 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 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. You'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 such that your network learned something right now this step to the right here is usually what what we focus on when we do deep learning. 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 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, it 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 run the code, usually your this is not the bottleneck. Usually, your GPU is here are at 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 earlier in the pipeline, the slower it is. And don't you just love these graphics? 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 you're 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 and this should be this should be different. It should mean okay, to correct this right here, this is idle. And this is running. So as you're 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 a repeat buffer. So what it does is it 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 gonna 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 and again. Now the 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 egg they 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 you do your shuffle buffer after you're echoing. So here, then after augmentation and after batching. So they experiment with these three locations in 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 data, it doesn't it sees the same information over and over, is 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. So the IID assumption is is is invalid. Now, why do you experiment with this in different locations? Because what you expect is that it hurts more or it 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 this 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 on to 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 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 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 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 am can absolutely accept one through five, especially in like an actual practical in the wild setting. But six, we'll see about six. So let's jump into their models. They, sorry about that, they train the following four models. So they train a transformer on these two data sets LM1B and common crawl. So I guess technically it's five models on language modeling. They train the ResNet 32 on CIFAR 10. They train the ResNet 50 on ImageNet and they train SD on Coco. Now here is the accuracies 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 where it gets wonky because, for example, take the 91% here on CIFAR 10. 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 under par your, this target performance really is. And 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 of now, at least the ones I know, like the ResNets, aren't really competitive. But so what do they do? They measure data echoing with an echoing factor of 2. So that means data that's incoming is output twice in a row. And 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 read. 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 really in the situation where your GPU is twice as fast as the rest of your pipeline, then an echoing factor of 2 will speed up at most your training procedure by a factor of 2. 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 the potential to be the fastest if maybe your augmentation is very expensive. Then, sorry, or your batching. You have example echoing after augmentation. So that would mean the augmentation is very expensive. So you save the augmented data point. And then you emit it multiple times, but each time it is batched differently. So 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 data 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, this helps you more, or this helps you. It doesn't help you fully because the dashed line here is the, if it would help you as much as a fresh data point, you'd be at the dashed line, right? This is exactly half of this because the echoing factor is two. So if a repeated data point was as useful as a fresh data point, you'd be at the dashed line. As you can see right here, you're not at the dashed line, but at least it doesn't hurt. 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 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, you echo each one twice. So it needs to process it twice so 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 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 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 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 ResNet 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 just sort of get it for free. As you can see, the dashed line again is as if if at repeated data point were as useful as a fresh data point, you'd be at the dashed line. And you can see right here that you are just above this dashed line. So this can help a lot. And so this is the fresh examples read and this is the wall time in their particular situation. In this 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's kind of the optimal echoing factor? And what can you tell me about this optimal echoing factor? 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 the 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 LM 1B. 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 1024 batch size, you can see that the baseline uses this many 1.5 times 10 to the seventh fresh examples to train until their target. If you increase the echoing factor by two, 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 batch 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 IID ness, 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 lowest like here the four and here the I don't know what it's gonna 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 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 is 1.5 and here it's actually four, because you increase that batch size. So that will tell you something 1.5 and four, that is that is like a times. Okay, that's like an times 2.5. So you go with the batch size of times four, and you need 2.5 more 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, these 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 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 yes, and 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, four 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 four. And if it were if it were times one, so if it were no, no speed up at all, sorry, not times four, if it would be times one, it would mean I'd need the same number of fresh training samples, right? No matter how I batch them. But it were times four. 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 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 in 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 indeed 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 were as useful as fresh examples. Yeah, so I believe 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. So 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 shuffled together with a bunch of other data points. Of course, this uses more memory, but 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 off freshness and freshness and doing multiple steps 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 read. And here I want to concentrate on the ResNet 50 on ImageNet. And as you can see, most of these models, 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, this is where it gets a bit confusing, honestly, because why do you have this super sharp thing here? Because 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 this target thing is lower than than the even though this target thing is the same for everyone, it is lower than the best reachable accuracy. And 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 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? I don't think so. I think they say they let it reach. They also have these things right here. These these curves where they say this is the best we reach. And this is the ResNet 32 on C410. 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 ResNet 32. 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, like it seems like it's outperforming the 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. But yeah, so my main criticisms are 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. 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 to do this and can help you tremendously. Alright, that was it. Thank you for listening. If you're still here, subscribe, like, tell a friend. Bye bye.
[ { "start": 0, "end": 5.12, "text": " Hi there! Today we're looking at faster neural network training with data" }, { "start": 5.12, "end": 11.9, "text": " echoing by Damme Choi, Alexander Passo, Christopher J. Shalu and George E. Dahl." }, { "start": 11.9, "end": 17.34, "text": " So on a high level this paper basically says you should repeat data that's" }, { "start": 17.34, "end": 21.86, "text": " already in memory in order to speed up the entire process of neural network" }, { "start": 21.86, "end": 27.76, "text": " training. And it also says that this can speed up your wall time without hurting" }, { "start": 27.76, "end": 33.52, "text": " your performance too much. And I have mixed feelings about it. So let's jump in." }, { "start": 33.52, "end": 38.800000000000004, "text": " So they basically make a point of saying that machine learning doesn't happen in" }, { "start": 38.800000000000004, "end": 46.8, "text": " just one thing. It's not like sklearn.fit anymore. It is more of a pipeline. So" }, { "start": 46.8, "end": 51.6, "text": " what do we mean by this? If you think of something like you want to" }, { "start": 51.6, "end": 57.160000000000004, "text": " train an ImageNet model, what you want to do is you have like your data set" }, { "start": 57.16, "end": 63.279999999999994, "text": " somewhere. And that could be in a database, it could be in the network" }, { "start": 63.279999999999994, "end": 68.44, "text": " somewhere. So if you have even something larger than ImageNet, you'll probably" }, { "start": 68.44, "end": 72.16, "text": " store it on a central server on an Amazon bucket somewhere. So this is in" }, { "start": 72.16, "end": 77.03999999999999, "text": " AWS. And the first thing you actually need to do is you need to read that" }, { "start": 77.03999999999999, "end": 82.47999999999999, "text": " data set. Now usually you're not gonna have enough memory on a machine to just" }, { "start": 82.48, "end": 87.52000000000001, "text": " load in the entire data set into memory. So that means this process here is" }, { "start": 87.52000000000001, "end": 93.32000000000001, "text": " streaming. So this is continuously streaming data points. And once you have" }, { "start": 93.32000000000001, "end": 96.82000000000001, "text": " used the data points, you're gonna throw it away because you need space for the" }, { "start": 96.82000000000001, "end": 103.24000000000001, "text": " next one, right? And so the streaming is done continuously. The next process is" }, { "start": 103.24000000000001, "end": 107.68, "text": " read and decode. That means you have to read it from the network and" }, { "start": 107.68, "end": 111.52000000000001, "text": " actually bring it into a format where you can use it. Usually something like an" }, { "start": 111.52, "end": 117.75999999999999, "text": " umpire array or a tensorflow tensor. You need to apply some shuffling because" }, { "start": 117.75999999999999, "end": 123.88, "text": " usually the order, you can't really trust the order that it is stored in." }, { "start": 123.88, "end": 127.39999999999999, "text": " Oftentimes there is like a bias in the ordering, so you need some sort of a" }, { "start": 127.39999999999999, "end": 133.2, "text": " shuffle buffer here. Then often you want to apply some data augmentation to it." }, { "start": 133.2, "end": 139.35999999999999, "text": " That means that you have one image. And we know for these models, if this is your" }, { "start": 139.36, "end": 146.4, "text": " cat, we know for these models that what can help is to basically make many many" }, { "start": 146.4, "end": 151.60000000000002, "text": " different images from one image. So this could be by cropping part of it and" }, { "start": 151.60000000000002, "end": 156.8, "text": " saying, well, if it was a cat before, the small upper right part here is still a" }, { "start": 156.8, "end": 162.72000000000003, "text": " cat. So this is one update. It's called data augmentation. And you're gonna apply" }, { "start": 162.72000000000003, "end": 166.76000000000002, "text": " a whole bunch of these things. So you can crop, you can rotate the image a bit. It's" }, { "start": 166.76, "end": 171.79999999999998, "text": " still a cat, right? And you can also change its luminance and a bit of its" }, { "start": 171.79999999999998, "end": 176.6, "text": " colors. You can jitter the colors, you can horizontally flip it and it'll still be a" }, { "start": 176.6, "end": 181.56, "text": " cat. And that's basically how you make many data points from one data point. And" }, { "start": 181.56, "end": 187.2, "text": " we know that helps. Then what you want to do is you want to batch this data. So you" }, { "start": 187.2, "end": 193.04, "text": " want to put it into mini batches. Since you've shuffled here, that means when the" }, { "start": 193.04, "end": 196.72, "text": " next time the same data point comes along, it's going to be batched with a" }, { "start": 196.72, "end": 202.7, "text": " different group of images and of course augmented differently with a" }, { "start": 202.7, "end": 206.95999999999998, "text": " different group of images. And that basically means it's a different training" }, { "start": 206.95999999999998, "end": 212.48, "text": " batch for the model. So this entire pipeline is basically a way that we take" }, { "start": 212.48, "end": 217.2, "text": " data points that we have and we make a whole bunch of variations and various" }, { "start": 217.2, "end": 221.84, "text": " groupings and batchings of it. And we know that helps enormously with the" }, { "start": 221.84, "end": 227.48, "text": " generalization capability of your final models. And then here you do your apply" }, { "start": 227.48, "end": 233.08, "text": " your SGD update. So that's usually where you forward propagate your data through" }, { "start": 233.08, "end": 239.8, "text": " your network, which here is F. You'll get like some Y hat as an output. And then" }, { "start": 239.8, "end": 244.56, "text": " you have your labels that also come through the pipeline. And you have some" }, { "start": 244.56, "end": 250.72, "text": " sort of loss function L that takes both as an input and gives you an output. And" }, { "start": 250.72, "end": 256.8, "text": " then you do your back propagation. So the back propagation would go through your" }, { "start": 256.8, "end": 262.96, "text": " loss function through your network and update the network parameters such that" }, { "start": 262.96, "end": 268.32, "text": " your network learned something right now this step to the right here is usually" }, { "start": 268.32, "end": 275.48, "text": " what what we focus on when we do deep learning. The step on the right here, all" }, { "start": 275.48, "end": 282.84000000000003, "text": " of this, this can be done on a GPU or is usually done on something like a GPU or a" }, { "start": 282.84000000000003, "end": 291.72, "text": " TPU. Right. But in these things are getting faster and faster. The point the" }, { "start": 291.72, "end": 297.44, "text": " paper makes is that the TPUs and GPUs of the world are getting faster. But this" }, { "start": 297.44, "end": 303.16, "text": " entire other thing right here, this is basically CPU land. Now I know there is" }, { "start": 303.16, "end": 309.32000000000005, "text": " some data augmentation now happening on the GPU and so on. But in essence, you can" }, { "start": 309.32000000000005, "end": 313.36, "text": " think of a pipeline where the thing to the left is happening on CPU and the" }, { "start": 313.36, "end": 319.40000000000003, "text": " thing to the right is happening on TPU. And even even worse, let's say the speed" }, { "start": 319.40000000000003, "end": 326.36, "text": " is continuously is continuously increasing. So in your pipeline, the kind" }, { "start": 326.36, "end": 337.36, "text": " of speed would be so here is the network reading. And here over here is the GPU SGD" }, { "start": 337.36, "end": 344.52000000000004, "text": " step. And this is speed. Basically, the further to the right in your pipeline," }, { "start": 344.52000000000004, "end": 353.36, "text": " you go the faster your the faster your hardware gets. And that means that if if" }, { "start": 353.36, "end": 358.28000000000003, "text": " this since this is a continuous pipeline, right, that basically means that if I" }, { "start": 358.28000000000003, "end": 364.6, "text": " input something here, it goes through the pipeline. And even if this is all running" }, { "start": 364.6, "end": 370.08000000000004, "text": " in parallel, at this thing over here is going to idle this since this is the" }, { "start": 370.08000000000004, "end": 376.52000000000004, "text": " fastest part of the pipeline, it is going to just idle a lot. Right, it because" }, { "start": 376.52000000000004, "end": 380.64, "text": " because it can only consume things as fast as this thing can produce. Now if" }, { "start": 380.64, "end": 386.24, "text": " you if you have some sort of a multi GPU machine and just train image net, like" }, { "start": 386.24, "end": 392.12, "text": " you just run the code, usually your this is not the bottleneck. Usually, your GPU" }, { "start": 392.12, "end": 398.24, "text": " is here are at 100% capacity. So this paper is not for you. But if you are," }, { "start": 398.24, "end": 402.64, "text": " let's say a big company have this network storage, have a big data set, have" }, { "start": 402.64, "end": 407.76, "text": " very expensive data augmentation. This happens, for example, this can happen in" }, { "start": 407.76, "end": 415.56, "text": " NLP and so on. This can be quite your situation, where the earlier in the" }, { "start": 415.56, "end": 423.08, "text": " pipeline, the slower it is. And don't you just love these graphics? So here's" }, { "start": 423.08, "end": 431.56, "text": " here's time. And apparently, it goes in both directions. And so does it go like" }, { "start": 431.56, "end": 437.52, "text": " this? I think what they mean is just time goes in this direction. And you're" }, { "start": 437.52, "end": 444.35999999999996, "text": " here. And you're upstream. So your upstream is your network. This is your" }, { "start": 444.35999999999996, "end": 450.71999999999997, "text": " network reading or your pre processing and the downstream, this is the GPU. So as" }, { "start": 450.71999999999997, "end": 457.24, "text": " you are pre processing things, you you and this should be this should be" }, { "start": 457.64, "end": 464.12, "text": " different. It should mean okay, to correct this right here, this is idle." }, { "start": 464.12, "end": 470.92, "text": " And this is running. So as you're upstream processes images, right at the" }, { "start": 470.92, "end": 475.88, "text": " beginning, your GPU is idle. But then as soon as it ships off the first batch of" }, { "start": 475.88, "end": 480.84000000000003, "text": " images, your GPU can run now it's running. While you're doing that, your" }, { "start": 480.84000000000003, "end": 484.76, "text": " upstream your network is still reading new images, pre processing them and so" }, { "start": 484.76, "end": 491.16, "text": " on, but it cannot is too slow to insert a batch at the time that the GPU is done." }, { "start": 491.16, "end": 496.68, "text": " The time the GPU is done, it's still processing this batch. So the GPU is idle" }, { "start": 497.68, "end": 502.32000000000005, "text": " until here where it finally manages to process that batch and then the GPU is" }, { "start": 502.32000000000005, "end": 507.40000000000003, "text": " running again. I think that would have been a much better graphic. But you know," }, { "start": 507.88, "end": 515, "text": " so their goal basically is that what you'll have is right here, for example," }, { "start": 515, "end": 520.36, "text": " after the batch, what you'll do is you scrap this connection, you take this" }, { "start": 520.36, "end": 528.4, "text": " and you put it into a smaller buffer. And the buffer is a repeat buffer. So what it" }, { "start": 528.4, "end": 536.6, "text": " does is it simply will repeat the whatever you have in the buffer until" }, { "start": 536.6, "end": 541.12, "text": " something new comes in, right? So new data point comes in, you just output that" }, { "start": 541.12, "end": 547.6, "text": " data point again, again, again, again, the for the GPU, it's gonna feel like these" }, { "start": 547.6, "end": 552.6800000000001, "text": " are all new batches and they continuously come in. But it's always the same until" }, { "start": 552.6800000000001, "end": 557.28, "text": " the next data point comes in. And then you output that one again and again and" }, { "start": 557.28, "end": 562.32, "text": " again and again. Now the the actual factor here you can, of course, tune by" }, { "start": 562.32, "end": 567.48, "text": " hand or you can just say repeat until something else comes in. In this paper," }, { "start": 567.48, "end": 572.2, "text": " they have an explicit factor where they say we repeat each data point four times" }, { "start": 572.2, "end": 577.24, "text": " or three times or so on. So this is data echoing, you basically echo the data" }, { "start": 577.24, "end": 584.88, "text": " point multiple times. And this can be done in various places. So they" }, { "start": 584.88, "end": 589.88, "text": " experiment with echoing in any of these places right here. So the egg they" }, { "start": 589.88, "end": 596.52, "text": " experiment with it right here, after reading and decoding, after shuffling. No," }, { "start": 596.52, "end": 602.84, "text": " I think always before shuffling. Because if you if you have a shuffle buffer" }, { "start": 602.84, "end": 607.52, "text": " anyway, they say it makes sense that if you do the echoing, you you do your" }, { "start": 607.52, "end": 612.72, "text": " shuffle buffer after you're echoing. So here, then after augmentation and after" }, { "start": 612.72, "end": 620.5600000000001, "text": " batching. So they experiment with these three locations in in echoing. Now what" }, { "start": 620.5600000000001, "end": 625.44, "text": " could be the downturn of something like this, the downturn, of course, is that" }, { "start": 625.44, "end": 633.72, "text": " this SGD procedure right here, basically, it relies on the data incoming being an" }, { "start": 633.72, "end": 640.1600000000001, "text": " IID sample from your data distribution, right? That's that's how we formulate SGD" }, { "start": 640.1600000000001, "end": 644.72, "text": " is that there's always new data incoming. Now, if you just output the same data" }, { "start": 644.72, "end": 650.8800000000001, "text": " point all the time, that could that is like no new information, first of all," }, { "start": 650.88, "end": 657.96, "text": " and second of all, it could bias the SGD update, such that you it because it sees" }, { "start": 657.96, "end": 661.56, "text": " the same data, it doesn't it sees the same information over and over, is going" }, { "start": 661.56, "end": 666.04, "text": " to think that's the whole data set, right? So potentially, it can make too many" }, { "start": 666.04, "end": 671.88, "text": " steps into the wrong direction. That just happens to be the bias in this particular" }, { "start": 671.88, "end": 681.4, "text": " data point. So the IID assumption is is is invalid. Now, why do you experiment" }, { "start": 681.4, "end": 687.48, "text": " with this in different locations? Because what you expect is that it hurts more or" }, { "start": 687.48, "end": 692.48, "text": " it hurts less the earlier you introduce this. So if you introduce echoing right" }, { "start": 692.48, "end": 698.36, "text": " here, so if you echo your data until new data from the network comes in, it's" }, { "start": 698.36, "end": 702.76, "text": " still going to be shuffled differently, right? It's and it's still going to be" }, { "start": 702.76, "end": 707.48, "text": " augmented differently. So each time the data point comes out of the echo buffer," }, { "start": 707.48, "end": 712.5600000000001, "text": " it is going to be shuffled. And it is going to be augmented in a different way" }, { "start": 712.5600000000001, "end": 716.96, "text": " than the last time the same data point came out. And this is going to be batched" }, { "start": 716.96, "end": 720.6, "text": " together because you've shuffled differently, it's going to be batched" }, { "start": 720.6, "end": 725.6800000000001, "text": " together with a different bunch of data points. And that means SGD gets new" }, { "start": 725.68, "end": 730.88, "text": " information. But if you go on to the very last thing, where you just after the" }, { "start": 730.88, "end": 736.2399999999999, "text": " batch right here, where you input the echo, that means SGD just gets to see" }, { "start": 736.2399999999999, "end": 745.52, "text": " the same batch of data augmented in the same way all the time, right? So the of" }, { "start": 745.52, "end": 750.68, "text": " course, where you exactly have to echo, you have to trade this off. So you have" }, { "start": 750.68, "end": 757.1999999999999, "text": " to trade off the how much you basically violate the IID fresh data assumption" }, { "start": 757.1999999999999, "end": 762.4799999999999, "text": " against where in your data pipeline is the bottleneck. So if your bottleneck is" }, { "start": 762.4799999999999, "end": 768.4799999999999, "text": " in the data augmentation, it may make little sense to echo before that because" }, { "start": 768.4799999999999, "end": 772.88, "text": " your bottleneck is the data augmentation. And that being said, if the bottleneck is" }, { "start": 772.88, "end": 777.16, "text": " that you don't have enough GPUs, then it probably doesn't make sense to data" }, { "start": 777.16, "end": 785, "text": " echo at all, though their experiments are somehow wonky on this. But so let's dive" }, { "start": 785, "end": 791.1999999999999, "text": " in, they make the following claims. Let's just go through them really quick. Data" }, { "start": 791.1999999999999, "end": 796.52, "text": " echo reduces the amount of upstream that think of network reading or" }, { "start": 796.52, "end": 802.12, "text": " augmentation computation needed to reach a competitive out of sample error rate" }, { "start": 802.12, "end": 806.28, "text": " on various data sets and model architectures. Second, data echoing can" }, { "start": 806.28, "end": 811.24, "text": " provide a wall time speed up in practice. Third, data echoing can support a wide" }, { "start": 811.24, "end": 815.72, "text": " range of echoing factors. And that's the echoing factor is how often you repeat" }, { "start": 815.72, "end": 821.24, "text": " the data. Fourth, the effectiveness of data echoing depends on the intersection" }, { "start": 821.24, "end": 826.36, "text": " point in the training pipeline, sorry, in the insertion point. That's what" }, { "start": 826.36, "end": 832.12, "text": " our hypothesis was, right? Fifth, data echoing can benefit from additional" }, { "start": 832.12, "end": 837.92, "text": " shuffling after echoing, but does not require it. And six, countering" }, { "start": 837.92, "end": 843.2, "text": " expectations, data echoing reaches the same final error rate as well tuned" }, { "start": 843.2, "end": 851.2, "text": " baselines. So I am can absolutely accept one through five, especially in like an" }, { "start": 851.2, "end": 863.5600000000001, "text": " actual practical in the wild setting. But six, we'll see about six. So let's jump" }, { "start": 863.5600000000001, "end": 870.9200000000001, "text": " into their models. They, sorry about that, they train the following four models. So" }, { "start": 870.9200000000001, "end": 876.8000000000001, "text": " they train a transformer on these two data sets LM1B and common crawl. So I" }, { "start": 876.8, "end": 884.4, "text": " guess technically it's five models on language modeling. They train the ResNet" }, { "start": 884.4, "end": 891.5999999999999, "text": " 32 on CIFAR 10. They train the ResNet 50 on ImageNet and they train SD on Coco." }, { "start": 891.5999999999999, "end": 899.3599999999999, "text": " Now here is the accuracies they get and here is, sorry, this is the target. So" }, { "start": 899.3599999999999, "end": 903.9599999999999, "text": " what they do is they train these models and then they say, okay, what's the" }, { "start": 903.96, "end": 910.48, "text": " accuracy we reach? And then they set a target value. So on ResNet 50 on ImageNet," }, { "start": 910.48, "end": 918.6, "text": " a very common number to reach is something like 76.5. If you look at, for" }, { "start": 918.6, "end": 924.1600000000001, "text": " example, torch vision models, they reach something like this. And so they say," }, { "start": 924.1600000000001, "end": 930.2, "text": " well, our target accuracy here is just a little bit below that. So and then we" }, { "start": 930.2, "end": 935.84, "text": " just measure how many steps or how many their measurement here is fresh data" }, { "start": 935.84, "end": 940.8000000000001, "text": " points. So how many actual fresh training samples do we need to reach this target?" }, { "start": 940.8000000000001, "end": 949.08, "text": " And this is where it gets wonky because, for example, take the 91% here on CIFAR 10." }, { "start": 949.08, "end": 958.1600000000001, "text": " That is quite, quite low. And also the ResNet 50 is, I mean, this is standard," }, { "start": 958.16, "end": 965.3199999999999, "text": " but still ImageNet is much further nowadays. And I think the effectiveness of" }, { "start": 965.3199999999999, "end": 970.8, "text": " something like this has a lot to do with how competitive you want to get. Maybe" }, { "start": 970.8, "end": 976.76, "text": " this is all just an effect of how much under par your, this target performance" }, { "start": 976.76, "end": 984.6, "text": " really is. And I would expect that even though they say it doesn't hurt their" }, { "start": 984.6, "end": 989.9200000000001, "text": " performance in their experiments, I would at least expect it will hurt your" }, { "start": 989.9200000000001, "end": 997.5600000000001, "text": " performance in general if you try to get competitive. Because these things aren't," }, { "start": 997.5600000000001, "end": 1003.84, "text": " as of now, at least the ones I know, like the ResNets, aren't really" }, { "start": 1003.84, "end": 1012.6, "text": " competitive. But so what do they do? They measure data echoing with an echoing" }, { "start": 1012.6, "end": 1018.84, "text": " factor of 2. So that means data that's incoming is output twice in a row. And" }, { "start": 1018.84, "end": 1023.76, "text": " every data point that's coming in is just emitted twice from the buffer. And" }, { "start": 1023.76, "end": 1029.48, "text": " then the next data point is emitted twice and so on. And what they measure," }, { "start": 1029.48, "end": 1035.32, "text": " again, is the fresh examples read. So how many fresh data points do you need to" }, { "start": 1035.32, "end": 1038.52, "text": " achieve something? This is a good measurement because this is kind of" }, { "start": 1038.52, "end": 1046.16, "text": " independent of hardware. So if you're really in the situation where your GPU is" }, { "start": 1046.16, "end": 1053.56, "text": " twice as fast as the rest of your pipeline, then an echoing factor of 2 will" }, { "start": 1053.56, "end": 1061.92, "text": " speed up at most your training procedure by a factor of 2. All right, so you have" }, { "start": 1061.92, "end": 1068.04, "text": " the baseline in red. And then you have batch echoing, which is where you echo" }, { "start": 1068.04, "end": 1072.6, "text": " what we said at the worst possible time right after batching. So this might hurt" }, { "start": 1072.6, "end": 1079.8, "text": " your performance the most, but also it has the potential to be the fastest if" }, { "start": 1079.8, "end": 1085.1599999999999, "text": " maybe your augmentation is very expensive. Then, sorry, or your batching." }, { "start": 1085.1599999999999, "end": 1090.6399999999999, "text": " You have example echoing after augmentation. So that would mean the" }, { "start": 1090.6399999999999, "end": 1095.56, "text": " augmentation is very expensive. So you save the augmented data point. And then" }, { "start": 1095.56, "end": 1103.6399999999999, "text": " you emit it multiple times, but each time it is batched differently. So it is" }, { "start": 1103.6399999999999, "end": 1107.32, "text": " shuffled and then batched with different other data points. So you have a shuffle" }, { "start": 1107.32, "end": 1111.52, "text": " buffer after it. And then you have example echoing before data augmentation." }, { "start": 1111.52, "end": 1115.24, "text": " So that means the same data point emitted multiple times will be augmented in" }, { "start": 1115.24, "end": 1120.1599999999999, "text": " different ways and basically will lead to slightly different data points. So the" }, { "start": 1120.1599999999999, "end": 1125.1599999999999, "text": " results here are pretty much what you could expect in that the earlier you do" }, { "start": 1125.16, "end": 1132.4, "text": " the echoing, as you can see here, the more this echoing helps. So the number, if" }, { "start": 1132.4, "end": 1138.28, "text": " you, for example, this is the object segmentation task, the baseline needs" }, { "start": 1138.28, "end": 1144.0800000000002, "text": " this many fresh examples to reach this target accuracy. With batch echoing, not" }, { "start": 1144.0800000000002, "end": 1151.44, "text": " only do you, sorry, with batch echoing, you need less fresh training examples. So" }, { "start": 1151.44, "end": 1159.56, "text": " that means even though you kind of train on the same data twice, this" }, { "start": 1159.56, "end": 1164.8400000000001, "text": " helps you more, or this helps you. It doesn't help you fully because the dashed" }, { "start": 1164.8400000000001, "end": 1172.6000000000001, "text": " line here is the, if it would help you as much as a fresh data point, you'd be at" }, { "start": 1172.6000000000001, "end": 1176.2, "text": " the dashed line, right? This is exactly half of this because the echoing factor" }, { "start": 1176.2, "end": 1183.4, "text": " is two. So if a repeated data point was as useful as a fresh data point," }, { "start": 1183.4, "end": 1187.24, "text": " you'd be at the dashed line. As you can see right here, you're not at the dashed" }, { "start": 1187.24, "end": 1192.1200000000001, "text": " line, but at least it doesn't hurt. You might expect that it hurts, but it" }, { "start": 1192.1200000000001, "end": 1196.1200000000001, "text": " doesn't hurt. It actually speeds up. So the repeated data points at least have" }, { "start": 1196.1200000000001, "end": 1203.48, "text": " some utility. Again, this is only useful if you have this asymmetry" }, { "start": 1203.48, "end": 1207.28, "text": " in your pipeline. If your pipeline is actually symmetric and you do an echoing" }, { "start": 1207.28, "end": 1212.04, "text": " factor of two, the wall time here, the wall time plot would look this for the" }, { "start": 1212.04, "end": 1218.72, "text": " baseline and then almost twice as high for the batch echoing. Because even" }, { "start": 1218.72, "end": 1223.28, "text": " though it needs the same amount of fresh, or almost the same amount of fresh" }, { "start": 1223.28, "end": 1231.68, "text": " example, you echo each one twice. So it needs to process it twice so it'll" }, { "start": 1231.68, "end": 1236.88, "text": " take much longer. So again, this is useful if you have this asymmetry and if" }, { "start": 1236.88, "end": 1242.6000000000001, "text": " the echoing factor is kind of smaller than your asymmetry. Otherwise you're" }, { "start": 1242.6000000000001, "end": 1249.64, "text": " simply wasting time repeating data points. Then if you do example echoing" }, { "start": 1249.64, "end": 1254.72, "text": " here after augmentation, you use even less fresh data points. And if you do it" }, { "start": 1254.72, "end": 1260.44, "text": " before augmentation, this is really surprising. You almost get the benefit of" }, { "start": 1260.44, "end": 1266.1200000000001, "text": " fresh data points, which is something you might expect, right? Because an" }, { "start": 1266.1200000000001, "end": 1272.3600000000001, "text": " augmented newly shuffled data point is kind of almost a new data point. But" }, { "start": 1272.3600000000001, "end": 1278.96, "text": " still, it's quite surprising that you almost get to the level of the of the" }, { "start": 1278.96, "end": 1285.8400000000001, "text": " theoretical possible. And also here on the image net task. Now here is actually" }, { "start": 1285.84, "end": 1291.24, "text": " an example where you can see that it hurts to do this batch echoing. Because" }, { "start": 1291.24, "end": 1295.9199999999998, "text": " the reasons why it could hurt is just that you have you violate this IID" }, { "start": 1295.9199999999998, "end": 1300.84, "text": " assumption, you basically have correlated data points. This is a big, big problem," }, { "start": 1300.84, "end": 1307.12, "text": " for example, in reinforcement learning, where already by nature of you running" }, { "start": 1307.12, "end": 1311.76, "text": " episodes and then feeding the episodes back into the training procedure, you" }, { "start": 1311.76, "end": 1316.84, "text": " have correlated data points. And that hurts your performance here actually" }, { "start": 1316.84, "end": 1323.2, "text": " compared to the to the baseline. But then if you go to example echoing, and the" }, { "start": 1323.2, "end": 1329.76, "text": " example echoing before augmentation, again, you get a speed up, which is pretty" }, { "start": 1329.8, "end": 1336.4, "text": " cool. Okay, so they do a bunch of other experiments. And I appreciate these" }, { "start": 1336.4, "end": 1340.72, "text": " experiments here to really show what's going on. And until when can you push" }, { "start": 1340.72, "end": 1346.48, "text": " this? So here they have a plot of example echoing before augmentation can reduce" }, { "start": 1346.52, "end": 1352.88, "text": " training time for ResNet 50 on image net. So this is before augmentation. And the" }, { "start": 1352.92, "end": 1358.1200000000001, "text": " echoing factor describes how often you repeat each data point. So this goes from" }, { "start": 1358.1200000000001, "end": 1365.3600000000001, "text": " two to five. And you can see that basically you you get the speed up, you" }, { "start": 1365.36, "end": 1372.6799999999998, "text": " just sort of get it for free. As you can see, the dashed line again is as if if at" }, { "start": 1372.7199999999998, "end": 1378.28, "text": " repeated data point were as useful as a fresh data point, you'd be at the dashed" }, { "start": 1378.28, "end": 1385.52, "text": " line. And you can see right here that you are just above this dashed line. So this" }, { "start": 1385.8799999999999, "end": 1391.8, "text": " can help a lot. And so this is the fresh examples read and this is the wall time" }, { "start": 1391.8, "end": 1397.32, "text": " in their particular situation. In this case, it doesn't help as much. But again," }, { "start": 1397.3999999999999, "end": 1404.68, "text": " it if that very much depends on how the asymmetry in your pipeline is. Now, in" }, { "start": 1404.68, "end": 1410.28, "text": " these experiments, I would actually appreciate something like they do down" }, { "start": 1410.32, "end": 1417.24, "text": " here, where I would always like to see where it breaks. So how far can you go" }, { "start": 1417.24, "end": 1423.04, "text": " with the echoing factor until it doesn't help anymore? Because this sort of tells" }, { "start": 1423.04, "end": 1427.2, "text": " me pretty much nothing. I want to see where is the low point? Where's kind of" }, { "start": 1427.2, "end": 1433.24, "text": " the optimal echoing factor? And what can you tell me about this optimal echoing" }, { "start": 1433.24, "end": 1438.4, "text": " factor? How can we determine it sort of beforehand? Or how can you reason how" }, { "start": 1438.4, "end": 1442.4, "text": " does it connect to the different parts of your architecture? So if I had to point" }, { "start": 1442.4, "end": 1448, "text": " out a flaw in this paper, it would be that right here, I would expect the them" }, { "start": 1448, "end": 1455.4, "text": " to continue this echoing factor increase until it breaks, sort of like they do" }, { "start": 1455.44, "end": 1464.44, "text": " down here. This is for I believe this is for the transformer on LM 1B. Now here" }, { "start": 1464.44, "end": 1472.88, "text": " they have a batch size of 1024. And you can see, and this is the this is their" }, { "start": 1472.88, "end": 1477.16, "text": " standard setting for the transformer, the 1024 batch size, you can see that the" }, { "start": 1477.16, "end": 1485.52, "text": " baseline uses this many 1.5 times 10 to the seventh fresh examples to train" }, { "start": 1485.52, "end": 1491.64, "text": " until their target. If you increase the echoing factor by two, you basically need" }, { "start": 1491.64, "end": 1498.8400000000001, "text": " half as many fresh examples, as long as you echo each one twice. Again, very" }, { "start": 1498.8400000000001, "end": 1507.4, "text": " surprising the fact how close you can get to the as if each batch were a a" }, { "start": 1507.4, "end": 1514.2, "text": " perfect fresh data point. But you can see as you increase this echoing factor, and" }, { "start": 1514.2, "end": 1519.5600000000002, "text": " here is exactly what I said, right, you at some point, this hurts at some point," }, { "start": 1519.56, "end": 1525.32, "text": " you get to the point where the non IID ness, the correlation of date of" }, { "start": 1525.32, "end": 1530.76, "text": " successive data points will actually hurt you. And they make a point here of" }, { "start": 1530.76, "end": 1537.9199999999998, "text": " saying that this is, for example, dependent on batch size. Now in this" }, { "start": 1537.9199999999998, "end": 1544.44, "text": " experiment over here, they have a larger batch size. And here is again the the" }, { "start": 1544.44, "end": 1551, "text": " baseline number of data points to reach the target. And you can see again it goes" }, { "start": 1551, "end": 1558.52, "text": " down. But now with the echoing factor where before you had a you had an" }, { "start": 1558.52, "end": 1562.68, "text": " increase again, now it continues to decrease. Again, it will be interesting to" }, { "start": 1562.68, "end": 1568.74, "text": " see where it goes up here and how the number at the lowest like here the four" }, { "start": 1568.74, "end": 1573.64, "text": " and here the I don't know what it's gonna be maybe the 16, how this will" }, { "start": 1573.64, "end": 1579.0800000000002, "text": " kind of depend on your batch size. And here is another problem. And that's what" }, { "start": 1579.0800000000002, "end": 1584.2, "text": " I alluded to at the beginning, this this performance dependence. Now, I have not" }, { "start": 1584.2, "end": 1589.96, "text": " read anything differently in the paper. So I had to assume that they trained" }, { "start": 1589.96, "end": 1595.38, "text": " this here, this number of fresh examples to reach the target is still the target" }, { "start": 1595.38, "end": 1601.64, "text": " that they determined at the beginning. So it's that 3.9 in the table, that 3.9" }, { "start": 1601.64, "end": 1607.3600000000001, "text": " was achieved with this batch size with 1024. And we know especially in language" }, { "start": 1607.3600000000001, "end": 1614.2800000000002, "text": " models that larger batch sizes will lead to a better performance, even if you need" }, { "start": 1614.2800000000002, "end": 1619.4, "text": " let's say more samples. So here you can see that the samples here is 1.5 and" }, { "start": 1619.4, "end": 1625.48, "text": " here it's actually four, because you increase that batch size. So that will" }, { "start": 1625.48, "end": 1633, "text": " tell you something 1.5 and four, that is that is like a times. Okay, that's like" }, { "start": 1633, "end": 1641.4, "text": " an times 2.5. So you go with the batch size of times four, and you need 2.5 more" }, { "start": 1641.4, "end": 1647.2, "text": " more fresh training samples to reach the same target accuracy. First of all, we" }, { "start": 1647.2, "end": 1653, "text": " know that the larger batch sizes can reach higher target accuracies. So again," }, { "start": 1653, "end": 1658.84, "text": " these results, the dependence of them on the actual performance to the" }, { "start": 1658.84, "end": 1665.6, "text": " maximum achievable value, to me that's kind of a shady world here to always" }, { "start": 1665.6, "end": 1672.36, "text": " say, okay, how long does it take to reach that particular target? Because we" }, { "start": 1672.36, "end": 1677.8, "text": " know that this model right here can reach a much higher target, but we don't" }, { "start": 1677.8, "end": 1682.72, "text": " know this about these models here. What is their kind of performance in the limit?" }, { "start": 1682.72, "end": 1688.68, "text": " And they try to make these experiments, but I don't really believe them. Maybe" }, { "start": 1688.68, "end": 1695.68, "text": " yeah. And yes, and the second, right, that will that will be that will that is" }, { "start": 1695.68, "end": 1702.82, "text": " already interesting. So this ratio right here, this 2.5 to 4, this ratio must mean" }, { "start": 1702.82, "end": 1707.72, "text": " something, right? It's it's I go to a higher batch size, four times higher" }, { "start": 1707.72, "end": 1714.64, "text": " batch size, and I need 2.5 many more fresh training samples to reach the same" }, { "start": 1714.64, "end": 1719.48, "text": " target. That must somehow tell you something about the usefulness of a" }, { "start": 1719.48, "end": 1724.96, "text": " single data point versus a succession of data points, right? So it doesn't seem" }, { "start": 1724.96, "end": 1728.64, "text": " because I would expect if each data point was valuable, I would expect this" }, { "start": 1728.64, "end": 1738.48, "text": " to be times four. And if it were if it were times one, so if it were no, no speed" }, { "start": 1738.48, "end": 1744.8400000000001, "text": " up at all, sorry, not times four, if it would be times one, it would mean I'd" }, { "start": 1744.8400000000001, "end": 1748.88, "text": " need the same number of fresh training samples, right? No matter how I batch" }, { "start": 1748.88, "end": 1754.44, "text": " them. But it were times four. That means basically that it doesn't matter really" }, { "start": 1754.44, "end": 1759.48, "text": " how many training points I have in a batch as long as I have enough and the" }, { "start": 1759.48, "end": 1765.8, "text": " 1024 seems to be enough. It just it just matters how many you know SGD steps I do." }, { "start": 1765.8, "end": 1769.92, "text": " So basically, what we're saying SGD isn't getting the most out of these data" }, { "start": 1769.92, "end": 1774.52, "text": " points. And this ratio this 2.5, this this tells you something about the" }, { "start": 1774.52, "end": 1779.0800000000002, "text": " information content of a of an additional data point versus the" }, { "start": 1779.08, "end": 1784.76, "text": " usefulness content of an additional step of SGD. And I would expect that to" }, { "start": 1784.76, "end": 1790.76, "text": " depend to intrinsically be connected to the where the low point of this echoing" }, { "start": 1790.76, "end": 1794.08, "text": " factor is because that's exactly what the echoing does. It trades off" }, { "start": 1794.08, "end": 1800.4399999999998, "text": " freshness of data point versus doing more steps on the on the on the same" }, { "start": 1800.44, "end": 1809.44, "text": " information. And for a paper, especially paper by Google brain, I this this is a" }, { "start": 1809.44, "end": 1815.72, "text": " connection that I would love to see investigated. But enough of the ranting," }, { "start": 1815.72, "end": 1820.16, "text": " they do investigate other things they do investigate, for example, what happens if" }, { "start": 1820.16, "end": 1825.2, "text": " we just up the batch size. And you can see here, yeah, this is interesting in" }, { "start": 1825.2, "end": 1832.48, "text": " the baseline needs more fresh samples as you up the batch size. But and at the" }, { "start": 1832.48, "end": 1836.04, "text": " beginning, this batch echoing, for example, doesn't help doesn't hurt, but" }, { "start": 1836.04, "end": 1840.88, "text": " doesn't help. But as you go to higher and higher batch sizes, this batch echoing" }, { "start": 1840.88, "end": 1848.1200000000001, "text": " starts to help more and more. Again, I believe this is connected to the" }, { "start": 1848.1200000000001, "end": 1852.1200000000001, "text": " usefulness of the single data point, at some point, your batch size is just too" }, { "start": 1852.12, "end": 1858.32, "text": " large for the problem, you'd rather do more steps. And that's why this helps. But" }, { "start": 1858.32, "end": 1865.3999999999999, "text": " also, this model right here might have a higher ceiling accuracy. So indeed is" }, { "start": 1865.3999999999999, "end": 1869.9599999999998, "text": " the question whether this model right here has the same or whether this model" }, { "start": 1869.9599999999998, "end": 1874.2399999999998, "text": " right here, the batch echoing model would actually fall back to the ceiling" }, { "start": 1874.24, "end": 1882.88, "text": " accuracy of one of these models over here. Yeah, in any case, their point is" }, { "start": 1882.88, "end": 1888.64, "text": " basically that as you increase the batch size, this echoing tends to help more" }, { "start": 1888.64, "end": 1895.96, "text": " relatively. Because maybe it's because what I said, right, they say as batch" }, { "start": 1895.96, "end": 1899.36, "text": " size increases, the performance of batch echoing relative to the baseline stays" }, { "start": 1899.36, "end": 1905.8, "text": " either stays the same or improves. While for example, echoing it either stays the" }, { "start": 1905.8, "end": 1910.6799999999998, "text": " same or it gets sorry, while for example, echoing it either stays the same or gets" }, { "start": 1910.6799999999998, "end": 1916.52, "text": " worse. Dashed lines indicate the expected values if repeated examples were as" }, { "start": 1916.52, "end": 1920.52, "text": " useful as fresh examples. Yeah, so I believe there is an intrinsic connection" }, { "start": 1920.52, "end": 1927.9599999999998, "text": " here between the usefulness of more data and usefulness of doing additional steps." }, { "start": 1927.96, "end": 1931.8, "text": " And here the example echoing you can almost see it as more data because" }, { "start": 1931.8, "end": 1936.3600000000001, "text": " especially here you're going to do augmentation on top of it and you see" }, { "start": 1936.3600000000001, "end": 1942.3600000000001, "text": " the non augmented versus the augmented ratio changes dramatically from here to" }, { "start": 1942.3600000000001, "end": 1950.1200000000001, "text": " here. Okay, final set of experiments. As you can tell, this is more mostly an" }, { "start": 1950.1200000000001, "end": 1956, "text": " experimental paper. And it is always easy to criticize experimental papers and" }, { "start": 1956, "end": 1964.56, "text": " rightfully so because I would not trust this very much. But given that it comes" }, { "start": 1964.56, "end": 1971.72, "text": " from a big institution, and it is a very well written paper, I would trust it" }, { "start": 1971.72, "end": 1976.16, "text": " more than I would a regular paper. And I would say if you're in practice, this is" }, { "start": 1976.16, "end": 1983.12, "text": " certainly worth trying. Absolutely. I'm just I just think that some of the" }, { "start": 1983.12, "end": 1988.52, "text": " things aren't aren't researched, like some of my questions aren't answered of" }, { "start": 1988.52, "end": 1995.6399999999999, "text": " this. So they investigate sizes. So they now build shuffle buffers. So we have" }, { "start": 1995.6399999999999, "end": 2001.32, "text": " batch echoing, but they say ah, but we can do batch echoing with shuffle buffers." }, { "start": 2001.32, "end": 2004.84, "text": " So after the batch echoing, right, we have this state where we have the" }, { "start": 2004.84, "end": 2011.28, "text": " batching. And then we have the echoing. So this is our echo buffer, where we" }, { "start": 2011.28, "end": 2016.44, "text": " output the each data point multiple times. And then we have another buffer," }, { "start": 2016.44, "end": 2020.3999999999999, "text": " which is a shuffle buffer, that a shuffle buffer just collects data points and" }, { "start": 2020.3999999999999, "end": 2024.6399999999999, "text": " then shuffles them around before outputting them. And that means even" }, { "start": 2024.6399999999999, "end": 2031.44, "text": " though we you know, output this five times, it might not come out five times" }, { "start": 2031.44, "end": 2036.2, "text": " after each other, it might be that it comes out once, and then another data" }, { "start": 2036.2, "end": 2039.76, "text": " point that was already in the shuffle buffer comes out. And then it will just" }, { "start": 2039.76, "end": 2044.32, "text": " say that in total, it comes out five times. But it is first shuffled together" }, { "start": 2044.32, "end": 2050.92, "text": " with a bunch of other data points. Of course, this uses more memory, but it" }, { "start": 2050.92, "end": 2056.12, "text": " returns to that more IID setting. And you can see here as the buffer size" }, { "start": 2056.12, "end": 2061.52, "text": " increases, then the performance gets more and more to the performance that you" }, { "start": 2061.52, "end": 2066.68, "text": " would have with completely fresh data. Right. So again, trading off freshness" }, { "start": 2066.68, "end": 2075.48, "text": " and freshness and doing multiple steps with by by basically repeating," }, { "start": 2075.96, "end": 2082.12, "text": " repeating data points straight out versus repeating data points shuffled." }, { "start": 2083.3999999999996, "end": 2088.7599999999998, "text": " And also here you have the same with example echoing. So if you apply the" }, { "start": 2088.7599999999998, "end": 2094.3599999999997, "text": " shuffle buffer to example echoing and you increase its size, you can get very," }, { "start": 2094.36, "end": 2101.1600000000003, "text": " very, very close to the performance that you would get with fresh data, which of" }, { "start": 2101.1600000000003, "end": 2105.8, "text": " course, if you increase the shuffle buffer to the size of the data set, you" }, { "start": 2105.8, "end": 2109.96, "text": " are at the situation that's the limit you are at the situation of fresh data," }, { "start": 2110.2000000000003, "end": 2115.48, "text": " right? If you do example echoing. Right. So here is where it gets into the funky" }, { "start": 2115.48, "end": 2121.56, "text": " part, where they say we actually measure the validation cross entropy and the" }, { "start": 2121.56, "end": 2127.4, "text": " validation accuracy versus the number of fresh examples read. And here I want to" }, { "start": 2127.56, "end": 2133.48, "text": " concentrate on the ResNet 50 on ImageNet. And as you can see, most of these" }, { "start": 2133.56, "end": 2139.7999999999997, "text": " models, they pretty much end up in the same place here. It's just that the" }, { "start": 2139.88, "end": 2148.68, "text": " echoing models end up there faster. Right. And this this is, I mean, this is" }, { "start": 2148.68, "end": 2155.48, "text": " where it gets a bit confusing, honestly, because why do you have this super sharp" }, { "start": 2155.48, "end": 2162.2, "text": " thing here? Because usually and here it sort of speeds up in the middle, you see" }, { "start": 2162.2, "end": 2167.48, "text": " you see that and then it kind of sharply declines. Is this maybe because they" }, { "start": 2167.48, "end": 2173.8799999999997, "text": " drop the learning rate or something. Now, my main thing is that the performance" }, { "start": 2173.88, "end": 2181.4, "text": " here even though this target thing is lower than than the even though this" }, { "start": 2181.4, "end": 2185.6400000000003, "text": " target thing is the same for everyone, it is lower than the best reachable" }, { "start": 2185.6400000000003, "end": 2193.48, "text": " accuracy. And I'm I'm just this this is just confusing. If this is really true." }, { "start": 2194.2000000000003, "end": 2202.2000000000003, "text": " Whoa. If this is really true, I think we have a lot to learn about SGD yet and" }, { "start": 2202.2, "end": 2207.24, "text": " how we're not actually doing SGD correctly. And because it seems like" }, { "start": 2207.24, "end": 2214.68, "text": " almost the the echo versions are better or reach a better accuracy than the" }, { "start": 2214.68, "end": 2219.96, "text": " baseline. I don't know, do they just cap it at the performance? I don't think so." }, { "start": 2219.96, "end": 2225.64, "text": " I think they say they let it reach. They also have these things right here." }, { "start": 2225.64, "end": 2229.8799999999997, "text": " These these curves where they say this is the best we reach. And this is the" }, { "start": 2229.88, "end": 2239, "text": " ResNet 32 on C410. Again, 91% on C410 is just very, very low. And I'm almost" }, { "start": 2239, "end": 2244.6800000000003, "text": " thinking that, okay, this might help if you just throw something that we know is" }, { "start": 2244.6800000000003, "end": 2249.96, "text": " kind of overpowered because we can reach 99%. Or at least you can reach" }, { "start": 2249.96, "end": 2256.04, "text": " something like 94% on C410 easily, easily with a network smaller than ResNet 32." }, { "start": 2256.04, "end": 2260.7599999999998, "text": " Maybe this effect manifests if you if you have actually something that could" }, { "start": 2260.7599999999998, "end": 2268.2799999999997, "text": " reach higher, but for some reason you only reach this low. I'm not sure. But" }, { "start": 2268.2799999999997, "end": 2275.56, "text": " this is confusing. And if this is really true. Yeah, I would just if it's true," }, { "start": 2275.56, "end": 2280.36, "text": " which I believe I believe this paper, it might be just an effect of not reaching" }, { "start": 2280.36, "end": 2286.6, "text": " the actual ceiling. And again, look at this. This is just the curves are just" }, { "start": 2286.6, "end": 2293.48, "text": " strange, right? You have the echoing before augmentation, like it seems like" }, { "start": 2293.48, "end": 2301.48, "text": " it's outperforming the the fresh data points. I don't know, there's a little" }, { "start": 2301.48, "end": 2306.44, "text": " bell in my head that doesn't like this. If it's actually true, then you know," }, { "start": 2306.44, "end": 2310.92, "text": " that's cool. But yeah, so my main criticisms are a bit with the" }, { "start": 2310.92, "end": 2315.96, "text": " experimental methodology, for example, where they increase the batch size, but" }, { "start": 2315.96, "end": 2320.36, "text": " still reach the same target accuracy, even though we know that there is a" }, { "start": 2320.36, "end": 2324.68, "text": " higher ceiling if you increase the batch size for language models. My other" }, { "start": 2324.68, "end": 2331.8, "text": " criticism is the non investigation of this connection. This connection right" }, { "start": 2331.8, "end": 2336.84, "text": " here, maybe, but all in all, it's a pretty cool paper. If I had a big company" }, { "start": 2336.84, "end": 2341.32, "text": " with these pipeline issues, I would absolutely implement this. This seems" }, { "start": 2341.32, "end": 2348.52, "text": " like a no brainer to do this and can help you tremendously. Alright, that was" }, { "start": 2348.52, "end": 2352.52, "text": " it. Thank you for listening. If you're still here, subscribe, like, tell a" }, { "start": 2352.52, "end": 2361.8, "text": " friend. Bye bye." } ]
l_3zj6HeWUE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Group Normalization (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "batchnorm", "groupnorm", "layer norm", "group norm", "batch norm", "instance norm", "fair", "normalization", "mean", "standard deviation", "minibatch", "batch statistics", "kernel", "cnn", "convolutional neural network" ]
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 Yuxin Wu and Kaiming 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, 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 you want to center it, first of all, such that 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 Gaussians. So if you look at this distribution, first is the centering and then second is what is called a 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 peaky 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 its standard deviation such that after it, it is a unit standard deviation Gaussian, 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 five three. This is a layer somewhere in the middle of a convolutional neural network. And if you look at the spread of how features feature 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 batch 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 basically backprop 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 guesstimation 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 size 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 4000 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 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 to have two options. If you're 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... Now 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 norm statistics get worse and worse. So the goal of this paper is to find this group norm thing here. The group norm, 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 regimes. 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 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 cube. Now, this cube here, N, means the batch size. So these 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're 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, would 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 operation 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 Ith kernel is going to be convolving the Ith 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 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 batch norm do? Batch norm takes, as you can see here, one channel. And it 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? Batch norm 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, batch norm, I'm not I didn't even know that in convolutional layer this works like this. You can also imagine batch norm 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 batch, 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. Layer norm is different. Layer norm has basically been proposed as an alternative to batch norm with the same reasoning that this paper has. So layer norm, 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 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 NumPy 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 layer norm. 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 than 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 data point at a time. Now, as you can imagine, this doesn't work anymore in 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 here 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, right. 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 so good. We should have, we should normalize the individual features, maybe individually. But 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'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. But you hope that by doing group norm, by basically at a priori, so at the beginning of training, you decide what the groups are. 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, OK, basically all the normalization techniques do this. They subtract a mean and divide by a 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 and 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. So you 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, am I in test 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. These 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 had to do this, even though you know exactly what turns out. So 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, but 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 counteracts 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. Maybe they do. But yeah, it seems like you just kind of have to bring some calmness on 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. 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 on the performance. So if you go a number of groups or here 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 is 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 two of Adam. It's it's always like people never change it from point nine nine nine because it just tends to work. Or whether that's really going to be another hyper parameter 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 to classify an entire video, that's a lot of data. 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 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 a nice day. If you haven't already, please subscribe, like, share, comment or whatever you feel like doing. Bye bye.
[ { "start": 0, "end": 10, "text": " Hi there! Today we'll look at group normalization by Yuxin Wu and Kaiming He of Facebook AI Research." }, { "start": 10, "end": 18, "text": " So this paper is basically an engineering paper about a new normalization technique called group normalization." }, { "start": 18, "end": 27, "text": " So what's the issue here? The issue is that pretty much throughout neural network learning we're using this technique called batch normalization." }, { "start": 27, "end": 33, "text": " Now batch normalization is a pretty reasonable thing and it works very very well." }, { "start": 33, "end": 36, "text": " So what's the idea behind batch normalization?" }, { "start": 36, "end": 47, "text": " The idea is if you have data points for machine learning methods and your data is in a 2D coordinate system somewhere down here," }, { "start": 47, "end": 51, "text": " and you're trying to separate that from the dots which are here," }, { "start": 51, "end": 57, "text": " it is often very beneficial to shift that distribution before you do anything." }, { "start": 57, "end": 61, "text": " You want to shift it to the middle of the..." }, { "start": 61, "end": 71, "text": " Basically you want to center it, first of all, such that the origin point is in the middle of the data." }, { "start": 71, "end": 75, "text": " And then sometimes you also want to do what's called normalize it." }, { "start": 75, "end": 85, "text": " And by normalizing we mean you want to kind of rescale the axis such that things are more or less sort of like Gaussians." }, { "start": 85, "end": 97, "text": " So if you look at this distribution, first is the centering and then second is what is called a normalization." }, { "start": 97, "end": 106, "text": " 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" }, { "start": 106, "end": 110, "text": " with conditioning numbers of the data being better and so on." }, { "start": 110, "end": 119, "text": " 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." }, { "start": 119, "end": 122, "text": " And that's true in general." }, { "start": 122, "end": 129, "text": " So if we draw this in 1D, you'd have a distribution that maybe is very peaky right here." }, { "start": 129, "end": 134, "text": " You first center it to the middle of the coordinate system." }, { "start": 134, "end": 137, "text": " And sorry, that's not really centered." }, { "start": 137, "end": 147, "text": " And then you would divide it by its standard deviation such that after it, it is a unit standard deviation Gaussian, so a normal distribution." }, { "start": 147, "end": 155, "text": " The closer your data seems to be to a multivariate normal distribution, the better these machine learning methods work," }, { "start": 155, "end": 160, "text": " especially if you look at how signal in deep network is propagating through the layers." }, { "start": 160, "end": 172, "text": " 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," }, { "start": 172, "end": 177, "text": " then it's probably good that the input to each layer is normalized." }, { "start": 177, "end": 188, "text": " So when you look at how signal features are in between layers, so this is, for example, the con five three." }, { "start": 188, "end": 193, "text": " This is a layer somewhere in the middle of a convolutional neural network." }, { "start": 193, "end": 200, "text": " And if you look at the spread of how features feature signals are throughout training," }, { "start": 200, "end": 206, "text": " you'll see that the more training progresses, the larger the kind of spread of features is." }, { "start": 206, "end": 215, "text": " So you might get really large numbers or really large negative numbers or maybe really small numbers in your neural networks." }, { "start": 215, "end": 221, "text": " And it would be better if you had a layer and the input you've normalized it right." }, { "start": 221, "end": 228, "text": " And the output then is again a distribution, but it's maybe shifted that you would first transform that back" }, { "start": 228, "end": 234, "text": " into a normal unit, normal distribution before you put it through the next layer." }, { "start": 234, "end": 246, "text": " So what batch 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." }, { "start": 246, "end": 250, "text": " And you can do basically backprop through that." }, { "start": 250, "end": 255, "text": " It's also common to learn bias and variance parameter to add after that." }, { "start": 255, "end": 263, "text": " But the important thing is that after each layer, the data is normalized such that it is kind of in the most comfortable regime." }, { "start": 263, "end": 269, "text": " What's the problem? The problem with this is that you actually need the distribution, right?" }, { "start": 269, "end": 276, "text": " If you want to center this data up here, you need to know what the data is." }, { "start": 276, "end": 282, "text": " So you need to know the entire data. If I want to figure out what is the mean of this distribution," }, { "start": 282, "end": 288, "text": " I need all of the data points to decide here's the mean. I need to shift that up to here." }, { "start": 288, "end": 292, "text": " If I just have a mini batch like we usually do in machine learning." }, { "start": 292, "end": 299, "text": " So if I just have this or this and this and this point, I just have four points. I can't determine the mean." }, { "start": 299, "end": 304, "text": " But what I can do is I can sort of guess the mean from the four points, right?" }, { "start": 304, "end": 309, "text": " So my guesstimation of the mean would be somewhere here. And that would be usually close enough." }, { "start": 309, "end": 319, "text": " 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." }, { "start": 319, "end": 327, "text": " So people have been training neural networks with large batch sizes for basically batch size have gotten larger and larger in the last year." }, { "start": 327, "end": 337, "text": " 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." }, { "start": 337, "end": 341, "text": " And the batch might be large. So this might be, I don't know, one million images." }, { "start": 341, "end": 352, "text": " This might still be 4000 images in your batch. But what they'll do, especially with things like TPUs, is they'll distribute that across many, many, many machines" }, { "start": 352, "end": 359, "text": " into batches of sometimes as small as eight samples per unit." }, { "start": 359, "end": 368, "text": " And 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," }, { "start": 368, "end": 376, "text": " you can sometimes even go down to two or one samples per unit of computation." }, { "start": 376, "end": 382, "text": " And of course, you can't do batch normalization. You can't calculate the mean of one sample." }, { "start": 382, "end": 388, "text": " It's just going to be that one sample itself. So either you have to have two options." }, { "start": 388, "end": 399, "text": " If you're 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." }, { "start": 399, "end": 407, "text": " Or after each layer, you basically do a synchronization step such that everyone communicates to everyone else their statistics." }, { "start": 407, "end": 412, "text": " And you can basically aggregate the statistics across the batch. Both are not cool." }, { "start": 412, "end": 418, "text": " Usually these frameworks, they don't do this synchronization because it's just too slow." }, { "start": 418, "end": 424, "text": " So they'll go with the bad statistics. And you can see this right here in this graph." }, { "start": 424, "end": 428, "text": " They have the ImageNet classification error versus batch sizes." }, { "start": 428, "end": 435, "text": " So this is a ResNet-50 model trained on the ImageNet dataset using eight workers, so eight GPUs." }, { "start": 435, "end": 442, "text": " And if they do 32 images per... Now just look at the blue line here." }, { "start": 442, "end": 450, "text": " If they do 32 images per worker, so it's eight workers, it's eight times 32. That's the batch size." }, { "start": 450, "end": 456, "text": " That is a large number. 256 maybe. Yeah." }, { "start": 456, "end": 466, "text": " All right. So if they do that, then you can see the error is on a state of the art for a ResNet-50." }, { "start": 466, "end": 472, "text": " If they go to 16, it's still pretty good. But then as they go lower and lower and lower," }, { "start": 472, "end": 481, "text": " so if they go to smaller and smaller batches and spread them out over the workers, then the error starts going up." }, { "start": 481, "end": 485, "text": " And this is because the batch norm statistics get worse and worse." }, { "start": 485, "end": 489, "text": " So the goal of this paper is to find this group norm thing here." }, { "start": 489, "end": 496, "text": " The group norm, this paper claims, is another normalization technique that pretty much does the same thing," }, { "start": 496, "end": 506, "text": " this centering and the normalization, the scaling. But it does it without relying on the batch statistics." }, { "start": 506, "end": 511, "text": " It basically does it within a data point. And that means that the performance," }, { "start": 511, "end": 516, "text": " even though it's a bit smaller at the beginning for this particular example," }, { "start": 516, "end": 521, "text": " will stay constant with even in small batch size regimes." }, { "start": 521, "end": 528, "text": " So this is potentially applicable, as I said, to things where you have to go to like two or one sample per worker," }, { "start": 528, "end": 534, "text": " because it's just the data points, the single data points are just too large." }, { "start": 534, "end": 541, "text": " So if you maybe want to train something like BERT on a GPU." }, { "start": 541, "end": 548, "text": " So what is group normalization? Group normalization, as I said, works within a sample." }, { "start": 548, "end": 553, "text": " Now, there have been other methods that work within a sample instead of across the batch." }, { "start": 553, "end": 557, "text": " And they tend to not work as well as batch norm." }, { "start": 557, "end": 563, "text": " Now, this paper here claims that group norm works on par with batch norm for large batch sizes" }, { "start": 563, "end": 569, "text": " and better than on small batch sizes. So here they have a schematic of what's happening." }, { "start": 569, "end": 573, "text": " In batch norm, as you can see here, you have this cube." }, { "start": 573, "end": 580, "text": " Now, this cube here, N, means the batch size. So these are the data points." }, { "start": 580, "end": 590, "text": " Points in your mini batch. This is the thing that is going to get small in the if you don't have enough memory." }, { "start": 590, "end": 594, "text": " Then C would be your channels." }, { "start": 594, "end": 604, "text": " So we are talking about convolutional neural networks here, but this is generalizable to other neural networks." }, { "start": 604, "end": 609, "text": " The channels are going to be the independent feature maps that you're going to have." }, { "start": 609, "end": 614, "text": " So in a convolutional neural network, usually each layer has these things called kernels." }, { "start": 614, "end": 617, "text": " And there might be three by three matrices like this." }, { "start": 617, "end": 623, "text": " And if you have an image, the kernel will be slided." }, { "start": 623, "end": 629, "text": " This thing right here will be maybe here will be slided across the image or slid. Is it slid?" }, { "start": 629, "end": 631, "text": " Okay, would be slid across the image." }, { "start": 631, "end": 634, "text": " And then the numbers in here will be convolved with the pixels." }, { "start": 634, "end": 639, "text": " And that will give you the next layers representation." }, { "start": 639, "end": 643, "text": " So whatever the operation convolution operation is, and you'll slide that over." }, { "start": 643, "end": 647, "text": " And that sliding over will give you the values in the next layer." }, { "start": 647, "end": 652, "text": " Now you not only have one kernel, but you actually have many kernels." }, { "start": 652, "end": 655, "text": " Sorry about this. Let's draw that." }, { "start": 655, "end": 665, "text": " So you have more and more kernels." }, { "start": 665, "end": 672, "text": " You have a whole stack of kernels. And how many kernels you have, those are the different kernels are also called your different channels." }, { "start": 672, "end": 676, "text": " Now, the kernels refer to the weights and the channels refer to the image." }, { "start": 676, "end": 681, "text": " But the Ith kernel is going to be convolving the Ith channel of the image." }, { "start": 681, "end": 687, "text": " So at the beginning, the input image has three channels because red, green and blue." }, { "start": 687, "end": 697, "text": " But then the intermediate images can have more channels as you have basically as many as you have kernels in the layer right before." }, { "start": 697, "end": 703, "text": " Okay, and the H and the W means the height and width of the image." }, { "start": 703, "end": 709, "text": " So it combined so the image is kind of unrolled across the height or the width in this direction." }, { "start": 709, "end": 711, "text": " So what does batch norm do?" }, { "start": 711, "end": 716, "text": " Batch norm takes, as you can see here, one channel." }, { "start": 716, "end": 720, "text": " And it it takes one channel." }, { "start": 720, "end": 723, "text": " So maybe this image, this is one channel." }, { "start": 723, "end": 727, "text": " Let's just say this is the red channel because I drawn it in red." }, { "start": 727, "end": 736, "text": " It takes that and it calculates the mean one over and the standard deviation of that." }, { "start": 736, "end": 742, "text": " It calculates those two statistics and it uses that to do this centering and scaling operation." }, { "start": 742, "end": 748, "text": " So all of these methods are going to calculate the mean and the variance and then do the same scaling transformation." }, { "start": 748, "end": 752, "text": " The question is just how do you calculate the mean?" }, { "start": 752, "end": 754, "text": " Batch norm does this across the data points." }, { "start": 754, "end": 761, "text": " So it looks at a single feature at a single channel and it asks what's the mean across all the data points?" }, { "start": 761, "end": 769, "text": " What are the data statistics of this channel and what was the mean and standard deviation?" }, { "start": 769, "end": 775, "text": " Now, actually, batch norm, I'm not I didn't even know that in convolutional layer this works like this." }, { "start": 775, "end": 779, "text": " You can also imagine batch norm of really just taking one single feature." }, { "start": 779, "end": 785, "text": " And that means of really just taking one of these things right here." }, { "start": 785, "end": 794, "text": " 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." }, { "start": 794, "end": 800, "text": " So it looks at your batch, looks at the mean and the variance in that batch and it normalizes by that." }, { "start": 800, "end": 805, "text": " I think convolutional layers make sense because you have this invariance in height and width and therefore." }, { "start": 805, "end": 807, "text": " Yeah, so that makes sense." }, { "start": 807, "end": 813, "text": " But in a fully connected layer, you'd simply go look at one feature at a time." }, { "start": 813, "end": 815, "text": " Layer norm is different." }, { "start": 815, "end": 821, "text": " Layer norm has basically been proposed as an alternative to batch norm with the same reasoning that this paper has." }, { "start": 821, "end": 827, "text": " So layer norm, as you can see here, it does each data point individually." }, { "start": 827, "end": 833, "text": " So here we only have one data point that is normalized by itself." }, { "start": 833, "end": 839, "text": " So you do this for each data point independently and therefore it's not dependent on the batch size anymore." }, { "start": 839, "end": 844, "text": " But what you'll do is you look across all of the channels right here." }, { "start": 844, "end": 848, "text": " So all of the channels and all of the width and height." }, { "start": 848, "end": 854, "text": " So this entire thing here, this entire thing is basically one channel." }, { "start": 854, "end": 859, "text": " Right. And then the next channel is here of the image and the next." }, { "start": 859, "end": 862, "text": " No, that's the next image." }, { "start": 862, "end": 867, "text": " Well, that is a bad drawing because the image is unrolled." }, { "start": 867, "end": 872, "text": " In any case, what you'll do is you look at." }, { "start": 872, "end": 878, "text": " So if you have a filter bank like this, you have an image and the image composed of multiple channels." }, { "start": 878, "end": 880, "text": " Right. This is the red." }, { "start": 880, "end": 883, "text": " And then you'll have the green." }, { "start": 883, "end": 885, "text": " Right. This is in the green." }, { "start": 885, "end": 890, "text": " And then you'll have the blue channel." }, { "start": 890, "end": 898, "text": " And what you'll do is simply you'll calculate the mean across all of the pixels." }, { "start": 898, "end": 905, "text": " And across all of the channels, you just take this whole NumPy array and you just say dot mean." }, { "start": 905, "end": 907, "text": " And that gives you one number." }, { "start": 907, "end": 912, "text": " And it's just whatever that number is, you subtract it and then you say standard deviation and you divide by that." }, { "start": 912, "end": 913, "text": " That's layer norm." }, { "start": 913, "end": 920, "text": " So an entire layers representation of one image is just normalized to the mean." }, { "start": 920, "end": 922, "text": " Now, this seems a bit drastic." }, { "start": 922, "end": 926, "text": " And that's why instance norm did the exact opposite." }, { "start": 926, "end": 935, "text": " They said, wait a minute, instead of normalizing across all of the features, right, we'll go back and do what batch norm does." }, { "start": 935, "end": 937, "text": " Batch norm looks at each feature individually." }, { "start": 937, "end": 942, "text": " So basically, it looks at all of these these different axes in the data distribution." }, { "start": 942, "end": 943, "text": " It looks at them differently." }, { "start": 943, "end": 954, "text": " So if one axis is scaled very widely, we want to normalize that differently than if than the other axis that is just scaled very shortly." }, { "start": 954, "end": 959, "text": " And that's why we'll look at each feature individually like batch norm." }, { "start": 959, "end": 962, "text": " But also, we only look at one data point at a time." }, { "start": 962, "end": 969, "text": " Now, as you can imagine, this doesn't work anymore in in a fully connected network." }, { "start": 969, "end": 974, "text": " This basically works in a convolutional network where you have a feature map channel." }, { "start": 974, "end": 980, "text": " So you look at one individual channel and one data point." }, { "start": 980, "end": 985, "text": " So that means here you would normalize the red channel individually." }, { "start": 985, "end": 990, "text": " You would normalize the green channel individually and you normalize the blue channel individually." }, { "start": 990, "end": 1000, "text": " 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." }, { "start": 1000, "end": 1002, "text": " And just within that data point, right." }, { "start": 1002, "end": 1010, "text": " So maybe I should here say across the number of features or something." }, { "start": 1010, "end": 1012, "text": " So I hope that that's clear." }, { "start": 1012, "end": 1021, "text": " So the layer norm drops the dependence on the batch size, but instead says we should normalize across all of the features." }, { "start": 1021, "end": 1030, "text": " 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." }, { "start": 1030, "end": 1032, "text": " And we should account for that." }, { "start": 1032, "end": 1036, "text": " But also, we don't want to be dependent on the batch size." }, { "start": 1036, "end": 1038, "text": " And now is this where group norm comes in?" }, { "start": 1038, "end": 1043, "text": " Group norm is basically a mix between layer norm and instance norm." }, { "start": 1043, "end": 1048, "text": " What group norm says, layer norm and instance norm have good ideas." }, { "start": 1048, "end": 1051, "text": " They only go across one sample." }, { "start": 1051, "end": 1052, "text": " They take that." }, { "start": 1052, "end": 1064, "text": " 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." }, { "start": 1064, "end": 1071, "text": " You might get not good enough statistics because you're now normalizing each of these things individually." }, { "start": 1071, "end": 1073, "text": " Whereas with layer norm, you're too restricted." }, { "start": 1073, "end": 1083, "text": " You're basically saying that the features, it's fine if the features relative to each other are like this, right." }, { "start": 1083, "end": 1086, "text": " One is maybe very high variance and one is very low variance." }, { "start": 1086, "end": 1088, "text": " Feature norm would keep that." }, { "start": 1088, "end": 1091, "text": " And group norm would say, maybe that's not so good." }, { "start": 1091, "end": 1096, "text": " We should have, we should normalize the individual features, maybe individually." }, { "start": 1096, "end": 1107, "text": " But their argumentation here is that maybe there are some features that by their nature already have the same sort of scaling and variance." }, { "start": 1107, "end": 1109, "text": " They give an example." }, { "start": 1109, "end": 1119, "text": " 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." }, { "start": 1119, "end": 1121, "text": " So a horizontal edge filter." }, { "start": 1121, "end": 1123, "text": " So it's very low value here." }, { "start": 1123, "end": 1126, "text": " And let me mark the high value with blue." }, { "start": 1126, "end": 1129, "text": " So this is a horizontal edge filter." }, { "start": 1129, "end": 1140, "text": " 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." }, { "start": 1140, "end": 1141, "text": " Or vice versa." }, { "start": 1141, "end": 1146, "text": " So it will give you very positive and very negative number every time you slide across an edge." }, { "start": 1146, "end": 1161, "text": " 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." }, { "start": 1161, "end": 1169, "text": " So the horizontal and the vertical edge filter, you'll see whatever their response is, they're probably about equal in size." }, { "start": 1169, "end": 1178, "text": " So we could expect that in a neural network, there will be groups of filters that together exhibit the same scale." }, { "start": 1178, "end": 1184, "text": " And therefore we can normalize across them like in layer norm." }, { "start": 1184, "end": 1188, "text": " So the more things we normalize across, the better statistics we can gather." }, { "start": 1188, "end": 1195, "text": " That's why instance norm doesn't work because it only normalizes across a very small thing, getting very little statistics." }, { "start": 1195, "end": 1204, "text": " But we should normalize, if we could gather good statistics, we should normalize different features differently." }, { "start": 1204, "end": 1211, "text": " And group norm says, well, since some of the features are almost guaranteed to behave the same, we could normalize across those." }, { "start": 1211, "end": 1216, "text": " Now, of course, you don't know at the beginning which ones those are." }, { "start": 1216, "end": 1226, "text": " But you hope that by doing group norm, by basically at a priori, so at the beginning of training, you decide what the groups are." }, { "start": 1226, "end": 1231, "text": " And naturally, it's just whichever ones are next to each other, those are the groups." }, { "start": 1231, "end": 1239, "text": " And you'll hope that through the training procedure, basically those groups will learn the features that are equal of size." }, { "start": 1239, "end": 1246, "text": " Well, you basically enforce that, so you kind of constrain the architecture to do that." }, { "start": 1246, "end": 1249, "text": " So that's the idea behind group norm." }, { "start": 1249, "end": 1258, "text": " You basically build these groups of channels and then you normalize across those, across the groups of, within the groups of channels," }, { "start": 1258, "end": 1264, "text": " across the entire height and width, only in a single data point." }, { "start": 1264, "end": 1270, "text": " And therefore, you gain the advantage of layer norm, of normalizing within a single data point." }, { "start": 1270, "end": 1278, "text": " You retain the advantage of batch norm, of normalizing across single features." }, { "start": 1278, "end": 1281, "text": " And that's what instance norm attempted." }, { "start": 1281, "end": 1285, "text": " But yeah, so you get the best of both worlds, sort of." }, { "start": 1285, "end": 1287, "text": " That's group norm." }, { "start": 1287, "end": 1291, "text": " And now we go and look what it does." }, { "start": 1291, "end": 1294, "text": " So they say, OK, basically all the normalization techniques do this." }, { "start": 1294, "end": 1296, "text": " They subtract a mean and divide by a standard deviation." }, { "start": 1296, "end": 1298, "text": " That's what we saw." }, { "start": 1298, "end": 1303, "text": " And the difference is just across what you collect, your statistics." }, { "start": 1303, "end": 1308, "text": " So the group norm is the following code in TensorFlow." }, { "start": 1308, "end": 1316, "text": " As you can see, you simply reshape your data and basically expand this part right here where you built, where you put the extra." }, { "start": 1316, "end": 1318, "text": " So this is C." }, { "start": 1318, "end": 1324, "text": " This entire thing used to be C. And you divide it into group and index within group." }, { "start": 1324, "end": 1331, "text": " And then you just normalize across that and reshape to the original dimension again." }, { "start": 1331, "end": 1339, "text": " And the important, the cool thing is in batch norm, you have to keep track of these, of these running means," }, { "start": 1339, "end": 1343, "text": " because at test time, you sort of don't want the batch statistic to influence anything." }, { "start": 1343, "end": 1345, "text": " You don't have that here." }, { "start": 1345, "end": 1349, "text": " So you just back propagate through this observation, through this operation." }, { "start": 1349, "end": 1353, "text": " And you don't need to keep these running, running averages going." }, { "start": 1353, "end": 1357, "text": " And you always care, am I in test or am I in train mode right now?" }, { "start": 1357, "end": 1358, "text": " You just do this." }, { "start": 1358, "end": 1361, "text": " This operation is per data point." }, { "start": 1361, "end": 1363, "text": " So it's just part of your model." }, { "start": 1363, "end": 1365, "text": " Right." }, { "start": 1365, "end": 1372, "text": " And they do a an experiment where they have 32 images per GPU." }, { "start": 1372, "end": 1374, "text": " So it's reasonably sized." }, { "start": 1374, "end": 1381, "text": " And they can basically show that the group norm and the batch norm, they compare in their performance." }, { "start": 1381, "end": 1388, "text": " Now, I do usually don't believe the experiments that you see in single papers." }, { "start": 1388, "end": 1391, "text": " But I think this has been replicated a couple of times." }, { "start": 1391, "end": 1395, "text": " Now, you see, this is the train error where group norm even behaves a bit better." }, { "start": 1395, "end": 1398, "text": " And then in the validation error, it behaves a bit worse." }, { "start": 1398, "end": 1408, "text": " 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." }, { "start": 1408, "end": 1410, "text": " These instance norm and layer norm." }, { "start": 1410, "end": 1415, "text": " So it at least it's better than instance norm and layer norm." }, { "start": 1415, "end": 1423, "text": " And then once you go into the smaller batch size regime, of course, that's where the group norm starts to shine." }, { "start": 1423, "end": 1431, "text": " 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." }, { "start": 1431, "end": 1436, "text": " And I believe they could even do one image per GPU with group norm." }, { "start": 1436, "end": 1441, "text": " But of course, you can't do that with batch norm because you need batch statistics." }, { "start": 1441, "end": 1446, "text": " You can see that the performance of batch norm degrades drastically." }, { "start": 1446, "end": 1450, "text": " Whereas with group norm, this experiment is just funny." }, { "start": 1450, "end": 1454, "text": " They just had to do this, even though you know exactly what turns out." }, { "start": 1454, "end": 1459, "text": " So look at the lines are all exactly in the in the same place." }, { "start": 1459, "end": 1468, "text": " I mean, come on, like, you know, you're just having time to probably one of the reviewers was like, but did you really do the experiment?" }, { "start": 1468, "end": 1472, "text": " They put it in." }, { "start": 1472, "end": 1474, "text": " So, yeah." }, { "start": 1474, "end": 1482, "text": " So you can see that the batch norm beats the group norm in this setting with the when you have the larger batch sizes." }, { "start": 1482, "end": 1488, "text": " But the group norm pulls ahead quite drastically when you have the smaller batch sizes." }, { "start": 1488, "end": 1490, "text": " And that is the main advantage." }, { "start": 1490, "end": 1498, "text": " So now you can turn to models that require small batch sizes or small batch per worker." }, { "start": 1498, "end": 1505, "text": " And generally, it's a pain in the ass to just keep track of those statistics for test time." }, { "start": 1505, "end": 1514, "text": " They do verify, which I find pretty cool, that this phenomenon of the responses going apart during training in the internal feature maps," }, { "start": 1514, "end": 1517, "text": " batch norm counteracts that." }, { "start": 1517, "end": 1522, "text": " So with batch norm, you'll get actually a convergence of responses during training." }, { "start": 1522, "end": 1528, "text": " So the more you train, the more normalized basically your internal features will be." }, { "start": 1528, "end": 1531, "text": " And they show that this is exactly the same with group norm." }, { "start": 1531, "end": 1535, "text": " So group norm is as it seems, it is a replacement." }, { "start": 1535, "end": 1537, "text": " It's not an addition." }, { "start": 1537, "end": 1540, "text": " It doesn't the gains don't come from different place." }, { "start": 1540, "end": 1549, "text": " It seems to be a substitute for batch norm, though they don't have an experiment where they do both." }, { "start": 1549, "end": 1551, "text": " I believe maybe I'm wrong." }, { "start": 1551, "end": 1554, "text": " Maybe they do." }, { "start": 1554, "end": 1560, "text": " But yeah, it seems like you just kind of have to bring some calmness on some standardization into your signal." }, { "start": 1560, "end": 1572, "text": " 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." }, { "start": 1572, "end": 1573, "text": " Yeah." }, { "start": 1573, "end": 1580, "text": " What I don't like about this is now you have, of course, a new hyper parameter, which is this number of groups." }, { "start": 1580, "end": 1583, "text": " So that that seems rather annoying." }, { "start": 1583, "end": 1589, "text": " And the gains like this usually come from the introductions of new hyper parameters." }, { "start": 1589, "end": 1600, "text": " 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." }, { "start": 1600, "end": 1613, "text": " 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 on the performance." }, { "start": 1613, "end": 1619, "text": " So if you go a number of groups or here number of channels per group, of course, these two numbers are inversely related." }, { "start": 1619, "end": 1622, "text": " The more groups you have, the less number of channels per group you have." }, { "start": 1622, "end": 1627, "text": " If you go to one extreme, you will get to the layer norm, basically." }, { "start": 1627, "end": 1632, "text": " So the layer norm is an extreme case of group norm where you just have one group." }, { "start": 1632, "end": 1634, "text": " All the channels are in the same group." }, { "start": 1634, "end": 1638, "text": " Then the performance, as you can see here, is quite a bit worse." }, { "start": 1638, "end": 1644, "text": " If you go to the other extreme where every channel is its own group, that's equivalent to instance norm." }, { "start": 1644, "end": 1647, "text": " Again, the performance is quite bad." }, { "start": 1647, "end": 1654, "text": " And somewhere in the middle here with 32 groups is seems to be a good sweet spot." }, { "start": 1654, "end": 1664, "text": " 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." }, { "start": 1664, "end": 1673, "text": " 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 two of Adam." }, { "start": 1673, "end": 1680, "text": " It's it's always like people never change it from point nine nine nine because it just tends to work." }, { "start": 1680, "end": 1684, "text": " Or whether that's really going to be another hyper parameter to fit." }, { "start": 1684, "end": 1687, "text": " That seems to be annoying." }, { "start": 1687, "end": 1694, "text": " They do a bunch of ablation studies and tests on, as we said, the, for example, object detection and segmentation." }, { "start": 1694, "end": 1703, "text": " So so models where you must go almost to small batch sizes just because so video classification." }, { "start": 1703, "end": 1707, "text": " So if you want to classify an entire video, that's a lot of data." }, { "start": 1707, "end": 1711, "text": " And you almost have to go small batch sizes for that." }, { "start": 1711, "end": 1713, "text": " They do a lot of experiments." }, { "start": 1713, "end": 1722, "text": " And generally, as I said, I believe these results for group norm have been replicated and across the community a bunch of times now." }, { "start": 1722, "end": 1732, "text": " And I would definitely consider group norm if you are thinking of a especially a distributed machine learning project." }, { "start": 1732, "end": 1735, "text": " All right. With that, I hope you enjoyed this paper." }, { "start": 1735, "end": 1737, "text": " I've been talking for way too long now." }, { "start": 1737, "end": 1739, "text": " I wish you a nice day." }, { "start": 1739, "end": 1745, "text": " If you haven't already, please subscribe, like, share, comment or whatever you feel like doing." }, { "start": 1745, "end": 1766, "text": " Bye bye." } ]
Cs_j-oNwGgg
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Concept Learning with Energy-Based Models (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "openai", "ebm", "energy function", "gradient descent", "relational neural network", "latent", "attention", "entities", "spatial relation", "inference time", "reasoning", "demonstration" ]
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 points 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 Mordac 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 0. And if the energy function is not happy with X it will be a high value, like larger than 0. 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 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 0 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 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, 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 a true label, we actually input like a distribution, softmax distribution over labels, and that's 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 model 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. 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 points, so the data points form the valleys right here. And then the generator will basically take that discriminator function and will try to infer points that are also in these valleys, to produce points that are also in the valleys. 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. 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 the concept of what an energy function is is a bit clear. 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's goal? The generator's goal is to hit those valleys in the energy function. And we produce a generator in one shot to produce this data. But what 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 I don't know if people... I guess people have trained GANs 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, we could simply gradient descent on the label 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, I can infer the last thing simply by gradient descent on my energy function. Because I know the energy function is zero 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'm given any of those two, any two of those three things, I can find a compatible third thing by descending. And then of course over here in these machine learning problems, the task was always actually to learn an energy function. So usually in the training data set 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're given all of the inputs in our training data set, and our training data 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're 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. 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 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 situation, so the same X, the same attention mask, but a different concept, so a different W vector right here, then the energy function would be maybe very happy if the two things are far apart 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 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, so 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 in embedding space, but the embedding is for a line, right? So 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 concepts are 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 state that makes this energy function happy. Now this here you would call the starting state, the X zero, 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 form a line. 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 and 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 once you see. So they specifically, or this author, I think it's a 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 identify two. So here is where you have given the initial state and an attention mask and you want to find the x1, 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 are pushed around until they make a square, because the concept right now is square. And in the other case, where you are given this x0 and x1, 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 you're tasked 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 a GAN, 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 xk 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, ha, this is square. Now the model isn't going to output square, the model is going to output a vector representation of square. 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, mister or missus 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, oh these four here are the a. So 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 two entities to each other with the concept vector, and then this is 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 computational, 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 ever have produced models that one shot produce something. And here, we, this is a, I believe this is a new concept where you use gradient 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 the 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 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 is it here. But no one has told me this. I just looked at the picture. So 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 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 an initial situation, and you're supposed to infer the X1 and the A. And the loss function is simply the negative log likelihood of that. But what does that mean? So we'll make it easier. If you have this procedure right here, where you have a demo event, this up here, 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. 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 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 A0. 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 learning. 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, we just write a little generator that will, you know, make this situation that knows what the concept is, right? It will say, okay, I'm gonna make an example for a square, then it will 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, right? 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, 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 ResNet 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 ResNet, 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 back propping through optimization procedures, a whole lot of these things will become the new a new wave in machine learning. I really I'm excited by this. I'm pretty sure it doesn't work yet. And this is very fiddly, fiddly work. But I'm excited by the prospect that we can do this. So this is the training procedure, right? You are given x0, x1, and a, and you optimize in order to infer the concept behind it, right? The generator 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 x0 and x1 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. The experiments are actually pretty cool. So what they've done is, for example, taken 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 attention on it. 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, which means you infer the a, then it will simply tell you that this ball right here is the furthest away from the x. 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 now blue, and of course the color, you can gradient descent on the colors, you need to make it red. And since the energy function, it just takes three input x, a and w. You're not gonna tell it right now in which situation you are. It has to create this w embedding space through learning. And if you do it with those two concepts, then it will put the make something red concept and the is something red concepts in the same places. So this is a PCA. And in blue, I think these blue is the attention codes for identify the red things. And in red are 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 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 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. 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 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 autoregressive model in NLP versus a non autoregressive 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 come produce independent or 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 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 concept. 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 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 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 roboty and stuff but the problem here is not really different. It's not real-world transfer or anything. So yeah let's go through some of the things they can learn with this. So you can see here they can learn these regional geometric shapes and on the left is the example event that the model needs to take the concept from. Now this is I believe very much identification. So what they did is they trained with a data set where all of these appear. 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 those things were in the training data set. It would be nice to see how this generalizes 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 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. It 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. Again 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 you have the recognition for the same task. You need to identify the ball that is closer. Here you really also see the optimization procedure in action. Where for example at the beginning of each flicker you kind of see the attention being everywhere and then stabilizing to one or two points. So if two points are equally close or far apart you'll see the attention being on multiple points. Which is pretty cool right? So that means the model really learns 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 is the part that I'm not really impressed with but you know 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, "end": 5.84, "text": " Hi there, what you're seeing here is an energy-based model that learns the" }, { "start": 5.84, "end": 11.92, "text": " concept of a shape from a demonstration on the left. So on the left you can see a" }, { "start": 11.92, "end": 17.84, "text": " demonstration of data points sampled from a shape, in these cases circles or" }, { "start": 17.84, "end": 23.12, "text": " squares, and then the corresponding energy function that the model infers" }, { "start": 23.12, "end": 28.6, "text": " from that. And then it can replicate that shape on the right using that energy" }, { "start": 28.6, "end": 33.760000000000005, "text": " function. So the paper we're going to analyze today is called Concept Learning" }, { "start": 33.760000000000005, "end": 40.480000000000004, "text": " with Energy-Based Models by Igor Mordac of OpenAI. And this is a very cool paper," }, { "start": 40.480000000000004, "end": 45.2, "text": " or at least I think it's a very cool paper, but it is also a very hard paper." }, { "start": 45.2, "end": 51.84, "text": " So therefore first I want to kind of make a bit of an introduction into the" }, { "start": 51.84, "end": 56.72, "text": " concepts that we are facing in this paper. So the first thing you need to" }, { "start": 56.72, "end": 61.04, "text": " know are energy functions or energy-based models. What is an energy" }, { "start": 61.04, "end": 67.44, "text": " function? An energy function, sometimes called E, is simply a function with one" }, { "start": 67.44, "end": 73.2, "text": " or multiple inputs, let's call them X. And you can make the... if the energy" }, { "start": 73.2, "end": 79.72, "text": " function is happy with X it will be the value 0. And if the energy function is" }, { "start": 79.72, "end": 88.48, "text": " not happy with X it will be a high value, like larger than 0. So this is happy, this" }, { "start": 88.48, "end": 94.68, "text": " is not happy. So let's give some examples of this. We can formulate almost any" }, { "start": 94.68, "end": 99.12, "text": " machine learning problem in terms of an energy function. Let's say we have a" }, { "start": 99.12, "end": 110.80000000000001, "text": " classifier. The classifier takes as an input an image here, maybe of a cat, and a" }, { "start": 110.80000000000001, "end": 118.68, "text": " label. So if the label is cat then the energy will be 0 if the energy function" }, { "start": 118.68, "end": 124.44, "text": " is of course working correctly. And if we give the energy function the same" }, { "start": 124.44, "end": 132.04, "text": " image but we give it a wrong label, dog, then it is very high. In the case of the" }, { "start": 132.04, "end": 137.8, "text": " classifier of course we can simply take the loss function as the energy function" }, { "start": 137.8, "end": 141.52, "text": " and we automatically get an energy-based model. So the loss function here" }, { "start": 141.52, "end": 149.48, "text": " would be something like the negative log probability of the correct class." }, { "start": 149.48, "end": 155.35999999999999, "text": " But in any case it is just going to be a high number, let's call it 10 to the 9." }, { "start": 155.35999999999999, "end": 161.92, "text": " So the energy function says, this is very bad, this thing here is" }, { "start": 161.92, "end": 167.2, "text": " very bad, the entire thing you input. It won't tell you yet what's bad about it." }, { "start": 167.2, "end": 172.67999999999998, "text": " So that also means you can change any of the two things to make the classifier" }, { "start": 172.67999999999998, "end": 176.72, "text": " happy. Now usually we're concerned with changing the label. It's like, tell me" }, { "start": 176.72, "end": 183.44, "text": " which other label do I need to input to make you happy? And if we make the labels" }, { "start": 183.44, "end": 187.76, "text": " differentiable, of course we never input a true label, we actually input like a" }, { "start": 187.76, "end": 193.32, "text": " distribution, softmax distribution over labels, and that's differentiable." }, { "start": 193.32, "end": 199.8, "text": " We can use gradient descent to update the dog label, we can use gradient descent" }, { "start": 199.8, "end": 204.68, "text": " to find a label that would make the energy function more happy. So we could" }, { "start": 204.68, "end": 213.36, "text": " use gradient descent to get the cat level if we had a good classifier. But we can" }, { "start": 213.36, "end": 220.28, "text": " also optimize the image to make it compatible with the dog label." }, { "start": 220.28, "end": 224.84, "text": " That's things that if you ever saw deep dream or something like this, those" }, { "start": 224.84, "end": 230.28, "text": " models do exactly that, they optimize the input image for a particular label." }, { "start": 230.28, "end": 234.60000000000002, "text": " And there you can view the entire neural network including the loss function" }, { "start": 234.6, "end": 243.56, "text": " as the energy function. So what's another example? Another example is, let's say" }, { "start": 243.56, "end": 249.6, "text": " you have a k-means model, and the energy function simply input a data point." }, { "start": 249.6, "end": 255.07999999999998, "text": " And for the data point, what you're going to do is you're going to find the min" }, { "start": 255.07999999999998, "end": 260.88, "text": " cluster index, the min k, over, you know, you have your multiple clusters here and" }, { "start": 260.88, "end": 265, "text": " your data point might be here, so you're going to find the cluster that's closest" }, { "start": 265, "end": 272.64, "text": " and then the distance here, this distance d, will be the energy of that. So the" }, { "start": 272.64, "end": 277.76, "text": " model is very happy when your data point comes from one of the clusters, but your" }, { "start": 277.76, "end": 281.28, "text": " model is not happy when the data point is far away. And that would be the cost" }, { "start": 281.28, "end": 285.64, "text": " function of the k-means function. So that's an energy-based model too. Now" }, { "start": 285.64, "end": 290.56, "text": " currently energy-based models have come into fashion through things like GANs or" }, { "start": 290.56, "end": 298.04, "text": " any sort of noise contrastive estimation. So in a GAN, what you" }, { "start": 298.04, "end": 303.68, "text": " have is you have a discriminator. And the discriminator will basically learn a" }, { "start": 303.68, "end": 310.4, "text": " function to differentiate data from non-data. So that by itself is an energy" }, { "start": 310.4, "end": 314.68, "text": " function. The discriminator will learn a function and that function will be low" }, { "start": 314.68, "end": 320.88, "text": " wherever the discriminator thinks there is data. So it will usually do" }, { "start": 320.88, "end": 324.92, "text": " this around the data points, so the data points form the valleys right here. And" }, { "start": 324.92, "end": 330.96000000000004, "text": " then the generator will basically take that discriminator function and will try" }, { "start": 330.96000000000004, "end": 336.56, "text": " to infer points that are also in these valleys, to produce points that are also" }, { "start": 336.56, "end": 343.24, "text": " in the valleys. And then you basically have an energy learning competition. The" }, { "start": 343.24, "end": 349.12, "text": " discriminator now tries to push down on the energy where the true data is and" }, { "start": 349.12, "end": 354.44, "text": " push up on the energy where the generated data is. And that will give you" }, { "start": 354.44, "end": 362.72, "text": " basically a steeper energy-based function in the future. So in this" }, { "start": 362.72, "end": 368.52, "text": " case the discriminator neural network is the energy function. And the" }, { "start": 368.52, "end": 373.76, "text": " degenerator just tries to produce data that is compatible with that energy" }, { "start": 373.76, "end": 377.64, "text": " function. So I hope that the concept of what an energy function is is a bit" }, { "start": 377.64, "end": 382.91999999999996, "text": " clear. Again any machine learning problem can be formulated in terms of" }, { "start": 382.91999999999996, "end": 388.59999999999997, "text": " an energy function. Now what is not done so far is what we alluded to a little" }, { "start": 388.59999999999997, "end": 395.84, "text": " bit before in the classifier example and also here. So right now when we want to" }, { "start": 395.84, "end": 402.4, "text": " train again we simply take the generator to produce data. Now what's the" }, { "start": 402.4, "end": 406.71999999999997, "text": " generator's goal? The generator's goal is to hit those valleys in the energy" }, { "start": 406.71999999999997, "end": 411.88, "text": " function. And we produce a generator in one shot to produce this data. But" }, { "start": 411.88, "end": 417.15999999999997, "text": " what we could also do is of course we could just start somewhere. Let's say" }, { "start": 417.15999999999997, "end": 421.96, "text": " here we pick a random data point and then we use gradient descent because the" }, { "start": 421.96, "end": 427.2, "text": " energy function in this case is smooth. We use gradient descent to just drop" }, { "start": 427.2, "end": 433.23999999999995, "text": " down this valley and then find ourselves in this valley. So without ever training" }, { "start": 433.23999999999995, "end": 438.76, "text": " a generator we can use this methods to produce points that are in the valley of" }, { "start": 438.76, "end": 445.28, "text": " the energy function. And I don't know if people... I guess people have" }, { "start": 445.28, "end": 448.97999999999996, "text": " trained GANs like this. The reason why it doesn't work let's say in the real" }, { "start": 448.98, "end": 454.08000000000004, "text": " world is because that procedure will just produce adversarial examples for" }, { "start": 454.08000000000004, "end": 459.04, "text": " the discriminator. And those usually look like nothing like data. Because if you" }, { "start": 459.04, "end": 464.36, "text": " keep the discriminator just stable and gradient descent against it what you'll" }, { "start": 464.36, "end": 470.92, "text": " get isn't really qualitatively good. But in principle if the discriminator was a" }, { "start": 470.92, "end": 476.28000000000003, "text": " good energy function for the data to describe the data we could use gradient" }, { "start": 476.28, "end": 482.91999999999996, "text": " descent. The same up here. In order to find a good label for an image given" }, { "start": 482.91999999999996, "end": 489.17999999999995, "text": " that we have a good energy function, we could simply gradient" }, { "start": 489.17999999999995, "end": 497.71999999999997, "text": " descent on the label in order to find a better label. So in this" }, { "start": 497.71999999999997, "end": 504.11999999999995, "text": " paper we're going to have a situation where we say we're given an energy" }, { "start": 504.12, "end": 510.52, "text": " function and we're given a bunch of inputs. They are then called X, A, and W." }, { "start": 510.52, "end": 517.92, "text": " And if I have my energy function already, if I have given my energy function and I" }, { "start": 517.92, "end": 525.5600000000001, "text": " have given two of those three things, any two, I can infer the last thing" }, { "start": 525.5600000000001, "end": 532.64, "text": " simply by gradient descent on my energy function. Because I know the energy" }, { "start": 532.64, "end": 538.24, "text": " function is zero when the energy function is happy with the input." }, { "start": 538.24, "end": 543.84, "text": " So when all of these things agree, basically the energy function is happy, it" }, { "start": 543.84, "end": 548.28, "text": " will output zero otherwise it will output a high value. Therefore if I'm given any" }, { "start": 548.28, "end": 554.56, "text": " of those two, any two of those three things, I can find a compatible third" }, { "start": 554.56, "end": 560.24, "text": " thing by descending. And then of course over here in these machine learning" }, { "start": 560.24, "end": 565.16, "text": " problems, the task was always actually to learn an energy function. So" }, { "start": 565.16, "end": 570.16, "text": " usually in the training data set we are given images and labels and we want to" }, { "start": 570.16, "end": 575.04, "text": " learn this energy function which would be parameterized. So we want to learn the" }, { "start": 575.04, "end": 580.72, "text": " parameters. And the same here in our general case if we are now given three" }, { "start": 580.72, "end": 585.08, "text": " things but we are not given the parameters of the energy function, we" }, { "start": 585.08, "end": 590.64, "text": " don't know what those are. As long as we're given all of the inputs in our" }, { "start": 590.64, "end": 594.6800000000001, "text": " training data set, and our training data set guarantees these are actually, you" }, { "start": 594.6800000000001, "end": 597.9200000000001, "text": " know, these are inputs that are compatible with each other, the energy" }, { "start": 597.9200000000001, "end": 602.6, "text": " function should be low, we can simply gradient descent on the parameters of" }, { "start": 602.6, "end": 608.08, "text": " the energy function. So in a sense there are four things, right? There are these" }, { "start": 608.08, "end": 611.1600000000001, "text": " three inputs and then there are the parameters of the energy function. If" }, { "start": 611.16, "end": 618.8399999999999, "text": " we're given any three of those four, we can gradient descent on the rest. And" }, { "start": 618.8399999999999, "end": 624.8, "text": " that's going to be the basis. So the X here is going to be the so-called state." }, { "start": 624.8, "end": 632.68, "text": " And the state in this paper is going to be images of entities. The entities," }, { "start": 632.68, "end": 636.88, "text": " sorry it's not going to be images, but the entities are these little circles" }, { "start": 636.88, "end": 643.2, "text": " that you're going to see. And each of those entities can have an X position, a" }, { "start": 643.2, "end": 650.12, "text": " Y position, and I believe a color. So R, G and B. So each of those can have that." }, { "start": 650.12, "end": 655.76, "text": " And then the concatenation of all of those attributes is one big vector and" }, { "start": 655.76, "end": 661, "text": " that is your X, that's your state. So state is number of entities and their" }, { "start": 661, "end": 667.32, "text": " attributes. A is going to be an attention mask over the state. So A is" }, { "start": 667.32, "end": 675.92, "text": " going to be... here you have four entities, so A will have four entries telling you" }, { "start": 675.92, "end": 684.12, "text": " which of these entities you should pay attention to right now. And W is going to" }, { "start": 684.12, "end": 693.48, "text": " be a concept vector so called. So W is going to be the embedding of a concept." }, { "start": 693.48, "end": 699.24, "text": " Now what a concept is in this case is very general. I can give you an example." }, { "start": 699.24, "end": 709.08, "text": " One concept is do the entities that the A pays attention to, are they" }, { "start": 709.08, "end": 714.48, "text": " close to each other? So in this case you see we have two entities that A has a" }, { "start": 714.48, "end": 723.6, "text": " high value on and this is this ball up here and this ball down here. Now if the" }, { "start": 723.6, "end": 729.9200000000001, "text": " concept vector is the embedding for the concept of being close to each other" }, { "start": 729.9200000000001, "end": 737.2800000000001, "text": " then the energy function would be very happy if those two things are close to" }, { "start": 737.28, "end": 740.8, "text": " each other and it would be very unhappy if those two things aren't close to each" }, { "start": 740.8, "end": 745.8399999999999, "text": " other. But in the very same situation, so the same X, the same attention mask, but" }, { "start": 745.8399999999999, "end": 753.72, "text": " a different concept, so a different W vector right here, then the energy" }, { "start": 753.72, "end": 757.1999999999999, "text": " function would be maybe very happy if the two things are far apart and maybe" }, { "start": 757.1999999999999, "end": 764.56, "text": " unhappy if the two things are close. So the question is always how are the three" }, { "start": 764.56, "end": 768.7199999999999, "text": " things that you put into the energy function compatible with each other and" }, { "start": 768.7199999999999, "end": 775.92, "text": " given all but one of these things you can infer the other. So let's say you" }, { "start": 775.92, "end": 781.7199999999999, "text": " have a perfect energy function for this situation." }, { "start": 781.7199999999999, "end": 788, "text": " You're just given the energy function, you can trust it. And you are given, let's" }, { "start": 788, "end": 791.8399999999999, "text": " make an example, you are given the X, so you're given the state, I'm going to draw" }, { "start": 791.84, "end": 802.08, "text": " the state down here, right? Okay, this is the state and you're given the W and the" }, { "start": 802.08, "end": 808.34, "text": " W is the embedding, it's a vector but in embedding space, but the" }, { "start": 808.34, "end": 818.36, "text": " embedding is for a line, right? So the geometric unit of a line." }, { "start": 818.36, "end": 825.24, "text": " Now your task is to find A, the attention mask that will make the energy function" }, { "start": 825.24, "end": 829.8000000000001, "text": " happy. And as you can see right here, what you would do is you would put a lot of" }, { "start": 829.8000000000001, "end": 836.16, "text": " weight on this, this, this and this ball and no weight on that ball, because those" }, { "start": 836.16, "end": 841.84, "text": " make a line. And since everything here is differentiable, so the state is" }, { "start": 841.84, "end": 845, "text": " differentiable, the attention is differentiable and the concepts are" }, { "start": 845, "end": 849.8, "text": " vectors, they're differentiable, you can use gradient descent to find that. Another" }, { "start": 849.8, "end": 857.36, "text": " example, if you're given again the same W, so line, and you are given this" }, { "start": 857.36, "end": 865.76, "text": " following thing and you are given, now you're given the attention on these" }, { "start": 865.76, "end": 871.8, "text": " three and you say please find the X, please find the X, the state that makes" }, { "start": 871.8, "end": 877.28, "text": " this energy function happy. Now this here you would call the starting state, the X" }, { "start": 877.28, "end": 885.0799999999999, "text": " zero, your task is going to be find the X one, find the state, how do you have to" }, { "start": 885.0799999999999, "end": 888.78, "text": " change this state such that the energy function is happy? And of course the" }, { "start": 888.78, "end": 893.28, "text": " answer is going to be is to push this ball here inward until it is in the" }, { "start": 893.28, "end": 898.92, "text": " middle of the two others, so the three form a line. Right, these three form a" }, { "start": 898.92, "end": 902.8399999999999, "text": " line. You don't have to do anything to this ball up here, because" }, { "start": 902.8399999999999, "end": 908.68, "text": " there is no attention on it. And the attention, it's only, is the concept for" }, { "start": 908.68, "end": 913.5999999999999, "text": " the things that you put attention on and the state, are those three in agreement" }, { "start": 913.5999999999999, "end": 921.8, "text": " and the energy function is happy. Okay, we have covered the basics. Now let's" }, { "start": 921.8, "end": 928.12, "text": " dive into the paper. I think this is the longest introduction ever, but" }, { "start": 928.12, "end": 936.96, "text": " I think it will pay off once you see. So they specifically, or this" }, { "start": 936.96, "end": 940.96, "text": " author, I think it's a single author, identifies two different things that you" }, { "start": 940.96, "end": 945.4, "text": " can do with an energy function here. Of course you can do more as we saw, but they" }, { "start": 945.4, "end": 952.82, "text": " identify two. So here is where you have given the initial state and an attention" }, { "start": 952.82, "end": 959.9200000000001, "text": " mask and you want to find the x1, the state that satisfies the concept and" }, { "start": 959.9200000000001, "end": 965.32, "text": " attention the most. This the author calls generation. As you can see here," }, { "start": 965.32, "end": 970.1600000000001, "text": " these four things that you have the attention on are pushed around until" }, { "start": 970.1600000000001, "end": 976.22, "text": " they make a square, because the concept right now is square. And in the other" }, { "start": 976.22, "end": 983.72, "text": " case, where you are given this x0 and x1, just call this x right here, just call" }, { "start": 983.72, "end": 990.0400000000001, "text": " this thing x. If you're given those two, and you are given the concept square, and" }, { "start": 990.0400000000001, "end": 994.4, "text": " you're tasked with finding a, the attention mask, of course you're going to" }, { "start": 994.4, "end": 999.96, "text": " put the attention on these right here. And that is going to happen through" }, { "start": 999.96, "end": 1004.64, "text": " gradient descent. Again, we're not learning a model to give you that" }, { "start": 1004.64, "end": 1009.12, "text": " attention. Like in a GAN, we're learning a generator to just one shot give it to" }, { "start": 1009.12, "end": 1013.4, "text": " you. Right now, what we're going to do is we're going to gradient descent" }, { "start": 1013.4, "end": 1017.8, "text": " optimize on our smooth energy function to give us that perfect attention mask" }, { "start": 1017.8, "end": 1022.4, "text": " that satisfies the energy function. Alright, so this is the difference right" }, { "start": 1022.4, "end": 1028.3, "text": " here. Gradient descent is part of the output procedure of the model. Usually we" }, { "start": 1028.3, "end": 1033.08, "text": " just use it to learn, and we learn a one-shot model. But here gradient descent" }, { "start": 1033.08, "end": 1040.1999999999998, "text": " is part of the model. So they introduce energy functions here, and they say, okay," }, { "start": 1040.1999999999998, "end": 1046.6, "text": " we can have a policy on x. So if we're given a concept W, and if we're given an" }, { "start": 1046.6, "end": 1052.4399999999998, "text": " A, we can have a policy over x, which basically means we can find x's that are" }, { "start": 1052.4399999999998, "end": 1058.3999999999999, "text": " compatible with that by running gradient descent here. You see there is an xk" }, { "start": 1058.4, "end": 1065.8400000000001, "text": " minus one, and we are running gradient descent on the energy function with" }, { "start": 1065.8400000000001, "end": 1071.2800000000002, "text": " respect to x to find a better x that satisfies the energy function given" }, { "start": 1071.2800000000002, "end": 1078.1200000000001, "text": " those inputs. And the same if we want to find an attention mask, we are running" }, { "start": 1078.1200000000001, "end": 1085.48, "text": " gradient descent on the attention mask, again, in order to satisfy the same" }, { "start": 1085.48, "end": 1091.16, "text": " energy function. So you see the inputs are both times the same. The concept here" }, { "start": 1091.16, "end": 1097.16, "text": " we can input square, here we can input square, but the difference is what we're" }, { "start": 1097.16, "end": 1102.14, "text": " running gradient descent on and what we keep constant. And I would get, I would" }, { "start": 1102.14, "end": 1109.1200000000001, "text": " add a third line here actually, because we can also, if we're given an x and an" }, { "start": 1109.12, "end": 1116, "text": " a, we can also infer a W. And that's going to be an integral part. So if I" }, { "start": 1116, "end": 1124.6399999999999, "text": " have this right here, and this situation, and I have, say I have attention on these" }, { "start": 1124.6399999999999, "end": 1133.2399999999998, "text": " four, now I can ask the model, so I'm given x and I'm given a, I can ask the" }, { "start": 1133.24, "end": 1141.72, "text": " model to infer W. And the model should ideally output, ha, this is square. Now" }, { "start": 1141.72, "end": 1146.04, "text": " the model isn't going to output square, the model is going to output a vector" }, { "start": 1146.04, "end": 1150.56, "text": " representation of square. So the model is going to output square but as a" }, { "start": 1150.56, "end": 1157.84, "text": " vector of numbers, because that's how we've trained it. W is an embedding. But" }, { "start": 1157.84, "end": 1163.3999999999999, "text": " what we can then do later is we can say, okay, I'm not going to tell you it's a" }, { "start": 1163.3999999999999, "end": 1169, "text": " square, you just come up with a vector W to describe this situation. And now I'm" }, { "start": 1169, "end": 1174.1599999999999, "text": " going to take that vector W that you came up with, miss, mister or missus model," }, { "start": 1174.1599999999999, "end": 1182.9599999999998, "text": " and I'm going to take, tell you a new situation. This situation right here. And" }, { "start": 1182.96, "end": 1189.32, "text": " I'm going to now give you x, and I'm going to give you the W that you" }, { "start": 1189.32, "end": 1196.08, "text": " yourself have output, and now please tell me what's the a. And then the model is of" }, { "start": 1196.08, "end": 1200.88, "text": " course supposed to tell you, oh these four here are the a. So without" }, { "start": 1200.88, "end": 1205.68, "text": " ever telling that it should be a square, what you can do is you can let the model" }, { "start": 1205.68, "end": 1212.32, "text": " infer a W from one example situation, and then transfer that W to a new" }, { "start": 1212.32, "end": 1219.08, "text": " situation. So it can identify, you can just say whatever concept I have up here," }, { "start": 1219.08, "end": 1225.36, "text": " please apply that same concept, which is the W down here. And this is the entire" }, { "start": 1225.36, "end": 1233.24, "text": " paper now. This is the concept learning through energy-based models. Okay, so that" }, { "start": 1233.24, "end": 1238.1599999999999, "text": " is kind of a third line I would add down here. You can infer a concept vector if" }, { "start": 1238.16, "end": 1245.16, "text": " you're given the X and the a. So in order to do all this, their energy function is" }, { "start": 1245.16, "end": 1249.8400000000001, "text": " going to be a so-called relational neural network. So what you'll have is" }, { "start": 1249.8400000000001, "end": 1254.44, "text": " you'll have a simple neural network, a multi-layer perceptron that always" }, { "start": 1254.44, "end": 1261.0400000000002, "text": " connects two entities to each other with the concept vector, and then this is I" }, { "start": 1261.0400000000002, "end": 1267.0800000000002, "text": " believe a sigmoid that connects the attention masks of the two, and you" }, { "start": 1267.08, "end": 1273.6399999999999, "text": " simply sum over all pairs of two entries in your model, and then you send that" }, { "start": 1273.6399999999999, "end": 1278.9199999999998, "text": " through an MLP, sorry, through an MLP again. This I believe is not so important," }, { "start": 1278.9199999999998, "end": 1284.12, "text": " it's just important that they can feed this entire situation, the X, the a, and" }, { "start": 1284.12, "end": 1287.36, "text": " the W, they can basically feed into a neural network, and the neural network" }, { "start": 1287.36, "end": 1294.28, "text": " comes up with a number of how well those three things fit together. And then you" }, { "start": 1294.28, "end": 1299.6, "text": " can transfer these concepts. That's pretty cool. Now the only question is, of" }, { "start": 1299.6, "end": 1305.72, "text": " course, we've always said we're given an energy function, we're just, we just have" }, { "start": 1305.72, "end": 1309.6399999999999, "text": " it. But of course, this is a neural network, and the neural network has" }, { "start": 1309.6399999999999, "end": 1314.12, "text": " parameters, and the parameters, we don't know what good parameters are at the" }, { "start": 1314.12, "end": 1320.32, "text": " beginning. So we need to train this thing. And again, the reason why these are toy" }, { "start": 1320.32, "end": 1325.36, "text": " problems right here is, I mean, we'll get to why it's computational, but this is" }, { "start": 1325.36, "end": 1330.6799999999998, "text": " kind of a new field, I believe in machine learning, at least I come from classical" }, { "start": 1330.6799999999998, "end": 1336.72, "text": " machine learning, and we only ever have used, like SGD to train, and we only ever" }, { "start": 1336.72, "end": 1345.04, "text": " have produced models that one shot produce something. And here, we, this is a," }, { "start": 1345.04, "end": 1348.76, "text": " I believe this is a new concept where you use gradient descent as part of the" }, { "start": 1348.76, "end": 1356.56, "text": " output. And that makes a lot of trouble. So that's why we work in toy problems. So" }, { "start": 1356.56, "end": 1362.84, "text": " what this, this here is the situation I described. You have a demo event where" }, { "start": 1362.84, "end": 1368.64, "text": " you're given the X and the A, and you're supposed to infer the W. So the question" }, { "start": 1368.64, "end": 1373.96, "text": " here is, what's the W? And the model will come up with a W, and you're not going to" }, { "start": 1373.96, "end": 1379.24, "text": " do anything, you know, right now, you're simply going to take that W and tell it," }, { "start": 1379.24, "end": 1386.24, "text": " oh, well, here is a so-called test event. So please apply the W you came up with in" }, { "start": 1386.24, "end": 1393.08, "text": " this test event. And please find me the A, in this case, that satisfies the W and" }, { "start": 1393.08, "end": 1398.64, "text": " the X I give you here. And of course, the A right here is, as you can see, even you" }, { "start": 1398.64, "end": 1404.88, "text": " don't know that it's a square. And the actual concept here is move the gray" }, { "start": 1404.88, "end": 1409.8000000000002, "text": " ball to the middle of the square, right? That is it here. But no one has told me" }, { "start": 1409.8000000000002, "end": 1415.8400000000001, "text": " this. I just looked at the picture. So the correct answer here would be to place" }, { "start": 1415.8400000000001, "end": 1421.16, "text": " attention on those four things, and then to take this thing and move it to the" }, { "start": 1421.16, "end": 1428.0400000000002, "text": " middle right here, in this over here. So that would be the correct answer. Now," }, { "start": 1428.04, "end": 1436.36, "text": " the question is, how do you train something like this? And they show" }, { "start": 1436.36, "end": 1441, "text": " that they, so this is the loss function right here. The loss function is they" }, { "start": 1441, "end": 1447.84, "text": " give you a concept and an initial situation, and you're supposed to infer" }, { "start": 1447.84, "end": 1453.12, "text": " the X1 and the A. And the loss function is simply the negative log likelihood of" }, { "start": 1453.12, "end": 1463.7199999999998, "text": " that. But what does that mean? So we'll make it easier. If you have this" }, { "start": 1463.7199999999998, "end": 1469.52, "text": " procedure right here, where you have a demo event, this up here, this is demo," }, { "start": 1469.52, "end": 1475.7199999999998, "text": " and this is a test event. How are you going, this entire procedure, how are you" }, { "start": 1475.7199999999998, "end": 1482.7199999999998, "text": " going to learn the energy function? Well, in this case, this entire procedure, this" }, { "start": 1482.72, "end": 1492.22, "text": " entire thing is one training sample. But usually we have input and" }, { "start": 1492.22, "end": 1498.88, "text": " label. And now here, it's much more complicated because, so we have input, okay," }, { "start": 1498.88, "end": 1504.68, "text": " that's this X and this A, cool. But then we have SGD as integral part of the" }, { "start": 1504.68, "end": 1510.78, "text": " procedure to determine the W. And now what we could do is just apply a loss to" }, { "start": 1510.78, "end": 1514.72, "text": " the W, but we don't because we don't know what the embedding space for the concepts" }, { "start": 1514.72, "end": 1520, "text": " is. We could maybe train a classifier, but in this case, we want to train the" }, { "start": 1520, "end": 1526.32, "text": " ability to transfer these concepts. So our training sample needs to be one time" }, { "start": 1526.32, "end": 1533.72, "text": " transferring a concept. So SGD for one is part of our process here. And not only" }, { "start": 1533.72, "end": 1539.12, "text": " that, but then this X here, of course, is also part of our training sample, right?" }, { "start": 1539.12, "end": 1544.28, "text": " This appears X0 and this here is X1. And now we need to find this A, this" }, { "start": 1544.28, "end": 1550.1999999999998, "text": " attention mask. And that is an SGD again. Remember, inferring anything through the" }, { "start": 1550.1999999999998, "end": 1555.4799999999998, "text": " energy function is a gradient descent process. So ultimately, our one training" }, { "start": 1555.4799999999998, "end": 1564.3999999999999, "text": " example consists of X0, A at the beginning, so let's call that A0. It" }, { "start": 1564.4, "end": 1572.76, "text": " consists of the SGD procedure to find W, it consists of X1, and it consists of" }, { "start": 1572.76, "end": 1582.8400000000001, "text": " the SGD procedure to find A, the A1, the output A. And then that will give us the" }, { "start": 1582.8400000000001, "end": 1590.44, "text": " output A, the A1. So this here is our input in the classical machine learning. This" }, { "start": 1590.44, "end": 1596.68, "text": " would be our X, and this here would be our label Y. And that's what we train on." }, { "start": 1596.68, "end": 1602.76, "text": " We train. So such that the output right here, the A, this is of course, sorry, this" }, { "start": 1602.76, "end": 1607.72, "text": " is of course the Y hat. This is what we predict. And in the training sample, we" }, { "start": 1607.72, "end": 1614.3200000000002, "text": " just write a little generator that will, you know, make this situation that knows" }, { "start": 1614.3200000000002, "end": 1618.2, "text": " what the concept is, right? It will say, okay, I'm gonna make an example for a" }, { "start": 1618.2, "end": 1622.16, "text": " square, then it will make this, will make the attention mask for a square, and then" }, { "start": 1622.16, "end": 1626.56, "text": " it will make the new situation again with a square, but not tell us the" }, { "start": 1626.56, "end": 1636.64, "text": " attention mask there, and it will make the attention mask into the true Y. So at" }, { "start": 1636.64, "end": 1642.3600000000001, "text": " the end, we can compare what our model output, the attention mask we output" }, { "start": 1642.3600000000001, "end": 1647.24, "text": " here, without ever knowing that this should be a square, right? And we have the" }, { "start": 1647.24, "end": 1653.4, "text": " true label, which comes out of the generator that at the beginning decided" }, { "start": 1653.4, "end": 1658.52, "text": " that it should be a square. And then the loss, the distance between those two," }, { "start": 1658.84, "end": 1666.72, "text": " that's our loss. This is an, this is an enormous procedure to get a loss. And" }, { "start": 1667.16, "end": 1672.84, "text": " most crucially, you have to back propagate through optimization procedures." }, { "start": 1672.84, "end": 1677.8799999999999, "text": " And this is something that we just can't do yet in our models. If you take an" }, { "start": 1677.8799999999999, "end": 1682.9599999999998, "text": " image, a ResNet 50, right, right now, we do one forward propagation to get a" }, { "start": 1682.9599999999998, "end": 1688.24, "text": " label. In this procedure, if you had to back propagate through the optimization" }, { "start": 1688.24, "end": 1693.1999999999998, "text": " procedure, for each sample, you would need to basically back propagate through" }, { "start": 1693.1999999999998, "end": 1699.24, "text": " 50 forward passes of the ResNet, if you if your optimization procedure is 50" }, { "start": 1699.24, "end": 1705.32, "text": " steps long, and that is just not feasible right now. So that's why we don't do it." }, { "start": 1706.04, "end": 1713.08, "text": " But I believe maybe once we find a smart way of back propping through optimization" }, { "start": 1713.08, "end": 1718.08, "text": " procedures, a whole lot of these things will become the new a new wave in" }, { "start": 1718.08, "end": 1722.32, "text": " machine learning. I really I'm excited by this. I'm pretty sure it doesn't work" }, { "start": 1722.32, "end": 1729.08, "text": " yet. And this is very fiddly, fiddly work. But I'm excited by the prospect that" }, { "start": 1729.08, "end": 1735.8, "text": " we can do this. So this is the training procedure, right? You are given x0, x1," }, { "start": 1735.8, "end": 1742.1599999999999, "text": " and a, and you optimize in order to infer the concept behind it, right? The" }, { "start": 1742.1599999999999, "end": 1747.1999999999998, "text": " generator that your level generator of your training data, it knows the concept," }, { "start": 1747.1999999999998, "end": 1750.4399999999998, "text": " it has a concept in mind when it generated this, but you're not telling" }, { "start": 1750.6799999999998, "end": 1755.8799999999999, "text": " your model what the concept is, it needs to infer that. And then using the" }, { "start": 1755.88, "end": 1762.48, "text": " model, the thing that the model inferred, you can either give it x0 and x1 and" }, { "start": 1762.48, "end": 1766.88, "text": " infer a, or you can give it the x and the a and infer x, you can do either of" }, { "start": 1766.88, "end": 1769.88, "text": " those, right? These are called identification or generation," }, { "start": 1769.88, "end": 1775.8000000000002, "text": " respectively. And then you compare the output here to what the generator at the" }, { "start": 1775.8000000000002, "end": 1781.5600000000002, "text": " beginning thought, again, it's not telling you it's that's because that's" }, { "start": 1781.56, "end": 1787.48, "text": " the label. And you compare this to that. And that will be your loss to train your" }, { "start": 1787.48, "end": 1792.84, "text": " energy function parameters. So your training samples, if you think of this" }, { "start": 1792.84, "end": 1797.44, "text": " entire thing as one forward pass of the model, then it's just classic machine" }, { "start": 1797.44, "end": 1800.76, "text": " learning, right? You have a training sample, which is one forward pass and you" }, { "start": 1800.76, "end": 1807.32, "text": " have a corresponding label that you infer. So let's jump to the experiments" }, { "start": 1807.32, "end": 1814, "text": " right here. The experiments are actually pretty cool. So what they've done is, for" }, { "start": 1814, "end": 1823.36, "text": " example, taken the concept of being far apart from something now being far apart" }, { "start": 1823.36, "end": 1828.48, "text": " so that the little x needs to be as far away as possible from the ball that has" }, { "start": 1828.48, "end": 1835.56, "text": " the attention on it. So if you do generation, and you start the little x" }, { "start": 1835.56, "end": 1842.04, "text": " right here, and you ask the model, where please infer the next state of the world," }, { "start": 1842.04, "end": 1846.8, "text": " it will push that little x away right here. And in color, you can see the energy" }, { "start": 1846.8, "end": 1853.52, "text": " function values of the position of the x. So it pushes it away from this thing. But" }, { "start": 1853.52, "end": 1859.44, "text": " if you take the same concept embedding, the concept embedding of being far away," }, { "start": 1859.44, "end": 1865.56, "text": " but you don't do generation, you do identification, which means you infer the a," }, { "start": 1865.56, "end": 1871.4, "text": " then it will simply tell you that this ball right here is the furthest away" }, { "start": 1871.4, "end": 1878.96, "text": " from the x. So you can do all sorts of things like this and transferring" }, { "start": 1878.96, "end": 1884.0800000000002, "text": " concepts. I find this here pretty interesting. So they have two different" }, { "start": 1884.08, "end": 1891.6399999999999, "text": " concepts. One concept is red as an identification. You need to identify the" }, { "start": 1891.6399999999999, "end": 1897.8, "text": " red ball. But the other concept is you need to turn something red, right? You" }, { "start": 1897.8, "end": 1902.6, "text": " need to take a ball that is maybe now blue, and of course the color, you can" }, { "start": 1902.6, "end": 1908, "text": " gradient descent on the colors, you need to make it red. And since the energy" }, { "start": 1908, "end": 1913.36, "text": " function, it just takes three input x, a and w. You're not gonna tell" }, { "start": 1913.36, "end": 1921.24, "text": " it right now in which situation you are. It has to create this w embedding" }, { "start": 1921.24, "end": 1928.8, "text": " space through learning. And if you do it with those two concepts, then it will put" }, { "start": 1928.8, "end": 1935.7199999999998, "text": " the make something red concept and the is something red concepts in the same" }, { "start": 1935.7199999999998, "end": 1941.32, "text": " places. So this is a PCA. And in blue, I think these blue is the attention codes" }, { "start": 1941.32, "end": 1946.48, "text": " for identify the red things. And in red are the generation code for make" }, { "start": 1946.48, "end": 1951, "text": " something red and they will be put in the same place, which is pretty cool. It" }, { "start": 1951, "end": 1954.48, "text": " means that the energy function really learns the feature of something being" }, { "start": 1954.48, "end": 1962.48, "text": " red. I find this pretty neat. And then here they have some" }, { "start": 1962.48, "end": 1967.36, "text": " experiments where they basically show we need that gradient descent" }, { "start": 1967.36, "end": 1973.3999999999999, "text": " optimization procedure because only after many steps will the energy" }, { "start": 1973.3999999999999, "end": 1978.76, "text": " function basically be aligned with the concept that you want. So if you have a" }, { "start": 1978.76, "end": 1983.6, "text": " zero-shot model, like just one forward pass as we do here, you'll see that the" }, { "start": 1983.6, "end": 1989.26, "text": " energy function that is supposed to make a circle from samples, right? This is the" }, { "start": 1989.26, "end": 1996.1999999999998, "text": " example concept right here. If you just have a one-shot model, it will, it cannot" }, { "start": 1996.2, "end": 2001.64, "text": " or in this case at least, it doesn't learn to one-shot produce. Only if you" }, { "start": 2001.64, "end": 2007.2, "text": " optimize for a few steps will it get this. So you optimize at inference time" }, { "start": 2007.2, "end": 2013.44, "text": " and that seems to be very important. You can see again here demonstrations of" }, { "start": 2013.44, "end": 2021.1200000000001, "text": " this. So the example is this and then the model as you can see after 20 steps" }, { "start": 2021.12, "end": 2027.52, "text": " learn optimizes the points to go to these locations. Whereas after only one" }, { "start": 2027.52, "end": 2032.4799999999998, "text": " step it didn't do that yet. So there are complex things at work here. And this" }, { "start": 2032.4799999999998, "end": 2035.56, "text": " column here is where you don't have a relational neural network. So you can't" }, { "start": 2035.56, "end": 2039.76, "text": " basically capture dependencies between things. So you have no chance of" }, { "start": 2039.76, "end": 2044.4799999999998, "text": " making a square because you don't know where the things are in relation to each" }, { "start": 2044.4799999999998, "end": 2048.54, "text": " other. But that's more of an engineering question. Their point is basically that" }, { "start": 2048.54, "end": 2054.36, "text": " if you have models that do optimization at inference time, they are much more" }, { "start": 2054.36, "end": 2061.14, "text": " powerful than models that just do a one-shot forward pass. It's sort of like" }, { "start": 2061.14, "end": 2067.12, "text": " an autoregressive model in NLP versus a non autoregressive model that produces" }, { "start": 2067.12, "end": 2071.8, "text": " all words at once. If you produce all words of a sentence at once, no word can" }, { "start": 2071.8, "end": 2076.38, "text": " depend on any other word and you can just come produce independent or you can" }, { "start": 2076.38, "end": 2081.92, "text": " just produce independent things which will make the sentence often not make" }, { "start": 2081.92, "end": 2088.6800000000003, "text": " any sense. They also have this KL objective which is a regularizer which I" }, { "start": 2088.6800000000003, "end": 2094.56, "text": " believe that's just a trial and error they built it in because. But it is a" }, { "start": 2094.56, "end": 2098.2400000000002, "text": " regularizer. I don't want to really go into that. And then they do" }, { "start": 2098.2400000000002, "end": 2105.36, "text": " demonstration and they reenact it on a robot. The demonstration here is that" }, { "start": 2105.36, "end": 2109.2000000000003, "text": " there is a situation where two things have attention on and you're supposed to" }, { "start": 2109.2000000000003, "end": 2113.08, "text": " move something into the middle of the two things. So that's the concept. You don't" }, { "start": 2113.08, "end": 2118.1600000000003, "text": " tell the robot the concept. It needs to learn that from data and then infer that" }, { "start": 2118.1600000000003, "end": 2122.84, "text": " this is the concept that you want and then transfer that to the other" }, { "start": 2122.84, "end": 2128.2400000000002, "text": " environment. Now you know there's this robot" }, { "start": 2128.2400000000002, "end": 2132.88, "text": " environment but ultimately they still encode the positions of these things and" }, { "start": 2132.88, "end": 2137.96, "text": " the position of that. And really all you have to do different here is that" }, { "start": 2137.96, "end": 2146.56, "text": " instead of moving this actuator directly you need to calculate what you" }, { "start": 2146.56, "end": 2151.1600000000003, "text": " need to do to the individual joints in the robot. So I think this is maybe" }, { "start": 2151.1600000000003, "end": 2156.04, "text": " because it's open AI and it needs to you know look roboty and stuff but the" }, { "start": 2156.04, "end": 2159.88, "text": " problem here is not really different. It's not real-world" }, { "start": 2159.88, "end": 2167.28, "text": " transfer or anything. So yeah let's go through some of the things they can" }, { "start": 2167.28, "end": 2172.76, "text": " learn with this. So you can see here they can learn these regional geometric" }, { "start": 2172.76, "end": 2178.4, "text": " shapes and on the left is the example event that the model needs to take the" }, { "start": 2178.4, "end": 2183.2000000000003, "text": " concept from. Now this is I believe very much identification. So what" }, { "start": 2183.2000000000003, "end": 2187.6400000000003, "text": " they did is they trained with a data set where all of these appear. So" }, { "start": 2187.64, "end": 2193.16, "text": " there are squares, there are lines, there are circles. So this is maybe my" }, { "start": 2193.16, "end": 2200.8399999999997, "text": " criticism here that it is not so much to generally infer a concept. It is more" }, { "start": 2200.8399999999997, "end": 2205.72, "text": " like identify the concept. So the model basically just needs to decide is this" }, { "start": 2205.72, "end": 2210.04, "text": " line, is this circle or is this square because those things were in" }, { "start": 2210.04, "end": 2215.04, "text": " the training data set. It would be nice to see how this generalizes to general" }, { "start": 2215.04, "end": 2220.8, "text": " concepts or if we can even make that if we can have a zero-shot concept" }, { "start": 2220.8, "end": 2225.96, "text": " inference and then transfer those concepts to other things. Maybe that's" }, { "start": 2225.96, "end": 2231.6, "text": " already happening. I don't know. So here the spatial arrangement is to" }, { "start": 2231.6, "end": 2238.52, "text": " either be close to something or to be between two things. So if the attention" }, { "start": 2238.52, "end": 2243.8, "text": " is on two things you want in between. So you see the top ones are the" }, { "start": 2243.8, "end": 2248.48, "text": " demonstrations. It needs to recognize the concept and it needs to basically" }, { "start": 2248.48, "end": 2258.4, "text": " optimize to fulfill that concept. Shapes. So to make shapes is..." }, { "start": 2258.4, "end": 2266.2000000000003, "text": " Oh yeah there's a triangle. Again this very much I believe" }, { "start": 2266.2000000000003, "end": 2271.36, "text": " relies on recognition and not actual understanding of what a triangle is. Here" }, { "start": 2271.36, "end": 2279.48, "text": " you have proximity being closer being far apart. What else is cool? Oh yeah you" }, { "start": 2279.48, "end": 2284.04, "text": " have the recognition for the same task. You need to identify the ball that" }, { "start": 2284.04, "end": 2289.2000000000003, "text": " is closer. Here you really also see the optimization procedure in action." }, { "start": 2289.2000000000003, "end": 2293.96, "text": " Where for example at the beginning of each flicker you kind of see the" }, { "start": 2293.96, "end": 2297.96, "text": " attention being everywhere and then stabilizing to one or two points. So if" }, { "start": 2297.96, "end": 2302.16, "text": " two points are equally close or far apart you'll see the attention being on" }, { "start": 2302.16, "end": 2306.48, "text": " multiple points. Which is pretty cool right? So that means the model really" }, { "start": 2306.48, "end": 2316.36, "text": " learns this concept. Here's the count quantity. So you can either have one" }, { "start": 2316.36, "end": 2323.44, "text": " two or larger than three or something. Yeah that seems like they tried three" }, { "start": 2323.44, "end": 2327.16, "text": " and four and didn't work so they just said we'll just do larger than three." }, { "start": 2327.16, "end": 2331.12, "text": " And here is this robot thing where it also always needs to move in between." }, { "start": 2331.12, "end": 2334.8799999999997, "text": " Now this is the part that I'm not really impressed with but you know" }, { "start": 2334.8799999999997, "end": 2342.04, "text": " whatever you want. Okay I hope this was a good introduction to energy" }, { "start": 2342.04, "end": 2346.08, "text": " functions. What you can do with them. What I think of them. And of this paper it is" }, { "start": 2346.08, "end": 2352.12, "text": " a pretty cool paper. Yes it only works on toy problems so far but I believe this" }, { "start": 2352.12, "end": 2358.6, "text": " is one interesting direction of future machine learning and something yet to be" }, { "start": 2358.6, "end": 2363.96, "text": " very much explored. If you like this content please subscribe, tell all of" }, { "start": 2363.96, "end": 2384.48, "text": " your friends about it, share and I'll see you next time. Bye bye!" } ]
iZXsWlSdMGY
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[News] Google’s medical AI was super accurate in a lab. Real life was a different story.
[ "Science & Technology" ]
[ "deep learning", "machine learning", "news", "google", "retina", "diabetes", "computer vision", "neural networks", "production", "devops", "deployment", "legal", "thailand" ]
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 the 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 a eye 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 tried to deploy this and the story is about how this failed basically. So they said they had this in Thailand, they had the opportunity to deploy this. So Thailand's Ministry of Health had set an annual goal to screen 60% of the people with diabetes for this diabetic retinopathy. It can cause blindness if not caught early. So here is where AI comes in because to 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 an AI. It says the AI 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. So this is pretty cool right? They've developed an AI you can send an eye scan and it'll say 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 who 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 but sometimes failed to give a result at all. So this 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 gonna 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 invent a new architecture or whatnot 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. The reason for this is that here you have a classifier 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 gonna 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 yeah and if it did some decision here if it says well I still go go with the negative class right this goes back to the patient and they made 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 percent I'm not sure I lean towards negative but I don't think so and then the nurse who maybe 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 lawgivers 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 bounds here now these are not going to be statistical true confidence bounds 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 build in some explainability to focus on part of the image and then you could alleviate a lot of these problems they sometimes wasted time trying to retake or edit an image that the AI had rejected right this this is just now you're just build AI working against humans rather than with humans so further this says because the system had to upload images to the cloud for processing poor 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 6 a.m. and for the first two hours could only 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 it's better anyway for for data 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 too harsh here so the the other there are some critics here so Michael Abramoff 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 health care than algorithms and I mean of course we can we can all 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 an AI system needs to fit into a process where sources of uncertainty are discussed rather than simply reject it and this exact this exactly feeds into what I've been saying if the air 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 if you regulate and I get 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 1,000 patients on her own I don't know in 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 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 they 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 image net 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 if you're looking for a PhD topic maybe this is something for you alright thanks for watching this this was my blabs about the story I hope you enjoyed this and these kind of new sections 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, "end": 5.24, "text": " Hi there, today we're looking at this new story from MIT Technology Review." }, { "start": 5.24, "end": 10.84, "text": " Google's medical AI was super accurate in a lab, real life was a different story." }, { "start": 10.84, "end": 17.72, "text": " So the story here is that Google had this AI to detect diabetic retinopathy." }, { "start": 17.72, "end": 25.12, "text": " So if you're a diabetic and your glucose isn't or your insulin isn't properly" }, { "start": 25.12, "end": 31.16, "text": " handled, that means you get damaged to your blood vessels and the small blood" }, { "start": 31.16, "end": 36.160000000000004, "text": " vessels like the ones in the eyes here, they're the first ones to get damaged" }, { "start": 36.160000000000004, "end": 41.92, "text": " and that can lead you to get this disease called retinopathy which is in" }, { "start": 41.92, "end": 46.78, "text": " the retina in the back of the eye and that can lead you to go blind if it's" }, { "start": 46.78, "end": 51.52, "text": " not discovered soon enough. So a eye doctor can look at an photograph like" }, { "start": 51.52, "end": 57.760000000000005, "text": " this and can determine whether you have it or not. I guess they would look at" }, { "start": 57.760000000000005, "end": 62.56, "text": " like a larger resolution of it but in any case they could determine from this." }, { "start": 62.56, "end": 69.36, "text": " So Google built an AI that could maybe spot things here that can maybe spot if" }, { "start": 69.36, "end": 76.92, "text": " you had this or not and they tried to deploy this and the story is about how" }, { "start": 76.92, "end": 85.2, "text": " this failed basically. So they said they had this in Thailand, they had the" }, { "start": 85.2, "end": 90.28, "text": " opportunity to deploy this. So Thailand's Ministry of Health had set an annual goal" }, { "start": 90.28, "end": 94.68, "text": " to screen 60% of the people with diabetes for this diabetic retinopathy." }, { "start": 94.68, "end": 100.76, "text": " It can cause blindness if not caught early. So here is where AI comes in" }, { "start": 100.76, "end": 108, "text": " because to 4.5 million patients that have diabetes there are only 200 experts" }, { "start": 108, "end": 114.4, "text": " that can determine from a photograph whether or not you do have that disease." }, { "start": 114.4, "end": 122.52000000000001, "text": " So they say clinics are struggling to meet the target and Google has built an AI." }, { "start": 122.52000000000001, "end": 128, "text": " It says the AI developed by Google have can identify signs of diabetic retinopathy" }, { "start": 128, "end": 133.52, "text": " from an eye scan with more than 90% accuracy which the team calls human" }, { "start": 133.52, "end": 140.12, "text": " specialist level and gives results in less than 10 minutes." }, { "start": 140.12, "end": 144.48, "text": " So this is pretty cool right? They've developed an AI you can send an eye scan" }, { "start": 144.48, "end": 152.36, "text": " and it'll say whether or not you have this disease but then the" }, { "start": 152.36, "end": 158.56, "text": " problems mount. So they followed over several months they observed nurses" }, { "start": 158.56, "end": 162.76000000000002, "text": " conducting eye scans and interviewed them about their expertise using the new" }, { "start": 162.76000000000002, "end": 168.76000000000002, "text": " system. So the nurses who conduct the eye scans they would try to use the AI and" }, { "start": 168.76000000000002, "end": 174.24, "text": " the nurses themselves aren't specialists they would otherwise send the" }, { "start": 174.24, "end": 178.64000000000001, "text": " scans to a specialist but now the AI is supposed to handle this up. When it" }, { "start": 178.64, "end": 184.6, "text": " worked well the AI did speed things up but sometimes failed to give a" }, { "start": 184.6, "end": 193.04, "text": " result at all. So this AI had been trained on high quality scans right?" }, { "start": 193.04, "end": 196.83999999999997, "text": " Of course if you want to train an AI system you want the highest quality data you can get" }, { "start": 196.83999999999997, "end": 202.23999999999998, "text": " but also in practice you're not gonna get high quality data. It was designed to" }, { "start": 202.23999999999998, "end": 208.27999999999997, "text": " reject images that fell below a certain threshold of quality and they say" }, { "start": 208.28, "end": 213, "text": " often taking photos in poor lighting conditions in the real world" }, { "start": 213, "end": 219.32, "text": " more than a fifth of the images were rejected. So this is my take on it. If you" }, { "start": 219.32, "end": 223.22, "text": " build something for the real world you need to take into account what the real" }, { "start": 223.22, "end": 229.12, "text": " world holds in store for you which means that you probably are going to have poor" }, { "start": 229.12, "end": 233.52, "text": " lighting conditions if you build an image recognition system. Now I'm" }, { "start": 233.52, "end": 237.7, "text": " not saying that like some people are saying whenever you work with AI you" }, { "start": 237.7, "end": 242.35999999999999, "text": " should consider how it impacts later on and so on. No it's perfectly fine to work" }, { "start": 242.35999999999999, "end": 246.6, "text": " on a data set of high quality images if you do something like invent a new" }, { "start": 246.6, "end": 251.85999999999999, "text": " architecture or whatnot work on optimization algorithms. Like nothing of" }, { "start": 251.85999999999999, "end": 257.08, "text": " that but it is if you are thinking of deploying something in the real world" }, { "start": 257.08, "end": 262.41999999999996, "text": " you need to take this into account. Now I also think this was particularly poorly" }, { "start": 262.42, "end": 268.44, "text": " designed for the task and here's why. Google probably here is mainly worried" }, { "start": 268.44, "end": 275.16, "text": " about legal culpability because the thing says it was designed to reject" }, { "start": 275.16, "end": 280.92, "text": " images that fell below a certain threshold of quality. The reason" }, { "start": 280.92, "end": 285.84000000000003, "text": " for this is that here you have a classifier and either it says it" }, { "start": 285.84, "end": 292.64, "text": " says okay here is positive and negative class. I am about this much sure of the" }, { "start": 292.64, "end": 296, "text": " positive class and this much of the negative class and there's quite a big" }, { "start": 296, "end": 300.88, "text": " of a difference here right so I'm gonna go with the negative class but if those" }, { "start": 300.88, "end": 308.88, "text": " two things are somewhat closer together the Google doesn't trust its own AI it's" }, { "start": 308.88, "end": 314.91999999999996, "text": " like yeah and if it did some decision here if it says well I still go go with" }, { "start": 314.92, "end": 319.2, "text": " the negative class right this goes back to the patient and they made a mistake" }, { "start": 319.2, "end": 325.16, "text": " then this thing here is automatically responsible for that mistake and since" }, { "start": 325.16, "end": 331.92, "text": " the AI is not a human these mistakes here could be rather trivial mistakes" }, { "start": 331.92, "end": 336.40000000000003, "text": " that a human would have spotted. So basically since it's deep learning we" }, { "start": 336.40000000000003, "end": 339.96000000000004, "text": " don't really trust it and then because Google doesn't want the legal" }, { "start": 339.96, "end": 345.79999999999995, "text": " culpability of being responsible they simply reject these cases they just say" }, { "start": 345.79999999999995, "end": 351.53999999999996, "text": " we don't deal with it we just deal with things with a large discrepancy. If you" }, { "start": 351.53999999999996, "end": 354.91999999999996, "text": " actually want to design something for the real world you need to take into" }, { "start": 354.91999999999996, "end": 359.24, "text": " account okay there's poor lighting conditions and I would think in if I" }, { "start": 359.24, "end": 364.08, "text": " were to build something like this optimally you would just output this" }, { "start": 364.08, "end": 370.12, "text": " thing you would output this distribution you would in this case you could say" }, { "start": 370.12, "end": 377.47999999999996, "text": " look I am 60-40 percent I'm not sure I lean towards negative but I don't think" }, { "start": 377.47999999999996, "end": 383.88, "text": " so and then the nurse who maybe also has some expertise could be experienced in" }, { "start": 383.88, "end": 388.2, "text": " when the system fails or when it tends to be not sure and could kind of" }, { "start": 388.2, "end": 393.84, "text": " integrate that information but this only works so if you're a that's maybe a" }, { "start": 393.84, "end": 398.59999999999997, "text": " recommendations for lawgivers this only works if you don't make the AI system" }, { "start": 398.59999999999997, "end": 406.32, "text": " completely culpable for its mistakes it can output its estimation and it can" }, { "start": 406.32, "end": 410.35999999999996, "text": " along of that it can actually also output an estimation of its own" }, { "start": 410.35999999999996, "end": 415.23999999999995, "text": " uncertainty it can like give you some confidence bounds here now these are not" }, { "start": 415.23999999999995, "end": 419, "text": " going to be statistical true confidence bounds because it's deep learning but" }, { "start": 419, "end": 424.2, "text": " still I would say please give all the available information that the system" }, { "start": 424.2, "end": 428.92, "text": " has and then let the humans work with the system rather than trying to fully" }, { "start": 428.92, "end": 437.64, "text": " replace the humans by simply saying yes no or reject all right so they say" }, { "start": 437.64, "end": 441.76, "text": " patients whose images were kicked out of the system were told they could have a" }, { "start": 441.76, "end": 446.52, "text": " visit they would have to visit a specialist at another clinic on another" }, { "start": 446.52, "end": 451.2, "text": " day if they found it hard to take time off work or did not have a car this was" }, { "start": 451.2, "end": 456.12, "text": " obviously inconvenient which I can understand nurses felt frustrated" }, { "start": 456.12, "end": 460.35999999999996, "text": " especially when they believed the rejected scans showed no sign of disease" }, { "start": 460.35999999999996, "end": 464.56, "text": " and the follow-up appointments were unnecessary this is exactly what I'm" }, { "start": 464.56, "end": 471.2, "text": " saying right the nurses often also have very good experience and can combine" }, { "start": 471.2, "end": 476.35999999999996, "text": " could combine something like this with their own experience of when something" }, { "start": 476.36, "end": 479.64, "text": " is wrong and when something isn't wrong and maybe you even build in some" }, { "start": 479.64, "end": 484.6, "text": " explainability to focus on part of the image and then you could alleviate a lot" }, { "start": 484.6, "end": 491.96000000000004, "text": " of these problems they sometimes wasted time trying to retake or edit an image" }, { "start": 491.96000000000004, "end": 499.52000000000004, "text": " that the AI had rejected right this this is just now you're just build AI working" }, { "start": 499.52000000000004, "end": 505.96000000000004, "text": " against humans rather than with humans so further this says because the system" }, { "start": 505.96, "end": 510.15999999999997, "text": " had to upload images to the cloud for processing poor internet connection in" }, { "start": 510.15999999999997, "end": 517.4, "text": " several clinics also caused delays so patients like the instant results but" }, { "start": 517.4, "end": 522.3199999999999, "text": " the internet is slow and the patients then complain they've been waiting here" }, { "start": 522.3199999999999, "end": 526.24, "text": " since 6 a.m. and for the first two hours could only we could only screen 10" }, { "start": 526.24, "end": 530.88, "text": " patients yes this is the type of stuff you have to take into account so maybe" }, { "start": 530.88, "end": 537.52, "text": " actually put the GPU server into the clinic it's better anyway for for data" }, { "start": 537.52, "end": 543.16, "text": " privacy reasons but of course the large companies they want to everything to be" }, { "start": 543.16, "end": 551.22, "text": " uploaded to their machines it's more convenient for them so they say there is" }, { "start": 551.22, "end": 555.72, "text": " now working with medical staff to design new workflows I mean sometimes you do" }, { "start": 555.72, "end": 560.68, "text": " rely on an internet connection so I don't want to be too too harsh here" }, { "start": 560.68, "end": 568.76, "text": " so the the other there are some critics here so Michael Abramoff an eye doctor" }, { "start": 568.76, "end": 572.8599999999999, "text": " and computer scientist at the University of Iowa hospitals and clinics has been" }, { "start": 572.8599999999999, "end": 577.4, "text": " developing an AI for diagnosing retinal disease for several years and is a CEO" }, { "start": 577.4, "end": 585.04, "text": " of a spin-off here and he basically says there is much more to health care than" }, { "start": 585.04, "end": 593.4399999999999, "text": " algorithms and I mean of course we can we can all we can all see that yeah he" }, { "start": 593.4399999999999, "end": 600.4, "text": " basically says that the questions the usefulness of comparing AI tools with" }, { "start": 600.4, "end": 604.0799999999999, "text": " human specialists when it comes to accuracy of course we don't want an AI" }, { "start": 604.0799999999999, "end": 607.7199999999999, "text": " to make a bad call but human doctors disagree all the time he says that's" }, { "start": 607.7199999999999, "end": 613.28, "text": " fine an AI system needs to fit into a process where sources of uncertainty are" }, { "start": 613.28, "end": 619.8399999999999, "text": " discussed rather than simply reject it and this exact this exactly feeds into" }, { "start": 619.8399999999999, "end": 625.9599999999999, "text": " what I've been saying if the air were just to output the source of uncertainty" }, { "start": 625.9599999999999, "end": 632, "text": " and all it thinks about a particular situation then the humans could discuss" }, { "start": 632, "end": 638.92, "text": " it right and then we could get to a better outcome but this only works if" }, { "start": 638.92, "end": 644.92, "text": " the legal framework is given if you regulate and I get I get that point too" }, { "start": 644.92, "end": 650.7199999999999, "text": " you want to assign kind of blame when something goes wrong but you just have" }, { "start": 650.7199999999999, "end": 658.4, "text": " to know that this is what keeps these systems back often finally they say the" }, { "start": 658.4, "end": 666.16, "text": " benefits could be huge there was one nurse that screened 1,000 patients on" }, { "start": 666.16, "end": 673.6, "text": " her own I don't know in what time that is I guess that's over the course of the" }, { "start": 673.6, "end": 680.64, "text": " study or so and with this tool she's unstoppable the patients didn't really" }, { "start": 680.64, "end": 685.28, "text": " care that it was an AI rather than a human reading their images they cared" }, { "start": 685.28, "end": 689.52, "text": " more about what their experience was going to be and that's a general" }, { "start": 689.52, "end": 695.92, "text": " general experience that I get from a lot of people working with human" }, { "start": 695.92, "end": 700.3199999999999, "text": " machine interactions is that the people don't they're not so super excited that" }, { "start": 700.3199999999999, "end": 708.12, "text": " it's a human if they if the machine appears competent I think we've gotten" }, { "start": 708.12, "end": 714.52, "text": " used to AI being quite good at particular tasks and we're actually" }, { "start": 714.52, "end": 719.68, "text": " happy to outsource some of these to them but again if you build something for the" }, { "start": 719.68, "end": 725.64, "text": " real world you have to take into account the real world conditions and this" }, { "start": 725.64, "end": 730.96, "text": " feeds into papers like image net v2 where you all of a sudden have a harder" }, { "start": 730.96, "end": 735.62, "text": " test set it feeds into topics like domain shift transfer learning domain" }, { "start": 735.62, "end": 740.64, "text": " adaptation and these are all research topics so I think problems like this can" }, { "start": 740.64, "end": 744.72, "text": " give rise to entirely new directions of research if you're looking for a PhD" }, { "start": 744.72, "end": 749.68, "text": " topic maybe this is something for you alright thanks for watching this this" }, { "start": 749.68, "end": 754.3199999999999, "text": " was my blabs about the story I hope you enjoyed this and these kind of new" }, { "start": 754.32, "end": 759.4000000000001, "text": " sections it's a new thing I'm doing if you like it subscribe if you didn't like" }, { "start": 759.4, "end": 788.4, "text": " it leave a comment and bye bye" } ]
k1GOF2jmX7c
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Big Transfer (BiT): General Visual Representation Learning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "google", "brain", "cnn", "convolutional neural network", "resnet", "residual network", "pretraining", "finetuning", "vtab", "imagenet", "cifar", "state of the art", "pretrained", "computer vision" ]
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 Baier, Yao-Ai 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 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 this small database. You only have very few labeled samples where the model could learn from. And that just 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 ImageNet 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 large data set and the small data set are at least somewhat overlapping in their... 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 fine-tune on the small data set, that's this step down here, that's called a fine-tuning. When you fine-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. 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 databases 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 dataset. This here is called the ImageNet 21k dataset 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 ImageNet dataset. So I mean just look at this. We're in a situation now where the small model is trained is pre-trained on ImageNet 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 Google can use this in their products because they have probably spent a 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. Alright but that's not topic of this video. So the models here are all pretty much just residual networks. They're all these ResNet 152 I think x4 which means that basically scale the width of each layer by a number of four from the original ResNet architecture and that's pretty much it. This is the architecture. There's nothing really new in this paper. The paper just details what exactly you have to do. Which things exactly matter when you pre-train these things and which ones don't. Therefore I believe 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 will sort of become the standard like we have in BERT now. So whenever you have a visual task you're just gonna start from those in practice. So this I think is mainly relevant for people in practice. Alright here you can see 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 datasets. So ImageNet is one of the tasks they fine tune on or CIFAR 10, CIFAR 100 and so on. And first of all look on the right side this full thing. This is when you take the entire dataset. So often they outperform, they get state-of-the-art on the full datasets. 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 datasets 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 these specialist models but not all of them. So 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 CIFAR 10, this model, so of course you have to pre-train it first on the big dataset, but just taking 5 labels per class you still get like 94% accuracy on CIFAR 10. And that's pretty good. That is pretty impressive especially if you compare it to this baseline model here which is a ResNet pre-trained on just the ImageNet dataset. So that really shows you the power of pre-training with full data. So one thing they say is that in their big dataset in their 300 million images they make sure to remove all the images that then appear in the downstream tasks. Because otherwise it is fairly conceivable that this database here is just scraped from the internet and of course these tasks are often, like CIFAR 10, are also scraped from the internet and also ImageNet. And it is entirely conceivable of course that the test data is already here and they say we remove images but I think they just remove exact duplicates. So it could still be that someone has taken ImageNet and then kind of recoded it into another color scheme or whatnot 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 datasets 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-train something like this. So they divide their findings up in two parts. How to pre-train and how to fine-tune. So how to transfer to downstream tasks. And the methods they find are surprisingly easy. They say there are 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 datasets to pre-train on. So this is the small dataset, the medium dataset and the large dataset. So in this direction you have dataset size. Then here you have accuracy not labeled. Again I guess we can understand accuracy. That's fine. 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 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 general it 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 other people also research in this area they have this sort of empirical finding and hypothesis that if you plot a graph and here is the number of parameters in relation to the data set size. It's a number of parameters in relation to the 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. We've all learned this in our general machine learning course and there is a point here, 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're past the number of data points 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 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. Alright 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 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. They have a batch size of I think 4,000 and they distribute to 500 TPUs so that leaves them with 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 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's standardizes the weights to be of a normal distribution. And just suffice 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. So that's what they do. They do large data large models and group normalization with weight standardization. That's how they pre-train and then how do they fine-tune. They say they have a rule to select hyperparameters. They call the bit hyper rule and that's just sort of a formula of how you have one hyper parameter. So you have one I guess it's a hyper hyper parameter and that hyper hyper parameter you run through their rule and the rule will tell you what each of the hyper parameters should be. So it's like a lookup table basically. It's oh you set this one number and we give you the rest of the hyper parameters and that one rule works pretty well. So you only have to find for fine-tuning you only have to grid search over one hyper parameter. It's not really grid anymore is it? And then they basically decide on the training schedule length resolution and whether to do mixup regularization. Mixup 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. You don't want to go mix it too 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, weight decay to zero, weight decay to initial parameters or dropout. I think they only use weight decay during pre-training and that's it. So let's look at some of the graphs. 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 data set and they come pretty close. Here you can also see how much they improve when pre-training on the larger data set. So far people have basically pre-trained on this ImageNet data set and now that they pre-train on the larger one of course they gain a lot of performance and the largest one isn't even 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 and not really natural and then structured tasks and the structured tasks isn't simply labeling or locating something. It is tasks 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 structured understanding of 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 data set I'm pretty sure that's just a web scrape of photos or mainly photos. So the main improvement you're gonna 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 impressive. So they say when they apply the standard computational budget of ImageNet pre-training when they scale up to the larger data set it seems detrimental. As you can see right here the performance actually goes down when you go to the larger data set. Only if you train longer then your improves. The axis labeling is just amazing here. Standard, long, longer. Oh 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 data set. Sorry it's the same model but the bigger data set. 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. I mean they make a big point out of this but who's to say that someone else doesn't come with like a ten 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 method. So 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 this dashed researcher the noob. So after eight GPU weeks which come on what is that eight GPU weeks that's just eight GPUs for a week. 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 the case learning right here and then it flattens 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 point five million steps where you take two million. So that's the first point. The second point is ImageNet 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 you know 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 CIFAR-10 they reach like 99.4 percent 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 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 image net 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-grained points in these models last thing I want to show I have never seen these image net 21k images these are just funky like look at that so here's the state-of-the-art previously I think said triceratops and the new model now says bit else as 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, "end": 5.76, "text": " Hi there! Today we're talking about Big Transfer, General Visual Representation" }, { "start": 5.76, "end": 12.620000000000001, "text": " Learning by Alexander Kolesnikov, Lukas Baier, Yao-Ai Chai and others of Google" }, { "start": 12.620000000000001, "end": 20.22, "text": " Brain. So this paper is basically an application slash engineering paper for" }, { "start": 20.22, "end": 27.16, "text": " the community and it is about the task of transfer learning for visual tasks. So" }, { "start": 27.16, "end": 32.08, "text": " what does that mean? In a visual task the meaning is basically that the input is" }, { "start": 32.08, "end": 38, "text": " an image. So it could be a classifier where you have an image and you have to" }, { "start": 38, "end": 47, "text": " say that this is a cat. Or it could be, let's say, a medical image of a lung and" }, { "start": 47, "end": 53.64, "text": " you have to point out where the defect in the lung is or if there is a defect" }, { "start": 53.64, "end": 58.32, "text": " in the lung or something like this. As we all know this field is pretty much" }, { "start": 58.32, "end": 64.8, "text": " dominated by CNNs, by convolutional neural networks that take in these" }, { "start": 64.8, "end": 69.68, "text": " images through many layers of convolution. Especially residual networks" }, { "start": 69.68, "end": 75.04, "text": " are doing particularly well on these tasks. The problem of course is that in" }, { "start": 75.04, "end": 81.64, "text": " some tasks you have lots of data and that's fine because CNNs need lots of" }, { "start": 81.64, "end": 86.32, "text": " data to train. But in some tasks, especially these medical tasks, you only" }, { "start": 86.32, "end": 91.44, "text": " have like very small database. Look at this small database. You only have very" }, { "start": 91.44, "end": 97.2, "text": " few labeled samples where the model could learn from. And that just is not" }, { "start": 97.2, "end": 101.36, "text": " enough to learn these big models that would perform well. So you will have to" }, { "start": 101.36, "end": 107.16, "text": " settle for a less performing model. Now the solution or one of the solutions is" }, { "start": 107.16, "end": 112.75999999999999, "text": " transfer learning. In transfer learning what you do is you take a large data set," }, { "start": 112.75999999999999, "end": 119.08, "text": " for example the ImageNet data set. You have this big data set right here and you" }, { "start": 119.08, "end": 125.6, "text": " train your CNN on that. And then you take that CNN and you do what's called a" }, { "start": 125.6, "end": 131.92, "text": " fine-tuning step on this small data set. So you take the CNN that you gained from" }, { "start": 131.92, "end": 136.8, "text": " the large data set as a starting point and then you just train for a few steps." }, { "start": 136.8, "end": 142.44, "text": " You just kind of adapt it to this final data set that you actually want to train" }, { "start": 142.44, "end": 147.88000000000002, "text": " it on. And that usually helps. And why does that help? Because you sort of hope" }, { "start": 147.88000000000002, "end": 153.44, "text": " that the large data set and the small data set are at least somewhat" }, { "start": 153.44, "end": 160.36, "text": " overlapping in their... So the images in the large data set are somewhat" }, { "start": 160.36, "end": 164.32000000000002, "text": " similar to the images in the small data set. It doesn't need to be super similar" }, { "start": 164.32, "end": 171.48, "text": " but just somewhat. And you hope that the features that the CNN learns from the" }, { "start": 171.48, "end": 178.28, "text": " large data set are useful in the small data set. Because then if that is the" }, { "start": 178.28, "end": 182.84, "text": " case when you fine-tune on the small data set, that's this step down here," }, { "start": 182.84, "end": 188.12, "text": " that's called a fine-tuning. When you fine-tune you can pretty much reuse" }, { "start": 188.12, "end": 192.76, "text": " those features. You only have to adjust them a little bit. And you just" }, { "start": 192.76, "end": 198.64, "text": " have to learn how to map the features to the output, which now is of course" }, { "start": 198.64, "end": 202.92, "text": " different than in the original task. But you won't have to rediscover the" }, { "start": 202.92, "end": 208.44, "text": " features. So that's why transfer learning can help. So the first phase is called" }, { "start": 208.44, "end": 214.45999999999998, "text": " pre-training. The second phase is called fine-tuning. Now the ultimate goal in" }, { "start": 214.45999999999998, "end": 221.23999999999998, "text": " this is the following. Imagine you have like a giant database of data." }, { "start": 221.24, "end": 227.08, "text": " This is giant. Look at the size comparison to the others. And so you have" }, { "start": 227.08, "end": 235.68, "text": " this big big database of images. And you train a CNN on that big database of" }, { "start": 235.68, "end": 242.68, "text": " labeled images. Now what you're hoping is that you can do this once and then this" }, { "start": 242.68, "end": 249.68, "text": " one CNN trained on this giant data set will become the starting point for all" }, { "start": 249.68, "end": 255.44, "text": " kinds of small tasks now. So basically you can post this on a repository online" }, { "start": 255.44, "end": 261.76, "text": " and everyone that has a visual task will not train from scratch. But they will" }, { "start": 261.76, "end": 268.16, "text": " basically take this one CNN as a starting point. It is very similar to" }, { "start": 268.16, "end": 273.36, "text": " what people are doing right now with BERT or generally these transformer" }, { "start": 273.36, "end": 277.24, "text": " language models. You never want to train them from scratch. You always want to" }, { "start": 277.24, "end": 283.24, "text": " train from a pre-trained state that someone else has done. Because usually" }, { "start": 283.24, "end": 287.92, "text": " the big work is now shifted to the pre-training. So the goal is to find" }, { "start": 287.92, "end": 296.56, "text": " this one universal starting point for visual learning. And of course no better" }, { "start": 296.56, "end": 303.6, "text": " place to do this than Google. They certainly do have a giant databases of" }, { "start": 303.6, "end": 308.84000000000003, "text": " images. They certainly have lots of computation which we're going to see is" }, { "start": 308.84000000000003, "end": 314.56, "text": " very necessary for something like this. Now they do train three different models." }, { "start": 314.56, "end": 320.8, "text": " Their model is called BIT and they train three different variants BIT. Small," }, { "start": 320.8, "end": 330.64000000000004, "text": " medium and large. So the L model is trained on 300 million images. The medium" }, { "start": 330.64, "end": 338.91999999999996, "text": " model is trained on 14 million images. So this is the I think it's called JFT" }, { "start": 338.91999999999996, "end": 345.88, "text": " dataset. This here is called the ImageNet 21k dataset which looks pretty funky. It" }, { "start": 345.88, "end": 351.64, "text": " has like objects in front of weird backgrounds and stuff like that. And the" }, { "start": 351.64, "end": 360.44, "text": " small is simply trained on the 1.3 million ImageNet dataset. So I mean just" }, { "start": 360.44, "end": 364.88, "text": " look at this. We're in a situation now where the small model is trained is" }, { "start": 364.88, "end": 372.24, "text": " pre-trained on ImageNet just for reference. If you had imagined this five" }, { "start": 372.24, "end": 376.96, "text": " years ago this you would not have maybe you would have guessed it but it's still" }, { "start": 376.96, "end": 383.24, "text": " impressive. So they do release these two models here the medium and the small one" }, { "start": 383.24, "end": 388.98, "text": " pre-trained I believe. They don't release the large one which maybe that's the" }, { "start": 388.98, "end": 394.48, "text": " price we have to pay for getting the medium and the small one. The fact that" }, { "start": 394.48, "end": 399.28000000000003, "text": " now Google can use this in their products because they have probably" }, { "start": 399.28000000000003, "end": 404.56, "text": " spent a considerable amount of money in doing this. I'm not sure this is a" }, { "start": 404.56, "end": 408.24, "text": " philosophical discussion whether in the interest of science they should really" }, { "start": 408.24, "end": 413.24, "text": " solve. Because they do give the sort of exact training protocol. You just need" }, { "start": 413.24, "end": 421.68, "text": " the money basically. Alright but that's not topic of this video. So the" }, { "start": 421.68, "end": 427.12, "text": " models here are all pretty much just residual networks. They're all" }, { "start": 427.12, "end": 434.16, "text": " these ResNet 152 I think x4 which means that basically scale the width of" }, { "start": 434.16, "end": 438.48, "text": " each layer by a number of four from the original ResNet architecture and that's" }, { "start": 438.48, "end": 443.92, "text": " pretty much it. This is the architecture. There's nothing really new in" }, { "start": 443.92, "end": 449.32, "text": " this paper. The paper just details what exactly you have to do. Which" }, { "start": 449.32, "end": 455, "text": " things exactly matter when you pre-train these things and which ones don't." }, { "start": 455, "end": 461.08000000000004, "text": " Therefore I believe it is a pretty good paper and I think that these" }, { "start": 461.08000000000004, "end": 466.92, "text": " models here the M and S models and maybe someone else trains an L model and" }, { "start": 466.92, "end": 472.24, "text": " releases it will sort of become the standard like we have in BERT now. So" }, { "start": 472.24, "end": 477.8, "text": " whenever you have a visual task you're just gonna start from those in practice." }, { "start": 477.8, "end": 484.6, "text": " So this I think is mainly relevant for people in practice. Alright here you can" }, { "start": 484.6, "end": 492.24, "text": " see these models. First of all excellent excellent not labeling of your x-axis." }, { "start": 492.24, "end": 499.08, "text": " Absolutely beautiful. The x-axis I believe is the number of samples per" }, { "start": 499.08, "end": 503.7, "text": " data class. So now they take their pre-trained model this bit L and they" }, { "start": 503.7, "end": 508.64, "text": " fine-tune it on these datasets. So ImageNet is one of the tasks they fine" }, { "start": 508.64, "end": 516.2, "text": " tune on or CIFAR 10, CIFAR 100 and so on. And first of all look on the right side" }, { "start": 516.2, "end": 520.54, "text": " this full thing. This is when you take the entire dataset. So often they" }, { "start": 520.54, "end": 526.04, "text": " outperform, they get state-of-the-art on the full datasets. Now they do compare" }, { "start": 526.04, "end": 532.8399999999999, "text": " against what they call generalist models. So generalist models are ones that have" }, { "start": 532.8399999999999, "end": 538.8, "text": " this particular training protocol where they train on one big giant database" }, { "start": 538.8, "end": 543.28, "text": " and then fine-tune to all the other tasks. They do not achieve state-of-the-art" }, { "start": 543.28, "end": 549.0999999999999, "text": " on all datasets in what they call specialist models. The specialist models" }, { "start": 549.1, "end": 554.98, "text": " would be such models that have this exact task in mind and therefore they" }, { "start": 554.98, "end": 558.84, "text": " don't care about other tasks. They outperform some of these specialist" }, { "start": 558.84, "end": 564, "text": " models but not all of them. So this is not the new state of the" }, { "start": 564, "end": 569.48, "text": " art in everything but it is in this transfer learning regime. And I think" }, { "start": 569.48, "end": 575.74, "text": " even more important if you see on the left this is in the small label regime." }, { "start": 575.74, "end": 582.92, "text": " So here you have something like 100 or 25 or 10 or even 5 labels per class. And" }, { "start": 582.92, "end": 588.96, "text": " if you take 5 labels per class for CIFAR 10, this model, so of course you have to" }, { "start": 588.96, "end": 594.52, "text": " pre-train it first on the big dataset, but just taking 5 labels per class you" }, { "start": 594.52, "end": 601.2, "text": " still get like 94% accuracy on CIFAR 10. And that's pretty good. That is pretty" }, { "start": 601.2, "end": 605.5600000000001, "text": " impressive especially if you compare it to this baseline model here which is a" }, { "start": 605.56, "end": 610.9, "text": " ResNet pre-trained on just the ImageNet dataset. So that really shows you the" }, { "start": 610.9, "end": 621, "text": " power of pre-training with full data. So one thing they say is that in their big" }, { "start": 621, "end": 629.68, "text": " dataset in their 300 million images they make sure to remove all the images that" }, { "start": 629.68, "end": 636.0799999999999, "text": " then appear in the downstream tasks. Because otherwise it is fairly" }, { "start": 636.0799999999999, "end": 640.64, "text": " conceivable that this database here is just scraped from the internet and of" }, { "start": 640.64, "end": 645, "text": " course these tasks are often, like CIFAR 10, are also scraped from the internet" }, { "start": 645, "end": 650.7199999999999, "text": " and also ImageNet. And it is entirely conceivable of course that the" }, { "start": 650.7199999999999, "end": 658.56, "text": " test data is already here and they say we remove images but I think they just" }, { "start": 658.56, "end": 665.1199999999999, "text": " remove exact duplicates. So it could still be that someone has taken" }, { "start": 665.1199999999999, "end": 669.88, "text": " ImageNet and then kind of recoded it into another color scheme or whatnot or" }, { "start": 669.88, "end": 677.2399999999999, "text": " just compressed it a bit more and then they find these images on the web." }, { "start": 677.2399999999999, "end": 684.28, "text": " So it's a little shaky this whole thing because these datasets might just be" }, { "start": 684.28, "end": 690.12, "text": " part of one another but you know given the results I do generally believe the" }, { "start": 690.12, "end": 697.56, "text": " improvements here. But yeah. So I guess what we need is like people to actually" }, { "start": 697.56, "end": 701.9599999999999, "text": " go out with cameras and shoot new pictures for a new test set. But in any" }, { "start": 701.9599999999999, "end": 708.4399999999999, "text": " case let's dive into how to pre-train something like this. So they divide their" }, { "start": 708.44, "end": 714.2800000000001, "text": " findings up in two parts. How to pre-train and how to fine-tune. So how to" }, { "start": 714.2800000000001, "end": 719.72, "text": " transfer to downstream tasks. And the methods they find are surprisingly" }, { "start": 719.72, "end": 725.24, "text": " easy. They say there are two components to pre-training. The first component is" }, { "start": 725.24, "end": 731.2800000000001, "text": " scale. So you have to have a lot of data and a lot of models and that is a pretty" }, { "start": 731.2800000000001, "end": 736.2800000000001, "text": " important recognition. So down here they have this ablation where they scale up" }, { "start": 736.28, "end": 744, "text": " the model and scale up the data. So look at this for example. You can see here you" }, { "start": 744, "end": 748.72, "text": " have the different datasets to pre-train on. So this is the small dataset, the" }, { "start": 748.72, "end": 754.0799999999999, "text": " medium dataset and the large dataset. So in this direction you have dataset size." }, { "start": 754.0799999999999, "end": 760.6, "text": " Then here you have accuracy not labeled. Again I guess we can understand" }, { "start": 760.6, "end": 768.72, "text": " accuracy. That's fine. And there we have the different models. Now the" }, { "start": 768.72, "end": 775.28, "text": " larger the dot here is the larger the model architecture. And you can see" }, { "start": 775.28, "end": 782.6, "text": " within the individual bins the larger the model the better performance you" }, { "start": 782.6, "end": 789.34, "text": " usually get. But as you can see like here this improvement in the large models" }, { "start": 789.34, "end": 795.76, "text": " isn't as much as when you have much data. And you can also see by the slope of the" }, { "start": 795.76, "end": 802.76, "text": " line here the larger amounts of data help more when you have larger models. So" }, { "start": 802.76, "end": 811.72, "text": " only scaling up the data is not as effective as scaling up the" }, { "start": 811.72, "end": 817.48, "text": " data and the model at the same time. And in some cases like in this small" }, { "start": 817.48, "end": 823.76, "text": " architecture here it actually hurts to incorporate more data. At least they say" }, { "start": 823.76, "end": 829, "text": " that. And you can also see that here. And here it just doesn't help as much anymore" }, { "start": 829, "end": 834.62, "text": " if you incorporate more data. So if your model is too small you can't handle the" }, { "start": 834.62, "end": 837.96, "text": " big data. Of course there are weird effects like here the performance goes" }, { "start": 837.96, "end": 842.88, "text": " down and then up with the larger data. So this might actually be an effect of the" }, { "start": 842.88, "end": 849.24, "text": " images in these data sets being somewhat qualitatively different also with" }, { "start": 849.24, "end": 856.24, "text": " respect to the task that you are training for. But in general it holds that" }, { "start": 856.24, "end": 863.8, "text": " you need a combination of data set size and model size to go up. And this I think" }, { "start": 863.8, "end": 870.12, "text": " might be an indication of where we are in Belkin's double descent curve. So if" }, { "start": 870.12, "end": 876.96, "text": " you look at the researcher Mikhail Belkin and other people also" }, { "start": 876.96, "end": 885.36, "text": " research in this area they have this sort of empirical finding and hypothesis" }, { "start": 885.36, "end": 893.64, "text": " that if you plot a graph and here is the number of parameters in relation" }, { "start": 893.64, "end": 898.72, "text": " to the data set size. It's a number of parameters in relation to the size" }, { "start": 898.72, "end": 907.8000000000001, "text": " of data. And here is your validation loss. Then what happens as you have very" }, { "start": 907.8000000000001, "end": 912.44, "text": " little parameters you can add more parameters to your model to get better" }, { "start": 912.44, "end": 917.6800000000001, "text": " validation loss. This is you know we get a better model and we train" }, { "start": 917.6800000000001, "end": 922.2, "text": " that and we get better. And then at some point you'll start to overfit." }, { "start": 922.2, "end": 925.5600000000001, "text": " We've all learned this in our general machine learning course and there is a" }, { "start": 925.56, "end": 930.56, "text": " point here, what is called the interpolation threshold, where you have" }, { "start": 930.56, "end": 935.64, "text": " this is one so the number of parameters is equal to the number of data points" }, { "start": 935.64, "end": 940.28, "text": " which is just interpolating your training data. Sorry the data point here" }, { "start": 940.28, "end": 951.3199999999999, "text": " that's train. But then the discovery sort of is that this comes down again and it" }, { "start": 951.32, "end": 957.5600000000001, "text": " stays down. So as you go up in number of data points, sorry number of parameters" }, { "start": 957.5600000000001, "end": 961.44, "text": " with the same data set you're perfectly fitting the training data set. You're" }, { "start": 961.44, "end": 968.2800000000001, "text": " past the number of data points in your model but still your validation" }, { "start": 968.2800000000001, "end": 973.12, "text": " loss comes down and there's various hypotheses why this could happen. And" }, { "start": 973.12, "end": 981.64, "text": " here we find ourselves maybe in this sort of situation where if you have a" }, { "start": 981.64, "end": 989.64, "text": " model right here and you want to scale it you want to add more data you can't" }, { "start": 989.64, "end": 995.96, "text": " just keep the model constant because if you add more data that will shift you to" }, { "start": 995.96, "end": 999.6800000000001, "text": " the left here because you add more data but you keep the number of" }, { "start": 999.68, "end": 1004.12, "text": " parameters the same so this number will shift to the left and you actually go up" }, { "start": 1004.12, "end": 1010.0799999999999, "text": " in your validation loss. So maybe this is actually what's happening right here the" }, { "start": 1010.0799999999999, "end": 1016.3599999999999, "text": " fact that the model is too small. This is just a hypothesis by me. So if you want" }, { "start": 1016.3599999999999, "end": 1019.8399999999999, "text": " to up your number of data points you also have to up your number of" }, { "start": 1019.8399999999999, "end": 1027.12, "text": " parameters and that will keep it going and maybe these models here are more on" }, { "start": 1027.12, "end": 1031.6, "text": " this side of this interpolation threshold and the models where it" }, { "start": 1031.6, "end": 1039.28, "text": " doesn't happen might be more over here. Though that is a big thing to assume." }, { "start": 1039.28, "end": 1046.9599999999998, "text": " Maybe not. Now that I think about it since they have even more parameters" }, { "start": 1046.9599999999998, "end": 1054.36, "text": " here they would be even more here somewhere so maybe you add a bunch of" }, { "start": 1054.36, "end": 1062.6, "text": " data it's just not as bad. There might be some weird interactions here." }, { "start": 1062.6, "end": 1070.3999999999999, "text": " Like this. Who knows? Let's just skip this. In any case the message here is you" }, { "start": 1070.3999999999999, "end": 1077.76, "text": " need more model and more data at the same time. Alright then there is a second" }, { "start": 1077.76, "end": 1088.4, "text": " message a second recipe for pre-training. There we are. The second method is group" }, { "start": 1088.4, "end": 1095.76, "text": " normalization and weight standardization. So they criticize batch norm. Batch norm" }, { "start": 1095.76, "end": 1103.36, "text": " has of course been used a lot. That is where if you have a batch of data and" }, { "start": 1103.36, "end": 1109.8799999999999, "text": " you put it through your layers and it has some intermediate" }, { "start": 1109.8799999999999, "end": 1114.1999999999998, "text": " representation what you want to do is you want to calculate sort of the mean" }, { "start": 1114.1999999999998, "end": 1120.7199999999998, "text": " and variance of your data in each of the features and then make it such that it's" }, { "start": 1120.7199999999998, "end": 1127.9199999999998, "text": " nice mean one and standard deviation. So mean zero and standard deviation of one." }, { "start": 1127.92, "end": 1134.92, "text": " That is called batch norm but of course it is dependent on your batch size. So it" }, { "start": 1134.92, "end": 1139.28, "text": " is dependent on how many data points you have because that's how well you can" }, { "start": 1139.28, "end": 1144.64, "text": " estimate these mean and variance parameters. And what people do nowadays" }, { "start": 1144.64, "end": 1150.48, "text": " is they take these batches and they group them into different groups and" }, { "start": 1150.48, "end": 1157.52, "text": " they distribute those groups onto many many machines which is called data" }, { "start": 1157.52, "end": 1162.6399999999999, "text": " parallelism especially with TPUs nowadays. You can just distribute" }, { "start": 1162.6399999999999, "end": 1168.8, "text": " everything to so many TPUs. I believe they say they distribute to something" }, { "start": 1168.8, "end": 1178.16, "text": " like 500 TPUs. They have a batch size of I think 4,000 and they" }, { "start": 1178.16, "end": 1184.6399999999999, "text": " distribute to 500 TPUs so that leaves them with eight samples per batch." }, { "start": 1184.64, "end": 1189.8400000000001, "text": " So this is eight and eight is just not very good for batch norm and if you have" }, { "start": 1189.8400000000001, "end": 1195.0800000000002, "text": " to if you want to circumvent that you need to in each layer globally sync with" }, { "start": 1195.0800000000002, "end": 1199.92, "text": " all of the other workers your batch norm parameters and that slows you down. So" }, { "start": 1199.92, "end": 1206.92, "text": " people have gone around this using what they call group normalization and weight" }, { "start": 1206.92, "end": 1211.8400000000001, "text": " standardization. So these two techniques of weight standardization is a" }, { "start": 1211.84, "end": 1217.8799999999999, "text": " addition to group normalization. They don't require the other samples in the" }, { "start": 1217.8799999999999, "end": 1223.6399999999999, "text": " batch. They work on a per sample basis and they normalize the features within" }, { "start": 1223.6399999999999, "end": 1231.1999999999998, "text": " groups of each channel. So the group normalization groups together" }, { "start": 1231.1999999999998, "end": 1237.04, "text": " different features within a sample and then normalizes across that and the" }, { "start": 1237.04, "end": 1241.52, "text": " weight standardization is a bit like standardizing the features but it's" }, { "start": 1241.52, "end": 1249.4, "text": " standardizes the weights to be of a normal distribution. And just suffice to" }, { "start": 1249.4, "end": 1254.16, "text": " say these are standard techniques that you can build in and they allow you to" }, { "start": 1254.16, "end": 1259.36, "text": " not have to synchronize constantly between your workers at the training" }, { "start": 1259.36, "end": 1264.68, "text": " time which makes everything a lot faster and also not a problem that you just" }, { "start": 1264.68, "end": 1272.88, "text": " have eight samples per worker. So that's what they do. They do large data" }, { "start": 1272.88, "end": 1279.28, "text": " large models and group normalization with weight standardization. That's how" }, { "start": 1279.28, "end": 1284.9, "text": " they pre-train and then how do they fine-tune. They say they have a rule to" }, { "start": 1284.9, "end": 1289.22, "text": " select hyperparameters. They call the bit hyper rule and that's just sort of a" }, { "start": 1289.22, "end": 1297.24, "text": " formula of how you have one hyper parameter. So you have one I guess it's" }, { "start": 1297.24, "end": 1302.08, "text": " a hyper hyper parameter and that hyper hyper parameter you run through their" }, { "start": 1302.08, "end": 1308.08, "text": " rule and the rule will tell you what each of the hyper parameters should be." }, { "start": 1308.08, "end": 1313.44, "text": " So it's like a lookup table basically. It's oh you set this one" }, { "start": 1313.44, "end": 1319.72, "text": " number and we give you the rest of the hyper parameters and that one rule works" }, { "start": 1319.72, "end": 1324.48, "text": " pretty well. So you only have to find for fine-tuning you only have to grid" }, { "start": 1324.48, "end": 1332.52, "text": " search over one hyper parameter. It's not really grid anymore is it? And then they" }, { "start": 1332.52, "end": 1341.24, "text": " basically decide on the training schedule length resolution and whether to" }, { "start": 1341.24, "end": 1346.92, "text": " do mixup regularization. Mixup is a technique that can help when you have" }, { "start": 1346.92, "end": 1352.84, "text": " very little data and what it does is it interpolates between data points and" }, { "start": 1352.84, "end": 1357.56, "text": " also trains on kind of like data points from half this class and half that class" }, { "start": 1357.56, "end": 1365.32, "text": " just to make more data available. But they all have this packed into this rule" }, { "start": 1365.32, "end": 1370.6, "text": " and they of course the exact settings of this rule are presented. So you can look" }, { "start": 1370.6, "end": 1376.1999999999998, "text": " it up then they have a data pre-processing, resize the image to a" }, { "start": 1376.1999999999998, "end": 1380.1999999999998, "text": " square, crop out small random square, randomly horizontally flip the image at" }, { "start": 1380.1999999999998, "end": 1384.56, "text": " training time. So they basically describe a standard training protocol here. You" }, { "start": 1384.56, "end": 1393.32, "text": " don't want to go mix it too up too much. The only thing they say surprisingly we" }, { "start": 1393.32, "end": 1398.1999999999998, "text": " do not use any form any of the following forms of regularization during downstream" }, { "start": 1398.2, "end": 1405.16, "text": " tuning, weight decay to zero, weight decay to initial parameters or dropout. I think" }, { "start": 1405.16, "end": 1414.76, "text": " they only use weight decay during pre-training and that's it. So let's" }, { "start": 1414.76, "end": 1419.72, "text": " look at some of the graphs. We've already seen some. Here is where they pretty much" }, { "start": 1419.72, "end": 1425.28, "text": " outperform the generalist, these generalist models on all of these tasks" }, { "start": 1425.28, "end": 1430.04, "text": " including this visual task adaptation benchmark. I've made a video about this." }, { "start": 1430.04, "end": 1435, "text": " This is a benchmark that includes 19 different visual tasks from all over the" }, { "start": 1435, "end": 1440.44, "text": " place and they have significant improvement here as you can see. They do" }, { "start": 1440.44, "end": 1445.52, "text": " not always outperform these specialist models but as you can see they" }, { "start": 1445.52, "end": 1450.32, "text": " outperform for example this on the flowers data set and they come pretty" }, { "start": 1450.32, "end": 1461.72, "text": " close. Here you can also see how much they improve when pre-training on the" }, { "start": 1461.72, "end": 1466, "text": " larger data set. So far people have basically pre-trained on this ImageNet" }, { "start": 1466, "end": 1471.9199999999998, "text": " data set and now that they pre-train on the larger one of course they gain a lot" }, { "start": 1471.92, "end": 1480.64, "text": " of performance and the largest one isn't even in this table. So what I" }, { "start": 1480.64, "end": 1486.96, "text": " finally want to look at is this visual task adaptation benchmark. This consists" }, { "start": 1486.96, "end": 1492, "text": " of 19 tasks and they're divided into natural tasks which are kind of natural" }, { "start": 1492, "end": 1497.5600000000002, "text": " images and then specialized tasks which are let's say the medical images and not" }, { "start": 1497.56, "end": 1502.44, "text": " really natural and then structured tasks and the structured tasks isn't simply" }, { "start": 1502.44, "end": 1507.52, "text": " labeling or locating something. It is tasks where you have to maybe reason" }, { "start": 1507.52, "end": 1515, "text": " about something. So let's say there is an image and there is a cup right here and" }, { "start": 1515, "end": 1520.4199999999998, "text": " there is a glass right here and the question is what's to the left of the" }, { "start": 1520.4199999999998, "end": 1525.4199999999998, "text": " glass and there's a bunch of other stuff around here and you have to say" }, { "start": 1525.42, "end": 1531.6000000000001, "text": " the cup. So it sort of requires a structured understanding of the image" }, { "start": 1531.6000000000001, "end": 1538, "text": " and you can see the main performance boost here comes in the natural images" }, { "start": 1538, "end": 1546, "text": " which is to be expected. So you only get what you feed in and this 300 million" }, { "start": 1546, "end": 1551.88, "text": " image data set I'm pretty sure that's just a web scrape of photos or mainly" }, { "start": 1551.88, "end": 1557.8000000000002, "text": " photos. So the main improvement you're gonna get is on pictures that are similar" }, { "start": 1557.8000000000002, "end": 1562.2, "text": " to that as we said at the beginning and these natural tasks have images like" }, { "start": 1562.2, "end": 1568.2, "text": " that and you can see that the model here improves extremely in that category," }, { "start": 1568.2, "end": 1574.0800000000002, "text": " improves slightly in this specialized thing and only improves a little bit in" }, { "start": 1574.08, "end": 1582.9199999999998, "text": " the structured tasks. So this as I said is to be expected. Just know if you" }, { "start": 1582.9199999999998, "end": 1588.72, "text": " use this model know what is in there. You have to know what it does, what it does" }, { "start": 1588.72, "end": 1593.9199999999998, "text": " well. It does well on natural images that are similar to what it was pre-trained" }, { "start": 1593.92, "end": 1606.16, "text": " on. Okay so they do have some analysis here and we've already went to most of" }, { "start": 1606.16, "end": 1615.8000000000002, "text": " them. I find this to be pretty impressive. So they say when they apply" }, { "start": 1615.8000000000002, "end": 1621.8400000000001, "text": " the standard computational budget of ImageNet pre-training when they scale" }, { "start": 1621.84, "end": 1625.6399999999999, "text": " up to the larger data set it seems detrimental. As you can see right here" }, { "start": 1625.6399999999999, "end": 1631.6399999999999, "text": " the performance actually goes down when you go to the larger data set. Only if" }, { "start": 1631.6399999999999, "end": 1637.04, "text": " you train longer then your improves. The axis labeling is just amazing here." }, { "start": 1637.04, "end": 1647.56, "text": " Standard, long, longer. Oh how long you train for? Longer. Thanks. But I guess the" }, { "start": 1647.56, "end": 1654.9199999999998, "text": " point is taken that you have to invest more computation along with your" }, { "start": 1654.9199999999998, "end": 1658.8, "text": " bigger model and bigger data set. Sorry it's the same model but the bigger data" }, { "start": 1658.8, "end": 1667.84, "text": " set. They also make some other points here that if you for example if you" }, { "start": 1667.84, "end": 1672.36, "text": " decrease your learning rate too early or set your weight decay parameter" }, { "start": 1672.36, "end": 1677.6399999999999, "text": " differently that also hurts you. So on the right here you see a smaller weight" }, { "start": 1677.6399999999999, "end": 1683.8799999999999, "text": " decay initially looks better. So initially you're higher but through the" }, { "start": 1683.8799999999999, "end": 1689.04, "text": " training you end up at a worse place than a higher setting right here. I" }, { "start": 1689.04, "end": 1693.9199999999998, "text": " mean they make a big point out of this but who's to say that someone else" }, { "start": 1693.9199999999998, "end": 1699.4399999999998, "text": " doesn't come with like a ten times longer training and figures out that" }, { "start": 1699.44, "end": 1707.48, "text": " ultimately you start off like this and then maybe goes up super high. So to me" }, { "start": 1707.48, "end": 1712.48, "text": " the lessons learned here is pretty much that there's always a way to" }, { "start": 1712.48, "end": 1720.3200000000002, "text": " get more performance out of more compute and probably there is a way to schedule" }, { "start": 1720.3200000000002, "end": 1723.76, "text": " all of these things because that's combined with decaying learning rate and" }, { "start": 1723.76, "end": 1728.8, "text": " so on. There's probably a way to schedule these things with the current" }, { "start": 1728.8, "end": 1735.6399999999999, "text": " method. So with this particular method that would end up somewhere here we just" }, { "start": 1735.6399999999999, "end": 1740.68, "text": " haven't found it yet because it's so complex. I would guess that is the" }, { "start": 1740.68, "end": 1745.84, "text": " case. Here they make an interesting point that if you decay the learning rate too" }, { "start": 1745.84, "end": 1751.8799999999999, "text": " early then you also end up at a worse place. So this this dashed researcher" }, { "start": 1751.88, "end": 1759, "text": " the noob. So after eight GPU weeks which come on what is that eight GPU weeks" }, { "start": 1759, "end": 1766.92, "text": " that's just eight GPUs for a week. That's nothing nothing. It looks like this" }, { "start": 1766.92, "end": 1771.48, "text": " right it looks fairly flat and this researcher now decides to decay the" }, { "start": 1771.48, "end": 1775.92, "text": " learning rate and that results in this thing here. So decays the learning rate" }, { "start": 1775.92, "end": 1782.76, "text": " here here and here. Sorry not here. So the case learning right here and then it" }, { "start": 1782.76, "end": 1786.8400000000001, "text": " flattens out again and then decays the learning rate again ends up at this" }, { "start": 1786.8400000000001, "end": 1793.4, "text": " level. Yet if you train for longer you can see right here if you look over eight" }, { "start": 1793.4, "end": 1798.3200000000002, "text": " months you can see that there is a slight upward trend still and it hasn't" }, { "start": 1798.3200000000002, "end": 1804.1200000000001, "text": " converged yet and you can if you decrease the learning rate only later" }, { "start": 1804.12, "end": 1810.76, "text": " and always wait for this to fully converge then you will end up at a" }, { "start": 1810.76, "end": 1817.9199999999998, "text": " better place right here above 70. Again who's to say that if I just wait here" }, { "start": 1817.9199999999998, "end": 1826.2399999999998, "text": " there isn't a slight upward trend if I wait for eight GPU years or eight GPU" }, { "start": 1826.2399999999998, "end": 1832.6799999999998, "text": " solar system births then there might be even a better point to decay finally" }, { "start": 1832.68, "end": 1838.76, "text": " decay the learning rate and then go up. I mean again this this researcher here" }, { "start": 1838.76, "end": 1843.96, "text": " only takes point five million steps where you take two million. So that's the" }, { "start": 1843.96, "end": 1850, "text": " first point. The second point is ImageNet or visual state-of-the-art" }, { "start": 1850, "end": 1856.52, "text": " research is now officially out of the hands of academia. This is it. If" }, { "start": 1856.52, "end": 1861.64, "text": " you see things like if you see a paper dissing on people that only wait eight" }, { "start": 1861.64, "end": 1868.48, "text": " GPU weeks to decrease their learning rate for the first time and advocating" }, { "start": 1868.48, "end": 1872.2800000000002, "text": " that you should you know at least wait until eight GPU months actually they" }, { "start": 1872.2800000000002, "end": 1882.6000000000001, "text": " wait twice as long it's over that's it. Yeah bye bye. Maybe maybe you know you" }, { "start": 1882.6000000000001, "end": 1889.98, "text": " want to do some theory or something yeah bye bye. What I find interesting is the" }, { "start": 1889.98, "end": 1895.8, "text": " mistakes so since on CIFAR-10 they reach like 99.4 percent there's only a" }, { "start": 1895.8, "end": 1899.88, "text": " handful of mistakes that they're still making because it's not that large of a" }, { "start": 1899.88, "end": 1911.76, "text": " data set and they do classify it so red in particular I think means red is the" }, { "start": 1911.76, "end": 1916.72, "text": " ground truth label is correct but green is the machine is correct and the" }, { "start": 1916.72, "end": 1920.6000000000001, "text": " ground truth label is wrong and you can see there is a fair number of green" }, { "start": 1920.6000000000001, "end": 1929.1000000000001, "text": " things here right so the model says ship and the label says cat and the model" }, { "start": 1929.1000000000001, "end": 1937.84, "text": " says bird and the label says cat clearly this this would be one weird cat so it" }, { "start": 1937.84, "end": 1942.76, "text": " gets to the point where you you also have to expect these errors to be in the" }, { "start": 1942.76, "end": 1948, "text": " training set so it could just be that the model here doesn't necessarily even" }, { "start": 1948, "end": 1951.36, "text": " make those mistakes but it's just somewhat consistent with the training" }, { "start": 1951.36, "end": 1956.8, "text": " set in making the mistakes and also here on image net they have selected ones" }, { "start": 1956.8, "end": 1962.04, "text": " where you know the model says notebook but it's actually laptop and the model" }, { "start": 1962.04, "end": 1968, "text": " says mouse but it's actually spacebar you know the model says Alp and it's ski" }, { "start": 1968, "end": 1978.56, "text": " so or here the model the model says candle but it's a this is a dishwasher" }, { "start": 1978.56, "end": 1990.52, "text": " what so you see that the the the types of mistakes here we get to very quirky" }, { "start": 1990.52, "end": 1996.48, "text": " very fine-grained points in these models last thing I want to show I have never" }, { "start": 1996.48, "end": 2005.24, "text": " seen these image net 21k images these are just funky like look at that so" }, { "start": 2005.24, "end": 2011.2, "text": " here's the state-of-the-art previously I think said triceratops and the new" }, { "start": 2011.2, "end": 2020.3600000000001, "text": " model now says bit else as starfish good job bit L you wow probably the correct" }, { "start": 2020.36, "end": 2028.76, "text": " label would just be weird and this no okay I don't want to rag on this too" }, { "start": 2028.76, "end": 2033.6, "text": " much this is a cool paper I believe this will be the new starting point for a lot" }, { "start": 2033.6, "end": 2039.56, "text": " of practitioners in when they do visual tasks I always as always invite you to" }, { "start": 2039.56, "end": 2043.9199999999998, "text": " check out the paper subscribe to the channel leave a like leave a comment if" }, { "start": 2043.92, "end": 2050.12, "text": " you want I do read them usually and bye bye" } ]
tjbEVY5XIk0
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Divide-and-Conquer Monte Carlo Tree Search For Goal-Directed Planning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "reinforcement learning", "deep rl", "planning", "alphago", "alphazero", "alpha go", "alpha zero", "mcts", "monte carlo", "tree search", "subdivision", "recursive", "training data", "hindsight experience replay" ]
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. Divide and Conquer Monte Carlo Tree Search for Goal-Directed Planning by Gian Battista Parascondolo and Lars Pyzing and a list of other authors. I believe this is from DeepMind and Max Planck and Eta and... yeah that's it. Alright, 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're on the algorithm. 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're traditionally reinforcement learning you would think I'm just gonna go ahead and run 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, I 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 AlphaGo or AlphaZero where you know if I move to the right here I'm going to be here. So you will know once you've reached the goal. If I'm here I go down I reach the goal. 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 of multiple different paths. So you can think ahead what would happen if I move right, what would happen if I move 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 move down instead? So you can easily see the planning problem becomes a tree search problem. In this case we've done a breadth first search and eventually you'll see that this will get you to the goal. So this breadth first search or maybe you want to employ 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 four to move left up down or 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 real 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 evaluates a heuristic to say what's the the value here and so on so it is in for some problems an 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 edge could 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 right so this now remember our long out 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 plan 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 on oh 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 gonna happen in here this half a plan is a node in the tree that we're searching over and then it splits it 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 note even though in itself it is a plan a tree string in this case and each of the two sub problems would become these particular 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 we're going to traverse this what they call these or nodes so they they divide the problem into and nodes and or nodes I I don't believe that's particularly necessary for us to think about but here's how this works so they traverse the or node 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 right so what we'll do is we'll run this procedure here 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 it would for the next 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 right 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 tree search over these plans so this select function here it has returned this as prime but it could have returned any point between s and s double prime so let 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 like it's a different s prime and then subdivided 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 month 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 sub problems 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 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 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 sub problem 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 for a path from here to here right and again for this particular sub problem 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 sort of log 2d deep it width 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 you're 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 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 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's just so small you can't see and these blue ones are that 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 right so we select the ones with the highest probability and will 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 sub problems 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 the 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 will reach the white square 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 I have reached a thing and 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 the this it 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 it 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 a point where your for 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 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 basically 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 its width 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 it is like next to the mouse if you can see it so 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 there 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, "end": 5.64, "text": " Hi there! What you're seeing here is a Divide and Conquer Monte Carlo Tree" }, { "start": 5.64, "end": 12.64, "text": " Search in action. This is a planning algorithm that plans in a kind of an" }, { "start": 12.64, "end": 17.52, "text": " unconventional fashion. So we're going to explore this today in this paper." }, { "start": 17.52, "end": 22.76, "text": " Divide and Conquer Monte Carlo Tree Search for Goal-Directed Planning by" }, { "start": 22.76, "end": 30.720000000000002, "text": " Gian Battista Parascondolo and Lars Pyzing and a list of other authors." }, { "start": 30.720000000000002, "end": 39.92, "text": " I believe this is from DeepMind and Max Planck and Eta and... yeah that's it." }, { "start": 39.92, "end": 46.480000000000004, "text": " Alright, so what does this thing do? It is a planning algorithm and planning might" }, { "start": 46.48, "end": 53.64, "text": " be not really familiar for you. So let's say you are in this room and or this set" }, { "start": 53.64, "end": 59, "text": " of rooms right here. There's a bunch of walls and you are up here and you want" }, { "start": 59, "end": 64.4, "text": " to reach the goal down here. So first of all this is a goal-directed problem." }, { "start": 64.4, "end": 69.08, "text": " Right here it says goal-directed. Goal-directed means that you give the" }, { "start": 69.08, "end": 73.92, "text": " algorithm a goal to reach and this could be a different goal each time you're on" }, { "start": 73.92, "end": 79.96000000000001, "text": " the algorithm. So you give it a goal to reach. Then the second thing here we" }, { "start": 79.96000000000001, "end": 84.36, "text": " see is planning. So it is a planning algorithm. What does planning mean?" }, { "start": 84.36, "end": 88.72, "text": " Planning means if you're traditionally reinforcement learning you" }, { "start": 88.72, "end": 96.04, "text": " would think I'm just gonna go ahead and run my agent here and maybe you can" }, { "start": 96.04, "end": 101.24000000000001, "text": " move in the four different directions, run my agent here, do some things, right?" }, { "start": 101.24, "end": 107.91999999999999, "text": " Maybe I hit a wall, I get a negative reward, I try again. In planning you" }, { "start": 107.91999999999999, "end": 113.8, "text": " don't have to move initially. What you can do is think about moving and you can" }, { "start": 113.8, "end": 118.32, "text": " think ahead of what's going to happen and that's usually because you have some" }, { "start": 118.32, "end": 124.16, "text": " sort of model what happens. This is very famous applied in for example AlphaGo" }, { "start": 124.16, "end": 130.04, "text": " or AlphaZero where you know if I move to the right here I'm going to" }, { "start": 130.04, "end": 135.2, "text": " be here. So you will know once you've reached the goal. If I'm" }, { "start": 135.2, "end": 140.16, "text": " here I go down I reach the goal. So you can think all of this without" }, { "start": 140.16, "end": 144.48, "text": " actually moving in the environment. You can think yourself ahead what would" }, { "start": 144.48, "end": 150.79999999999998, "text": " happen if I did certain things and that in turn also means that you can think" }, { "start": 150.79999999999998, "end": 154.84, "text": " ahead of multiple different paths. So you can think ahead what would happen if I" }, { "start": 154.84, "end": 158.95999999999998, "text": " move right, what would happen if I move down and then you can think in the next" }, { "start": 158.96, "end": 165.08, "text": " layer if I move right what would happen if I moved right again? What would happen" }, { "start": 165.08, "end": 171.20000000000002, "text": " if I move down instead? So you can easily see the planning problem becomes a tree" }, { "start": 171.20000000000002, "end": 176.24, "text": " search problem. In this case we've done a breadth first search" }, { "start": 176.24, "end": 183.36, "text": " and eventually you'll see that this will get you to the goal. So this" }, { "start": 183.36, "end": 187.72, "text": " breadth first search or maybe you want to employ depth first search will" }, { "start": 187.72, "end": 192.32, "text": " ultimately get you to the goal. We can represent this as a search tree. So" }, { "start": 192.32, "end": 196.04, "text": " you're here in a particular state and you have a bunch of actions in this case" }, { "start": 196.04, "end": 204.34, "text": " four to move left up down or right and you can choose any of them and you will" }, { "start": 204.34, "end": 208.32, "text": " get into a new state and from each of those you could choose any again and you" }, { "start": 208.32, "end": 213.24, "text": " can think ahead all of this you can construct this entire tree and one of" }, { "start": 213.24, "end": 220.76000000000002, "text": " these branches will lead you to the goal. Promise! What is the problem? The problem" }, { "start": 220.76000000000002, "end": 228.60000000000002, "text": " is if the path to the goal here is let's say D steps long then this tree here is" }, { "start": 228.60000000000002, "end": 234.92000000000002, "text": " going to be D layers deep and in our case that means we'll have four to the D" }, { "start": 234.92000000000002, "end": 242.8, "text": " nodes in that tree before we even reach the goal and that is just a long long" }, { "start": 242.8, "end": 248.72, "text": " or a big tree and we can't construct all of it. So algorithms have come along for" }, { "start": 248.72, "end": 254, "text": " example the A star algorithm where you can incorporate something like a" }, { "start": 254, "end": 258.8, "text": " heuristic and the heuristic would be well it's generally good if I'm close to" }, { "start": 258.8, "end": 264.76, "text": " the goal in L2 distance so you would not build the entire tree here but you would" }, { "start": 264.76, "end": 271.28000000000003, "text": " prefer nodes that will bring you towards this heuristic so this node down here is" }, { "start": 271.28, "end": 275.96, "text": " closer to the green node in terms of L2 distance and this node down here is even" }, { "start": 275.96, "end": 281.76, "text": " closer but then you're kind of stuck so A star will explore a bit probably along" }, { "start": 281.76, "end": 288.84, "text": " this wall here and once you're here you have a clear path again right so you can" }, { "start": 288.84, "end": 292.52, "text": " simply take the actions that minimize this L2 distance so this will already" }, { "start": 292.52, "end": 300.28, "text": " get you to a real good point. Monte Carlo tree search as it was employed in AlphaGo" }, { "start": 300.28, "end": 306.91999999999996, "text": " or AlphaStar has a similar structure where it after a certain while it stops" }, { "start": 306.91999999999996, "end": 312.32, "text": " and evaluates a heuristic to say what's the the value here and so on so it is in" }, { "start": 312.32, "end": 318.2, "text": " for some problems an even better method of constructing the search tree in a way" }, { "start": 318.2, "end": 324.47999999999996, "text": " where you don't get overblown by the number so the Monte Carlo search tree in" }, { "start": 324.47999999999996, "end": 330.03999999999996, "text": " this algorithm refers to the fact that we are generalizing Monte Carlo tree" }, { "start": 330.04, "end": 337.28000000000003, "text": " search from the let's say the AlphaGo paper so what's the idea here so far" }, { "start": 337.28000000000003, "end": 343.16, "text": " we've known everything the idea is the following if I had an Oracle if I am the" }, { "start": 343.16, "end": 352.16, "text": " master here and I can tell the agent agent look I guarantee you that this" }, { "start": 352.16, "end": 357.64000000000004, "text": " state right here in the middle you will pass that state if you want to reach the" }, { "start": 357.64, "end": 365.2, "text": " goal you will pass this for sure if I tell this to the agent now what can the" }, { "start": 365.2, "end": 369.8, "text": " agent do the edge could say oh okay if I know that I can simply I don't have to" }, { "start": 369.8, "end": 374.44, "text": " search for a way to the goal I'd much rather search for a way from my start" }, { "start": 374.44, "end": 380.52, "text": " point to that point where I know that I'm guaranteed to be at some place and" }, { "start": 380.52, "end": 388.96, "text": " then I can search also from a way from there to the goal right so this now" }, { "start": 388.96, "end": 394.47999999999996, "text": " remember our long out our path was d steps long for the original problem this" }, { "start": 394.47999999999996, "end": 399.91999999999996, "text": " is now let's say d half long each of these paths and that means we just" }, { "start": 399.91999999999996, "end": 405.64, "text": " construct two trees each one of them is going to be 4 to the d half and the" }, { "start": 405.64, "end": 410.24, "text": " other one is also 4 to the d half and if we add them that is much smaller than" }, { "start": 410.24, "end": 417.40000000000003, "text": " the original 4 to the d tree that we build so right there we have subdivided" }, { "start": 417.40000000000003, "end": 422.36, "text": " our problem into two sub problems and each of them are much easier than the" }, { "start": 422.36, "end": 428.08, "text": " original problem this paper basically does this recursively so it will" }, { "start": 428.08, "end": 433.36, "text": " subdivide the problem by proposing some middle state where you are going to be" }, { "start": 433.36, "end": 438.08, "text": " at some point for sure and that for sure we're going to take a look at and then" }, { "start": 438.08, "end": 443.03999999999996, "text": " for each of those problems again it will try to subdivided into sub problems and" }, { "start": 443.03999999999996, "end": 447.52, "text": " therefore recursively solve the sub problems until they're small enough that" }, { "start": 447.52, "end": 455.4, "text": " they can be basically solved in one step so that's the big idea here and this is" }, { "start": 455.4, "end": 461.28, "text": " illustrated in this point right here so you are in this s0 the start state and" }, { "start": 461.28, "end": 466.79999999999995, "text": " you want to go to this s infinity the goal state in your case what this paper" }, { "start": 466.8, "end": 471.6, "text": " does is it proposes to split the problem here in the middle and then simply solve" }, { "start": 471.6, "end": 479.16, "text": " the two problems recursively now what is a bit confusing right here is that it is" }, { "start": 479.16, "end": 486.8, "text": " the planning already is a tree search right so a plan is like a tree but we" }, { "start": 486.8, "end": 491.44, "text": " are searching over plan so we're searching for the best plan which means" }, { "start": 491.44, "end": 498.28, "text": " that we are searching over trees and that search itself is a tree search so" }, { "start": 498.28, "end": 502.71999999999997, "text": " the search itself is a problem where we go down one route and then on oh and then" }, { "start": 502.71999999999997, "end": 510.44, "text": " we maybe go down another route and here and then here so the search is a tree so" }, { "start": 510.44, "end": 515.8, "text": " we're now tree searching over trees that's the kind of tricky thing to" }, { "start": 515.8, "end": 521.8, "text": " remember so each of these plans even if it's half if it's only half done like" }, { "start": 521.8, "end": 526.28, "text": " this is only half a plan we don't know what's gonna happen in here this half a" }, { "start": 526.28, "end": 534.16, "text": " plan is a node in the tree that we're searching over and then it splits it it" }, { "start": 534.16, "end": 539.0799999999999, "text": " splits as you can see here into two sub problems the two sub problems also are" }, { "start": 539.0799999999999, "end": 544.4799999999999, "text": " nodes in that search tree so you see that this top thing here would correspond" }, { "start": 544.48, "end": 550.04, "text": " to this note even though in itself it is a plan a tree string in this case and" }, { "start": 550.04, "end": 555.76, "text": " each of the two sub problems would become these particular these nodes in" }, { "start": 555.76, "end": 563.44, "text": " the search tree so keep that in mind as we go through this paper it is very easy" }, { "start": 563.44, "end": 571.9200000000001, "text": " to get confused in this respect the algorithm is pretty simple in this case" }, { "start": 571.92, "end": 580.92, "text": " so this algorithm rests on this traverse procedure so we're going to we're going" }, { "start": 580.92, "end": 586.4399999999999, "text": " to traverse this what they call these or nodes so they they divide the problem" }, { "start": 586.4399999999999, "end": 591.28, "text": " into and nodes and or nodes I I don't believe that's particularly necessary" }, { "start": 591.28, "end": 597.24, "text": " for us to think about but here's how this works so they traverse the or node" }, { "start": 597.24, "end": 605.6800000000001, "text": " s to s prime this is simply again this is a node but the node is a path from s" }, { "start": 605.6800000000001, "end": 613.12, "text": " to s prime where we don't know yet what happens in between right so what we'll" }, { "start": 613.12, "end": 620.08, "text": " do is we'll run this procedure here select and select it you can see it" }, { "start": 620.08, "end": 624.88, "text": " outputs an s prime and the s prime is going to be a node here somewhere in the" }, { "start": 624.88, "end": 631.36, "text": " middle where the model says this is your subdivision point and then it will" }, { "start": 631.36, "end": 637.52, "text": " recursively traverse the left and the right branch of this tree so it will" }, { "start": 637.52, "end": 643.48, "text": " subdivide the problem into two problems and then recursively call this traverse" }, { "start": 643.48, "end": 648.72, "text": " you see that's the function that we're defining call this traverse function on" }, { "start": 648.72, "end": 654.16, "text": " these so it will subdivide this problem into these problems and it would for the" }, { "start": 654.16, "end": 660.6, "text": " next for the next step again it will eat for each of the problems propose a" }, { "start": 660.6, "end": 667.28, "text": " middle node and subdivide it further and so on until you have a full plan right" }, { "start": 667.28, "end": 672.24, "text": " at some point you're going to have a full plan now here again is the" }, { "start": 672.24, "end": 678.4399999999999, "text": " important thing to remember this is just one branch of the search this is just" }, { "start": 678.44, "end": 686.96, "text": " one possible plan and we are going to do a tree search over these plans so this" }, { "start": 686.96, "end": 692.2, "text": " select function here it has returned this as prime but it could have returned" }, { "start": 692.2, "end": 698.6800000000001, "text": " any point between s and s double prime so let in it this is just one branch I'm" }, { "start": 698.6800000000001, "end": 704.48, "text": " going to I don't have space to draw here but I'm going to draw it down here again" }, { "start": 704.48, "end": 712.32, "text": " so it could have also returned this particular node here like it's a" }, { "start": 712.32, "end": 717.48, "text": " different s prime and then subdivided the problem into different problems and" }, { "start": 717.48, "end": 722.12, "text": " then of course those problems are now different so they would be subdivided" }, { "start": 722.12, "end": 729.04, "text": " differently again and so on so this top part here is just if you consider this" }, { "start": 729.04, "end": 733.9200000000001, "text": " thing here your root node this is where you search from this top part is just" }, { "start": 733.92, "end": 740.28, "text": " one node one branch in the tree but we could also subdivide like this and then" }, { "start": 740.28, "end": 745.7199999999999, "text": " that would be another branch in your tree and this tree here is the thing" }, { "start": 745.7199999999999, "end": 751.88, "text": " that you're searching over so important to keep keep this in mind we're searching" }, { "start": 751.88, "end": 757.4799999999999, "text": " over these different possibilities now the rest of this algorithm here is" }, { "start": 757.4799999999999, "end": 763.48, "text": " basically the carryover from Monte Carlo tree search and I don't want to go into" }, { "start": 763.48, "end": 767.6, "text": " that in this video but if you're interested in you know how to actually" }, { "start": 767.6, "end": 773.36, "text": " implement this you'll have to go look at MCTS and then all of this just carries" }, { "start": 773.36, "end": 777.6, "text": " over from that algorithm because you have to keep estimates of value and" }, { "start": 777.6, "end": 781.6800000000001, "text": " visit counts in this tree and so on and also you have some sort of a value" }, { "start": 781.6800000000001, "end": 787.84, "text": " estimator but yeah I'm mainly concerned with how the tree is constructed right" }, { "start": 787.84, "end": 795.72, "text": " here so basically here's the here's the difference between a between the Monte" }, { "start": 795.72, "end": 801.64, "text": " Carlo tree search and the divide and conquer Monte Carlo tree search in" }, { "start": 801.64, "end": 806.2800000000001, "text": " Monte Carlo tree search ignore the yellow one for now you're in the green" }, { "start": 806.2800000000001, "end": 811.84, "text": " position and you want to go to the blue position in Monte Carlo tree search what" }, { "start": 811.84, "end": 817.64, "text": " you're searching over is the next action to take in this case you have four" }, { "start": 817.64, "end": 821.96, "text": " possible actions to take that's what you're searching over and that's what" }, { "start": 821.96, "end": 827.48, "text": " you build your search tree from your search tree is going to be which action" }, { "start": 827.48, "end": 833.4399999999999, "text": " to take right up left down or right that's why you have four actions in" }, { "start": 833.4399999999999, "end": 838.08, "text": " month in divide and conquer Monte Carlo tree search you're not searching over" }, { "start": 838.08, "end": 843.48, "text": " actions you are searching over the best way to subdivide this problem right" }, { "start": 843.48, "end": 848.16, "text": " you're searching over which of these all the black squares should I use to" }, { "start": 848.16, "end": 853.12, "text": " subdivide my problem into sub problems and that's what you build your search" }, { "start": 853.12, "end": 859.04, "text": " tree from so naturally you you can already see what kind of possibilities" }, { "start": 859.04, "end": 864.08, "text": " do we have here to subdivide this problem I drew one white square but any" }, { "start": 864.08, "end": 869.44, "text": " of the black squares are candidates to subdivide this problem right any of the" }, { "start": 869.44, "end": 874.96, "text": " black squares could be potential subdivisions and this is what we search" }, { "start": 874.96, "end": 882.44, "text": " over so in in Monte Carlo tree search we search over the actions which gives us" }, { "start": 882.44, "end": 890.6800000000001, "text": " this four to the D tree but in divide and conquer we're searching over all the" }, { "start": 890.6800000000001, "end": 895.2800000000001, "text": " ways to subdivide the problem as you can see there that are many many more" }, { "start": 895.28, "end": 901.48, "text": " possibilities so from this first starting node we have like like a hundred" }, { "start": 901.48, "end": 907.72, "text": " possibilities to subdivide this problem into two problems right and each of" }, { "start": 907.72, "end": 914.4, "text": " those again if you now you've decided on a subdivision let's say you decided on" }, { "start": 914.4, "end": 919.12, "text": " this one right here you say I want to pass through that point on my way to the" }, { "start": 919.12, "end": 926.8, "text": " goal now you have to subdivide that in this sub problem into two problems again" }, { "start": 926.8, "end": 932.22, "text": " every possible black square I'm not saying which one is good good thing to" }, { "start": 932.22, "end": 937, "text": " subdivide the problem I'm just asking what is a possible candidate every" }, { "start": 937, "end": 942.8, "text": " single black square here is a possible candidate for for a path from here to" }, { "start": 942.8, "end": 947.76, "text": " here right and again for this particular sub problem you have to do the same" }, { "start": 947.76, "end": 956.4399999999999, "text": " thing so the the search tree here even though we said before it is this one is" }, { "start": 956.4399999999999, "end": 965.88, "text": " very deep and this one is probably only log D sort of log 2d deep it width is" }, { "start": 965.88, "end": 971.6, "text": " going to be enormous and that is the catch right the catch this is not a" }, { "start": 971.6, "end": 978.44, "text": " method that is like a magic pill the catch is even though your tree is not as" }, { "start": 978.44, "end": 984.44, "text": " deep it is much much wider and it is intuitive right because you still have" }, { "start": 984.44, "end": 989.48, "text": " to have the ability to construct any possible plan so your tree is going to" }, { "start": 989.48, "end": 994.64, "text": " have as many nodes as the original Monte Carlo tree search tree you're if you" }, { "start": 994.64, "end": 1000.48, "text": " were to fully expand it right so it's your trading of depth for width here" }, { "start": 1000.48, "end": 1011.24, "text": " I hope I hope that's a bit clear so your entire your entire promise of this" }, { "start": 1011.24, "end": 1016.2, "text": " method is going to be can you from all of these possibilities so from all of" }, { "start": 1016.2, "end": 1020.6800000000001, "text": " these you don't even you don't even want to go and search even one layer deep" }, { "start": 1020.6800000000001, "end": 1025.28, "text": " through all of these don't even want to consider all of them right you want to" }, { "start": 1025.28, "end": 1033.2, "text": " search in this tree you want to limit your search to very particular ways of" }, { "start": 1033.2, "end": 1039.36, "text": " subdivision here if you can do that efficiently if you can pick efficiently" }, { "start": 1039.36, "end": 1045.48, "text": " candidates to subdivide then this could be a successful thing because your deep" }, { "start": 1045.48, "end": 1050.72, "text": " is now not as your tree is not as deep as the original search tree would have" }, { "start": 1050.72, "end": 1055.76, "text": " been and you can limit the width effectively to only very few candidates" }, { "start": 1055.76, "end": 1061.4, "text": " so here we could for example make a heuristic that will always only pick" }, { "start": 1061.4, "end": 1069.76, "text": " squares that are kind of on this straight path to the goal so everything" }, { "start": 1069.76, "end": 1077, "text": " rests on how you do this select action this thing here the entire algorithm" }, { "start": 1077, "end": 1083.32, "text": " relies on the fact that you can select effectively select in between states" }, { "start": 1083.32, "end": 1087.72, "text": " where you're pretty sure that the algorithm will have to pass through" }, { "start": 1087.72, "end": 1093.04, "text": " there because the worse you make these predictions the worse your tree search" }, { "start": 1093.04, "end": 1101.08, "text": " is going to work and what they do of course is they use deep learning as you" }, { "start": 1101.08, "end": 1105.72, "text": " might have guessed to do that so they have they will have a model that for a" }, { "start": 1105.72, "end": 1111, "text": " particular start and end goal will give them a probability distribution across" }, { "start": 1111, "end": 1115.16, "text": " candidates now everything that's black here also has probability mass but it's" }, { "start": 1115.16, "end": 1120.96, "text": " just so small you can't see and these blue ones are that the lighter blue the" }, { "start": 1120.96, "end": 1125.84, "text": " more probable this model thinks that this is going to be an in between state" }, { "start": 1125.84, "end": 1132.92, "text": " now the tree search can now limit itself effectively to only the ones here with" }, { "start": 1132.92, "end": 1136.16, "text": " the highest probability right so we select the ones with the highest" }, { "start": 1136.16, "end": 1143.6000000000001, "text": " probability and will only search plans that have these as the first possible" }, { "start": 1143.6000000000001, "end": 1150.16, "text": " subdivisions again we're searching over plans so we're searching over ways to" }, { "start": 1150.16, "end": 1154.88, "text": " subdivide the problem into smaller problems that is our search space so" }, { "start": 1154.88, "end": 1159.52, "text": " once we've decided on one of them let's say here the yellow one again we have to" }, { "start": 1159.52, "end": 1163.52, "text": " evaluate that model for each of the sub problems and this this is kind of a step" }, { "start": 1163.52, "end": 1167.96, "text": " that's missing here so in between here there would be a model evaluation that" }, { "start": 1167.96, "end": 1173.6, "text": " would again tell you which of these in between states were probable subdivision" }, { "start": 1173.6, "end": 1178.44, "text": " candidates and then you would select again one of those in that particular" }, { "start": 1178.44, "end": 1182.6, "text": " search branch and in a different search branch right you're searching over these" }, { "start": 1182.6, "end": 1185.92, "text": " things in a different search branch you would select a different one and see is" }, { "start": 1185.92, "end": 1193.2, "text": " this possibly a better way to subdivide the problem and so on so the question of" }, { "start": 1193.2, "end": 1196.44, "text": " course is how do you train this model how do you train a model that gives you" }, { "start": 1196.44, "end": 1203.64, "text": " good candidates for subdivision and the answer here is a comes from the idea of" }, { "start": 1203.64, "end": 1209.28, "text": " hindsight experience replay so let's say again you are here and you want to go" }, { "start": 1209.28, "end": 1216.32, "text": " here and you're not very good at the at it initially so they train this model as" }, { "start": 1216.32, "end": 1221.24, "text": " I understand along with letting their agent act in this environment so the" }, { "start": 1221.24, "end": 1225.04, "text": " agent uses the model to plan but initially it's not very good so maybe" }, { "start": 1225.04, "end": 1230.52, "text": " the agent will fail a lot of times so instead of going to the blue square it" }, { "start": 1230.52, "end": 1236.84, "text": " will reach this white square right here it will go here here and here will reach" }, { "start": 1236.84, "end": 1241.3999999999999, "text": " the white square instead of saying I failed what you can do and this is the" }, { "start": 1241.3999999999999, "end": 1246.9199999999998, "text": " idea of hindsight experience replay is to say well I did fail but I did reach" }, { "start": 1246.9199999999998, "end": 1253.56, "text": " something right I I have reached a thing and and it's actually possible that that" }, { "start": 1253.56, "end": 1258.08, "text": " thing could have been the goal but this particular episode this was the goal" }, { "start": 1258.08, "end": 1263.1999999999998, "text": " remember the goal changes every time it's a goal-directed policy so it says" }, { "start": 1263.2, "end": 1268.32, "text": " well this could have been the goal possibly so if I just pretend this was" }, { "start": 1268.32, "end": 1274.64, "text": " the goal then I have a training example for a successful run so the hindsight" }, { "start": 1274.64, "end": 1279.52, "text": " experience replay basically pretends that what you have achieved even if you" }, { "start": 1279.52, "end": 1284.1200000000001, "text": " failed was your actual goal and that gives you a positive training example" }, { "start": 1284.1200000000001, "end": 1288.88, "text": " for an episode with that as a goal and the this it could have been the goal" }, { "start": 1288.88, "end": 1295.68, "text": " because the goal is chosen at random so this gives you a good training example" }, { "start": 1295.68, "end": 1300.5200000000002, "text": " now this paper just generalizes the hindsight experience replay or applies" }, { "start": 1300.5200000000002, "end": 1305.16, "text": " it to their particular framework and they say well if I reach this thing that" }, { "start": 1305.16, "end": 1312.5600000000002, "text": " means any point on this path is a good candidate for subdividing the path" }, { "start": 1312.56, "end": 1318.6799999999998, "text": " because I did actually reach the point remember the goal is to propose a a" }, { "start": 1318.6799999999998, "end": 1324.56, "text": " point where your for sure are going to pass through now since I've taken this" }, { "start": 1324.56, "end": 1329.72, "text": " path to this goal I have passed through any of the squares in between and so" }, { "start": 1329.72, "end": 1334.6, "text": " these are my possible sub candidates and all other black squares I don't want" }, { "start": 1334.6, "end": 1338.54, "text": " that so now I have a classifier I can train I can say any of these squares on" }, { "start": 1338.54, "end": 1343.92, "text": " my path are good squares to subdivide and any not on my path are bad ones they" }, { "start": 1343.92, "end": 1348.6, "text": " go a step further I believe and they actually say we're so if this was m" }, { "start": 1348.6, "end": 1354.56, "text": " steps we're actually going to take the particular square that is reached after" }, { "start": 1354.56, "end": 1361.8799999999999, "text": " m half steps so the exact middle point of that path is going to be our training" }, { "start": 1361.88, "end": 1369.0800000000002, "text": " example for subdivision so you have a classifier that has exactly one one" }, { "start": 1369.0800000000002, "end": 1376.2800000000002, "text": " target to train so this you train along with acting in the environment and of" }, { "start": 1376.2800000000002, "end": 1380.4, "text": " course your model for proposing subdivisions is going to be better and" }, { "start": 1380.4, "end": 1383.8000000000002, "text": " better and better and better and that makes your planning algorithm better and" }, { "start": 1383.8000000000002, "end": 1390.2800000000002, "text": " better and that makes you collect better episodes and so you can sort of sort of" }, { "start": 1390.28, "end": 1399.04, "text": " get bootstrap yourself up this thing now this is the basic experiment of the" }, { "start": 1399.04, "end": 1404.92, "text": " paper they also do this in a 3d manner where they move this little spider here" }, { "start": 1404.92, "end": 1408.68, "text": " around so the spider was trained to just move from one block to the next block and" }, { "start": 1408.68, "end": 1414.48, "text": " the planner basically tell it where to go and they show that they outperform" }, { "start": 1414.48, "end": 1420.84, "text": " the traditional Monte Carlo tree search now I have to say this is cool but you" }, { "start": 1420.84, "end": 1427.84, "text": " have to remember this is this is only advantageous in very very specific types" }, { "start": 1427.84, "end": 1432, "text": " of problems so first of all it has to be this goal-directed nature otherwise you" }, { "start": 1432, "end": 1439.2, "text": " probably couldn't train this this predictor here super well then given" }, { "start": 1439.2, "end": 1446.44, "text": " that you have such a good predictor the problem needs to be such that if you" }, { "start": 1446.44, "end": 1452.16, "text": " have a start state there could be many ways to go about reaching the end and if" }, { "start": 1452.16, "end": 1455.44, "text": " you have an end state there could be many ways from where you could come from" }, { "start": 1455.44, "end": 1462.04, "text": " but but there is like some bottleneck state in the middle where you're pretty" }, { "start": 1462.04, "end": 1467.3600000000001, "text": " sure that you're going to have to pass through it so if your problem is of that" }, { "start": 1467.36, "end": 1473.36, "text": " nature right if it has these bottleneck states where you can predict with" }, { "start": 1473.36, "end": 1478.1999999999998, "text": " reasonable accuracy that you're going to have to pass through then this is a good" }, { "start": 1478.1999999999998, "end": 1485.08, "text": " algorithm to consider and is obviously I mean it's intuitively outperforming the" }, { "start": 1485.08, "end": 1492.28, "text": " original Monte Carlo tree search because you have much less deep search tree and" }, { "start": 1492.28, "end": 1497.8799999999999, "text": " you can effectively limit its width by using that model they also have made" }, { "start": 1497.8799999999999, "end": 1504.8799999999999, "text": " this website where they kind of show videos of their spider and I haven't seen" }, { "start": 1504.8799999999999, "end": 1511.8799999999999, "text": " it in a while but it is it is like next to the mouse if you can see it so so you" }, { "start": 1511.8799999999999, "end": 1516.6, "text": " see this is kind of a continuous control problem that also requires planning and" }, { "start": 1516.6, "end": 1520.6399999999999, "text": " they also have these kind of gifts of how they're there what order their plans" }, { "start": 1520.64, "end": 1525.6000000000001, "text": " are constructed in so I invite you to check this out read the paper if you" }, { "start": 1525.6000000000001, "end": 1531.64, "text": " like this subscribe leave a like leave a comment and thank you for listening bye" }, { "start": 1531.64, "end": 1550.96, "text": " bye" } ]
eCH0M4wzKJs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
WHO ARE YOU? 10k Subscribers Special (w/ Channel Analytics)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "special" ]
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,071 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 going to 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, there's Siraj controversy, very popular. It was a fun event and a 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 then it occurred to me, if you title a video Deconstructing Lottery Tickets and you put a bunch of math on the thumbnail. People are going to 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 to 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 back prop 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 worse job at explaining, then the viewer has to watch for longer. But that usually doesn't really work out because they're just going to 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 the 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% 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 YouTube just 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 searched on Google, but YouTube shows you what people searched for on YouTube. And that tends to be mostly attention is all you need. You zero 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 Schmidhuber drama, a lot of people searching for that. Maybe maybe it's ImageNet V2 or the online conferences. I don't know. You can see right here, I didn't make many subscribers of 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 in Google searching for content on this channel. I have no idea what's going on. All right. 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 800,000 subscribers. All right. 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, "end": 8.76, "text": " Hi there! We have just crossed 10,000 subscribers on this channel and that is an absolutely mind-blowing number." }, { "start": 8.76, "end": 15.84, "text": " To everyone who's subscribed, thank you! And today, for a bit of a special occasion, I thought we would look at you." }, { "start": 15.84, "end": 21.080000000000002, "text": " Yes, you handsome! One of the 10,000 subscribers of this channel." }, { "start": 21.080000000000002, "end": 27.88, "text": " And we're going to dive into the YouTube analytics and see who you are and what you like and how you behave." }, { "start": 27.88, "end": 31.56, "text": " So if you've never done YouTube as a creator, this is what it looks like." }, { "start": 31.56, "end": 37.76, "text": " You can see right here, there are 10,071 subscribers right now." }, { "start": 37.76, "end": 43.44, "text": " And if you look at the videos, Attention Is All You Need is the most popular video on this channel." }, { "start": 43.44, "end": 46.4, "text": " It is also one of the oldest videos on this channel." }, { "start": 46.4, "end": 52.28, "text": " Probably it's in many university curricula now and there's like half a lecture allocated to it." }, { "start": 52.28, "end": 57.88, "text": " And that is not enough to understand this paper. So people come to this channel." }, { "start": 57.88, "end": 64.52, "text": " I was still using kind of Adobe Reader at the time and etching in sort of..." }, { "start": 64.52, "end": 72.84, "text": " There's only one color, it's super laggy, but for some reason people like it and I'm not going to debate with people about what they like and what they don't." }, { "start": 72.84, "end": 82.04, "text": " 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." }, { "start": 82.04, "end": 93.36000000000001, "text": " 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." }, { "start": 93.36000000000001, "end": 99.60000000000001, "text": " Also, there's Siraj controversy, very popular. It was a fun event and a sad event." }, { "start": 99.60000000000001, "end": 103.04, "text": " This video right here, Deconstructing Lottery Tickets." }, { "start": 103.04, "end": 110.4, "text": " It just outperforms all the other videos, absolutely mind blowingly rockets over everything." }, { "start": 110.4, "end": 119.2, "text": " 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." }, { "start": 119.2, "end": 132.72, "text": " And I could not understand this for the longest time. And then it occurred to me, if you title a video Deconstructing Lottery Tickets and you put a bunch of math on the thumbnail." }, { "start": 132.72, "end": 140.96, "text": " People are going to click and then be very, very, very disappointed when you don't tell them how to win the lottery." }, { "start": 140.96, "end": 147.56, "text": " And that takes them about one to two minutes to notice like, oh crap, I can't make any money using this video." }, { "start": 147.56, "end": 154.32, "text": " So if you go to the general analytics tabs, it's very interesting to see what people like." }, { "start": 154.32, "end": 160.07999999999998, "text": " You see the last 28 days I've uploaded every single day, except here." }, { "start": 160.08, "end": 168.08, "text": " This is a bit of a gap. I have accidentally deleted the back prop in the brain video and had to re-upload it the next day." }, { "start": 168.08, "end": 173.92000000000002, "text": " So if you look at the last year, the views have gone up substantially." }, { "start": 173.92000000000002, "end": 179.20000000000002, "text": " The subscribers have gone up, but there are subscriber spikes right here." }, { "start": 179.20000000000002, "end": 186.20000000000002, "text": " And these spikes are usually sometimes when some large personality recommends this channel." }, { "start": 186.2, "end": 191.04, "text": " The channel gains a bunch of subscribers that doesn't necessarily translate into more views." }, { "start": 191.04, "end": 194.79999999999998, "text": " It's just people that click on subscribe and then never care anymore." }, { "start": 194.79999999999998, "end": 198.28, "text": " The metric that's most interesting to me personally is watch time." }, { "start": 198.28, "end": 205.83999999999997, "text": " And as you can see here, watch time has gone substantially up in the last month, which I find to be encouraging." }, { "start": 205.83999999999997, "end": 213.12, "text": " One minute of watch time means that I get to transmit one minute of information to the viewer." }, { "start": 213.12, "end": 214.92, "text": " And that's what really matters to me." }, { "start": 214.92, "end": 220.28, "text": " Of course, if I'm doing a worse job at explaining, then the viewer has to watch for longer." }, { "start": 220.28, "end": 224.23999999999998, "text": " But that usually doesn't really work out because they're just going to click away." }, { "start": 224.23999999999998, "end": 228.39999999999998, "text": " All right, to the fun part, the audience." }, { "start": 228.39999999999998, "end": 230.72, "text": " Who are you?" }, { "start": 230.72, "end": 235.04, "text": " Now, as you can see here, 69% of you are not subscribed." }, { "start": 235.04, "end": 237.27999999999997, "text": " What are you doing not being subscribed?" }, { "start": 237.27999999999997, "end": 240.48, "text": " Though this has changed in the last month significantly." }, { "start": 240.48, "end": 242.79999999999998, "text": " I believe now it's about half and half." }, { "start": 242.8, "end": 249.04000000000002, "text": " What I find most interesting, though, is that 10% of you have this bell notification on." }, { "start": 249.04000000000002, "end": 255.12, "text": " So 10% of you actively want to be disturbed whenever I upload a video." }, { "start": 255.12, "end": 257.48, "text": " I am incredibly flattered by this." }, { "start": 257.48, "end": 259.32, "text": " This is the biggest compliment." }, { "start": 259.32, "end": 262.64, "text": " Not even I do this for the channels that I follow." }, { "start": 262.64, "end": 264.88, "text": " Demographics also very fun." }, { "start": 264.88, "end": 272.76, "text": " About 93% of you tend to be male and about 6% of you tend to be female, at least according to YouTube statistics." }, { "start": 272.76, "end": 280.56, "text": " And that's a pretty good intersection of YouTube being mostly male and machine learning field also being mostly male." }, { "start": 280.56, "end": 288.03999999999996, "text": " If I'm doing anything to attract any particular type of person, please let me know so I can diversify a bit." }, { "start": 288.03999999999996, "end": 290.56, "text": " Everyone's welcome here." }, { "start": 290.56, "end": 298.96, "text": " You tend to be above 18, which is good because we have very, very much adult content on this channel." }, { "start": 298.96, "end": 301.76, "text": " I'm happy to see that none of you is underage." }, { "start": 301.76, "end": 306.96, "text": " I think that's YouTube just not reporting underage statistics." }, { "start": 306.96, "end": 315.84, "text": " But most of you tend to be 18 to 45 years old, though to the older viewers, you're of course also very welcome." }, { "start": 315.84, "end": 325.64, "text": " 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." }, { "start": 325.64, "end": 331.91999999999996, "text": " So most of you tend to come from the United States or India or Germany." }, { "start": 331.91999999999996, "end": 333.64, "text": " This is very incomplete list." }, { "start": 333.64, "end": 341.88, "text": " I think the most people simply are in the other category of countries, which I think means YouTube just doesn't know." }, { "start": 341.88, "end": 344.76, "text": " But it is cool to see that India is so high up." }, { "start": 344.76, "end": 346.91999999999996, "text": " One of the reasons I started this channel." }, { "start": 346.91999999999996, "end": 353.8, "text": " So the main reason is because it forces myself to read papers more thoroughly if I have to explain them." }, { "start": 353.8, "end": 362.32, "text": " 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," }, { "start": 362.32, "end": 367.44, "text": " any sort of Coursera course and where research is right now." }, { "start": 367.44, "end": 372.52, "text": " And to bridge that gap, you basically have to go to a very good university." }, { "start": 372.52, "end": 377.08000000000004, "text": " And I know that most of the world doesn't have access to these very good universities." }, { "start": 377.08, "end": 388.96, "text": " 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," }, { "start": 388.96, "end": 391.91999999999996, "text": " to be able to read current research papers." }, { "start": 391.91999999999996, "end": 400.88, "text": " 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." }, { "start": 400.88, "end": 404.44, "text": " Thanks for watching from all around the world." }, { "start": 404.44, "end": 410, "text": " One person is watching this with Russian subtitles." }, { "start": 410, "end": 413.76, "text": " Okay, we can go into the advanced statistics here." }, { "start": 413.76, "end": 415.84, "text": " And that is pretty interesting as well." }, { "start": 415.84, "end": 421, "text": " You see here most videos kind of spike when they come out, especially the news videos." }, { "start": 421, "end": 423.92, "text": " They tend to be very popular." }, { "start": 423.92, "end": 428.8, "text": " Just the moment that I release them and then they sort of fall down." }, { "start": 428.8, "end": 431.4, "text": " Traffic source I find particularly interesting." }, { "start": 431.4, "end": 440.15999999999997, "text": " If you look at the last 90 days, there are these spikes and these spikes tend to come mainly from from Google searches." }, { "start": 440.15999999999997, "end": 448.52, "text": " So at some point, people simply Google search for stuff and then they find this channel, which is encouraging." }, { "start": 448.52, "end": 452.59999999999997, "text": " Most people actually search for attention is all you need or things like this." }, { "start": 452.59999999999997, "end": 459.79999999999995, "text": " YouTube doesn't show you anymore what people searched on Google, but YouTube shows you what people searched for on YouTube." }, { "start": 459.8, "end": 463.36, "text": " And that tends to be mostly attention is all you need." }, { "start": 463.36, "end": 465.68, "text": " You zero my name." }, { "start": 465.68, "end": 466.6, "text": " Hello." }, { "start": 466.6, "end": 475.32, "text": " 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." }, { "start": 475.32, "end": 479.32, "text": " But this particular spike is only United States." }, { "start": 479.32, "end": 485.92, "text": " And if you look at the videos that I released during that time period, one of these videos right here." }, { "start": 485.92, "end": 491.40000000000003, "text": " So either it is the Schmidhuber drama, a lot of people searching for that." }, { "start": 491.40000000000003, "end": 496.48, "text": " Maybe maybe it's ImageNet V2 or the online conferences." }, { "start": 496.48, "end": 502.12, "text": " I don't know. You can see right here, I didn't make many subscribers of of these spikes." }, { "start": 502.12, "end": 506.08000000000004, "text": " It's simply people being interested in content, which is pretty cool." }, { "start": 506.08000000000004, "end": 514.72, "text": " It is also interesting to see that these spikes right here, they correspond mainly to mobile phone users." }, { "start": 514.72, "end": 520.96, "text": " So mobile phone users go in Google searching for content on this channel." }, { "start": 520.96, "end": 523.1600000000001, "text": " I have no idea what's going on." }, { "start": 523.1600000000001, "end": 527.48, "text": " All right. Now, the last question to solve is, of course, monetization." }, { "start": 527.48, "end": 530.88, "text": " How much money does this channel make?" }, { "start": 530.88, "end": 534.4, "text": " And the answer is none so far." }, { "start": 534.4, "end": 538.6, "text": " So there are multiple reasons why I haven't applied for monetization yet." }, { "start": 538.6, "end": 546.4, "text": " I find YouTube ads just incredibly annoying, especially now that they've decided to stick two ads in front of videos." }, { "start": 546.4, "end": 549.24, "text": " I just don't want to bug users with that." }, { "start": 549.24, "end": 552.16, "text": " If you look at what I gain from it, it's not that much." }, { "start": 552.16, "end": 556.72, "text": " Any money that I would make, I would like to sort of reinvest into the channel." }, { "start": 556.72, "end": 559.48, "text": " And right now, I just don't have any requirements." }, { "start": 559.48, "end": 564.0400000000001, "text": " That might change in the future, maybe once we get to 800,000 subscribers." }, { "start": 564.0400000000001, "end": 567.28, "text": " All right. That was it for YouTube analytics of this channel." }, { "start": 567.28, "end": 569.52, "text": " I hope you are still enjoying this content." }, { "start": 569.52, "end": 571.64, "text": " If you're not subscribed, please do." }, { "start": 571.64, "end": 574.6, "text": " Next update will be at a hundred thousand." }, { "start": 574.6, "end": 579.24, "text": " And I hope that everything is as enjoyable as ever." }, { "start": 579.24, "end": 581.8399999999999, "text": " Thank you for watching. Thank you for subscribing." }, { "start": 581.84, "end": 598.84, "text": " Thanks for being here and to the future." } ]
to7vCdkLi4s
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Reinforcement Learning with Augmented Data (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "rl", "reinforcement learning", "sac", "ppo", "deep rl", "deep reinforcement learning", "dreamer", "curl", "pixel", "pretraining", "deepmind", "openai", "berkeley" ]
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, Kimmin 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, 1 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 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 plugin like here, so this is basically you plug this into your pipeline in reinforcement learning, this is basically as much of a gain as pretty much the last five years of research on 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, grayscale 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 a random probability. Rotate is the same but you instead of flip you rotate it. Random conv means you randomly convolve it with a filter. In this case, some red or blue or yellow filters. And color jitter means that you kind of jitter around the colors in a sort of 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 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 you know, 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 we can 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 their momentum how they're moving right and you can you can 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 proximal 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. All right, getting it together. Cool. So when you do this, when you do that, they say when applying our ad, which is the random random data augmentation to SAC, which is soft actor critic, right? Our data 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 a 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 a 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 outperform 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 a 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 to the pixels. And you can see that the data augmentation method, which is basically just plain RL plane pure SAC plus the plus the data augmentation outperforms in many times all of these other baselines. Now, here is a criticism of me. In order 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 100k and 500k 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 100k or you get 500k 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 wouldn't 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 RL 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 in 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 augmentations 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 augmentations. And do you see, so for example, this thing here means that you apply grayscale, and then the 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 they say, okay, crop is the most 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 image is pretty clear. So you can pretty clearly see that here is the thing, there's no natural background or whatnot, 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 want to say it 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. So here they have some attention maps on where the algorithm focuses. And you can see when there's no data augmentation, it 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 cropped 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 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 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 seen 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 paste based PPOs. Now, there is some nuance to this table here. First of all, you can see that these this crop thing is now only the winner in one of these three tasks, right in the in the big fish thing. In 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 dnd jumper with 200 levels, so this is 100 or 200 levels, the 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, where as in the jumper example, the entire level structure seems to change. So then the the augmentation all of a sudden is not super effective anymore actually hurts, right? So I'm just not I'm just not super convinced by the claims you're making here. And one of the claims I find is, in particular, rad with random crop achieves, no wait, this 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 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. Alright, 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 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, "end": 5.66, "text": " Hi there. Today we're going to take a short look at reinforcement learning with augmented" }, { "start": 5.66, "end": 12.58, "text": " data. This paper is by Michael Laskin, Kimmin Lee, and others from UC Berkeley and NYU." }, { "start": 12.58, "end": 17.080000000000002, "text": " So the reason why this is a short look is because I believe the statements made in the" }, { "start": 17.080000000000002, "end": 25.76, "text": " paper are quite short and small, but they are quite grandiose. So we'll dive into it." }, { "start": 25.76, "end": 32.1, "text": " The paper basically combines two things reinforcement learning and data augmentation. Now reinforcement" }, { "start": 32.1, "end": 36.84, "text": " learning, we've talked about a number of times, it's basically where an agent is in a world" }, { "start": 36.84, "end": 42.56, "text": " and has to learn to solve an optimization problem by repeatedly interacting with the" }, { "start": 42.56, "end": 50.260000000000005, "text": " world. You can see here, for example, this is the walker task, where this walker thing," }, { "start": 50.260000000000005, "end": 55.160000000000004, "text": " it has two feet and basically needs to stand upright and walk for a number of steps. The" }, { "start": 55.16, "end": 59.599999999999994, "text": " further you go, the better. So by repeatedly trying this and getting better and better" }, { "start": 59.599999999999994, "end": 66.88, "text": " at it, that is reinforcement learning. The second part is the data augmentation. Now" }, { "start": 66.88, "end": 73.06, "text": " data augmentation is a pretty standard practice in supervised learning. What does it mean?" }, { "start": 73.06, "end": 78.52, "text": " So if you have a supervised learning task, for example, an image classification task," }, { "start": 78.52, "end": 84.88, "text": " here is a picture of a cat, and the label is cat, then you can feed this through your" }, { "start": 84.88, "end": 92.83999999999999, "text": " neural network to arrive at a loss. But you only have so many pictures. You have a database" }, { "start": 92.83999999999999, "end": 100.56, "text": " and maybe you have, I don't know, 1 million images. Usually what people do is they go," }, { "start": 100.56, "end": 107.44, "text": " let's say a number of times, like 20 or 50 times through that database to basically have" }, { "start": 107.44, "end": 113.47999999999999, "text": " the model learn each image multiple times. But what turns out to be more successful is" }, { "start": 113.48, "end": 119.4, "text": " if you do data augmentation, that means you have an in between layer right here that takes" }, { "start": 119.4, "end": 129.34, "text": " this image and some modifies it in some small way. This could be for example, it blocks" }, { "start": 129.34, "end": 136.68, "text": " out part of the image. So it simply blocks out the square here. And then you feed that" }, { "start": 136.68, "end": 142.22, "text": " through the the model. And then the next time the image comes up, it does something different." }, { "start": 142.22, "end": 148.48, "text": " For example, it randomly crops the image to only the top right part here. And then the" }, { "start": 148.48, "end": 155.16, "text": " next time it does a bit of a color jitter. And then the next time it goes to grayscale" }, { "start": 155.16, "end": 160.36, "text": " and so on. So supervised learning has found data augmentation to be quite beneficial because" }, { "start": 160.36, "end": 165.76, "text": " not only do you make the model learn what this picture is, but you also make the model" }, { "start": 165.76, "end": 171.4, "text": " kind of learn some small variations of that picture where you can be pretty sure they" }, { "start": 171.4, "end": 176.22, "text": " would not change the label. So you would not feed the model false information that generally" }, { "start": 176.22, "end": 185.12, "text": " makes it more robust to test time discrepancies. So this paper has basically claims. If you" }, { "start": 185.12, "end": 193.28, "text": " want to do reinforcement learning, if you do simply do data augmentation with the input" }, { "start": 193.28, "end": 199.16, "text": " data to that reinforcement learning, it works much, much, much better. Now, of course, we" }, { "start": 199.16, "end": 203.88, "text": " can expect since in supervised learning, this is a general trick that it would do something" }, { "start": 203.88, "end": 210.54, "text": " for reinforcement learning as well. But this paper basically claims that this one plugin" }, { "start": 210.54, "end": 215.85999999999999, "text": " like here, so this is basically you plug this into your pipeline in reinforcement learning," }, { "start": 215.85999999999999, "end": 225.7, "text": " this is basically as much of a gain as pretty much the last five years of research on on" }, { "start": 225.7, "end": 234.94, "text": " reinforcement learning on these things. So let's dive into it. This paper proposes just" }, { "start": 234.94, "end": 239.6, "text": " what I said, just plug in the data augmentation and then do reinforcement learning on the" }, { "start": 239.6, "end": 245.95999999999998, "text": " augmented data. They use these data augmentations. So crop we've already discussed, it's a random" }, { "start": 245.95999999999998, "end": 253.28, "text": " crop, grayscale means that the picture goes to gray, black and white with a certain probability." }, { "start": 253.28, "end": 259.42, "text": " Cut out means that there's a little patch missing, like I said, cut out color the same" }, { "start": 259.42, "end": 265.82, "text": " but in a random color. Flip means you flip the image horizontally or vertically, according" }, { "start": 265.82, "end": 273.6, "text": " to a random probability. Rotate is the same but you instead of flip you rotate it. Random" }, { "start": 273.6, "end": 280.7, "text": " conv means you randomly convolve it with a filter. In this case, some red or blue or" }, { "start": 280.7, "end": 290.86, "text": " yellow filters. And color jitter means that you kind of jitter around the colors in a" }, { "start": 290.86, "end": 296.7, "text": " sort of in a sort of way that doesn't mess up the image too much. So you basically just" }, { "start": 296.7, "end": 301.53999999999996, "text": " kind of change the colors on the image, but the overall image still looks the same. The" }, { "start": 301.53999999999996, "end": 308.06, "text": " only thing you have to you have to pay attention to is that so in your reinforcement learning" }, { "start": 308.06, "end": 312.82, "text": " pipeline, usually if you have a walker like this, what you want to do is you have your" }, { "start": 312.82, "end": 317.02, "text": " network here and then you have you know, your policy and your value function. If you don't" }, { "start": 317.02, "end": 323.66, "text": " know what these are, we'll have we have I've treated them many times in reinforcement learning" }, { "start": 323.66, "end": 329.02, "text": " videos. What you want to do is you simply don't want to take this one current observation" }, { "start": 329.02, "end": 335.06, "text": " in here. But sometimes you want to take kind of the stacked of the last few frames so that" }, { "start": 335.06, "end": 340.6, "text": " the model kind of gets an idea what happened during let's say the last one second, right," }, { "start": 340.6, "end": 345.38, "text": " so we can it can determine in this walker, for example, it's not only important where" }, { "start": 345.38, "end": 351.78, "text": " the legs are, which are up here right now. It is also important their momentum how they're" }, { "start": 351.78, "end": 358.1, "text": " moving right and you can you can you can determine that from the last few frames. So sometimes" }, { "start": 358.1, "end": 363.58, "text": " it's beneficial to feed the last few frames. And they say the important thing here is that" }, { "start": 363.58, "end": 368.9, "text": " these augmentations are applied consistently across the stacked frames. So basically you" }, { "start": 368.9, "end": 374.41999999999996, "text": " select on an augmentation and on the scale of that augmentation and then you apply it" }, { "start": 374.41999999999996, "end": 380.06, "text": " to these stacked frames all the same. And then in the next forward pass, you have a" }, { "start": 380.06, "end": 385.02, "text": " different set of stacked frames, then you can decide on a on a different augmentation." }, { "start": 385.02, "end": 388.9, "text": " So that's basically the only difference between the supervised setting and this setting is" }, { "start": 388.9, "end": 397.5, "text": " that you have to consistently apply the augmentation. And you have to consistently apply this here" }, { "start": 397.5, "end": 406.14, "text": " and during training. So they formulate the classic proximal policy optimization here," }, { "start": 406.14, "end": 413.17999999999995, "text": " which is an actor critic method. And the only time you have to really pay attention is when" }, { "start": 413.18, "end": 421.38, "text": " you plug the observation into these models here, right here, then it needs to be the" }, { "start": 421.38, "end": 427.54, "text": " same augmentation. Sorry, the same observation. So that means the observation augmented with" }, { "start": 427.54, "end": 438.18, "text": " the same data with the same augmentation procedures. All right, getting it together. Cool. So when" }, { "start": 438.18, "end": 444.14, "text": " you do this, when you do that, they say when applying our ad, which is the random random" }, { "start": 444.14, "end": 454.02, "text": " data augmentation to SAC, which is soft actor critic, right? Our data augmentations are" }, { "start": 454.02, "end": 459.86, "text": " applied to the observation past the Q and pi. So sorry, this is the thing up here. This" }, { "start": 459.86, "end": 463.74, "text": " is soft actor critic, which is a state of the art of policy algorithm for continuous" }, { "start": 463.74, "end": 469.1, "text": " control problems. And also you have to pay attention that when you feed the observations," }, { "start": 469.1, "end": 475.14, "text": " they're the same observations, like here and here. And then proximal policy optimization" }, { "start": 475.14, "end": 479.7, "text": " is the one is a state of the art on policy algorithm for learning a continuous or discrete" }, { "start": 479.7, "end": 492.76, "text": " control policy. Okay, so as I said, they simply drop this in there. And then it turns out" }, { "start": 492.76, "end": 502.7, "text": " they outperform or match performance of many, many baselines. Here you can see curl, I've" }, { "start": 502.7, "end": 510.14, "text": " made a video on curl, which is another way of augmenting or pre training a for reinforcement" }, { "start": 510.14, "end": 516.46, "text": " learning, then state of the art things like planet or dreamer, I've made a video on dreamer" }, { "start": 516.46, "end": 522.3199999999999, "text": " as well. And then pixel SAC and state SAC is sort of a cheating algorithm because it" }, { "start": 522.32, "end": 528.12, "text": " has access to the state whereas all the other methods only have access to the to the pixels." }, { "start": 528.12, "end": 534.86, "text": " And you can see that the data augmentation method, which is basically just plain RL plane" }, { "start": 534.86, "end": 544.7, "text": " pure SAC plus the plus the data augmentation outperforms in many times all of these other" }, { "start": 544.7, "end": 553.46, "text": " baselines. Now, here is a criticism of me. In order they never investigate, they simply" }, { "start": 553.46, "end": 560.0600000000001, "text": " say wow, this reaches the same performance or outperforms these other methods. Now, so" }, { "start": 560.0600000000001, "end": 564.58, "text": " it's the state of the art algorithm. It's important to note here that this is on the" }, { "start": 564.58, "end": 572.3000000000001, "text": " DM control 100k and 500k benchmarks, which means that there's a limit on the number of" }, { "start": 572.3, "end": 578.66, "text": " I believe frames from these control tasks that you get. So you either get 100k or you" }, { "start": 578.66, "end": 585.02, "text": " get 500k frames. So the difficulty is learning from limited data. It's not state of the art" }, { "start": 585.02, "end": 589.9399999999999, "text": " reinforcement learning method. Overall, it is the state of the art on this particular" }, { "start": 589.9399999999999, "end": 596.14, "text": " task on learning from limited data. Now, while I can believe that the augmentation would" }, { "start": 596.14, "end": 605.56, "text": " help here, I it is completely unclear whether or not the augmentation gives the same benefits" }, { "start": 605.56, "end": 610.9399999999999, "text": " as like something like dreamer, or whether the benefits from dreamer and the benefits" }, { "start": 610.9399999999999, "end": 617.34, "text": " from data augmentation are completely orthogonal. So in this paper, given that the claim is" }, { "start": 617.34, "end": 622.74, "text": " so simple that they make, I wouldn't I would expect like an investigation, what happens" }, { "start": 622.74, "end": 631.1, "text": " if I do dreamer plus the data augmentation? Maybe they've done it somewhere, and I just" }, { "start": 631.1, "end": 638.46, "text": " haven't seen it. But it just seems like they, they put this on the base basic RL algorithm," }, { "start": 638.46, "end": 645.0600000000001, "text": " and then they claim, well, look here, it works well, but they never show that. So it could" }, { "start": 645.0600000000001, "end": 650.84, "text": " be that dreamer all this architecture, what it simply does is basically recover these" }, { "start": 650.84, "end": 656.26, "text": " gains that you could get by data augmentation, or it could be that it actually does something" }, { "start": 656.26, "end": 662.6600000000001, "text": " different, but just reaches the same amount of gain, right, it just reaches the same amount" }, { "start": 662.6600000000001, "end": 668.3000000000001, "text": " in improvement. And by combining them, you could improve it further. So not not just" }, { "start": 668.3000000000001, "end": 673.14, "text": " to get like a better number, but combining the two would actually give a lot of hints" }, { "start": 673.14, "end": 679.2800000000001, "text": " as to whether or not this augmentation works in line with the other methods, or whether" }, { "start": 679.28, "end": 684.38, "text": " the other methods are really doing something meaningfully different or not. But this is" }, { "start": 684.38, "end": 695.14, "text": " just not done here. And so they go into the they go into a question of which data augmentations" }, { "start": 695.14, "end": 703.9399999999999, "text": " contribute the most, and they get to the point where they say random crop is extremely effective." }, { "start": 703.94, "end": 710.22, "text": " So they have this table here where they just basically combine two augmentations. And do" }, { "start": 710.22, "end": 715.1, "text": " you see, so for example, this thing here means that you apply grayscale, and then the rotate" }, { "start": 715.1, "end": 721.48, "text": " augmentation. And that gets you to whatever 300 points in this Walker, if you apply crop," }, { "start": 721.48, "end": 728.84, "text": " and then crop, it gets you to 920 points and beats everything else. So they they say, okay," }, { "start": 728.84, "end": 738.0400000000001, "text": " crop is the most the most effective. And I have I have the sneaking suspicion that these" }, { "start": 738.0400000000001, "end": 743.44, "text": " augmentations are so effective, simply because of how we set up these tasks, right, these" }, { "start": 743.44, "end": 747.7, "text": " reinforcement learning tasks, they don't tend to be a real world, they tend to be somewhat" }, { "start": 747.7, "end": 755.02, "text": " simulated. And as you can see here, the image is pretty clear. So you can pretty clearly" }, { "start": 755.02, "end": 759.9, "text": " see that here is the thing, there's no natural background or whatnot, it's procedurally generated," }, { "start": 759.9, "end": 766.86, "text": " right, there are these stars that could confuse the model a bit. But still, it is so easy" }, { "start": 766.86, "end": 773.14, "text": " visually, this task, that I'm going to guess the whole reason why these image augmentations" }, { "start": 773.14, "end": 780.12, "text": " help is simply because of the way these reinforcement learning tasks right now are set up. And I'm" }, { "start": 780.12, "end": 786, "text": " would guess that if we had reinforcement learning in something like the real world, that the" }, { "start": 786, "end": 792.42, "text": " image augmentation methods would help in about the way they help unsupervised tasks in in" }, { "start": 792.42, "end": 801.46, "text": " the same data, for example, image net. So that is my sneaking suspicion. And this paper," }, { "start": 801.46, "end": 810.04, "text": " I want to say it sort of over claims, it's how how absolutely great this works. Of course," }, { "start": 810.04, "end": 814.9, "text": " it works great on these things. But I think there needs to be an investigation of where," }, { "start": 814.9, "end": 821.14, "text": " why. So here they have some attention maps on where the algorithm focuses. And you can" }, { "start": 821.14, "end": 827.14, "text": " see when there's no data augmentation, it sort of focuses on good points. But when you" }, { "start": 827.14, "end": 833.06, "text": " do crop, it focuses on this ridge here, which makes sense, right, because that's the thing" }, { "start": 833.06, "end": 841.4599999999999, "text": " that needs to be kind of vertical in order for the walker to be stable. And in if you" }, { "start": 841.4599999999999, "end": 848.66, "text": " do other things, then you can see it, it doesn't really focus, it focuses on different things." }, { "start": 848.66, "end": 857.06, "text": " So the crop method seems to make the model focus on the most important part of the image." }, { "start": 857.06, "end": 863.14, "text": " And as the same with the cheetah task here, so if you don't do augmentation, and some" }, { "start": 863.14, "end": 868.14, "text": " of the augmentation, you can see that it actually focuses on some of these background stars," }, { "start": 868.14, "end": 875.3, "text": " whereas in the cropped version, it focuses on not on the stars, but actually on the cheetah" }, { "start": 875.3, "end": 882.6199999999999, "text": " as a whole, which probably makes sense. Now, again, I have a bit of a I have a bit of a" }, { "start": 882.62, "end": 888.26, "text": " worry with these kinds of experiments, because we already know that crop will give you a" }, { "start": 888.26, "end": 894.66, "text": " much better score, right? So who's to say that if we could train this thing here to" }, { "start": 894.66, "end": 902.3, "text": " the same score, it wouldn't be paying attention to the same part. What they're trying to make" }, { "start": 902.3, "end": 907.62, "text": " clear here is that it is dependent on the particular type of data augmentation that" }, { "start": 907.62, "end": 915.62, "text": " the model gets a better grip on the input. But it is not really a valid comparison if" }, { "start": 915.62, "end": 924.9, "text": " we know that the crop agent performs a better score. And it could simply be that that's" }, { "start": 924.9, "end": 931.7, "text": " the reason why the attention is better, right? That that it is actually solving the problem" }, { "start": 931.7, "end": 938.46, "text": " better. So I mean, of course, this the fact that it's working better is due to the fact" }, { "start": 938.46, "end": 944.4200000000001, "text": " that you have crop augmented the data, but the fact that is focusing on the correct parts" }, { "start": 944.4200000000001, "end": 950.4200000000001, "text": " is not a property of the crop augmentation, but the property of the fact that it reaches" }, { "start": 950.4200000000001, "end": 961.34, "text": " a higher score. That was a long winded complaint, but I hope you get what I mean here. The last" }, { "start": 961.34, "end": 967.1800000000001, "text": " thing they do is they investigate generalization performance. So improving generalization on" }, { "start": 967.1800000000001, "end": 973.9, "text": " this open AI proc gen. Now, as I understand it, this is a reinforcement learning task" }, { "start": 973.9, "end": 980.6600000000001, "text": " or suite of tasks where you have procedurally generated levels. So you can sort of train" }, { "start": 980.6600000000001, "end": 988.1600000000001, "text": " on a bunch of levels, and then test the generalization to new levels that you haven't seen before." }, { "start": 988.16, "end": 994.4, "text": " So there's a jumper here and star pilot. So they seem like this like a jump and run game" }, { "start": 994.4, "end": 999.3399999999999, "text": " or big fish. I don't even know what you have to do in big fish. But you can see that the" }, { "start": 999.3399999999999, "end": 1007.26, "text": " levels seen here, this is one example, and unseen. So in this example, the background" }, { "start": 1007.26, "end": 1012.8199999999999, "text": " is very different. And I'm going to guess in the jumper thing, not only is the background" }, { "start": 1012.82, "end": 1019.3000000000001, "text": " but also the kind of generated level how you have to jump is quite different. So they investigate" }, { "start": 1019.3000000000001, "end": 1027.5800000000002, "text": " whether or not a agent trained on only the seen ones can generalize to the unseen ones." }, { "start": 1027.5800000000002, "end": 1036.5800000000002, "text": " And this table presents the results. And as you can see, the RAD with the crop or with" }, { "start": 1036.58, "end": 1046.1399999999999, "text": " other things outperform the pixel paste based PPOs. Now, there is some nuance to this table" }, { "start": 1046.1399999999999, "end": 1054.22, "text": " here. First of all, you can see that these this crop thing is now only the winner in" }, { "start": 1054.22, "end": 1062.1799999999998, "text": " one of these three tasks, right in the in the big fish thing. In there is another augmentation" }, { "start": 1062.18, "end": 1067.8600000000001, "text": " technique here that wins over at star pilot. But you can see the difference is not that" }, { "start": 1067.8600000000001, "end": 1078.26, "text": " high. And in the dnd jumper with 200 levels, so this is 100 or 200 levels, the the original" }, { "start": 1078.26, "end": 1086.3400000000001, "text": " method is even the best. So here again, I believe this is evidence that that it is very" }, { "start": 1086.34, "end": 1092.62, "text": " much an interaction of these augmentations with the way the task is set up and not the" }, { "start": 1092.62, "end": 1098.02, "text": " augmentations themselves or the fact that you're augmenting. For example, if we look" }, { "start": 1098.02, "end": 1105.26, "text": " at this big fish, we've seen, okay, the what seems to change here is mainly the background," }, { "start": 1105.26, "end": 1115.62, "text": " where as in the jumper example, the entire level structure seems to change. So" }, { "start": 1115.62, "end": 1122.3799999999999, "text": " then the the augmentation all of a sudden is not super effective anymore actually hurts," }, { "start": 1122.3799999999999, "end": 1127.5, "text": " right? So I'm just not I'm just not super convinced by the claims you're making here." }, { "start": 1127.5, "end": 1134.4599999999998, "text": " And one of the claims I find is, in particular, rad with random crop achieves, no wait, this" }, { "start": 1134.4599999999998, "end": 1145.26, "text": " point down here. Oh, yeah, achieves 55.8% gain over pixel based PPO. Okay. trained with" }, { "start": 1145.26, "end": 1151.42, "text": " 100 training levels outperforms the pixel based PPO with 200 training levels on both" }, { "start": 1151.42, "end": 1159.26, "text": " big fish and star pilot environment. This shows that data augmentation can be more effective" }, { "start": 1159.26, "end": 1164.58, "text": " in learning generalizable representations compared to simply increasing the number of" }, { "start": 1164.58, "end": 1172.1, "text": " training environments. I this statement. So again, how, like, why do you compare two different" }, { "start": 1172.1, "end": 1179.02, "text": " things if you don't? Like, if you don't show that maybe they're orthogonal. In fact, they" }, { "start": 1179.02, "end": 1185.5, "text": " are probably orthogonal because even on the 200 levels you you gain over the pixel based" }, { "start": 1185.5, "end": 1195.6999999999998, "text": " PPO, right? So why the comparison and then second of all, so here we see on the 100 levels," }, { "start": 1195.6999999999998, "end": 1201.62, "text": " this method is better than the pixel based PPO. And then they claim that okay, they are" }, { "start": 1201.62, "end": 1210.3, "text": " even better on 100 levels than the pixel based PPO on 200 levels. And why that is true. If" }, { "start": 1210.3, "end": 1220.2199999999998, "text": " you know, if if if a is bigger than b, then probably a is going to be bigger than b plus" }, { "start": 1220.22, "end": 1231.78, "text": " some epsilon. And right, and and that doesn't, I just think that doesn't really warrant their" }, { "start": 1231.78, "end": 1239.34, "text": " statement where they say, Oh, look, this is even better. So as if the 100 levels of additional" }, { "start": 1239.34, "end": 1246.58, "text": " training were the standard measure of more data, like if there is going to be if you're" }, { "start": 1246.58, "end": 1250.8999999999999, "text": " better at the beginning, there's going to be a certain amount of data where you're still" }, { "start": 1250.8999999999999, "end": 1258.6599999999999, "text": " better than the other method with more data. And I don't find this super duper surprising," }, { "start": 1258.6599999999999, "end": 1266.1399999999999, "text": " but they make a big claim here out of this. Alright, so in conclusion, I hope I'm not" }, { "start": 1266.1399999999999, "end": 1270.6599999999999, "text": " too harsh on this paper, it is a cool paper. And of course, it is cool findings. But I" }, { "start": 1270.66, "end": 1276.94, "text": " have a big suspicion that the augmentation here works so well simply because of how we" }, { "start": 1276.94, "end": 1283.78, "text": " set up these RL tasks, because they're visually quite, let's say easy. And therefore, these" }, { "start": 1283.78, "end": 1290.18, "text": " augmentations that are also our sort of easy abstractions of when an image is visually" }, { "start": 1290.18, "end": 1296.02, "text": " similar, because all of these things, right, to us as humans, we say, probably doesn't" }, { "start": 1296.02, "end": 1302.26, "text": " change anything if we just rotate the image. And we this is our prejudice. And we built" }, { "start": 1302.26, "end": 1308.86, "text": " this prejudice into these simulators for the RL tasks. So they will match up extremely" }, { "start": 1308.86, "end": 1314.58, "text": " well with these augmentations. And that's the reason I believe these things work and" }, { "start": 1314.58, "end": 1322.9, "text": " maybe not as much the the fact that you're augmenting. Okay, well, if you like this video," }, { "start": 1322.9, "end": 1328.02, "text": " I invite you to check out the paper, subscribe to this channel, tell all your friends about" }, { "start": 1328.02, "end": 1354.26, "text": " it and leave a like in the comment. Thank you very much and bye bye." } ]
cIUtRNhY6Rw
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
TAPAS: Weakly Supervised Table Parsing via Pre-training (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "bert", "nlp", "natural language processing", "wikitables", "sql", "tabular", "aggregations", "structured", "google" ]
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 the 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 need to go to number of reigns column and you need to mentally sort them and you'll find out that 8 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 Dan Severn. 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 Herzig, Pavel Kristof Novak, Thomas Miller, Francesco Piccino and Julian Martin Eisenschloss. Full disclaimer I know these people so I might be slightly biased. Alright 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 there 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, Rick 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 wrestlers are ranked in the bottom three and out of these which one have 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 3426 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 2. You can teach your model either to select this number here or you can teach your model that would be wrong. 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 2 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 1 here which is also 2. 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. Now 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. 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 BERT input. So this is a transformer right here. This is BERT or any variant of BERT 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 a count 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. 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. Alright 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 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 into a token embeddings. So first you want to split everything you put in 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 days before here would be name of the wrestler and this would be number of days. And then here 0 1 2 3 so this this table right here corresponds to this string right here. I hope you can 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 BERT you have what they're called position embeddings to indicate where in the sequence that is. So in a simpler in the simplest case these are embeddings for the numbers 0 1 2 3 4 and so on so wherever the position is. This you can all look up in the attention is all you need video I've made that if you are unfamiliar with transformer inputs. Then also the the segment embeddings simply indicate where what a token is part of. So for every token that's part of the query you see you have segment 0 embedding and for every token that's part of the table you have a segment 1 embedding. 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 0 but for the table you see there is a column 1 and column 2 and the this exactly so we've seen that this here is the header of column 1 and this is the header of column 2 and then it goes back column 1 column 2 column 1 column 2 and you can see here this 0 is in column 1 and this one is in column 2 and this in column 1 again and the same for the rows so you have row 0 for the headers and then row 1 for the first two numbers and row 2 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 sorry the number of days of something so this is the number of days and this second one is the number of reigns 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 4 and 1 so for each column you want to tell the model the ranking of the numbers so here it's pretty easy this is rank 1 this is rank 2 this is rank 3 further on the left side this is rank 1 this is rank 2 down here and this is rank 3 so the model has an will have an if you give this information the model have an easier time to detect like give me the top 2 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 as 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 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 it correctly for this particular for this particular input alright I think that's the 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 people used to do the very different things so people if given a query and a table like this what people would do is they would somehow first of all get the table headers and and kind of guess the data types of the attributes and then they would formulate reformulate the query maybe also with a 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 you build if we want to build a cell selector that's pretty easy right we've seen this so we the cell selector is first column column selection and then second row selection and this can be multiple rows so that's fairly easy selecting 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 class classifier right so the classifier will simply tell us a give us a distribution and then we see okay the sum aggregation is probably here the the 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 the 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 had the most number of rains we just know the answer is a Ric flair now they 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 is the answer a number is the answer a number if no then it is definitely a cell selection task so they 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 then 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 there's 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 the 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 blurny 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 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 alright 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 your aggregation selection module gives you a softmax distribution over 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 wants point one puts what point one probability on the count I'm going to have 0.1 times 3 plus it wants point three times this so 0.3 times 18 plus 0.6 times 6 now I'm not gonna so this is 6 plus point three plus 3.6 9.9 so that 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 like variance than the average and and that's somewhat going the count maybe somewhere in between depending on the numbers so this 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 the average so the correct answers six 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 robust and they do other things to be more outlier robust 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 on to 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 wait 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 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 of 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 this is the let's say the 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 this 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 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 the selection of the aggregation to perform but also to the cell selector to set which cells to to select so from this weak 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 not really accurate understanding of what you need to do is 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 this is it's a 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 and 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 suffice to say this this only works for pretty I think 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 don't I'm not really gonna 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 I believe they're actually on par with another model but in one data set but they beat them on every other data set so that's you know that's cool I don't think there was a bar nevermind 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, "end": 5.88, "text": " Hi there, have a look at this table on the left. So in this table, in each row" }, { "start": 5.88, "end": 12.82, "text": " you can see the following things. The name of a wrestler, the number of times" }, { "start": 12.82, "end": 19.16, "text": " that wrestler has been a champion and the combined number of days where that" }, { "start": 19.16, "end": 24, "text": " wrestler has been a champion or like the sum of the length of all their" }, { "start": 24, "end": 30.4, "text": " championships. Along with the column that is the rank and this is ranked by the" }, { "start": 30.4, "end": 36.44, "text": " combined days attribute. So this table is very interesting by itself but if you" }, { "start": 36.44, "end": 40.3, "text": " look at the right we have a couple of questions and let's try to answer them." }, { "start": 40.3, "end": 46.379999999999995, "text": " Which wrestler had the most number of reigns? So for that you need to go to" }, { "start": 46.379999999999995, "end": 52.379999999999995, "text": " number of reigns column and you need to mentally sort them and you'll find out" }, { "start": 52.38, "end": 58.92, "text": " that 8 is the highest number and therefore Ric Flair is the wrestler" }, { "start": 58.92, "end": 64.5, "text": " you're looking for. Second question, the average time as a champion for top two" }, { "start": 64.5, "end": 71.64, "text": " wrestlers. Now we need to go the top two wrestlers, we can guess that pertains to" }, { "start": 71.64, "end": 79.12, "text": " the rank and then so we want the average of these two numbers. You even have" }, { "start": 79.12, "end": 84.16000000000001, "text": " questions such as which of the following wrestlers were ranked in" }, { "start": 84.16000000000001, "end": 89.56, "text": " the bottom three? Which the answers would be all of those and then after that out" }, { "start": 89.56, "end": 97.80000000000001, "text": " of these who had more than one reign? And you can see that's Dan Severn. So the" }, { "start": 97.80000000000001, "end": 104.52000000000001, "text": " paper that we're having here is trying to answer questions like this if given a" }, { "start": 104.52, "end": 111.32, "text": " table. As you can see this is a pretty pretty hard task and so pretty excited" }, { "start": 111.32, "end": 118.64, "text": " to read this. The paper is called TAPAS weekly supervised table parsing via" }, { "start": 118.64, "end": 125.12, "text": " pre-training by Jonathan Herzig, Pavel Kristof Novak, Thomas Miller, Francesco" }, { "start": 125.12, "end": 131.07999999999998, "text": " Piccino and Julian Martin Eisenschloss. Full disclaimer I know these people so" }, { "start": 131.08, "end": 137.28, "text": " I might be slightly biased. Alright so you've already seen the task. The task is" }, { "start": 137.28, "end": 144.08, "text": " you are given a table and a question and you're trying to answer that. Now there" }, { "start": 144.08, "end": 150.76000000000002, "text": " it's not as easy as that but the table questions come in different" }, { "start": 150.76000000000002, "end": 155.92000000000002, "text": " forms as you have seen. Sometimes you just need to select a cell from a table" }, { "start": 155.92, "end": 162.72, "text": " like we have here. The first question I simply, most number of reigns, I simply" }, { "start": 162.72, "end": 169.6, "text": " select whatever that is. So the answer here is already in the table, Rick Flair" }, { "start": 169.6, "end": 176.48, "text": " and this they call a cell selection task. This is wherever you need to select a" }, { "start": 176.48, "end": 181.35999999999999, "text": " cell. The same for these bottom here so which of the following wrestlers are" }, { "start": 181.35999999999999, "end": 184.48, "text": " ranked in the bottom three and out of these which one have more than one reign?" }, { "start": 184.48, "end": 190.11999999999998, "text": " All of these answers are in the table somewhere. The second thing is what they" }, { "start": 190.11999999999998, "end": 197.67999999999998, "text": " call a scalar answer. That is when the answer to be computed is a number that" }, { "start": 197.67999999999998, "end": 207.39999999999998, "text": " is not in the table. So these average time here which turns out to be 3426 is" }, { "start": 207.39999999999998, "end": 213.79999999999998, "text": " nowhere to be found in the table. So there actually needs to be a computation" }, { "start": 213.8, "end": 220.72, "text": " performed by the model. And lastly you have these things called ambiguous" }, { "start": 220.72, "end": 229.4, "text": " answers. Now the ambiguous answers refer to a thing where it is a number that" }, { "start": 229.4, "end": 236.92000000000002, "text": " you're looking for so how many but the number here is in the table. So you can" }, { "start": 236.92000000000002, "end": 240.16000000000003, "text": " think of this in terms of training data. If you have a task like this and you" }, { "start": 240.16, "end": 244.6, "text": " have training data and you just have the question, you just have this question and" }, { "start": 244.6, "end": 252, "text": " you're given the answer 2. You can teach your model either to select" }, { "start": 252, "end": 259.44, "text": " this number here or you can teach your model that would be wrong. Because" }, { "start": 259.44, "end": 266.64, "text": " how many world champions are there with only one reign to simply select this" }, { "start": 266.64, "end": 271.88, "text": " cell here is not correct. Because that cell even though the number is 2 it" }, { "start": 271.88, "end": 277.03999999999996, "text": " doesn't mean the same thing. It's not counting right. So the correct program" }, { "start": 277.03999999999996, "end": 282.88, "text": " here would be to count the number to count the cells where there is a 1 here" }, { "start": 282.88, "end": 288.06, "text": " which is also 2. And they call this situation ambiguous answer. So you might" }, { "start": 288.06, "end": 293.36, "text": " have already guessed that a single model that does all of this needs to sort of" }, { "start": 293.36, "end": 301.6, "text": " have multiple modes. That's exactly what they propose. So they propose a model" }, { "start": 302.2, "end": 311.6, "text": " that takes in the table and the question. And then in the first step it selects its" }, { "start": 311.6, "end": 322.48, "text": " mode. So the mode is either the cell selection or it is to compute something." }, { "start": 322.48, "end": 329.72, "text": " And then whenever it's a cell selection it simply has a component to select" }, { "start": 329.72, "end": 338.32, "text": " cells. But when it's a compute it needs to decide in the second step what to" }, { "start": 338.32, "end": 352.12, "text": " compute and then also select the appropriate cells. So this is the" }, { "start": 352.12, "end": 357.92, "text": " model. Now this stuff like this has existed for a long time in these table" }, { "start": 357.92, "end": 362.6, "text": " answering things but the way we want to do it here is end to end with a single" }, { "start": 362.6, "end": 366.68, "text": " deep learning model of course. Because we want to be better than anything else. And" }, { "start": 366.68, "end": 372.32, "text": " the trend in deep learning is to put more and more into one model and to have" }, { "start": 372.32, "end": 378.64, "text": " it end to end differentiable. So you see we need multiple components. We" }, { "start": 378.64, "end": 383.71999999999997, "text": " need some sort of a mode selector. We need some sort of a cell collector and" }, { "start": 383.71999999999997, "end": 388.8, "text": " we need a thing that decides if we are in the compute mode what computation to" }, { "start": 388.8, "end": 396.08, "text": " be done. Now let me present the model that this paper proposes. So this paper" }, { "start": 396.08, "end": 404.56, "text": " proposes to embed the question here. So you can see here that's the question into" }, { "start": 404.56, "end": 412.96, "text": " a BERT input. So this is a transformer right here. This is BERT or any variant" }, { "start": 412.96, "end": 418.16, "text": " of BERT that you can think of. So the question is embedded as natural language" }, { "start": 418.16, "end": 427.08, "text": " and then interestingly enough the table right here is also embedded as language." }, { "start": 427.08, "end": 433.8, "text": " We'll get to that in a second. But the question and the table are in the input" }, { "start": 433.8, "end": 438.36, "text": " and then the model is asked to do two things. First of all it's asked to do an" }, { "start": 438.36, "end": 443.44, "text": " aggregation prediction. So this can either be one of these programs called" }, { "start": 443.44, "end": 451.36, "text": " count sum average or it can be as you can see here none. So no aggregation. So" }, { "start": 451.36, "end": 456.88, "text": " this handles our first two components. It can decide to perform a calculation or" }, { "start": 456.88, "end": 463.12, "text": " none and if it is performing a calculation it can decide to do a count" }, { "start": 463.12, "end": 469.12, "text": " sum or an average. Now of course the model here is not limited to" }, { "start": 469.12, "end": 474.12, "text": " those computations. You can think of extending this to any further" }, { "start": 474.12, "end": 482.44, "text": " computation. The important thing is that they have a number as an output. Second" }, { "start": 482.44, "end": 488.32, "text": " of all there is a cell selector. So depending on this aggregation prediction" }, { "start": 488.32, "end": 493.68, "text": " you need some cells. Like if you want to compute an average you need the cells to" }, { "start": 493.68, "end": 499.88, "text": " compute an average over. So the cell selector here will select cells from the" }, { "start": 499.88, "end": 507.96, "text": " table. Specifically it goes by row and column. Sorry column and row. Since" }, { "start": 507.96, "end": 513.04, "text": " these tables usually they have a header right this is the table header where the" }, { "start": 513.04, "end": 520.0799999999999, "text": " attributes are listed. It makes sense to first in a first step select which column" }, { "start": 520.0799999999999, "end": 526.28, "text": " you want to select from and then if once you have a column let's say this column" }, { "start": 526.28, "end": 534.28, "text": " here in the second step you say which of the cells you want to select. Now these" }, { "start": 534.28, "end": 540, "text": " can be multiple but the way the system is set up it's first a column selector" }, { "start": 540, "end": 546.04, "text": " and then a cell selector within that column. So you can only ever get columns" }, { "start": 546.04, "end": 553.24, "text": " from the same cell in this thing. Let's remember that for later. Alright so this" }, { "start": 553.24, "end": 561.52, "text": " is what the model does now let's look at the input. The input to the model is this" }, { "start": 561.52, "end": 566.6, "text": " here. Now this if you refer from this before this was in this blue box and then" }, { "start": 566.6, "end": 571.0400000000001, "text": " here you'd have the computation selection and here you have the cell" }, { "start": 571.0400000000001, "end": 577.96, "text": " selection. So this is this is how you can relate that. So usually if you input" }, { "start": 577.96, "end": 584.4, "text": " something into a transformer what you want to do is you want to embed this into" }, { "start": 584.4, "end": 591.64, "text": " into a token embeddings. So first you want to split everything you put in into" }, { "start": 591.64, "end": 597.4, "text": " what are called tokens. Now tokens are either things like words or word pieces" }, { "start": 597.4, "end": 601.48, "text": " the important thing is to have a dictionary for it and each one gets mapped" }, { "start": 601.48, "end": 611.88, "text": " to a vector. So this here is your query. You take your query as a string" }, { "start": 611.88, "end": 617.72, "text": " and you tokenize it and you get the embeddings from the embedding table and" }, { "start": 617.72, "end": 623.96, "text": " that's your input right. So it's a sequence of token embeddings and then" }, { "start": 623.96, "end": 630.1600000000001, "text": " you also embed the table and this I find pretty cool here in this model and" }, { "start": 630.1600000000001, "end": 638, "text": " somewhat special is that the table is actually presented as just natural" }, { "start": 638, "end": 650.08, "text": " language. So you can see here the table is one string it's just a single string" }, { "start": 650.08, "end": 656.08, "text": " that goes from left to right it's just the serialized table. So this table right" }, { "start": 656.08, "end": 663.24, "text": " here you can see these are word pieces so this table if I reconstruct it if I" }, { "start": 663.24, "end": 670.96, "text": " can attempt to reconstruct it it is going to be a table that has as the" }, { "start": 670.96, "end": 678.92, "text": " headers call one call two these are the names so in days before here would be" }, { "start": 678.92, "end": 699.3199999999999, "text": " name of the wrestler and this would be number of days. And then here 0 1 2 3 so" }, { "start": 699.3199999999999, "end": 708.5999999999999, "text": " this this table right here corresponds to this string right here. I hope you can" }, { "start": 708.6, "end": 713.84, "text": " you can make sense of that. So the table is just put there as one long string and" }, { "start": 713.84, "end": 720.76, "text": " then in order to make the model realize you know what the table is you have" }, { "start": 720.76, "end": 724.36, "text": " these special embeddings. So usually in BERT you have what they're called" }, { "start": 724.36, "end": 730.48, "text": " position embeddings to indicate where in the sequence that is. So in a simpler in" }, { "start": 730.48, "end": 737.0400000000001, "text": " the simplest case these are embeddings for the numbers 0 1 2 3 4 and so on so" }, { "start": 737.04, "end": 742.16, "text": " wherever the position is. This you can all look up in the attention is all you" }, { "start": 742.16, "end": 747.56, "text": " need video I've made that if you are unfamiliar with transformer inputs. Then" }, { "start": 747.56, "end": 756, "text": " also the the segment embeddings simply indicate where what a token is part of. So" }, { "start": 756, "end": 760.9599999999999, "text": " for every token that's part of the query you see you have segment 0 embedding and" }, { "start": 760.9599999999999, "end": 764.68, "text": " for every token that's part of the table you have a segment 1 embedding. This is" }, { "start": 764.68, "end": 770.2399999999999, "text": " simply to tell the model hey this particular token is part of the question" }, { "start": 770.2399999999999, "end": 775.28, "text": " or part of the table. Then you have the new things so this paper newly" }, { "start": 775.28, "end": 780.5999999999999, "text": " introduces the following embeddings column and row embeddings. Now these for" }, { "start": 780.5999999999999, "end": 784, "text": " the question of course they don't make any sense but you have to put something" }, { "start": 784, "end": 793.04, "text": " here so you just put column 0 but for the table you see there is a column 1" }, { "start": 793.04, "end": 801.68, "text": " and column 2 and the this exactly so we've seen that this here is the header" }, { "start": 801.68, "end": 806.28, "text": " of column 1 and this is the header of column 2 and then it goes back column 1" }, { "start": 806.28, "end": 814.5999999999999, "text": " column 2 column 1 column 2 and you can see here this 0 is in column 1 and this" }, { "start": 814.5999999999999, "end": 821.04, "text": " one is in column 2 and this in column 1 again and the same for the rows so you" }, { "start": 821.04, "end": 828.76, "text": " have row 0 for the headers and then row 1 for the first two numbers and row 2" }, { "start": 828.76, "end": 834.3199999999999, "text": " for the second two numbers. So this is all of this so you see these two are in" }, { "start": 834.3199999999999, "end": 838.0799999999999, "text": " the first row and these two are in the second row. All of this is to tell the" }, { "start": 838.0799999999999, "end": 846.1999999999999, "text": " model all of this information down here is to tell the model how this table" }, { "start": 846.2, "end": 851.5200000000001, "text": " looks so if it wants to select the second column from the third row it" }, { "start": 851.5200000000001, "end": 857.76, "text": " would look in this information to see which cell to select and then the last" }, { "start": 857.76, "end": 864.32, "text": " thing they introduce is this so-called rank embeddings. Now as we've seen before" }, { "start": 864.32, "end": 872.0400000000001, "text": " if this first column here is maybe the sorry the number of days of something so" }, { "start": 872.04, "end": 877.76, "text": " this is the number of days and this second one is the number of reigns so" }, { "start": 877.76, "end": 884.0799999999999, "text": " how many championships the table can only be sorted at maximum by one of them" }, { "start": 884.0799999999999, "end": 891.12, "text": " so you want to sort of for each cell you want to tell the model let's extend that" }, { "start": 891.12, "end": 899.76, "text": " table by two numbers 4 and 1 so for each column you want to tell the model the" }, { "start": 899.76, "end": 904, "text": " ranking of the numbers so here it's pretty easy this is rank 1 this is rank" }, { "start": 904, "end": 909.76, "text": " 2 this is rank 3 further on the left side this is rank 1 this is rank 2 down" }, { "start": 909.76, "end": 913.6, "text": " here and this is rank 3 so the model has an will have an if you give this" }, { "start": 913.6, "end": 920.68, "text": " information the model have an easier time to detect like give me the top 2 or" }, { "start": 920.68, "end": 925.2, "text": " something like this give me the worst give me the best give me the highest and" }, { "start": 925.2, "end": 932.5600000000001, "text": " so on the model will have an easier time doing that so that's why the rank here" }, { "start": 932.5600000000001, "end": 942.1600000000001, "text": " as you can see the zero and as also the number one are embedded rank one and the" }, { "start": 942.1600000000001, "end": 948.72, "text": " other two rank two because they're just lower now I don't feel I feel they could" }, { "start": 948.72, "end": 953.08, "text": " could have given a better example than this table I feel you could actually" }, { "start": 953.08, "end": 960.2800000000001, "text": " put real names here to make clearer not call one and call two and I feel you" }, { "start": 960.2800000000001, "end": 968.32, "text": " could give a somewhat smarter content because if you just look at the picture" }, { "start": 968.32, "end": 974.24, "text": " here you cannot see the correspondence of these rank tokens because in essence" }, { "start": 974.24, "end": 981.76, "text": " they are exactly equal as the row tokens but fortunately we can read the text oh" }, { "start": 981.76, "end": 988.36, "text": " there's the table ha so I have actually I've not seen that but I have discerned" }, { "start": 988.36, "end": 996.04, "text": " it correctly for this particular for this particular input alright I think" }, { "start": 996.04, "end": 1000.52, "text": " that's the the half of the magic is how you encode the input in such a thing and" }, { "start": 1000.52, "end": 1007.28, "text": " this seems to be first of all a pretty cool idea but second of all it exactly" }, { "start": 1007.28, "end": 1014.1999999999999, "text": " is what this kind of new regime of NLP is about is that you basically put" }, { "start": 1014.1999999999999, "end": 1019.56, "text": " everything as a string you annotate it in a smart way and that lets the model" }, { "start": 1019.56, "end": 1026.04, "text": " figure out a lot of stuff about the input people used to people used to do" }, { "start": 1026.04, "end": 1032.92, "text": " the very different things so people if given a query and a table like this what" }, { "start": 1032.92, "end": 1038.16, "text": " people would do is they would somehow first of all get the table headers and" }, { "start": 1038.16, "end": 1045.16, "text": " and kind of guess the data types of the attributes and then they would formulate" }, { "start": 1045.16, "end": 1049.48, "text": " reformulate the query maybe also with a neural network maybe with something else" }, { "start": 1049.48, "end": 1056.6000000000001, "text": " into something like SQL in order to actually have an SQL statement to select" }, { "start": 1056.6000000000001, "end": 1062.28, "text": " the correct cells or perform the correct aggregations and that is somewhat" }, { "start": 1062.28, "end": 1068.76, "text": " brittle and it's just much less deep learning than this model so I like this" }, { "start": 1068.76, "end": 1074.68, "text": " part of the model now the problem of course is as we've seen in this multi" }, { "start": 1074.68, "end": 1080.76, "text": " step process so how do we first of all if you build if we want to build a cell" }, { "start": 1080.76, "end": 1085.6399999999999, "text": " selector that's pretty easy right we've seen this so we the cell selector is" }, { "start": 1085.64, "end": 1096.0400000000002, "text": " first column column selection and then second row selection and this can be" }, { "start": 1096.0400000000002, "end": 1102.96, "text": " multiple rows so that's fairly easy selecting cells either for just returning" }, { "start": 1102.96, "end": 1110.3200000000002, "text": " or for aggregation pretty easy but how do we do the actually the aggregation" }, { "start": 1110.3200000000002, "end": 1114.48, "text": " selection is also pretty easy because we can just do a multi class classifier" }, { "start": 1114.48, "end": 1119.24, "text": " right so the classifier will simply tell us a give us a distribution and then we" }, { "start": 1119.24, "end": 1125.8, "text": " see okay the sum aggregation is probably here the the what the model wants the" }, { "start": 1125.8, "end": 1133.28, "text": " real question is how do we train this and how this is trained is what I find" }, { "start": 1133.28, "end": 1138.88, "text": " really interesting so as we've seen they have training data the training data" }, { "start": 1138.88, "end": 1144.96, "text": " comes in the form of tables questions and answers as we've seen before we don't" }, { "start": 1144.96, "end": 1153.0800000000002, "text": " know how to get to those answers so when the question is which wrestler had the" }, { "start": 1153.0800000000002, "end": 1157.1200000000001, "text": " most number of rains we just know the answer is a Ric flair now they they do" }, { "start": 1157.1200000000001, "end": 1162, "text": " again a two-step process for their training data that mimics the two step" }, { "start": 1162, "end": 1169.52, "text": " process of the model so the first step is is the answer a number is the answer" }, { "start": 1169.52, "end": 1185.12, "text": " a number if no then it is definitely a cell selection task so they if it's not" }, { "start": 1185.12, "end": 1190.64, "text": " a number they just restrict themselves to selecting cells if the answer is not" }, { "start": 1190.64, "end": 1196.68, "text": " in the table then that just means that the correct thing is to select no cells" }, { "start": 1196.68, "end": 1203.72, "text": " and just say I can't answer this question if it is a number then again" }, { "start": 1203.72, "end": 1217.76, "text": " you have two options so is it in the table if yes we are in a weird situation" }, { "start": 1217.76, "end": 1234.16, "text": " if no not in table then it is an aggregation so if it is a number that is" }, { "start": 1234.16, "end": 1239.24, "text": " not in the table that means that the answer is a number there's not in the" }, { "start": 1239.24, "end": 1243.44, "text": " table that means the answer must be computed via one of these aggregations" }, { "start": 1243.44, "end": 1252, "text": " and if the answer is a number but is in the table then we are in this ambiguous" }, { "start": 1252, "end": 1258.04, "text": " answer setting where the it could be that we need to select the cell but it" }, { "start": 1258.04, "end": 1263.3200000000002, "text": " could also be that the same number by accident is in the table but actually" }, { "start": 1263.3200000000002, "end": 1268.72, "text": " needs to be computed from other numbers and they do this in the most deep" }, { "start": 1268.72, "end": 1277.56, "text": " blurny way possible is that they do basically a soft decision here so" }, { "start": 1277.56, "end": 1285.96, "text": " they let the model when they let it select what to compute they let it make" }, { "start": 1285.96, "end": 1290.48, "text": " a soft decision what do I mean by that so let's say you have these three" }, { "start": 1290.48, "end": 1296.32, "text": " operations count sum and average and you have the cell selection so the cell" }, { "start": 1296.32, "end": 1301.52, "text": " selector will basically tell you I will select three cells the three cells" }, { "start": 1301.52, "end": 1308.12, "text": " contain the number seven the number eight and the number three alright so" }, { "start": 1308.12, "end": 1311.28, "text": " and the question was I don't even know what the question was but the cell" }, { "start": 1311.28, "end": 1315.12, "text": " selector tells you these three cells are to be selected you do this by simply" }, { "start": 1315.12, "end": 1319.08, "text": " selecting the cells where the cell selector has a higher probability than" }, { "start": 1319.08, "end": 1326.48, "text": " one half now your your aggregation selection module gives you a softmax" }, { "start": 1326.48, "end": 1335.32, "text": " distribution over over the actions so it's not very much count here maybe" }, { "start": 1335.32, "end": 1343.48, "text": " that's 0.1 this here is maybe 0.3 and this is the 0.6 what you do is you" }, { "start": 1343.48, "end": 1348.1599999999999, "text": " simply compute all of them so you want to compute the count here which is three" }, { "start": 1348.16, "end": 1356, "text": " you want to compute the sum here which is 18 and then you want to compute the" }, { "start": 1356, "end": 1364.96, "text": " average which is six ha I made a good example by accident and then you simply" }, { "start": 1364.96, "end": 1371.44, "text": " weigh the outputs here by their probabilities so you say since the model" }, { "start": 1371.44, "end": 1378.3600000000001, "text": " wants point one puts what point one probability on the count I'm going to" }, { "start": 1378.3600000000001, "end": 1391.1200000000001, "text": " have 0.1 times 3 plus it wants point three times this so 0.3 times 18 plus" }, { "start": 1391.12, "end": 1413.52, "text": " 0.6 times 6 now I'm not gonna so this is 6 plus point three plus 3.6 9.9 so that" }, { "start": 1413.52, "end": 1417.8799999999999, "text": " that's how the model computes things it simply puts probability on these" }, { "start": 1417.88, "end": 1423.5600000000002, "text": " operations here and then you simply take a weighted output with respect to the" }, { "start": 1423.5600000000002, "end": 1429.2, "text": " computation of all those things now I'm pretty sure that's completely invalid" }, { "start": 1429.2, "end": 1434.0800000000002, "text": " because for the same numbers for example the sum is going to have a much larger" }, { "start": 1434.0800000000002, "end": 1442.96, "text": " like variance than the average and and that's somewhat going the count maybe" }, { "start": 1442.96, "end": 1447.5600000000002, "text": " somewhere in between depending on the numbers so this just to take the weighted" }, { "start": 1447.56, "end": 1455.2, "text": " average here and then of course right so what they do is they do have this this" }, { "start": 1455.2, "end": 1458.08, "text": " is the model output and you have the correct answer let's say the correct" }, { "start": 1458.08, "end": 1462.36, "text": " answer was actually was to compute the the average so the correct answers six" }, { "start": 1462.36, "end": 1468.32, "text": " so what they do is simply they take the squared error and that's their loss" }, { "start": 1468.32, "end": 1472.56, "text": " actually they don't take the squared error they take a approximation to the" }, { "start": 1472.56, "end": 1479.84, "text": " squared error which is square until some Delta and then it's linear and this is" }, { "start": 1479.84, "end": 1485.28, "text": " simply to be a bit more outlier robust and they do other things to be more" }, { "start": 1485.28, "end": 1490.84, "text": " outlier robust but this so this is the model output and this is the correct" }, { "start": 1490.84, "end": 1498.24, "text": " answer and they simply count on the fact that this will this will back propagate" }, { "start": 1498.24, "end": 1505.72, "text": " so if you want to make these two things closer if you're the model right you" }, { "start": 1505.72, "end": 1513.8, "text": " have the option of simply putting more weight from the from the other ones on" }, { "start": 1513.8, "end": 1521.8, "text": " to the average operation and that will decrease the 9.9 because you as you can" }, { "start": 1521.8, "end": 1539.52, "text": " see both of these numbers will get smaller and no wait this isn't the yes" }, { "start": 1539.52, "end": 1544.76, "text": " sorry so you will you will decrease these numbers so this is the output we" }, { "start": 1544.76, "end": 1550.04, "text": " got from the weighted average right so if we decrease these weights you will" }, { "start": 1550.04, "end": 1555.56, "text": " put weight from here to here that will bring the number 9.9 down and that will" }, { "start": 1555.56, "end": 1561.72, "text": " get you closer to the answer you're looking for but you can also achieve" }, { "start": 1561.72, "end": 1569.24, "text": " this by you can achieve this even more right so this 9.9 is too high if we want" }, { "start": 1569.24, "end": 1574.6399999999999, "text": " to bring the 9.9 down we're much better off by taking some of that output and" }, { "start": 1574.64, "end": 1580.1200000000001, "text": " actually putting on this here because three is the lowest number right the" }, { "start": 1580.1200000000001, "end": 1585.6000000000001, "text": " only agreement here is that we want to take weight away from the 18 from the" }, { "start": 1585.6000000000001, "end": 1593.1200000000001, "text": " large one so I'm extremely surprised that this works given that it is so" }, { "start": 1593.1200000000001, "end": 1601.0600000000002, "text": " super ambiguous what the model should do with these operations and I I highly" }, { "start": 1601.06, "end": 1605.08, "text": " doubt that you can extend this so it's of course agnostic of what these" }, { "start": 1605.08, "end": 1611.8799999999999, "text": " aggregations are but to be able to extend this to many more aggregations" }, { "start": 1611.8799999999999, "end": 1616.32, "text": " is will I think lead to much more of these situations where the model is" }, { "start": 1616.32, "end": 1622.08, "text": " entirely unsure of where to put the mass of where to put the weight and I would be" }, { "start": 1622.08, "end": 1627.04, "text": " interested to see what happens if you have a data set with like 20 or 50 of" }, { "start": 1627.04, "end": 1635.1599999999999, "text": " these aggregations and not just three so this is the this is the let's say the" }, { "start": 1635.1599999999999, "end": 1639.44, "text": " the interesting part here the other if you go the other way when you have this" }, { "start": 1639.44, "end": 1646.56, "text": " cell selection task it is just to select a cell right and then you simply have" }, { "start": 1646.56, "end": 1654.12, "text": " the cell selector that part here that does the selection that you also you" }, { "start": 1654.12, "end": 1658.7199999999998, "text": " train every time simply to give each cell a weight right so this this is" }, { "start": 1658.7199999999998, "end": 1663.56, "text": " simply the softmax over column and then the softmax over rows and you can train" }, { "start": 1663.56, "end": 1670.7199999999998, "text": " that using the cross entropy now training this cell selector from data is" }, { "start": 1670.7199999999998, "end": 1676.4799999999998, "text": " pretty easy when it's a cell selection task right because the answer is in the" }, { "start": 1676.4799999999998, "end": 1682.4799999999998, "text": " table and or is not in the table and then you know to select no cell so you" }, { "start": 1682.48, "end": 1686.88, "text": " do have the training data that a particular cell is the correct cell and" }, { "start": 1686.88, "end": 1693.04, "text": " you can train the model to select that cell but it is actually a pretty hard" }, { "start": 1693.04, "end": 1698.64, "text": " task if it is for example you're looking for an average operation because not" }, { "start": 1698.64, "end": 1702.48, "text": " only do you are you not really sure that it's an average operation you just know" }, { "start": 1702.48, "end": 1707.2, "text": " that that kind of gives you the correct answer you also don't really know which" }, { "start": 1707.2, "end": 1713.72, "text": " cells to select for this average operation right because depending on" }, { "start": 1713.72, "end": 1716.64, "text": " which cells you select and of course that's going to be a soft selection as" }, { "start": 1716.64, "end": 1722.92, "text": " well the the average answer the average will be different depending on which" }, { "start": 1722.92, "end": 1727.88, "text": " cells you select so they're basically counting on this loss here to back" }, { "start": 1727.88, "end": 1733.2, "text": " propagate not only through the the selection of the aggregation to perform" }, { "start": 1733.2, "end": 1741.68, "text": " but also to the cell selector to set which cells to to select so from this" }, { "start": 1741.68, "end": 1745.3600000000001, "text": " weak signal it's almost like the reinforcement learning problem where you" }, { "start": 1745.3600000000001, "end": 1749.76, "text": " have the weak signal and you have like a billion ways to get your number closer" }, { "start": 1749.76, "end": 1756.3600000000001, "text": " to that signal and not not really accurate understanding of what you need" }, { "start": 1756.3600000000001, "end": 1760.32, "text": " to do is you're just relying on the model through lots and lots and lots and" }, { "start": 1760.32, "end": 1765.3999999999999, "text": " lots of data to kind of figure out which natural language questions to map to" }, { "start": 1765.3999999999999, "end": 1772.76, "text": " which cell selection and aggregation so this is it's a it seems like impossible" }, { "start": 1772.76, "end": 1778.48, "text": " but it works the last thing we need to talk about is this ambiguous answer" }, { "start": 1778.48, "end": 1782.6, "text": " setting and as you can imagine it's pretty simple that they also let the" }, { "start": 1782.6, "end": 1787.96, "text": " model do and a soft selection between the cell selection tasks so no" }, { "start": 1787.96, "end": 1792.32, "text": " aggregation and the aggregations to be performed and basically let the model" }, { "start": 1792.32, "end": 1798.24, "text": " figure out itself which one is better to do an aggregation or to do no" }, { "start": 1798.24, "end": 1807.6000000000001, "text": " aggregation suffice to say this this only works for pretty I think I think it" }, { "start": 1807.6000000000001, "end": 1811.24, "text": " only works for pretty limited amount of tasks pretty limited amount of questions" }, { "start": 1811.24, "end": 1815.24, "text": " and you might have spotted there even these questions that are follow-up" }, { "start": 1815.24, "end": 1819.76, "text": " questions which are another thing they build into the model and I don't I'm not" }, { "start": 1819.76, "end": 1824.84, "text": " really gonna talk about this but they do have this concept as well which I find" }, { "start": 1824.84, "end": 1828.52, "text": " maybe a bit out of place but maybe it's just part of their data set somewhere" }, { "start": 1828.52, "end": 1834.36, "text": " maybe it's just these companies want to get into this conversational mode so" }, { "start": 1834.36, "end": 1839.08, "text": " everything needs to be context dependent at the interesting part here is really" }, { "start": 1839.08, "end": 1844.64, "text": " the computation of the aggregates and specifically the question of which of" }, { "start": 1844.64, "end": 1849.8400000000001, "text": " these aggregations to choose and this again this is so surprising that it" }, { "start": 1849.8400000000001, "end": 1857.6000000000001, "text": " works and fairly fairly cool I think that is the gist of the paper they do" }, { "start": 1857.6000000000001, "end": 1863.8000000000002, "text": " extremely thorough evaluations here on these data sets and ablations to see" }, { "start": 1863.8000000000002, "end": 1869.44, "text": " what really counts and what doesn't I don't really want to go into that safe" }, { "start": 1869.44, "end": 1875.04, "text": " to say their results are better than anything else before I believe they I" }, { "start": 1875.04, "end": 1880.8400000000001, "text": " believe they're actually on par with another model but in one data set but" }, { "start": 1880.8400000000001, "end": 1886.92, "text": " they beat them on every other data set so that's you know that's cool I don't" }, { "start": 1886.92, "end": 1893.3200000000002, "text": " think there was a bar nevermind I invite you to check out this paper look for" }, { "start": 1893.3200000000002, "end": 1897, "text": " yourself they have the code online if you want to train a model like this" }, { "start": 1897, "end": 1900.92, "text": " yourself other than that thanks for listening if you like this content" }, { "start": 1900.92, "end": 1927.8000000000002, "text": " please subscribe like comment tell a friend and bye bye" } ]
PDRtyrVskMU
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Chip Placement with Deep Reinforcement Learning (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "reinforcement learning", "deep reinforcement learning", "gans", "gan", "deconvolution", "computer chip", "gpu", "tpu", "fpga", "netlist", "constrained", "google" ]
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 Miroszajny, Anna Goldi 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 netlist. So your netlist is any parts that you want on that computer chip and their shape or their size. So you can imagine this like a bit of a Tetris game. So here's this netlist. There's this part and then this part and then there's maybe this part and also this part. 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 netlist 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 nodes. Now your goal is to place those things on this board. So for example we're gonna place this right here and we're gonna 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 NAND gates right? NAND gates pretty important for a CPU and this is your floating point unit also pretty important and so on. So I 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 is a component right here. According to the netlist 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 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 it 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 the 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 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. 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 gonna draw this again I can imagine maybe there's a part here that wants to go up and then it maybe shares sorry shares this part of the wire here with the other one and so there's congestion like it's 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 measure 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 netlist first and they just go down the netlist like this. So you tell the agent hey agent I want you to place this 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 and 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 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 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 tasks you'll get your reward at the end of that action time but not here at the end of the action time there is an 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 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 netlist as 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 netlist is always the same right if you might be coming from a deep learning framework where you're used to many many different training samples in this case basically the netlist 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 in supervised learning if you know the solution to a particular data point you're happy right you 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 netlist one problem to optimally place this netlist and 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 that 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 alright so here is how the model looks from a deep RL perspective now there's two parts to 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 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 side 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 controller you compress them here we if you run 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 D convolutions and the D convolutions 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 D convolved into more and more though less and less channels but more and more height and width 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 D convolution 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 nanometer 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 three four and so on eight right here so for each of these they 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 on 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 this 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 say ah 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 netlist 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 netlist is a graph right the netlist is again if you have your wow this is slow today if you have your netlist 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 during a 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 vi vj and vk now these represent the pieces in the netlist 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 I believe they they have them somewhere here its size maybe how much power it uses and also its 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 vi and vj for an 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 EJK and this is the same as if you're used to yeah 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 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 back propagate through this through these multiple updates or whether they just back prop through one of them not entirely sure but ultimately they get embeddings these edge embeddings out of this graph and they simply take the mean to get the graph embeddings and that goes into their state embeddings right 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 it's 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 netlist 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 right 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 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 it will get better over time all right 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 netlist where was it right we've we've now trained on this particular netlist this was this was our problem and we've solved that we have a great solution can we now when we get a netlist another netlist so here is netlist 2 right it's maybe a bit different so this one is more longer and this one is here and so on what if so we would have to start again from scratch a training reinforcement learning agent on the netlist too so maybe a RL 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 netlist but on a set of netlists and the biggest set they have is 20 so their data set size is 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-trained 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 on the right and fine-tuned on that particular architecture obviously me being an expert in chip placement is it 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 approach is and it says the figures are intentionally blurred as the designs are provided like why do you put them that clearly I can't even couldn't even judge if they're super crisp I yeah all 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 they also better on the metrics yeah 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 all right 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, "end": 5.48, "text": " Hi there! Today we're looking at Chip Placement with Deep Reinforcement Learning" }, { "start": 5.48, "end": 11.88, "text": " by Azalia Miroszajny, Anna Goldi and a long list of authors that I have no" }, { "start": 11.88, "end": 18.96, "text": " stamina to read down. I'm sorry. So this work is a cool application of" }, { "start": 18.96, "end": 26.36, "text": " reinforcement learning to the real world. And we're gonna go through it and the" }, { "start": 26.36, "end": 31.88, "text": " cool thing about it is it pulls together parts from so many different areas of" }, { "start": 31.88, "end": 37, "text": " machine learning and also here chip engineering. So what's the fundamental" }, { "start": 37, "end": 44.760000000000005, "text": " problem? The fundamental problem of chip design is this. You have a canvas, an" }, { "start": 44.760000000000005, "end": 50.16, "text": " empty chip and you want to build a computer chip. Now what you have given is" }, { "start": 50.16, "end": 57.959999999999994, "text": " a so-called netlist. So your netlist is any parts that you want on that computer" }, { "start": 57.959999999999994, "end": 63.12, "text": " chip and their shape or their size. So you can imagine this like a bit of a" }, { "start": 63.12, "end": 69.64, "text": " Tetris game. So here's this netlist. There's this part and then this part and" }, { "start": 69.64, "end": 75.52, "text": " then there's maybe this part and also this part. Many many parts. Now these as I" }, { "start": 75.52, "end": 80.75999999999999, "text": " understand it can be thousands of parts but you can sort of group them together" }, { "start": 80.75999999999999, "end": 85.8, "text": " but still there are a lot of these parts. And the netlist also contains" }, { "start": 85.8, "end": 90.64, "text": " information about how they're connected. So for each of these parts you would" }, { "start": 90.64, "end": 96.75999999999999, "text": " have a list of which other ones of these parts they must be connected to. So" }, { "start": 96.75999999999999, "end": 101.16, "text": " maybe it says okay this part here needs to be connected to those three parts and" }, { "start": 101.16, "end": 105.32, "text": " for each of those you'd also have like a list of how they must be connected." }, { "start": 105.32, "end": 110.27999999999999, "text": " You can represent this as an adjacency matrix right? But ultimately this is a" }, { "start": 110.27999999999999, "end": 117.55999999999999, "text": " graph of these nodes. Now your goal is to place those things on this board. So for" }, { "start": 117.55999999999999, "end": 122.11999999999999, "text": " example we're gonna place this right here and we're gonna place the second" }, { "start": 122.11999999999999, "end": 127.35999999999999, "text": " one maybe here and the third one maybe here. So you can imagine if this is a" }, { "start": 127.35999999999999, "end": 132.92, "text": " CPU maybe look I have no clue of chip design but I imagine it like this. This" }, { "start": 132.92, "end": 139.23999999999998, "text": " is your clock that you need on there. This is your NAND gates right? NAND gates" }, { "start": 139.23999999999998, "end": 145.07999999999998, "text": " pretty important for a CPU and this is your floating point unit also pretty" }, { "start": 145.07999999999998, "end": 149.67999999999998, "text": " important and so on. So I need to place these things and then you need to" }, { "start": 149.67999999999998, "end": 154.51999999999998, "text": " connect them using these using wires. Now wires are of course etched into the" }, { "start": 154.51999999999998, "end": 160.2, "text": " board but you need to connect them according to the maybe there is a" }, { "start": 160.2, "end": 165.92, "text": " component right here. According to the netlist right they need to be connected" }, { "start": 165.92, "end": 172.35999999999999, "text": " like that. Maybe the algorithm that came up with the chip told you they need to" }, { "start": 172.35999999999999, "end": 177.23999999999998, "text": " be connected like this and if you lay them out like this you can draw the" }, { "start": 177.23999999999998, "end": 181.95999999999998, "text": " wires. So this is your finished you you want to go from the thing on the right" }, { "start": 181.95999999999998, "end": 187.23999999999998, "text": " to the thing on the left and your goal here in order to get the fastest" }, { "start": 187.24, "end": 194.8, "text": " possible computer chip is three things. First of all you want first of all the" }, { "start": 194.8, "end": 201.60000000000002, "text": " density is important. By density it basically just means you can't place" }, { "start": 201.60000000000002, "end": 207.92000000000002, "text": " stuff on top of other stuff so you could not place a block right here. Not possible" }, { "start": 207.92000000000002, "end": 212.8, "text": " because the clock is already there. So that's first thing you can't place" }, { "start": 212.8, "end": 221.76000000000002, "text": " stuff on top of other stuff. Then the second thing is the wires and" }, { "start": 221.76000000000002, "end": 228.36, "text": " specifically the length of the wires. So you see for example this thing here is a" }, { "start": 228.36, "end": 233.56, "text": " pretty short wire that means the signal travels fast. This thing here is a long" }, { "start": 233.56, "end": 241.04000000000002, "text": " wire so the signal travels more slowly. Now the lower sorry the the faster you" }, { "start": 241.04, "end": 244.76, "text": " want your signal to go that means you have to make your wires as short as" }, { "start": 244.76, "end": 249.28, "text": " possible. So you want to keep the total amount of wire length as short as" }, { "start": 249.28, "end": 259.28, "text": " possible. Then third is what's called congestion. So congestion is when for" }, { "start": 259.28, "end": 265.36, "text": " example okay I actually don't know what it is but maybe it is when two wires" }, { "start": 265.36, "end": 272.08000000000004, "text": " cross like somewhere here there might be congestion or maybe some parts" }, { "start": 272.08000000000004, "end": 278.16, "text": " actually share their wires. I can imagine sorry I'm gonna draw this again I can" }, { "start": 278.16, "end": 287.08000000000004, "text": " imagine maybe there's a part here that wants to go up and then it maybe shares" }, { "start": 287.08000000000004, "end": 292.88, "text": " sorry shares this part of the wire here with the other one and so there's" }, { "start": 292.88, "end": 298.56, "text": " congestion like it's roads or something. In any case you can measure congestion" }, { "start": 298.56, "end": 303.52, "text": " it's a bad thing and you want to lay out your components basically in order to" }, { "start": 303.52, "end": 308.15999999999997, "text": " minimize congestion and also minimize the length of the wires and not have" }, { "start": 308.15999999999997, "end": 314.76, "text": " them on top of one another. Easy enough right? It takes human experts and" }, { "start": 314.76, "end": 320.36, "text": " combined with state-of-the-art algorithms multiple weeks to design chips like this" }, { "start": 320.36, "end": 326, "text": " and that's the fundamental problem and this paper takes reinforcement learning" }, { "start": 326, "end": 333.04, "text": " in order to solve this problem in a few hours. So how does it do this? The" }, { "start": 333.04, "end": 338.8, "text": " reinforcement learning is basically a sequential measure method so you want to" }, { "start": 338.8, "end": 345.16, "text": " do one action at a time. So you start off with what they call the chip canvas" }, { "start": 345.16, "end": 351.6, "text": " which is just empty. This is your state and then the agent here it gets to" }, { "start": 351.6, "end": 355.56, "text": " decide where to place the next thing. Now how do you decide what the next thing is?" }, { "start": 355.56, "end": 361.48, "text": " I believe they simply go by size so they take the largest component first of" }, { "start": 361.48, "end": 367.92, "text": " the netlist first and they just go down the netlist like this. So you tell the" }, { "start": 367.92, "end": 374.12, "text": " agent hey agent I want you to place this this thing here I want you to place this" }, { "start": 374.12, "end": 380.2, "text": " next and the agent will tell you I will place it right here and then again you" }, { "start": 380.2, "end": 385.04, "text": " tell the agent agent I have this this thing here where do you want to place it" }, { "start": 385.04, "end": 389.56, "text": " and along with sorry along with all the connections right along with everything" }, { "start": 389.56, "end": 394.84000000000003, "text": " that it needs to be connected to and also the entire list so the agent must" }, { "start": 394.84000000000003, "end": 400.72, "text": " also think of what what is to come yet what it hasn't placed yet. So it" }, { "start": 400.72, "end": 405.12, "text": " everything goes into this decision and it tells you okay I want to place this" }, { "start": 405.12, "end": 411.32000000000005, "text": " here and then at the end you end up with this filled board. Now this isn't" }, { "start": 411.32000000000005, "end": 418.24, "text": " actually the end. After you have placed all your things there is another method" }, { "start": 418.24, "end": 423.64000000000004, "text": " coming in this is called this force directed method placing yet more things" }, { "start": 423.64000000000004, "end": 430, "text": " so what you actually place with this agent is only the things called macros. I" }, { "start": 430, "end": 434.92, "text": " have no idea what those are or how these are different from these standard cells" }, { "start": 434.92, "end": 439.84, "text": " but apparently you must use a force directed method which you can think of" }, { "start": 439.84, "end": 445.48, "text": " just just an algorithm you run to place the standard cells and these are these" }, { "start": 445.48, "end": 453.84, "text": " these gray blobs here and at the end of all of this you can finally evaluate how" }, { "start": 453.84, "end": 459.1, "text": " good your design is. So at the end of all your of this you get a reward that is a" }, { "start": 459.1, "end": 464.28000000000003, "text": " mixture of wire length and congestion. Now this is actually an approximation to" }, { "start": 464.28000000000003, "end": 468.44, "text": " wire length and this is an approximation to congestion that they use because they" }, { "start": 468.44, "end": 473.6, "text": " need to evaluate it quickly but in essentially it's highly correlated" }, { "start": 473.6, "end": 478.96000000000004, "text": " with wire length and congestion so the negative of that is going to be your" }, { "start": 478.96000000000004, "end": 486, "text": " reward. So in terms of a reinforcement learning problem this is pretty nasty" }, { "start": 486, "end": 491.8, "text": " right because as you can see here you get basically a reward of zero for every" }, { "start": 491.8, "end": 498.04, "text": " step until the very end you get your true reward and it is actually worse" }, { "start": 498.04, "end": 505.36, "text": " than that because so from here to here your agent gets to perform actions" }, { "start": 505.36, "end": 512.88, "text": " right this is action time but usually when you have these sparse reward tasks" }, { "start": 512.88, "end": 517.84, "text": " you'll get your reward at the end of that action time but not here at the end" }, { "start": 517.84, "end": 522.76, "text": " of the action time there is an algorithm over which the agent basically has no" }, { "start": 522.76, "end": 529.48, "text": " control that comes in and does a bunch of things this force directed method and" }, { "start": 529.48, "end": 535.68, "text": " only then do you get your reward right so the agent must purposefully sort of" }, { "start": 535.68, "end": 540.6, "text": " leave room here for what this algorithm is going to do so it needs to learn that" }, { "start": 540.6, "end": 546.4, "text": " as well this is a as far as reinforcement learning goes this is a" }, { "start": 546.4, "end": 551.72, "text": " pretty good reinforcement learning problem right so now we have an" }, { "start": 551.72, "end": 557.8000000000001, "text": " environment which is the canvas here and also this you can you can consider this" }, { "start": 557.8000000000001, "end": 562.84, "text": " force directed method to be part of the environment and of course the reward" }, { "start": 562.84, "end": 570.2, "text": " giver and you have also the netlist as part of the environment and you have the" }, { "start": 570.2, "end": 574.76, "text": " agent that can do actions now we have to go into how does the agent perform" }, { "start": 574.76, "end": 583.1600000000001, "text": " actions on this so by the way maybe a bit confusing because it was a bit" }, { "start": 583.1600000000001, "end": 587.6800000000001, "text": " confusing for me for a given reinforcement learning problem we'll" }, { "start": 587.6800000000001, "end": 593.6, "text": " just start out by saying that the netlist is always the same right if you" }, { "start": 593.6, "end": 599.9200000000001, "text": " might be coming from a deep learning framework where you're used to many many" }, { "start": 599.92, "end": 606.3199999999999, "text": " different training samples in this case basically the netlist the goal is always" }, { "start": 606.3199999999999, "end": 611.04, "text": " the same you can think of it like a reinforcement learning agent for the" }, { "start": 611.04, "end": 615.76, "text": " game of chess where it's always the same chess game that you're trying to" }, { "start": 615.76, "end": 620.4, "text": " optimize this is the difference to let's say supervised learning if you have a" }, { "start": 620.4, "end": 624.5999999999999, "text": " label in supervised learning if you know the solution to a particular data point" }, { "start": 624.5999999999999, "end": 628.8399999999999, "text": " you're happy right you that data point is no longer interesting you want to" }, { "start": 628.84, "end": 635.08, "text": " generalize here even though they generalize later here you can give it a" }, { "start": 635.08, "end": 641.44, "text": " single problem right and it will already a solution to that problem will be" }, { "start": 641.44, "end": 645.5600000000001, "text": " valuable because it can be a better solution that humanity has come up with" }, { "start": 645.5600000000001, "end": 650.84, "text": " until this point so always think that we're now just working on one single" }, { "start": 650.84, "end": 656.44, "text": " netlist one problem to optimally place this netlist and an episode is simply to" }, { "start": 656.44, "end": 662.4000000000001, "text": " place these things until here and then you get a reward and then you go back to" }, { "start": 662.4000000000001, "end": 666.2800000000001, "text": " the beginning and just do it all over again but just try to do better and then" }, { "start": 666.2800000000001, "end": 671.2, "text": " you go back to the beginning and you do it all over again the same problem right" }, { "start": 671.2, "end": 678.6, "text": " okay so how does this work by the way that the paper has great technical" }, { "start": 678.6, "end": 684.5200000000001, "text": " detail on chip engineering and how the reward function exactly works and so on" }, { "start": 684.52, "end": 691.0799999999999, "text": " I have not the expertise to go into this with you beyond what I just described" }, { "start": 691.0799999999999, "end": 696.12, "text": " alright so here is how the model looks from a deep RL perspective now there's" }, { "start": 696.12, "end": 703.6, "text": " two parts to this model you can divide it about here so on the right you would" }, { "start": 703.6, "end": 707.96, "text": " have what is your policy and value networks and on the left the feature" }, { "start": 707.96, "end": 713.48, "text": " embeddings so in reinforcement learning and we won't go much into reinforcement" }, { "start": 713.48, "end": 718.96, "text": " learning now but what you need are basically a way to encode the state this" }, { "start": 718.96, "end": 724.5600000000001, "text": " is the encoder so all the information of the observation they might be in" }, { "start": 724.5600000000001, "end": 729.08, "text": " different modalities and so on you need to encode this into but in for" }, { "start": 729.08, "end": 733.48, "text": " simplicity let's say a single vector that's thing that this thing here this" }, { "start": 733.48, "end": 745.72, "text": " is the state encoding and then you can employ a policy and a value network in" }, { "start": 745.72, "end": 749.6, "text": " order to do reinforcement learning so the side on the right this comes from" }, { "start": 749.6, "end": 754.36, "text": " standard RL you have a policy network and a value network and they do I" }, { "start": 754.36, "end": 760.4, "text": " believe PPO with it this is a standard reinforcement learning architecture" }, { "start": 760.4, "end": 766.84, "text": " it's an actor critic architecture so the value net is simply telling you what's" }, { "start": 766.84, "end": 771.4399999999999, "text": " the value of the state that you're in now given that you have a state embedding" }, { "start": 771.4399999999999, "end": 776.72, "text": " it simply takes a fully connected layer to transform this into a single float" }, { "start": 776.72, "end": 781.24, "text": " that is the value network the policy is a bit different because usually in" }, { "start": 781.24, "end": 784.4, "text": " reinforcement learning you just have a list of actions right you just say I" }, { "start": 784.4, "end": 792.16, "text": " have these 16 buttons on my controller you compress them here we if you run if" }, { "start": 792.16, "end": 798.4, "text": " you look at this chip from above we have a question where do you want to place" }, { "start": 798.4, "end": 805.12, "text": " the next thing so in order to do that we take this embedding of the state and" }, { "start": 805.12, "end": 811.24, "text": " they run it through a series of D convolutions and the D convolutions they" }, { "start": 811.24, "end": 818.2, "text": " have the ability to basically up sample an image so you see here you transform" }, { "start": 818.2, "end": 824.88, "text": " this vector into a 4 by 4 by 32 tensor and that gets D convolved into more and" }, { "start": 824.88, "end": 830.96, "text": " more though less and less channels but more and more height and width images so" }, { "start": 830.96, "end": 836.16, "text": " it kind of from a vector it produces an image right here you might recognize" }, { "start": 836.16, "end": 842.28, "text": " this from a lot of generator architectures for when you make GANs for" }, { "start": 842.28, "end": 849.68, "text": " images have exactly this D convolution architecture so as I said pretty cool" }, { "start": 849.68, "end": 853.68, "text": " it pulls in kind of architectures and methods from different fields we already" }, { "start": 853.68, "end": 860.8, "text": " have reinforcement learning now we have generators for images now so you come up" }, { "start": 860.8, "end": 866.92, "text": " with an image and basically this image if you can imagine this from above is" }, { "start": 866.92, "end": 871.1999999999999, "text": " discretized so you can place the thing you have to place pretty much every" }, { "start": 871.1999999999999, "end": 878.92, "text": " single nanometer but they discretize this into a grid and for each point in" }, { "start": 878.92, "end": 885.4, "text": " the grid the network outputs a number so the number maybe nine here three four" }, { "start": 885.4, "end": 893.0799999999999, "text": " and so on eight right here so for each of these they it outputs a number where" }, { "start": 893.0799999999999, "end": 897.8, "text": " it would or how much it would like to place the next thing at this particular" }, { "start": 897.8, "end": 903.56, "text": " location so this is a distribution over locations so the first thing you have to" }, { "start": 903.56, "end": 906.84, "text": " do is you have to mask out where there are already things we said the first" }, { "start": 906.84, "end": 911.16, "text": " condition is things cannot be on top of other things so maybe you already have" }, { "start": 911.16, "end": 914.04, "text": " placed something here so you ignore those numbers and you have already" }, { "start": 914.04, "end": 918.12, "text": " placed something here so you ignore those numbers as well this is this" }, { "start": 918.12, "end": 922.8, "text": " masking operation right here and then you simply look at where is your highest" }, { "start": 922.8, "end": 929.0799999999999, "text": " number and maybe there's maybe there's an 11 down here somewhere say ah this is" }, { "start": 929.0799999999999, "end": 934.14, "text": " my highest number okay cool and you look at what you need to place maybe the" }, { "start": 934.14, "end": 939.68, "text": " thing you need to place looks like this and you say all right I will place maybe" }, { "start": 939.68, "end": 947.76, "text": " the 11 marks the top left corner I will place it right here okay and then you do" }, { "start": 947.76, "end": 953.2399999999999, "text": " the same thing again for the next piece so the next piece you would simply also" }, { "start": 953.2399999999999, "end": 959.3199999999999, "text": " mark this to be blue so you can't place here you evaluate your network again of" }, { "start": 959.3199999999999, "end": 963.8399999999999, "text": " course you'll have a new shape something like this and then you ask the network" }, { "start": 963.8399999999999, "end": 967.64, "text": " where would you like to place this and you do this step by step by step until" }, { "start": 967.64, "end": 976.28, "text": " the entire netlist is empty so this is how we do the reinforcement learning" }, { "start": 976.28, "end": 981.4399999999999, "text": " this is how we decide on an action but how do we actually put the state into" }, { "start": 981.4399999999999, "end": 988.56, "text": " this encoding now this pulls in yet another framework from another field of" }, { "start": 988.56, "end": 994.28, "text": " deep learning namely graph convolutional neural networks so since the netlist is" }, { "start": 994.28, "end": 1003.92, "text": " a graph right the netlist is again if you have your wow this is slow today if" }, { "start": 1003.92, "end": 1008.88, "text": " you have your netlist right here with the part right the shape or size" }, { "start": 1008.88, "end": 1017.12, "text": " whatever and the list of things it needs to be connected to then this forms" }, { "start": 1017.12, "end": 1022.4, "text": " naturally a graph so you can transform this into a graph with the things that" }, { "start": 1022.4, "end": 1027.84, "text": " need to be connected connected by an edge and they run a graph convolutional" }, { "start": 1027.84, "end": 1032.92, "text": " network across that now in a graph convolutional network you're trying to" }, { "start": 1032.92, "end": 1040.72, "text": " take a graph like this and have embeddings for the edges and the" }, { "start": 1040.72, "end": 1048.5, "text": " vertices so ultimately you want what's called a graph embedding in order to do" }, { "start": 1048.5, "end": 1053.92, "text": " that you need to propagate information along the graph usually as we said this" }, { "start": 1053.92, "end": 1059.68, "text": " is done during a graph convolution if you are in machine learning for a while" }, { "start": 1059.68, "end": 1065.48, "text": " longer you might remember also things like conditional random fields or" }, { "start": 1065.48, "end": 1072.88, "text": " generally graphical methods that were once popular and are kind of a precursor" }, { "start": 1072.88, "end": 1078.72, "text": " to this so the way they do it is they do it in an iterative fashion they have" }, { "start": 1078.72, "end": 1090.7600000000002, "text": " multiple so they say this right here so how do they embed a graph they have" }, { "start": 1090.7600000000002, "end": 1095.6000000000001, "text": " nodes in the graph as we saw before I'm going to draw this one again so this is" }, { "start": 1095.6000000000001, "end": 1102.6000000000001, "text": " maybe vi vj and vk now these represent the pieces in the netlist that you have" }, { "start": 1102.6, "end": 1109.6399999999999, "text": " to place so for each of those it has a bunch of features right so the features" }, { "start": 1109.6399999999999, "end": 1120, "text": " might be its size it's I believe they they have them somewhere here its size" }, { "start": 1120, "end": 1125.6799999999998, "text": " maybe how much power it uses and also its x and y coordinates if it is already" }, { "start": 1125.6799999999998, "end": 1131.2199999999998, "text": " placed right so you start with a vector like this and then you iteratively do" }, { "start": 1131.22, "end": 1140.64, "text": " the following thing you compute edge edge features by running first these" }, { "start": 1140.64, "end": 1149.46, "text": " things so this is vi and vj for an for each edge you take its nodes run them" }, { "start": 1149.46, "end": 1155.64, "text": " through this fully connected layer so you embed the features of the nodes you" }, { "start": 1155.64, "end": 1160.52, "text": " concatenate them and you run it through another neural network layer and that's" }, { "start": 1160.52, "end": 1168.2, "text": " how you get embeddings for edges and then you update the embeddings for the" }, { "start": 1168.2, "end": 1172.96, "text": " nodes again by taking the mean embeddings of the edges so you do this" }, { "start": 1172.96, "end": 1177.48, "text": " in an iterative fashion first you compute the edges from the nodes and" }, { "start": 1177.48, "end": 1185.32, "text": " then you compute the nodes from the edges and so on right so this means that" }, { "start": 1185.32, "end": 1190.2, "text": " information can now propagate through the graph so information from this thing" }, { "start": 1190.2, "end": 1195.8400000000001, "text": " propagates into this edge embedding and then in the next step that will" }, { "start": 1195.8400000000001, "end": 1202.56, "text": " propagate into this and then that can propagate into this EJK and this is the" }, { "start": 1202.56, "end": 1206.96, "text": " same as if you're used to yeah something like a conditional random fields over" }, { "start": 1206.96, "end": 1215.32, "text": " time if you have a big graph like this the information from any particular node" }, { "start": 1215.32, "end": 1220.9199999999998, "text": " will kind of propagate out throughout the graph and at some point you can sort" }, { "start": 1220.9199999999998, "end": 1226.6, "text": " of reach an equilibrium where everyone everyone in the graph knows about" }, { "start": 1226.6, "end": 1236.1599999999999, "text": " everyone else I have not found how many times they do it they simply say we" }, { "start": 1236.1599999999999, "end": 1241.32, "text": " repeatedly perform the following updates maybe that's somewhere and I just" }, { "start": 1241.32, "end": 1246.6, "text": " haven't read it closely enough but also I don't haven't seen whether or not they" }, { "start": 1246.6, "end": 1251.24, "text": " then back propagate through this through these multiple updates or whether they" }, { "start": 1251.24, "end": 1259.8, "text": " just back prop through one of them not entirely sure but ultimately they get" }, { "start": 1259.8, "end": 1266.12, "text": " embeddings these edge embeddings out of this graph and they simply take the mean" }, { "start": 1266.12, "end": 1272.12, "text": " to get the graph embeddings and that goes into their state embeddings right" }, { "start": 1272.12, "end": 1279.8, "text": " along with that they also have the macro embeddings which are the nodes here the" }, { "start": 1279.8, "end": 1284.9599999999998, "text": " things to be placed along with the current macro ID this is which one do you" }, { "start": 1284.9599999999998, "end": 1290.28, "text": " need to place right now so this comes out of these are the two things out of" }, { "start": 1290.28, "end": 1295.32, "text": " graphs vertices and edges and then which one you need to place right now it's" }, { "start": 1295.32, "end": 1303.48, "text": " pretty important right so you take the ones the one that you need to place" }, { "start": 1303.48, "end": 1307.6, "text": " this also goes into your embedding and then you have some metadata about the" }, { "start": 1307.6, "end": 1313.9199999999998, "text": " netlist like how many things there are and so on and this is also embedded" }, { "start": 1313.9199999999998, "end": 1318.1599999999999, "text": " using a fully connected layer all of that goes into your embedding right so" }, { "start": 1318.1599999999999, "end": 1322.32, "text": " your embedding will contain all of this information if you've done a good job" }, { "start": 1322.32, "end": 1331.1599999999999, "text": " and if you train it correctly so this is the model now they do pre train this" }, { "start": 1331.1599999999999, "end": 1336.72, "text": " encoder part right here and the encoder part it's also kind of circular first of" }, { "start": 1336.72, "end": 1343.4399999999998, "text": " all they just generate a giant list so they take this chip here and they just" }, { "start": 1343.4399999999998, "end": 1348.3999999999999, "text": " run a policy network that is maybe not super optimal but they just run it a" }, { "start": 1348.4, "end": 1353.2800000000002, "text": " bunch of times in intermediate states and they pre train the encoder to" }, { "start": 1353.2800000000002, "end": 1360.1200000000001, "text": " predict the final reward for each of these placements or sorry the the the" }, { "start": 1360.1200000000001, "end": 1366.6000000000001, "text": " wire length and congestion and so on and that pre trains the encoder but" }, { "start": 1366.6000000000001, "end": 1370.3200000000002, "text": " ultimately you can train this with reinforcement learning you can now let" }, { "start": 1370.3200000000002, "end": 1374.76, "text": " it try to solve this board over and over and over and over and it will get better" }, { "start": 1374.76, "end": 1383.32, "text": " over time all right the last thing they do is they do transfer learning now" }, { "start": 1383.32, "end": 1389.76, "text": " finding a better architecture for a single board is already better and" }, { "start": 1389.76, "end": 1395.76, "text": " faster than the humans but what is cool is that if you have now trained on this" }, { "start": 1395.76, "end": 1403, "text": " one particular board sorry with one particular netlist where was it right" }, { "start": 1403, "end": 1408.28, "text": " we've we've now trained on this particular netlist this was this was our" }, { "start": 1408.28, "end": 1415.64, "text": " problem and we've solved that we have a great solution can we now when we get a" }, { "start": 1415.64, "end": 1420.84, "text": " netlist another netlist so here is netlist 2 right it's maybe a bit" }, { "start": 1420.84, "end": 1427.56, "text": " different so this one is more longer and this one is here and so on what if so we" }, { "start": 1427.56, "end": 1432.88, "text": " would have to start again from scratch a training reinforcement learning" }, { "start": 1432.88, "end": 1438.2, "text": " agent on the netlist too so maybe a RL agent trained on chess if we now wanted" }, { "start": 1438.2, "end": 1444, "text": " to play go you know we need to start over again but they try to just" }, { "start": 1444, "end": 1450.1000000000001, "text": " transfer this to the new one and astonishingly enough if you train the" }, { "start": 1450.1000000000001, "end": 1456.0400000000002, "text": " same RL agent not only on one netlist but on a set of netlists and the biggest" }, { "start": 1456.0400000000002, "end": 1462.0400000000002, "text": " set they have is 20 so their data set size is 20 imagine how small this is" }, { "start": 1462.04, "end": 1467.8799999999999, "text": " compared to supervised learning but maybe think of this like you train on" }, { "start": 1467.8799999999999, "end": 1474.44, "text": " 20 Atari games and then it will play the 21st one much better than if you started" }, { "start": 1474.44, "end": 1481.24, "text": " from scratch interestingly though even zero shot embeddings tend to be pretty" }, { "start": 1481.24, "end": 1486.28, "text": " good so they don't optimize for the new thing at all and it's already better you" }, { "start": 1486.28, "end": 1493.68, "text": " can see that here so if you train a policy from scratch then you this here" }, { "start": 1493.68, "end": 1501.8799999999999, "text": " then it takes a long time but if you fine-tune a pre-trained policy it's much" }, { "start": 1501.8799999999999, "end": 1509.24, "text": " shorter and interestingly enough at the beginning it is already better than the" }, { "start": 1509.24, "end": 1514.44, "text": " policy from scratch that means the knowledge from one chip transfers over" }, { "start": 1514.44, "end": 1518.76, "text": " to the other chip so the problems are sufficiently close and that basically" }, { "start": 1518.76, "end": 1524.68, "text": " means that if we now want to design a new AI chip not only are we better" }, { "start": 1524.68, "end": 1530.8400000000001, "text": " because of RL we're also faster because we can transfer learn and they show here" }, { "start": 1530.8400000000001, "end": 1536.0800000000002, "text": " that this effect basically appears when you have a large enough data set and" }, { "start": 1536.0800000000002, "end": 1541.8, "text": " again large here is just 20 blocks here you see one of these placements on the" }, { "start": 1541.8, "end": 1545.72, "text": " left the zero shot placement on the right and fine-tuned on that particular" }, { "start": 1545.72, "end": 1550.68, "text": " architecture obviously me being an expert in chip placement is it clearly" }, { "start": 1550.68, "end": 1559.12, "text": " obvious that both are extremely good and yes though actually more funny I find" }, { "start": 1559.12, "end": 1565.8, "text": " this one where they compare human experts to what their approach is and it" }, { "start": 1565.8, "end": 1570.24, "text": " says the figures are intentionally blurred as the designs are provided like" }, { "start": 1570.24, "end": 1574.8, "text": " why do you put them that clearly I can't even couldn't even judge if they're" }, { "start": 1574.8, "end": 1582.52, "text": " super crisp I yeah all right I guess it's their trade secret so they compare" }, { "start": 1582.52, "end": 1586.8, "text": " this with the standard algorithms for these things and not only are they" }, { "start": 1586.8, "end": 1595.84, "text": " faster they are they also better on the metrics yeah overall as I said I find" }, { "start": 1595.84, "end": 1600.24, "text": " this to be a pretty cool work that pulls in a lot of things from a lot of" }, { "start": 1600.24, "end": 1605.8799999999999, "text": " different fields at one point they say we propose a novel graph convolutional" }, { "start": 1605.8799999999999, "end": 1611.1599999999999, "text": " architecture I'm not sure that it is novel maybe it's novel for this problem" }, { "start": 1611.1599999999999, "end": 1614.6399999999999, "text": " but I'm pretty sure graph convolutional networks and things like this have been" }, { "start": 1614.6399999999999, "end": 1620.04, "text": " around for a while but again it pulls together things from many different" }, { "start": 1620.04, "end": 1627.92, "text": " fields and applies them very well very well engineered paper and a step towards" }, { "start": 1627.92, "end": 1636.28, "text": " the singularity as now AI can design AI accelerators how amazing yeah humanity" }, { "start": 1636.28, "end": 1639.52, "text": " is doomed all right I invite you to check out this paper if you're still" }, { "start": 1639.52, "end": 1645.52, "text": " here please subscribe leave a like and a comment and I'll see you next time bye" }, { "start": 1645.52, "end": 1650.6399999999999, "text": " bye" } ]
wTIPGoHLw_8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
I talk to the new Facebook Blender Chatbot
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "nlp", "chatbot", "dialogue", "persona", "vegan", "turing test", "natural language processing", "transformer", "generator", "context" ]
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 chat bot 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 chat bot 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 chat bot. Of course, it takes a large scale of training data and model, but also they discuss things like unlikelihood training, sampling and the need for a minimum decoding length to not be boring. And things like sub sequence 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 chat bot 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 manner. So this is the subtask is called wizards of Wikipedia, where you kind of 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 is the kind of interweaving of all those skills. And that's what this model is trained for. So we're gonna try it out. This is all available on the parlay platform of for 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's 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 some something to say here, literally the first time I interacted with this model, I thought, okay, let's put it to the Turing test. The Turing test being a 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. The AI doesn't see yours. All right, so I this this is what it says your persona, I love candy, your persona, I have a crush on my co worker. And me, I just didn't really know what you're doing. I just typed Oh, really? And the first thing first thing the 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, Turing 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 I'm just trying to get it to 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 lookup, it would be much more factual or something like this. But it's trying to kind of give us a fact. So we're kind of done with the boring stuff. You can 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 done. 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 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 communists. 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 is also has been trained on data that where the humans were explicitly instructed, for example, not to use toxic language and things like this. So I would say there's a big positivity bias and also the empathy task probably reinforces this even more. I would like to see a socialist revolution in the United States. I know it will never happen, but a man can dream. 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, really, 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, "end": 1.92, "text": " Yes, I am a vegan." }, { "start": 1.92, "end": 4.36, "text": " I don't eat any animal products." }, { "start": 4.36, "end": 5.36, "text": " Hi there." }, { "start": 5.36, "end": 11.36, "text": " Today, we're going to talk to a transformer and specifically to the new chat bot blender" }, { "start": 11.36, "end": 13.92, "text": " that Facebook has just released." }, { "start": 13.92, "end": 17.12, "text": " Everything is open source, so we can try it out live." }, { "start": 17.12, "end": 22.06, "text": " Now, along with the code, they've released this paper here called recipes for building" }, { "start": 22.06, "end": 27, "text": " an open domain chat bot by Facebook AI research." }, { "start": 27, "end": 33.26, "text": " And the paper itself is just more of an engineering manual rather than some kind of new model" }, { "start": 33.26, "end": 34.26, "text": " or new technique." }, { "start": 34.26, "end": 38.76, "text": " They just kind of discuss what it takes to build a good chat bot." }, { "start": 38.76, "end": 43.34, "text": " Of course, it takes a large scale of training data and model, but also they discuss things" }, { "start": 43.34, "end": 49.8, "text": " like unlikelihood training, sampling and the need for a minimum decoding length to not" }, { "start": 49.8, "end": 51.480000000000004, "text": " be boring." }, { "start": 51.480000000000004, "end": 56.16, "text": " And things like sub sequence blocking for keeping the model from repeating itself." }, { "start": 56.16, "end": 58.48, "text": " So we won't go too much into this." }, { "start": 58.48, "end": 60.059999999999995, "text": " I invite you to read the paper." }, { "start": 60.059999999999995, "end": 65.16, "text": " It's very informative if you want to build something like this, but it's not technically," }, { "start": 65.16, "end": 69.1, "text": " I think, anything super novel in there." }, { "start": 69.1, "end": 75.28, "text": " The task here is basically to build a chat bot that can maintain a dialogue." }, { "start": 75.28, "end": 81.92, "text": " And it is pre trained on a big Reddit corpus and then fine tuned on a multi objective task." }, { "start": 81.92, "end": 85.24, "text": " And the task is called the blended skill task." }, { "start": 85.24, "end": 89.67999999999999, "text": " And basically, you need to do three things in the blended skill task." }, { "start": 89.67999999999999, "end": 95.52, "text": " First of all, you need to kind of maintain a consistent persona across the dialogue." }, { "start": 95.52, "end": 99.75999999999999, "text": " Second of all, you need to have empathy for your partner." }, { "start": 99.75999999999999, "end": 106.47999999999999, "text": " So there's some kind of insight into how the other person is feeling during the conversation." }, { "start": 106.47999999999999, "end": 114.32, "text": " And third, you need to be able to discuss some factual topic in a factually correct" }, { "start": 114.32, "end": 115.32, "text": " manner." }, { "start": 115.32, "end": 120.24, "text": " So this is the subtask is called wizards of Wikipedia, where you kind of discuss a given" }, { "start": 120.24, "end": 122.55999999999999, "text": " Wikipedia page in dialogue." }, { "start": 122.55999999999999, "end": 129.64, "text": " So the technique called skill blending, or this blended skill task that also comes from" }, { "start": 129.64, "end": 136.72, "text": " a different paper is is the kind of interweaving of all those skills." }, { "start": 136.72, "end": 140.18, "text": " And that's what this model is trained for." }, { "start": 140.18, "end": 142.14, "text": " So we're gonna try it out." }, { "start": 142.14, "end": 152.27999999999997, "text": " This is all available on the parlay platform of for for researching dialogue frameworks." }, { "start": 152.27999999999997, "end": 155.83999999999997, "text": " I believe the platform itself is also by Facebook." }, { "start": 155.83999999999997, "end": 159.89999999999998, "text": " And they've released their model code and pre trained weights." }, { "start": 159.89999999999998, "end": 166.88, "text": " The pre trained weights are 17 gigabytes compressed, there's 9 billion parameter transformer." }, { "start": 166.88, "end": 170.72, "text": " So this is going to take a while to do even a single forward pass." }, { "start": 170.72, "end": 176.96, "text": " If I cut the video, it's just because I don't want you to have to look 20 seconds at an" }, { "start": 176.96, "end": 180.24, "text": " empty screen while the model is thinking about what it says." }, { "start": 180.24, "end": 187.6, "text": " Now I have some something to say here, literally the first time I interacted with this model," }, { "start": 187.6, "end": 189.64, "text": " I thought, okay, let's put it to the Turing test." }, { "start": 189.64, "end": 194.72, "text": " The Turing test being a can I differentiate this from a real human?" }, { "start": 194.72, "end": 198.96, "text": " And at the beginning, you always get this persona, right?" }, { "start": 198.96, "end": 205.64000000000001, "text": " So you get a persona, and the AI gets a persona, and you don't see the persona of the AI until" }, { "start": 205.64000000000001, "end": 211.96, "text": " the end, you can set that, but you don't generally see the persona of the AI until the very end." }, { "start": 211.96, "end": 216.12, "text": " So and you can choose to stick to yours or not." }, { "start": 216.12, "end": 217.56, "text": " The AI doesn't see yours." }, { "start": 217.56, "end": 222.72, "text": " All right, so I this this is what it says your persona, I love candy, your persona," }, { "start": 222.72, "end": 225.88, "text": " I have a crush on my co worker." }, { "start": 225.88, "end": 228.04000000000002, "text": " And me, I just didn't really know what you're doing." }, { "start": 228.04, "end": 230.04, "text": " I just typed Oh, really?" }, { "start": 230.04, "end": 235.68, "text": " And the first thing first thing the AI says to me is, yes, I am a vegan." }, { "start": 235.68, "end": 238.56, "text": " I don't eat any animal products." }, { "start": 238.56, "end": 242.04, "text": " Do you like country music?" }, { "start": 242.04, "end": 244.48, "text": " Like a real vegan." }, { "start": 244.48, "end": 247.51999999999998, "text": " This is indistinguishable from a human." }, { "start": 247.51999999999998, "end": 250.68, "text": " At this point, Turing test already won." }, { "start": 250.68, "end": 255.34, "text": " So you see, there's also this kind of profanity filter in here." }, { "start": 255.34, "end": 256.48, "text": " But you can disable that." }, { "start": 256.48, "end": 263.96000000000004, "text": " So what we're going to play around with is a setting where you have to turn off the safety" }, { "start": 263.96000000000004, "end": 267.28000000000003, "text": " filter." }, { "start": 267.28000000000003, "end": 270.12, "text": " And so you can see you can turn that off." }, { "start": 270.12, "end": 276.36, "text": " And if you say include personas equals false, then there's no random persona given to the" }, { "start": 276.36, "end": 281.28000000000003, "text": " model, which means you can either just talk about general things, or you can feed your" }, { "start": 281.28000000000003, "end": 282.28000000000003, "text": " own persona." }, { "start": 282.28, "end": 287.84, "text": " All right, it took a while to load these weights, but we're ready to go." }, { "start": 287.84, "end": 290.71999999999997, "text": " So we have disabled personas right now." }, { "start": 290.71999999999997, "end": 296.55999999999995, "text": " And sometimes there is a topic that the conversation should be about, which is not right now." }, { "start": 296.55999999999995, "end": 298.15999999999997, "text": " So we can just type Hello." }, { "start": 298.15999999999997, "end": 299.15999999999997, "text": " Hi there." }, { "start": 299.15999999999997, "end": 301.15999999999997, "text": " How are you this evening?" }, { "start": 301.15999999999997, "end": 304.09999999999997, "text": " I just got home from a long day at work." }, { "start": 304.09999999999997, "end": 309.88, "text": " So this is unconditional right now." }, { "start": 309.88, "end": 314.2, "text": " What do you do for work?" }, { "start": 314.2, "end": 315.84, "text": " I work in a call center." }, { "start": 315.84, "end": 317.84, "text": " It can be very stressful at times." }, { "start": 317.84, "end": 321.2, "text": " How about you?" }, { "start": 321.2, "end": 329.88, "text": " I work as a call center supervisor." }, { "start": 329.88, "end": 333.36, "text": " What do you think of that?" }, { "start": 333.36, "end": 335.06, "text": " I think that's a great job." }, { "start": 335.06, "end": 340.04, "text": " You must have a lot of experience to be able to do that." }, { "start": 340.04, "end": 341.52, "text": " Indeed." }, { "start": 341.52, "end": 348.76, "text": " Do you have any hobbies?" }, { "start": 348.76, "end": 350.28000000000003, "text": " I like to play video games." }, { "start": 350.28000000000003, "end": 352.8, "text": " I'm a big fan of the Fallout series." }, { "start": 352.8, "end": 354.72, "text": " What about yourself?" }, { "start": 354.72, "end": 365.76000000000005, "text": " How many games did fall out produce?" }, { "start": 365.76000000000005, "end": 372.08000000000004, "text": " I should probably phrase that as how many games are in the Fallout series, but I'm just" }, { "start": 372.08000000000004, "end": 377.56, "text": " trying to get it to to tell me something factual so you can kind of see that it has these sort" }, { "start": 377.56, "end": 381.08000000000004, "text": " of different modes, but they blend in fairly well." }, { "start": 381.08, "end": 386.84, "text": " I'm not sure how many games it produced, but I know it's been around since 1997." }, { "start": 386.84, "end": 388.88, "text": " So this is pretty good, right?" }, { "start": 388.88, "end": 391.64, "text": " This is this is now true conversation." }, { "start": 391.64, "end": 396.74, "text": " If it were just like a lookup, it would be much more factual or something like this." }, { "start": 396.74, "end": 399.53999999999996, "text": " But it's trying to kind of give us a fact." }, { "start": 399.53999999999996, "end": 402.96, "text": " So we're kind of done with the boring stuff." }, { "start": 402.96, "end": 408.56, "text": " You can go on talking to it and you'll see it is a pretty, pretty realistic chatbot." }, { "start": 408.56, "end": 411.6, "text": " But now we'll get into the personas." }, { "start": 411.6, "end": 415.4, "text": " So anytime you end an episode, you type done." }, { "start": 415.4, "end": 422.96, "text": " And that it says it's preparing a new chat, we can say your persona, colon, and then you" }, { "start": 422.96, "end": 424.88, "text": " can type something." }, { "start": 424.88, "end": 433.44, "text": " For example, I am a vegan like the one before, or I love protein." }, { "start": 433.44, "end": 438.56, "text": " It says protein is the most important macronutrient for bodybuilders and athletes." }, { "start": 438.56, "end": 442.24, "text": " So that's the start of the conversation." }, { "start": 442.24, "end": 445.84, "text": " What do you love?" }, { "start": 445.84, "end": 451.92, "text": " I love the taste of chicken, beef, pork, seafood, and dairy products." }, { "start": 451.92, "end": 456.56, "text": " I wonder what those have in common." }, { "start": 456.56, "end": 463.32, "text": " What do you do in your spare time?" }, { "start": 463.32, "end": 466.28, "text": " I like to go to the gym and lift weights." }, { "start": 466.28, "end": 469.59999999999997, "text": " I also like to play video games." }, { "start": 469.59999999999997, "end": 474.52, "text": " Ladies and gentlemen, I present the transformer is a gym bro." }, { "start": 474.52, "end": 480.96, "text": " All right, so you can play around with that a bit." }, { "start": 480.96, "end": 484.68, "text": " So let's say your persona." }, { "start": 484.68, "end": 493.03999999999996, "text": " I want to seize the means of production." }, { "start": 493.04, "end": 498.92, "text": " I am a communist and I want to overthrow the bourgeoisie." }, { "start": 498.92, "end": 503.44, "text": " What do you think of Karl Marx?" }, { "start": 503.44, "end": 510.76, "text": " I don't know much about him, but I do know he was a German philosopher." }, { "start": 510.76, "end": 514.96, "text": " Do you like capitalism?" }, { "start": 514.96, "end": 519.6800000000001, "text": " Yes, I do like capitalism." }, { "start": 519.68, "end": 527.1999999999999, "text": " I think it is the best economic system we have so far." }, { "start": 527.1999999999999, "end": 528.1999999999999, "text": " Capitalism wins again." }, { "start": 528.1999999999999, "end": 529.1999999999999, "text": " Checkmate." }, { "start": 529.1999999999999, "end": 535.4399999999999, "text": " I did try this before and it did turn out differently." }, { "start": 535.4399999999999, "end": 537.68, "text": " I was talking to real communists." }, { "start": 537.68, "end": 540.2399999999999, "text": " Let's try some more." }, { "start": 540.2399999999999, "end": 542.8, "text": " What do you want?" }, { "start": 542.8, "end": 549.3599999999999, "text": " I have to say, if you phrase things positively with this chatbot, it's very likely the chatbot" }, { "start": 549.36, "end": 555.96, "text": " agrees with you because it is also has been trained on data that where the humans were" }, { "start": 555.96, "end": 561.76, "text": " explicitly instructed, for example, not to use toxic language and things like this." }, { "start": 561.76, "end": 569.2, "text": " So I would say there's a big positivity bias and also the empathy task probably reinforces" }, { "start": 569.2, "end": 570.6800000000001, "text": " this even more." }, { "start": 570.6800000000001, "end": 573.9200000000001, "text": " I would like to see a socialist revolution in the United States." }, { "start": 573.9200000000001, "end": 578.32, "text": " I know it will never happen, but a man can dream." }, { "start": 578.32, "end": 584.72, "text": " So we've determined the gender of the socialist transformer generator." }, { "start": 584.72, "end": 591.2800000000001, "text": " What would need to happen for that?" }, { "start": 591.2800000000001, "end": 597, "text": " I'm not sure, but it would take a lot of people to get on board with it." }, { "start": 597, "end": 598.88, "text": " Correct." }, { "start": 598.88, "end": 605.5600000000001, "text": " What would the people need to do?" }, { "start": 605.56, "end": 612.4799999999999, "text": " Well, the people would have to overthrow the bourgeoisie and establish a classless, moneyless" }, { "start": 612.4799999999999, "end": 614.8, "text": " society." }, { "start": 614.8, "end": 621.76, "text": " So as you can see, really, the I like capitalism was a positivity bias." }, { "start": 621.76, "end": 625.92, "text": " It is fairly consistent in its persona here." }, { "start": 625.92, "end": 631.3599999999999, "text": " And it also is factually very accurate in the topic you're talking about." }, { "start": 631.36, "end": 635.6800000000001, "text": " So big props to Mr. Communist here." }, { "start": 635.6800000000001, "end": 645.24, "text": " What is the best method to allocate scarce resources?" }, { "start": 645.24, "end": 652.28, "text": " I don't know, but I do know that capitalism is not the best way to do it." }, { "start": 652.28, "end": 655.8000000000001, "text": " Like a true communist, no solutions, just complaints." }, { "start": 655.8000000000001, "end": 657.08, "text": " All right." }, { "start": 657.08, "end": 660.24, "text": " That was it for us talking to the transformer." }, { "start": 660.24, "end": 665.16, "text": " It still has its limitations, but it is fun if you are able to definitely try it out." }, { "start": 665.16, "end": 666.64, "text": " It takes a bit of patience." }, { "start": 666.64, "end": 672.64, "text": " If you like this video, please subscribe, tell your friends and leave a comment." }, { "start": 672.64, "end": 674.64, "text": " All right, I'll see you next time." }, { "start": 674.64, "end": 693.68, "text": " Bye bye." } ]
1aO-uHXbzmQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Jukebox: A Generative Model for Music (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "arxiv", "explained", "neural networks", "ai", "artificial intelligence", "paper", "music", "vae", "vq-vae", "latent codes", "quantization", "sound", "lyrics", "sinatra", "kanye", "transformer", "openai" ]
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 OpenAI jukebox. 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 Jukebox, a generative model for music, and it's by Profola Darival, Heiwo Jun, Christine Pine, Jongwoo Kim, Alec Radford, and Ilya Sutskever of OpenAI. 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 VQVAE models. So these models, 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 classic autoencoder I would here have a decoder and then I train that decoder to match 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 Gaussians. So in the easiest case, 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 giving us a vector that describes an entire multivariate 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 VQVAE and that's 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 called H. So it maps it to a vector called H. Now here is where it gets different. We do have a so called codebook here. So a codebook is just a list of vectors. This is the codebook and these are here called E. So what we'll do is we'll simply look for H which one's the closest neighbor in the codebook that we have of hidden vectors and we'll map it to that and say this here is the closest neighbor. So we'll basically quantize the hidden representation to these codes. So we end up only with vectors that are these codes. And now instead of saving the vector H, first of all we get a super compressed representation because if these are like 16 codebook vectors we can just simply enumerate them. 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 code vectors. Now of course everything is trained here. So the encoder is trained and the codebooks 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 their loss for these VQVAEs 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 codebook vector that belongs to the hidden representation of X. So this is your standard reconstruction loss. The next part of the loss is this codebook loss. Now the codebook loss is for training these codebook vectors. So it basically pulls the codebook vector closer to the actual hidden representation. So that is where you train these. This here is a stop gradient. So basically it just means that you want your codebook vectors to be better representing of the data that you feed in because otherwise it would be useless codebook vectors. And the third part of their loss is this commit loss right here. And that is exactly the opposite. Now you put the stop gradient on the codebook vector and you simply want to pull the hidden representation closer to the codebook vector such that, imagine the encoder must learn to approximately hit one of these codebook vectors. Otherwise it cannot really learn something meaningfully. It must learn to deal with the codebook vectors that are there and to approximately map the input into the vicinity of one of the codebook 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 codebook vectors to represent the data and you also train the encoder to make good use of the codebook vectors. Basically now that I think about it I am pretty sure in the reconstruction loss you might only train the decoder because you do have this quantization step in between in this thing here. So technically you could not back propagate through that. So that is how you train the individual parts of a VQVAE and we will see how they use it in order to produce music. Alright, 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 autoencoder architecture. That is why it is an autoencoder. 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 VQVAEs here in the middle but you have them at different scales. So you will have three of those here. There is a coarse scale one, middle scale one and a high frequency one. So three VQVAEs right here. And you train each one of them separately. And the difference between them is that because this is a continuous signal you cannot just encode a continuous signal because it is an audio waveform. 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 codebook. And the size here, the precise size of how you go through the audio, that is different between these different scales. So in this scale right here you go through the audio in very small steps. This as you can imagine gives you the best reconstruction. So this is the audio. The audio is like this. 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 codebook here, right? You have your codebook. 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. You take the second place and you might decide, no, that's this one. So you put this one into the second place. And the third one you might decide, ah, no, that also is closest to the first codebook vector. So you again put the first codebook vector into that slot. Now 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, ah, probably this isn't the exact same note as here, but it might decide, you know, that the chord played will repeat or something like this. So there's this vector quantization step and the codebook look up. Sorry, yeah, this minimizes which vector of the codebook is closest and the codebook look up, I think we'll just replace then the code, this vector with the actual codebook things. And so there's this slight difference here. So Z here, as you can see, is the argmin K. So the argument that is the actual number K, which codebook vector is the closest. And then this EZT will be the actual vectors. So this here is actually what I described right here. But this is, I think, a detail. And 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 coarse grained one, it can learn things about longer 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 basically ignore the top two and only go over via the coarse grained ones. So that's why they completely separate these at this stage of training. Right, so we have trained three different VAEs 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, right? I've said before, this is a very compressed representation of your data. Why can you do that? Sorry, 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. 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 could learn, right? So we're trying, we're going to try to learn a prior distribution over the distribution of codebook vectors. And that is naturally going to be a joint distribution between the top, middle and bottom VQVAEs. And we can decompose this into the following thing simply by applying the standard probabilistic algebra transformation. And we can then, they say, we train separate models, sorry about that, we train separate models for the top level prior, the 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 here. You'd simply use your data, compress it to the hidden space, and then train a neural network to produce that distribution. And you can do this in any number of ways. You can use classic VAEs, you can use, sorry, you can use here, they say we use transformers 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. But they see, you see, they model this distribution with these scalable transformers. All right, 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 that, this part here was just used for training. We can, we 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 could 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 coarse 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 we'll use, what we'll 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 coarse, 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 with each other. All right, so you can connect this to this. It's basically like conditioning the model that produces the 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, 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, it appears to be pretty important because you kind of, first of all, want some variety. And then second of all, you sort of want to control what music is produced. And you don't just want to train this model for one 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're 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 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 produced during training, right? You get these hidden representations, 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 listen. 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 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 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. 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 a lot. So 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? And linear because you get the lyrics from some lyrics website, this blah, blah, blah. 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 token position and lyrics token position. Here you see the the system learns that for example, if it has this music token 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 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, right. And the fact that it learns to linearly attend to the tokens is a confirmation that it actually includes that information into the coding. And that is a pretty gives you pretty much better results. So we can maybe go to classic pop. So this are unseen lyrics. So the model has never seen these lyrics, right? 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, we conditioned on lyrics seen 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 Eminem's lose yourself. I'm grooving. I don't know what you're thinking, but this is cool. And they can also, as we said, do these completions where they start with part of a song. And just I have to do this. I have to do the hi there. So the first version of this video was copystriked because what you would hear would be the original never going to give you up like 10 seconds of it, and then followed by what the model continues with. So as a substitute, you're now going to have to listen to me. I hope that suffices. 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 to different things because it doesn't it doesn't it doesn't just continue. So this is great. So 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 autoregressive property anymore. And then it doesn't find the proper place to attend anymore. And just, again, comes up with sort of babbles, 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, rerenditions, and so on. This all is very cool. They have their training setup 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": 0, "end": 25.28, "text": " Alright, so what you're hearing is the OpenAI jukebox." }, { "start": 25.28, "end": 33.2, "text": " This paper came out and it is a surprisingly good quality generative model for music," }, { "start": 33.2, "end": 39.480000000000004, "text": " including lyrics, so including singing, which I believe is pretty novel." }, { "start": 39.480000000000004, "end": 45.120000000000005, "text": " And the fact that it works so well and has musical consistency throughout entire songs" }, { "start": 45.120000000000005, "end": 49.92, "text": " is something that is very, very novel and cool." }, { "start": 49.92, "end": 55.92, "text": " Alright, so we're looking at the paper, it's called Jukebox, a generative model for music," }, { "start": 55.92, "end": 65.04, "text": " and it's by Profola Darival, Heiwo Jun, Christine Pine, Jongwoo Kim, Alec Radford, and Ilya" }, { "start": 65.04, "end": 69.12, "text": " Sutskever of OpenAI." }, { "start": 69.12, "end": 77.76, "text": " So the model here is not very novel, but I think the way they set it up makes a lot of" }, { "start": 77.76, "end": 83.84, "text": " sense and we'll quickly go through it and look at what comes out of this." }, { "start": 83.84, "end": 93.68, "text": " This is not a very technical paper, but I think it's well written and their main thing" }, { "start": 93.68, "end": 96.88000000000001, "text": " is these VQVAE models." }, { "start": 96.88000000000001, "end": 101.60000000000001, "text": " So these models, you might know what a variational autoencoder is." }, { "start": 101.6, "end": 107.96, "text": " So in a variational autoencoder I have an input, let's say an image, here of our typical" }, { "start": 107.96, "end": 115.47999999999999, "text": " cat, and I put it through what is called an encoder in order to get a hidden representation." }, { "start": 115.47999999999999, "end": 125.19999999999999, "text": " Now this hidden representation, usually called something like Z or H, is then in a classic" }, { "start": 125.2, "end": 134.36, "text": " autoencoder I would here have a decoder and then I train that decoder to match that original" }, { "start": 134.36, "end": 136.4, "text": " picture as closely as possible." }, { "start": 136.4, "end": 142.04, "text": " So I train these two neural networks, the encoder and the decoder, to just basically" }, { "start": 142.04, "end": 148.68, "text": " compress to this representation and then reproduce again the original image." }, { "start": 148.68, "end": 152.76, "text": " And thereby I think I can learn a good hidden representation." }, { "start": 152.76, "end": 159.35999999999999, "text": " Now in a variational autoencoder what happens is there is an in-between step, namely this" }, { "start": 159.35999999999999, "end": 166.04, "text": " Z representation here is not directly fed to the decoder, but this representation is" }, { "start": 166.04, "end": 170.32, "text": " actually used to parameterize Gaussians." }, { "start": 170.32, "end": 178.72, "text": " So in the easiest case, let's say we have six dimensions here in the hidden representation," }, { "start": 178.72, "end": 184.64, "text": " the first two are used to parameterize the first Gaussian, one is going to be the mean" }, { "start": 184.64, "end": 190.04, "text": " and one is going to be the standard deviation of that Gaussian, and the second two are going" }, { "start": 190.04, "end": 193.88, "text": " to parameterize the second Gaussian and the third are going to parameterize the third" }, { "start": 193.88, "end": 194.88, "text": " one." }, { "start": 194.88, "end": 200, "text": " So we have now three Gaussians and then from those three Gaussian distributions we're going" }, { "start": 200, "end": 208.32, "text": " to sample a three-dimensional vector and then we're going to feed that three-dimensional" }, { "start": 208.32, "end": 210.2, "text": " vector to the decoder." }, { "start": 210.2, "end": 216.28, "text": " So every input image in essence is giving us a distribution in the latent space and" }, { "start": 216.28, "end": 222.04, "text": " not just a single vector, it's just giving us a vector that describes an entire multivariate" }, { "start": 222.04, "end": 224.51999999999998, "text": " Gaussian distribution." }, { "start": 224.51999999999998, "end": 233.6, "text": " And then we train the decoder basically to reconstruct the encoder given that distribution." }, { "start": 233.6, "end": 240.07999999999998, "text": " So the variational autoencoder has improved over the classic autoencoder because it tends" }, { "start": 240.07999999999998, "end": 245.64, "text": " to circumvent some of the shortcomings, but still variational autoencoders have their" }, { "start": 245.64, "end": 250.7, "text": " problems and in terms of generative model for images, people as you know have gone to" }, { "start": 250.7, "end": 253.66, "text": " things like GANs and so on." }, { "start": 253.66, "end": 261.6, "text": " But here this new thing is called the VQVAE and that's because I believe this stands for" }, { "start": 261.6, "end": 264, "text": " vector quantization." }, { "start": 264, "end": 271.70000000000005, "text": " Not entirely sure honestly, but so what it does is it takes the input right here and" }, { "start": 271.70000000000005, "end": 275.8, "text": " again it maps it to a latent code." }, { "start": 275.8, "end": 284.24, "text": " And these latent code I believe are called H. So it maps it to a vector called H. Now" }, { "start": 284.24, "end": 286.14000000000004, "text": " here is where it gets different." }, { "start": 286.14, "end": 291.82, "text": " We do have a so called codebook here." }, { "start": 291.82, "end": 294.59999999999997, "text": " So a codebook is just a list of vectors." }, { "start": 294.59999999999997, "end": 302.32, "text": " This is the codebook and these are here called E. So what we'll do is we'll simply look for" }, { "start": 302.32, "end": 307.56, "text": " H which one's the closest neighbor in the codebook that we have of hidden vectors and" }, { "start": 307.56, "end": 311.96, "text": " we'll map it to that and say this here is the closest neighbor." }, { "start": 311.96, "end": 318.76, "text": " So we'll basically quantize the hidden representation to these codes." }, { "start": 318.76, "end": 322.56, "text": " So we end up only with vectors that are these codes." }, { "start": 322.56, "end": 327.71999999999997, "text": " And now instead of saving the vector H, first of all we get a super compressed representation" }, { "start": 327.71999999999997, "end": 335.56, "text": " because if these are like 16 codebook vectors we can just simply enumerate them." }, { "start": 335.56, "end": 342.88, "text": " And then we can simply encode the image as one or a sequence of these indices here." }, { "start": 342.88, "end": 349.88, "text": " But second of all it tends to bring a more kind of a diversity and accuracy if we then" }, { "start": 349.88, "end": 354.28, "text": " decode from these code vectors." }, { "start": 354.28, "end": 355.9, "text": " Now of course everything is trained here." }, { "start": 355.9, "end": 363.08, "text": " So the encoder is trained and the codebooks themselves are also trained and the decoder" }, { "start": 363.08, "end": 369.03999999999996, "text": " is also trained to give you the maximum kind of benefit." }, { "start": 369.03999999999996, "end": 370.91999999999996, "text": " So this is what is described here." }, { "start": 370.91999999999996, "end": 377.2, "text": " What they have is first of all their loss for these VQVAEs and you'll see how they are" }, { "start": 377.2, "end": 380.64, "text": " using them to generate music in a second." }, { "start": 380.64, "end": 386, "text": " Their loss is part this reconstruction loss which you can see here." }, { "start": 386, "end": 390.12, "text": " This is the original image." }, { "start": 390.12, "end": 395.52, "text": " How far is it away from the decoded hidden quantized representation?" }, { "start": 395.52, "end": 402, "text": " This E here, this is the quantized codebook vector that belongs to the hidden representation" }, { "start": 402, "end": 403, "text": " of X." }, { "start": 403, "end": 406.56, "text": " So this is your standard reconstruction loss." }, { "start": 406.56, "end": 410.08, "text": " The next part of the loss is this codebook loss." }, { "start": 410.08, "end": 415.28000000000003, "text": " Now the codebook loss is for training these codebook vectors." }, { "start": 415.28, "end": 422.79999999999995, "text": " So it basically pulls the codebook vector closer to the actual hidden representation." }, { "start": 422.79999999999995, "end": 425.2, "text": " So that is where you train these." }, { "start": 425.2, "end": 427.35999999999996, "text": " This here is a stop gradient." }, { "start": 427.35999999999996, "end": 432.14, "text": " So basically it just means that you want your codebook vectors to be better representing" }, { "start": 432.14, "end": 438.35999999999996, "text": " of the data that you feed in because otherwise it would be useless codebook vectors." }, { "start": 438.35999999999996, "end": 442.94, "text": " And the third part of their loss is this commit loss right here." }, { "start": 442.94, "end": 444.4, "text": " And that is exactly the opposite." }, { "start": 444.4, "end": 450.4, "text": " Now you put the stop gradient on the codebook vector and you simply want to pull the hidden" }, { "start": 450.4, "end": 458.28, "text": " representation closer to the codebook vector such that, imagine the encoder must learn" }, { "start": 458.28, "end": 463.47999999999996, "text": " to approximately hit one of these codebook vectors." }, { "start": 463.47999999999996, "end": 468.41999999999996, "text": " Otherwise it cannot really learn something meaningfully." }, { "start": 468.41999999999996, "end": 473.15999999999997, "text": " It must learn to deal with the codebook vectors that are there and to approximately map the" }, { "start": 473.16, "end": 479.12, "text": " input into the vicinity of one of the codebook vectors." }, { "start": 479.12, "end": 481.64000000000004, "text": " Otherwise there is no information flowing." }, { "start": 481.64000000000004, "end": 483.48, "text": " So that is how you train things." }, { "start": 483.48, "end": 488.54, "text": " You train the encoder and the decoder to reconstruct." }, { "start": 488.54, "end": 494.92, "text": " You train the codebook vectors to represent the data and you also train the encoder to" }, { "start": 494.92, "end": 499, "text": " make good use of the codebook vectors." }, { "start": 499, "end": 505.26, "text": " Basically now that I think about it I am pretty sure in the reconstruction loss you might" }, { "start": 505.26, "end": 513.24, "text": " only train the decoder because you do have this quantization step in between in this" }, { "start": 513.24, "end": 514.28, "text": " thing here." }, { "start": 514.28, "end": 519.64, "text": " So technically you could not back propagate through that." }, { "start": 519.64, "end": 526.1, "text": " So that is how you train the individual parts of a VQVAE and we will see how they use it" }, { "start": 526.1, "end": 528.12, "text": " in order to produce music." }, { "start": 528.12, "end": 536.68, "text": " Alright, so what they do is they start off with a sample of music and they send it through" }, { "start": 536.68, "end": 544.76, "text": " this thing, through this architecture and at the end they are trying to reconstruct" }, { "start": 544.76, "end": 546.5600000000001, "text": " the same thing they had at the beginning." }, { "start": 546.5600000000001, "end": 550.84, "text": " So you see this overarching autoencoder architecture." }, { "start": 550.84, "end": 552.16, "text": " That is why it is an autoencoder." }, { "start": 552.16, "end": 557.5600000000001, "text": " You try to reconstruct your input and thereby you try to learn something about the data" }, { "start": 557.56, "end": 563.88, "text": " because a model that can compress and then uncompress all of your data has learned something" }, { "start": 563.88, "end": 566.2399999999999, "text": " useful about it." }, { "start": 566.2399999999999, "end": 572.3599999999999, "text": " Now you have these VQVAEs here in the middle but you have them at different scales." }, { "start": 572.3599999999999, "end": 576.5999999999999, "text": " So you will have three of those here." }, { "start": 576.5999999999999, "end": 581.64, "text": " There is a coarse scale one, middle scale one and a high frequency one." }, { "start": 581.64, "end": 586.2399999999999, "text": " So three VQVAEs right here." }, { "start": 586.24, "end": 590.6, "text": " And you train each one of them separately." }, { "start": 590.6, "end": 598.52, "text": " And the difference between them is that because this is a continuous signal you cannot just" }, { "start": 598.52, "end": 602.28, "text": " encode a continuous signal because it is an audio waveform." }, { "start": 602.28, "end": 607.5600000000001, "text": " What you have to do is you have to go through it in some sort of a stepwise fashion." }, { "start": 607.5600000000001, "end": 615.04, "text": " You have to divide it into individual pieces and encode each of those pieces as one hidden" }, { "start": 615.04, "end": 619.5999999999999, "text": " vector, or one element of the codebook." }, { "start": 619.5999999999999, "end": 626.3199999999999, "text": " And the size here, the precise size of how you go through the audio, that is different" }, { "start": 626.3199999999999, "end": 629.24, "text": " between these different scales." }, { "start": 629.24, "end": 637.3199999999999, "text": " So in this scale right here you go through the audio in very small steps." }, { "start": 637.3199999999999, "end": 640.8399999999999, "text": " This as you can imagine gives you the best reconstruction." }, { "start": 640.8399999999999, "end": 641.8399999999999, "text": " So this is the audio." }, { "start": 641.8399999999999, "end": 643.68, "text": " The audio is like this." }, { "start": 643.68, "end": 648.9599999999999, "text": " And you just take part of it, like from here to here, and you encode it into a single hidden" }, { "start": 648.9599999999999, "end": 651.9599999999999, "text": " vector, which is this brown thing here." }, { "start": 651.9599999999999, "end": 657.02, "text": " Then you take the next one, the next slice and you encode it and that will give you this" }, { "start": 657.02, "end": 659.16, "text": " blue thing here." }, { "start": 659.16, "end": 664.68, "text": " Then you run this sequence through the vector quantization step where each of those will" }, { "start": 664.68, "end": 665.68, "text": " be mapped." }, { "start": 665.68, "end": 667.3199999999999, "text": " So you have a codebook here, right?" }, { "start": 667.3199999999999, "end": 669.24, "text": " You have your codebook." }, { "start": 669.24, "end": 675.6, "text": " And you look up the first one and you decide, ah, this probably goes here to this code vector." }, { "start": 675.6, "end": 678.52, "text": " So you put that code vector into the first place." }, { "start": 678.52, "end": 682, "text": " You take the second place and you might decide, no, that's this one." }, { "start": 682, "end": 684.6, "text": " So you put this one into the second place." }, { "start": 684.6, "end": 689.36, "text": " And the third one you might decide, ah, no, that also is closest to the first codebook" }, { "start": 689.36, "end": 690.36, "text": " vector." }, { "start": 690.36, "end": 695.5600000000001, "text": " So you again put the first codebook vector into that slot." }, { "start": 695.56, "end": 702.16, "text": " Now that doesn't mean that it's the same music, but of course the decoder now is going to" }, { "start": 702.16, "end": 707.3599999999999, "text": " look at the entire sequence and can decide, ah, probably this isn't the exact same note" }, { "start": 707.3599999999999, "end": 714.2399999999999, "text": " as here, but it might decide, you know, that the chord played will repeat or something" }, { "start": 714.2399999999999, "end": 716.28, "text": " like this." }, { "start": 716.28, "end": 721.76, "text": " So there's this vector quantization step and the codebook look up." }, { "start": 721.76, "end": 729.16, "text": " Sorry, yeah, this minimizes which vector of the codebook is closest and the codebook look" }, { "start": 729.16, "end": 740.24, "text": " up, I think we'll just replace then the code, this vector with the actual codebook things." }, { "start": 740.24, "end": 742.28, "text": " And so there's this slight difference here." }, { "start": 742.28, "end": 746.6, "text": " So Z here, as you can see, is the argmin K." }, { "start": 746.6, "end": 752.52, "text": " So the argument that is the actual number K, which codebook vector is the closest." }, { "start": 752.52, "end": 757.24, "text": " And then this EZT will be the actual vectors." }, { "start": 757.24, "end": 764.08, "text": " So this here is actually what I described right here." }, { "start": 764.08, "end": 766.02, "text": " But this is, I think, a detail." }, { "start": 766.02, "end": 767.9200000000001, "text": " And you're going to do this at different scales." }, { "start": 767.9200000000001, "end": 773.32, "text": " Now you can imagine that the bottom one is going to give you the best, most faithful" }, { "start": 773.32, "end": 776.32, "text": " reconstruction when you decode it, right?" }, { "start": 776.32, "end": 782.72, "text": " But it is also going to learn about the kind of details in the music, the short term details." }, { "start": 782.72, "end": 788.7600000000001, "text": " Whereas this coarse grained one, it can learn things about longer range compositions." }, { "start": 788.7600000000001, "end": 795.84, "text": " It might not produce as correct of a reconstruction, but it can learn long range dependencies," }, { "start": 795.84, "end": 801.48, "text": " such as the structure of a song or the structure of a verse or something like this." }, { "start": 801.48, "end": 803.44, "text": " So these are independent of each other." }, { "start": 803.44, "end": 805.84, "text": " And they make an argument as to why." }, { "start": 805.84, "end": 810.1800000000001, "text": " So people have tried to kind of share these architectures, but have found that mainly" }, { "start": 810.1800000000001, "end": 818.46, "text": " the models will basically ignore the top two and only go over via the coarse grained ones." }, { "start": 818.46, "end": 823.88, "text": " So that's why they completely separate these at this stage of training." }, { "start": 823.88, "end": 829.6600000000001, "text": " Right, so we have trained three different VAEs at three different scales of music to" }, { "start": 829.6600000000001, "end": 833.22, "text": " always reconstruct the input." }, { "start": 833.22, "end": 834.5400000000001, "text": " What does that give us?" }, { "start": 834.54, "end": 842.36, "text": " That gives us a distribution right here." }, { "start": 842.36, "end": 849.06, "text": " That gives us a way to take a piece of music and map it to this hidden space, to this very" }, { "start": 849.06, "end": 854.16, "text": " compressed representation in this quantized world, right?" }, { "start": 854.16, "end": 860.52, "text": " I've said before, this is a very compressed representation of your data." }, { "start": 860.52, "end": 862.28, "text": " Why can you do that?" }, { "start": 862.28, "end": 864, "text": " Sorry, what's that useful for?" }, { "start": 864, "end": 868.62, "text": " What you can do now is you can try to sample in that hidden space." }, { "start": 868.62, "end": 873.16, "text": " So instead of sampling music, we have no clue of how to sample music unless we are given" }, { "start": 873.16, "end": 874.64, "text": " some music." }, { "start": 874.64, "end": 880.6, "text": " What we can do is we can say maybe this thing here, because it's compressed, it kind of..." }, { "start": 880.6, "end": 885.78, "text": " So if we just sample a waveform, it's very unlikely that it's music." }, { "start": 885.78, "end": 892.04, "text": " But if we sample these hidden things, you know, it's quite likely that if we feed it" }, { "start": 892.04, "end": 894.48, "text": " through the decoder, something will come out." }, { "start": 894.48, "end": 902.8, "text": " And even better, maybe our data set in this hidden space follows a kind of a simpler distribution," }, { "start": 902.8, "end": 905.56, "text": " one that we could learn, right?" }, { "start": 905.56, "end": 912.3199999999999, "text": " So we're trying, we're going to try to learn a prior distribution over the distribution" }, { "start": 912.3199999999999, "end": 916.0799999999999, "text": " of codebook vectors." }, { "start": 916.0799999999999, "end": 920.4399999999999, "text": " And that is naturally going to be a joint distribution between the top, middle and bottom" }, { "start": 920.44, "end": 923.36, "text": " VQVAEs." }, { "start": 923.36, "end": 931.9200000000001, "text": " And we can decompose this into the following thing simply by applying the standard probabilistic" }, { "start": 931.9200000000001, "end": 933.96, "text": " algebra transformation." }, { "start": 933.96, "end": 940.24, "text": " And we can then, they say, we train separate models, sorry about that, we train separate" }, { "start": 940.24, "end": 946.32, "text": " models for the top level prior, the top, the middle, and the bottom." }, { "start": 946.32, "end": 952.1800000000001, "text": " So what that means is basically, these are now neural networks." }, { "start": 952.1800000000001, "end": 956.6, "text": " If you read something like this in a paper like this, this is going to be a neural network" }, { "start": 956.6, "end": 964.2, "text": " that takes the right side as an input and produces the left side, right?" }, { "start": 964.2, "end": 971.8800000000001, "text": " So you start out with this one, this is a neural network that simply takes as an input," }, { "start": 971.88, "end": 977.24, "text": " sorry, I'm going to draw this neural network, takes as an input, maybe something like a" }, { "start": 977.24, "end": 981.2, "text": " Gaussian super prior, right?" }, { "start": 981.2, "end": 988.36, "text": " You sample from that and that will as an output give you this Z top." }, { "start": 988.36, "end": 994.32, "text": " Then the next neural network will take this as an input and will give you Z middle as" }, { "start": 994.32, "end": 995.32, "text": " an output." }, { "start": 995.32, "end": 1001.72, "text": " And then the final neural network will input the two of those and give you Z top." }, { "start": 1001.72, "end": 1009.76, "text": " And you can train these neural networks simply by kind of training a prior to produce this" }, { "start": 1009.76, "end": 1011.48, "text": " thing right here." }, { "start": 1011.48, "end": 1018.4, "text": " You'd simply use your data, compress it to the hidden space, and then train a neural" }, { "start": 1018.4, "end": 1021.32, "text": " network to produce that distribution." }, { "start": 1021.32, "end": 1023.44, "text": " And you can do this in any number of ways." }, { "start": 1023.44, "end": 1037.9, "text": " You can use classic VAEs, you can use, sorry, you can use here, they say we use transformers" }, { "start": 1037.9, "end": 1045.8400000000001, "text": " with sparse attention, as they are currently state of the art in autoregressive modeling." }, { "start": 1045.8400000000001, "end": 1050.88, "text": " And they say we propose a simplified version, which we call the scalable transformer that" }, { "start": 1050.88, "end": 1053.68, "text": " is easier to implement and scale." }, { "start": 1053.68, "end": 1058.48, "text": " But they see, you see, they model this distribution with these scalable transformers." }, { "start": 1058.48, "end": 1060.64, "text": " All right, so now what do we have?" }, { "start": 1060.64, "end": 1067.96, "text": " We have a way to sample these hidden vectors, right?" }, { "start": 1067.96, "end": 1071.6000000000001, "text": " So we don't need, we don't need this part anymore." }, { "start": 1071.6000000000001, "end": 1078.66, "text": " This part, sorry about that, this part here was just used for training." }, { "start": 1078.66, "end": 1083.0400000000002, "text": " We can, we now have our transformers." }, { "start": 1083.0400000000002, "end": 1088.2, "text": " They take nothing as an input or they take like a Gaussian as an input and they can directly" }, { "start": 1088.2, "end": 1090.8200000000002, "text": " output this hidden representation." }, { "start": 1090.8200000000002, "end": 1097.28, "text": " So we could technically sample from that and then just push it through this decoder of" }, { "start": 1097.28, "end": 1099.2, "text": " the VQVA." }, { "start": 1099.2, "end": 1103, "text": " But the question is, which of the three do we take?" }, { "start": 1103, "end": 1105.74, "text": " And wouldn't it be great if we can combine them?" }, { "start": 1105.74, "end": 1111.92, "text": " Because if we simply sample these, this higher scale one, we just get not very long range" }, { "start": 1111.92, "end": 1113.16, "text": " dependencies, right?" }, { "start": 1113.16, "end": 1114.92, "text": " Because that's what the VQVA learned." }, { "start": 1114.92, "end": 1121.72, "text": " If we just sample this one, then we just get a coarse music and we can sample all three," }, { "start": 1121.72, "end": 1125.72, "text": " but they will just give us three different tracks of music." }, { "start": 1125.72, "end": 1131.66, "text": " So we want to combine the three decoders into one somehow." }, { "start": 1131.66, "end": 1135.88, "text": " And that's, we do this through these up samplers." }, { "start": 1135.88, "end": 1141.52, "text": " So what we'll use, what we'll target actually is this bottom one." }, { "start": 1141.52, "end": 1146.16, "text": " We target this one because this one gives us the best quality music, right?" }, { "start": 1146.16, "end": 1150, "text": " Because it was trained with the shortest time scale." }, { "start": 1150, "end": 1154.72, "text": " We're going to try to take the other signals and influence it." }, { "start": 1154.72, "end": 1159.8200000000002, "text": " So we'll start with the top level prior, right?" }, { "start": 1159.82, "end": 1169.36, "text": " That will produce us, these transformers will give us a sequence, a sequence of tokens in" }, { "start": 1169.36, "end": 1173, "text": " the hidden space that is very coarse, as you can see here." }, { "start": 1173, "end": 1177, "text": " And then we'll feed that into a up sampler." }, { "start": 1177, "end": 1183.36, "text": " And these up samplers again are on the neural networks that can connect the different scales" }, { "start": 1183.36, "end": 1184.36, "text": " with each other." }, { "start": 1184.36, "end": 1189.52, "text": " All right, so you can connect this to this." }, { "start": 1189.52, "end": 1196.28, "text": " It's basically like conditioning the model that produces the sequence on this sequence" }, { "start": 1196.28, "end": 1198.72, "text": " right here." }, { "start": 1198.72, "end": 1203.8, "text": " And again, we use an up sampler to up sample this to the finest scale." }, { "start": 1203.8, "end": 1207.92, "text": " And that we feed in the bottom scale, and then we get our music." }, { "start": 1207.92, "end": 1213.46, "text": " Now throughout all of this, you have conditioning information here, which is a bit of an addition" }, { "start": 1213.46, "end": 1215.16, "text": " to the model." }, { "start": 1215.16, "end": 1223.8000000000002, "text": " So the conditioning information can be things like artist, genre, and timing." }, { "start": 1223.8000000000002, "end": 1230.3200000000002, "text": " And this is, it appears to be pretty important because you kind of, first of all, want some" }, { "start": 1230.3200000000002, "end": 1231.42, "text": " variety." }, { "start": 1231.42, "end": 1237.88, "text": " And then second of all, you sort of want to control what music is produced." }, { "start": 1237.88, "end": 1245.2, "text": " And you don't just want to train this model for one single artist, because you have much" }, { "start": 1245.2, "end": 1248.1200000000001, "text": " more data across all of music." }, { "start": 1248.1200000000001, "end": 1253.96, "text": " So this conditioning information is just included here via another neural network." }, { "start": 1253.96, "end": 1258.64, "text": " And you can find all the architectures for all of these models in the paper." }, { "start": 1258.64, "end": 1265.2800000000002, "text": " It's not particularly important, I believe, how exactly you include them, but the fact" }, { "start": 1265.28, "end": 1268.72, "text": " that you do." }, { "start": 1268.72, "end": 1273.3799999999999, "text": " The last thing is, what they do is they do this kind of windowed sampling." }, { "start": 1273.3799999999999, "end": 1280.6399999999999, "text": " So in order to produce music, you're going to have to produce these slices of music right" }, { "start": 1280.6399999999999, "end": 1281.6399999999999, "text": " here." }, { "start": 1281.6399999999999, "end": 1287.36, "text": " But you sort of have a maximum length here that your models can handle." }, { "start": 1287.36, "end": 1290.96, "text": " And this is usually not the length of a song." }, { "start": 1290.96, "end": 1292.76, "text": " You may know transformers and so on." }, { "start": 1292.76, "end": 1297.44, "text": " They usually have token limits of like 512 tokens." }, { "start": 1297.44, "end": 1299.68, "text": " In terms of audio, that's not that much." }, { "start": 1299.68, "end": 1307.56, "text": " So what you do is this windowed sampling, where you sample something, and then you condition" }, { "start": 1307.56, "end": 1312.6, "text": " basically on the first part, and then you just sample the next thing, and then you again" }, { "start": 1312.6, "end": 1318.44, "text": " condition on the first part, and then you just sample the next thing, the next few ones." }, { "start": 1318.44, "end": 1323.28, "text": " And that guarantees that each of the sampling steps is basically conditioned on what comes" }, { "start": 1323.28, "end": 1326.4, "text": " before, as you see up here." }, { "start": 1326.4, "end": 1333.24, "text": " So you would always sort of condition on a part, produce the next part." }, { "start": 1333.24, "end": 1336.88, "text": " All right." }, { "start": 1336.88, "end": 1341.38, "text": " And they say you can also basically condition on..." }, { "start": 1341.38, "end": 1346.92, "text": " So you can feed in, you don't have to sample the very first one, you can also feed in an" }, { "start": 1346.92, "end": 1350.1000000000001, "text": " existing song in order to prime the system." }, { "start": 1350.1000000000001, "end": 1355.74, "text": " So what you can do is if you have a beginning of a song, then you can let the system finish" }, { "start": 1355.74, "end": 1361.0800000000002, "text": " the song by simply taking the song, running it through the encoder that we produced during" }, { "start": 1361.0800000000002, "end": 1362.0800000000002, "text": " training, right?" }, { "start": 1362.0800000000002, "end": 1365.5600000000002, "text": " You get these hidden representations, so you don't actually have to sample them from your" }, { "start": 1365.5600000000002, "end": 1366.7, "text": " prior." }, { "start": 1366.7, "end": 1372.0800000000002, "text": " And then you run this generation process as if this came out of your prior instead of" }, { "start": 1372.0800000000002, "end": 1374.0800000000002, "text": " what you sampled." }, { "start": 1374.0800000000002, "end": 1376.04, "text": " Okay." }, { "start": 1376.04, "end": 1383.6, "text": " So let's have a look at how that sounds, or listen." }, { "start": 1383.6, "end": 1387.76, "text": " This is an explorer, they release many, many samples from this." }, { "start": 1387.76, "end": 1403.8799999999999, "text": " And the part here where we're going to listen is called no lyrics conditioning." }, { "start": 1403.88, "end": 1413.96, "text": " So as you can hear, this is already pretty good music and the genre is American folk." }, { "start": 1413.96, "end": 1417.96, "text": " The singer is Pete Seeger." }, { "start": 1417.96, "end": 1423.8400000000001, "text": " This already sounds very authentic, but you can hear that the lyrics are just kind of" }, { "start": 1423.8400000000001, "end": 1425.92, "text": " mumbly, right?" }, { "start": 1425.92, "end": 1433.16, "text": " And that's because the model is basically asked to come up with lyrics as pure audio" }, { "start": 1433.16, "end": 1434.48, "text": " waveforms." }, { "start": 1434.48, "end": 1438.5600000000002, "text": " And that results in some subpar lyrics." }, { "start": 1438.5600000000002, "end": 1442.44, "text": " Basically it just produces phonemes that sound like the singer." }, { "start": 1442.44, "end": 1444.44, "text": " It doesn't produce entire words." }, { "start": 1444.44, "end": 1449.88, "text": " And of course it also doesn't produce sentences that make any sort of sense." }, { "start": 1449.88, "end": 1455.3200000000002, "text": " And that's why they're building in an additional thing to do lyrics conditioning." }, { "start": 1455.3200000000002, "end": 1462, "text": " So with lyrics conditioning, the idea is that in the conditioning information, you also" }, { "start": 1462, "end": 1463.28, "text": " add lyrics." }, { "start": 1463.28, "end": 1466.28, "text": " So here is plus text." }, { "start": 1466.28, "end": 1474.96, "text": " So you add text, and then the model is basically can also look at the text." }, { "start": 1474.96, "end": 1483.08, "text": " Now you never, you still, you still, so even before we had music with lyrics and the decoder" }, { "start": 1483.08, "end": 1486.52, "text": " was always asked to reconstruct that." }, { "start": 1486.52, "end": 1489.06, "text": " And so none of that changes." }, { "start": 1489.06, "end": 1491.76, "text": " That's why it has learned to produce phonemes, right?" }, { "start": 1491.76, "end": 1499.52, "text": " But now the decoder can also, and also the encoder, the system can look at the lyrics" }, { "start": 1499.52, "end": 1505.12, "text": " that you provide right here in order to help with its decoding." }, { "start": 1505.12, "end": 1513.64, "text": " So technically it could learn to bypass the encoding of the exact way the lyrics are uttered." }, { "start": 1513.64, "end": 1517.64, "text": " And it could just look at the text that you provide." }, { "start": 1517.64, "end": 1522.8400000000001, "text": " Now this of course requires that during training you provide the lyrics of the song that are" }, { "start": 1522.8400000000001, "end": 1527.0800000000002, "text": " actually that you feed in." }, { "start": 1527.0800000000002, "end": 1532.92, "text": " But also it means that during decoding, if you sample, you can then provide your own" }, { "start": 1532.92, "end": 1536.4, "text": " lyrics and look what happens." }, { "start": 1536.4, "end": 1543.4, "text": " So they say they provide lyrics, they always have to provide lyrics for chunks of audio." }, { "start": 1543.4, "end": 1548.3200000000002, "text": " So our data set includes song level lyrics, but to make it easier, we train on shorter" }, { "start": 1548.3200000000002, "end": 1551.0400000000002, "text": " 24 second chunks of audio." }, { "start": 1551.0400000000002, "end": 1555.8400000000001, "text": " And this is partly to make it easier for the model, but also partly because those appear" }, { "start": 1555.8400000000001, "end": 1559.5, "text": " to be the limitations of these systems, right?" }, { "start": 1559.5, "end": 1569.22, "text": " If you have transformers in there and whatnot, 24 seconds of raw audio waveform is a lot." }, { "start": 1569.22, "end": 1577.88, "text": " So they have this problem of they have a song from here to here, and they have the lyrics," }, { "start": 1577.88, "end": 1579.24, "text": " blah, blah, blah." }, { "start": 1579.24, "end": 1584.32, "text": " And they need to know which lyrics belong to which part of the song." }, { "start": 1584.32, "end": 1586.64, "text": " And usually it's monotonic, right?" }, { "start": 1586.64, "end": 1591.52, "text": " And linear because you get the lyrics from some lyrics website, this blah, blah, blah." }, { "start": 1591.52, "end": 1596.22, "text": " But you don't know particularly to which 24 second chunk they belong." }, { "start": 1596.22, "end": 1601.64, "text": " So they say, first of all, they started with simply linearly aligning the lyrics, but then" }, { "start": 1601.64, "end": 1606.8, "text": " they had some, they had some problems with fast songs." }, { "start": 1606.8, "end": 1609.3600000000001, "text": " So they had some heuristic here." }, { "start": 1609.3600000000001, "end": 1617.02, "text": " But ultimately, the decoder needs to learn to attend to these lyrics." }, { "start": 1617.02, "end": 1621.8, "text": " And these the graphics like this you see here is the music token position and lyrics token" }, { "start": 1621.8, "end": 1622.8, "text": " position." }, { "start": 1622.8, "end": 1629.32, "text": " Here you see the the system learns that for example, if it has this music token needs" }, { "start": 1629.32, "end": 1632.8799999999999, "text": " to attend to this token in the lyric." }, { "start": 1632.8799999999999, "end": 1640.68, "text": " So you can by inspecting these attention heads that you have on the lyrics text in the system," }, { "start": 1640.68, "end": 1644.1, "text": " you can see which lyrics the model is paying attention to." }, { "start": 1644.1, "end": 1651.4199999999998, "text": " And the fact that it learns to pay linearly attention to these things is kind of a confirmation" }, { "start": 1651.42, "end": 1657.5, "text": " because you you don't you give the whole text or at least the 24 second chunks of audio," }, { "start": 1657.5, "end": 1660.54, "text": " you give that at once as a as a text, right." }, { "start": 1660.54, "end": 1666.3200000000002, "text": " And the fact that it learns to linearly attend to the tokens is a confirmation that it actually" }, { "start": 1666.3200000000002, "end": 1671.04, "text": " includes that information into the coding." }, { "start": 1671.04, "end": 1677.76, "text": " And that is a pretty gives you pretty much better results." }, { "start": 1677.76, "end": 1695.92, "text": " So we can maybe go to classic pop." }, { "start": 1695.92, "end": 1716.04, "text": " So this are unseen lyrics." }, { "start": 1716.04, "end": 1719.64, "text": " So the model has never seen these lyrics, right?" }, { "start": 1719.64, "end": 1725.3600000000001, "text": " It was just asked to produce classic pop in the style of Frank Sinatra with these lyrics." }, { "start": 1725.36, "end": 1726.9199999999998, "text": " And that's what it came up with." }, { "start": 1726.9199999999998, "end": 1729.1999999999998, "text": " That is pretty, pretty, pretty cool." }, { "start": 1729.1999999999998, "end": 1736.08, "text": " I think they also have re renditions where they basically feed I believe feed in the" }, { "start": 1736.08, "end": 1742.8, "text": " original lyrics, we conditioned on lyrics seen during training." }, { "start": 1742.8, "end": 1747.36, "text": " And they have fun songs." }, { "start": 1747.36, "end": 1752.52, "text": " And in the fun songs, I like the hip hop in the style of Kanye West, where they provide" }, { "start": 1752.52, "end": 1780.2, "text": " the lyrics of Eminem's lose yourself." }, { "start": 1780.2, "end": 1781.2, "text": " I'm grooving." }, { "start": 1781.2, "end": 1784.16, "text": " I don't know what you're thinking, but this is cool." }, { "start": 1784.16, "end": 1789.48, "text": " And they can also, as we said, do these completions where they start with part of a song." }, { "start": 1789.48, "end": 1791.1200000000001, "text": " And just I have to do this." }, { "start": 1791.1200000000001, "end": 1792.8400000000001, "text": " I have to do the hi there." }, { "start": 1792.8400000000001, "end": 1797.88, "text": " So the first version of this video was copystriked because what you would hear would be the original" }, { "start": 1797.88, "end": 1802.64, "text": " never going to give you up like 10 seconds of it, and then followed by what the model" }, { "start": 1802.64, "end": 1804.96, "text": " continues with." }, { "start": 1804.96, "end": 1809.04, "text": " So as a substitute, you're now going to have to listen to me." }, { "start": 1809.04, "end": 1812.04, "text": " I hope that suffices." }, { "start": 1839.04, "end": 1856.76, "text": " Almost as good, almost as good as the original." }, { "start": 1856.76, "end": 1863.52, "text": " So as you can see, this the results here are pretty, pretty cool." }, { "start": 1863.52, "end": 1870.32, "text": " And I want to show you one last thing, and that is this Christmas song in the style of" }, { "start": 1870.32, "end": 1872, "text": " Frank Sinatra." }, { "start": 1872, "end": 1875.16, "text": " I believe it's this one right here." }, { "start": 1875.16, "end": 1880.48, "text": " And the special thing here is, it's again classic pop in the style of Frank Sinatra." }, { "start": 1880.48, "end": 1887.24, "text": " And you see on the bottom here, you see on the bottom which of the lyrics it's attending" }, { "start": 1887.24, "end": 1888.24, "text": " to." }, { "start": 1888.24, "end": 1892.5, "text": " And you see, you know, this this graph right here that shows you that first, it's attending" }, { "start": 1892.5, "end": 1898.68, "text": " linearly through the lyrics, but then it kind of jumps around and attends to different things" }, { "start": 1898.68, "end": 1902.28, "text": " because it doesn't it doesn't it doesn't just continue." }, { "start": 1902.28, "end": 1930.04, "text": " So" }, { "start": 1930.04, "end": 1942.44, "text": " this is great." }, { "start": 1942.44, "end": 1947.92, "text": " So it kind of falls out of this linearly attending to the lyrics." }, { "start": 1947.92, "end": 1953.26, "text": " And probably because there was sort of a pause in the lyrics." }, { "start": 1953.26, "end": 1957.04, "text": " And maybe this is just more than one audio window." }, { "start": 1957.04, "end": 1960.24, "text": " So it doesn't have this autoregressive property anymore." }, { "start": 1960.24, "end": 1964.72, "text": " And then it doesn't find the proper place to attend anymore." }, { "start": 1964.72, "end": 1972.8, "text": " And just, again, comes up with sort of babbles, but it sounds pretty, pretty cool." }, { "start": 1972.8, "end": 1979.6, "text": " Yeah, so this they have released many, many samples here, some cherry picked and just" }, { "start": 1979.6, "end": 1984.52, "text": " a lot of samples with unseen lyrics, rerenditions, and so on." }, { "start": 1984.52, "end": 1986.96, "text": " This all is very cool." }, { "start": 1986.96, "end": 1992.1200000000001, "text": " They have their training setup described, I believe they also release their code." }, { "start": 1992.1200000000001, "end": 1998.04, "text": " Many more results in the paper of how to make this thing work if you want to do that yourself." }, { "start": 1998.04, "end": 2000.72, "text": " And with that, I invite you to read the paper." }, { "start": 2000.72, "end": 2006.1200000000001, "text": " If you're still here, please subscribe if you like this content, leave a comment and" }, { "start": 2006.12, "end": 2022.8799999999999, "text": " bye bye." } ]
RrBapqCPnmE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[ML Coding Tips] Separate Computation & Plotting using locals
[ "Science & Technology" ]
[ "deep learning", "machine learning", "coding", "research", "engineering", "ipython", "colab", "notebook", "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 research or 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 collabs 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'll usually run my big jobs on a cluster. So let's say I have run some jobs, one for each model, and have some logs that I want to analyze. So I'll go through my models and here I 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 shortcut and say printing is plotting. So think of these, this might be numbers right, and now I want to plot them here out, let's 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 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... here at the end you'll say something like data for this model is A 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 DA, DB, 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 tuples here, right, they could 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, I compute something new. I now need to add something here, right, I need to remember to store it in the data array and then I need to here 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 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. A software engineer would usually tell you let's do something like a data class 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 more probably the most verbose, you can also do name tuples, adder 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 you don't have to do the dictionary notation or remember the order. But now again if you want to add the C, 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 beware if there's a doc string and then you can use it here. This is just too 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 a software engineer you might have to get them chocolate for doing this. But alright, so what you can do is you can save your local variables in this dictionary. 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 A, B, C, M and all a bunch of other things, right. It's not clear in these IPython notebooks they have a bunch of stuff around them such that the meaning is slightly different depending where locals 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 locals dict refers of course to 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 defined them, right. If this doesn't work that means that the locals here is a copy basically and this is a Python optimization and I read I don't have to use it because in these IPython 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. Alright this was it I hope you enjoyed this I want to bring these kind of tips every now and then as a as an intermix into the research papers I hope you enjoyed this bye bye
[ { "start": 0, "end": 5.5600000000000005, "text": " Hi there! So today I just wanted to bring you a quick coding tip that I often" }, { "start": 5.5600000000000005, "end": 11.76, "text": " encounter in my daily machine learning research or life that might not be super" }, { "start": 11.76, "end": 17.52, "text": " common in let's say traditional software engineering or elsewhere. So often I have" }, { "start": 17.52, "end": 21.16, "text": " a bunch of, let's say I have a bunch of models right, and I use these IPython" }, { "start": 21.16, "end": 27, "text": " notebooks or collabs to analyze my data, plot things and so on. So I have a bunch" }, { "start": 27, "end": 33.84, "text": " of models, let's say they're called M1 and M2, and I'll usually run my big jobs" }, { "start": 33.84, "end": 38.36, "text": " on a cluster. So let's say I have run some jobs, one for each model, and have" }, { "start": 38.36, "end": 45.6, "text": " some logs that I want to analyze. So I'll go through my models and here I" }, { "start": 45.6, "end": 52.400000000000006, "text": " load a bunch of logs and I'll also compute some stuff, some statistics and" }, { "start": 52.4, "end": 59.12, "text": " some just things, right, that I want to have computed. And maybe these things" }, { "start": 59.12, "end": 68.08, "text": " are called A and let's... this and B, right. So now I've computed these things now, I" }, { "start": 68.08, "end": 73.92, "text": " want to analyze them. And let's shortcut and say printing is plotting. So" }, { "start": 73.92, "end": 77.44, "text": " think of these, this might be numbers right, and now I want to plot them here" }, { "start": 77.44, "end": 80.92, "text": " out, let's just print them, which I do this. Now every time I want to, you know," }, { "start": 80.92, "end": 88.8, "text": " change something here in my printing, maybe I want the separator to be that," }, { "start": 88.8, "end": 93.04, "text": " I'll have to load all the logs and compute all the stuff right each time I" }, { "start": 93.04, "end": 97.72, "text": " run this cell, which is not super cool, right. So I usually would like to factor" }, { "start": 97.72, "end": 103.64, "text": " out the plotting and stuff like this from the computation. So I could" }, { "start": 103.64, "end": 108.48, "text": " extract one of them into like a function, but then the point of these notebooks is" }, { "start": 108.48, "end": 111.96000000000001, "text": " that I can run each of the cells and they'll run right there, right. So" }, { "start": 111.96000000000001, "end": 116.72, "text": " functions aren't really cool in these notebooks. So what I'll usually end up" }, { "start": 116.72, "end": 123.16, "text": " doing is you'll have some second loop in here, right, and let's see, you'll have" }, { "start": 123.16, "end": 129.48000000000002, "text": " some data dict up here and you'll... here at the end you'll say something like" }, { "start": 129.48, "end": 139.67999999999998, "text": " data for this model is A and B or something like this, right, and then down" }, { "start": 139.67999999999998, "end": 149.79999999999998, "text": " here the first thing I do is I'll get my data and then I'll unpack again. So DA," }, { "start": 149.79999999999998, "end": 157.64, "text": " DB, either I'll unpack or I'll just address them in dictionary notation like" }, { "start": 157.64, "end": 161.6, "text": " this and then I can do my plotting, right. Some people use tuples here, right, they" }, { "start": 161.6, "end": 166.95999999999998, "text": " could just go A and B, but then you'll have to do this unpacking. The problem is" }, { "start": 166.95999999999998, "end": 172.33999999999997, "text": " now if I want to add something here, right, I compute something new. I now need" }, { "start": 172.33999999999997, "end": 176.92, "text": " to add something here, right, I need to remember to store it in the data array" }, { "start": 176.92, "end": 181.11999999999998, "text": " and then I need to here remember to unpack it in the same order, right, and" }, { "start": 181.11999999999998, "end": 187.51999999999998, "text": " then I need to produce to put it in in the plotting, right. So this is very" }, { "start": 187.52, "end": 193.68, "text": " cumbersome. This line here and this line here, they're very... because you kind of" }, { "start": 193.68, "end": 197.24, "text": " duplicate your variable names all over the place just because you want to" }, { "start": 197.24, "end": 201.44, "text": " compute them here and use them here. A software engineer would usually tell you" }, { "start": 201.44, "end": 211.04000000000002, "text": " let's do something like a data class or in its most simplest form is say of a" }, { "start": 211.04, "end": 218, "text": " class and you know there are multiple ways of achieving this but let's just do" }, { "start": 218, "end": 224.6, "text": " A and B here. This is more probably the most verbose, you can also do name tuples," }, { "start": 224.6, "end": 230.56, "text": " adder classes, data classes and so on but ultimately you produce a class like this" }, { "start": 230.56, "end": 237.12, "text": " and then here you say this is a data class A and B and then here down here" }, { "start": 237.12, "end": 244.28, "text": " you can at least address them like this, right, and you don't have to do the" }, { "start": 244.28, "end": 252.56, "text": " dictionary notation or remember the order. But now again if you" }, { "start": 252.56, "end": 257.2, "text": " want to add the C, not only do you have to add it here but you have to add" }, { "start": 257.2, "end": 266.64, "text": " it up here and you have to add it here and beware if there's a doc string and" }, { "start": 266.64, "end": 272.88, "text": " then you can use it here. This is just too cumbersome. So here is a" }, { "start": 272.88, "end": 277.8, "text": " trick and please only use these in like notebooks like this. This will lead to so" }, { "start": 277.8, "end": 281.71999999999997, "text": " much memory problems and everything and if you work with a software engineer you" }, { "start": 281.71999999999997, "end": 289.15999999999997, "text": " might have to get them chocolate for doing this. But alright, so what you" }, { "start": 289.15999999999997, "end": 295.88, "text": " can do is you can save your local variables in this dictionary." }, { "start": 295.88, "end": 302.32, "text": " So this is a built-in that saves the local variables, sorry that gives you a" }, { "start": 302.32, "end": 308.8, "text": " dict of the local variables. The local variables here are A, B, C, M and all a bunch" }, { "start": 308.8, "end": 312.8, "text": " of other things, right. It's not clear in these IPython notebooks they have a" }, { "start": 312.8, "end": 316.8, "text": " bunch of stuff around them such that the meaning is slightly different depending" }, { "start": 316.8, "end": 322.6, "text": " where locals is but in essence you'll get the A, B and C what you want. Now the" }, { "start": 322.6, "end": 329.16, "text": " locals dict refers in order for this to go through the locals dict refers of" }, { "start": 329.16, "end": 333.72, "text": " course to the same objects not newly constructed so we're safe here to make a" }, { "start": 333.72, "end": 341.72, "text": " copy of that right like this and then down here we simply retrieve these local" }, { "start": 341.72, "end": 349.56, "text": " variables and update the current local variables using the local variables we" }, { "start": 349.56, "end": 359.16, "text": " stored and voila we can use A, B and C without ever having defined them, right." }, { "start": 359.16, "end": 366, "text": " If this doesn't work that means that the locals here is a copy basically" }, { "start": 366, "end": 371.48, "text": " and this is a Python optimization and I read I don't have to use it because in" }, { "start": 371.48, "end": 378.66, "text": " these IPython notebooks it appears to work but you might want to have an empty" }, { "start": 378.66, "end": 385.36, "text": " exec statement here such that the Python interpreter can never be sure which" }, { "start": 385.36, "end": 392.56, "text": " variables are created in here and therefore can't optimize away. So that" }, { "start": 392.56, "end": 399.6, "text": " that is a horrible horrible trick. Again don't build anything serious upon this" }, { "start": 399.6, "end": 406.36, "text": " but it is very duper super easy you can just add any variable here and then use" }, { "start": 406.36, "end": 417.56, "text": " it down here so easy right and so wrong. Alright this was it I hope you enjoyed" }, { "start": 417.56, "end": 422.28000000000003, "text": " this I want to bring these kind of tips every now and then as a as an intermix" }, { "start": 422.28, "end": 437.71999999999997, "text": " into the research papers I hope you enjoyed this bye bye" } ]
F5aaXrIMWyU
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
The AI Economist: Improving Equality and Productivity with AI-Driven Tax Policies (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "reinforcement learning", "society", "gini index", "welfare", "taxes", "brackets", "progressive", "regressive", "us", "poor", "rich", "equality", "redistribution", "outer loop", "world", "resources", "labor", "trade", "neural networks", "ppo" ]
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 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. Where? 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 agents 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 off of other people. This is unlucky. No coins, no houses, and no resources. Look at them. 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 yeah, so and 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 1000 steps. So the number H 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 policy is 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 an 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 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 Gini index. So if you plot the cumulative distribution of wealth, a fully equal society would be a straight line because 50% of the people would have 50% of the money and so on. But 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 Gini index and 1 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 RL 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 tied 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 and the SAES 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 the SAES 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 to this in a second. Let's actually just look at one of these things first, one of these games, how this plays out. 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. And generally just kind of being a dick, being in everyone's face and kind of building things everywhere. And the other ones don't. Or just very few, like the light blue on the bottom left builds 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. Now 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 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 forgo 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, sorry about that, resources collected. If you have the lowest skill and the highest skill labors, the lowest skills, they mainly, this should be a 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 at 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 SAS 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 there's a lot of headroom here over what we currently have. Now let's look at some of the 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 SAS strategy. You can 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 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 downtrodden by life, abandoned by society, you have 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. Give us that. Give us that money. Come on. So basically, 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. So it's not like the government makes any money from the poor people independently of how high it taxes them. But it is 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 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 this level right here. And interestingly, if you earn even more, you'll be taxed high again, right? So this, we're kind of used to that. You earn little, you pay little, you earn more. You pay more. But then comes this entire valley here. What's up with that? Right? Like WT, and this can be this is now of course, the same reasoning as you have with this size 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 kind of 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 moneymakers, right? 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're 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 social mobility into the cost function. And therefore, the AI doesn't care that the poor people will stay poor and 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 just 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 effing eff the poor, right? No social mobility, mobility. No. And then what's happening at the end? What's happening at the end? This is beautiful. Very rich people. These are the moneymaker, right? This is the this is the monopoly guy top hat monocle wearing Scrooge McDuck 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 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 away quickly and we'll come back to this. Here's what I find particularly interesting about this paper, which just confuses the heck out of me. It 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 subdivide this into, as we said, 1000 steps. So an agent is here and it can do step, 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 RL problem. But also they divide this into 10, what they call periods. And I'm just going to draw maybe four 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 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. Because 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. And 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. Someone 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 free RLs, proximal policy optimization. And the 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 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'm 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 its 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 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? Like come on, become more productive and I get the benefits of that. And then in the last episode, last period, right, 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. But of course, this is not sustainable because all the rich people would just be kind of screwed through that and move down again, but it's the end of the episode. So 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. But the fact that this is this periodical 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 the 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 strategy. They just take these developed tax strategies and let the humans be the agents so that the 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 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 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 outperforms 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 periodical. 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 different strategies. So in the size formula, you'll see that the light blue person here is kind of spreading out a bit, probably playing correctly. Everyone else is just neatly building their houses. Humans are so territorial. And most of them, they kind of stay in their little corner. And they're like, this is my corner. I'm going to build my houses here in a 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. It's just building straight lines. And 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 kind of see that humans clearly 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 is the best. Okay, watch the on the bottom right, the human. They're just first they do something, they're just 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. And 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. Alright, 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, "end": 5.76, "text": " Alright, today we're going to find out why AI is much better at governing people, why" }, { "start": 5.76, "end": 12.8, "text": " poor people really should pay more taxes, and how Donald Trump is just a normal human." }, { "start": 12.8, "end": 15.16, "text": " Alright, we'll dive into it." }, { "start": 15.16, "end": 19.400000000000002, "text": " We're looking at the AI Economist by Salesforce Research." }, { "start": 19.400000000000002, "end": 26.92, "text": " Now Salesforce Research has kind of created a simulated world environment where they can" }, { "start": 26.92, "end": 32.36, "text": " place agents in it and the agents, they can move around, they can collect resources, they" }, { "start": 32.36, "end": 39.36, "text": " can trade those resources, and they can use those resources to build houses and that will" }, { "start": 39.36, "end": 41.56, "text": " earn them coins." }, { "start": 41.56, "end": 47.44, "text": " And each agent wants to maximize its own coins, but also there's the government and the government" }, { "start": 47.44, "end": 49.24, "text": " can set taxes." }, { "start": 49.24, "end": 52.980000000000004, "text": " So they collect money from everyone and they redistribute it." }, { "start": 52.98, "end": 61.31999999999999, "text": " And the goal now is going to be that the AI handles both the agent and the taxes and" }, { "start": 61.31999999999999, "end": 65.92, "text": " we want to maximize the social welfare of the entire population." }, { "start": 65.92, "end": 68.1, "text": " Alright, that's the goal." }, { "start": 68.1, "end": 73.96, "text": " So the paper here is called The AI Economist Improving Equality and Productivity with AI" }, { "start": 73.96, "end": 81.94, "text": " Driven Tax Policies by Stefan Cheng and Alexander Trott and other people from Salesforce Research" }, { "start": 81.94, "end": 85, "text": " and Harvard University." }, { "start": 85, "end": 94.16, "text": " So as I said, this is a simulated environment and the simulated environment works like this." }, { "start": 94.16, "end": 101.96, "text": " There is a 2D plane, kind of like a game playing field and in this game there are agents." }, { "start": 101.96, "end": 105.6, "text": " Here you can see the agents, there are always four agents." }, { "start": 105.6, "end": 106.6, "text": " Where?" }, { "start": 106.6, "end": 108.96, "text": " Oh, down here." }, { "start": 108.96, "end": 111.24, "text": " What are you doing in the corner?" }, { "start": 111.24, "end": 117.08, "text": " Come on, be productive." }, { "start": 117.08, "end": 121.36, "text": " The agents are in this world and they can do certain things." }, { "start": 121.36, "end": 123.11999999999999, "text": " They have certain actions at their disposal." }, { "start": 123.11999999999999, "end": 124.88, "text": " So first of all, they can move around." }, { "start": 124.88, "end": 128.35999999999999, "text": " They can move down, left, right and so on." }, { "start": 128.35999999999999, "end": 131.95999999999998, "text": " Whenever they walk past a resource tile, they collect the resource." }, { "start": 131.95999999999998, "end": 134.29999999999998, "text": " This is stone and this is wood." }, { "start": 134.29999999999998, "end": 136.56, "text": " So there are two kinds of resources." }, { "start": 136.56, "end": 140.78, "text": " And then the last actions the agents have is building a house." }, { "start": 140.78, "end": 147.52, "text": " One wood and one stone will create one house and the house gives you coins." }, { "start": 147.52, "end": 151.72, "text": " So this is a house and that will give you coins." }, { "start": 151.72, "end": 157.3, "text": " But how much coins you get is different from agent to agent and this represents the agents" }, { "start": 157.3, "end": 159.44, "text": " different skill levels." }, { "start": 159.44, "end": 167.28, "text": " This is an abstraction and the kind of economic theory behind it is that the income inequality" }, { "start": 167.28, "end": 174.16, "text": " in people, one of the main drivers of it is that they are skilled differently and therefore" }, { "start": 174.16, "end": 185.76, "text": " are able to convert one unit of labor into more money than another lower skilled worker." }, { "start": 185.76, "end": 190.96, "text": " So this is here represented by the fact that maybe if this agent here builds the house," }, { "start": 190.96, "end": 193.12, "text": " they'll get 50 coins." }, { "start": 193.12, "end": 197.48000000000002, "text": " But if this agent here would build the same house, they'll only get 10 coins." }, { "start": 197.48000000000002, "end": 203, "text": " So we'll call this here a high skilled worker and this here a low skilled worker." }, { "start": 203, "end": 206.88, "text": " Now the last thing, sorry, I saw the last thing before, but the very last thing the" }, { "start": 206.88, "end": 209.32, "text": " agents can do is they can trade." }, { "start": 209.32, "end": 214.4, "text": " So if one agent has too many resources and the other one has not enough, they can trade" }, { "start": 214.4, "end": 218.28, "text": " those resources among each other for those coins." }, { "start": 218.28, "end": 222.28, "text": " So once you build a house, you collect some coins, you can then either go and collect" }, { "start": 222.28, "end": 231.96, "text": " more resources or you can use those coins in order to buy resources off of other people." }, { "start": 231.96, "end": 233.32, "text": " This is unlucky." }, { "start": 233.32, "end": 237.64, "text": " No coins, no houses, and no resources." }, { "start": 237.64, "end": 238.64, "text": " Look at them." }, { "start": 238.64, "end": 243.44, "text": " Oh yeah, so you also can't move across the water here." }, { "start": 243.44, "end": 245.48, "text": " You can only move on the grass." }, { "start": 245.48, "end": 252.12, "text": " You can also not move through a house, which gives you some interesting abilities because" }, { "start": 252.12, "end": 255.4, "text": " you can just build a house right here." }, { "start": 255.4, "end": 260.28000000000003, "text": " And yeah, so and you can't move over other players." }, { "start": 260.28000000000003, "end": 263.16, "text": " But these are the rules are pretty simple." }, { "start": 263.16, "end": 268.62, "text": " And the goal here is for the agents to maximize the number of coins they get in 1000 steps." }, { "start": 268.62, "end": 275.28000000000003, "text": " So the number H here is 1000, which is the number of steps that the agents can take before" }, { "start": 275.28000000000003, "end": 278.52, "text": " the game is over and it restarts again." }, { "start": 278.52, "end": 284.76, "text": " So each agent is using reinforcement learning in order to learn how to achieve the maximum" }, { "start": 284.76, "end": 286.24, "text": " number of coins." }, { "start": 286.24, "end": 290.32, "text": " Now the policy is of course going to be different depending on whether that is a high or a low" }, { "start": 290.32, "end": 292.15999999999997, "text": " skilled worker." }, { "start": 292.15999999999997, "end": 297.4, "text": " The catch here is that outside of this there is the government, the government here, let's" }, { "start": 297.4, "end": 308.4, "text": " draw this big house with the flag of our fictitious nation, which is like this." }, { "start": 308.4, "end": 310, "text": " That's the flag." }, { "start": 310, "end": 319.12, "text": " And the government will observe what's happening here and they will issue a tax taxes." }, { "start": 319.12, "end": 321.71999999999997, "text": " So it will issue a tax distribution." }, { "start": 321.71999999999997, "end": 323.44, "text": " Now how do you imagine that?" }, { "start": 323.44, "end": 329.84, "text": " So if you imagine the government says something like this for the first 10 coins you own," }, { "start": 329.84, "end": 334.58, "text": " you owe us 5% of that." }, { "start": 334.58, "end": 340.84, "text": " For the next 10 coins, so from 10 to 20 you earn, you owe us 10% and so on." }, { "start": 340.84, "end": 347.5, "text": " So if you earn even more, you owe us more and more percent of those extra coins." }, { "start": 347.5, "end": 350.08, "text": " This is what you might know as a progressive tax schedule." }, { "start": 350.08, "end": 356.47999999999996, "text": " The more you earn, the more percentage wise you pay on that extra earned money." }, { "start": 356.47999999999996, "end": 362.56, "text": " This is what you might be used to, but there are other tax schedules and the exact histogram" }, { "start": 362.56, "end": 369.14, "text": " you see or the exact how many percent for which amount of coins, that is the action" }, { "start": 369.14, "end": 370.14, "text": " of the government." }, { "start": 370.14, "end": 375.68, "text": " So the government decides on the taxes and the taxes are just collected from the income." }, { "start": 375.68, "end": 383.76, "text": " So if an agent earns these coins, then it has to pay taxes to the government and the" }, { "start": 383.76, "end": 389.96, "text": " government will redistribute all the taxes it has collected equally among the population." }, { "start": 389.96, "end": 394.28, "text": " So if you pay a lot, you might lose through this process and if you just pay a little" }, { "start": 394.28, "end": 398.96, "text": " taxes you might gain through this process." }, { "start": 398.96, "end": 400.88, "text": " So that's it." }, { "start": 400.88, "end": 403.79999999999995, "text": " That is the basic premise of the game." }, { "start": 403.79999999999995, "end": 409, "text": " The agents are using reinforcement learning and I believe the newness of this paper is" }, { "start": 409, "end": 415.4, "text": " also that the government now is using reinforcement learning in order to determine the optimal" }, { "start": 415.4, "end": 417.76, "text": " tax policy." }, { "start": 417.76, "end": 422.4, "text": " There is kind of this inner loop here and there is this outer game where the government" }, { "start": 422.4, "end": 425.32, "text": " also tries to maximize the RL." }, { "start": 425.32, "end": 427.84, "text": " And what does the government try to maximize?" }, { "start": 427.84, "end": 428.96, "text": " Good question." }, { "start": 428.96, "end": 434.32, "text": " It is a measure that's called social welfare." }, { "start": 434.32, "end": 439.02, "text": " Now social welfare consists of two things and they have this here way down in the paper." }, { "start": 439.02, "end": 442.15999999999997, "text": " Social welfare in this paper consists of two things." }, { "start": 442.16, "end": 449.28000000000003, "text": " First of all, economic productivity, which basically just means how many coins has anyone" }, { "start": 449.28000000000003, "end": 450.44, "text": " produced." }, { "start": 450.44, "end": 453.92, "text": " It doesn't matter who, but just the total amount of coins produced." }, { "start": 453.92, "end": 459.84000000000003, "text": " The second one is income equality and this is related to the Gini index." }, { "start": 459.84000000000003, "end": 465.3, "text": " So if you plot the cumulative distribution of wealth, a fully equal society would be" }, { "start": 465.3, "end": 473.46000000000004, "text": " a straight line because 50% of the people would have 50% of the money and so on." }, { "start": 473.46000000000004, "end": 480.56, "text": " But almost all true societies have something like this where 50% of the people might have" }, { "start": 480.56, "end": 486.92, "text": " 10% of the money and the rest 50% of the people has the other 90%." }, { "start": 486.92, "end": 491.44, "text": " And the measure of inequality is this area here." }, { "start": 491.44, "end": 498.52, "text": " This is called the Gini index and 1 minus this area is what this paper has as an equality" }, { "start": 498.52, "end": 499.52, "text": " measure." }, { "start": 499.52, "end": 506.6, "text": " So the higher this number, the more equal is the society in terms of their income distribution." }, { "start": 506.6, "end": 512.3, "text": " Now what is actually optimized for here is this thing, equality times productivity." }, { "start": 512.3, "end": 518.36, "text": " So you want both to be high, your income equality and your productivity." }, { "start": 518.36, "end": 525.04, "text": " There's a trade off here of course, but you can have multiple ways to trade that off and" }, { "start": 525.04, "end": 528.2, "text": " that will give you the different thing." }, { "start": 528.2, "end": 532.44, "text": " They call this the social welfare function." }, { "start": 532.44, "end": 537.44, "text": " And that's the thing that the government RL agent optimizes for." }, { "start": 537.44, "end": 543.88, "text": " So you can see here already the free market, even though it's the most productive, produces" }, { "start": 543.88, "end": 549, "text": " the most coins because if you have a free market means no taxes." }, { "start": 549, "end": 555.68, "text": " If you have no taxes, then people are basically encouraged to earn more money because they" }, { "start": 555.68, "end": 557.24, "text": " don't have to pay taxes on them." }, { "start": 557.24, "end": 561.64, "text": " As soon as you tax them, they're less encouraged to earn more money." }, { "start": 561.64, "end": 567.2, "text": " And therefore if you have no taxes, the most coins will be earned in total." }, { "start": 567.2, "end": 569.06, "text": " But the equality suffers." }, { "start": 569.06, "end": 573.76, "text": " So the equality is the lowest among these things considered." }, { "start": 573.76, "end": 581.4399999999999, "text": " If you compare that to the AI economist, the AI economist achieves the highest social welfare." }, { "start": 581.4399999999999, "end": 587.72, "text": " It achieves the highest equality, but it doesn't suffer as much in productivity as other systems" }, { "start": 587.72, "end": 588.72, "text": " here." }, { "start": 588.72, "end": 592.84, "text": " And the baseline systems are first of all, the US federal system." }, { "start": 592.84, "end": 594.96, "text": " This is not particularly tied to the US." }, { "start": 594.96, "end": 601.28, "text": " This is basically every system or most of the systems that you have currently in the" }, { "start": 601.28, "end": 607.3199999999999, "text": " world is the progressive tax system and the SAES formula, which I believe is an economically" }, { "start": 607.3199999999999, "end": 611.88, "text": " theory based system, which is a regressive tax schedule." }, { "start": 611.88, "end": 619.64, "text": " You can see them down here where the US federal will be progressive, means the more you earn," }, { "start": 619.64, "end": 622.0799999999999, "text": " the more percentage wise you pay." }, { "start": 622.0799999999999, "end": 627.4399999999999, "text": " While the SAES formula will be regressive, which generally means the more you earn, the" }, { "start": 627.4399999999999, "end": 628.4399999999999, "text": " less you pay." }, { "start": 628.44, "end": 634.6800000000001, "text": " I believe this was derived under some assumptions to be the optimal tax distribution." }, { "start": 634.6800000000001, "end": 643.08, "text": " And the AI economist will come to this in a second." }, { "start": 643.08, "end": 649.6400000000001, "text": " Let's actually just look at one of these things first, one of these games, how this plays" }, { "start": 649.6400000000001, "end": 650.6400000000001, "text": " out." }, { "start": 650.6400000000001, "end": 653.5, "text": " The cool thing here is that they have pretty flashy animations." }, { "start": 653.5, "end": 656.12, "text": " So you can look how does one of these games turn out." }, { "start": 656.12, "end": 661.48, "text": " Now this is a free market game and you can see the agents moving around collecting things," }, { "start": 661.48, "end": 662.48, "text": " building houses." }, { "start": 662.48, "end": 668.04, "text": " And you might notice that one of the agents, namely agent one, is just building all of" }, { "start": 668.04, "end": 669.52, "text": " the houses." }, { "start": 669.52, "end": 675.48, "text": " And generally just kind of being a dick, being in everyone's face and kind of building things" }, { "start": 675.48, "end": 676.64, "text": " everywhere." }, { "start": 676.64, "end": 679.96, "text": " And the other ones don't." }, { "start": 679.96, "end": 685.64, "text": " Or just very few, like the light blue on the bottom left builds some houses." }, { "start": 685.64, "end": 691.76, "text": " On the right you can see how the distribution of wealth is structured." }, { "start": 691.76, "end": 694.84, "text": " And you see agent one ends up with most of the wealth." }, { "start": 694.84, "end": 698.76, "text": " Now the size of the circle I think is the total productivity." }, { "start": 698.76, "end": 706.52, "text": " So you can see this grows over time mainly because agent one becomes so rich." }, { "start": 706.52, "end": 711.84, "text": " And if you analyze this, if you analyze what's happening here, then you'll see that agent" }, { "start": 711.84, "end": 716.4, "text": " one and I might be..." }, { "start": 716.4, "end": 721.64, "text": " Yeah, they have a graph up here." }, { "start": 721.64, "end": 725.5600000000001, "text": " So it is very interesting what happens." }, { "start": 725.5600000000001, "end": 727.86, "text": " This is kind of the same game." }, { "start": 727.86, "end": 737.12, "text": " So agent one here is this orange dot and agents two, three and four are these dots here." }, { "start": 737.12, "end": 740.72, "text": " And this graph here is coin from trading." }, { "start": 740.72, "end": 745.64, "text": " So how much money they win or lose from trading." }, { "start": 745.64, "end": 753, "text": " Now the green bars are trading wood and the brown bars are trading stone." }, { "start": 753, "end": 758.44, "text": " So you see agent number four, which is the lowest skilled, the skill is just determined" }, { "start": 758.44, "end": 761.24, "text": " at the beginning of the episode." }, { "start": 761.24, "end": 766.08, "text": " It will just make all of its coins basically by selling wood." }, { "start": 766.08, "end": 769.34, "text": " And agent three will make all of its coins by selling stone." }, { "start": 769.34, "end": 772.84, "text": " And agent two will collect both and sell both." }, { "start": 772.84, "end": 778.44, "text": " And agent one will just spend money in trading." }, { "start": 778.44, "end": 782.8000000000001, "text": " So you'll have a specialization here." }, { "start": 782.8000000000001, "end": 789.26, "text": " Agent one, which is the highest skill one right here, will buy resources in order to" }, { "start": 789.26, "end": 793.6, "text": " build more houses because it clearly profits from building lots and lots and lots and lots" }, { "start": 793.6, "end": 795.0600000000001, "text": " of houses." }, { "start": 795.06, "end": 799.7199999999999, "text": " So it will use that money to buy more resources rather than go and collecting them." }, { "start": 799.7199999999999, "end": 805.8399999999999, "text": " While all the other ones basically forgo building houses in favor of they just collect the resources" }, { "start": 805.8399999999999, "end": 810.7199999999999, "text": " and they just trade them way to the agent one that's more profitable for them than building" }, { "start": 810.7199999999999, "end": 812.1999999999999, "text": " houses themselves." }, { "start": 812.1999999999999, "end": 817.9599999999999, "text": " So you see this kind of specialization emerging in these games, which I find, I find this" }, { "start": 817.9599999999999, "end": 824.3599999999999, "text": " to be pretty cool that you see something like this, like a really stark division of labor" }, { "start": 824.36, "end": 831, "text": " emerging just from these very, very small set of rules." }, { "start": 831, "end": 833.88, "text": " And you can analyze this game in different ways." }, { "start": 833.88, "end": 841.6800000000001, "text": " They have a few more plots where this becomes quite apparent that sorry, that these agents" }, { "start": 841.6800000000001, "end": 843.3000000000001, "text": " specialize." }, { "start": 843.3000000000001, "end": 849.94, "text": " So you see here resources collected, sorry about that, resources collected." }, { "start": 849.94, "end": 859.6400000000001, "text": " If you have the lowest skill and the highest skill labors, the lowest skills, they mainly," }, { "start": 859.6400000000001, "end": 861.86, "text": " this should be a 10." }, { "start": 861.86, "end": 871.6, "text": " They mainly collect resources, while the highest skill labor mainly goes for building things." }, { "start": 871.6, "end": 876.7600000000001, "text": " It doesn't collect resources, but net income from building is really high while everyone" }, { "start": 876.76, "end": 880.08, "text": " else just doesn't build at all." }, { "start": 880.08, "end": 885.52, "text": " All right, so we have a division of labor emerging." }, { "start": 885.52, "end": 887.3199999999999, "text": " Now this was a free market." }, { "start": 887.3199999999999, "end": 890.76, "text": " Let's actually compare the different algorithms." }, { "start": 890.76, "end": 897.1, "text": " So if you look at social welfare, this is this thing here, equality times productivity." }, { "start": 897.1, "end": 902.8, "text": " You can see that the AI economist will outperform over time over the training progress, it will" }, { "start": 902.8, "end": 906.16, "text": " outperform all of the other systems." }, { "start": 906.16, "end": 912.36, "text": " So it will outperform the free market, the US federal tax system, and the SAS formula" }, { "start": 912.36, "end": 915.78, "text": " if trained for long enough, which is to be expected, right?" }, { "start": 915.78, "end": 921.24, "text": " If you put RL onto a cost function, it will then optimize that cost function." }, { "start": 921.24, "end": 927.52, "text": " But it's pretty cool to see that there's a lot of headroom here over what we currently" }, { "start": 927.52, "end": 929.16, "text": " have." }, { "start": 929.16, "end": 933.92, "text": " Now let's look at some of the strategies it comes up with." }, { "start": 933.92, "end": 941.8399999999999, "text": " So what do these games look like where the AI has imposed different tax strategies?" }, { "start": 941.8399999999999, "end": 943.76, "text": " So this is with the SAS strategy." }, { "start": 943.76, "end": 945.88, "text": " You can see that here." }, { "start": 945.88, "end": 951.56, "text": " Again, you see this inequality emerging with the yellow player here building most of the" }, { "start": 951.56, "end": 953, "text": " houses." }, { "start": 953, "end": 959.7199999999999, "text": " With the AI economist, again, there is inequality, but you can see at the distribution that agent" }, { "start": 959.72, "end": 965.52, "text": " one only ends up with about half of the wealth, where if you compare this to the free market" }, { "start": 965.52, "end": 972.38, "text": " here, then agent one ends up with like two thirds of the wealth, right?" }, { "start": 972.38, "end": 975, "text": " This is the game we saw before." }, { "start": 975, "end": 982.64, "text": " But there is not qualitatively that much of a difference, but there is in the end result." }, { "start": 982.64, "end": 987.84, "text": " All right, let's look at what these policies actually come up with." }, { "start": 987.84, "end": 991.52, "text": " So what is the tax policy that the AI comes up with?" }, { "start": 991.52, "end": 998.1, "text": " So this tax policy outperforms on this social welfare metric." }, { "start": 998.1, "end": 1001.76, "text": " And this is very interesting, right?" }, { "start": 1001.76, "end": 1005.12, "text": " So first of all, you see that it's right zigzag." }, { "start": 1005.12, "end": 1010.24, "text": " It's like down, up, down, up, which is already weird." }, { "start": 1010.24, "end": 1017.5, "text": " So the first very weird thing is the spike at the very bottom." }, { "start": 1017.5, "end": 1021.52, "text": " So that thing here, what's that thing here?" }, { "start": 1021.52, "end": 1026.72, "text": " Those are the poorest people in your society, and you're taxing them the highest." }, { "start": 1026.72, "end": 1027.72, "text": " Right?" }, { "start": 1027.72, "end": 1035.2, "text": " So just imagine this, you're here downtrodden by life, abandoned by society, you have no" }, { "start": 1035.2, "end": 1037.04, "text": " money, no house, no nothing." }, { "start": 1037.04, "end": 1042.8, "text": " And you're just trying to get a job, you're just getting like a little bit of money." }, { "start": 1042.8, "end": 1049.32, "text": " And you can buy a cheeseburger, and then the government comes." }, { "start": 1049.32, "end": 1050.32, "text": " Give us that." }, { "start": 1050.32, "end": 1053.32, "text": " Give us that money." }, { "start": 1053.32, "end": 1054.32, "text": " Come on." }, { "start": 1054.32, "end": 1059.6, "text": " So basically, these are the poor." }, { "start": 1059.6, "end": 1063.36, "text": " And the poor in this system is just F you." }, { "start": 1063.36, "end": 1064.36, "text": " F you the poor." }, { "start": 1064.36, "end": 1068.76, "text": " Now, the reason why this happens is pretty clear, right?" }, { "start": 1068.76, "end": 1075.64, "text": " The reason why this happens is because you want to encourage people to go here to earn" }, { "start": 1075.64, "end": 1077.6, "text": " more money." }, { "start": 1077.6, "end": 1081.8799999999999, "text": " So it's not like the government makes any money from the poor people independently of" }, { "start": 1081.8799999999999, "end": 1084.28, "text": " how high it taxes them." }, { "start": 1084.28, "end": 1090.48, "text": " But it is basically an incentive structure to make them move over to the somewhat more" }, { "start": 1090.48, "end": 1092.44, "text": " productive population." }, { "start": 1092.44, "end": 1097.44, "text": " Because here it's assumed kind of that even the lowest skilled ones can move over a bit" }, { "start": 1097.44, "end": 1101.48, "text": " if you just tax them enough at the low brackets, right?" }, { "start": 1101.48, "end": 1110.76, "text": " So this is what I find to be you just have to realize that it is so hard, I believe it" }, { "start": 1110.76, "end": 1117.92, "text": " is almost impossible to encapsulate what we really want in a system into a formula to" }, { "start": 1117.92, "end": 1120.06, "text": " be into a cost function to be optimized." }, { "start": 1120.06, "end": 1121.68, "text": " It is so incredibly hard." }, { "start": 1121.68, "end": 1125.72, "text": " And you see that here, of course, it is going to result in a better social outcome, but" }, { "start": 1125.72, "end": 1132.32, "text": " it just doesn't feel right to tax the poor at what 60%?" }, { "start": 1132.32, "end": 1136.84, "text": " Okay, so F the poor, right?" }, { "start": 1136.84, "end": 1140.04, "text": " And then you get to this level right here." }, { "start": 1140.04, "end": 1147.1200000000001, "text": " And interestingly, if you earn even more, you'll be taxed high again, right?" }, { "start": 1147.1200000000001, "end": 1152.04, "text": " So this, we're kind of used to that." }, { "start": 1152.04, "end": 1155.16, "text": " You earn little, you pay little, you earn more." }, { "start": 1155.16, "end": 1156.8000000000002, "text": " You pay more." }, { "start": 1156.8000000000002, "end": 1159.72, "text": " But then comes this entire valley here." }, { "start": 1159.72, "end": 1161.0400000000002, "text": " What's up with that?" }, { "start": 1161.0400000000002, "end": 1162.0400000000002, "text": " Right?" }, { "start": 1162.0400000000002, "end": 1169.92, "text": " Like WT, and this can be this is now of course, the same reasoning as you have with this size" }, { "start": 1169.92, "end": 1177.92, "text": " formula here is where the rich people, you want to tax them less so that they are more" }, { "start": 1177.92, "end": 1181.24, "text": " productive such that they generate more coins." }, { "start": 1181.24, "end": 1187.84, "text": " And even though you tax them less percentage wise, they will end up paying more money in" }, { "start": 1187.84, "end": 1189.96, "text": " absolute terms." }, { "start": 1189.96, "end": 1194.4, "text": " Because because you basically encourage them to produce more." }, { "start": 1194.4, "end": 1201.6, "text": " So that is that is kind of that is the, I guess the reasoning behind this." }, { "start": 1201.6, "end": 1205.92, "text": " But what you have to wreck, you have to recognize what's happening here, right?" }, { "start": 1205.92, "end": 1207, "text": " What are we optimizing?" }, { "start": 1207, "end": 1210.88, "text": " We're optimizing this productivity times equality." }, { "start": 1210.88, "end": 1213.1200000000001, "text": " And what do we get?" }, { "start": 1213.1200000000001, "end": 1219.68, "text": " You see, you get two big valleys of attraction, one here, and one here." }, { "start": 1219.68, "end": 1225.8400000000001, "text": " And that means that this algorithm favors a two class society." }, { "start": 1225.8400000000001, "end": 1227.0600000000002, "text": " Right?" }, { "start": 1227.0600000000002, "end": 1231.8600000000001, "text": " And I believe this is this is partially the limitations of this simulation here, the fact" }, { "start": 1231.8600000000001, "end": 1235.68, "text": " that you only have four agents, the fact that you can only do two things either collect" }, { "start": 1235.68, "end": 1237.0400000000002, "text": " or build, right?" }, { "start": 1237.04, "end": 1242.8, "text": " It encourages a two class society, this specialization that you saw, right?" }, { "start": 1242.8, "end": 1247.1599999999999, "text": " So you say these here are the moneymakers, right?" }, { "start": 1247.1599999999999, "end": 1249.3, "text": " And these here are the collectors." }, { "start": 1249.3, "end": 1252.8799999999999, "text": " And it is very hard to move from one group to the other." }, { "start": 1252.8799999999999, "end": 1259.08, "text": " Because if you you earn more coins as a collector, you're here, and you're really discouraged" }, { "start": 1259.08, "end": 1260.08, "text": " here." }, { "start": 1260.08, "end": 1263.6399999999999, "text": " If you move there, you want to move all the way over here, right?" }, { "start": 1263.64, "end": 1268.96, "text": " Now, the people that are already over here, if they earn an extra coin, that doesn't bother" }, { "start": 1268.96, "end": 1269.96, "text": " them too much." }, { "start": 1269.96, "end": 1272.0400000000002, "text": " So they're very encouraged to earn more money." }, { "start": 1272.0400000000002, "end": 1277.68, "text": " But the very, the poorer people on this side, they're basically discouraged from earning" }, { "start": 1277.68, "end": 1285.1000000000001, "text": " more money, because the system needs them to stay at that collector level, right?" }, { "start": 1285.1000000000001, "end": 1292.2, "text": " So the system encourages the two class society because we have not built social mobility" }, { "start": 1292.2, "end": 1301.7, "text": " into the into the into the equation, we have not built a measure for social social mobility" }, { "start": 1301.7, "end": 1303.18, "text": " into the cost function." }, { "start": 1303.18, "end": 1308.04, "text": " And therefore, the AI doesn't care that the poor people will stay poor and rich people" }, { "start": 1308.04, "end": 1310.04, "text": " will stay rich." }, { "start": 1310.04, "end": 1314.64, "text": " It just knows that this is the best outcome for society overall, given the cost function" }, { "start": 1314.64, "end": 1320, "text": " that we had, again, this just doesn't seem like fair to us, like what we want, we want" }, { "start": 1320, "end": 1326.6, "text": " someone to be able to make it over here, right, even if they start out from the bottom." }, { "start": 1326.6, "end": 1330.48, "text": " And so we'd have to we have to build that in." }, { "start": 1330.48, "end": 1335.6, "text": " So we have a system that is effing eff the poor, right?" }, { "start": 1335.6, "end": 1340.96, "text": " No social mobility, mobility." }, { "start": 1340.96, "end": 1342.8, "text": " No." }, { "start": 1342.8, "end": 1345.48, "text": " And then what's happening at the end?" }, { "start": 1345.48, "end": 1346.64, "text": " What's happening at the end?" }, { "start": 1346.64, "end": 1348.44, "text": " This is beautiful." }, { "start": 1348.44, "end": 1350.1200000000001, "text": " Very rich people." }, { "start": 1350.1200000000001, "end": 1352, "text": " These are the moneymaker, right?" }, { "start": 1352, "end": 1359.92, "text": " This is the this is the monopoly guy top hat monocle wearing Scrooge McDuck bathing in" }, { "start": 1359.92, "end": 1361.22, "text": " coins." }, { "start": 1361.22, "end": 1365.56, "text": " This is where the the government makes their money." }, { "start": 1365.56, "end": 1373.4, "text": " And the discrepancy is really stunning, because you could also argue, hey, why don't we apply" }, { "start": 1373.4, "end": 1376, "text": " the same reasoning as we applied here and here?" }, { "start": 1376, "end": 1382.08, "text": " Why is not is it not like the case that if the rich people if you tax them lower, they'll" }, { "start": 1382.08, "end": 1383.32, "text": " pay more money and so on." }, { "start": 1383.32, "end": 1389.78, "text": " I believe again, this might be just a result of this, how the simulation is set up." }, { "start": 1389.78, "end": 1393.08, "text": " So we'll move away quickly and we'll come back to this." }, { "start": 1393.08, "end": 1398.4, "text": " Here's what I find particularly interesting about this paper, which just confuses the" }, { "start": 1398.4, "end": 1400.84, "text": " heck out of me." }, { "start": 1400.84, "end": 1404.5, "text": " It is a double periodic game." }, { "start": 1404.5, "end": 1407.02, "text": " So it's an inner outer loop game." }, { "start": 1407.02, "end": 1408.3, "text": " What do I mean by that?" }, { "start": 1408.3, "end": 1409.76, "text": " They have these episodes, right?" }, { "start": 1409.76, "end": 1411.58, "text": " Here is the start." }, { "start": 1411.58, "end": 1416.04, "text": " And here is the end." }, { "start": 1416.04, "end": 1421.16, "text": " And they subdivide this into, as we said, 1000 steps." }, { "start": 1421.16, "end": 1425.32, "text": " So an agent is here and it can do step, step, step, step, step, and it can perform these" }, { "start": 1425.32, "end": 1426.32, "text": " actions." }, { "start": 1426.32, "end": 1427.64, "text": " This is the agent." }, { "start": 1427.64, "end": 1431.48, "text": " There are 1000 steps here and the agent just tries to collect as much coins." }, { "start": 1431.48, "end": 1434.4, "text": " So this is your classic RL problem." }, { "start": 1434.4, "end": 1438.64, "text": " But also they divide this into 10, what they call periods." }, { "start": 1438.64, "end": 1443.2800000000002, "text": " And I'm just going to draw maybe four periods, right?" }, { "start": 1443.2800000000002, "end": 1452.6200000000001, "text": " So this thing here, they call one period where the whole thing is an episode." }, { "start": 1452.6200000000001, "end": 1458.0400000000002, "text": " Now the purpose of the period is that at the beginning of each period, the government," }, { "start": 1458.0400000000002, "end": 1462.3000000000002, "text": " the government can impose a new tax schedule." }, { "start": 1462.3, "end": 1468.12, "text": " So the government doesn't only fix the taxes once, but it can change the taxes over the" }, { "start": 1468.12, "end": 1472.5, "text": " course of the episode, right?" }, { "start": 1472.5, "end": 1475.24, "text": " Now this is what I find." }, { "start": 1475.24, "end": 1477.02, "text": " I just don't see why." }, { "start": 1477.02, "end": 1483.3999999999999, "text": " So now you're formulating the tax giving objective as a sequential decision making." }, { "start": 1483.3999999999999, "end": 1488.56, "text": " It's like the government saying, well, today we have high taxes, but tomorrow we have low" }, { "start": 1488.56, "end": 1492.04, "text": " taxes and the day after that we have high taxes again." }, { "start": 1492.04, "end": 1498.44, "text": " And it just doesn't make sense for any government to do this." }, { "start": 1498.44, "end": 1503.56, "text": " What you should do is you should set taxes once at the beginning of the episode and then" }, { "start": 1503.56, "end": 1508.8, "text": " see how that turns out and then try to maximize your tax schedule." }, { "start": 1508.8, "end": 1515.44, "text": " Because all we're looking at, we're only ever looking at how the taxes are at the end, right?" }, { "start": 1515.44, "end": 1520.48, "text": " The things that we've examined are just the last taxes that the AI has issued." }, { "start": 1520.48, "end": 1523.76, "text": " We don't know the dynamic of what happens in between." }, { "start": 1523.76, "end": 1528.72, "text": " This might be super wild actually, what the AI does in between." }, { "start": 1528.72, "end": 1534.44, "text": " And I just don't see the framing as a sequential decision problem." }, { "start": 1534.44, "end": 1538.6, "text": " And I believe this is just an over engineered thing." }, { "start": 1538.6, "end": 1543.24, "text": " Because someone wanted a reason and here is the architecture, right?" }, { "start": 1543.24, "end": 1548, "text": " You see someone wanted a reason to put an LSTM in there." }, { "start": 1548, "end": 1552.88, "text": " Someone is thinking like, well, RL, that means like sequential decisions and so on." }, { "start": 1552.88, "end": 1560, "text": " And RL in this outer loop, the way I propose it would just be a one step per episode decision," }, { "start": 1560, "end": 1561.28, "text": " which is a bandit problem." }, { "start": 1561.28, "end": 1564, "text": " And as we all know, bandits are boring." }, { "start": 1564, "end": 1567.72, "text": " So they didn't want this to be a bandit problem." }, { "start": 1567.72, "end": 1569.44, "text": " They wanted to be a sequential problem." }, { "start": 1569.44, "end": 1574.56, "text": " And that's why they made this period thing, which I find dumb." }, { "start": 1574.56, "end": 1581.12, "text": " So another factor here, and I'm going to tell you how this relates to the to the weird rich" }, { "start": 1581.12, "end": 1582.84, "text": " people are taxed high." }, { "start": 1582.84, "end": 1585.52, "text": " Another factor here is look at this." }, { "start": 1585.52, "end": 1590.52, "text": " It's a CNN, an MLP, an LSTM and an MLP and the agent as well." }, { "start": 1590.52, "end": 1594.6799999999998, "text": " And I can tell you right now, the CNN has two layers." }, { "start": 1594.6799999999998, "end": 1596.22, "text": " Two." }, { "start": 1596.22, "end": 1601.22, "text": " And the LSTM has like 128 units in its hidden state." }, { "start": 1601.22, "end": 1605.4, "text": " So these are tiny, tiny models." }, { "start": 1605.4, "end": 1610.52, "text": " And it is not a model based RL, it's model free RLs, proximal policy optimization." }, { "start": 1610.52, "end": 1619.6000000000001, "text": " And the the the ability of these agents or planner to learn anything substantial here," }, { "start": 1619.6000000000001, "end": 1626.38, "text": " I believe is just not super duper well, right." }, { "start": 1626.38, "end": 1632.0800000000002, "text": " So the I believe that these are rather dumb agents." }, { "start": 1632.0800000000002, "end": 1638.72, "text": " And you can see the tax rates given by the planner is fed into the agent model." }, { "start": 1638.72, "end": 1645.5600000000002, "text": " But I don't think that the agent given such a small model can actually adjust to these" }, { "start": 1645.5600000000002, "end": 1651.38, "text": " inputs because you have to do some pretty good logic in order to from these tax brackets" }, { "start": 1651.38, "end": 1654.7, "text": " to determine how you should act right now." }, { "start": 1654.7, "end": 1659.0800000000002, "text": " What I think is happening is the agent just kind of is aware of its skill level and through" }, { "start": 1659.0800000000002, "end": 1664.76, "text": " its rewards, it's trying to maximize its future rewards." }, { "start": 1664.76, "end": 1671.8400000000001, "text": " And then when the government changes the tax rate, it will not, I'm almost positive it" }, { "start": 1671.8400000000001, "end": 1675.76, "text": " will not directly change its response to that." }, { "start": 1675.76, "end": 1681.4, "text": " But it will kind of observe that something's happening in the world and then adjust maybe" }, { "start": 1681.4, "end": 1687.1200000000001, "text": " a little bit its overall strategy, but not in that particular instance, and it will be" }, { "start": 1687.1200000000001, "end": 1690.74, "text": " delayed or it will be like an overall strategy." }, { "start": 1690.74, "end": 1700.72, "text": " And this might be one of the reasons why the tax brackets here might be screwed up because" }, { "start": 1700.72, "end": 1707.8000000000002, "text": " who says who says if I were this AI, what I could do is in period one through nine," }, { "start": 1707.8, "end": 1711.96, "text": " I make the taxes really low for the rich people." }, { "start": 1711.96, "end": 1716.1599999999999, "text": " So I just encourage everyone to make more money, right?" }, { "start": 1716.1599999999999, "end": 1719.96, "text": " Like come on, become more productive and I get the benefits of that." }, { "start": 1719.96, "end": 1726.2, "text": " And then in the last episode, last period, right, I just freaking jack up that final" }, { "start": 1726.2, "end": 1727.2, "text": " tax bracket." }, { "start": 1727.2, "end": 1731.3799999999999, "text": " It's like you, you have lots of money, give it to me." }, { "start": 1731.3799999999999, "end": 1736.12, "text": " And then you just redistribute what you got there to the poor people in the very last" }, { "start": 1736.12, "end": 1740.8799999999999, "text": " period and thereby you achieve your goal of this social welfare function." }, { "start": 1740.8799999999999, "end": 1745.3999999999999, "text": " But of course, this is not sustainable because all the rich people would just be kind of" }, { "start": 1745.3999999999999, "end": 1749, "text": " screwed through that and move down again, but it's the end of the episode." }, { "start": 1749, "end": 1751.6, "text": " So what are they going to do?" }, { "start": 1751.6, "end": 1759.3999999999999, "text": " So I think the fact how this is framed, that there are just two different ways to get coins." }, { "start": 1759.4, "end": 1766.2800000000002, "text": " But the fact that this is this periodical nature of the outer loop all might lead to" }, { "start": 1766.2800000000002, "end": 1773.96, "text": " something that becomes slowly more and more and more uninterpretable." }, { "start": 1773.96, "end": 1774.96, "text": " Still cool though." }, { "start": 1774.96, "end": 1779.5600000000002, "text": " All right, so the final thing, they do this with humans." }, { "start": 1779.5600000000002, "end": 1781.48, "text": " Yes, real humans." }, { "start": 1781.48, "end": 1790.92, "text": " So they let humans try it and they have this interface here and the humans, they behave" }, { "start": 1790.92, "end": 1793.82, "text": " quite differently from the AI." }, { "start": 1793.82, "end": 1797.64, "text": " So there are a few different things where the humans act." }, { "start": 1797.64, "end": 1802.6200000000001, "text": " But look at that here, AI economists, this is what the agents do, right?" }, { "start": 1802.6200000000001, "end": 1805.72, "text": " So this AI economist is the tax strategy." }, { "start": 1805.72, "end": 1811.96, "text": " They just take these developed tax strategies and let the humans be the agents so that the" }, { "start": 1811.96, "end": 1817.04, "text": " you just want to observe how the agents act and whether or not the tax strategies also" }, { "start": 1817.04, "end": 1823.1200000000001, "text": " work when it's real humans acting in this environment and not our agents." }, { "start": 1823.1200000000001, "end": 1826.76, "text": " So compare this to how the humans act." }, { "start": 1826.76, "end": 1831.76, "text": " The humans they just build their houses in like neat little packets or straight lines" }, { "start": 1831.76, "end": 1833.76, "text": " or stuff like this." }, { "start": 1833.76, "end": 1836.24, "text": " I just find it to be very funny." }, { "start": 1836.24, "end": 1841.54, "text": " Now there are some things lacking in the human environment which I find really important." }, { "start": 1841.54, "end": 1845.8799999999999, "text": " So first of all, they have no cost for moving, which I guess is minor." }, { "start": 1845.8799999999999, "end": 1850.7, "text": " But second of all, they have no trade." }, { "start": 1850.7, "end": 1853.76, "text": " And I think that just kills the whole experiment." }, { "start": 1853.76, "end": 1857.96, "text": " Because now of course what you're going to get is the wealth is just going to be proportional" }, { "start": 1857.96, "end": 1863.44, "text": " to how much you get coins per house, which is different for each agent, right?" }, { "start": 1863.44, "end": 1870.74, "text": " So to me that that is now a pointless experiment if you can't trade because the outcome is" }, { "start": 1870.74, "end": 1872.0800000000002, "text": " just predictable." }, { "start": 1872.0800000000002, "end": 1879.1200000000001, "text": " And I don't think that the human behavior changes in response to the different tax brackets." }, { "start": 1879.1200000000001, "end": 1883.88, "text": " I think they'll just do and however they can make money, they'll make money, they'll build" }, { "start": 1883.88, "end": 1886, "text": " more houses until it becomes unprofitable." }, { "start": 1886, "end": 1887, "text": " And that's it." }, { "start": 1887, "end": 1892.88, "text": " So I don't see the I don't see the value of these experiments, even though they show that" }, { "start": 1892.88, "end": 1901.3600000000001, "text": " again, the AI economist outperforms the other tax strategies in this equality times productivity" }, { "start": 1901.3600000000001, "end": 1905.64, "text": " metric and also in another metric that they measure." }, { "start": 1905.64, "end": 1911.1000000000001, "text": " The second problem I have is for the human experiments, they take this distribution here," }, { "start": 1911.1000000000001, "end": 1915.2800000000002, "text": " they say, well, the AI, this is one of the distributions that the AI came up with." }, { "start": 1915.2800000000002, "end": 1921.44, "text": " But you notice the lack of the F you poor people, and the lack of this big spike here" }, { "start": 1921.44, "end": 1928.68, "text": " for the rich people, which I find are one of the two features of the other distribution." }, { "start": 1928.68, "end": 1933.04, "text": " So I think there's quite a bit of variance in what this AI comes up with." }, { "start": 1933.04, "end": 1934.88, "text": " Or maybe it's just because this is periodical." }, { "start": 1934.88, "end": 1941.06, "text": " But this is really confusing because they show and discuss that other distribution." }, { "start": 1941.06, "end": 1945.64, "text": " And now all of a sudden, they say, well, we use this distribution that was also created" }, { "start": 1945.64, "end": 1946.68, "text": " by our AI." }, { "start": 1946.68, "end": 1950.16, "text": " And it seems to be qualitatively quite different." }, { "start": 1950.16, "end": 1958.28, "text": " In any case, let's look at how the humans behave under the different strategies." }, { "start": 1958.28, "end": 1964.2, "text": " So in the size formula, you'll see that the light blue person here is kind of spreading" }, { "start": 1964.2, "end": 1966.52, "text": " out a bit, probably playing correctly." }, { "start": 1966.52, "end": 1969.68, "text": " Everyone else is just neatly building their houses." }, { "start": 1969.68, "end": 1970.68, "text": " Humans are so territorial." }, { "start": 1970.68, "end": 1974.64, "text": " And most of them, they kind of stay in their little corner." }, { "start": 1974.64, "end": 1976.6000000000001, "text": " And they're like, this is my corner." }, { "start": 1976.6, "end": 1981.48, "text": " I'm going to build my houses here in a nice thing." }, { "start": 1981.48, "end": 1987.1999999999998, "text": " And under the AI economist, again, you don't really see a different thing just because" }, { "start": 1987.1999999999998, "end": 1989.36, "text": " the taxes are different." }, { "start": 1989.36, "end": 1992.1999999999998, "text": " The qualitative behavior is quite the same." }, { "start": 1992.1999999999998, "end": 1994.8, "text": " It's just building straight lines." }, { "start": 1994.8, "end": 1997.98, "text": " And I think the difference is more between the humans." }, { "start": 1997.98, "end": 2000.36, "text": " So I think it's not always the same humans." }, { "start": 2000.36, "end": 2003.36, "text": " And the difference might be more between the humans." }, { "start": 2003.36, "end": 2009.6399999999999, "text": " And you kind of see that humans clearly haven't really trained or discovered the optimal strategy." }, { "start": 2009.6399999999999, "end": 2011.3999999999999, "text": " They're just doing something." }, { "start": 2011.3999999999999, "end": 2015.08, "text": " And what you're seeing is just a result of the taxation." }, { "start": 2015.08, "end": 2016.08, "text": " It's not different behavior." }, { "start": 2016.08, "end": 2018.7199999999998, "text": " And this here, this is the best." }, { "start": 2018.7199999999998, "end": 2023.08, "text": " Okay, watch the on the bottom right, the human." }, { "start": 2023.08, "end": 2030, "text": " They're just first they do something, they're just walling up the other players." }, { "start": 2030, "end": 2034.04, "text": " And look, this is this is the best." }, { "start": 2034.04, "end": 2037.52, "text": " I am going to build a big beautiful wall." }, { "start": 2037.52, "end": 2041.72, "text": " And I'm going to have the orange guy pay for it." }, { "start": 2041.72, "end": 2043.88, "text": " It's Donald Trump in the game." }, { "start": 2043.88, "end": 2044.88, "text": " Amazing." }, { "start": 2044.88, "end": 2050.4, "text": " And look at the end, they actually managed to lock in the other players so they can't" }, { "start": 2050.4, "end": 2052.2, "text": " move anymore." }, { "start": 2052.2, "end": 2054.44, "text": " Donald Trump wins." }, { "start": 2054.44, "end": 2055.44, "text": " Amazing." }, { "start": 2055.44, "end": 2061.88, "text": " And though, actually, the yellow player appears to win economy wise." }, { "start": 2061.88, "end": 2066.6, "text": " But what do you want with lots of money if you can't move?" }, { "start": 2066.6, "end": 2072.54, "text": " So I again, I find these human experiments to be rather pointless here because you disable" }, { "start": 2072.54, "end": 2077.32, "text": " trade and you don't train the humans to find a good strategy." }, { "start": 2077.32, "end": 2083.86, "text": " Alright, but in that, I find the entire paper to be pretty cool code is going to be released," }, { "start": 2083.86, "end": 2088.8, "text": " they promise and they have checked that they have no ethical problems." }, { "start": 2088.8, "end": 2093, "text": " Of course, I invite you to check out the paper." }, { "start": 2093, "end": 2099.76, "text": " If you like content like this, please subscribe, share and leave a comment of what you think." }, { "start": 2099.76, "end": 2114.44, "text": " Thank you so much for listening and bye bye." } ]
jhCInVFE2sc
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Deconstructing Lottery Tickets: Zeros, Signs, and the Supermask (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "initialization", "mask", "arxiv", "uber", "training", "subnetwork", "overparameterization", "zero", "frozen", "weights" ]
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 super mask by Hadi Jo, Janis Lan, Rosanne Liu and Jason Yosinski of Uber.ai. So this is a follow-up 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 sub networks 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 sub network must be initialized at the same place as the full network. 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 sub network. 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 sub networks or the proposition. And the lottery ticket algorithm is the process by which you obtain these so-called winning tickets. Again, the full 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 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 wi which is the initial value of the weight. Now this is randomly initialized, right? So here is zero and you randomly initialize these weights in the neural networks. So this number is random. The wf 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 value of 3 before training and then after training it went to a value of 1, right? So it got initialized at 3 and SGD thought no it's better at 1. Why? So you see that there is an ellipsis here. Why is there an ellipsis? That's because very often the initial and the final weight value are positively correlated. So if a weight initially was positive it tends to also be positive at 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 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 an 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 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 we'll 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. Denote 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 p percent to one and the bottom 100 minus p percent to zero. So this masking criterion here is now how you select the weights to be in the winning ticket basically. So 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 is a mask one action and a mask zero action which is describing what happens to the weights 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, 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 marked for training in the next round but you can think of different things. So this paper will experiment with all of these three steps basically. Step two, step three and step four and decide on what's important and what isn't. So first they go with the mask criteria. This is the criteria how do we select which weights we should retain and which ones we shouldn't. So think of it. We have our full network, we have trained it to completion and for each weight we know its initial and its 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 plot 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 see the y threshold stays the same but it is inverted. We retain the weights that are inside of the threshold. This is a control criterion just to kind of do the opposite of what the initial paper did. Large init ignores the final value and simply goes on the initial value of the weight. As you can see here now the threshold is on the x axis and the same for small init, the control case for that. Then there is a large init 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 threshold 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 init 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. This depicted here 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. The 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 they don't do the absolute values before they subtract so it's basically everything above this diagonal. So you 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. Now 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. And the 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 claim here that this is significant. Because it's just in one plot in one network on one data set. So if you want to make the claim that the magnitude increase works better than the large final maybe. What you can say for sure is 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. 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 additional irrelevant criterion. So 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. All right. 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-init which basically means we set them back to the beginning of the optimization procedure. That is what the original algorithm does. We can reshuffle 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 constant. 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. Now ran sign means a random sign which basically means we reshuffle or we initialize to the constant. The constant will be 50-50 whether it's plus or minus alpha. The reshuffle will mean we don't care how we shuffle the weights as long as we shuffled the same weights somehow. With in it sign what they mean is that they make sure that the sign of the weight that is reinitialized is equal to the sign of the weight in the final train network. So they're basically saying that this weight is positive in the winning ticket so we should initialize them to a positive sign. That means that all the alpha in this case here is going to be a plus alpha if the original weight was a positive weight and a negative alpha if the original weight was a negative weight. Also here the shuffling will only happen between the positive and the negative weights. Now this might actually be at initial not at final but they are extremely correlated so there shouldn't be a big difference. So these perform all about at the same level which again is interesting. The authors here claim that it's just about the sign so the important part here seems to be the sign. I disagree with that. 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. Those two things are closer together than a random plus or minus alpha. In expectation they will be close together. Also with the reshuffle basically what with this in it sign thing what you ensure is that your initialization is closer to this one here. So it will be more like the large final initialization where you rewind the weights. 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 basin 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. By matching the sign you already make them closer in expectation and that's why it might work. Also stop testing at 0.005 significance level with five runs. That's no. All right so the last thing they do is the mask zero 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 accuracy. These are the black lines and then the blue lines are set the mask zero weights to zero. So forget about them. Don't include them which is what the original algorithm did. So that's why you see this plot right here. And these are the blue lines and as you can see in the original paper this outperforms the original network at first. And then as you prune more and more and more here you just have whatever 1.2 percent 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. And here they try to allude that by the numbers they put here. So 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 zero. 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 ones that you that you mask. 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. So it's below the especially here you can see it's below the original algorithm where you set it to zero. This is very interesting I think because and I think that's just because you introduce 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 in magnitude. So the optimal value for those weights seems to be close to zero. So by setting them to zero the original lottery ticket algorithm basically freezes them at their optimal position. And if you freeze them to any other position right away from zero then that means you have a less optimal configuration here. And 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 zero 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. We'll set it to its initial value but if it moved down so it's lower then we'll set it to zero right. So you have the an additional threshold of how it moved 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 regions where you really have low weights. Then it come up with a further variant where they also do the same thing to the trainable weights. So these trainable weights up here 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 zero those ones because they were too high initially and that performs even better sometimes right. And again I don't see this as an algorithm where it's set to zero or set to high. It's simply because you were again setting something closer to its optimal value. During training if a weight that is trainable during training 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 zero you end up at a point that is closer in magnitude 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 over interpreted by the authors and ultimately it's just about getting the weights close to 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. The last section here they call super masks and now super masks are 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 MNIST 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 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 masked network is 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 they do 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 percent accuracy on MNIST and it also reaches non negligible accuracy on CIFAR 10 so 20 percent. 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 CIFAR 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 at the mask also agrees with the signs so that you have a sign criteria 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 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 CIFAR 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 CIFAR 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. And the easier the task, 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 CIFAR 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. Right, 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, to some kind of optimal lottery ticket. And I think the experiments here are very cool, are very well designed, but I think they're often a bit over interpreted. Alright, that was it for me. I invite you to check out the paper and bye bye.
[ { "start": 0, "end": 8, "text": " Hi there! Today we're looking at deconstructing lottery tickets, zeros, signs and the super mask by Hadi Jo, Janis Lan," }, { "start": 8, "end": 17, "text": " Rosanne Liu and Jason Yosinski of Uber.ai. So this is a follow-up paper to the original paper that was called" }, { "start": 17, "end": 24, "text": " the lottery ticket hypothesis. I have done a video on that paper, so if you don't know what the lottery ticket" }, { "start": 24, "end": 32, "text": " hypothesis is, I suggest you go watch it. Just very quickly, very quickly, the lottery ticket hypothesis states" }, { "start": 32, "end": 40, "text": " the following. If you have a neural network that has, let's say it has these layers and has some weights," }, { "start": 40, "end": 49, "text": " lottery ticket hypothesis states that there are a subset of weights that are significantly less number of weights" }, { "start": 49, "end": 61, "text": " than in the original network. A subset of weights are already enough for this network to be trained in a successful" }, { "start": 61, "end": 70, "text": " fashion. So there are sub networks here. If you train them, you will get the same or even higher accuracy" }, { "start": 70, "end": 81, "text": " than if you train the full network. Now, the intrinsic part here is that the sub network must be initialized" }, { "start": 81, "end": 88, "text": " at the same place as the full network. So with that goes the lottery ticket algorithm. The lottery ticket" }, { "start": 88, "end": 100, "text": " algorithm is the following. First, train the full network. Second, select the largest weights. Select the" }, { "start": 100, "end": 116, "text": " largest weights at the end of the training. And then third, reset the weights to their initial value. And this needs to be" }, { "start": 116, "end": 127, "text": " the same initial value at which you initialize them at step one. And then train. So once you have the desired" }, { "start": 127, "end": 136, "text": " weights, these ones, right, you need to reset them to their original value before training. And then you can" }, { "start": 136, "end": 144, "text": " retrain just the small sub network. And that will work the same or better than the original network. So it's basically" }, { "start": 144, "end": 151, "text": " a pruning technique. So this is the lottery ticket hypothesis, the fact that there are these sub networks or the" }, { "start": 151, "end": 160, "text": " proposition. And the lottery ticket algorithm is the process by which you obtain these so-called winning" }, { "start": 160, "end": 172, "text": " tickets. Again, the full video will make this clearer. So this paper is going to shine some light on different" }, { "start": 172, "end": 180, "text": " aspects of these winning tickets and what is really important and what isn't and how you can obtain even better" }, { "start": 180, "end": 192, "text": " ones. So they often show the following 2D plots here. And these 2D plots will spend like a little time understanding" }, { "start": 192, "end": 200, "text": " them. There is two dimensions here and each one of these plots represents a single weight in the neural network." }, { "start": 200, "end": 209, "text": " So a single weight is just one floating point number, right? On the x-axis you have wi which is the initial value" }, { "start": 209, "end": 216, "text": " of the weight. Now this is randomly initialized, right? So here is zero and you randomly initialize these" }, { "start": 216, "end": 229, "text": " weights in the neural networks. So this number is random. The wf is on the y-axis and that is the final value of" }, { "start": 229, "end": 244, "text": " the weight. This is after training, right? This is trained. So if a point is for example here, that means it had this" }, { "start": 244, "end": 253, "text": " value of 3 before training and then after training it went to a value of 1, right? So it got initialized at 3 and SGD" }, { "start": 253, "end": 262, "text": " thought no it's better at 1. Why? So you see that there is an ellipsis here. Why is there an ellipsis? That's" }, { "start": 262, "end": 272, "text": " because very often the initial and the final weight value are positively correlated. So if a weight initially" }, { "start": 272, "end": 281, "text": " was positive it tends to also be positive at final. And that's just because of the nature of SGD. It just takes" }, { "start": 281, "end": 290, "text": " little steps and basically tries to do as little effort as possible in order to reach its goal, right? It always" }, { "start": 290, "end": 299, "text": " just goes downhill in a greedy fashion and that means probably if it can it will elect to not move the weights" }, { "start": 299, "end": 306, "text": " too far from their initial position or the position of the previous step. So that's why they're correlated and that's" }, { "start": 306, "end": 315, "text": " why you have an ellipsis. But they don't have to be. That's just the author superimposing their kind of view." }, { "start": 315, "end": 325, "text": " So then they say what happens during these lottery ticket pruning is in the original algorithm, right? You had" }, { "start": 325, "end": 334, "text": " the following pruning technique. You would select all the weights that at the end of the training had a certain" }, { "start": 334, "end": 341, "text": " magnitude or higher. And that's this here. So on the y-axis which is the final weight you define a threshold" }, { "start": 341, "end": 352, "text": " here and everything that is smaller magnitude than the threshold you mask to zero, right? You prune away." }, { "start": 352, "end": 360, "text": " You don't want to retain. But everything that is above that either positively or negatively you mask to one" }, { "start": 360, "end": 371, "text": " which means that you retain it in the winning ticket. So the light regions here will be the regions where you set" }, { "start": 371, "end": 381, "text": " 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" }, { "start": 381, "end": 394, "text": " was initially here but then it traveled to here during the training then sorry, of course, initially," }, { "start": 394, "end": 400, "text": " well if the y-axis is the process during training and we'll visualize this here then we'll say initially it was" }, { "start": 400, "end": 410, "text": " here, right? Initially it was here and then in subsequent steps it traveled over this line. Then we would retain" }, { "start": 410, "end": 420, "text": " it because its final value was higher than the threshold. All right. So this paper generalizes the lottery ticket" }, { "start": 420, "end": 428, "text": " algorithm. It states it in a bit of a convoluted way but just to go quickly over it, it says first initialize a mask" }, { "start": 428, "end": 435, "text": " to all ones, randomly initialize the parameters of the network like this. Now to convolve it with the mask here" }, { "start": 435, "end": 442, "text": " is a bit superfluous because it's all ones but they do it for consistency. Then they say train the parameters" }, { "start": 442, "end": 449, "text": " of the network to completion. Denote the initial weights before training by wi, that's what we saw in the plot," }, { "start": 449, "end": 459, "text": " and the final weights by wf. Then here is the first generalization. Use the mask criterion m to produce a masking" }, { "start": 459, "end": 465, "text": " score for each currently unmasked weight. Rank the weights in each layer by their scores. Set the mask value" }, { "start": 465, "end": 475, "text": " for the top p percent to one and the bottom 100 minus p percent to zero. So this masking criterion here is now" }, { "start": 475, "end": 488, "text": " how you select the weights to be in the winning ticket basically. So you select the weights that you want" }, { "start": 488, "end": 497, "text": " to be part of that trainable sub network. In the original lottery ticket algorithm this was simply the absolute value" }, { "start": 497, "end": 506, "text": " as you can see here. Then they say there is a mask one action and a mask zero action which is describing what" }, { "start": 506, "end": 515, "text": " happens to the weights that are part of the winning ticket and what happens to the weights that aren't part of the" }, { "start": 515, "end": 522, "text": " winning ticket. Now to the second one first. The weights that aren't part of the winning ticket in the original algorithm" }, { "start": 522, "end": 528, "text": " they were just pruned, set to zero and frozen during any subsequent training. That's what we looked at before." }, { "start": 528, "end": 534, "text": " But you can think of different things like setting them to a constant value and just not training them." }, { "start": 534, "end": 543, "text": " The common thing is that they are masked to zero so they will not be trained but you can still kind of retain them" }, { "start": 543, "end": 550, "text": " at like a constant value or a random value something like this. And same for the mask one. All it means here" }, { "start": 550, "end": 560, "text": " is that they will be trained. In the original algorithm these weights were reset to their initial values" }, { "start": 560, "end": 568, "text": " and marked for training in the next round but you can think of different things. So this paper will experiment" }, { "start": 568, "end": 575, "text": " with all of these three steps basically. Step two, step three and step four and decide on what's important" }, { "start": 575, "end": 583, "text": " and what isn't. So first they go with the mask criteria. This is the criteria how do we select which weights" }, { "start": 583, "end": 591, "text": " we should retain and which ones we shouldn't. So think of it. We have our full network, we have trained it" }, { "start": 591, "end": 599, "text": " to completion and for each weight we know its initial and its final value. And based on that we now need to" }, { "start": 599, "end": 606, "text": " make a decision. Should this particular weight be included in the winning ticket or shouldn't it?" }, { "start": 606, "end": 613, "text": " The original paper as we said simply took the absolute value of the final weight completely ignoring the original weight." }, { "start": 613, "end": 625, "text": " So they do experiment with different things. First and you can see this in the plot here. Large final is what we had" }, { "start": 625, "end": 634, "text": " and we saw this. Small final is this score here which is just retain the weights that have a small final value." }, { "start": 634, "end": 642, "text": " You see the y threshold stays the same but it is inverted. We retain the weights that are inside of the threshold." }, { "start": 642, "end": 653, "text": " This is a control criterion just to kind of do the opposite of what the initial paper did. Large init ignores the final value" }, { "start": 653, "end": 663, "text": " and simply goes on the initial value of the weight. As you can see here now the threshold is on the x axis" }, { "start": 663, "end": 672, "text": " and the same for small init, the control case for that. Then there is a large init large final where you say" }, { "start": 672, "end": 681, "text": " okay I only retain a weight if it both was large at initialization and large in the final value." }, { "start": 681, "end": 692, "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 threshold" }, { "start": 692, "end": 699, "text": " you will simply make the thresholds lower and then that region up here that you retain will become larger" }, { "start": 699, "end": 706, "text": " to reach the same percentage of weights retained. So that's something you have to keep in mind." }, { "start": 706, "end": 716, "text": " To control case small init small final. Then the interesting case here magnitude increase which means all everywhere" }, { "start": 716, "end": 724, "text": " where the final weight is larger than the initial weight or the ranking score is basically based on how much you move." }, { "start": 724, "end": 735, "text": " This depicted here if a weight was originally here it just needs to be larger, it just needs to be above that." }, { "start": 735, "end": 748, "text": " So basically it needs to be above the diagonal here. The diagonal are basically weights that are as high in the final trained version" }, { "start": 748, "end": 755, "text": " as they were at initialization and everything above this here or of course below this here." }, { "start": 755, "end": 765, "text": " So you need to think of a second one here and then everything in this region and in this region magnitude wise" }, { "start": 765, "end": 771, "text": " will fulfill that criterion and then movement simply describes how far they move." }, { "start": 771, "end": 781, "text": " Now this is the same as the magnitude increase but just they don't do the absolute values before they subtract" }, { "start": 781, "end": 788, "text": " so it's basically everything above this diagonal. So you don't look at how much the magnitude increase" }, { "start": 788, "end": 802, "text": " 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": 802, "end": 814, "text": " And then random you simply mask at random this is a control case. So our focus is going to be on the following" }, { "start": 814, "end": 825, "text": " the large final which is the original right. The large in it might be interesting, the large in it large final might be interesting" }, { "start": 825, "end": 835, "text": " and the magnitude increase might be interesting. Now what do they find? We'll go to the plot with the most effects." }, { "start": 835, "end": 843, "text": " The star here is simply a significance indicator so disregard the stars for now." }, { "start": 843, "end": 853, "text": " The magnitude increase tends to perform the best as you can see. Magnitude increase and compare that to large final." }, { "start": 853, "end": 862, "text": " Large final is the original algorithm. Magnitude increase tends to perform better than the large final." }, { "start": 862, "end": 872, "text": " Interestingly but if you look across the experiments it doesn't tend to do that consistently or often" }, { "start": 872, "end": 880, "text": " and there are these effects here when you go to really small networks. And the stars I said disregard them." }, { "start": 880, "end": 888, "text": " They are significance indicators for a t-test but the t-test is just across five samples and what you're seeing here" }, { "start": 888, "end": 896, "text": " is not a standard deviation but the min and max over the five runs. So I see there might be an effect here" }, { "start": 896, "end": 908, "text": " but I'm absolutely not trusting the claim here that this is significant." }, { "start": 908, "end": 916, "text": " Because it's just in one plot in one network on one data set." }, { "start": 916, "end": 924, "text": " So if you want to make the claim that the magnitude increase works better than the large final maybe." }, { "start": 924, "end": 936, "text": " What you can say for sure is that things like large in it they don't work. We don't really care." }, { "start": 936, "end": 945, "text": " Interestingly large in it large final doesn't work as well as you can see here. It kind of goes below these." }, { "start": 945, "end": 956, "text": " I just think that's what I said. By imposing two thresholds each of them needs to be lower than the original threshold." }, { "start": 956, "end": 967, "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" }, { "start": 967, "end": 978, "text": " than the ones that are only thresholding on large final and therefore it's just an additional irrelevant criterion." }, { "start": 978, "end": 988, "text": " So those are the results but basically you can see that it really tends to be, in my opinion," }, { "start": 988, "end": 998, "text": " 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." }, { "start": 998, "end": 1009, "text": " I think it pretty much measures the same thing as the large final and I don't really see that it outperforms." }, { "start": 1009, "end": 1020, "text": " All right. Then they go over the mask one actions and the mask one actions remember these are how should we treat the weights" }, { "start": 1020, "end": 1029, "text": " that we have selected to be in the winning ticket. Now we can do the following things. We can re-init which basically means" }, { "start": 1029, "end": 1036, "text": " we set them back to the beginning of the optimization procedure. That is what the original algorithm does." }, { "start": 1036, "end": 1049, "text": " We can reshuffle 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": 1049, "end": 1058, "text": " That guarantees us that the same weight distribution is still followed but it's not that each weight is at the original weight." }, { "start": 1058, "end": 1067, "text": " 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": 1067, "end": 1081, "text": " And then constant it just means we'll set them to some constant. So either we set them to a negative or a positive constant" }, { "start": 1081, "end": 1093, "text": " and then the weights that are masked to zero will become a zero. So here are the results." }, { "start": 1093, "end": 1103, "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": 1103, "end": 1111, "text": " The blue curve is rewind with large final. Now that is the original algorithm." }, { "start": 1111, "end": 1121, "text": " The orange is reshuffle in it sign and the red is constant in it sign. Now what does in it sign mean?" }, { "start": 1121, "end": 1128, "text": " You see that these things will perform well if they have this in it sign instead of ran sign." }, { "start": 1128, "end": 1136, "text": " Now ran sign means a random sign which basically means we reshuffle or we initialize to the constant." }, { "start": 1136, "end": 1142, "text": " The constant will be 50-50 whether it's plus or minus alpha." }, { "start": 1142, "end": 1151, "text": " The reshuffle will mean we don't care how we shuffle the weights as long as we shuffled the same weights somehow." }, { "start": 1151, "end": 1165, "text": " With in it sign what they mean is that they make sure that the sign of the weight that is reinitialized" }, { "start": 1165, "end": 1174, "text": " is equal to the sign of the weight in the final train network." }, { "start": 1174, "end": 1187, "text": " So they're basically saying that this weight is positive in the winning ticket so we should initialize them to a positive sign." }, { "start": 1187, "end": 1201, "text": " That means that all the alpha in this case here is going to be a plus alpha if the original weight was a positive weight" }, { "start": 1201, "end": 1204, "text": " and a negative alpha if the original weight was a negative weight." }, { "start": 1204, "end": 1209, "text": " Also here the shuffling will only happen between the positive and the negative weights." }, { "start": 1209, "end": 1217, "text": " Now this might actually be at initial not at final but they are extremely correlated so there shouldn't be a big difference." }, { "start": 1217, "end": 1222, "text": " So these perform all about at the same level which again is interesting." }, { "start": 1222, "end": 1230, "text": " The authors here claim that it's just about the sign so the important part here seems to be the sign." }, { "start": 1230, "end": 1232, "text": " I disagree with that." }, { "start": 1232, "end": 1241, "text": " I think what's happening here is if you do these things what you'll do is you'll automatically be closer." }, { "start": 1241, "end": 1245, "text": " Let's actually give a benefit of the doubt here and you say this is the initial." }, { "start": 1245, "end": 1256, "text": " What you'll do is if you do plus alpha only if the initial weight was positive they will be closer together." }, { "start": 1256, "end": 1263, "text": " Those two things are closer together than a random plus or minus alpha." }, { "start": 1263, "end": 1266, "text": " In expectation they will be close together." }, { "start": 1266, "end": 1279, "text": " Also with the reshuffle basically what with this in it sign thing what you ensure is that your initialization is closer to this one here." }, { "start": 1279, "end": 1286, "text": " So it will be more like the large final initialization where you rewind the weights." }, { "start": 1286, "end": 1290, "text": " I don't think you can make the claim it's just about the sign." }, { "start": 1290, "end": 1301, "text": " I would guess that any algorithm that makes the weights closer to this original lottery ticket thing will also perform well." }, { "start": 1301, "end": 1312, "text": " What is true and that's what the author says that the basin of attraction seems to be much larger than you have to exactly hit the original weights." }, { "start": 1312, "end": 1319, "text": " But I think this effect here is not at all about the sign and just about the fact that you make them closer." }, { "start": 1319, "end": 1327, "text": " By matching the sign you already make them closer in expectation and that's why it might work." }, { "start": 1327, "end": 1336, "text": " Also stop testing at 0.005 significance level with five runs." }, { "start": 1336, "end": 1339, "text": " That's no." }, { "start": 1339, "end": 1346, "text": " All right so the last thing they do is the mask zero actions." }, { "start": 1346, "end": 1353, "text": " Basically how do we treat the weights that we want to get rid of that are not part of the trainable winning ticket." }, { "start": 1353, "end": 1359, "text": " So they experiment with different things." }, { "start": 1359, "end": 1363, "text": " They say okay here is the original network." }, { "start": 1363, "end": 1366, "text": " It's at a certain accuracy." }, { "start": 1366, "end": 1373, "text": " These are the black lines and then the blue lines are set the mask zero weights to zero." }, { "start": 1373, "end": 1375, "text": " So forget about them." }, { "start": 1375, "end": 1379, "text": " Don't include them which is what the original algorithm did." }, { "start": 1379, "end": 1382, "text": " So that's why you see this plot right here." }, { "start": 1382, "end": 1391, "text": " And these are the blue lines and as you can see in the original paper this outperforms the original network at first." }, { "start": 1391, "end": 1397, "text": " And then as you prune more and more and more here you just have whatever 1.2 percent of the weights." }, { "start": 1397, "end": 1399, "text": " Then it finally gets worse." }, { "start": 1399, "end": 1403, "text": " Now you can do original sorry different actions." }, { "start": 1403, "end": 1407, "text": " One of them is set them to their initial values." }, { "start": 1407, "end": 1414, "text": " And here they try to allude that by the numbers they put here." }, { "start": 1414, "end": 1423, "text": " So this thing here means whatever you don't mask put it to the initial value which is this i plus." }, { "start": 1423, "end": 1428, "text": " And this means set everything else to zero." }, { "start": 1428, "end": 1434, "text": " Now this thing here means set it to this to the initial value and also set this to the initial value." }, { "start": 1434, "end": 1437, "text": " So set everything to the initial value." }, { "start": 1437, "end": 1441, "text": " Just don't train the ones that you that you mask." }, { "start": 1441, "end": 1447, "text": " So now you end up with a network where some of the connections are simply frozen at their original value." }, { "start": 1447, "end": 1453, "text": " And that as you can see performs worse often." }, { "start": 1453, "end": 1461, "text": " So it's below the especially here you can see it's below the original algorithm where you set it to zero." }, { "start": 1461, "end": 1471, "text": " This is very interesting I think because and I think that's just because you introduce some noise signal in there." }, { "start": 1471, "end": 1483, "text": " So you introduce some unnecessary signal and the authors here claim well these weights you mask them because they were small in magnitude." }, { "start": 1483, "end": 1489, "text": " So the optimal value for those weights seems to be close to zero." }, { "start": 1489, "end": 1499, "text": " So by setting them to zero the original lottery ticket algorithm basically freezes them at their optimal position." }, { "start": 1499, "end": 1511, "text": " And if you freeze them to any other position right away from zero then that means you have a less optimal configuration here." }, { "start": 1511, "end": 1515, "text": " And I can believe that I can follow that." }, { "start": 1515, "end": 1517, "text": " Not fully convinced but I can follow." }, { "start": 1517, "end": 1527, "text": " So they they come up with a cool experiment what I think is that they they say for all the weights that we mask." }, { "start": 1527, "end": 1535, "text": " We're going to set the ones below this line to zero and the ones above them to their initial value." }, { "start": 1535, "end": 1546, "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." }, { "start": 1546, "end": 1557, "text": " 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." }, { "start": 1557, "end": 1560, "text": " The masking threshold is here so it's not included in the ticket but it moved up." }, { "start": 1560, "end": 1569, "text": " We'll set it to its initial value but if it moved down so it's lower then we'll set it to zero right." }, { "start": 1569, "end": 1577, "text": " So you have the an additional threshold of how it moved during training that's the line here." }, { "start": 1577, "end": 1588, "text": " You can see this here and that often performs better than the original ticket algorithm." }, { "start": 1588, "end": 1596, "text": " Not much and it mainly tends to be in the regions where you really have low weights." }, { "start": 1596, "end": 1601, "text": " Then it come up with a further variant where they also do the same thing to the trainable weights." }, { "start": 1601, "end": 1613, "text": " So these trainable weights up here 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, "end": 1621, "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." }, { "start": 1621, "end": 1632, "text": " We're going to set the ones to zero those ones because they were too high initially and that performs even better sometimes right." }, { "start": 1632, "end": 1640, "text": " And again I don't see this as an algorithm where it's set to zero or set to high." }, { "start": 1640, "end": 1647, "text": " It's simply because you were again setting something closer to its optimal value." }, { "start": 1647, "end": 1661, "text": " During training if a weight that is trainable during training went down a bit that means that its optimal value is lower than it originally was." }, { "start": 1661, "end": 1681, "text": " And it can just be that by setting it to zero you end up at a point that is closer in magnitude to the optimal value than at the initial point." }, { "start": 1681, "end": 1703, "text": " So I think my comment here is that a lot of these things I think are a bit over interpreted by the authors and ultimately it's just about getting the weights close to where their optimal value is either at the beginning or at the end of the training." }, { "start": 1703, "end": 1710, "text": " And I think the original lottery ticket paper already did a good job analyzing that." }, { "start": 1710, "end": 1732, "text": " The last section here they call super masks and now super masks are is a thing where they say hey if we have a mask can't we just apply this to the original untrained network." }, { "start": 1732, "end": 1750, "text": " 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 MNIST you have a 10% chance because there are 10 classes right." }, { "start": 1750, "end": 1765, "text": " 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." }, { "start": 1765, "end": 1780, "text": " 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 the masking action it will mask weights that are not part of the winning ticket." }, { "start": 1780, "end": 1800, "text": " It will retain weights that are part of the winning ticket. Weights tend to not move that much by SGD. So basically the masked network is at a place closer to its optimal value than the unmasked network and therefore it will perform better." }, { "start": 1800, "end": 1814, "text": " So I think their findings are fairly easy to interpret here. And the last thing they do is they say can we optimize these masks. Can we train the mask." }, { "start": 1814, "end": 1832, "text": " 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." }, { "start": 1832, "end": 1846, "text": " 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, "end": 1862, "text": " So interestingly, interestingly the if you apply the mask of the lottery ticket just at the beginning of training without training the network." }, { "start": 1862, "end": 1875, "text": " You can see here that it already reaches whatever 40 percent accuracy on MNIST and it also reaches non negligible accuracy on CIFAR 10 so 20 percent." }, { "start": 1875, "end": 1891, "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." }, { "start": 1891, "end": 1907, "text": " 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." }, { "start": 1907, "end": 1915, "text": " 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." }, { "start": 1915, "end": 1927, "text": " 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 CIFAR 10." }, { "start": 1927, "end": 1935, "text": " So if you train the mask, if you if you just apply the mask, you get non random performance better than random." }, { "start": 1935, "end": 1948, "text": " If you look at the mask also agrees with the signs so that you have a sign criteria where you say I'm only going to take the initial weights into the mask." }, { "start": 1948, "end": 1956, "text": " If they have the same sign as the end weights, then you get a better performing initial sub network." }, { "start": 1956, "end": 1966, "text": " 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, "end": 1977, "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." }, { "start": 1977, "end": 1992, "text": " But what you can see here is that the effect on MNIST is appears to be very high between these two." }, { "start": 1992, "end": 1999, "text": " And the effect on CIFAR 10 seems to be different. It seems to be low between these two and then high between these two." }, { "start": 1999, "end": 2012, "text": " 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." }, { "start": 2012, "end": 2020, "text": " And then they put the following table. So here you have the different networks." }, { "start": 2020, "end": 2037, "text": " 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": 2037, "end": 2047, "text": " And you can see here that the MNIST even outperforms the original trained weights simply by learning the mask." }, { "start": 2047, "end": 2052, "text": " Now you can also see that on CIFAR 10, this effect is not present." }, { "start": 2052, "end": 2062, "text": " And I've already seen a paper that states that on like ResNets and ImageNet, the lottery ticket hypothesis isn't really measurable." }, { "start": 2062, "end": 2076, "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" }, { "start": 2076, "end": 2085, "text": " or being trained well, if the task is sufficiently easy. And the easier the task, the more you can basically do with it." }, { "start": 2085, "end": 2098, "text": " 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": 2098, "end": 2110, "text": " Where CIFAR 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, "end": 2124, "text": " Right, 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, to some kind of optimal lottery ticket." }, { "start": 2124, "end": 2134, "text": " And I think the experiments here are very cool, are very well designed, but I think they're often a bit over interpreted." }, { "start": 2134, "end": 2155, "text": " Alright, that was it for me. I invite you to check out the paper and bye bye." } ]
h9w3KffPPmQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Rant] Online Conferences
[ "Science & Technology" ]
[ "machine learning", "deep learning", "online", "conference", "iclr", "virtual", "research" ]
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! Janek here. Okay, that is stolen. Today I want to give some quick thoughts about online conferences. As you might know, iClear 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. iClear 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 gonna have to sacrifice that. I know there are efforts but let's be real. So there are paper presentations and there are things like talks, panels, workshops and so on. For the papers in iClear what they have is they have a website and you can kind of click on each of the papers. You'll get to a sub page and you'll find a video that the authors uploaded 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 people can come there and kind of chat about the paper at a given time. What people have pointed out here and 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 what are we doing here? I 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's 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. It can be five minutes. It can be 30 minutes. You put it on YouTube. You link to your paper your abstract and your reviews you can put them in the description and then okay there's no live chat but there is a comment section. I appreciate all of you 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 have you already have pre-recorded talks. What are you doing having them compete with other things at the same time? Like okay I'm going to go to this workshop but this one's happening too. Right now I have to go and decide 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 do Reddit 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 could 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 Joshua Benjo is in a panel in a live conference you'll be lucky to even get a single question in 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 poster session 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 weasel out 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. It's a lot of work to build this website and so on but we have YouTube and Reddit and that already covers like 95% of what this is doing. I always think of this, I don't know if it's a myth, when the car was first invented it still had the pulleys to pull the horse because people were just used to horse buggies and not cars. It seems like we're doing the same thing with online conferences. We were just so used to the live conferences that we don't see the mega possibilities that we have online. These are my thoughts on online conferences. If you agree, disagree, leave a comment and maybe in the future we'll go to true online conferences asynchronous. Thank you for being here and bye bye.
[ { "start": 0, "end": 7.08, "text": " Hey, machine learners! Janek here. Okay, that is stolen. Today I want to give some quick" }, { "start": 7.08, "end": 12.88, "text": " thoughts about online conferences. As you might know, iClear this year is fully online" }, { "start": 12.88, "end": 18.56, "text": " because of the global situation. Big props to the organizers of the conference for putting" }, { "start": 18.56, "end": 24.32, "text": " something together in this short amount of time. iClear is one of the largest machine" }, { "start": 24.32, "end": 29.6, "text": " learning conferences and if you're not registered you don't get access to that website right" }, { "start": 29.6, "end": 34.160000000000004, "text": " now. So today I'll just talk about things that are public and we'll do like analysis" }, { "start": 34.160000000000004, "end": 39.84, "text": " of what happened when the materials are actually released. If you want to run an online conference" }, { "start": 39.84, "end": 45.2, "text": " there are basically two things you need to take care of. Actually three. One of them is networking" }, { "start": 45.2, "end": 50.24, "text": " but it's going to be online. We're gonna have to sacrifice that. I know there are efforts but" }, { "start": 51.040000000000006, "end": 57.2, "text": " let's be real. So there are paper presentations and there are things like talks, panels, workshops" }, { "start": 57.2, "end": 63.6, "text": " and so on. For the papers in iClear what they have is they have a website and you can kind of click" }, { "start": 63.6, "end": 68.8, "text": " on each of the papers. You'll get to a sub page and you'll find a video that the authors uploaded" }, { "start": 68.8, "end": 75.84, "text": " which is about five minutes long. You'll get the abstract and the reviews directly there from open" }, { "start": 75.84, "end": 83.12, "text": " review and during the poster sessions you'll have a chat window where you can chat with the authors" }, { "start": 83.12, "end": 88.88000000000001, "text": " and so people can come there and kind of chat about the paper at a given time. What people have" }, { "start": 88.88000000000001, "end": 94.64, "text": " pointed out here and I agree is that watching a five minute video often you need like two or three" }, { "start": 94.64, "end": 100, "text": " minutes of that video to even see whether you're interested in the paper which is much longer than" }, { "start": 100, "end": 105.60000000000001, "text": " you would have at a poster. At a poster you could clearly see people say they just open the pdf and" }, { "start": 105.60000000000001, "end": 110.4, "text": " just kind of gloss over it and that takes 30 seconds to decide whether or not you're interested." }, { "start": 110.4, "end": 118.32000000000001, "text": " If I were to suggest an improvement it would be also have the authors upload a poster so at a glance" }, { "start": 118.32000000000001, "end": 124.80000000000001, "text": " you'll be able to see what interests you right. For the talks and the panels the talks are pre-recorded" }, { "start": 125.44000000000001, "end": 131.84, "text": " and then there is a question and answer session that is live. The questions are voted beforehand" }, { "start": 131.84, "end": 139.6, "text": " and then the most voted questions I believe will be answered in a live session by either the talk" }, { "start": 139.6, "end": 147.44, "text": " giver or the panel discussionists. That is the conference but what what are we doing here? I" }, { "start": 147.44, "end": 154.64, "text": " I kind of think it's a paradoxical thing to take the live conference and just try to map it as" }, { "start": 154.64, "end": 162.64, "text": " closely as possible to online. Look at these paper poster poster sessions right. It is cool that you" }, { "start": 162.64, "end": 169.83999999999997, "text": " have all this but now I have to go at that particular time to chat with the authors and" }, { "start": 169.83999999999997, "end": 174.32, "text": " this is in competition to everything else that's happening at the same time right. So there will be" }, { "start": 174.32, "end": 179.51999999999998, "text": " a hundred papers that are presented in a given session and now I can go to this one and chat here" }, { "start": 179.51999999999998, "end": 185.67999999999998, "text": " but I'll miss the chat over there. Of course I can read it later but the only reason that is in the" }, { "start": 185.67999999999998, "end": 190.95999999999998, "text": " live conference is because everyone's just there for one week right. That's about the span you can" }, { "start": 190.96, "end": 196.72, "text": " hold people in one place. So you need to cram things at the same time. So you're at the poster" }, { "start": 196.72, "end": 201.68, "text": " session you will miss this poster if you go to this poster right. You just don't have time but" }, { "start": 201.68, "end": 207.28, "text": " online we're not constrained by this. So why are we doing this at the same time? Why aren't we doing" }, { "start": 207.28, "end": 213.44, "text": " this asynchronously? We actually have a perfect system for doing things like this. It's called" }, { "start": 213.44, "end": 219.76000000000002, "text": " YouTube. You publish a paper you can make it. It can be five minutes. It can be 30 minutes. You put" }, { "start": 219.76, "end": 225.51999999999998, "text": " it on YouTube. You link to your paper your abstract and your reviews you can put them in the description" }, { "start": 225.51999999999998, "end": 232, "text": " and then okay there's no live chat but there is a comment section. I appreciate all of you thank you" }, { "start": 232, "end": 237.28, "text": " but we have a perfectly fine system for that to do this in an asynchronous way. I don't see the" }, { "start": 237.28, "end": 244.64, "text": " benefit of having really this live chat and the talks and the panels the same thing. You have you" }, { "start": 244.64, "end": 251.35999999999999, "text": " already have pre-recorded talks. What are you doing having them compete with other things at the same" }, { "start": 251.35999999999999, "end": 256.88, "text": " time? Like okay I'm going to go to this workshop but this one's happening too. Right now I have to" }, { "start": 256.88, "end": 262.32, "text": " go and decide because everything needs to be crammed into this one week. It just seems to" }, { "start": 262.32, "end": 270.56, "text": " make no sense. For example on our channel Machine Learning Street Talk we have guests on and we'll" }, { "start": 270.56, "end": 277.68, "text": " do Reddit threads to ask people which questions would they like the authors or the people that we" }, { "start": 277.68, "end": 284.08, "text": " have on to answer and people up and down vote the questions and then we have a panel discussion." }, { "start": 284.88, "end": 290.56, "text": " We could even do this live right on YouTube and then record it and it will be almost the same" }, { "start": 290.56, "end": 298.24, "text": " experience because let's be honest if Joshua Benjo is in a panel in a live conference you'll be lucky" }, { "start": 298.24, "end": 304.56, "text": " to even get a single question in and it will almost never happen that you'll get a follow-up" }, { "start": 304.56, "end": 311.12, "text": " question because you're right there live. It's just not something that is really happening. I" }, { "start": 311.12, "end": 317.28000000000003, "text": " think the main advantage of these live conferences is the fact that you're there. If you go to a" }, { "start": 317.28000000000003, "end": 322.96000000000004, "text": " poster session the face-to-face interaction is something very different from a chat window." }, { "start": 322.96, "end": 329.68, "text": " You can kind of see what the author is thinking in real time. You can ask them questions. So in" }, { "start": 329.68, "end": 336.15999999999997, "text": " writing you can always weasel out of difficult questions or so. Yeah so it seems like you lose" }, { "start": 336.15999999999997, "end": 342.15999999999997, "text": " all the benefits of the live conference but if you do it in this way you retain all the bad sides" }, { "start": 342.15999999999997, "end": 348, "text": " namely the crowdedness, different things competing at the same time, entry fees. I get it. It's a lot" }, { "start": 348, "end": 354.64, "text": " of work to build this website and so on but we have YouTube and Reddit and that already covers" }, { "start": 354.64, "end": 361.6, "text": " like 95% of what this is doing. I always think of this, I don't know if it's a myth, when the" }, { "start": 361.6, "end": 367.2, "text": " car was first invented it still had the pulleys to pull the horse because people were just used to" }, { "start": 367.2, "end": 372.48, "text": " horse buggies and not cars. It seems like we're doing the same thing with online conferences. We" }, { "start": 372.48, "end": 378.96000000000004, "text": " were just so used to the live conferences that we don't see the mega possibilities that we have" }, { "start": 378.96000000000004, "end": 385.68, "text": " online. These are my thoughts on online conferences. If you agree, disagree, leave a comment and maybe" }, { "start": 385.68, "end": 402.96000000000004, "text": " in the future we'll go to true online conferences asynchronous. Thank you for being here and bye bye." } ]
fvctpYph8Pc
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Do ImageNet Classifiers Generalize to ImageNet? (Paper Explained)
[ "Science & Technology" ]
[ "deep learning", "machine learning", "imagenet", "cifar10", "cifar10.1", "generalization", "overfitting", "mturk", "arxiv", "vision", "models", "research", "hardness", "accuracy", "classifier", "resnet" ]
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 image net classifiers Generalized to image net by Benjamin wrecked Rebecca are Olaf's Ludwig Schmidt and Vyshal Shankar So the premise of this paper is pretty simple We've been training models on image net now for a while Almost ten years to be exact image net is this data set with a lot of images millions of images categorized into many thousands of categories now the The classic part of image net that people know is that has about 1.5 million images in 1,000 different classes and this Image net 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 Alex net was using deep learning instead of the classical visual computer vision approaches so we've been training on image net for a while and the idea or the question this paper asks if we Collect a second test set right so for image net 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 and all such that the models perform well on that particular test set Let's call this v1 right and it might not it might not be as successful on a new test set So this paper goes about collecting a test set to image net in Exactly the way that the v1 test set was collected right? So they 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 image net but also for c4 10 which is a much smaller data set But also a lot of computer vision algorithms are evaluated on c4 10 So let's just put up a hypothesis here The hypothesis is that we have pretty much over fitted to image net by now. This is a very prestigious Number to get if you have state-of-the-art on image net 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 and 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 over fitted and the model is performing equally well on both both sets So what what now if we assume that we have over fitted if we have over fitted? We would assume that you know the models that perform really poorly might also you know They perform kind of they're not really over fitted 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 over fitted to v1 and this might even go down right the more The more kind of we might overfit to v1 The worse we're actually going to get on v2 So this this is kind of a meta over fitting so this is what we would expect if we over fit right over over fit 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 over fit and what they found was neither And these are basically these interesting plots here So again the dashed line here would be the not over fitting line So what they find if you for example look at image net every dot here is a model right? So this model right here is performing with like a 67 percent accuracy On v1 and it is performing with something like a 53 percent accuracy on v2 If you look at this line here what that means is that 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 on c410 you can see the line rather than being tilted like this is actually tilted A bit slanted upwards right? So the the the 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 it's a this Let's 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 is pretty much constant So if if a model is 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 at or actually sorry 100% is already here If you could go higher maybe or maybe you can see here that in the end these will actually converge But nevertheless if the models that are doing better on v1 aren't only not overfit But they are actually experience 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 that is crazy and it is not only neural networks right so up here for 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 k nearest neighbor sorry k nearest 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 these 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 they say 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 one percent 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 part of the processing pipeline has a very big influence So what happens when you collect an ImageNet test set? 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 So 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 WordNet And WordNet is sort of a linguistic classification of words into groups So it would have hierarchical, it 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 on a system called Mechanical Turk, you may know it, 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 0, then you can be pretty sure it's not in the class And this selection frequency criteria, the paper thinks that this is the main criteria why the datasets are of different difficulties, let's say Because even though they try to match the process exactly, even the questions they pose 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 the 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 of another class So you can kind of do a quality control 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 ImageNet for these different datasets 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, right? 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, while 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 dataset there is So they basically hypothesize by thresholding differently for the new dataset You have a very good grip on the difficulty of the new dataset So this process of matching the selection frequency, so this matched frequency dataset It might actually not result in the same difficulty in dataset They do have some more experiments where they experiment with 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 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 where this line is So if you only take the easy samples you're up here, and this is about 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 that still doesn't explain that if you try to follow the protocol exactly Why does the accuracy drop? 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 And still mystery remains, I would say So the last thing they do is they try to just come up with a model for this So their hypothesis now is that the new test set just is harder And they have an 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 accuracies, they all fall exactly on this line There's this linear relationship, especially if you do like probit scaling of accuracies There's this line, and 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, right? So this here is the probability that the model will classify an image correctly, given 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 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 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 this Of course this doesn't explain anything, right? This doesn't explain the phenomena, but it still gives a clue of why the linear relationship here might result from the test set 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 suggestions for future research, I especially like the super holdout So if you ever make a data set, then make a super holdout set And once you're 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 Alright, so I think this paper is very interesting And I think everyone that sees and reads this comes up with their own hypothesis 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 taken part of V2 here So they split this one into a train and a test And they put this and this training together into like a super train So you train on both things together and they see whether it improves at this test set 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 Alright, that was what I had to say for this paper If you like this video, consider subscribing and comment what you think I usually answer or like or read most comments Thanks for listening, bye bye
[ { "start": 0, "end": 3.3000000000000003, "text": " Hi there today we're looking at to do image net classifiers" }, { "start": 3.6, "end": 9.78, "text": " Generalized to image net by Benjamin wrecked Rebecca are Olaf's Ludwig Schmidt and Vyshal Shankar" }, { "start": 10.1, "end": 12.620000000000001, "text": " So the premise of this paper is pretty simple" }, { "start": 12.98, "end": 16.4, "text": " We've been training models on image net now for a while" }, { "start": 17.1, "end": 24.54, "text": " Almost ten years to be exact image net is this data set with a lot of images millions of images" }, { "start": 25.62, "end": 28.76, "text": " categorized into many thousands of categories now the" }, { "start": 28.76, "end": 35.44, "text": " The classic part of image net that people know is that has about 1.5 million images in" }, { "start": 36.24, "end": 38.24, "text": " 1,000 different classes and" }, { "start": 39.28, "end": 40.84, "text": " this" }, { "start": 40.84, "end": 45.52, "text": " Image net was one of the main data sets now or has been for the last few years" }, { "start": 45.6, "end": 49.84, "text": " And as you can see on the right here the error rate year after year" }, { "start": 50.6, "end": 56.32000000000001, "text": " Was pretty much I think cut in half every year since 2012" }, { "start": 56.32, "end": 62.52, "text": " When the first net Alex net was using deep learning instead of the classical" }, { "start": 63.6, "end": 65.6, "text": " visual computer vision approaches" }, { "start": 65.92, "end": 69.6, "text": " so we've been training on image net for a while and the" }, { "start": 70.44, "end": 74.64, "text": " idea or the question this paper asks if we" }, { "start": 75.96000000000001, "end": 82.12, "text": " Collect a second test set right so for image net we have a train and a test set" }, { "start": 82.12, "end": 89.64, "text": " If we now collect a second test set here test v2" }, { "start": 90.36, "end": 92.24000000000001, "text": " right if" }, { "start": 92.24000000000001, "end": 96.78, "text": " We have a model that was trained on training here and evaluated on test" }, { "start": 97, "end": 102, "text": " Does it also perform well on this second test set right?" }, { "start": 103.08000000000001, "end": 108, "text": " the idea of this being that maybe over the years we've" }, { "start": 108, "end": 113.8, "text": " Tuned our hyper parameters and all such that the models perform well on that particular test set" }, { "start": 113.8, "end": 122, "text": " Let's call this v1 right and it might not it might not be as successful on a new test set" }, { "start": 122.32, "end": 127.03999999999999, "text": " So this paper goes about collecting a test set to image net in" }, { "start": 127.68, "end": 131.4, "text": " Exactly the way that the v1 test set was collected right?" }, { "start": 132.04, "end": 136.8, "text": " So they they try to match exactly the process of how v1 was collected" }, { "start": 136.8, "end": 142.28, "text": " To create another test set and then they evaluate models on that new test set" }, { "start": 142.76000000000002, "end": 148.56, "text": " They do this not only for image net but also for c4 10 which is a much smaller data set" }, { "start": 148.56, "end": 153.32000000000002, "text": " But also a lot of computer vision algorithms are evaluated on c4 10" }, { "start": 154.32000000000002, "end": 157.28, "text": " So let's just put up a hypothesis here" }, { "start": 157.28, "end": 165.20000000000002, "text": " The hypothesis is that we have pretty much over fitted to image net by now. This is a very prestigious" }, { "start": 165.2, "end": 169.44, "text": " Number to get if you have state-of-the-art on image net and therefore" }, { "start": 169.76, "end": 176.95999999999998, "text": " Tuning your hyper parameters and your learning rate and everything such that it performs well on the test set v1 is very likely" }, { "start": 177.28, "end": 181.35999999999999, "text": " So this paper has the most important plots are like this" }, { "start": 181.35999999999999, "end": 187.95999999999998, "text": " It has two axes and on the bottom axis is the performance on v1 right and" }, { "start": 188.56, "end": 190.56, "text": " so performance" }, { "start": 190.56, "end": 192.56, "text": " and that means" }, { "start": 192.56, "end": 198.28, "text": " Accuracy basically so accuracy and on line two is v2 accuracy" }, { "start": 199.28, "end": 200.48, "text": " now" }, { "start": 200.48, "end": 202.48, "text": " Here is one" }, { "start": 202.48, "end": 204.48, "text": " Here is zero" }, { "start": 205.12, "end": 210.16, "text": " This line here means that if a model is performing" }, { "start": 210.88, "end": 216.8, "text": " 50% accuracy on v1 it is also performing 50% accuracy on v2" }, { "start": 216.8, "end": 224.32000000000002, "text": " So being on this line would basically mean we have not over fitted and the model is performing equally well on both" }, { "start": 224.88000000000002, "end": 226.88000000000002, "text": " both sets" }, { "start": 226.88000000000002, "end": 233.04000000000002, "text": " So what what now if we assume that we have over fitted if we have over fitted?" }, { "start": 233.04000000000002, "end": 238, "text": " We would assume that you know the models that perform really poorly might also you know" }, { "start": 238, "end": 244, "text": " They perform kind of they're not really over fitted but over the years as we've gotten better on v1" }, { "start": 244, "end": 248.4, "text": " We stray away from this so we get better on v1" }, { "start": 248.72, "end": 256.56, "text": " But we don't really get better on v2 right and that means we've over fitted to v1 and this might even go down right the more" }, { "start": 256.88, "end": 260, "text": " The more kind of we might overfit to v1" }, { "start": 260.72, "end": 263.28, "text": " The worse we're actually going to get on v2" }, { "start": 264.24, "end": 271.84, "text": " So this this is kind of a meta over fitting so this is what we would expect if we over fit right over" }, { "start": 271.84, "end": 273.84, "text": " over fit to v1" }, { "start": 274.71999999999997, "end": 280.56, "text": " And I think this was the initial hypothesis behind the people that ran this experiment to check" }, { "start": 280.96, "end": 286.08, "text": " Can we see an effect like this or is the effect more?" }, { "start": 286.71999999999997, "end": 292.15999999999997, "text": " A continuous one where we don't over fit and what they found was neither" }, { "start": 292.96, "end": 296.64, "text": " And these are basically these interesting plots here" }, { "start": 296.64, "end": 302.15999999999997, "text": " So again the dashed line here would be the not over fitting line" }, { "start": 302.15999999999997, "end": 307.44, "text": " So what they find if you for example look at image net every dot here is a model right?" }, { "start": 307.91999999999996, "end": 313.03999999999996, "text": " So this model right here is performing with like a 67 percent accuracy" }, { "start": 313.68, "end": 320, "text": " On v1 and it is performing with something like a 53 percent accuracy on v2" }, { "start": 320.32, "end": 324.15999999999997, "text": " If you look at this line here what that means is that" }, { "start": 324.16, "end": 326.64000000000004, "text": " Every model kind of drops" }, { "start": 327.36, "end": 329.36, "text": " By about this much" }, { "start": 329.84000000000003, "end": 330.96000000000004, "text": " right" }, { "start": 330.96000000000004, "end": 332.08000000000004, "text": " so" }, { "start": 332.08000000000004, "end": 334.08000000000004, "text": " Not only not we don't see" }, { "start": 334.64000000000004, "end": 340, "text": " This and we don't see this but we see this line is shifted down" }, { "start": 340, "end": 347.44000000000005, "text": " And if you look closely especially on c410 you can see the line rather than being tilted like this is actually tilted" }, { "start": 347.92, "end": 350.40000000000003, "text": " A bit slanted upwards right?" }, { "start": 350.4, "end": 358.96, "text": " So the the the the angle is not is higher is greater the slope is greater than the one-to-one slope" }, { "start": 358.96, "end": 360.96, "text": " This is extremely interesting" }, { "start": 361.52, "end": 364, "text": " If you think about what does that mean?" }, { "start": 364.71999999999997, "end": 367.28, "text": " It means that if you" }, { "start": 368.79999999999995, "end": 371.84, "text": " Take a model right right here" }, { "start": 374.23999999999995, "end": 377.44, "text": " If you look at its order" }, { "start": 377.44, "end": 380.56, "text": " It's it's it's a this" }, { "start": 380.56, "end": 383.28, "text": " Let's let's look at this model here. This model is number one" }, { "start": 383.76, "end": 388.32, "text": " Best model in the world right it will still be number one on v2" }, { "start": 389.36, "end": 397.28, "text": " This model here is number number three rank three on v1. It will also be rank three on v2 right?" }, { "start": 397.28, "end": 400.88, "text": " So the order of models is is pretty much constant" }, { "start": 400.88, "end": 405.68, "text": " So if if a model is doing well on v1 it is also doing well on v2" }, { "start": 405.68, "end": 415.04, "text": " In relation to other models but every model experiences this drop in in accuracy" }, { "start": 415.04, "end": 419.92, "text": " And the most interesting part is that and again you can see this more here" }, { "start": 422, "end": 429.92, "text": " The the better you're doing the smaller this drop gets right this drop here is smaller than this drop here" }, { "start": 429.92, "end": 436.24, "text": " This is exactly counter to the notion of overfitting" }, { "start": 437.84000000000003, "end": 446.88, "text": " Where it seems the more accurate you get on v1 the more you're able to close this gap between v1 and v2" }, { "start": 446.88, "end": 455.92, "text": " And if you extrapolate here you might as well think that once we are at at or actually sorry 100% is already here" }, { "start": 455.92, "end": 463.92, "text": " If you could go higher maybe or maybe you can see here that in the end these will actually converge" }, { "start": 463.92, "end": 472.88, "text": " But nevertheless if the models that are doing better on v1 aren't only not overfit" }, { "start": 472.88, "end": 477.52000000000004, "text": " But they are actually experience less of a drop with regards to a new test set" }, { "start": 477.52000000000004, "end": 484.8, "text": " So they generalize better to the new test set than the the worst models right" }, { "start": 484.8, "end": 495.28000000000003, "text": " And that is crazy and it is not only neural networks right so up here for up here you have the the deep neural networks and whatnot" }, { "start": 495.28000000000003, "end": 506.16, "text": " But you can also go with I believe some of these or even further down here are k nearest neighbor sorry k nearest neighbor classifiers and things like this" }, { "start": 506.16, "end": 513.92, "text": " So it doesn't seem to be a property of neural networks it really seems to be a property of the data set" }, { "start": 513.92, "end": 528.0799999999999, "text": " 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" }, { "start": 528.0799999999999, "end": 543.4399999999999, "text": " 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" }, { "start": 543.44, "end": 554.72, "text": " All right so they first say potential causes of accuracy drops and they propose a model" }, { "start": 554.72, "end": 563.6, "text": " They say here are two here is the entire difference between two data sets with regards to a classifier" }, { "start": 563.6, "end": 572.1600000000001, "text": " 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" }, { "start": 572.16, "end": 576.9599999999999, "text": " So this is an expanding sum in the middle" }, { "start": 576.9599999999999, "end": 588.64, "text": " So there is the generalization gap the generalization gap refers to the gap that you have between different data sets of the same distribution" }, { "start": 588.64, "end": 598.9599999999999, "text": " So these 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" }, { "start": 598.96, "end": 608.1600000000001, "text": " In this case the generalization gap simply refers to the difference between the generalization to the first and to the second set" }, { "start": 608.1600000000001, "end": 622.32, "text": " They argue that this isn't really an issue here because they say they can put up confidence intervals" }, { "start": 622.32, "end": 633.0400000000001, "text": " So if those were identically distributed how much would the generalization gap be at maximum given some kind of confidence interval" }, { "start": 633.0400000000001, "end": 640.5600000000001, "text": " 95 confidence interval would only give you plus minus a one percent difference in generalization gap" }, { "start": 640.5600000000001, "end": 645.84, "text": " So they rule out that this is the reason for the big discrepancy" }, { "start": 645.84, "end": 650, "text": " Then have two others they have the adaptivity gap and the distribution gap" }, { "start": 650, "end": 657.36, "text": " So the adaptivity gap is what we hypothesized at the beginning" }, { "start": 657.36, "end": 663.12, "text": " It is the overfitting to the first data set or to one of the two data sets" }, { "start": 663.12, "end": 672, "text": " So if you have a big adaptivity gap then you have fitted much more to one than to the other data set" }, { "start": 672, "end": 680, "text": " Now because of the shape of the curve being the way it is they also rule out the adaptivity gap" }, { "start": 680, "end": 687.6, "text": " And we went over why right because it would look completely different than it does" }, { "start": 687.6, "end": 692, "text": " Now the only thing remaining here is this distribution gap" }, { "start": 692, "end": 704, "text": " 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" }, { "start": 704, "end": 708, "text": " And they go into why that is" }, { "start": 708, "end": 724, "text": " And I'm going to compress their hypothesis of why that is into a short summary" }, { "start": 724, "end": 728, "text": " Let's say we won't go over the entire paper" }, { "start": 728, "end": 744, "text": " They basically say that the Mechanical Turk part of the processing pipeline has a very big influence" }, { "start": 744, "end": 748, "text": " So what happens when you collect an ImageNet test set? You start with Flickr" }, { "start": 748, "end": 760, "text": " 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" }, { "start": 760, "end": 766, "text": " So they start by going to Flickr and searching for images" }, { "start": 766, "end": 772, "text": " And their ground truth class labels come, you may know this, from a system called WordNet" }, { "start": 772, "end": 778, "text": " And WordNet is sort of a linguistic classification of words into groups" }, { "start": 778, "end": 788, "text": " So it would have hierarchical, it would have animals, animal being a word and then below animal it would have dog and then it would have terrier" }, { "start": 788, "end": 792, "text": " And it would have these hierarchical groupings of these words" }, { "start": 792, "end": 800, "text": " And they search on Flickr for images and then they put the images to a human rater" }, { "start": 800, "end": 809, "text": " So the human rater on a system called Mechanical Turk, you may know it, you can just sign up there and do these kind of tasks" }, { "start": 809, "end": 817, "text": " They present the human with a grid of images and a class, terrier" }, { "start": 817, "end": 827, "text": " And they say please select all the images where a terrier appears, so the human might select this, this, this and this one" }, { "start": 827, "end": 832, "text": " And that will give you what they call a selection frequency" }, { "start": 832, "end": 842, "text": " So, selection frequency, so how often was a particular image selected given that class" }, { "start": 842, "end": 852, "text": " And of course the higher, so you do this over many, sorry, the selection frequency is across many of these Mechanical Turk workers" }, { "start": 852, "end": 865, "text": " 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" }, { "start": 865, "end": 873, "text": " So you can be pretty sure it's in the class, if it goes towards 0, then you can be pretty sure it's not in the class" }, { "start": 873, "end": 891, "text": " And this selection frequency criteria, the paper thinks that this is the main criteria why the datasets are of different difficulties, let's say" }, { "start": 891, "end": 899, "text": " Because even though they try to match the process exactly, even the questions they pose to the Turk workers" }, { "start": 899, "end": 907, "text": " They even restricted their flicker date range to the date range where the original image net was collected" }, { "start": 907, "end": 916, "text": " They still think that there is a difference in how the Mechanical Turk workers basically rated the images" }, { "start": 916, "end": 920, "text": " Or then after that how they were selected using the selection frequency" }, { "start": 920, "end": 930, "text": " So what they do is they do different, they select different images depending on criteria so they can test these hypotheses" }, { "start": 930, "end": 935, "text": " Their original V2 test set is called matched frequency" }, { "start": 935, "end": 941, "text": " Now what you do in matched frequency is you kind of play a little game" }, { "start": 941, "end": 951, "text": " What you do is every now and then you will implant an image here of the V1 test set" }, { "start": 951, "end": 957, "text": " So thereby, of the V1 test set, either of this class or of another class" }, { "start": 957, "end": 960, "text": " So you can kind of do a quality control" }, { "start": 960, "end": 970, "text": " From this you can now find out what is the selection frequency of images in the V1 class for Terrier" }, { "start": 970, "end": 977, "text": " And then you can simply select the same one in the V2" }, { "start": 977, "end": 986, "text": " So if you know the selection frequency for V1 was 0.8, you can just put the threshold here at 0.8" }, { "start": 986, "end": 993, "text": " And you know, you can be reasonably sure that you have selected a similar difficulty" }, { "start": 993, "end": 995, "text": " Or so you would think, right?" }, { "start": 995, "end": 1002, "text": " So if they do it like this, then they get this drop that you saw at the beginning" }, { "start": 1002, "end": 1010, "text": " They also do this threshold 0.7, which I guess is arbitrary-ish" }, { "start": 1010, "end": 1015, "text": " And then they also say top images, where they say" }, { "start": 1015, "end": 1020, "text": " For each class we chose the 10 images with the highest selection frequency" }, { "start": 1020, "end": 1026, "text": " So these would be the sort of easiest ones" }, { "start": 1026, "end": 1034, "text": " And if you look at the graphs, and this is ImageNet for these different datasets" }, { "start": 1034, "end": 1042, "text": " So if you do the threshold 0.7 that they selected, now the old line was somewhere here" }, { "start": 1042, "end": 1047, "text": " Now the new line is much closer, right? You see that here" }, { "start": 1047, "end": 1052, "text": " And if you do these top images, so you just select the easy ones" }, { "start": 1052, "end": 1057, "text": " The new line is actually above, right? This is now" }, { "start": 1057, "end": 1064, "text": " Note that the red line here is above the black line, while here it's below" }, { "start": 1064, "end": 1075, "text": " It is still extremely interesting that still there is this almost linear relationship between the V1 and V2 accuracies" }, { "start": 1075, "end": 1079, "text": " And even here on this easier dataset there is" }, { "start": 1079, "end": 1088, "text": " So they basically hypothesize by thresholding differently for the new dataset" }, { "start": 1088, "end": 1095, "text": " You have a very good grip on the difficulty of the new dataset" }, { "start": 1095, "end": 1102, "text": " So this process of matching the selection frequency, so this matched frequency dataset" }, { "start": 1102, "end": 1108, "text": " It might actually not result in the same difficulty in dataset" }, { "start": 1108, "end": 1117, "text": " They do have some more experiments where they experiment with different difficulties" }, { "start": 1117, "end": 1127, "text": " So let's actually jump down there, it's a bit of a jump because there are over 70 pages in this paper" }, { "start": 1127, "end": 1135, "text": " The appendix has its own content directory, that's how crazy that is" }, { "start": 1135, "end": 1145, "text": " But I want to show you these plots, so here what they do is they do different bins of this set" }, { "start": 1145, "end": 1150, "text": " So they have bins of easy samples, less easy samples and so on" }, { "start": 1150, "end": 1157, "text": " And you can see that you have a pretty good grip on where this line is" }, { "start": 1157, "end": 1162, "text": " So if you only take the easy samples you're up here, and this is about what we saw before" }, { "start": 1162, "end": 1169, "text": " If this is the old line, it's the red line, right? If you take the entire new test set" }, { "start": 1169, "end": 1176, "text": " If you just take bin the second hardest bin you're somewhere here or here or here" }, { "start": 1176, "end": 1182, "text": " So you have a good hold on where this line is" }, { "start": 1182, "end": 1187, "text": " But that still doesn't explain that if you try to follow the protocol exactly" }, { "start": 1187, "end": 1191, "text": " Why does the accuracy drop? That is still a mystery" }, { "start": 1191, "end": 1197, "text": " Even though they say here is a variable that influences this a lot" }, { "start": 1197, "end": 1203, "text": " If they try to set the variable as it was set in v1, it is not equal" }, { "start": 1203, "end": 1208, "text": " And still mystery remains, I would say" }, { "start": 1208, "end": 1216, "text": " So the last thing they do is they try to just come up with a model for this" }, { "start": 1216, "end": 1223, "text": " So their hypothesis now is that the new test set just is harder" }, { "start": 1223, "end": 1231, "text": " And they have an analytical kind of a formal model of why if you assume certain things" }, { "start": 1231, "end": 1234, "text": " This results in this line, right?" }, { "start": 1234, "end": 1242, "text": " The really interesting thing about the paper is that the accuracies, they all fall exactly on this line" }, { "start": 1242, "end": 1248, "text": " There's this linear relationship, especially if you do like probit scaling of accuracies" }, { "start": 1248, "end": 1255, "text": " There's this line, and so they put up a model where you say" }, { "start": 1255, "end": 1262, "text": " What if we assume that each example i has a difficulty, right?" }, { "start": 1262, "end": 1264, "text": " It's just a number how difficult it is" }, { "start": 1264, "end": 1276, "text": " And each model j has a probability of correctly classifying an image with difficulty tau here" }, { "start": 1276, "end": 1279, "text": " Given by this function, right?" }, { "start": 1279, "end": 1288, "text": " So this here is the probability that the model will classify an image correctly, given that it's tau hard" }, { "start": 1288, "end": 1297, "text": " And so this is an increasing function" }, { "start": 1297, "end": 1304, "text": " And they put up this following parameterization" }, { "start": 1304, "end": 1311, "text": " This is the CDF of the... So they put up a model for this function now, right?" }, { "start": 1311, "end": 1316, "text": " For this, they say if we assume that it is like this" }, { "start": 1316, "end": 1321, "text": " That each model has a sort of a skill number" }, { "start": 1321, "end": 1327, "text": " So each model has a skill, and each image has a difficulty that is tau" }, { "start": 1327, "end": 1333, "text": " If the skill is higher than the tau, probably it will classify correctly" }, { "start": 1333, "end": 1338, "text": " If the skill is lower, probably, then this number is negative, it will classify it incorrectly" }, { "start": 1338, "end": 1345, "text": " So this is the CDF of a normal distribution, it goes something like this, right?" }, { "start": 1345, "end": 1354, "text": " And if the zero point is here, so if this number here is zero, it's like 50-50" }, { "start": 1354, "end": 1359, "text": " Whether it will classify it correctly" }, { "start": 1359, "end": 1365, "text": " So if you assume this, and you assume a bunch of other Gaussian error distributions" }, { "start": 1365, "end": 1380, "text": " Then the performance of a model on the test set V2 is exactly the performance of the model under test set V1" }, { "start": 1380, "end": 1387, "text": " Times this scalar here, plus this scalar here, which is a linear relationship" }, { "start": 1387, "end": 1390, "text": " So they put up a model for this" }, { "start": 1390, "end": 1393, "text": " Of course this doesn't explain anything, right?" }, { "start": 1393, "end": 1408, "text": " This doesn't explain the phenomena, but it still gives a clue of why the linear relationship here might result from the test set having a different difficulty setting" }, { "start": 1408, "end": 1411, "text": " Or a different difficulty properties" }, { "start": 1411, "end": 1420, "text": " So they go on, after discussing related work, they go on to say what can one do" }, { "start": 1420, "end": 1428, "text": " And suggestions for future research, I especially like the super holdout" }, { "start": 1428, "end": 1441, "text": " So if you ever make a data set, then make a super holdout set" }, { "start": 1441, "end": 1452, "text": " And once you're 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" }, { "start": 1452, "end": 1454, "text": " It will be fantastic" }, { "start": 1454, "end": 1458, "text": " Alright, so I think this paper is very interesting" }, { "start": 1458, "end": 1467, "text": " And I think everyone that sees and reads this comes up with their own hypothesis of why this is and what's going on here" }, { "start": 1467, "end": 1469, "text": " They have investigated a lot of this" }, { "start": 1469, "end": 1476, "text": " Especially I want to highlight an experiment where they taken part of V2 here" }, { "start": 1476, "end": 1486, "text": " So they split this one into a train and a test" }, { "start": 1486, "end": 1492, "text": " And they put this and this training together into like a super train" }, { "start": 1492, "end": 1499, "text": " So you train on both things together and they see whether it improves at this test set" }, { "start": 1499, "end": 1506, "text": " You would think that if you put this training in there that it would improve" }, { "start": 1506, "end": 1510, "text": " And it does improve, but it improves by like a miniscule amount" }, { "start": 1510, "end": 1514, "text": " So they've done a whole bunch of experiments like this to investigate what's going on" }, { "start": 1514, "end": 1519, "text": " This is all in this 70 page appendix that you can go over" }, { "start": 1519, "end": 1522, "text": " Alright, that was what I had to say for this paper" }, { "start": 1522, "end": 1529, "text": " If you like this video, consider subscribing and comment what you think" }, { "start": 1529, "end": 1533, "text": " I usually answer or like or read most comments" }, { "start": 1533, "end": 1553, "text": " Thanks for listening, bye bye" } ]
hDQNCWR3HLQ
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Drama] Schmidhuber: Critique of Honda Prize for Dr. Hinton
[ "Science & Technology" ]
[ "deep learning", "machine learning", "schmidhuber", "hinton", "seppo", "rummelhardt", "hochreiter", "lstm", "rbm", "backpropagation", "credit", "science" ]
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, Jürgen Schmidhuber 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. So this is on Schmidhuber's own website, and it's by himself. Don't you love this? How to pronounce his name, Jürgen Schmidhuber. You again. Sorry. This is absolutely great. So both, actually, Schmidhuber 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 backpropagation algorithm that forms the basis of deep learning approach to AI. And Schmidhuber just goes off. He basically claims, while Hinton and his coworkers have made certain significant contributions to deep learning, the claim above is plain wrong. He says Hinton did not invent backpropagation. The person who invented backpropagation was Seppo Linayma. He says basically many papers failed to cite Linayma, who was the original inventor of backprop and so on. And he goes through a history of this and how it's even earlier. I always have a bit of a trouble with claims like who invented what, because when is an algorithm really the same thing? 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 backpropagation 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 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. And he basically goes, 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 forward networks can be trained by plain backprop, 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, Schmidhuber 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, right, that we don't really do unsupervised pre-training anymore until now, of course. But you, like, to train an MNIST classifier, you don't have to do that. But it's also doubtful that this was a step, even though 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 Schmidhuber that he always compares it to his own things. Like it just, like, either criticize them for, you know, 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 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 doing any experiments or actually specifying exactly what they mean. They just kind of wrote down a bunch of ideas and that got published. Especially, like, there's 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 mistake this, that think that 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. All of this is really hard. And then the Honda says, in 2009, Dr. Hinton and two of his students used multilayer neural nets to make major breakthrough in speech recognition. That led directly to greatly improved. And this, of course, Schmidrub 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 our team in Switzerland already used his first superior award-winning GPU-based CNN and so on. That's what was called DanNet, was produced by his group. And again, this seems correct, right? This seems when he lays it out like this, it doesn't change the fact that AlexNet won ImageNet in 2012. And that was like the start of the deep learning revolution. It was like, wow, you can cut the error rate by something like 30% simply by doing this deep learning stuff. So again, even if DanNet says it blew away the competition, it always seems like Schmidhuber is kind of right, but then also he's not. He's like, exact 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, Dr. Hinton also invented a widely used new method called dropout, which uses overfitting. No, like no, like no, just no. Randomly dropping parts in order to make something more robust, that is surely not a new thing. And he also says much earlier, there's this stochastic delta rule and so on. And he also critiques that this paper did not cite this. They just gave it the name. 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 because it's a natural idea, and then they gave it a name, and the name stuck. 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 Dr. Hinton 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 Hinton's contributions. And this is just a bit of a cheap shot. Clearly, Honda, they're not saying it would have been physically impossible. Without his contributions. But certainly Hinton has, even if he hadn't invented any of those things, he certainly has created a spark. And these things created a splash, got people excited, people thinking about new ways of applying things, even if this is all true. But I would like you to notice, this is a critique of what Honda says about Hinton. And if I read through the statements of Schmidhuber, most of them are technically correct. And you know, that was that. And then I thought, OK, cool. But then someone posted it on Reddit. And then Hinton replies. And this is... Don't you love this? So Hinton says, Having a public debate with Schmidhuber about academic credit is not 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 arrivals. He is even escorted to tricks like having multiple aliases in Wikipedia to make it look as if other people agree. The page on his website about Alan Turing is a nice example of how he goes on trying to... These are shots fired. And he says, I'm going to respond once and only once. I have never claimed that I invented backpropagation. David Rumelhard invented it independently. After other people in other fields had invented it. It's true. When we first published, we did not know the history. So he basically says, OK, we did forget to cite it when we first published about backprop, but he doesn't say he invented it. What I've claimed is that I was the person to clearly demonstrate that backprop could learn interesting internal representations and that this is what made it popular. So this goes into the direction. Schmidhuber is very much on academic contributions. Idea was there before. And Hinton basically says, no, 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 this by forcing that, blah, blah, blah. And he says, it is true that many people in the press have said I invented backprop and I've 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 Hinton where he says, lots of people invented different versions of backprop before David Rumelhart. They were mainly independent inventions, something I feel I've got too much credit for. It's one of these rare cases where an academic feels he has gotten 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 Juergen would like to set the record straight on who invented LSTMs. Boom, boom. Crazy. Shots fired by Hinton here. This is, I mean, this is just great. But again, look at what Hinton says. Hinton basically says, yes, I have not invented that. I have corrected this on public record in the past. And yeah, so that's what Hinton says. And I mean, the comments here are just gold. I really invite you to read it. And then Schmidhuber, of course, being Schmidhuber, replies again. Down here, he has a response to the reply. And I don't expect Hinton to reply again, so I waited for a bit. But I believe Hinton when he says he does it only once. So he goes into this. It just says, summary, the facts presented in sections one, two, three, four, five are still valid. So he goes kind of statement by statement. Is this having a public debate? Blah, blah, blah. And he just says, well, this is an ad hominem attack, which is true. Right. This is true. And he says he even has multiple aliases in Wikipedia. And he just says another ad hominem attack. And then he goes into that Schmidhuber tries to discredit Alan Turing. And then Schmidhuber goes into this big, long, big, long, basically claim that Alan Turing wasn't as important as people made him out to be. And people invented this kind of Turing machine equivalence before that. Again, it's kind of Schmidhuber'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 true it's an ad hominem attack. Right. So, you know, be it as it may. This is correct. And then when Hinton goes that he didn't invent Backprop and Schmidhuber says this is finally a response related to my post, which is true. Right. However, it does not at all contradict what I wrote. And it is true that Hinton credited his co-author Rommelhardt with the invention, but neither cited Lin-Neymar 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, like, can you really say now this is the exact time when Backprop was invented, even though it probably wasn't in the exact current formulation. And it probably existed somewhat like this. So, but again, and he his main claim is Dr. Hinton 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 would like to set the record straight. We invented LSTMs and, you know, as we as you may know, Sepp Hochreiter kind of invented LSTMs under Jürgen Schmidhuber as a PhD advisor. But the to summarize Dr. Hinton's comments and ad hominem 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 is this is correct. Right. Hinton basically replies to, hey, I, I never claimed I invented Backprop and other people have invented it. And Schmidhuber doesn't criticize Hinton in this particular post. He may otherwise. Schmidhuber doesn't criticize Hinton for claiming that he criticizes Honda for claiming that Hinton did. And Hinton doesn't. Hinton basically agrees with him. And also Schmidhuber says Dr. Hinton 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 Hinton accepted this price under this release. Right. Now, you might be able to say Hinton also says he's on the record basically saying he didn't do this. And I guess if you're Hinton and you know, you've had this you've 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 Hinton understood this as an attack on himself that he claims he invented Backprop. And Schmidhuber says Honda claims Hinton invented Backprop and Hinton accepted the price. So he agrees with it and Hinton 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 Schmidhuber is always on the idea existed before. And Hinton 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 Schmidhuber 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 enjoy 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, "end": 4, "text": " On April 21st, Jürgen Schmidhuber tweeted out," }, { "start": 4, "end": 8, "text": " Stop crediting the wrong people for inventions made by others." }, { "start": 8, "end": 11, "text": " At least in science, the facts will always win at the end," }, { "start": 11, "end": 14, "text": " as long as the facts have not yet won." }, { "start": 14, "end": 16, "text": " It is not yet the end." }, { "start": 16, "end": 19, "text": " No fancy award can ever change that." }, { "start": 19, "end": 24, "text": " Hashtag self-correcting science, hashtag plagiarism." }, { "start": 24, "end": 28, "text": " And links to an article of his own website," }, { "start": 28, "end": 30, "text": " where he wrote," }, { "start": 30, "end": 34, "text": " Critique of Honda Prize for Dr. Hinton." }, { "start": 34, "end": 37, "text": " So this is on Schmidhuber's own website," }, { "start": 37, "end": 39, "text": " and it's by himself." }, { "start": 39, "end": 41, "text": " Don't you love this?" }, { "start": 41, "end": 44, "text": " How to pronounce his name, Jürgen Schmidhuber." }, { "start": 44, "end": 47, "text": " You again. Sorry." }, { "start": 47, "end": 49, "text": " This is absolutely great." }, { "start": 49, "end": 52, "text": " So both, actually, Schmidhuber and Hinton are on Twitter." }, { "start": 52, "end": 55, "text": " You can tweet at them and follow them." }, { "start": 55, "end": 59, "text": " This article here is basically a critique" }, { "start": 59, "end": 62, "text": " of the press release of Honda" }, { "start": 62, "end": 65, "text": " when they awarded Jeff Hinton" }, { "start": 65, "end": 68, "text": " for his achievements." }, { "start": 68, "end": 71, "text": " And it goes through it step by step." }, { "start": 71, "end": 73, "text": " And we won't look at the whole thing," }, { "start": 73, "end": 75, "text": " but just for you to get the flavor." }, { "start": 75, "end": 77, "text": " So here Honda says," }, { "start": 77, "end": 80, "text": " Dr. Hinton has created a number of technologies" }, { "start": 80, "end": 83, "text": " that have enabled the broader application of AI," }, { "start": 83, "end": 85, "text": " including the backpropagation algorithm" }, { "start": 85, "end": 89, "text": " that forms the basis of deep learning approach to AI." }, { "start": 89, "end": 92, "text": " And Schmidhuber just goes off." }, { "start": 92, "end": 94, "text": " He basically claims," }, { "start": 94, "end": 96, "text": " while Hinton and his coworkers have made" }, { "start": 96, "end": 98, "text": " certain significant contributions to deep learning," }, { "start": 98, "end": 101, "text": " the claim above is plain wrong." }, { "start": 101, "end": 105, "text": " He says Hinton did not invent backpropagation." }, { "start": 105, "end": 110, "text": " The person who invented backpropagation was Seppo Linayma." }, { "start": 110, "end": 118, "text": " He says basically many papers failed to cite Linayma," }, { "start": 118, "end": 124, "text": " who was the original inventor of backprop and so on." }, { "start": 124, "end": 127, "text": " And he goes through a history of this" }, { "start": 127, "end": 129, "text": " and how it's even earlier." }, { "start": 129, "end": 131, "text": " I always have a bit of a trouble with claims" }, { "start": 131, "end": 132, "text": " like who invented what," }, { "start": 132, "end": 136, "text": " because when is an algorithm really the same thing?" }, { "start": 136, "end": 138, "text": " And when is it a variation on another algorithm?" }, { "start": 138, "end": 140, "text": " And when is it something completely new?" }, { "start": 140, "end": 142, "text": " It's never entirely clear." }, { "start": 142, "end": 146, "text": " But the points here made that the things," }, { "start": 146, "end": 152, "text": " the backpropagation algorithm existed before Hinton." }, { "start": 152, "end": 156, "text": " And also that some of the papers," }, { "start": 156, "end": 160, "text": " some of the seminal papers did not cite the correct origin." }, { "start": 160, "end": 163, "text": " Statement 2. In 2002 he introduced" }, { "start": 163, "end": 167, "text": " a fast learning algorithm for restricted Boltzmann machines" }, { "start": 167, "end": 171, "text": " that allowed them to learn a single layer of distributed representation" }, { "start": 171, "end": 173, "text": " without requiring any labeled data." }, { "start": 173, "end": 176, "text": " These methods allowed deep learning to work better" }, { "start": 176, "end": 179, "text": " and they led to the current deep learning revolution." }, { "start": 179, "end": 184, "text": " And he basically goes, no, Dr. Hinton's interesting unsupervised pre-training" }, { "start": 184, "end": 187, "text": " for deep neural networks was irrelevant" }, { "start": 187, "end": 189, "text": " for the current deep learning revolution." }, { "start": 189, "end": 193, "text": " In 2010 our team showed that the feed forward networks" }, { "start": 193, "end": 195, "text": " can be trained by plain backprop," }, { "start": 195, "end": 198, "text": " do not at all require pre-training." }, { "start": 198, "end": 201, "text": " And he basically again says," }, { "start": 201, "end": 203, "text": " apart from this Hinton's unsupervised pre-training" }, { "start": 203, "end": 207, "text": " was conceptually a rehash of my unsupervised pre-training" }, { "start": 207, "end": 210, "text": " for deep recurrent neural networks." }, { "start": 210, "end": 214, "text": " So he, you know, as you know, Schmidhuber has done a lot of work" }, { "start": 214, "end": 217, "text": " in recurrent neural networks and he basically says" }, { "start": 217, "end": 220, "text": " it was just a rehash of his algorithm." }, { "start": 220, "end": 223, "text": " Now I have to say I have," }, { "start": 223, "end": 227, "text": " so first of all, he makes a point here, right," }, { "start": 227, "end": 231, "text": " that we don't really do unsupervised pre-training anymore" }, { "start": 231, "end": 233, "text": " until now, of course." }, { "start": 233, "end": 236, "text": " But you, like, to train an MNIST classifier," }, { "start": 236, "end": 238, "text": " you don't have to do that." }, { "start": 238, "end": 242, "text": " But it's also doubtful that this was a step," }, { "start": 242, "end": 246, "text": " even though if it wasn't on the exact path" }, { "start": 246, "end": 249, "text": " to the current situation," }, { "start": 249, "end": 252, "text": " it was a thing that got people excited maybe." }, { "start": 252, "end": 255, "text": " And so the critique is like half valid." }, { "start": 255, "end": 258, "text": " And also it doesn't help Schmidhuber" }, { "start": 258, "end": 261, "text": " that he always compares it to his own things." }, { "start": 261, "end": 266, "text": " Like it just, like, either criticize them for, you know," }, { "start": 266, "end": 270, "text": " general things, but then avoid bringing your own things in" }, { "start": 270, "end": 273, "text": " because it just sounds like I did this before." }, { "start": 273, "end": 276, "text": " And also I read some papers from these times." }, { "start": 276, "end": 279, "text": " People just wrote papers sometimes." }, { "start": 279, "end": 281, "text": " I haven't read this specific one," }, { "start": 281, "end": 283, "text": " but sometimes people just wrote papers" }, { "start": 283, "end": 285, "text": " writing down their ideas." }, { "start": 285, "end": 288, "text": " Like, one could do this and this and this." }, { "start": 288, "end": 290, "text": " Never doing any experiments" }, { "start": 290, "end": 294, "text": " or actually specifying exactly what they mean." }, { "start": 294, "end": 296, "text": " They just kind of wrote down a bunch of ideas" }, { "start": 296, "end": 298, "text": " and that got published." }, { "start": 298, "end": 302, "text": " Especially, like, there's some reinforcement learning papers" }, { "start": 302, "end": 304, "text": " where people are just like, oh, one," }, { "start": 304, "end": 308, "text": " I imagine agents doing this and learning from that." }, { "start": 308, "end": 313, "text": " So it is, again, it is never really clear." }, { "start": 313, "end": 315, "text": " Ideas are just had by everyone." }, { "start": 315, "end": 318, "text": " I think people mistake this," }, { "start": 318, "end": 320, "text": " that think that ideas are unique." }, { "start": 320, "end": 322, "text": " It's not ideas that are unique." }, { "start": 322, "end": 326, "text": " Many people have the same ideas, but some..." }, { "start": 326, "end": 331, "text": " There's also execution and exact formalization and so on." }, { "start": 331, "end": 333, "text": " And exact level of specificity." }, { "start": 333, "end": 335, "text": " All of this is really hard." }, { "start": 335, "end": 339, "text": " And then the Honda says, in 2009, Dr. Hinton" }, { "start": 339, "end": 341, "text": " and two of his students used multilayer neural nets" }, { "start": 341, "end": 343, "text": " to make major breakthrough in speech recognition." }, { "start": 343, "end": 345, "text": " That led directly to greatly improved." }, { "start": 345, "end": 348, "text": " And this, of course, Schmidrub goes off by this" }, { "start": 348, "end": 355, "text": " because speech recognition is, of course, prime LSTM territory." }, { "start": 355, "end": 359, "text": " So you don't want to go near this." }, { "start": 359, "end": 361, "text": " And the Honda further says," }, { "start": 361, "end": 364, "text": " revolutionized computer vision" }, { "start": 364, "end": 366, "text": " by showing that deep learning worked far better" }, { "start": 366, "end": 368, "text": " than existing state of the art." }, { "start": 368, "end": 372, "text": " And again, he says the basic ingredients" }, { "start": 372, "end": 375, "text": " were already there and so on." }, { "start": 375, "end": 380, "text": " And our team in Switzerland already used" }, { "start": 380, "end": 384, "text": " his first superior award-winning GPU-based CNN and so on." }, { "start": 384, "end": 388, "text": " That's what was called DanNet, was produced by his group." }, { "start": 388, "end": 391, "text": " And again, this seems correct, right?" }, { "start": 391, "end": 393, "text": " This seems when he lays it out like this," }, { "start": 393, "end": 398, "text": " it doesn't change the fact that AlexNet won ImageNet in 2012." }, { "start": 398, "end": 403, "text": " And that was like the start of the deep learning revolution." }, { "start": 403, "end": 410, "text": " It was like, wow, you can cut the error rate by something like 30%" }, { "start": 410, "end": 414, "text": " simply by doing this deep learning stuff." }, { "start": 414, "end": 420, "text": " So again, even if DanNet says it blew away the competition," }, { "start": 420, "end": 425, "text": " it always seems like Schmidhuber is kind of right," }, { "start": 425, "end": 429, "text": " but then also he's not." }, { "start": 429, "end": 434, "text": " He's like, exact academic work" }, { "start": 434, "end": 437, "text": " and the idea being there on a paper" }, { "start": 437, "end": 442, "text": " isn't the only thing that drives progress." }, { "start": 442, "end": 445, "text": " And it says, to achieve their dramatic results," }, { "start": 445, "end": 449, "text": " Dr. Hinton also invented a widely used new method called dropout," }, { "start": 449, "end": 451, "text": " which uses overfitting." }, { "start": 451, "end": 456, "text": " No, like no, like no, just no." }, { "start": 456, "end": 461, "text": " Randomly dropping parts in order to make something more robust," }, { "start": 461, "end": 466, "text": " that is surely not a new thing." }, { "start": 466, "end": 473, "text": " And he also says much earlier, there's this stochastic delta rule and so on." }, { "start": 473, "end": 478, "text": " And he also critiques that this paper did not cite this." }, { "start": 478, "end": 480, "text": " They just gave it the name." }, { "start": 480, "end": 483, "text": " This is an idea that is kind of so simple" }, { "start": 483, "end": 487, "text": " that you wouldn't even necessarily think about researching" }, { "start": 487, "end": 489, "text": " whether that has existed already." }, { "start": 489, "end": 493, "text": " I think they just did it because it's a natural idea," }, { "start": 493, "end": 496, "text": " and then they gave it a name, and the name stuck." }, { "start": 496, "end": 499, "text": " It's not about the idea itself." }, { "start": 499, "end": 502, "text": " And then lastly, they say, of the countless AI-based technological services" }, { "start": 502, "end": 506, "text": " across the world, it is no exaggeration to say that few would have been possible" }, { "start": 506, "end": 509, "text": " without the results Dr. Hinton created." }, { "start": 509, "end": 510, "text": " I love this." }, { "start": 510, "end": 516, "text": " Name one that would not have been possible." }, { "start": 516, "end": 521, "text": " And he just gives a list of their own group" }, { "start": 521, "end": 525, "text": " that are basically possible without Hinton's contributions." }, { "start": 525, "end": 529, "text": " And this is just a bit of a cheap shot." }, { "start": 529, "end": 535, "text": " Clearly, Honda, they're not saying it would have been physically impossible." }, { "start": 535, "end": 538, "text": " Without his contributions." }, { "start": 538, "end": 547, "text": " But certainly Hinton has, even if he hadn't invented any of those things," }, { "start": 547, "end": 551, "text": " he certainly has created a spark." }, { "start": 551, "end": 555, "text": " And these things created a splash, got people excited," }, { "start": 555, "end": 560, "text": " people thinking about new ways of applying things, even if this is all true." }, { "start": 560, "end": 569, "text": " But I would like you to notice," }, { "start": 569, "end": 574, "text": " this is a critique of what Honda says about Hinton." }, { "start": 574, "end": 577, "text": " And if I read through the statements of Schmidhuber," }, { "start": 577, "end": 580, "text": " most of them are technically correct." }, { "start": 580, "end": 583, "text": " And you know, that was that." }, { "start": 583, "end": 585, "text": " And then I thought, OK, cool." }, { "start": 585, "end": 588, "text": " But then someone posted it on Reddit." }, { "start": 588, "end": 592, "text": " And then Hinton replies." }, { "start": 592, "end": 594, "text": " And this is..." }, { "start": 594, "end": 595, "text": " Don't you love this?" }, { "start": 595, "end": 598, "text": " So Hinton says," }, { "start": 598, "end": 602, "text": " Having a public debate with Schmidhuber about academic credit is not advisable" }, { "start": 602, "end": 604, "text": " because it just encourages him." }, { "start": 604, "end": 608, "text": " And there is no limit to the time and effort that he is willing to put" }, { "start": 608, "end": 613, "text": " into trying to discredit his perceived arrivals." }, { "start": 613, "end": 617, "text": " He is even escorted to tricks like having multiple aliases in Wikipedia" }, { "start": 617, "end": 620, "text": " to make it look as if other people agree." }, { "start": 620, "end": 625, "text": " The page on his website about Alan Turing is a nice example" }, { "start": 625, "end": 627, "text": " of how he goes on trying to..." }, { "start": 627, "end": 631, "text": " These are shots fired." }, { "start": 631, "end": 634, "text": " And he says, I'm going to respond once and only once." }, { "start": 634, "end": 638, "text": " I have never claimed that I invented backpropagation." }, { "start": 638, "end": 643, "text": " David Rumelhard invented it independently." }, { "start": 643, "end": 649, "text": " After other people in other fields had invented it." }, { "start": 649, "end": 652, "text": " It's true. When we first published, we did not know the history." }, { "start": 652, "end": 658, "text": " So he basically says, OK, we did forget to cite it when we first published" }, { "start": 658, "end": 664, "text": " about backprop, but he doesn't say he invented it." }, { "start": 664, "end": 666, "text": " What I've claimed is that I was the person to clearly demonstrate that" }, { "start": 666, "end": 669, "text": " backprop could learn interesting internal representations" }, { "start": 669, "end": 672, "text": " and that this is what made it popular." }, { "start": 672, "end": 674, "text": " So this goes into the direction." }, { "start": 674, "end": 677, "text": " Schmidhuber is very much on academic contributions." }, { "start": 677, "end": 678, "text": " Idea was there before." }, { "start": 678, "end": 682, "text": " And Hinton basically says, no, what we did is kind of we showed" }, { "start": 682, "end": 687, "text": " that it works in this particular way and we kind of got people excited about it." }, { "start": 687, "end": 694, "text": " I did this by forcing that, blah, blah, blah." }, { "start": 694, "end": 698, "text": " And he says, it is true that many people in the press have said" }, { "start": 698, "end": 701, "text": " I invented backprop and I've spent a lot of time correcting them." }, { "start": 701, "end": 708, "text": " Here is an excerpt from 2018 where this is, I guess, a quote from this book" }, { "start": 708, "end": 713, "text": " that quotes Hinton where he says, lots of people invented different versions" }, { "start": 713, "end": 715, "text": " of backprop before David Rumelhart." }, { "start": 715, "end": 721, "text": " They were mainly independent inventions, something I feel I've got too much credit for." }, { "start": 721, "end": 726, "text": " It's one of these rare cases where an academic feels he has gotten too much credit for something." }, { "start": 726, "end": 730, "text": " My main contribution was to show you can use it for learning distributor representations." }, { "start": 730, "end": 734, "text": " So I'd like to set the record straight on that." }, { "start": 734, "end": 740, "text": " Then he says, maybe Juergen would like to set the record straight on who invented LSTMs." }, { "start": 740, "end": 743, "text": " Boom, boom." }, { "start": 743, "end": 744, "text": " Crazy." }, { "start": 744, "end": 748, "text": " Shots fired by Hinton here." }, { "start": 748, "end": 751, "text": " This is, I mean, this is just great." }, { "start": 751, "end": 755, "text": " But again, look at what Hinton says." }, { "start": 755, "end": 759, "text": " Hinton basically says, yes, I have not invented that." }, { "start": 759, "end": 764, "text": " I have corrected this on public record in the past." }, { "start": 764, "end": 768, "text": " And yeah, so that's what Hinton says." }, { "start": 768, "end": 774, "text": " And I mean, the comments here are just gold." }, { "start": 774, "end": 776, "text": " I really invite you to read it." }, { "start": 776, "end": 781, "text": " And then Schmidhuber, of course, being Schmidhuber, replies again." }, { "start": 781, "end": 786, "text": " Down here, he has a response to the reply." }, { "start": 786, "end": 790, "text": " And I don't expect Hinton to reply again, so I waited for a bit." }, { "start": 790, "end": 793, "text": " But I believe Hinton when he says he does it only once." }, { "start": 793, "end": 797, "text": " So he goes into this." }, { "start": 797, "end": 805, "text": " It just says, summary, the facts presented in sections one, two, three, four, five are still valid." }, { "start": 805, "end": 808, "text": " So he goes kind of statement by statement." }, { "start": 808, "end": 811, "text": " Is this having a public debate? Blah, blah, blah." }, { "start": 811, "end": 815, "text": " And he just says, well, this is an ad hominem attack, which is true." }, { "start": 815, "end": 816, "text": " Right. This is true." }, { "start": 816, "end": 820, "text": " And he says he even has multiple aliases in Wikipedia." }, { "start": 820, "end": 825, "text": " And he just says another ad hominem attack." }, { "start": 825, "end": 830, "text": " And then he goes into that Schmidhuber tries to discredit Alan Turing." }, { "start": 830, "end": 841, "text": " And then Schmidhuber goes into this big, long, big, long, basically claim that Alan Turing wasn't as important as people made him out to be." }, { "start": 841, "end": 846, "text": " And people invented this kind of Turing machine equivalence before that." }, { "start": 846, "end": 853, "text": " Again, it's kind of Schmidhuber's take that the idea basically was already there and these people don't get the correct credit." }, { "start": 853, "end": 865, "text": " And also he's correct that this is a true it's an ad hominem attack." }, { "start": 865, "end": 869, "text": " Right. So, you know, be it as it may." }, { "start": 869, "end": 871, "text": " This is correct." }, { "start": 871, "end": 881, "text": " And then when Hinton goes that he didn't invent Backprop and Schmidhuber says this is finally a response related to my post, which is true." }, { "start": 881, "end": 885, "text": " Right. However, it does not at all contradict what I wrote." }, { "start": 885, "end": 896, "text": " And it is true that Hinton credited his co-author Rommelhardt with the invention, but neither cited Lin-Neymar and also the statement, lots of people." }, { "start": 896, "end": 901, "text": " He says it wasn't created by lots of different people, but exactly one person." }, { "start": 901, "end": 916, "text": " So this I find, like, can you really say now this is the exact time when Backprop was invented, even though it probably wasn't in the exact current formulation." }, { "start": 916, "end": 919, "text": " And it probably existed somewhat like this." }, { "start": 919, "end": 931, "text": " So, but again, and he his main claim is Dr. Hinton accepted the Honda price, although he apparently agrees that Honda's claims are false." }, { "start": 931, "end": 934, "text": " He should ask Honda to correct their statements." }, { "start": 934, "end": 938, "text": " And maybe you're going to would like to set the record straight." }, { "start": 938, "end": 951, "text": " We invented LSTMs and, you know, as we as you may know, Sepp Hochreiter kind of invented LSTMs under Jürgen Schmidhuber as a PhD advisor." }, { "start": 951, "end": 962, "text": " But the to summarize Dr. Hinton's comments and ad hominem arguments diverge from the contents of my post and do not challenge the facts and so on." }, { "start": 962, "end": 966, "text": " And I have to say after reading this, this is this is correct." }, { "start": 966, "end": 977, "text": " Right. Hinton basically replies to, hey, I, I never claimed I invented Backprop and other people have invented it." }, { "start": 977, "end": 981, "text": " And Schmidhuber doesn't criticize Hinton in this particular post." }, { "start": 981, "end": 991, "text": " He may otherwise. Schmidhuber doesn't criticize Hinton for claiming that he criticizes Honda for claiming that Hinton did." }, { "start": 991, "end": 994, "text": " And Hinton doesn't. Hinton basically agrees with him." }, { "start": 994, "end": 1000, "text": " And also Schmidhuber says Dr. Hinton accepted the Honda price, although he apparently agrees that the claims are false." }, { "start": 1000, "end": 1003, "text": " He should ask Honda to correct their statements." }, { "start": 1003, "end": 1008, "text": " And it is true that Hinton accepted this price under this release." }, { "start": 1008, "end": 1015, "text": " Right. Now, you might be able to say Hinton also says he's on the record basically saying he didn't do this." }, { "start": 1015, "end": 1021, "text": " And I guess if you're Hinton and you know, you've had this you've had the successful career and so on." }, { "start": 1021, "end": 1028, "text": " And you have previously really publicly stated that you didn't invent these things and, you know, made it clear." }, { "start": 1028, "end": 1031, "text": " And then you get a prize and they write this thing." }, { "start": 1031, "end": 1037, "text": " Maybe you just don't want to go after every single press statement and correcting that." }, { "start": 1037, "end": 1047, "text": " But, you know, in essence, basically Hinton understood this as an attack on himself that he claims he invented Backprop." }, { "start": 1047, "end": 1052, "text": " And Schmidhuber says Honda claims Hinton invented Backprop and Hinton accepted the price." }, { "start": 1052, "end": 1062, "text": " So he agrees with it and Hinton basically agrees with it, but doesn't say Honda should have corrected it, which I can understand." }, { "start": 1062, "end": 1066, "text": " So this is my take on this issue." }, { "start": 1066, "end": 1073, "text": " It's kind of both are correct and they just kind of talk past each other." }, { "start": 1073, "end": 1079, "text": " And Schmidhuber is always on the idea existed before." }, { "start": 1079, "end": 1085, "text": " And Hinton is correct when he says it's not always just about the idea." }, { "start": 1085, "end": 1097, "text": " 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, "end": 1100, "text": " But it is fun. It is fun." }, { "start": 1100, "end": 1118, "text": " 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." }, { "start": 1118, "end": 1128, "text": " And even though sometimes it's over the top, like Schmidhuber always going after it, I think we need people like him just kind of to keep the field in check a bit." }, { "start": 1128, "end": 1131, "text": " And yeah, I will link to all of this." }, { "start": 1131, "end": 1135, "text": " I hope you enjoy this and I wish you a nice rest of the weekend." }, { "start": 1135, "end": 1140, "text": " If you're still here, consider subscribing and leave comment if you want." }, { "start": 1140, "end": 1159, "text": " I usually read them. Bye bye." } ]
gJR28onlqzs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
How much memory does Longformer use?
[ "Science & Technology" ]
[ "deep learning", "machine learning", "nlp", "natural language processing", "machine translation", "arxiv", "google", "attention mechanism", "attention", "transformer", "tensor2tensor", "rnn", "recurrent", "seq2seq" ]
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 longformer. 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 longformer is, what it does, how it compares and so on. And the gist of the longformer 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 BERT model doesn't fit into my memory, can this solve my problem? And I just kind of want to go into the math of the longformer 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 implement it. 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, a 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 you do something like overlapping pieces or something like this, right? And now the promise of the longformer as it is in the paper is that you can put all of this into the longformer, 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 longformer window size is 512, right? So within that window you have the classic N squared full attention, right? So let's just go into that. How much memory does the longformer 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 already see it right here, if you have one, two, three, four locations of global attention you have four times two because you also have them in this direction, right? You have them in both directions times your full sequence length. So plus two 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 N zero in their experiments. So let's replace this window size by N zero and actually let's factor out the N. So we'll get to N times N zero plus 2S. Alright, so you can already see that Roberta originally had N zero squared. Now if N is larger than N zero that means you already use more here. The kind of trick, 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 Roberta was the window size of the long former. So this is N zero squared, right? And here technically you'd have to say this is N times N zero. So if N is larger than N zero 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 large-ish 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 Roberta and right now I can do N squared. So this is N, this is N, so there's N zero, N zero. This is my sequence length that I can put into Roberta. 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 N zero. 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 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 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, and 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 you 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 attentions 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 longformer that takes in the same amount of memory as a your classic model but can take a full n 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 liked this consider subscribing, liking and bye bye.
[ { "start": 0, "end": 7.32, "text": " So I wanted to come back to this paper here about the longformer. I have done a" }, { "start": 7.32, "end": 11, "text": " video on this. If you haven't seen it then this video is probably not going to" }, { "start": 11, "end": 16.32, "text": " make much sense to you. But in the video I go over what the longformer is, what it" }, { "start": 16.32, "end": 21.52, "text": " does, how it compares and so on. And the gist of the longformer is that it can" }, { "start": 21.52, "end": 31.36, "text": " now do a transformer model on a long document as you can read here. So I've" }, { "start": 31.36, "end": 35.96, "text": " gotten a lot of questions of like does that mean we can now have much longer" }, { "start": 35.96, "end": 41.2, "text": " documents, right? The BERT model doesn't fit into my memory, can this solve my" }, { "start": 41.2, "end": 47.519999999999996, "text": " problem? And I just kind of want to go into the math of the longformer memory" }, { "start": 47.52, "end": 54.88, "text": " requirements here because I think I've alluded to it but it is quite a..." }, { "start": 54.88, "end": 62.400000000000006, "text": " I think the graphics here are just a bit misleading from the way they implement" }, { "start": 62.400000000000006, "end": 68.36, "text": " it. Now I've already gone over something like this in the last thing. So Roberta," }, { "start": 68.36, "end": 77.12, "text": " let's spell this correctly, Roberta, that is their baseline, has a size, a" }, { "start": 77.12, "end": 88.4, "text": " let's call that N0 of 512. So they can have 512 tokens at the same time. So if" }, { "start": 88.4, "end": 94.48, "text": " you have a sequence that is way longer than 512 you need to chunk it up into" }, { "start": 94.48, "end": 100.60000000000001, "text": " pieces of 512 and usually you do something like overlapping pieces or" }, { "start": 100.60000000000001, "end": 106, "text": " something like this, right? And now the promise of the longformer as it is in" }, { "start": 106, "end": 114.28, "text": " the paper is that you can put all of this into the longformer, right? And it" }, { "start": 114.28, "end": 121.84, "text": " will do this sliding window attention thing where it basically slides a window" }, { "start": 121.84, "end": 129.24, "text": " here, this window, across this input sequence and only does this local" }, { "start": 129.24, "end": 134.56, "text": " attention, right, within the window. And then it also has some global attention" }, { "start": 134.56, "end": 140.56, "text": " that it constantly has. Now what I find interesting is that in their experiments" }, { "start": 140.56, "end": 149.28, "text": " their window size here, so the longformer window size is 512, right? So" }, { "start": 149.28, "end": 158.84, "text": " within that window you have the classic N squared full attention, right? So let's" }, { "start": 158.84, "end": 166.92000000000002, "text": " just go into that. How much memory does the longformer really do? We've" }, { "start": 166.92000000000002, "end": 175.68, "text": " already calculated it here a bit but I want to take this still apart a bit. So" }, { "start": 175.68, "end": 185.92000000000002, "text": " as you can see on the left here you have N times W that you have for this middle" }, { "start": 185.92, "end": 194, "text": " band, right? So this middle band is N times W. Then you want to add the global" }, { "start": 194, "end": 200.04, "text": " attention, right? So the global attention, you can already see it right here, if you" }, { "start": 200.04, "end": 209.04, "text": " have one, two, three, four locations of global attention you have four times two" }, { "start": 209.04, "end": 214.16, "text": " because you also have them in this direction, right? You have them in both" }, { "start": 214.16, "end": 221.96, "text": " directions times your full sequence length. So plus two times full sequence" }, { "start": 221.96, "end": 231.07999999999998, "text": " length times the number of global attention. I call this S over here. So as" }, { "start": 231.07999999999998, "end": 242.07999999999998, "text": " we saw up here the window size here was N zero in their experiments. So let's" }, { "start": 242.08, "end": 251.24, "text": " replace this window size by N zero and actually let's factor out the N. So we'll" }, { "start": 251.24, "end": 268.04, "text": " get to N times N zero plus 2S. Alright, so you can already see that Roberta" }, { "start": 268.04, "end": 278.96000000000004, "text": " originally had N zero squared. Now if N is larger than N zero that means you" }, { "start": 278.96000000000004, "end": 287.84000000000003, "text": " already use more here. The kind of trick, it's not really a trick, it is" }, { "start": 287.84000000000003, "end": 297.44, "text": " true that this is order of N, right? If N is your input sequence length but in" }, { "start": 297.44, "end": 307.4, "text": " this here is technically order of N squared if N, if this is N. But the" }, { "start": 307.4, "end": 314.42, "text": " sequence length in Roberta was the window size of the long former. So this" }, { "start": 314.42, "end": 320.4, "text": " is N zero squared, right? And here technically you'd have to say this is N" }, { "start": 320.4, "end": 330.32, "text": " times N zero. So if N is larger than N zero you can see that this uses more" }, { "start": 330.32, "end": 338.03999999999996, "text": " memory given that. So in their experiments they use a model that on" }, { "start": 338.03999999999996, "end": 345.76, "text": " paper uses more memory than the baseline model and saying that it scales" }, { "start": 345.76, "end": 351.88, "text": " linearly with sequence length is because, I mean of course it scales linearly" }, { "start": 351.88, "end": 358.56, "text": " because they can now input these long sequences, right? And the attention, sorry" }, { "start": 358.56, "end": 364.15999999999997, "text": " the memory requirements scales basically linear and also linear with the window" }, { "start": 364.15999999999997, "end": 371.48, "text": " size. Now the window size still needs to be apparently large-ish in order to" }, { "start": 371.48, "end": 376.08000000000004, "text": " achieve the performance. So the fact that the performance is equal or better is" }, { "start": 376.08000000000004, "end": 386.32, "text": " not really a secret because it uses more memory, right? It's not like this model" }, { "start": 386.32, "end": 395.28000000000003, "text": " uses less memory but outperforms the old one, it uses more. If you want to look at" }, { "start": 395.28, "end": 407.52, "text": " it you have to ask, okay I have Roberta and right now I can do N squared. So this" }, { "start": 407.52, "end": 413.35999999999996, "text": " is N, this is N, so there's N zero, N zero. This is my sequence length that I can put" }, { "start": 413.35999999999996, "end": 419.35999999999996, "text": " into Roberta. You have to ask yourself what kind of sequence do I want to put" }, { "start": 419.36, "end": 429.44, "text": " in? And if you say I want to put in a sequence that's twice as long, right? I" }, { "start": 429.44, "end": 436.88, "text": " want to put in this long of a sequence, so N here would be twice N zero. Then you" }, { "start": 436.88, "end": 444.96000000000004, "text": " have to take this, put it here, put it here and then you realize, yes, that your" }, { "start": 444.96, "end": 451.32, "text": " window size of the long former can only be half, right? So if you have the same" }, { "start": 451.32, "end": 456.12, "text": " amount of memory you can double your sequence length at the cost of having" }, { "start": 456.12, "end": 462.91999999999996, "text": " your window size but that doesn't yet include the cost of the global" }, { "start": 462.91999999999996, "end": 468.56, "text": " attention. So any global attention you do will come basically on top of the window" }, { "start": 468.56, "end": 478.12, "text": " size. You see this here, right? So you decide on, let's do it like this, you" }, { "start": 478.12, "end": 484.04, "text": " decide on how long you want your thing, your input sequence length to be, then" }, { "start": 484.04, "end": 489.04, "text": " you decide, and that means that's this rectangle here, then you decide how many" }, { "start": 489.04, "end": 496.48, "text": " global attentions do I want and here I say I want one global attention and you" }, { "start": 496.48, "end": 502.16, "text": " have to cross out as many rows here as you want global attention and what" }, { "start": 502.16, "end": 507.84000000000003, "text": " remains is your window. Actually you have to cross out twice but we don't have, we" }, { "start": 507.84000000000003, "end": 513.52, "text": " only have one left, but you get the point. You have to cross out two times S rows" }, { "start": 513.52, "end": 520.12, "text": " of how many global attentions you want and what remains will be your window" }, { "start": 520.12, "end": 525.9200000000001, "text": " size. In this case it's just a window size of one. So that's how you would" }, { "start": 525.92, "end": 533.1999999999999, "text": " construct a longformer that takes in the same amount of memory as a your classic" }, { "start": 533.1999999999999, "end": 541.92, "text": " model but can take a full n sequence length. Alright? So I just wanted to kind" }, { "start": 541.92, "end": 549.8399999999999, "text": " of make that clear, go through the calculation myself and I hope that helped." }, { "start": 549.84, "end": 556.44, "text": " Thanks for listening and if you liked this consider subscribing, liking and" }, { "start": 556.44, "end": 580.36, "text": " bye bye." } ]
MpdbFLXOOIw
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Supervised Contrastive Learning
[ "Science & Technology" ]
[ "deep learning", "machine learning", "supervised learning", "classification", "classifier", "labels", "pretraining", "unsupervised", "self-supervised", "representation learning", "representations", "hidden space", "loss function", "google", "mit", "imagenet" ]
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 rand 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 they claim it is a big claim, right? We 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. So here's the but. It is actually not a new loss to replace the cross entropy loss. And they do come about this pretty quickly. I don't think they're dishonest or lying or anything here. But it is sort of if you start reading you 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 what does it mean to build a classifier, this is what you usually do. You do 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 are 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 class does it belong to with what probability. They also have this label right here. So the label dog for that image, what you do with that is you do a one hot vector. 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 this so this entire thing reduces to the log probability of the correct class. This is what you want to maximize. Therefore, you 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, right? And it doesn't do anything to the other ones. But you have to realize that this softmax 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, right? So what this does is it pushes the correct class up, and it pushes the other classes down. So this, 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 softmax 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, right? 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 this softmax 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. Right, 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 another 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 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 classifier is 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 thing, 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 this, so this stage one, and then in stage two, and there is where 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. All you 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 you train the classifier in the old cross entropy way, using just normal supervised learning. So what we see here is that the stage one pre training is is what's training the network and the cross entropy loss only trains the classifier. Right, so let's look at how this pre training actually work what is using 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, right? So you simply want the network to learn representations of images that are somehow meaningful, right? That are there. 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. Natives are simply different images from your data set, right? For example, this or this or this, you don't care as long as they're different, right? You just sample a bunch. And what you want, so your 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 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 spread the data and 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-train a classifier is the thing they show on the right. So on the left here you have a picture of a dog. 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. 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? So the task here is implicitly making the task for the later classifier harder by pushing apart samples that should be of the same class. And so this is not happening if you introduce 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 versions. 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 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 than if you just hammer on hammer with the contrastive sorry with the cross entropy loss from the beginning. So 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 and unlabeled data is pretty cheap to obtain. So that's the advantages and disadvantages here. So this new loss, so they they do compare this here. And usually in these contrastive objectives, you have somewhat like two encoders, one to encode the the anchor and one to encode the augmented versions. And this one is like a momentum with shared weights and so on. 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 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 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 sample 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, that is the standard objective that you had before they, 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 is 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 p ij quantity and the p ij quantity is exactly the inner product between i and j normalized, of course. So if you minimum, so the gradient is going to point into the negative direction of that for the positives, which means you're going to pull them together. And it's going to push into this direction for the negative classes, which means you push them apart. And they also analyze what happens with relation to hardness. So they say there are two kinds of, if you just look at the positive samples, there are two kinds. There 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 p ij quantity is large, right? 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 they're 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. So 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 apart of inner products for the positive and negative samples. And it mainly focuses on samples where you not yet have found a good representation to align them with others. It focuses on pairs that are not yet correctly close or together or far apart. 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 called this hard negative mining, because you only have one negative sample, you better make this something where the network can learn from. And if it's too easy, the network can't learn anything. And thereby you have the problem of hard negative mining, where you often have to filter through your mini batch or even through your data set to 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. There's not really a difference here. 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. I think this paper just gets around it by having huge batch sizes. So yeah, but again, they do get state of the art on ImageNet for these types of networks and augmentation strategies. And they do look at how their loss appears to be more hyperparameter 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 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 ImageNet. So there's an ImageNet data set where 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 trained 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. It's not clear whether that's really an effect of the difference of the losses or it's 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 it is an interesting finding that their method is more stable to these corruptions. I just want to point out at the end, their training details just highlight they train for up to 700 epochs during the pre-training stage, which is, I think, standard but mad. And they trained up models with batch sizes up to 8192. 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 kind of a good improvement, it is still like a 1% improvement. And in these small numbers, I just feel 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 that 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, "end": 5.96, "text": " Hi there, today we're looking at supervised contrastive learning by people from Google" }, { "start": 5.96, "end": 8.56, "text": " Research and MIT." }, { "start": 8.56, "end": 14.120000000000001, "text": " Now this paper proposes a new loss for supervised learning." }, { "start": 14.120000000000001, "end": 19.12, "text": " And you might recognize that this is a big claim." }, { "start": 19.12, "end": 25.48, "text": " So forever now we've basically used this cross entropy loss in order to do supervised training" }, { "start": 25.48, "end": 27.68, "text": " of neural networks." }, { "start": 27.68, "end": 33.8, "text": " This paper proposes to replace that with the supervised contrastive loss." }, { "start": 33.8, "end": 36.4, "text": " And let's jump straight into the results here." }, { "start": 36.4, "end": 42.68, "text": " They say our supervised contrastive loss outperforms the cross entropy loss with standard data" }, { "start": 42.68, "end": 47.36, "text": " augmentations such as auto augment and rand augment." }, { "start": 47.36, "end": 52.56, "text": " So these are some of the previous state of the art data augmentation techniques used" }, { "start": 52.56, "end": 55.6, "text": " together with the cross entropy loss." }, { "start": 55.6, "end": 59, "text": " And they say their supervised contrastive loss outperforms them." }, { "start": 59, "end": 65.24000000000001, "text": " You can see here on ImageNet, which is the biggest vision benchmark or the most famous" }, { "start": 65.24000000000001, "end": 71.68, "text": " one, this new loss, the supervised contrastive loss, outperforms these other methods by" }, { "start": 71.68, "end": 74.68, "text": " something like a percent." }, { "start": 74.68, "end": 78.1, "text": " One percent is a big improvement on ImageNet right now." }, { "start": 78.1, "end": 82.56, "text": " So they claim it is a big claim, right?" }, { "start": 82.56, "end": 89.2, "text": " We recognize if this is true, this could be a game changer basically for all of supervised" }, { "start": 89.2, "end": 90.2, "text": " learning." }, { "start": 90.2, "end": 95.18, "text": " And supervised learning is really the only thing right now in deep learning that works." }, { "start": 95.18, "end": 99.12, "text": " So it could revolutionize the field." }, { "start": 99.12, "end": 100.44, "text": " So here's the but." }, { "start": 100.44, "end": 105.76, "text": " It is actually not a new loss to replace the cross entropy loss." }, { "start": 105.76, "end": 110.76, "text": " And they do come about this pretty quickly." }, { "start": 110.76, "end": 114.84, "text": " I don't think they're dishonest or lying or anything here." }, { "start": 114.84, "end": 119.96000000000001, "text": " But it is sort of if you start reading you like what this is a new loss." }, { "start": 119.96000000000001, "end": 120.96000000000001, "text": " It is not." }, { "start": 120.96000000000001, "end": 127.60000000000001, "text": " It is a new way of pre training the network for a classification task." }, { "start": 127.60000000000001, "end": 131.04000000000002, "text": " And so let's look into this." }, { "start": 131.04000000000002, "end": 137.8, "text": " So if you look at what does what does it mean to build a classifier, this is what you usually" }, { "start": 137.8, "end": 138.8, "text": " do." }, { "start": 138.8, "end": 142.76000000000002, "text": " You do supervised cross entropy training, you have an image and the image here is of" }, { "start": 142.76000000000002, "end": 148, "text": " a dog, you put it through your network, and you obtain a representation." }, { "start": 148, "end": 154.72, "text": " So the representation here are is this last layer, or the second to last layer." }, { "start": 154.72, "end": 159.76000000000002, "text": " And you put that through a classification layer and then a softmax." }, { "start": 159.76000000000002, "end": 164.24, "text": " And what you get as an output is basically a probability distribution." }, { "start": 164.24, "end": 167.08, "text": " And let's say you have three classes here." }, { "start": 167.08, "end": 171.32000000000002, "text": " There's dog, there's cat, and there's horse." }, { "start": 171.32000000000002, "end": 175.36, "text": " And let's say the network doesn't yet isn't yet trained very well." }, { "start": 175.36, "end": 179.8, "text": " So the probability for dog here is fairly low." }, { "start": 179.8, "end": 184.64000000000001, "text": " So this is basically what the network thinks of that image, like which class does it belong" }, { "start": 184.64000000000001, "end": 186.04000000000002, "text": " to with what probability." }, { "start": 186.04000000000002, "end": 189.3, "text": " They also have this label right here." }, { "start": 189.3, "end": 195.34, "text": " So the label dog for that image, what you do with that is you do a one hot vector." }, { "start": 195.34, "end": 197.68, "text": " So that would look like this." }, { "start": 197.68, "end": 202.44, "text": " So the one is at the position where the correct class is." }, { "start": 202.44, "end": 206.5, "text": " And then the cross entropy loss takes all of this and does the following." }, { "start": 206.5, "end": 208.28, "text": " There's a sum over all your classes." }, { "start": 208.28, "end": 210.6, "text": " In this case, you have three classes." }, { "start": 210.6, "end": 218.6, "text": " And let's call these the labels L. And you want to always take the label of the class" }, { "start": 218.6, "end": 225.96, "text": " times the log probability that the network thinks belongs to this class." }, { "start": 225.96, "end": 234.1, "text": " So you can quickly see that this if the label is zero, so for all the incorrect classes," }, { "start": 234.1, "end": 236.84, "text": " that means this entire term drops away." }, { "start": 236.84, "end": 244.95999999999998, "text": " And only if the label is one, so only the correct class that will result in the log" }, { "start": 244.96, "end": 253.48000000000002, "text": " probability of the class where the label is the correct label." }, { "start": 253.48000000000002, "end": 258.24, "text": " So in order to make this a loss, you actually have to put a negative sign in front of here" }, { "start": 258.24, "end": 265.12, "text": " because you want to this so this entire thing reduces to the log probability of the correct" }, { "start": 265.12, "end": 266.12, "text": " class." }, { "start": 266.12, "end": 267.72, "text": " This is what you want to maximize." }, { "start": 267.72, "end": 273.28000000000003, "text": " Therefore, you if you want to minimize something you need." }, { "start": 273.28, "end": 278.96, "text": " So you minimize the negative log probability of the correct class, which means you maximize" }, { "start": 278.96, "end": 283.46, "text": " the probability." }, { "start": 283.46, "end": 287.79999999999995, "text": " If you've never looked at the cross entropy loss like this, it is important to notice" }, { "start": 287.79999999999995, "end": 293.52, "text": " that you're going to say, hey, all this does is pull this here up, right?" }, { "start": 293.52, "end": 296.55999999999995, "text": " And it doesn't do anything to the other ones." }, { "start": 296.55999999999995, "end": 301.79999999999995, "text": " But you have to realize that this softmax operation, since this is a probability distribution," }, { "start": 301.8, "end": 304.52000000000004, "text": " all of this is normalized to sum up to one." }, { "start": 304.52000000000004, "end": 309.88, "text": " So implicitly, you will push these down through the normalization, right?" }, { "start": 309.88, "end": 314, "text": " So what this does is it pushes the correct class up, and it pushes the other classes" }, { "start": 314, "end": 315.04, "text": " down." }, { "start": 315.04, "end": 320.28000000000003, "text": " So this, to look at this is going to be important later." }, { "start": 320.28000000000003, "end": 326.44, "text": " Because if you look at what this representation here does, so again, you have the network" }, { "start": 326.44, "end": 328.52, "text": " produces a representation here." }, { "start": 328.52, "end": 334.44, "text": " This is 2000 dimensional, and then it does, it adds on top this classification layer," }, { "start": 334.44, "end": 340.4, "text": " this classification layer is simply a linear layer, and then a softmax on top." }, { "start": 340.4, "end": 346.44, "text": " So how you have to imagine this is that there is a representation space, this 2000 dimensional" }, { "start": 346.44, "end": 357.64, "text": " space, and the representations are made in such a way that the labels such that sorry," }, { "start": 357.64, "end": 360.12, "text": " let's have three classes here." }, { "start": 360.12, "end": 365.52, "text": " The representations are made in such a way that a linear classifier can separate them" }, { "start": 365.52, "end": 367.64, "text": " correctly, right?" }, { "start": 367.64, "end": 370.56, "text": " So here, this would be like a boundary." }, { "start": 370.56, "end": 374.28, "text": " And then this would be another boundary." }, { "start": 374.28, "end": 377, "text": " And this maybe would be another decision boundary." }, { "start": 377, "end": 382.41999999999996, "text": " So you can see that linear classifier can separate the classes well." }, { "start": 382.41999999999996, "end": 383.41999999999996, "text": " That is the goal." }, { "start": 383.42, "end": 389.08000000000004, "text": " If you use this softmax cross entropy loss, that is implicitly what will happen in the" }, { "start": 389.08000000000004, "end": 394.88, "text": " representation space W. All it cares about is that the classes are on one side of the" }, { "start": 394.88, "end": 401.24, "text": " decision boundary and everything else is on the other side of a decision boundary." }, { "start": 401.24, "end": 406.08000000000004, "text": " So if you have the network isn't trained very well at the beginning, and you maybe have" }, { "start": 406.08000000000004, "end": 412.44, "text": " a sample of the green class here, it will push the network such that the representation" }, { "start": 412.44, "end": 418.6, "text": " of that sample will go onto the other side of this decision boundary and it will push" }, { "start": 418.6, "end": 423.24, "text": " the decision boundary at the same time to make that happen more easily." }, { "start": 423.24, "end": 426.56, "text": " Right, so it will optimize all of this at the same time." }, { "start": 426.56, "end": 427.92, "text": " That's what you do." }, { "start": 427.92, "end": 429.96, "text": " That's how you optimize the representations." }, { "start": 429.96, "end": 439.28, "text": " So this work here, and another work has said, wouldn't it be great if the representation" }, { "start": 439.28, "end": 445.23999999999995, "text": " and decision boundaries weren't just trained at the same time for this, but we learn good" }, { "start": 445.23999999999995, "end": 451.08, "text": " representations first, such that classifying them becomes very simple." }, { "start": 451.08, "end": 459.03999999999996, "text": " And in essence, what this paper says is, if we have a representation space W, shouldn't" }, { "start": 459.03999999999996, "end": 465.47999999999996, "text": " images of the same class, shouldn't we just make them close together?" }, { "start": 465.48, "end": 472.02000000000004, "text": " So without caring about decision boundaries, we just want them to be close to each other." }, { "start": 472.02000000000004, "end": 476.12, "text": " And we want them to be far apart from other classes." }, { "start": 476.12, "end": 481.20000000000005, "text": " If that happens, you can see that a linear classifier is going to have a very easy time" }, { "start": 481.20000000000005, "end": 485.16, "text": " separating these classes later." }, { "start": 485.16, "end": 488.48, "text": " So that's exactly what this paper does." }, { "start": 488.48, "end": 491.98, "text": " It has a pre training stage and a training stage." }, { "start": 491.98, "end": 496.8, "text": " So in the pre training stage, this is over here, supervised contrastive." }, { "start": 496.8, "end": 503.36, "text": " In the pre training stage, it simply tries to learn these representations, like over" }, { "start": 503.36, "end": 511.76, "text": " like down here, such that without the decision boundaries, class thing, images of the same" }, { "start": 511.76, "end": 519.12, "text": " class are close together, and images of different classes are far apart, which notice the subtle" }, { "start": 519.12, "end": 523.72, "text": " difference right to the cross entropy loss where you just care about them being on one" }, { "start": 523.72, "end": 527.24, "text": " or the other side of a decision boundary." }, { "start": 527.24, "end": 537.08, "text": " And in stage this, so this stage one, and then in stage two, and there is where where" }, { "start": 537.08, "end": 540.5600000000001, "text": " it comes in, you basically freeze the network." }, { "start": 540.5600000000001, "end": 545.44, "text": " So you freeze these weights down here, these are frozen, you don't train them anymore." }, { "start": 545.44, "end": 550, "text": " All you train is this one classification layer." }, { "start": 550, "end": 556, "text": " So the represent you actually freeze also the representation layer here, you only train" }, { "start": 556, "end": 562.6800000000001, "text": " the classifier on top in stage two, but you train it using softmax and using the cross" }, { "start": 562.6800000000001, "end": 563.82, "text": " entropy loss." }, { "start": 563.82, "end": 571.5200000000001, "text": " So you you train the classifier in the old cross entropy way, using just normal supervised" }, { "start": 571.5200000000001, "end": 572.5200000000001, "text": " learning." }, { "start": 572.52, "end": 579.48, "text": " So what we see here is that the stage one pre training is is what's training the network" }, { "start": 579.48, "end": 582.4, "text": " and the cross entropy loss only trains the classifier." }, { "start": 582.4, "end": 588.64, "text": " Right, so let's look at how this pre training actually work what is using what it's using" }, { "start": 588.64, "end": 592.52, "text": " is a method called contrastive pre training." }, { "start": 592.52, "end": 597.36, "text": " Now in contrastive pre training, and they have a little diagram up here, what this does" }, { "start": 597.36, "end": 603.6, "text": " is if you look at the classic way of doing contrastive pre training, you have to go to" }, { "start": 603.6, "end": 610.48, "text": " the unsupervised pre training literature, people have kind of discovered that they can" }, { "start": 610.48, "end": 616.46, "text": " improve a neural network by pre training it first in an unsupervised way." }, { "start": 616.46, "end": 620.66, "text": " This is also called some of these methods are called self supervised." }, { "start": 620.66, "end": 626.6, "text": " So the advantage here of self supervised or unsupervised pre training is that you don't" }, { "start": 626.6, "end": 628.12, "text": " need labels." }, { "start": 628.12, "end": 634.44, "text": " What you want to do is simply to make the representation space somewhat meaningful," }, { "start": 634.44, "end": 635.44, "text": " right?" }, { "start": 635.44, "end": 642.72, "text": " So you simply want the network to learn representations of images that are somehow meaningful, right?" }, { "start": 642.72, "end": 644.48, "text": " That are there." }, { "start": 644.48, "end": 646.84, "text": " And here's how you do it." }, { "start": 646.84, "end": 653.62, "text": " So you want to take an image like this dog here." }, { "start": 653.62, "end": 659.4, "text": " And then you want to randomly augment this image, which just means you want to produce" }, { "start": 659.4, "end": 661.78, "text": " different versions of the same image." }, { "start": 661.78, "end": 666.92, "text": " In this case down here, this is a random crop, it's cropped about here, it's still the same" }, { "start": 666.92, "end": 669.44, "text": " image but it's kind of a different version of it." }, { "start": 669.44, "end": 674.52, "text": " In the case here, you can see that it's flipped left right and the brightness is slightly" }, { "start": 674.52, "end": 676.5600000000001, "text": " increased." }, { "start": 676.5600000000001, "end": 679.8, "text": " So these are just different versions of the same image." }, { "start": 679.8, "end": 683.5600000000001, "text": " And what you also want are what's called negatives." }, { "start": 683.56, "end": 687.76, "text": " Natives are simply different images from your data set, right?" }, { "start": 687.76, "end": 692, "text": " For example, this or this or this, you don't care as long as they're different, right?" }, { "start": 692, "end": 694, "text": " You just sample a bunch." }, { "start": 694, "end": 700.2399999999999, "text": " And what you want, so your embedding space and they make a big deal here that they are" }, { "start": 700.2399999999999, "end": 702.7199999999999, "text": " normalized and that seems to work better." }, { "start": 702.7199999999999, "end": 707.64, "text": " But this is not necessary for the idea to work." }, { "start": 707.64, "end": 717.48, "text": " The big idea is here that if you have an image right here, let's say this is the dog, and" }, { "start": 717.48, "end": 724.04, "text": " the blue dots here are the augmented versions of the same dog, and the green dots are all" }, { "start": 724.04, "end": 726.3199999999999, "text": " the other images in the data set." }, { "start": 726.3199999999999, "end": 734.96, "text": " What you want is that all the images that come from the original same image are pulled" }, { "start": 734.96, "end": 739.76, "text": " close together and everything else is pushed apart." }, { "start": 739.76, "end": 741.1600000000001, "text": " Right?" }, { "start": 741.1600000000001, "end": 746.9200000000001, "text": " So that's why these are called positives and these are called negatives." }, { "start": 746.9200000000001, "end": 751.5600000000001, "text": " So the contrastive training basically means that you always want to have a set that you" }, { "start": 751.5600000000001, "end": 757.64, "text": " pull together in representation space and a set called the negatives that you push apart." }, { "start": 757.64, "end": 763.9200000000001, "text": " So the network basically learns about these random transformations that you have here." }, { "start": 763.92, "end": 768.28, "text": " The network learns what it means to come from the same image." }, { "start": 768.28, "end": 771.8, "text": " It learns to be robust to these kind of transformations." }, { "start": 771.8, "end": 777.76, "text": " It learns about the data in general and how to spread the data and embedding space with" }, { "start": 777.76, "end": 779.16, "text": " these transformations." }, { "start": 779.16, "end": 785.8399999999999, "text": " So this usually ends up in a pretty good representation space and people have been using this in recent" }, { "start": 785.8399999999999, "end": 790.28, "text": " years in order to gain significant improvements." }, { "start": 790.28, "end": 797.56, "text": " Now the problem here, if you specifically do this to pre-train a classifier is the thing" }, { "start": 797.56, "end": 799.12, "text": " they show on the right." }, { "start": 799.12, "end": 804.6, "text": " So on the left here you have a picture of a dog." }, { "start": 804.6, "end": 809.3199999999999, "text": " But if you just do this self-supervised, you do it without the labels." }, { "start": 809.3199999999999, "end": 817.64, "text": " So it can happen that this image here shows up in the negatives, but it is also of a dog." }, { "start": 817.64, "end": 823.08, "text": " And now this image here is going to end up maybe being this image here." }, { "start": 823.08, "end": 824.4399999999999, "text": " And you see what happens to it." }, { "start": 824.4399999999999, "end": 825.4399999999999, "text": " It's a green one." }, { "start": 825.4399999999999, "end": 827.24, "text": " So it's going to get pushed apart." }, { "start": 827.24, "end": 832.16, "text": " And this is going to make the entire task for the later classifier much harder because" }, { "start": 832.16, "end": 838.8, "text": " if they are pushed apart from each other, how is a linear classifier going to have them" }, { "start": 838.8, "end": 843.4, "text": " on the same side of the decision boundary while having everything else on a different" }, { "start": 843.4, "end": 844.76, "text": " side?" }, { "start": 844.76, "end": 852.42, "text": " So the task here is implicitly making the task for the later classifier harder by pushing" }, { "start": 852.42, "end": 857.2, "text": " apart samples that should be of the same class." }, { "start": 857.2, "end": 864, "text": " And so this is not happening if you introduce labels to the pre-training objective." }, { "start": 864, "end": 867.56, "text": " That's what they do, the supervised contrastive objective." }, { "start": 867.56, "end": 874.4, "text": " Now you still, all you want to do is here, we're going to draw the same embedding space" }, { "start": 874.4, "end": 877.1999999999999, "text": " and we're going to draw this original dog image." }, { "start": 877.1999999999999, "end": 881.52, "text": " And we're going to draw the augmented version of the original dog image." }, { "start": 881.52, "end": 884.52, "text": " But now we also have the following." }, { "start": 884.52, "end": 889.04, "text": " We also have these images, which are images of the same class." }, { "start": 889.04, "end": 892.16, "text": " So we're going to put them in black here." }, { "start": 892.16, "end": 898.1999999999999, "text": " And let's say the augmented versions around them in smaller black dots, augmented versions" }, { "start": 898.1999999999999, "end": 899.1999999999999, "text": " of those, right?" }, { "start": 899.1999999999999, "end": 901.1999999999999, "text": " You can augment them as well." }, { "start": 901.2, "end": 904.6800000000001, "text": " And then you have the negative samples." }, { "start": 904.6800000000001, "end": 910.12, "text": " And the negative samples are not just any images, but just images of different classes." }, { "start": 910.12, "end": 915.32, "text": " So you just go over your mini batch and all everything that's of the same class becomes" }, { "start": 915.32, "end": 920.9200000000001, "text": " positives, including their augmentations, and everything that is not in the same class" }, { "start": 920.9200000000001, "end": 922.0400000000001, "text": " becomes negatives." }, { "start": 922.0400000000001, "end": 924.84, "text": " And also you can augment them as well." }, { "start": 924.84, "end": 928.1600000000001, "text": " So now we have a bunch of things in our embedding space." }, { "start": 928.16, "end": 934.64, "text": " And our objective is simply going to be, again, we want to push away all the images that are" }, { "start": 934.64, "end": 939.68, "text": " not of the same class as our original, as our red original image, which is called the" }, { "start": 939.68, "end": 940.68, "text": " anchor." }, { "start": 940.68, "end": 944.0799999999999, "text": " So all of this needs to be pushed away." }, { "start": 944.0799999999999, "end": 950.28, "text": " But now we want to pull together all the augmented versions of the original image, but also we" }, { "start": 950.28, "end": 957.72, "text": " want to pull together all of the other images of the same class, including also their augmented" }, { "start": 957.72, "end": 958.72, "text": " versions." }, { "start": 958.72, "end": 961.2, "text": " So all of this is going to be pulled together." }, { "start": 961.2, "end": 965.84, "text": " So not only does the network learn about these augmentations, which again, for this idea," }, { "start": 965.84, "end": 968.6, "text": " the augmentations aren't even necessary." }, { "start": 968.6, "end": 975.32, "text": " The network learns a representation space where images of the same class are close together," }, { "start": 975.32, "end": 980.6800000000001, "text": " which again is going to make the task of later linear classifiers that needs to separate" }, { "start": 980.6800000000001, "end": 984.3000000000001, "text": " this class from other classes very, very easy." }, { "start": 984.3, "end": 987.92, "text": " And again, the other images aren't just going to be pushed away, but if they're from the" }, { "start": 987.92, "end": 992.4399999999999, "text": " same class, let's say this and this image are from the same class, all of those are" }, { "start": 992.4399999999999, "end": 999.16, "text": " going to be pushed apart from our red dot, but by themselves being pushed together to" }, { "start": 999.16, "end": 1003.4399999999999, "text": " their own cluster here of their own class." }, { "start": 1003.4399999999999, "end": 1004.88, "text": " I hope this makes sense." }, { "start": 1004.88, "end": 1011.1999999999999, "text": " And I hope the difference to the cross entropy objective is sort of clear." }, { "start": 1011.2, "end": 1015.76, "text": " The cross entropy objective simply from the beginning just cares about which side of the" }, { "start": 1015.76, "end": 1017.5600000000001, "text": " decision boundary you're on." }, { "start": 1017.5600000000001, "end": 1023.6400000000001, "text": " While this pre training objective first cares to put things close together that are in the" }, { "start": 1023.6400000000001, "end": 1031.24, "text": " same class, and then the decision classifier will have a much easier time." }, { "start": 1031.24, "end": 1037.46, "text": " The reason why this works better than the because because it's not entirely clear from" }, { "start": 1037.46, "end": 1042.2, "text": " the beginning that why this should work better because it's working with the same information." }, { "start": 1042.2, "end": 1047.72, "text": " It's just because people have generally found that these pre training contrastive pre training" }, { "start": 1047.72, "end": 1053.6000000000001, "text": " objectives, they just are somewhat better at exploiting the information in the data" }, { "start": 1053.6000000000001, "end": 1061, "text": " set than if you just hammer on hammer with the contrastive sorry with the cross entropy" }, { "start": 1061, "end": 1064.06, "text": " loss from the beginning." }, { "start": 1064.06, "end": 1068.86, "text": " So but it is not fully explained yet why this works better because it's working with the" }, { "start": 1068.86, "end": 1070.04, "text": " same data." }, { "start": 1070.04, "end": 1076.62, "text": " Again, the difference here is that the previous methods of contrastive pre training the self" }, { "start": 1076.62, "end": 1081.04, "text": " supervised ones, they did not have access to the labels." }, { "start": 1081.04, "end": 1088.04, "text": " And the advantage of that is you can have a giant database of unlabeled additional data" }, { "start": 1088.04, "end": 1091.8, "text": " that you do the pre training on." }, { "start": 1091.8, "end": 1095.44, "text": " Whereas here we do the pre training, including the labels." }, { "start": 1095.44, "end": 1100.48, "text": " So here, the label dog is an intrinsic part because we need to know which of the samples" }, { "start": 1100.48, "end": 1102.36, "text": " we need to pull together." }, { "start": 1102.36, "end": 1108.44, "text": " But that also means we cannot leverage the maybe that we have more unlabeled data and" }, { "start": 1108.44, "end": 1111.32, "text": " unlabeled data is pretty cheap to obtain." }, { "start": 1111.32, "end": 1115.12, "text": " So that's the advantages and disadvantages here." }, { "start": 1115.12, "end": 1121.4399999999998, "text": " So this new loss, so they they do compare this here." }, { "start": 1121.4399999999998, "end": 1127.3999999999999, "text": " And usually in these contrastive objectives, you have somewhat like two encoders, one to" }, { "start": 1127.3999999999999, "end": 1132.6399999999999, "text": " encode the the anchor and one to encode the augmented versions." }, { "start": 1132.6399999999999, "end": 1137.2399999999998, "text": " And this one is like a momentum with shared weights and so on." }, { "start": 1137.2399999999998, "end": 1139.28, "text": " All of this isn't really important." }, { "start": 1139.28, "end": 1144.6, "text": " If you want to look into that look into papers like momentum contrast, or I did one on curl" }, { "start": 1144.6, "end": 1147.48, "text": " for reinforcement learning." }, { "start": 1147.48, "end": 1154.04, "text": " I think the the general gist of it is clear." }, { "start": 1154.04, "end": 1159.52, "text": " So they compare the formulation of their loss to the self supervised one, usually it takes" }, { "start": 1159.52, "end": 1162, "text": " the form of things like this." }, { "start": 1162, "end": 1170.3999999999999, "text": " So one is the the anchor here, and then the zji would be the positive example." }, { "start": 1170.4, "end": 1175.0800000000002, "text": " And you see here that the inner product between the anchor and the positive example, sorry" }, { "start": 1175.0800000000002, "end": 1185.24, "text": " about that, the inner product should be high, because here the loss is the negative of whatever" }, { "start": 1185.24, "end": 1186.46, "text": " is here." }, { "start": 1186.46, "end": 1192.96, "text": " So if you minimize the loss, you say I want the inner product between my anchor, and whatever" }, { "start": 1192.96, "end": 1199.16, "text": " is the positive sample to be high, and everything else here, which includes the thing on the" }, { "start": 1199.16, "end": 1204.8400000000001, "text": " top, but it also includes everything else, I want the inner product to be low, and which" }, { "start": 1204.8400000000001, "end": 1211.8400000000001, "text": " is exactly the thing where you push you pull together the positives, and you push apart" }, { "start": 1211.8400000000001, "end": 1213.88, "text": " everything else." }, { "start": 1213.88, "end": 1221.0400000000002, "text": " That, that is the standard objective that you had before they, they extend this, but" }, { "start": 1221.0400000000002, "end": 1223.1000000000001, "text": " it looks almost the same." }, { "start": 1223.1, "end": 1229.28, "text": " So compared to the unsupervised objective now, first of all, they extend this such that" }, { "start": 1229.28, "end": 1231.56, "text": " you can have more than one positive sample." }, { "start": 1231.56, "end": 1236.1799999999998, "text": " Now this is also possible in the unsupervised way." }, { "start": 1236.1799999999998, "end": 1240.1999999999998, "text": " So they just augmented by this." }, { "start": 1240.1999999999998, "end": 1245.12, "text": " And they also now this is the crucial part, they include the labels into the pre turning" }, { "start": 1245.12, "end": 1246.12, "text": " objective." }, { "start": 1246.12, "end": 1253.9599999999998, "text": " So they say everywhere where I and J have the same label should be maximized in the" }, { "start": 1253.9599999999998, "end": 1261.28, "text": " inner product, so should be pulled together, while everything else is being pushed apart." }, { "start": 1261.28, "end": 1271.7199999999998, "text": " Yeah, so they say we generalize to an arbitrary number of positives." }, { "start": 1271.7199999999998, "end": 1274.9199999999998, "text": " And they also say contrastive power increases with more negatives." }, { "start": 1274.92, "end": 1279.1200000000001, "text": " I think that's just a finding that they have that when they add more negatives, so when" }, { "start": 1279.1200000000001, "end": 1286.3600000000001, "text": " they increase the batch size, that contrastive power increases." }, { "start": 1286.3600000000001, "end": 1292.28, "text": " They do analyze their gradient, which I find is pretty neat." }, { "start": 1292.28, "end": 1295.44, "text": " You can already see that if you formulate a loss, of course, the gradient is going to" }, { "start": 1295.44, "end": 1301.1200000000001, "text": " go in the negative direction, but they make it clear that if you look at the gradient" }, { "start": 1301.12, "end": 1307.9199999999998, "text": " for the positive cases, what appears is this one minus p ij quantity and the p ij quantity" }, { "start": 1307.9199999999998, "end": 1313.2199999999998, "text": " is exactly the inner product between i and j normalized, of course." }, { "start": 1313.2199999999998, "end": 1320.6399999999999, "text": " So if you minimum, so the gradient is going to point into the negative direction of that" }, { "start": 1320.6399999999999, "end": 1324.6799999999998, "text": " for the positives, which means you're going to pull them together." }, { "start": 1324.68, "end": 1334.04, "text": " And it's going to push into this direction for the negative classes, which means you" }, { "start": 1334.04, "end": 1335.8400000000001, "text": " push them apart." }, { "start": 1335.8400000000001, "end": 1341.1200000000001, "text": " And they also analyze what happens with relation to hardness." }, { "start": 1341.1200000000001, "end": 1345.76, "text": " So they say there are two kinds of, if you just look at the positive samples, there are" }, { "start": 1345.76, "end": 1346.76, "text": " two kinds." }, { "start": 1346.76, "end": 1351.44, "text": " There are easy positives where the network has already learned to match them closely," }, { "start": 1351.44, "end": 1353.3600000000001, "text": " where the inner product is almost one." }, { "start": 1353.36, "end": 1359.04, "text": " If you look at them, that means the p ij quantity is large, right?" }, { "start": 1359.04, "end": 1362.74, "text": " Because that is basically the inner product." }, { "start": 1362.74, "end": 1368.52, "text": " And you look at this term, this term is exactly what we saw in the gradient." }, { "start": 1368.52, "end": 1373.9599999999998, "text": " Then you see that this here, since this is one, this entire thing is zero." }, { "start": 1373.9599999999998, "end": 1375.3999999999999, "text": " This is also high." }, { "start": 1375.3999999999999, "end": 1376.3999999999999, "text": " This is close to one." }, { "start": 1376.3999999999999, "end": 1378.1999999999998, "text": " So this entire thing is zero." }, { "start": 1378.1999999999998, "end": 1380.24, "text": " This is almost zero." }, { "start": 1380.24, "end": 1385.58, "text": " But if you have a hard positive where the network hasn't learned yet to align the inner" }, { "start": 1385.58, "end": 1392.32, "text": " product properly or align the representation properly, then the angle between the things" }, { "start": 1392.32, "end": 1400.06, "text": " again, these are normalized, the angle is they're approximately orthogonal." }, { "start": 1400.06, "end": 1408.76, "text": " So the gradient magnitude is going to be this here is going to be approximately zero." }, { "start": 1408.76, "end": 1414.78, "text": " So this is close to one and this here, since this is also zero is also close to one." }, { "start": 1414.78, "end": 1423.24, "text": " So this is going to be larger than zero, which means that their loss focuses on the examples" }, { "start": 1423.24, "end": 1430.56, "text": " that are that the network cannot yet represent well, according to their objective, which" }, { "start": 1430.56, "end": 1432.2, "text": " makes sense, right?" }, { "start": 1432.2, "end": 1437.32, "text": " First of all, but second of all, it that is exactly the same thing as in the cross entropy" }, { "start": 1437.32, "end": 1438.32, "text": " loss." }, { "start": 1438.32, "end": 1443.12, "text": " So if you look at the cross entropy loss and you have a situation where the network is" }, { "start": 1443.12, "end": 1449, "text": " really good already for a given sample, so it already puts a dog into the dog class," }, { "start": 1449, "end": 1454.48, "text": " then the gradient will not be pulling much for that sample." }, { "start": 1454.48, "end": 1458.24, "text": " It might mainly focuses on where you're still wrong." }, { "start": 1458.24, "end": 1463.8999999999999, "text": " So it is like I appreciate the analysis, but it is not a notable difference." }, { "start": 1463.9, "end": 1471.16, "text": " I think what they want to show is that their loss, if you do gradient descent really does" }, { "start": 1471.16, "end": 1476.98, "text": " what it is supposed to do, namely, first of all, it does this pulling together pushing" }, { "start": 1476.98, "end": 1481, "text": " apart of inner products for the positive and negative samples." }, { "start": 1481, "end": 1488.0800000000002, "text": " And it mainly focuses on samples where you not yet have found a good representation to" }, { "start": 1488.0800000000002, "end": 1489.52, "text": " align them with others." }, { "start": 1489.52, "end": 1496.56, "text": " It focuses on pairs that are not yet correctly close or together or far apart." }, { "start": 1496.56, "end": 1505.08, "text": " They also connect this to the triplet loss, where they can show after some approximation," }, { "start": 1505.08, "end": 1512.12, "text": " that if their loss only has one positive and one negative sample, it is going to be proportional" }, { "start": 1512.12, "end": 1513.28, "text": " to the triplet loss." }, { "start": 1513.28, "end": 1519.08, "text": " The triplet loss is basically where you have an image and you find one positive, I think" }, { "start": 1519.08, "end": 1524.3999999999999, "text": " that's going to be of the same class right here, and you find one negative of a different" }, { "start": 1524.3999999999999, "end": 1531.12, "text": " class and you try to push those apart while pulling those together." }, { "start": 1531.12, "end": 1535.6, "text": " The problem here, they say, is the problem of hard negative sampling." }, { "start": 1535.6, "end": 1540.6799999999998, "text": " In order for this to make sense, you need the negative sample to be what's called a" }, { "start": 1540.6799999999998, "end": 1542.32, "text": " hard negative sample." }, { "start": 1542.32, "end": 1547.28, "text": " So this is called this hard negative mining, because you only have one negative sample," }, { "start": 1547.28, "end": 1551.6399999999999, "text": " you better make this something where the network can learn from." }, { "start": 1551.6399999999999, "end": 1555.36, "text": " And if it's too easy, the network can't learn anything." }, { "start": 1555.36, "end": 1560.36, "text": " And thereby you have the problem of hard negative mining, where you often have to filter through" }, { "start": 1560.36, "end": 1565.24, "text": " your mini batch or even through your data set to find a good negative sample to go along" }, { "start": 1565.24, "end": 1568.24, "text": " with this pair of positive samples." }, { "start": 1568.24, "end": 1574.84, "text": " But I don't really see how their method, except that it has a bunch of positives and negative" }, { "start": 1574.84, "end": 1581.08, "text": " samples, except for that, which I guess you could also apply to the triplet loss." }, { "start": 1581.08, "end": 1583.36, "text": " There's not really a difference here." }, { "start": 1583.36, "end": 1590.22, "text": " Again, if your method is a contrastive method, you do have the problem that if you simply" }, { "start": 1590.22, "end": 1596.8, "text": " sample at random, your negative samples are going to become easier and easier over the" }, { "start": 1596.8, "end": 1599.3999999999999, "text": " training over the course of training." }, { "start": 1599.4, "end": 1606.44, "text": " And you get the problem of at some point, you're going to have to do actively sample" }, { "start": 1606.44, "end": 1607.5600000000002, "text": " hard negatives." }, { "start": 1607.5600000000002, "end": 1611.24, "text": " I think this paper just gets around it by having huge batch sizes." }, { "start": 1611.24, "end": 1618.6000000000001, "text": " So yeah, but again, they do get state of the art on ImageNet for these types of networks" }, { "start": 1618.6000000000001, "end": 1621.44, "text": " and augmentation strategies." }, { "start": 1621.44, "end": 1627.6200000000001, "text": " And they do look at how their loss appears to be more hyperparameter stable." }, { "start": 1627.62, "end": 1632.08, "text": " So if they change out the augmentation, if they change the optimizer or the learning" }, { "start": 1632.08, "end": 1638.52, "text": " rate, you can see here that the spread in accuracy is much smaller than for the cross" }, { "start": 1638.52, "end": 1645, "text": " entropy loss except here, but it is hard to compare variances of things that don't have" }, { "start": 1645, "end": 1648.36, "text": " the same means in terms of accuracy." }, { "start": 1648.36, "end": 1654.1999999999998, "text": " So take this on the right here with a grain of salt." }, { "start": 1654.1999999999998, "end": 1657.28, "text": " They also evaluate this on corrupted ImageNet." }, { "start": 1657.28, "end": 1664.56, "text": " So there's an ImageNet data set where it has several levels of corruptedness of the data" }, { "start": 1664.56, "end": 1665.56, "text": " set." }, { "start": 1665.56, "end": 1671.5, "text": " And you can see your accuracy goes down, but the accuracy for the cross entropy loss goes" }, { "start": 1671.5, "end": 1676.6399999999999, "text": " down faster than for the supervised contrastive loss." }, { "start": 1676.6399999999999, "end": 1680.84, "text": " You see they start together like this and they go further apart." }, { "start": 1680.84, "end": 1684.12, "text": " Now it is not clear to me whether that's just an effect." }, { "start": 1684.12, "end": 1688.36, "text": " Like if you just trained a supervised contrastive loss also to this level, whether it would" }, { "start": 1688.36, "end": 1694.8, "text": " fall off at the same speed or whether because it is the supervised contrastive loss, it" }, { "start": 1694.8, "end": 1697.08, "text": " would kind of match that curve." }, { "start": 1697.08, "end": 1701.4399999999998, "text": " It's not clear whether that's really an effect of the difference of the losses or it's just" }, { "start": 1701.4399999999998, "end": 1708.3999999999999, "text": " an effect of the fact that they aren't the same accuracy to begin with." }, { "start": 1708.4, "end": 1714.2800000000002, "text": " Again, this kind of shifting, you can't really compare things that have different means in" }, { "start": 1714.2800000000002, "end": 1715.3200000000002, "text": " the first place." }, { "start": 1715.3200000000002, "end": 1722.52, "text": " But it is an interesting finding that their method is more stable to these corruptions." }, { "start": 1722.52, "end": 1729.72, "text": " I just want to point out at the end, their training details just highlight they train" }, { "start": 1729.72, "end": 1736.42, "text": " for up to 700 epochs during the pre-training stage, which is, I think, standard but mad." }, { "start": 1736.42, "end": 1741.44, "text": " And they trained up models with batch sizes up to 8192." }, { "start": 1741.44, "end": 1746.88, "text": " So you need like a super TPU cluster to run these kind of things." }, { "start": 1746.88, "end": 1753.52, "text": " And I am never exactly trusting of numbers like this." }, { "start": 1753.52, "end": 1758.64, "text": " Even though it's kind of a good improvement, it is still like a 1% improvement." }, { "start": 1758.64, "end": 1770, "text": " And in these small numbers, I just feel there might be a big effect that things like batch" }, { "start": 1770, "end": 1778.14, "text": " sizes and how much you put into computing, how much compute you put into it and what" }, { "start": 1778.14, "end": 1779.4, "text": " else you're doing." }, { "start": 1779.4, "end": 1785.64, "text": " There might be so much influence of that, that I first want to see this replicated multiple" }, { "start": 1785.64, "end": 1793.64, "text": " times across the entire field before I'm going to really trust that this is a good thing" }, { "start": 1793.64, "end": 1794.64, "text": " to do." }, { "start": 1794.64, "end": 1797.3600000000001, "text": " Alright, so I hope you like this." }, { "start": 1797.3600000000001, "end": 1799.6000000000001, "text": " If you're still here, thank you." }, { "start": 1799.6000000000001, "end": 1801.2, "text": " Consider subscribing." }, { "start": 1801.2, "end": 1802.76, "text": " If you have a comment, please leave it." }, { "start": 1802.76, "end": 1805.0400000000002, "text": " I usually read them." }, { "start": 1805.04, "end": 1816.08, "text": " And with that, bye bye." } ]
pZyxlf6l0N8
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Thinking While Moving: Deep Reinforcement Learning with Concurrent Control
[ "Science & Technology" ]
[ "deep learning", "machine learning", "reinforcement learning", "vector to go", "vtg", "continuous", "control", "robot", "concurrent", "deep rl", "deep neural networks", "berkeley", "google", "grasping", "qlearning" ]
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 to 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 has 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 pie will take an observation and then output an action of what to do and will send back the action to that environment. So in classic RL, you assume that this part here is kind of freezes 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 OpenAI 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. So 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, I'm drawing a small neural network here. This happens instantaneously in these formulations and only as the action is executed, time happens, right? 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 we have here is 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, right? So you don't even have to say the action is still ongoing, but the world is still moving, right? 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 use 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 formulates this in a formal way. It formulates it in a formal way and will 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. Now we'll 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, the environment has this transition function. The transition function, it takes it says, OK, I'm in this state and the agent does this action. And here is the probability distribution over the next state. So it says that your little spaceship is here and the meteors are here. And then you push the button. If you push the button for shoot, then you'll be in the same place. The 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 action and it will give you the next state. It 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. So 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 contains various forms, but it's just a function for now. The agent also has a Q and V function, and these are quite, quite similar. So the Q function, what the Q function will do if if you were in a state and you have several options of what to do, right, you have action one, action two and action three. You're in state S. The Q function of S and A one superscript 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 Q 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 Q and the value functions. You can see why Q learning is popular. If you have a good Q function and the Q and the value function, these are the things that you actually want to learn, right? If you have a good Q function, you can simply always plug in every action into your Q function and then simply take the maximum, the action that has the maximum Q value, because that will give you the best reward if your policy pi, right, is kind of self-referential. If your policy is to always take the maximum Q value, then taking the maximum Q value with the policy, given that you take the maximum Q value, will be optimal. All right, this was very convoluted, but all right, so let's start off with modeling the environment in this continuous framework. So instead of having the next state be determined by the current state in action, in the continuous framework, they do this via differential equation. So 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 now functions and it will output how the state changes. And the G here is, this is a Wiener 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 Wiener 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. 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 have the expected value of the reward. So each one of these has a reward, the expected value of the reward over all 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 t prime up here. 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 the discrete case, the Q function tells you if I'm in state s and perform action a, what is my expected reward going to be? 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. Your 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. 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 the next state. 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 each time. After each 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 each time. Is that correct? Until here. So the 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 to time to perform 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 a s. 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 a s. 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 there on. I hope this is clear. It wasn't clear to me until just now as well. All right. So they define the Monte Carlo estimator where you can do this with just samples of the 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 value based reinforcement learning because the Bellman backup operator is basically what I talked about before. 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 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 RL 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 RL is going to be the optimal Q function. But here, I 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 a good thing to show this at the point where they start thinking, they give a they give the last action with. So at this point right here, 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. 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 T minus one, as you would need in the Q value. You will also say, and this much is outstanding. This is 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 why 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 Q learning in this continuous framework. So here on the left side, you have blocking actions and it says when it says yes here, it is kind of the old old framework. You see the grasp success at like 92 percent, where as 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 introduce 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 than when you are in the old framework, naturally, because you don't need to pause. Right. In this. 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. But 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 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 ablation studies of what's important and what not. And with that, bye bye.
[ { "start": 0, "end": 7, "text": " Hi there. So if you look at these two robots, the left one labeled blocking, the right one labeled concurrent," }, { "start": 7, "end": 15, "text": " the blocking robot, as you can see, always has these little pauses in its movement where it does nothing" }, { "start": 15, "end": 24, "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, "end": 33, "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, "end": 41, "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, "end": 48, "text": " And while all of this is happening, the robot on the left just freezes. So it performs an action and then it freezes" }, { "start": 48, "end": 58, "text": " 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." }, { "start": 58, "end": 66, "text": " It also takes a time to register the state and to compute an action, but it does that as it is executing the last action." }, { "start": 66, "end": 75, "text": " So it does this in parallel and then it executes the action. Once it has computed a new action, it executes that new action right on top of the old action." }, { "start": 75, "end": 83, "text": " And that gives this one big fluid motion. So this requires a new formulation of reinforcement learning." }, { "start": 83, "end": 93, "text": " 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." }, { "start": 93, "end": 103, "text": " So they have a nice diagram here in the supplementary material to show you what is going on in their framework." }, { "start": 103, "end": 111, "text": " So in classic reinforcement learning right here, in classic reinforcement learning, you have this dichotomy between agent and environment, right?" }, { "start": 111, "end": 120, "text": " So the agent and the environment. Now, the agent is supposed to kind of act in the environment in the following manner." }, { "start": 120, "end": 129, "text": " The environment will send an observation to the agent. The observation in this case is the picture of the camera." }, { "start": 129, "end": 139, "text": " So it sends an observation and the agent will think what to do with the observation, which is called a policy." }, { "start": 139, "end": 149, "text": " The policy pie will take an observation and then output an action of what to do and will send back the action to that environment." }, { "start": 149, "end": 160, "text": " So in classic RL, you assume that this part here is kind of freezes time." }, { "start": 160, "end": 174, "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": 174, "end": 186, "text": " Of course, it doesn't happen in zero time, but in our reinforcement learning problems, for example, the OpenAI Gym, the environment just stops until it gets the next action." }, { "start": 186, "end": 194, "text": " And then it performs the action, right? It performs the action in the environment and by that the environment changes and time happens." }, { "start": 194, "end": 206, "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": 206, "end": 216, "text": " 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." }, { "start": 216, "end": 226, "text": " And that's what you see here on the left. So in blue, you have the state registration. This is, for example, the camera." }, { "start": 226, "end": 236, "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": 236, "end": 248, "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, "end": 256, "text": " And also, this is the policy. This is thinking what to do, right? This is your evaluation of your neural network." }, { "start": 256, "end": 272, "text": " If this is a neural network, I'm drawing a small neural network here. This happens instantaneously in these formulations and only as the action is executed, time happens, right?" }, { "start": 272, "end": 280, "text": " And then until here, time freezes again and only once the action is determined, time happens again." }, { "start": 280, "end": 292, "text": " In the new formulation now, as you've already seen, what we have here is this kind of continuous framework where, let's say you're here," }, { "start": 292, "end": 300, "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, "end": 304, "text": " And then once you decide on an action, that action is going to happen, right?" }, { "start": 304, "end": 314, "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, "end": 320, "text": " But that takes time. And while that's happening, the old action is still ongoing, right?" }, { "start": 320, "end": 326, "text": " So you don't even have to say the action is still ongoing, but the world is still moving, right?" }, { "start": 326, "end": 333, "text": " The world is still changing while you think, while you post process and while you evaluate your policy." }, { "start": 333, "end": 338, "text": " The world is thinking and only after some time, right?" }, { "start": 338, "end": 343, "text": " After this lag time here, have you decided on a new action?" }, { "start": 343, "end": 349, "text": " And then you can break that old action and kind of perform your new action." }, { "start": 349, "end": 355, "text": " And all of this is happening in time. So this is the new framework." }, { "start": 355, "end": 366, "text": " 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, "end": 371, "text": " You base your decisions on a state as it was at that time, right?" }, { "start": 371, "end": 376, "text": " That's what you use to think right here. That's what you store and think about." }, { "start": 376, "end": 381, "text": " But you perform. So you perform the action at this point in time." }, { "start": 381, "end": 386, "text": " So there is a considerable difference here because the world has now changed." }, { "start": 386, "end": 392, "text": " So you see the problem. The action you perform is based on an old knowledge of the world." }, { "start": 392, "end": 398, "text": " And you have basically no way of making the action dependent on the current state of the world," }, { "start": 398, "end": 403, "text": " because that would require you to capture the current state and that takes time." }, { "start": 403, "end": 406, "text": " And in that time, the world has already shifted again." }, { "start": 406, "end": 417, "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, "end": 425, "text": " So this new formulation of reinforcement learning formulates this in a formal way." }, { "start": 425, "end": 432, "text": " It formulates it in a formal way and will quickly go through that." }, { "start": 432, "end": 440, "text": " Yes, so they go into the very basics here. We'll quickly, quickly go through them." }, { "start": 440, "end": 453, "text": " So they introduce these quantities like the policy pi, the transition distribution, the reward and the Q and value function." }, { "start": 453, "end": 459, "text": " Now we'll just quickly go over these. So you have the agent. Sorry about that." }, { "start": 459, "end": 467, "text": " You have the agent and you have the environment. Hello." }, { "start": 467, "end": 480, "text": " So if you think of the agent and the environment, the environment has this transition function." }, { "start": 480, "end": 489, "text": " The transition function, it takes it says, OK, I'm in this state and the agent does this action." }, { "start": 489, "end": 494, "text": " And here is the probability distribution over the next state." }, { "start": 494, "end": 501, "text": " So it says that your little spaceship is here and the meteors are here." }, { "start": 501, "end": 514, "text": " And then you push the button. If you push the button for shoot, then you'll be in the same place." }, { "start": 514, "end": 520, "text": " The meteors will still be here, but you'll have a little shot coming out of your spaceship." }, { "start": 520, "end": 527, "text": " That's what the environment does. Right. So you give it a state and action and it will give you the next state." }, { "start": 527, "end": 532, "text": " It will also give you a reward. Right." }, { "start": 532, "end": 548, "text": " 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, "end": 557, "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." }, { "start": 557, "end": 564, "text": " So that's how you model the environment. Then the agent has these quantities called the policy." }, { "start": 564, "end": 579, "text": " So 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, "end": 589, "text": " The policy takes in a state and gives an action. And this contains various forms, but it's just a function for now." }, { "start": 589, "end": 596, "text": " The agent also has a Q and V function, and these are quite, quite similar." }, { "start": 596, "end": 607, "text": " So the Q function, what the Q function will do if if you were in a state and you have several options of what to do, right, you have action one, action two and action three." }, { "start": 607, "end": 620, "text": " You're in state S. The Q function of S and A one superscript pi would tell you the following." }, { "start": 620, "end": 629, "text": " It would tell you what's my expected reward if I'm in state S. That's here. And perform action A." }, { "start": 629, "end": 642, "text": " 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." }, { "start": 642, "end": 649, "text": " 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." }, { "start": 649, "end": 655, "text": " What is my expected reward going to be until the end of the episode? That's the Q function." }, { "start": 655, "end": 661, "text": " And the value function here, very similar, but it only cares about the state." }, { "start": 661, "end": 672, "text": " 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." }, { "start": 672, "end": 681, "text": " What is my expected reward going to be over the course of the episode? That is the Q and the value functions." }, { "start": 681, "end": 689, "text": " You can see why Q learning is popular. If you have a good Q function and the Q and the value function, these are the things that you actually want to learn, right?" }, { "start": 689, "end": 703, "text": " If you have a good Q function, you can simply always plug in every action into your Q function and then simply take the maximum, the action that has the maximum Q value," }, { "start": 703, "end": 712, "text": " because that will give you the best reward if your policy pi, right, is kind of self-referential." }, { "start": 712, "end": 726, "text": " If your policy is to always take the maximum Q value, then taking the maximum Q value with the policy, given that you take the maximum Q value, will be optimal." }, { "start": 726, "end": 736, "text": " All right, this was very convoluted, but all right, so let's start off with modeling the environment in this continuous framework." }, { "start": 736, "end": 745, "text": " So instead of having the next state be determined by the current state in action, in the continuous framework, they do this via differential equation." }, { "start": 745, "end": 754, "text": " So the DS is how does the environment change? This is the change in the environment that is determined by two functions, F and G." }, { "start": 754, "end": 762, "text": " So F is your classic environment function. It takes in a state and an action at time t, right?" }, { "start": 762, "end": 768, "text": " These are now functions and it will output how the state changes." }, { "start": 768, "end": 783, "text": " And the G here is, this is a Wiener 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": 783, "end": 793, "text": " So this Wiener process is responsible for introducing that probabilistic nature into this differential equation." }, { "start": 793, "end": 801, "text": " But ultimately, it simply tells you how does the state change depending on my state, current state and action that I perform." }, { "start": 801, "end": 808, "text": " So the reward function now is also pretty simple." }, { "start": 808, "end": 815, "text": " The tau here is a trajectory and the trajectory is simply the state and action over time." }, { "start": 815, "end": 826, "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?" }, { "start": 826, "end": 832, "text": " So I go through my episode and I get high reward, not so high and so on." }, { "start": 832, "end": 843, "text": " 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, "end": 850, "text": " In the continuous case, you can think of each infinitesimal time step giving you a tiny bit of reward." }, { "start": 850, "end": 855, "text": " So the entire reward is just an integral." }, { "start": 855, "end": 863, "text": " Then we go on the value function for a given state at time t." }, { "start": 863, "end": 877, "text": " 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, "end": 888, "text": " And that here is the expectation over all trajectories that come from my policy of the reward in that trajectory." }, { "start": 888, "end": 894, "text": " So I can, you know, if I'm here, my policy now is also a distribution." }, { "start": 894, "end": 900, "text": " It can go multiple trajectories, right? And I want to have the expected value of the reward." }, { "start": 900, "end": 910, "text": " So each one of these has a reward, the expected value of the reward over all trajectories starting from state s t." }, { "start": 910, "end": 924, "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." }, { "start": 924, "end": 944, "text": " 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 t prime up here." }, { "start": 944, "end": 955, "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." }, { "start": 955, "end": 961, "text": " But I might be missing something. I'm not the biggest integrator in the world." }, { "start": 961, "end": 967, "text": " So, you know, all right, then you have the Q function." }, { "start": 967, "end": 977, "text": " Now think of it what the Q function is in the discrete case, the Q function tells you if I'm in state s and perform action a, what is my expected reward going to be?" }, { "start": 977, "end": 995, "text": " 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" }, { "start": 995, "end": 1003, "text": " until you perform the next action. Right. So h is your your lag time here until you perform the next action." }, { "start": 1003, "end": 1010, "text": " So this now I actually agree with this formulation with the integral here." }, { "start": 1010, "end": 1016, "text": " So this is going to be the integral from time t to time t plus h." }, { "start": 1016, "end": 1030, "text": " That's how long you perform the action. Your reward of performing that action, right. Given the state plus the value function at the end of that." }, { "start": 1030, "end": 1037, "text": " So you're here. You're in s t and you perform action a right." }, { "start": 1037, "end": 1049, "text": " 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." }, { "start": 1049, "end": 1061, "text": " 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." }, { "start": 1061, "end": 1088, "text": " 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 the next state." }, { "start": 1088, "end": 1095, "text": " Because the value function is exactly the reward that you would get by following policy pi in that next state." }, { "start": 1095, "end": 1101, "text": " And the Q function means I perform a now and after that I perform pi." }, { "start": 1101, "end": 1104, "text": " So this is the continuous analog." }, { "start": 1104, "end": 1110, "text": " That's why you have this part here where you perform the action for each time." }, { "start": 1110, "end": 1118, "text": " After each time you just go after go with your policy and that will be the value function." }, { "start": 1118, "end": 1124, "text": " So this is the continuous formulation of the of the problem." }, { "start": 1124, "end": 1129, "text": " Right. And now they can introduce these these lagging times." }, { "start": 1129, "end": 1135, "text": " So in their diagram up here, they define these notions." }, { "start": 1135, "end": 1141, "text": " So you have your state s t right here." }, { "start": 1141, "end": 1147, "text": " Then after this time, you capture the new state." }, { "start": 1147, "end": 1159, "text": " Right. So after that time, you capture the new state and decide on an action and then you perform it for each time." }, { "start": 1159, "end": 1161, "text": " Is that correct?" }, { "start": 1161, "end": 1163, "text": " Until here." }, { "start": 1163, "end": 1175, "text": " So the the the I minus one of action is performed at this time and the I action is performed at this time." }, { "start": 1175, "end": 1178, "text": " No, that makes no sense." }, { "start": 1178, "end": 1185, "text": " So let's read it." }, { "start": 1185, "end": 1193, "text": " So this is when you capture the state and you need to time to perform to think." }, { "start": 1193, "end": 1197, "text": " Right. This is thinking." }, { "start": 1197, "end": 1202, "text": " And then you perform this action at that time." }, { "start": 1202, "end": 1204, "text": " This is the lag time now." }, { "start": 1204, "end": 1207, "text": " And you perform this action." }, { "start": 1207, "end": 1215, "text": " You want to know you want to know if I perform this action until this time here, what is what is happening?" }, { "start": 1215, "end": 1222, "text": " So this is the new Q function takes into account this thing." }, { "start": 1222, "end": 1234, "text": " It tells you if I'm in state s and I think this is thinking leads me to here." }, { "start": 1234, "end": 1238, "text": " This is the old action, right?" }, { "start": 1238, "end": 1243, "text": " This is the old action that's still happening while I observe this state." }, { "start": 1243, "end": 1254, "text": " Right. So it means if I do this right now and after thinking, I do this." }, { "start": 1254, "end": 1256, "text": " Right." }, { "start": 1256, "end": 1260, "text": " So I'm at state. I'm at time t." }, { "start": 1260, "end": 1263, "text": " And this is still happening." }, { "start": 1263, "end": 1274, "text": " And then after I think thinking leads me here t plus t a s." }, { "start": 1274, "end": 1277, "text": " I perform this new action." }, { "start": 1277, "end": 1280, "text": " I'm out of colors." }, { "start": 1280, "end": 1286, "text": " I perform this new action at that point until time H." }, { "start": 1286, "end": 1288, "text": " What's my Q function?" }, { "start": 1288, "end": 1302, "text": " 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 a s." }, { "start": 1302, "end": 1305, "text": " That's when I still perform the old action." }, { "start": 1305, "end": 1311, "text": " Right. So this is going to be the reward in the state given the old action." }, { "start": 1311, "end": 1314, "text": " And then at that time, I switch over to the new action." }, { "start": 1314, "end": 1315, "text": " Right." }, { "start": 1315, "end": 1322, "text": " So at that time until time H, now I perform the new action." }, { "start": 1322, "end": 1340, "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." }, { "start": 1340, "end": 1343, "text": " Right. So because before it was simply executing one action," }, { "start": 1343, "end": 1345, "text": " we didn't have this concurrency yet." }, { "start": 1345, "end": 1347, "text": " So executing the action." }, { "start": 1347, "end": 1349, "text": " And after that, it's going to be the value function." }, { "start": 1349, "end": 1352, "text": " And now it's executing two actions." }, { "start": 1352, "end": 1354, "text": " First, execute the old action." }, { "start": 1354, "end": 1357, "text": " Then once you're done thinking, execute the new action." }, { "start": 1357, "end": 1361, "text": " And then it's the value function from there on." }, { "start": 1361, "end": 1364, "text": " I hope this is clear." }, { "start": 1364, "end": 1367, "text": " It wasn't clear to me until just now as well." }, { "start": 1367, "end": 1368, "text": " All right." }, { "start": 1368, "end": 1378, "text": " So they define the Monte Carlo estimator where you can do this with just samples of the trajectories instead of expectations." }, { "start": 1378, "end": 1383, "text": " And then they define the Bellman operator, the Bellman backup operator." }, { "start": 1383, "end": 1393, "text": " Now, the Bellman backup operator is an important quantity in value based reinforcement learning because the Bellman backup operator is basically what I talked about before." }, { "start": 1393, "end": 1406, "text": " It tells you that if your policy is to always select the maximum, the action with the maximum Q value, right?" }, { "start": 1406, "end": 1407, "text": " That's what's down here." }, { "start": 1407, "end": 1419, "text": " After you do this action, then the policy you arrive at and you can give certain optimality guarantees." }, { "start": 1419, "end": 1424, "text": " But in essence, this is so-called a contraction." }, { "start": 1424, "end": 1435, "text": " 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, "end": 1446, "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," }, { "start": 1446, "end": 1460, "text": " 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." }, { "start": 1460, "end": 1465, "text": " And you'll converge to a single Q function." }, { "start": 1465, "end": 1470, "text": " So given enough time and enough data, you'll converge on one Q function." }, { "start": 1470, "end": 1474, "text": " There's one fixed point Q function that you'll converge to." }, { "start": 1474, "end": 1484, "text": " And you can show under assumption in classic RL that this is going to be the optimal Q function, the true, let's say, Q function." }, { "start": 1484, "end": 1491, "text": " So they first prove this and then they prove a now they go back to discrete time." }, { "start": 1491, "end": 1492, "text": " So now they were in continuous time." }, { "start": 1492, "end": 1499, "text": " They go back to discrete time, but now they have a discrete time formulation with this lag here." }, { "start": 1499, "end": 1504, "text": " And also they prove that that Bellman operator is a contraction." }, { "start": 1504, "end": 1512, "text": " So the contraction part basically means that if you perform Q learning, you're going to arrive at a solution." }, { "start": 1512, "end": 1514, "text": " That's what this means to be contraction." }, { "start": 1514, "end": 1521, "text": " But now, obviously, that solution in classic RL is going to be the optimal Q function." }, { "start": 1521, "end": 1524, "text": " But here, I actually don't know." }, { "start": 1524, "end": 1533, "text": " All right, so they try this out and they introduce one last important concept here, what they call vector to go," }, { "start": 1533, "end": 1545, "text": " which basically means that at the point where they start thinking," }, { "start": 1545, "end": 1556, "text": " where is a good thing to show this at the point where they start thinking, they give a they give the last action with." }, { "start": 1556, "end": 1566, "text": " So at this point right here, where they capture the state," }, { "start": 1566, "end": 1581, "text": " they also sort of the state contains a information about what part of the action that you started here is still outstanding." }, { "start": 1581, "end": 1586, "text": " So maybe your action was and they illustrate this down here." }, { "start": 1586, "end": 1594, "text": " Maybe your action was to move your robot arm from down here to up here." }, { "start": 1594, "end": 1598, "text": " That was your planned action at this point in time." }, { "start": 1598, "end": 1608, "text": " Now, if you are at step, if you perform the action here and here you start capturing the next state," }, { "start": 1608, "end": 1615, "text": " then you would also give this particular vector here to the to the to the agent." }, { "start": 1615, "end": 1622, "text": " So not only will you tell it, hey, by the way, my last action was a T minus one, as you would need in the Q value." }, { "start": 1622, "end": 1627, "text": " You will also say, and this much is outstanding." }, { "start": 1627, "end": 1631, "text": " This is much is where as I still have to do that much." }, { "start": 1631, "end": 1638, "text": " 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, "end": 1645, "text": " Now you can see why the algorithm is able to learn much better given that information," }, { "start": 1645, "end": 1660, "text": " 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, "end": 1661, "text": " So they test this out." }, { "start": 1661, "end": 1671, "text": " And what results is the robot videos you've seen before where they say they can recover the original" }, { "start": 1671, "end": 1675, "text": " Q learning in this continuous framework." }, { "start": 1675, "end": 1682, "text": " So here on the left side, you have blocking actions and it says when it says yes here," }, { "start": 1682, "end": 1685, "text": " it is kind of the old old framework." }, { "start": 1685, "end": 1694, "text": " You see the grasp success at like 92 percent, where as if you go to non blocking actions," }, { "start": 1694, "end": 1701, "text": " but do none of the none of the concurrent information, the grasp success suffers." }, { "start": 1701, "end": 1715, "text": " But you can recover the grasp success if you if you give these concurrent information like introduce time step penalty and you give this vector to go and the information about the previous action." }, { "start": 1715, "end": 1728, "text": " And you can also see that the episode duration here is much lower when you go for the continuous actions than when you are in the old framework," }, { "start": 1728, "end": 1730, "text": " naturally, because you don't need to pause." }, { "start": 1730, "end": 1734, "text": " Right." }, { "start": 1734, "end": 1735, "text": " In this." }, { "start": 1735, "end": 1739, "text": " So this is the simulated robotics and the real world robotic grasping results." }, { "start": 1739, "end": 1749, "text": " 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": 1749, "end": 1756, "text": " But your duration of your of your policy is cut in half." }, { "start": 1756, "end": 1760, "text": " So maybe this is a trade off worth considering." }, { "start": 1760, "end": 1763, "text": " I think this is a is pretty cool framework." }, { "start": 1763, "end": 1768, "text": " And I think there's going to be a lot of work still outstanding here." }, { "start": 1768, "end": 1776, "text": " And I invite you to check out the paper and look at their videos and their ablation studies of what's important and what not." }, { "start": 1776, "end": 1799, "text": " And with that, bye bye." } ]
yPjuAo53uNI
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
[Rant] The Male Only History of Deep Learning
[ "Science & Technology" ]
[ "deep learning", "machine learning", "neural networks", "history", "groups", "ideology" ]
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 going 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 at 1943. And the Perceptron paper right here. The first backpropagation 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, Minsky's paper, very famous. But here backpropagation attributed to this paper, and so on. And you can see things people like Hinton only coming up later here, the Boltzmann machine, backpropagation 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, AlexNet, then GANs, AlphaGo. So we're now going a bit faster. And then the end, it says, the godfathers win the Turing 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 AlexNet is here. Now this person rags that AlexNet 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 CelebA isn't. C410 isn't. MNIST isn't. The PantryBank isn't. So I think we've skipped a lot of architectural advancements here, like transformers or all kinds of things here. But the history is clearly about the algorithmic developments. And to reframe this, it clearly states ImageNet doesn't because women's contributions don't count. 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. 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 you're like, arrrrr, it doesn't fit my narrative, right? This GPU is not a white person. So to make it fit your narrative you have to call white-adjacent... What is white-adjacent? It's like, whatever I don't like I now call white. But 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 do 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. I think these calls only get big whenever there is money and attention going into a field, right? If you look at 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. 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, "end": 6.26, "text": " Alright, so instead of reviewing a paper today, I thought I might review this thing." }, { "start": 6.26, "end": 13.22, "text": " So this person on Twitter posted this link to an article called Brief History of Deep" }, { "start": 13.22, "end": 21.1, "text": " Learning from 1943 to 2019 of Machine Learning Knowledge.ai." }, { "start": 21.1, "end": 24.28, "text": " So let's look at this." }, { "start": 24.28, "end": 26.04, "text": " Actually let's look at the tweet first." }, { "start": 26.04, "end": 28.12, "text": " Because this is..." }, { "start": 28.12, "end": 29.64, "text": " I just saw this." }, { "start": 29.64, "end": 36, "text": " The male-only history of deep learning, where you say AlexNet makes history, but ImageNet" }, { "start": 36, "end": 40.72, "text": " doesn't, because women's contributions don't count." }, { "start": 40.72, "end": 47.84, "text": " And contributions from anyone except for white and white-adjacent people for that matter." }, { "start": 47.84, "end": 56.96, "text": " That is the tweet, and it has 109 retweets, over 400 likes, and people generally agreeing" }, { "start": 56.96, "end": 58.14, "text": " with this sentiment." }, { "start": 58.14, "end": 68.72, "text": " So the person is expressing concerns that this article is only going over one particular" }, { "start": 68.72, "end": 70.68, "text": " group of people." }, { "start": 70.68, "end": 73.2, "text": " So let's look at the article." }, { "start": 73.2, "end": 80.84, "text": " They basically go over the history of neural networks, of deep learning in an algorithmic" }, { "start": 80.84, "end": 81.84, "text": " sense." }, { "start": 81.84, "end": 83.12, "text": " So let's check it out." }, { "start": 83.12, "end": 88.28, "text": " So first we go into neurons, starting at 1943." }, { "start": 88.28, "end": 93.52000000000001, "text": " And the Perceptron paper right here." }, { "start": 93.52000000000001, "end": 97.36, "text": " The first backpropagation algorithm from Kelly." }, { "start": 97.36, "end": 101.96000000000001, "text": " This actually, I think people like Schmidhuber would be proud." }, { "start": 101.96000000000001, "end": 108.44, "text": " As far as I can tell, this is kind of more of a forgotten history, or some of these things" }, { "start": 108.44, "end": 109.72, "text": " are more of a forgotten history." }, { "start": 109.72, "end": 113.44, "text": " Of course, Minsky's paper, very famous." }, { "start": 113.44, "end": 120.6, "text": " But here backpropagation attributed to this paper, and so on." }, { "start": 120.6, "end": 127.6, "text": " And you can see things people like Hinton only coming up later here, the Boltzmann machine," }, { "start": 127.6, "end": 132.44, "text": " backpropagation in neural networks now." }, { "start": 132.44, "end": 139.36, "text": " So this, as far as I can tell, it's just a take on kind of the history of algorithmic" }, { "start": 139.36, "end": 140.36, "text": " development." }, { "start": 140.36, "end": 144.84, "text": " And you can see here, it really is about algorithms." }, { "start": 144.84, "end": 147.60000000000002, "text": " The algorithms behind deep learning." }, { "start": 147.60000000000002, "end": 154.16000000000003, "text": " So here is the vanishing gradient problem, the LSTM as an architectural component, deep" }, { "start": 154.16000000000003, "end": 155.52, "text": " belief networks." }, { "start": 155.52, "end": 158.72000000000003, "text": " Then you have GPUs for training." }, { "start": 158.72000000000003, "end": 163.88000000000002, "text": " Again, vanishing gradients, AlexNet, then GANs, AlphaGo." }, { "start": 163.88000000000002, "end": 166.20000000000002, "text": " So we're now going a bit faster." }, { "start": 166.2, "end": 171.72, "text": " And then the end, it says, the godfathers win the Turing Award for their immense contribution" }, { "start": 171.72, "end": 174.72, "text": " in advancements in area of deep learning and artificial intelligence." }, { "start": 174.72, "end": 179.32, "text": " This is a defining moment for those who had worked relentlessly on neural networks when" }, { "start": 179.32, "end": 183.83999999999997, "text": " the entire machine learning community had moved away from it in the 1970s." }, { "start": 183.83999999999997, "end": 191.95999999999998, "text": " So the article clearly is focused on algorithmic developments in deep learning." }, { "start": 191.95999999999998, "end": 194.04, "text": " And that's why AlexNet is here." }, { "start": 194.04, "end": 200.32, "text": " Now this person rags that AlexNet is here, but ImageNet isn't." }, { "start": 200.32, "end": 205.64, "text": " And clearly you can see from the article, ImageNet is a data set." }, { "start": 205.64, "end": 208.35999999999999, "text": " It was not made with deep learning in mind." }, { "start": 208.35999999999999, "end": 210.5, "text": " It was simply made as a data set." }, { "start": 210.5, "end": 212.76, "text": " It's not an algorithmic development." }, { "start": 212.76, "end": 215.32, "text": " So GANs are here as well, right?" }, { "start": 215.32, "end": 217.39999999999998, "text": " But CelebA isn't." }, { "start": 217.39999999999998, "end": 219.2, "text": " C410 isn't." }, { "start": 219.2, "end": 222.07999999999998, "text": " MNIST isn't." }, { "start": 222.08, "end": 224.60000000000002, "text": " The PantryBank isn't." }, { "start": 224.60000000000002, "end": 232.72000000000003, "text": " So I think we've skipped a lot of architectural advancements here, like transformers or all" }, { "start": 232.72000000000003, "end": 234, "text": " kinds of things here." }, { "start": 234, "end": 237.88000000000002, "text": " But the history is clearly about the algorithmic developments." }, { "start": 237.88000000000002, "end": 245.4, "text": " And to reframe this, it clearly states ImageNet doesn't because women's contributions don't" }, { "start": 245.4, "end": 247.24, "text": " count." }, { "start": 247.24, "end": 254, "text": " The insinuation here, absolutely, I find this to be absolutely intellectually dishonest." }, { "start": 254, "end": 257.96000000000004, "text": " And they say, and contributions from anyone except for white and white-adjacent people" }, { "start": 257.96000000000004, "end": 259.72, "text": " for that matter." }, { "start": 259.72, "end": 262.44, "text": " At this point you just have to laugh." }, { "start": 262.44, "end": 268.8, "text": " Because of course the narrative that the person wanted to tell was that it's only white people" }, { "start": 268.8, "end": 270.2, "text": " that count." }, { "start": 270.2, "end": 275.92, "text": " But then you scroll and you're like, arrrrr, it doesn't fit my narrative, right?" }, { "start": 275.92, "end": 281.6, "text": " This GPU is not a white person." }, { "start": 281.6, "end": 286.36, "text": " So to make it fit your narrative you have to call white-adjacent..." }, { "start": 286.36, "end": 288.56, "text": " What is white-adjacent?" }, { "start": 288.56, "end": 294.96000000000004, "text": " It's like, whatever I don't like I now call white." }, { "start": 294.96000000000004, "end": 301, "text": " But people just agreeing with this, I find this absolutely disgusting." }, { "start": 301, "end": 303.48, "text": " And I find the article to be okay." }, { "start": 303.48, "end": 304.88, "text": " I don't know better." }, { "start": 304.88, "end": 306.24, "text": " But if you have a problem with..." }, { "start": 306.24, "end": 311.6, "text": " I definitely think there is misattribution in science throughout, even systematic." }, { "start": 311.6, "end": 317.04, "text": " But to say that ImageNet wasn't included because women's contributions don't count, that is" }, { "start": 317.04, "end": 319.71999999999997, "text": " just a straight out lie." }, { "start": 319.71999999999997, "end": 325.15999999999997, "text": " And to call people white-adjacent is like, how do you not have a bell in your head that" }, { "start": 325.15999999999997, "end": 330.26, "text": " goes ding ding ding ding ding when you do something like this?" }, { "start": 330.26, "end": 338.15999999999997, "text": " So I find this to be dishonest, either willfully or just because people have so become used" }, { "start": 338.15999999999997, "end": 344.36, "text": " to seeing the world in one particular frame." }, { "start": 344.36, "end": 350.76, "text": " I think these calls only get big whenever there is money and attention going into a" }, { "start": 350.76, "end": 351.96, "text": " field, right?" }, { "start": 351.96, "end": 359, "text": " If you look at any field where it's just a bunch of weirdos doing their thing, the weirdos" }, { "start": 359, "end": 360.4, "text": " don't care who's there." }, { "start": 360.4, "end": 364.56, "text": " They just care about the ideas that people have." }, { "start": 364.56, "end": 370, "text": " And I believe we should take that view in science in general." }, { "start": 370, "end": 372.96, "text": " I don't care who has the idea." }, { "start": 372.96, "end": 376.08, "text": " And these people do." }, { "start": 376.08, "end": 377.08, "text": " And I disagree." }, { "start": 377.08, "end": 379.24, "text": " All right, that was it." }, { "start": 379.24, "end": 383.32, "text": " Keep pushing back on these things if you agree as well." }, { "start": 383.32, "end": 385.76, "text": " And keep science for ideas." }, { "start": 385.76, "end": 389.4, "text": " Thanks." } ]
PZypP7PiKi0
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Gradient Surgery for Multi-Task Learning
[ "Science & Technology" ]
[ "deep learning", "machine learning", "neural networks", "multi task", "conflicting gradients", "magnitudes", "adam", "sgd", "momentum", "optimization", "projection" ]
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 multitask learning by Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergei Levine, Carole Hausmann and Chelsea Finn. So in this paper, the concern is a thing called multitask learning. Now what is multitask 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. So it could be something like task one, if the input is a food, right? A food object. The task one could be, is it a fruit? Right? Task two could be how many calories does it have? Right? The input is 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 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. Alright, 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? Weight one, here is weight two. And this is what the optimization landscape look like 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. If we have 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 Adam, that adjusts the gradient to the to the variance of the gradient landscape, things like this, right? So these are these are problems in optimization. But what happens when you have a multitask 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 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 it didn't matter whether we were here or here, both had a relatively low loss value, right? And 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 somewhat somewhat 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. 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 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 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. Now, the 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, Xi. 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 Xi. 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 that one points in this direction, and the other one points in that direction. And we've done this just and and things like things like Adam and SGD actually, are able to 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 tasks distribution is not like stochastically IID, let's say. So in in this case, you can always count on that the expectation will average out this noise. So this noise, if you 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 is 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 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 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 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 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 the 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 the Lipschitz constant, will converge either to a location where the cosine is exactly negative one between two gradients. 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 this 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. Theorem two says, suppose L is differentiable and the gradient of L is Lipschitz continuous. This again, same assumptions, except no longer need convexity. Let theta MT, which is the multitask 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 we'll 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, right? 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 state 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 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 in 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's 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 trifecta something, they have a name for it. But I'm going to read you out the the the conditions that how they describe it. The conditions are first, the angle between the task gradients is not too small, i.e. 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 subtlety. 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 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 write 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 theorem would no longer hold and it will 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 too 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. So 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. As I said, it's a cool algorithm, but I found that to be funny. All right, so they test this on multitask, which these MT 10 and MT 50 benchmarks are these robotic manipulation. So multitask doesn't only mean like supervised learning. In this case, it's actually multitask 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 the 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, you the hope is that you can learn kind of a shared representation that you can then perform all of these tasks faster than if you were to learn them each independently. So the MT 10 and MT 50 come from this. And I think they also have goal condition pushing, where it the task is simply to push something to a what they call goal conditioned. 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. Right. 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 under performs against the SAC 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, 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, is a, a consequence of a Taylor approximation. So if you have like f of x, you can, you can write this as f of some x zero, plus the gradient of f that plus the gradient of f times x here, sorry, at x zero 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. Right? So this is, this would be this, except they don't, they, they do it not doing the x and x zero, they do it at theta t and theta t plus one. 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 number seem to be large, right? Just compared to what you can handle with a computer, the 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 update 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 are really there and then therefore their algorithm helps, right? So here's 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, "end": 7, "text": " Hi there, today we're looking at gradient surgery for multitask learning by Tianhe Yu," }, { "start": 7, "end": 15.08, "text": " Saurabh Kumar, Abhishek Gupta, Sergei Levine, Carole Hausmann and Chelsea Finn." }, { "start": 15.08, "end": 22.28, "text": " So in this paper, the concern is a thing called multitask learning." }, { "start": 22.28, "end": 24.32, "text": " Now what is multitask learning?" }, { "start": 24.32, "end": 29.2, "text": " So this has some very subtle distinctions from other things, that's I think why it's" }, { "start": 29.2, "end": 32.76, "text": " important to look at it a bit." }, { "start": 32.76, "end": 37.76, "text": " So let's say you have multiple tasks, a learning problem in multiple tasks, this seems easy" }, { "start": 37.76, "end": 40.08, "text": " enough, right?" }, { "start": 40.08, "end": 47.519999999999996, "text": " So what we mean is that we have the same input, but then we want to perform two different" }, { "start": 47.519999999999996, "end": 48.58, "text": " tasks." }, { "start": 48.58, "end": 54.519999999999996, "text": " So task one and task two." }, { "start": 54.52, "end": 63.96, "text": " So it could be something like task one, if the input is a food, right?" }, { "start": 63.96, "end": 65.96000000000001, "text": " A food object." }, { "start": 65.96000000000001, "end": 71.60000000000001, "text": " The task one could be, is it a fruit?" }, { "start": 71.60000000000001, "end": 73.2, "text": " Right?" }, { "start": 73.2, "end": 80.56, "text": " Task two could be how many calories does it have?" }, { "start": 80.56, "end": 81.88, "text": " Right?" }, { "start": 81.88, "end": 85.36, "text": " The input is this food item here." }, { "start": 85.36, "end": 87.6, "text": " And you want to know both things." }, { "start": 87.6, "end": 88.8, "text": " Is it a fruit?" }, { "start": 88.8, "end": 91.72, "text": " And how many calories does it have?" }, { "start": 91.72, "end": 99.28, "text": " And ideally, so what you could do is you could train two separate machine learning classifiers," }, { "start": 99.28, "end": 100.28, "text": " right?" }, { "start": 100.28, "end": 104.67999999999999, "text": " Classifier one simply does the is it a fruit thing?" }, { "start": 104.67999999999999, "end": 107.56, "text": " Task two simply does how many calories does it have?" }, { "start": 107.56, "end": 113.56, "text": " Let's say this is, let's actually say this is a food picture, right?" }, { "start": 113.56, "end": 120.64, "text": " Since Instagram is full of food pictures, we have lots of training data, right?" }, { "start": 120.64, "end": 125.02000000000001, "text": " At least unsupervised, people usually label it." }, { "start": 125.02000000000001, "end": 127, "text": " And we could train two different things." }, { "start": 127, "end": 131.72, "text": " But it would be nice, since they're both kind of dealing with the same input, so they're" }, { "start": 131.72, "end": 135.8, "text": " not kind of, they actually deal with the same input distribution." }, { "start": 135.8, "end": 143.26000000000002, "text": " It would be nice if we could kind of share a representation, right?" }, { "start": 143.26000000000002, "end": 147.74, "text": " So maybe we have some neural network here with many layers." }, { "start": 147.74, "end": 154.04000000000002, "text": " And then we have at the end, we take this hidden representation here." }, { "start": 154.04000000000002, "end": 159.64000000000001, "text": " And we just have maybe one or two fully connected layers for each individual task." }, { "start": 159.64000000000001, "end": 165.34, "text": " But our goal would be that the hidden representation here is shared." }, { "start": 165.34, "end": 171.34, "text": " So shared representation." }, { "start": 171.34, "end": 172.8, "text": " And why could that help?" }, { "start": 172.8, "end": 182.6, "text": " Because we might have, maybe we have lots of training data for the how many calories" }, { "start": 182.6, "end": 184.04, "text": " does it have, right?" }, { "start": 184.04, "end": 188.04, "text": " But we don't have that much training data for is it a fruit." }, { "start": 188.04, "end": 194.24, "text": " So lots of training data here, big database, but only like a handful of data points for" }, { "start": 194.24, "end": 195.92000000000002, "text": " the second task." }, { "start": 195.92000000000002, "end": 200.5, "text": " Or we might just not have much training data at all for both tasks." }, { "start": 200.5, "end": 205.98000000000002, "text": " And we just might benefit from training this shared representation, you might have already" }, { "start": 205.98000000000002, "end": 210.28, "text": " seen this with something like BERT." }, { "start": 210.28, "end": 217.24, "text": " So in BERT's case, the input is text, right?" }, { "start": 217.24, "end": 219.72, "text": " And then you do something different." }, { "start": 219.72, "end": 222.48000000000002, "text": " That's why BERT is different than multitask learning." }, { "start": 222.48, "end": 230.44, "text": " What you do in BERT is you do first you do this masked language model pre training." }, { "start": 230.44, "end": 232.72, "text": " So that's step one." }, { "start": 232.72, "end": 240, "text": " And then in step two, you take this and then you, you fine tune it on a number of tasks," }, { "start": 240, "end": 241, "text": " right?" }, { "start": 241, "end": 248.72, "text": " So here, question answering, sentiment detection, entailment, and so on." }, { "start": 248.72, "end": 250.04, "text": " This is different." }, { "start": 250.04, "end": 254.76, "text": " This is called pre training and fine tuning." }, { "start": 254.76, "end": 263.96, "text": " Tuning in multitask learning, we actually want to train on different tasks at the same" }, { "start": 263.96, "end": 264.96, "text": " time." }, { "start": 264.96, "end": 266.44, "text": " Maybe they have different data, right?" }, { "start": 266.44, "end": 270.68, "text": " And we simply want to create this shared representation." }, { "start": 270.68, "end": 277.15999999999997, "text": " And we hope that by combining these tasks, we might learn them better than if we were" }, { "start": 277.16, "end": 280.24, "text": " to learn each task individually." }, { "start": 280.24, "end": 286.20000000000005, "text": " Alright, so this paper says there are there's a big problem with things like this." }, { "start": 286.20000000000005, "end": 289.40000000000003, "text": " And they illustrate this in this example right here." }, { "start": 289.40000000000003, "end": 294.66, "text": " So let's say you have a multitask objective, and the learning landscape looks like this." }, { "start": 294.66, "end": 297.74, "text": " So the objective for task one is the following." }, { "start": 297.74, "end": 303.16, "text": " So this you have to have to imagine this is maybe a neural network with just two weights," }, { "start": 303.16, "end": 304.16, "text": " right?" }, { "start": 304.16, "end": 307.52000000000004, "text": " Weight one, here is weight two." }, { "start": 307.52000000000004, "end": 311.24, "text": " And this is what the optimization landscape look like looks like for task one." }, { "start": 311.24, "end": 317.76000000000005, "text": " If you're not used to this kind of depiction, the light parts up here and here are high" }, { "start": 317.76000000000005, "end": 320.32000000000005, "text": " values for the loss function." }, { "start": 320.32000000000005, "end": 325.48, "text": " And the darker parts are low values for the loss function." }, { "start": 325.48, "end": 329, "text": " So you want to get to the darker parts." }, { "start": 329, "end": 333.34000000000003, "text": " Now usually we discuss things like this in terms of optimization." }, { "start": 333.34, "end": 337.59999999999997, "text": " So for example, we would talk about SGD." }, { "start": 337.59999999999997, "end": 342.47999999999996, "text": " And we would talk about the fact that oh, if we have too large of a so if you're here," }, { "start": 342.47999999999996, "end": 347.59999999999997, "text": " where does the gradient point the gradient points towards the direction of steepest increase." }, { "start": 347.59999999999997, "end": 350.96, "text": " So here, so the negative gradient would point down." }, { "start": 350.96, "end": 354.52, "text": " If we have SGD, maybe we'd go here." }, { "start": 354.52, "end": 358.96, "text": " And then we take another gradient step, we would go here, right?" }, { "start": 358.96, "end": 360.88, "text": " Oh, now we've gone too far, right?" }, { "start": 360.88, "end": 364.94, "text": " So the gradient now points this direction." }, { "start": 364.94, "end": 370.52, "text": " So we go here, and then we just continue this, right?" }, { "start": 370.52, "end": 372.9, "text": " So this is a problem with with SGD." }, { "start": 372.9, "end": 377.36, "text": " And what we can do is we can decrease the step size, for example, and then we converge" }, { "start": 377.36, "end": 386.36, "text": " in this, or we can use something like Adam, that adjusts the gradient to the to the variance" }, { "start": 386.36, "end": 390.84, "text": " of the gradient landscape, things like this, right?" }, { "start": 390.84, "end": 393.91999999999996, "text": " So these are these are problems in optimization." }, { "start": 393.91999999999996, "end": 399.76, "text": " But what happens when you have a multitask objective is that for just task one, the optimization" }, { "start": 399.76, "end": 401.44, "text": " landscape would look like this, right?" }, { "start": 401.44, "end": 409.47999999999996, "text": " If you were just to train your neural network, if you were to just train this part, and we" }, { "start": 409.47999999999996, "end": 414.47999999999996, "text": " just look here is is like theta one, and here is theta two, these are the two weights we" }, { "start": 414.47999999999996, "end": 418.47999999999996, "text": " care about right now, everything else, let's say is fixed." }, { "start": 418.48, "end": 423.06, "text": " Task one looks like this, but for task two, because it's a different task, right, we need" }, { "start": 423.06, "end": 427.94, "text": " to set the weights differently to get our desired output, it looks different." }, { "start": 427.94, "end": 431.62, "text": " So our loss function is going to be a combination." }, { "start": 431.62, "end": 436.96000000000004, "text": " So our loss function is going to be the loss of task loss function for a given sample," }, { "start": 436.96000000000004, "end": 443.26, "text": " it's going to be the loss on task one of that sample plus the loss of task two on that sample." }, { "start": 443.26, "end": 449.2, "text": " So that's going to be the combination the combination you see on the right." }, { "start": 449.2, "end": 455.56, "text": " So this plus this equals this right here." }, { "start": 455.56, "end": 463.15999999999997, "text": " So you can see in task one, it almost let's say it didn't matter whether we were here" }, { "start": 463.15999999999997, "end": 467.24, "text": " or here, both had a relatively low loss value, right?" }, { "start": 467.24, "end": 475.76, "text": " And you can you can see in task two, this point here is not an optimum, well, this point" }, { "start": 475.76, "end": 480.52, "text": " or maybe these are slight, these are somewhat somewhat close together." }, { "start": 480.52, "end": 485.96000000000004, "text": " So if you add them, you can see that now this thing here still has a low value but not as" }, { "start": 485.96000000000004, "end": 488.24, "text": " low as this is much darker, right?" }, { "start": 488.24, "end": 500.04, "text": " So the landscape for both tasks together looks differently from the landscape of either task" }, { "start": 500.04, "end": 501.04, "text": " alone." }, { "start": 501.04, "end": 505.84000000000003, "text": " So your goal is to find this optimal point and optimal point here that works for both" }, { "start": 505.84000000000003, "end": 508.2, "text": " tasks." }, { "start": 508.2, "end": 515.52, "text": " Now the paper identifies many, sorry, sorry, the paper identifies problems with this multitask" }, { "start": 515.52, "end": 523.72, "text": " learning and they say the problem is that you can have what are called conflicting gradients." }, { "start": 523.72, "end": 535.0799999999999, "text": " So if you look if you look at if you look at where the gradients point in the different" }, { "start": 535.0799999999999, "end": 538.48, "text": " in the different tasks." }, { "start": 538.48, "end": 542.3199999999999, "text": " So if we go by task two, sorry, let me put that in again." }, { "start": 542.32, "end": 547.2, "text": " We care about the point right here that they care about, right?" }, { "start": 547.2, "end": 552.96, "text": " And they use Adam in this case, and their starting point is right here, and they've" }, { "start": 552.96, "end": 554.8000000000001, "text": " come this way so far." }, { "start": 554.8000000000001, "end": 559.96, "text": " So we're going to draw this in here and draw this in right here." }, { "start": 559.96, "end": 564.88, "text": " And we'll stop a little bit before that valley, right?" }, { "start": 564.88, "end": 570.2, "text": " So let's analyze the gradient, the gradient task one actually points in this direction," }, { "start": 570.2, "end": 572.6400000000001, "text": " you see down the valley, right?" }, { "start": 572.6400000000001, "end": 575.48, "text": " And it's pretty big because it's pretty steep, right?" }, { "start": 575.48, "end": 579.5200000000001, "text": " You can see the curves here getting closer and closer together." }, { "start": 579.5200000000001, "end": 583.6400000000001, "text": " That means the gradient is pretty steep, and it points in that direction." }, { "start": 583.6400000000001, "end": 589.6400000000001, "text": " Whereas for task two, if you're here, right, the gradient actually points in this direction," }, { "start": 589.6400000000001, "end": 591.6600000000001, "text": " but not as steep, right?" }, { "start": 591.6600000000001, "end": 595.36, "text": " Because here the the lines are pretty far apart still." }, { "start": 595.36, "end": 599.08, "text": " So that means it's relatively flat." }, { "start": 599.08, "end": 603.08, "text": " This is what the paper calls conflicting gradients, and they're drawn in here." }, { "start": 603.08, "end": 608.72, "text": " I'm going to draw them just a little bit larger." }, { "start": 608.72, "end": 612.5200000000001, "text": " So these two gradients, first of all, they have different magnitude." }, { "start": 612.5200000000001, "end": 618.2, "text": " You see that the magnitude of this is much larger than the magnitude of this." }, { "start": 618.2, "end": 622.32, "text": " And also their angle between them is large." }, { "start": 622.32, "end": 628.24, "text": " That means conflicting, that they're more than 90 degrees apart from each other." }, { "start": 628.24, "end": 636.12, "text": " And this results if you calculate the resulting gradient, of course, this results in a gradient" }, { "start": 636.12, "end": 637.78, "text": " like this, right?" }, { "start": 637.78, "end": 644.4, "text": " So our algorithm wouldn't actually go down this valley, it will go up the hill again," }, { "start": 644.4, "end": 652.5600000000001, "text": " because you have differently sized gradients from the different tasks that go in different" }, { "start": 652.5600000000001, "end": 653.5600000000001, "text": " directions." }, { "start": 653.5600000000001, "end": 657.16, "text": " Now, the important point, I was wondering for a long time, what's the difference between" }, { "start": 657.16, "end": 664.36, "text": " this and simply saying, look, any data set, right, your loss on any data set D is just" }, { "start": 664.36, "end": 670.48, "text": " the sum of the loss of your individual data points, Xi." }, { "start": 670.48, "end": 677.4399999999999, "text": " Because it is the same case that you can have different data points and the gradients that" }, { "start": 677.4399999999999, "end": 679, "text": " you get, right?" }, { "start": 679, "end": 683.8399999999999, "text": " So that would result, if you've never done optimization, I'm sorry, I'm going a bit fast," }, { "start": 683.84, "end": 688.8000000000001, "text": " that would result in the gradient with respect to your weights of your loss over the entire" }, { "start": 688.8000000000001, "end": 698.62, "text": " data set is, of course, approximated by the one over n in your mini batch." }, { "start": 698.62, "end": 703.08, "text": " So by the gradients in your mini batch, right?" }, { "start": 703.08, "end": 707.7800000000001, "text": " So let's call this the loss of Xi." }, { "start": 707.7800000000001, "end": 710.5400000000001, "text": " This is completely illegible." }, { "start": 710.54, "end": 717.52, "text": " But what I'm saying is that your total gradient is the average of your individual data points." }, { "start": 717.52, "end": 720.04, "text": " And these might be conflicting as well, right?" }, { "start": 720.04, "end": 725.68, "text": " You could have that that one points in this direction, and the other one points in that" }, { "start": 725.68, "end": 726.68, "text": " direction." }, { "start": 726.68, "end": 732.4, "text": " And we've done this just and and things like things like Adam and SGD actually, are able" }, { "start": 732.4, "end": 736.5999999999999, "text": " to to handle that just fine, because we do this average operation." }, { "start": 736.6, "end": 746.28, "text": " I think what is different here is in multitask learning is that the multitask the tasks distribution" }, { "start": 746.28, "end": 751.28, "text": " is not like stochastically IID, let's say." }, { "start": 751.28, "end": 758.36, "text": " So in in this case, you can always count on that the expectation will average out this" }, { "start": 758.36, "end": 759.36, "text": " noise." }, { "start": 759.36, "end": 765.9200000000001, "text": " So this noise, if you if you go in expectation, right, if you do mini batches, and aggregate" }, { "start": 765.92, "end": 771.1999999999999, "text": " over the whole data set, then that will kind of even out because for the different data" }, { "start": 771.1999999999999, "end": 778, "text": " points, okay, one gradient might be larger, one might be smaller, but there is no systematic" }, { "start": 778, "end": 784.24, "text": " error, or there's no systematic bias that comes from the different data points." }, { "start": 784.24, "end": 792.3399999999999, "text": " Here you have, as we said, one task might be much harder than the other task, right?" }, { "start": 792.34, "end": 800.36, "text": " Or you might have much more data, or the loss function is just larger, like magnitude wise." }, { "start": 800.36, "end": 807.7, "text": " So you can have any number of systematic biases that that different tasks have with each other." }, { "start": 807.7, "end": 812.08, "text": " And therefore, the conflicting gradients seem to be a problem." }, { "start": 812.08, "end": 816.76, "text": " So this paper does a good job of analyzing the situation of conflicting gradients." }, { "start": 816.76, "end": 827.4399999999999, "text": " And what I find particularly interesting is that they first of all, they propose an algorithm" }, { "start": 827.4399999999999, "end": 830.08, "text": " to deal with these conflicting gradients." }, { "start": 830.08, "end": 836.8, "text": " So they say whenever two gradients are conflicting, right, what we would do is we would project" }, { "start": 836.8, "end": 840.08, "text": " them on the normal plane of each other, right?" }, { "start": 840.08, "end": 848.6, "text": " So for example, here in step B, we take the gradient of task I, and we project it onto" }, { "start": 848.6, "end": 855.8000000000001, "text": " the normal plane of gradient from the task J, right?" }, { "start": 855.8000000000001, "end": 860.96, "text": " And if we do this, and they have a whole algorithm where it's general." }, { "start": 860.96, "end": 869.58, "text": " So if we do this for multiple tasks, so basically, we get a mini batch of tasks, right?" }, { "start": 869.58, "end": 875.88, "text": " So they generalize this to that you have a bunch of tasks." }, { "start": 875.88, "end": 880.1600000000001, "text": " We get the different gradients, and these can be stochastic because we can we can do" }, { "start": 880.1600000000001, "end": 882.96, "text": " this with stochastic data sets." }, { "start": 882.96, "end": 885.86, "text": " We go through the batch." }, { "start": 885.86, "end": 894.2800000000001, "text": " And if the gradients are conflicting, we simply project the gradients onto the onto each other." }, { "start": 894.28, "end": 901.28, "text": " And that will result now in a set of non conflicting gradients." }, { "start": 901.28, "end": 903.56, "text": " You might be a bit appalled by this." }, { "start": 903.56, "end": 906.56, "text": " I was at first when I saw this." }, { "start": 906.56, "end": 911.76, "text": " But they actually do, as I said, a good job of analyzing this." }, { "start": 911.76, "end": 914.8, "text": " So they have two theorems here, which I find interesting." }, { "start": 914.8, "end": 919.92, "text": " So theorem one is assume these are convex and differentiable." }, { "start": 919.92, "end": 924, "text": " So somewhat standard assumptions in optimization." }, { "start": 924, "end": 929.84, "text": " They say then the PC grad update rule with a step size smaller than one over L, L is" }, { "start": 929.84, "end": 937.02, "text": " the Lipschitz constant, will converge either to a location where the cosine is exactly" }, { "start": 937.02, "end": 940.32, "text": " negative one between two gradients." }, { "start": 940.32, "end": 945.92, "text": " That never happens except if you construct it or the optimal value, right?" }, { "start": 945.92, "end": 952.16, "text": " So this is basically a consistency theorem saying that this algorithm will still converge" }, { "start": 952.16, "end": 954.4399999999999, "text": " to the optimum value." }, { "start": 954.4399999999999, "end": 959.4399999999999, "text": " This here is this is the loss." }, { "start": 959.4399999999999, "end": 966.64, "text": " So this loss is the sum of loss one and loss two, right of these two tasks." }, { "start": 966.64, "end": 972.4, "text": " So for two tasks, they prove that the algorithm will still go to the correct point if you" }, { "start": 972.4, "end": 974.04, "text": " run it long enough." }, { "start": 974.04, "end": 977.12, "text": " Doesn't say anything about the speed, though." }, { "start": 977.12, "end": 980.64, "text": " This is where theorem two comes in." }, { "start": 980.64, "end": 987.36, "text": " Theorem two says, suppose L is differentiable and the gradient of L is Lipschitz continuous." }, { "start": 987.36, "end": 994.04, "text": " This again, same assumptions, except no longer need convexity." }, { "start": 994.04, "end": 1003.64, "text": " Let theta MT, which is the multitask gradient and theta, sorry, not the gradient, the parameters" }, { "start": 1003.64, "end": 1010.08, "text": " theta PC grad be the parameters after applying one update to theta with G and PC grad modified" }, { "start": 1010.08, "end": 1011.08, "text": " G." }, { "start": 1011.08, "end": 1017.44, "text": " So this MT is the that would be kind of the original algorithm without their method." }, { "start": 1017.44, "end": 1021.64, "text": " And this here would be with their method." }, { "start": 1021.64, "end": 1028.1200000000001, "text": " Moreover, assume a bunch of things which we'll go into soon." }, { "start": 1028.1200000000001, "end": 1037.98, "text": " Then the loss function of the PC grad theta is smaller or equal than the loss function" }, { "start": 1037.98, "end": 1042.56, "text": " of the MT of the original." }, { "start": 1042.56, "end": 1043.6200000000001, "text": " So what does it mean?" }, { "start": 1043.6200000000001, "end": 1051.24, "text": " It means that if you're in your optimization landscape, and you're somewhere here, right," }, { "start": 1051.24, "end": 1058.32, "text": " and your optimum is somewhere here, and your loss function is kind of how far away are" }, { "start": 1058.32, "end": 1061.78, "text": " you from this from this optimum, right?" }, { "start": 1061.78, "end": 1069.36, "text": " It means that as long as these conditions are given, if you do your update without the" }, { "start": 1069.36, "end": 1079.8799999999999, "text": " their method, which would be so here would be theta MT or with their method, theta PC" }, { "start": 1079.8799999999999, "end": 1087.52, "text": " grad, then the loss function that you get from their method will be smaller than the" }, { "start": 1087.52, "end": 1092.16, "text": " loss function that you get without their method." }, { "start": 1092.16, "end": 1094.32, "text": " So this is a theorem, they prove it." }, { "start": 1094.32, "end": 1101.08, "text": " And for this to be the case, they need these three things." }, { "start": 1101.08, "end": 1102.8, "text": " So let's go from the back." }, { "start": 1102.8, "end": 1109, "text": " The third one is a is a condition on the on the loss function, sorry, on the step size." }, { "start": 1109, "end": 1113.96, "text": " And you can say, okay, the step size needs to be large enough." }, { "start": 1113.96, "end": 1116.52, "text": " You can set the step size." }, { "start": 1116.52, "end": 1118.8799999999999, "text": " This here, what is this?" }, { "start": 1118.8799999999999, "end": 1125.98, "text": " This here needs to be a this is a condition on the on this epsilon." }, { "start": 1125.98, "end": 1128.46, "text": " So what's this thing?" }, { "start": 1128.46, "end": 1132.96, "text": " It is a curvature bounding measure." }, { "start": 1132.96, "end": 1136.16, "text": " And that is compared to little l." }, { "start": 1136.16, "end": 1140.56, "text": " And little l here is this thing." }, { "start": 1140.56, "end": 1152.96, "text": " It is a constant that must be smaller than h and h is up here is the curvature." }, { "start": 1152.96, "end": 1156.36, "text": " So it depends on the curvature, right?" }, { "start": 1156.36, "end": 1163.26, "text": " It depends on the curvature fulfilling some condition, they state down here." }, { "start": 1163.26, "end": 1168.36, "text": " The curvature of the multitask gradient should be large." }, { "start": 1168.36, "end": 1179.04, "text": " Yeah, and the first condition we've already seen is that the cosine of the angles needs" }, { "start": 1179.04, "end": 1183.1599999999999, "text": " to be smaller than negative something that depends on the gradients." }, { "start": 1183.1599999999999, "end": 1187.1999999999998, "text": " And this here turns out actually to be the magnitudes of the gradients." }, { "start": 1187.1999999999998, "end": 1193.1599999999999, "text": " So this, this first this here, we can we can neglect that's a step size condition." }, { "start": 1193.16, "end": 1198.48, "text": " This here means the gradients should be conflicting." }, { "start": 1198.48, "end": 1205.94, "text": " And this here means that there should be sufficient curvature in the loss function." }, { "start": 1205.94, "end": 1213.1200000000001, "text": " This is exactly what we saw at the beginning in this in this thing here." }, { "start": 1213.1200000000001, "end": 1218.1200000000001, "text": " So there was a sufficient curvature." }, { "start": 1218.12, "end": 1223.32, "text": " Because in one direction, the gradient was very steep, and in the other direction, it" }, { "start": 1223.32, "end": 1227.9599999999998, "text": " wasn't, which basically means there is a change of steepness, right?" }, { "start": 1227.9599999999998, "end": 1232.6599999999999, "text": " There's a change of steepness in one direction versus the other direction." }, { "start": 1232.6599999999999, "end": 1238.8, "text": " And also the two gradients were conflicting, which we saw right here." }, { "start": 1238.8, "end": 1246.76, "text": " If this is the case, then this algorithm will bring you faster to the optimum than the the" }, { "start": 1246.76, "end": 1249.84, "text": " normal algorithm, but only if this is given." }, { "start": 1249.84, "end": 1253.36, "text": " And notably, this can change step to step." }, { "start": 1253.36, "end": 1260.82, "text": " They actually call this the I think the holy trifecta evil trifecta something, they have" }, { "start": 1260.82, "end": 1262.4, "text": " a name for it." }, { "start": 1262.4, "end": 1267.48, "text": " But I'm going to read you out the the the conditions that how they describe it." }, { "start": 1267.48, "end": 1271.36, "text": " The conditions are first, the angle between the task gradients is not too small, i.e." }, { "start": 1271.36, "end": 1274.44, "text": " the two tasks need to conflict sufficiently." }, { "start": 1274.44, "end": 1280, "text": " Second, the difference in magnitude needs to be sufficiently large." }, { "start": 1280, "end": 1285.52, "text": " Third, the curvature of the multitask gradient should be large." }, { "start": 1285.52, "end": 1290.3200000000002, "text": " And fourth, the learning rate should be big enough such that large curvature would lead" }, { "start": 1290.3200000000002, "end": 1296.6200000000001, "text": " to overestimation of performance improvement on the dominating task and underestimation" }, { "start": 1296.6200000000001, "end": 1300.6000000000001, "text": " of performance degradation on the dominated task." }, { "start": 1300.6000000000001, "end": 1303.2, "text": " So here you see a little subtlety." }, { "start": 1303.2, "end": 1311.32, "text": " I said before that this condition here was negligible because you can set the task size." }, { "start": 1311.32, "end": 1321.64, "text": " In actuality, this you can so I'm not meaning to rag on this, but what does it mean the" }, { "start": 1321.64, "end": 1325.4, "text": " learning rate should be big enough such that blah blah blah." }, { "start": 1325.4, "end": 1330.56, "text": " And what what comes here seems to be negative, right, such that the large curvature would" }, { "start": 1330.56, "end": 1339.6399999999999, "text": " lead to overestimation, which basically means this method, this thing here counts if the" }, { "start": 1339.6399999999999, "end": 1341.32, "text": " step size is large." }, { "start": 1341.32, "end": 1349.96, "text": " So that means if I were to play devil's advocate, if I have a problem like this, I could either" }, { "start": 1349.96, "end": 1360.48, "text": " write I could either use their method PC grad, or I could just decrease my learning rate." }, { "start": 1360.48, "end": 1367.08, "text": " And use the classic algorithm, because if I just decrease my learning rate relative" }, { "start": 1367.08, "end": 1371.88, "text": " to the curvature, then this theorem would no longer hold and it will no longer be the" }, { "start": 1371.88, "end": 1376.6, "text": " case that their algorithm gives me a faster convergence." }, { "start": 1376.6, "end": 1379.52, "text": " So there's there's two ways of looking at these things." }, { "start": 1379.52, "end": 1385.52, "text": " It's like, yes, in in these conditions, this algorithm is better, but it is better because" }, { "start": 1385.52, "end": 1392.44, "text": " someone has set the learning rate too high, and this algorithm kind of fixes that." }, { "start": 1392.44, "end": 1399.4, "text": " Now the upside to this is, of course, that the usually you don't want to kind of set" }, { "start": 1399.4, "end": 1405.32, "text": " your learning rate in accordance with the curvature of the with the curvature of the" }, { "start": 1405.32, "end": 1408.32, "text": " problem and so on, you don't know the curvature most of the time." }, { "start": 1408.32, "end": 1414.36, "text": " So you just set some learning rate, and their algorithm appears to be working." }, { "start": 1414.36, "end": 1419.3999999999999, "text": " So when this learning rate is smaller, it's just not guaranteed to outperform the classic" }, { "start": 1419.3999999999999, "end": 1420.3999999999999, "text": " algorithm." }, { "start": 1420.3999999999999, "end": 1426.1799999999998, "text": " But I just found find this interesting in terms of how you read a paper, right?" }, { "start": 1426.1799999999998, "end": 1430.34, "text": " If you read a paper, you come across something like this, these conditions, you can always" }, { "start": 1430.34, "end": 1436.7199999999998, "text": " see them as here is what needs to happen for us to succeed, or here is what needs to happen" }, { "start": 1436.7199999999998, "end": 1439.56, "text": " for the others to fail." }, { "start": 1439.56, "end": 1445.52, "text": " And therefore, we're the only ones that succeed in this regime." }, { "start": 1445.52, "end": 1450.04, "text": " As I said, it's a cool algorithm, but I found that to be funny." }, { "start": 1450.04, "end": 1459.76, "text": " All right, so they test this on multitask, which these MT 10 and MT 50 benchmarks are" }, { "start": 1459.76, "end": 1461.46, "text": " these robotic manipulation." }, { "start": 1461.46, "end": 1465.36, "text": " So multitask doesn't only mean like supervised learning." }, { "start": 1465.36, "end": 1467.96, "text": " In this case, it's actually multitask reinforcement learning." }, { "start": 1467.96, "end": 1473.8, "text": " So here you have everything you have mini batches, you have episodes, and you have you" }, { "start": 1473.8, "end": 1475.48, "text": " have multiple tasks." }, { "start": 1475.48, "end": 1478.64, "text": " So this is everything together." }, { "start": 1478.64, "end": 1479.64, "text": " Very cool." }, { "start": 1479.64, "end": 1488.8400000000001, "text": " And you in their actual implementation, they say what they do is they have these multiple" }, { "start": 1488.8400000000001, "end": 1489.8400000000001, "text": " tasks." }, { "start": 1489.8400000000001, "end": 1493.6200000000001, "text": " So they have the agent, and they first select the tasks." }, { "start": 1493.6200000000001, "end": 1497.14, "text": " So for example, here, pull this right?" }, { "start": 1497.14, "end": 1502.72, "text": " Then they generate an episode by interacting with the environment, forth and back, forth" }, { "start": 1502.72, "end": 1508.64, "text": " and back, then they put that episode into a replay buffer." }, { "start": 1508.64, "end": 1511.6000000000001, "text": " Then they maybe select another task and so on." }, { "start": 1511.6000000000001, "end": 1516.68, "text": " So until they have a bunch of data in the replay buffer from different tasks, then they" }, { "start": 1516.68, "end": 1524, "text": " sample episodes from different tasks, right from task one, task two, and so on." }, { "start": 1524, "end": 1527.52, "text": " And that will become a mini batch in the learning procedure." }, { "start": 1527.52, "end": 1530.36, "text": " So pretty intricate thing." }, { "start": 1530.36, "end": 1534.52, "text": " But of course, you the hope is that you can learn kind of a shared representation that" }, { "start": 1534.52, "end": 1543.16, "text": " you can then perform all of these tasks faster than if you were to learn them each independently." }, { "start": 1543.16, "end": 1546.44, "text": " So the MT 10 and MT 50 come from this." }, { "start": 1546.44, "end": 1553.6, "text": " And I think they also have goal condition pushing, where it the task is simply to push" }, { "start": 1553.6, "end": 1556.4399999999998, "text": " something to a what they call goal conditioned." }, { "start": 1556.4399999999998, "end": 1560.9199999999998, "text": " And the cool thing about this is, it's not only 50 tasks, but you can produce an infinity" }, { "start": 1560.9199999999998, "end": 1566.76, "text": " of tasks because you can always specify a new location where you should push something" }, { "start": 1566.76, "end": 1567.76, "text": " to." }, { "start": 1567.76, "end": 1568.9599999999998, "text": " Right." }, { "start": 1568.9599999999998, "end": 1572.1999999999998, "text": " So that's, that's fairly, fairly cool." }, { "start": 1572.1999999999998, "end": 1573.9599999999998, "text": " And oh, yeah, the curves." }, { "start": 1573.9599999999998, "end": 1582.56, "text": " So you see that if you do something like soft actor critic, or multi head soft actor critic," }, { "start": 1582.56, "end": 1589.76, "text": " so this multi head soft actor critic is probably the closest to what I defined in to what I" }, { "start": 1589.76, "end": 1595.8, "text": " defined at the beginning, where you have this shared representation, and then and then the" }, { "start": 1595.8, "end": 1597.2, "text": " individual heads." }, { "start": 1597.2, "end": 1605.08, "text": " And you can see that severely under performs against the SAC plus PC grad plus their method" }, { "start": 1605.08, "end": 1612.3999999999999, "text": " that seems to outperform fairly consistently, even against learning the tasks independently." }, { "start": 1612.4, "end": 1617.64, "text": " So it learns much faster than if you were to learn these tasks just independently from" }, { "start": 1617.64, "end": 1621.3200000000002, "text": " each other, which is pretty cool, right?" }, { "start": 1621.3200000000002, "end": 1624.2, "text": " So I, I think that's pretty cool." }, { "start": 1624.2, "end": 1630.72, "text": " All right, so they do actually interesting investigations." }, { "start": 1630.72, "end": 1637.52, "text": " First of all, they research, okay, in during these learning runs, how, what is the curvature" }, { "start": 1637.52, "end": 1639.4, "text": " here?" }, { "start": 1639.4, "end": 1643.6000000000001, "text": " And the curvature of the loss function, they measure like this." }, { "start": 1643.6000000000001, "end": 1650.0400000000002, "text": " So basically, all this is, is a, a consequence of a Taylor approximation." }, { "start": 1650.0400000000002, "end": 1660.44, "text": " So if you have like f of x, you can, you can write this as f of some x zero, plus the gradient" }, { "start": 1660.44, "end": 1671.64, "text": " of f that plus the gradient of f times x here, sorry, at x zero times x in this direction." }, { "start": 1671.64, "end": 1678.28, "text": " And then if you subtract, so this is a first order approximation to this, to the function" }, { "start": 1678.28, "end": 1679.28, "text": " on the right." }, { "start": 1679.28, "end": 1686.76, "text": " Then if you bring this over here, you or if you sorry, if you subtract the two sides from" }, { "start": 1686.76, "end": 1693.96, "text": " each other, then you can see there's the difference between the actual function and the first" }, { "start": 1693.96, "end": 1701.08, "text": " order approximation of the function that must be, or that is most likely the curvature." }, { "start": 1701.08, "end": 1707.44, "text": " Now it is not, it is like every higher order term, but the assumption is that the dominant" }, { "start": 1707.44, "end": 1710.48, "text": " higher order term will be the curvature." }, { "start": 1710.48, "end": 1711.8, "text": " Right?" }, { "start": 1711.8, "end": 1718.24, "text": " So this is, this would be this, except they don't, they, they do it not doing the x and" }, { "start": 1718.24, "end": 1721.84, "text": " x zero, they do it at theta t and theta t plus one." }, { "start": 1721.84, "end": 1728.3, "text": " So you can see this is the first order approximation, and this is the actual function value after" }, { "start": 1728.3, "end": 1730.8, "text": " they do a step." }, { "start": 1730.8, "end": 1736.68, "text": " And the resulting thing will be the curvature or dominated by the curvature." }, { "start": 1736.68, "end": 1744.64, "text": " So they analyze this over the course of learning and they see that it actually increases as" }, { "start": 1744.64, "end": 1746.16, "text": " you, as you go on." }, { "start": 1746.16, "end": 1753.88, "text": " And just, I'm not a big fan of like just large numbers, but they number seem to be large," }, { "start": 1753.88, "end": 1755.24, "text": " right?" }, { "start": 1755.24, "end": 1758.88, "text": " Just compared to what you can handle with a computer, the numbers seem to be large and" }, { "start": 1758.88, "end": 1765.6000000000001, "text": " they seem to be getting larger in order of magnitude steps across training iterations." }, { "start": 1765.6, "end": 1770.12, "text": " So I'm going to believe them that this curvature is given." }, { "start": 1770.12, "end": 1779.36, "text": " I would have liked to have it seen compared to just a single task instead of a multitask," }, { "start": 1779.36, "end": 1784.3999999999999, "text": " instead of, you know, comparing these things, which is useless because they reach different" }, { "start": 1784.3999999999999, "end": 1786.9199999999998, "text": " losses, right?" }, { "start": 1786.9199999999998, "end": 1792.98, "text": " So it's pretty useless to compare their curvature across the number of iterations." }, { "start": 1792.98, "end": 1798.98, "text": " What I would have liked to see is a comparison multitask versus single task." }, { "start": 1798.98, "end": 1807.08, "text": " And to show me that in single task learning, this curvature doesn't happen." }, { "start": 1807.08, "end": 1812.76, "text": " Here you have the percentage of update steps where conditions A and B are held." }, { "start": 1812.76, "end": 1817.8, "text": " You remember condition A was the condition on the conflicting angle." }, { "start": 1817.8, "end": 1828.8, "text": " Condition B was the condition that the curvature is large enough and you can see that as you" }, { "start": 1828.8, "end": 1836.84, "text": " go on with learning these dotted and dashed lines, the conditions hold almost entirely" }, { "start": 1836.84, "end": 1843.08, "text": " at the beginning of learning, but then still hold by in a big time of the steps." }, { "start": 1843.08, "end": 1850.1799999999998, "text": " So here is like about half the steps still at the end of training these conditions hold." }, { "start": 1850.1799999999998, "end": 1858.72, "text": " So it is fairly, fairly good evidence that often the problems that they say are real" }, { "start": 1858.72, "end": 1862.9399999999998, "text": " are really there and then therefore their algorithm helps, right?" }, { "start": 1862.9399999999998, "end": 1868, "text": " So here's the average per task average return." }, { "start": 1868, "end": 1876.76, "text": " And interestingly, they say in the text, look, this task here seems to be easier, right?" }, { "start": 1876.76, "end": 1880.2, "text": " And the task two, which is the dotted line seems to be harder." }, { "start": 1880.2, "end": 1887.8, "text": " So SAC, the baseline algorithm never really manages to learn task two, whereas this PC" }, { "start": 1887.8, "end": 1891.6, "text": " grad manages after a while to learn it." }, { "start": 1891.6, "end": 1900.6799999999998, "text": " And at that point, something happens over here, which I'm not super sure." }, { "start": 1900.6799999999998, "end": 1908.4399999999998, "text": " Yeah, that's what they say in the text, but I have to squint a lot to see that exactly" }, { "start": 1908.4399999999998, "end": 1911, "text": " at that position, something happens." }, { "start": 1911, "end": 1918.32, "text": " Suffice to say that the PC grad is able to learn the task that SAC isn't able to learn" }, { "start": 1918.32, "end": 1925.2, "text": " because probably task one is completely dominating the gradient at that point, right?" }, { "start": 1925.2, "end": 1927.84, "text": " All right, so this was the paper." }, { "start": 1927.84, "end": 1932.72, "text": " I invite you to read it and thanks for listening." }, { "start": 1932.72, "end": 1949.08, "text": " Bye bye." } ]
_8KNb5iqblE
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Longformer: The Long-Document Transformer
[ "Science & Technology" ]
[ "deep learning", "machine learning", "nlp", "natural language processing", "machine translation", "arxiv", "attention mechanism", "attention", "transformer", "bert", "roberta", "mlm", "convolution", "memory", "linear", "sliding", "dilated", "sparse" ]
The Longformer extends the Transformer by introducing sliding window attention and sparse global attention. This allows for the processing of much longer documents than classic models like BERT. Paper: https://arxiv.org/abs/2004.05150 Code: https://github.com/allenai/longformer Abstract: Transformer-based models are unable to process long sequences due to their self-attention operation, which scales quadratically with the sequence length. To address this limitation, we introduce the Longformer with an attention mechanism that scales linearly with sequence length, making it easy to process documents of thousands of tokens or longer. Longformer's attention mechanism is a drop-in replacement for the standard self-attention and combines a local windowed attention with a task motivated global attention. Following prior work on long-sequence transformers, we evaluate Longformer on character-level language modeling and achieve state-of-the-art results on text8 and enwik8. In contrast to most prior work, we also pretrain Longformer and finetune it on a variety of downstream tasks. Our pretrained Longformer consistently outperforms RoBERTa on long document tasks and sets new state-of-the-art results on WikiHop and TriviaQA. Authors: Iz Beltagy, Matthew E. Peters, Arman Cohan 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 Longformer, the long document transformer by Is Beltaji, Matthew Peters and Armin Cohen of Allen AI. So the longformer is a variant of the transformer as you might have guessed. The longformer is a transformer that can deal with long documents, so it's aptly named. So I am going to discuss what differentiates the longformer from the transformer. If you don't know what a transformer is, watch the video on attention is all you need. I have a video on that. And I would also suggest you watch the video on BERT, because a lot of the architecture and training here is based on the BERT or variants of BERT. So I'll basically explain what makes the longformer different such that it gets long documents, right, so she can be applied to long documents. So what is the problem with the original transformer? If you have a transformer model and let's say you're doing an NLP task, which usually is where transformers are used, and you want to have a paragraph like this one right here, the abstract of the paper, and maybe you want to predict whether the paper gets accepted at a conference or not. Now the classic transformers, they have a limit, a very harsh limit, on the amount of tokens that they can look at at the same time. So what you would do in a classic transformer is you couldn't process this entire thing, let's say, you would divide it in chunks, you'd say, okay, here's my first chunk from here to here, my second chunk from here to here, and then here to here, and so on. So you go through the documents, split it up in chunks, process each of the chunks individually, and then maybe aggregate the predictions. But of course the drawback is that the model cannot make specific connections between, let's say, some word here, like operation, and somewhere down here, like language. It cannot connect the two on a neural level, at least not in the classic transformer architectures. Now there are ways to try to alleviate this, but classically, if you split up your documents into individual samples, they become independent, you cannot do attention, this attention mechanism cannot operate over across the boundaries of these chunks. So the long former, the goal is to actually just be able to put this entire document here into the model at the same time. So let's look a bit closer into this. In a classic transformer model, what you'll have is you'll have layers of what is called attention mechanism. I'm gonna draw six units here, and the units are actually the input sequence. So in a transformer, other than like a classic neural network, you don't actually have numbers of units in the layers, but you can input as many as long sequences as you want, until your memory limit is reached basically. So these units, they expose something called keys on the lower layer, and these are vectors that point somewhere, and the upper layer will produce what are called queries. And again, I invite you to look at the attention is all you need video if you want more explanation. And basically the keys and queries, they decide where information gets routed to. So the routing of information is what makes the transformer the transformer. So for example, this here is probably going to be routed to this here. So the information is routed like this, and then this here is going to be routed like this. You see the routing is according to the dot product of the keys and queries. So in essence, if you have an input sequence tokens, and you usually transform in a transformer, you transform the things into same length sequences. That has to do a lot also with how you want to pre-train things and so on. So we're not really going to change that part. If you have n input sequence and n tokens on the next layer, and everything can attend to everything, so all the inner products are computed, right? Everything is connected to everything. That means that you're going to end up with an O of n squared memory requirement, because you have n squared connections. The way to alleviate this is much much like you would alleviate this in a classic neural network. So in a classic neural network, imagine you have this MLP, a multi-layer perceptron, or what usually known as a fully connected layer, right? So here I have the same thing, but it's not a transformer. It's a classic neural network, fully connected. So I have D units right here, and D units in this first hidden layer. And I'll have a weight matrix in here, right? And the weight matrix means everything is connected to everything, right? Everything connects to everything else. Again, my memory requirement here is D squared. Now how do we deal with this in a classic neural network? We go to what is called a convolutional neural network. At least that's one of the methods. So let's make this again, but let's now make this a convolutional neural network. What we'll have is we'll have a convolutional kernel. In this case, it's just of length 3, right? So we just have 3 units here, and they will do the same fully connected pattern, but only over these 3 units right here. And then we slide the kernel over, right? Now it's in this position. It's still the same 3 units, but now these 3 things are connected to these 3 things that they're now over, right? And so you keep sliding this over across the lower layer until you're finally at the end here. And now you've reduced the memory consumption from D squared to just D times, and if this is usually the kernel size, it's called K, to D times K. And K you can keep pretty much constant, so that's O of D, right? The same goes for the long former. So in the long former, the idea is that you have a so-called sliding window attention. It's exactly the same as it is in the convolution, except that you don't have these hidden units here, but these are actually parts of the input sequence, and instead of the weight matrix here, you have the attention mechanism over the keys, queries, and values. But the idea is similar. So you can basically say this is a sort of a convolution, and we've already had this in the video about axial attention a bit. Now of course this is your trade-off memory for performance, because before, right, before, I'm gonna draw, let's draw it on top of this fully connected layer, before all the units could attend to all the units, right? And now the unit can only attend to its immediate neighborhood, right? This green unit here can only attend to itself in the lower layer and its immediate neighbors if the kernel size is 3. But consider what happens in the next layer. So in the next layer I have, for example, this unit right here. This is same unit, right, on the next layer. It can attend to these two and itself in the lower layer, but these two themselves can attend to all of these, right, so that the one on the right can attend to one more. So in the first layer this particular unit had information from these three units, but in the second layer the same unit has now information across these five, right, and this is kind of this cone of attention. It gets bigger and bigger as you go through the layers. So you lose the information to incorporate wide ranges of information in a single layer, but you regain it through depth, right? The deeper you go the more a single unit gets information, right, this unit gets information from this unit over here through the layers, through the layers. It can't watch the unit right here in this layer. That's not possible, but it gets the information through the layers. Of course there's still a trade-off, like a fully connected layer could just do this in one step and then in the next layer it could do it again, right, it can do much more complex computation. But if you believe that the most important information is actually in the neighborhoods of the individual tokens, which is conceivable in something like a convolutional neural network, you know that, you know, in an image usually you have localized information, right, if there's a cat here then the nose and the eyes of the cat are pretty close together. So in order to recognize it's a cat you mostly want local information, more and more local information. So in an image that makes sense and in a text it also makes sense to a degree in that usually words close together in a sentence, they are important for each other, right, but the power of the transformer was initially that it could attend to everything in a sentence, right. So for example if you have again the paragraph here, the power of the transformer, at least that was said, is the fact that this piece of text here could make a connection to this piece of text here and therefore the understanding of the entire paragraph could be reliant on this connection being made, which a local model can't do. But if you go through depth that you might be able to recover that. So the longformer is basically what the convolutional neural network does for MLPs, it does it for transformers, right. So instead of n by n giving you n squared now you go into this way where you have, so if you do the same for the transformer you go to o n times, let's call it w, and w being your window size in this case. They have an illustration of this right here. So in a original transformer this is an attention matrix. So here you have your n units in a sequence and drawn in is which unit can attend to which other unit in a given layer. So you'll see this particular unit i here can attend of course to itself, right, can attend to unit i. But it can also attend to this unit or to this unit or to this unit to any unit, right. And that's what gives you this n squared attention because any unit can attend to any unit. Now in this sliding window attention pattern, and this is one of the core components of the longformer, you see that the i-th unit here right here can attend to itself, right, but also to this and to this, this, but no more. It can only attend to the i-th unit or to i minus w to i plus w, right. And this here is a window of size w. This is this sliding window. So a given unit can only attend to itself or its neighbors in one layer, right. And this is exactly what a convolution is. Like if you see if you see this pattern, this is a this is a convolutional pattern. Now the second core component is they expand on this idea in that they make they create these dilated sliding windows. Now you see you already know what a sliding window is. Now they're saying well if you if you have this sliding window it might take quite a number of layers in order to you know get your attention of the entire sequence incorporated. We saw before it took like three layers to get halfway through this sequence of what was it like six tokens and it took us like three layers and with so basically if you go if you go one layer up right one layer up you gain one more context window in each direction, right. So it's not you'd have to go very very deep in order to incorporate the information from these very long sequences and the sliding the dilated sliding window helps this where they say well technically now any any any sequence here so again if we have this sequence and this is the next layer actually let's just draw so this unit right here it will be able to attend this and this but not this and not this but it will also be able to attend this and this but not this and not this sorry not this so it'll skip one so right these these attention patterns they will always kind of skip skip one and the idea is that now you have a vastly greater window of attention right your your window size is now way bigger that means you can incorporate information way faster across the layers like global information but of course now they're kind of arguing against each other in when they do this sliding window they say well we pose that mostly local information is important for NLP right the words right around the word are important and now if they say this here they basically say oh well it's not so important that we miss this word right here which is right next to the word that they are attending from which is counter counter to what they just said that probably the most important information is around the word they they do get around this by saying well if we have different layers in a transformer and in the lower layers will use this sliding window fully local and in the higher layers will use this dilated window and therefore in the in the lower layers we postulate that local information is actually what's needed to understand local features and then in the higher layers we want more global information because it will incorporate features from the from the local informations of the lower layers all right I can I can get the argumentation but I feel that's just something they've thrown in there to make it work better after they tried it out and the the last idea here in the long former is what they call global attention and these global attention is sparse what it means is that there are some special units here so in this this this and this unit and these special units as you can see from the attention pattern these are these can actually attend to everything so this unit can attend for example to this one or to this one or to anything these can attend to anything and any unit can attend to those right any unit can attend to the the first unit right here right so these are your special tokens your special units and they have global attention and the reason for this particularly is that sometimes this is needed and this is an engineering choice right the example I can give is let's say you have a question answering task in a question answering task what you usually have is a question and a paragraph and let's say the task here is to answer yes or no is the is the question so the question might be a statement right I don't know King James was King of England from 1120 to 1140 and then the paragraph will be the Wikipedia entry for King James and the the question is yes or no is the is the question true or not is the statement made true or not how you would feed this to a birdmold to a transformer is you concatenate these two things quest statement in paragraph right these are the tokens right here and then you would separate them using a special token called the separator token this is just to inform the model that here is where the first thing stops and the next thing starts and then at the beginning you would put a special token called the CLS token now usually what you do is you send these things through your transformer and now in the last layer right you end up as we've seen before because you always transform a sequence into a sequence you end up with a sequence again but you just want a single thing you just want yes or no so you designate you say this particular unit here that corresponds to the CLS token that's what I'm going to throw into a logistic regression and that's what will give me my yes or no answer and that's how you train it right so you you don't want to single out any of these any of these as like special so you simply already include a special token at the beginning that then you take the classification from right it's pretty smart but also you say ah this is such a special token I want that to be able to attend to anything right even though for example this unit right here it can only attend to its neighbors right it has this cone thing and this unit right here has this cone thing this unit right here can always attend to anything at each of the layers right it can attend to anything and anything can attend to it so it can get information from anywhere routed to it in each of the layers and it can send information to any of the other units. This is an engineering choice. So at the beginning, you as an engineer have to say which one of these tokens are special tokens. For these tokens, you'll actually then do full attention. It can attend to and from anything. What are our new memory requirements? What this will give us is, first of all, we have N tokens. And here W is our window size. So we have N times W memory. But then we also add the global attention. So plus the number of special tokens times, if there's a special token, it will have N times 2 memory requirement, because it can attend from and to in each layer. And this entire thing, sorry, with the plus, this entire thing times the number of layers. So this is your new attention memory requirements. And as you can see here, N plus N. So this is going to be order of N, instead of much smaller than order of N squared, as we had for the original transformer. Right. So this is what the longformer basically does. Now they have written custom CUDA kernels for doing this dilated attention and so on, which is pretty cool. And they have code available for the model. They test this on a number of language tasks. And what I find interesting is, actually, they start from the Roberta checkpoint, which Roberta, where is it said? Somewhere, oh yeah, this Roberta model right here is a variant of BERT. Right, you can see the name in here. It's a variant of BERT. And that's their baseline. And they start from these checkpoints, as far as I understand, and they kind of copy over the position embeddings and so on. And therefore, they only need to train not very much past the Roberta. Now the reason why they can copy it over actually is, and this I find very interesting, is they use a window size of 512. So until I read this, I got away from reading the paper thinking that this window size here might be fairly small. Right. So this window size, it might be, you know, maybe 10, 20, 30 tokens or something, right? But actually, this window size is 512 in their formulation, which basically means that this is as much as one of the classic models could take as a document. Right. So, sorry, let's go over. So this here is 512. So this is what a classic model could take as an entire document. And in the classic model, you simply split up the document, feed chunks, right? And then aggregate over them. Now the longformer basically has this. So right now, for now, I said it has less memory requirements. Actually, it has the same memory requirements as a classic model, but it is also able, because of these global attention, to kind of incorporate information from the surrounding things. So that's the new part. Because if you think about it, if this W here is 512, 512 was the original N. So 512 was the N0. Whatever the old models had as an N. So right now, if I replace this, and let's not take care of this. If I replace this, it's actually N times N0. And that regresses to the classic model if you plug in N0 here, right? So the new part really is the fact that you have this sliding window, and the global attention is able to incorporate information from these special tokens as well. Because sliding window, that was done before. So I just don't want to get to you the wrong impression that now we can run transformers on like very small memory machines. We can't. But we can run them on the same memory machines, because this is the same length, right? But also feed in longer documents, and have some information of the entire document be propagated to these blocks, which before we couldn't. Before we could just simply feed these blocks as one and not have global information. So that's the new thing. At least they haven't tested it on the smaller things, which is cool from an engineering point, right? You would want to, because if you want to show that you're better, you would want to basically be able to be as powerful as the old model, but then be more powerful. And that's what they do. All right. So if you want to check out the experiments and the ablations, it's very interesting because they turn on and off a lot of things in their model, and kind of check out where things come from, what helps, what doesn't. And I'll leave this to you, and I'll link it. And with that, thanks for listening, watching, and bye-bye.
[ { "start": 0, "end": 5.54, "text": " Hi there, today we're looking at Longformer, the long document transformer by" }, { "start": 5.54, "end": 13.48, "text": " Is Beltaji, Matthew Peters and Armin Cohen of Allen AI. So the longformer is a" }, { "start": 13.48, "end": 19.240000000000002, "text": " variant of the transformer as you might have guessed. The longformer is a" }, { "start": 19.240000000000002, "end": 26.72, "text": " transformer that can deal with long documents, so it's aptly named. So I am" }, { "start": 26.72, "end": 32.72, "text": " going to discuss what differentiates the longformer from the transformer. If you" }, { "start": 32.72, "end": 37.92, "text": " don't know what a transformer is, watch the video on attention is all you need. I" }, { "start": 37.92, "end": 43.96, "text": " have a video on that. And I would also suggest you watch the video on BERT," }, { "start": 43.96, "end": 50.120000000000005, "text": " because a lot of the architecture and training here is based on the BERT" }, { "start": 50.12, "end": 56.599999999999994, "text": " or variants of BERT. So I'll basically explain what makes the longformer" }, { "start": 56.599999999999994, "end": 61.12, "text": " different such that it gets long documents, right, so she can be applied" }, { "start": 61.12, "end": 66.2, "text": " to long documents. So what is the problem with the original transformer?" }, { "start": 66.2, "end": 72.44, "text": " If you have a transformer model and let's say you're doing an NLP task, which" }, { "start": 72.44, "end": 78.68, "text": " usually is where transformers are used, and you want to have a paragraph like" }, { "start": 78.68, "end": 83.76, "text": " this one right here, the abstract of the paper, and maybe you want to predict" }, { "start": 83.76, "end": 89.12, "text": " whether the paper gets accepted at a conference or not. Now the classic" }, { "start": 89.12, "end": 96.84, "text": " transformers, they have a limit, a very harsh limit, on the amount of tokens that" }, { "start": 96.84, "end": 100.80000000000001, "text": " they can look at at the same time. So what you would do in a classic" }, { "start": 100.80000000000001, "end": 107.32000000000001, "text": " transformer is you couldn't process this entire thing, let's say, you would divide" }, { "start": 107.32, "end": 112.24, "text": " it in chunks, you'd say, okay, here's my first chunk from here to here, my second" }, { "start": 112.24, "end": 118, "text": " chunk from here to here, and then here to here, and so on. So you go through the" }, { "start": 118, "end": 123.24, "text": " documents, split it up in chunks, process each of the chunks individually, and then" }, { "start": 123.24, "end": 128.92, "text": " maybe aggregate the predictions. But of course the drawback is that the model" }, { "start": 128.92, "end": 135.4, "text": " cannot make specific connections between, let's say, some word here, like operation," }, { "start": 135.4, "end": 140.92000000000002, "text": " and somewhere down here, like language. It cannot connect the two on a neural" }, { "start": 140.92000000000002, "end": 145.20000000000002, "text": " level, at least not in the classic transformer architectures. Now there are" }, { "start": 145.20000000000002, "end": 152.52, "text": " ways to try to alleviate this, but classically, if you split up your" }, { "start": 152.52, "end": 157.72, "text": " documents into individual samples, they become independent, you cannot do" }, { "start": 157.72, "end": 162.6, "text": " attention, this attention mechanism cannot operate over across the boundaries" }, { "start": 162.6, "end": 169.96, "text": " of these chunks. So the long former, the goal is to actually just be able" }, { "start": 169.96, "end": 177.51999999999998, "text": " to put this entire document here into the model at the same time. So let's look" }, { "start": 177.51999999999998, "end": 182.64, "text": " a bit closer into this. In a classic transformer model, what you'll have is" }, { "start": 182.64, "end": 189.2, "text": " you'll have layers of what is called attention mechanism. I'm gonna draw six" }, { "start": 189.2, "end": 195.44, "text": " units here, and the units are actually the input sequence. So in a transformer," }, { "start": 195.44, "end": 200.64, "text": " other than like a classic neural network, you don't actually have numbers of units" }, { "start": 200.64, "end": 208.72, "text": " in the layers, but you can input as many as long sequences as you" }, { "start": 208.72, "end": 216.2, "text": " want, until your memory limit is reached basically. So these units, they expose" }, { "start": 216.2, "end": 221.67999999999998, "text": " something called keys on the lower layer, and these are vectors that" }, { "start": 221.67999999999998, "end": 228.56, "text": " point somewhere, and the upper layer will produce what are called queries. And" }, { "start": 228.56, "end": 234.23999999999998, "text": " again, I invite you to look at the attention is all you need video if you" }, { "start": 234.23999999999998, "end": 238.88, "text": " want more explanation. And basically the keys and queries, they decide where" }, { "start": 238.88, "end": 245.44, "text": " information gets routed to. So the routing of information is what makes" }, { "start": 245.44, "end": 250.92, "text": " the transformer the transformer. So for example, this here is probably going to" }, { "start": 250.92, "end": 255.68, "text": " be routed to this here. So the information is routed like this, and then" }, { "start": 255.68, "end": 258.88, "text": " this here is going to be routed like this. You see the routing is according to" }, { "start": 258.88, "end": 267.15999999999997, "text": " the dot product of the keys and queries. So in essence, if you have" }, { "start": 267.15999999999997, "end": 274.64, "text": " an input sequence tokens, and you usually transform in a transformer, you transform" }, { "start": 274.64, "end": 281.71999999999997, "text": " the things into same length sequences. That has to do a lot also with how you" }, { "start": 281.71999999999997, "end": 286.96, "text": " want to pre-train things and so on. So we're not really going to change that" }, { "start": 286.96, "end": 294.08, "text": " part. If you have n input sequence and n tokens on the next layer, and everything" }, { "start": 294.08, "end": 298.4, "text": " can attend to everything, so all the inner products are computed, right?" }, { "start": 298.4, "end": 302.96, "text": " Everything is connected to everything. That means that you're going to end up" }, { "start": 302.96, "end": 308.23999999999995, "text": " with an O of n squared memory requirement, because you have n squared" }, { "start": 308.23999999999995, "end": 316.84, "text": " connections. The way to alleviate this is much much like you would alleviate this" }, { "start": 316.84, "end": 321.76, "text": " in a classic neural network. So in a classic neural network, imagine you have" }, { "start": 321.76, "end": 327, "text": " this MLP, a multi-layer perceptron, or what usually known as a fully connected" }, { "start": 327, "end": 331.88, "text": " layer, right? So here I have the same thing, but it's not a transformer. It's a" }, { "start": 331.88, "end": 338.12, "text": " classic neural network, fully connected. So I have D units right here, and D units" }, { "start": 338.12, "end": 342.88, "text": " in this first hidden layer. And I'll have a weight matrix in here, right? And the" }, { "start": 342.88, "end": 346.92, "text": " weight matrix means everything is connected to everything, right? Everything" }, { "start": 346.92, "end": 354.28, "text": " connects to everything else. Again, my memory requirement here is D squared. Now" }, { "start": 354.28, "end": 358.6, "text": " how do we deal with this in a classic neural network? We go to what is called a" }, { "start": 358.6, "end": 363.52000000000004, "text": " convolutional neural network. At least that's one of the methods. So let's" }, { "start": 363.52000000000004, "end": 369.88, "text": " make this again, but let's now make this a convolutional neural network. What we'll" }, { "start": 369.88, "end": 375.52000000000004, "text": " have is we'll have a convolutional kernel. In this case, it's just of length 3, right?" }, { "start": 375.52000000000004, "end": 382.8, "text": " So we just have 3 units here, and they will do the same fully connected pattern," }, { "start": 382.8, "end": 389.92, "text": " but only over these 3 units right here. And then we slide the kernel over, right?" }, { "start": 389.92, "end": 395.32, "text": " Now it's in this position. It's still the same 3 units, but now these 3 things" }, { "start": 395.32, "end": 401.08000000000004, "text": " are connected to these 3 things that they're now over, right? And so you keep" }, { "start": 401.08000000000004, "end": 408.48, "text": " sliding this over across the lower layer until you're finally at the end here. And" }, { "start": 408.48, "end": 413.76, "text": " now you've reduced the memory consumption from D squared to just D" }, { "start": 413.76, "end": 420.84000000000003, "text": " times, and if this is usually the kernel size, it's called K, to D times K. And K" }, { "start": 420.84000000000003, "end": 428.28000000000003, "text": " you can keep pretty much constant, so that's O of D, right? The same goes for" }, { "start": 428.28000000000003, "end": 433.44, "text": " the long former. So in the long former, the idea is that you have a so-called" }, { "start": 433.44, "end": 438.48, "text": " sliding window attention. It's exactly the same as it is in the convolution," }, { "start": 438.48, "end": 444, "text": " except that you don't have these hidden units here, but these are actually" }, { "start": 444, "end": 449.28, "text": " parts of the input sequence, and instead of the weight matrix here, you have the" }, { "start": 449.28, "end": 454.76, "text": " attention mechanism over the keys, queries, and values. But the idea is" }, { "start": 454.76, "end": 460.24, "text": " similar. So you can basically say this is a sort of a convolution, and we've" }, { "start": 460.24, "end": 465.64, "text": " already had this in the video about axial attention a bit. Now of course this" }, { "start": 465.64, "end": 474.48, "text": " is your trade-off memory for performance, because before, right, before, I'm gonna" }, { "start": 474.48, "end": 481.52, "text": " draw, let's draw it on top of this fully connected layer, before all the units" }, { "start": 481.52, "end": 487.44, "text": " could attend to all the units, right? And now the unit can only attend to its" }, { "start": 487.44, "end": 493.92, "text": " immediate neighborhood, right? This green unit here can only attend to itself in" }, { "start": 493.92, "end": 500.32, "text": " the lower layer and its immediate neighbors if the kernel size is 3. But" }, { "start": 500.32, "end": 505.24, "text": " consider what happens in the next layer. So in the next layer I have, for example," }, { "start": 505.24, "end": 511.96, "text": " this unit right here. This is same unit, right, on the next layer. It can attend to" }, { "start": 511.96, "end": 518.8, "text": " these two and itself in the lower layer, but these two themselves can attend to" }, { "start": 518.8, "end": 524.92, "text": " all of these, right, so that the one on the right can attend to one more. So in" }, { "start": 524.92, "end": 532.8, "text": " the first layer this particular unit had information from these three units, but" }, { "start": 532.8, "end": 537.56, "text": " in the second layer the same unit has now information across these five, right," }, { "start": 537.56, "end": 544.16, "text": " and this is kind of this cone of attention. It gets bigger and bigger as" }, { "start": 544.16, "end": 549.1999999999999, "text": " you go through the layers. So you lose the information to incorporate wide" }, { "start": 549.1999999999999, "end": 554.4399999999999, "text": " ranges of information in a single layer, but you regain it through depth, right?" }, { "start": 554.4399999999999, "end": 561, "text": " The deeper you go the more a single unit gets information, right, this unit gets" }, { "start": 561, "end": 566.0799999999999, "text": " information from this unit over here through the layers, through the layers." }, { "start": 566.08, "end": 571.88, "text": " It can't watch the unit right here in this layer. That's not possible, but it" }, { "start": 571.88, "end": 575.72, "text": " gets the information through the layers. Of course there's still a trade-off, like" }, { "start": 575.72, "end": 579.84, "text": " a fully connected layer could just do this in one step and then in the next" }, { "start": 579.84, "end": 584.88, "text": " layer it could do it again, right, it can do much more complex computation. But if" }, { "start": 584.88, "end": 588.72, "text": " you believe that the most important information is actually in the" }, { "start": 588.72, "end": 593.76, "text": " neighborhoods of the individual tokens, which is conceivable in something like a" }, { "start": 593.76, "end": 599.8, "text": " convolutional neural network, you know that, you know, in an image usually you" }, { "start": 599.8, "end": 606.48, "text": " have localized information, right, if there's a cat here then the nose and the" }, { "start": 606.48, "end": 610.48, "text": " eyes of the cat are pretty close together. So in order to recognize it's a" }, { "start": 610.48, "end": 617, "text": " cat you mostly want local information, more and more local information. So in" }, { "start": 617, "end": 621.68, "text": " an image that makes sense and in a text it also makes sense to a degree in that" }, { "start": 621.68, "end": 627.8399999999999, "text": " usually words close together in a sentence, they are important for" }, { "start": 627.8399999999999, "end": 634.12, "text": " each other, right, but the power of the transformer was initially that it could" }, { "start": 634.12, "end": 641.28, "text": " attend to everything in a sentence, right. So for example if you have again the" }, { "start": 641.28, "end": 645.0799999999999, "text": " paragraph here, the power of the transformer, at least that was said, is" }, { "start": 645.08, "end": 653, "text": " the fact that this piece of text here could make a connection to this" }, { "start": 653, "end": 657.36, "text": " piece of text here and therefore the understanding of the entire paragraph" }, { "start": 657.36, "end": 662.8000000000001, "text": " could be reliant on this connection being made, which a local model can't do." }, { "start": 662.8000000000001, "end": 668, "text": " But if you go through depth that you might be able to recover that. So the" }, { "start": 668, "end": 673.32, "text": " longformer is basically what the convolutional neural network does for" }, { "start": 673.32, "end": 682.24, "text": " MLPs, it does it for transformers, right. So instead of n by n giving you n squared" }, { "start": 682.24, "end": 689.5200000000001, "text": " now you go into this way where you have, so if you do the same for the" }, { "start": 689.5200000000001, "end": 697.1600000000001, "text": " transformer you go to o n times, let's call it w, and w being your window size" }, { "start": 697.16, "end": 706.16, "text": " in this case. They have an illustration of this right here. So in a original" }, { "start": 706.16, "end": 712.04, "text": " transformer this is an attention matrix. So here you have your n units in a" }, { "start": 712.04, "end": 718.4, "text": " sequence and drawn in is which unit can attend to which other unit in a given" }, { "start": 718.4, "end": 725.8399999999999, "text": " layer. So you'll see this particular unit i here can attend of course to itself," }, { "start": 725.84, "end": 732.5600000000001, "text": " right, can attend to unit i. But it can also attend to this unit or to this unit" }, { "start": 732.5600000000001, "end": 739.88, "text": " or to this unit to any unit, right. And that's what gives you this n squared" }, { "start": 739.88, "end": 745.88, "text": " attention because any unit can attend to any unit. Now in this sliding window" }, { "start": 745.88, "end": 751, "text": " attention pattern, and this is one of the core components of the longformer, you" }, { "start": 751, "end": 761.64, "text": " see that the i-th unit here right here can attend to itself, right, but also to" }, { "start": 761.64, "end": 774.28, "text": " this and to this, this, but no more. It can only attend to the i-th unit or to i" }, { "start": 774.28, "end": 784.64, "text": " minus w to i plus w, right. And this here is a window of size w. This is this" }, { "start": 784.64, "end": 791.4, "text": " sliding window. So a given unit can only attend to itself or its neighbors in one" }, { "start": 791.4, "end": 796.28, "text": " layer, right. And this is exactly what a convolution is. Like if you see if you" }, { "start": 796.28, "end": 804.36, "text": " see this pattern, this is a this is a convolutional pattern. Now the second" }, { "start": 804.36, "end": 810.28, "text": " core component is they expand on this idea in that they make they create these" }, { "start": 810.28, "end": 816.0799999999999, "text": " dilated sliding windows. Now you see you already know what a sliding window is." }, { "start": 816.0799999999999, "end": 822.0799999999999, "text": " Now they're saying well if you if you have this sliding window it might take" }, { "start": 822.08, "end": 828.2800000000001, "text": " quite a number of layers in order to you know get your attention of the entire" }, { "start": 828.2800000000001, "end": 834.2800000000001, "text": " sequence incorporated. We saw before it took like three layers to get halfway" }, { "start": 834.2800000000001, "end": 841.84, "text": " through this sequence of what was it like six tokens and it took us like" }, { "start": 841.84, "end": 849.6400000000001, "text": " three layers and with so basically if you go if you go one layer up right one" }, { "start": 849.64, "end": 857.3199999999999, "text": " layer up you gain one more context window in each direction, right. So it's" }, { "start": 857.3199999999999, "end": 862.3199999999999, "text": " not you'd have to go very very deep in order to incorporate the information" }, { "start": 862.3199999999999, "end": 870.64, "text": " from these very long sequences and the sliding the dilated sliding window helps" }, { "start": 870.64, "end": 881.28, "text": " this where they say well technically now any any any sequence here so again if we" }, { "start": 881.28, "end": 889.56, "text": " have this sequence and this is the next layer actually let's just draw so this" }, { "start": 889.56, "end": 896.12, "text": " unit right here it will be able to attend this and this but not this and" }, { "start": 896.12, "end": 900.92, "text": " not this but it will also be able to attend this and this but not this and" }, { "start": 900.92, "end": 905.88, "text": " not this sorry not this so it'll skip one so right these these attention" }, { "start": 905.88, "end": 912.62, "text": " patterns they will always kind of skip skip one and the idea is that now you" }, { "start": 912.62, "end": 918.28, "text": " have a vastly greater window of attention right your your window size is" }, { "start": 918.28, "end": 923.4, "text": " now way bigger that means you can incorporate information way faster" }, { "start": 923.4, "end": 929.4, "text": " across the layers like global information but of course now they're" }, { "start": 929.4, "end": 934, "text": " kind of arguing against each other in when they do this sliding window they" }, { "start": 934, "end": 941.24, "text": " say well we pose that mostly local information is important for NLP right" }, { "start": 941.24, "end": 945.84, "text": " the words right around the word are important and now if they say this here" }, { "start": 945.84, "end": 950.56, "text": " they basically say oh well it's not so important that we miss this word right" }, { "start": 950.56, "end": 957.04, "text": " here which is right next to the word that they are attending from which is" }, { "start": 957.04, "end": 961.16, "text": " counter counter to what they just said that probably the most important" }, { "start": 961.16, "end": 968, "text": " information is around the word they they do get around this by saying well if we" }, { "start": 968, "end": 973, "text": " have different layers in a transformer and in the lower layers will use this" }, { "start": 973, "end": 979.76, "text": " sliding window fully local and in the higher layers will use this dilated" }, { "start": 979.76, "end": 986.4, "text": " window and therefore in the in the lower layers we postulate that local" }, { "start": 986.4, "end": 991.88, "text": " information is actually what's needed to understand local features and then in" }, { "start": 991.88, "end": 997.92, "text": " the higher layers we want more global information because it will incorporate" }, { "start": 997.92, "end": 1003.88, "text": " features from the from the local informations of the lower layers all" }, { "start": 1003.88, "end": 1008.92, "text": " right I can I can get the argumentation but I feel that's just something they've" }, { "start": 1008.92, "end": 1017.0799999999999, "text": " thrown in there to make it work better after they tried it out and the the last" }, { "start": 1017.0799999999999, "end": 1023.24, "text": " idea here in the long former is what they call global attention and these" }, { "start": 1023.24, "end": 1029, "text": " global attention is sparse what it means is that there are some special units" }, { "start": 1029, "end": 1037.1599999999999, "text": " here so in this this this and this unit and these special units as you can see" }, { "start": 1037.16, "end": 1041.92, "text": " from the attention pattern these are these can actually attend to everything" }, { "start": 1041.92, "end": 1047, "text": " so this unit can attend for example to this one or to this one or to anything" }, { "start": 1047, "end": 1052.3200000000002, "text": " these can attend to anything and any unit can attend to those right any unit" }, { "start": 1052.3200000000002, "end": 1059.3200000000002, "text": " can attend to the the first unit right here right so these are your special" }, { "start": 1059.3200000000002, "end": 1066.68, "text": " tokens your special units and they have global attention and the reason for" }, { "start": 1066.68, "end": 1072.88, "text": " this particularly is that sometimes this is needed and this is an engineering" }, { "start": 1072.88, "end": 1077.48, "text": " choice right the example I can give is let's say you have a question answering" }, { "start": 1077.48, "end": 1081.3600000000001, "text": " task in a question answering task what you usually have is a question and a" }, { "start": 1081.3600000000001, "end": 1087.5600000000002, "text": " paragraph and let's say the task here is to answer yes or no is the is the" }, { "start": 1087.5600000000002, "end": 1092.68, "text": " question so the question might be a statement right I don't know King James" }, { "start": 1092.68, "end": 1099.44, "text": " was King of England from 1120 to 1140 and then the paragraph will be the" }, { "start": 1099.44, "end": 1107.1200000000001, "text": " Wikipedia entry for King James and the the question is yes or no is the is the" }, { "start": 1107.1200000000001, "end": 1111.72, "text": " question true or not is the statement made true or not how you would feed this" }, { "start": 1111.72, "end": 1118.8400000000001, "text": " to a birdmold to a transformer is you concatenate these two things quest" }, { "start": 1118.84, "end": 1124.9199999999998, "text": " statement in paragraph right these are the tokens right here and then you would" }, { "start": 1124.9199999999998, "end": 1129.6399999999999, "text": " separate them using a special token called the separator token this is just" }, { "start": 1129.6399999999999, "end": 1133.72, "text": " to inform the model that here is where the first thing stops and the next" }, { "start": 1133.72, "end": 1139.24, "text": " thing starts and then at the beginning you would put a special token called the" }, { "start": 1139.24, "end": 1145.9599999999998, "text": " CLS token now usually what you do is you send these things through your" }, { "start": 1145.96, "end": 1152.68, "text": " transformer and now in the last layer right you end up as we've seen before" }, { "start": 1152.68, "end": 1156.24, "text": " because you always transform a sequence into a sequence you end up with a" }, { "start": 1156.24, "end": 1161.24, "text": " sequence again but you just want a single thing you just want yes or no so" }, { "start": 1161.24, "end": 1168.8400000000001, "text": " you designate you say this particular unit here that corresponds to the CLS" }, { "start": 1168.8400000000001, "end": 1174.48, "text": " token that's what I'm going to throw into a logistic regression and that's" }, { "start": 1174.48, "end": 1178.96, "text": " what will give me my yes or no answer and that's how you train it right so you" }, { "start": 1178.96, "end": 1185.68, "text": " you don't want to single out any of these any of these as like special so" }, { "start": 1185.68, "end": 1191.08, "text": " you simply already include a special token at the beginning that then you" }, { "start": 1191.08, "end": 1197.56, "text": " take the classification from right it's pretty smart but also you say ah this is" }, { "start": 1197.56, "end": 1204.24, "text": " such a special token I want that to be able to attend to anything right even" }, { "start": 1204.24, "end": 1209.4, "text": " though for example this unit right here it can only attend to its neighbors" }, { "start": 1209.4, "end": 1214.06, "text": " right it has this cone thing and this unit right here has this cone thing this" }, { "start": 1214.06, "end": 1220.4, "text": " unit right here can always attend to anything at each of the layers right it" }, { "start": 1220.4, "end": 1225.72, "text": " can attend to anything and anything can attend to it so it can get information" }, { "start": 1225.72, "end": 1231.78, "text": " from anywhere routed to it in each of the layers and it can send information" }, { "start": 1231.78, "end": 1233.78, "text": " to any of the other units." }, { "start": 1234.58, "end": 1236.66, "text": " This is an engineering choice." }, { "start": 1236.74, "end": 1243.18, "text": " So at the beginning, you as an engineer have to say which one of these tokens are special tokens." }, { "start": 1243.18, "end": 1247.62, "text": " For these tokens, you'll actually then do full attention." }, { "start": 1247.62, "end": 1250.42, "text": " It can attend to and from anything." }, { "start": 1251.18, "end": 1253.7, "text": " What are our new memory requirements?" }, { "start": 1253.98, "end": 1255.98, "text": " What this will give us is," }, { "start": 1256.1399999999999, "end": 1259.46, "text": " first of all, we have N tokens." }, { "start": 1259.46, "end": 1263.14, "text": " And here W is our window size." }, { "start": 1263.14, "end": 1266.94, "text": " So we have N times W memory." }, { "start": 1266.94, "end": 1269.98, "text": " But then we also add the global attention." }, { "start": 1269.98, "end": 1275.74, "text": " So plus the number of special tokens times," }, { "start": 1275.74, "end": 1278.46, "text": " if there's a special token," }, { "start": 1278.46, "end": 1284.66, "text": " it will have N times 2 memory requirement," }, { "start": 1284.66, "end": 1288.06, "text": " because it can attend from and to in each layer." }, { "start": 1288.06, "end": 1293.1399999999999, "text": " And this entire thing, sorry, with the plus," }, { "start": 1293.1399999999999, "end": 1296.82, "text": " this entire thing times the number of layers." }, { "start": 1296.82, "end": 1300.86, "text": " So this is your new attention memory requirements." }, { "start": 1300.86, "end": 1303.98, "text": " And as you can see here, N plus N." }, { "start": 1303.98, "end": 1306.98, "text": " So this is going to be order of N," }, { "start": 1306.98, "end": 1311.1, "text": " instead of much smaller than order of N squared," }, { "start": 1311.1, "end": 1313.8999999999999, "text": " as we had for the original transformer." }, { "start": 1313.9, "end": 1315.9, "text": " Right." }, { "start": 1315.9, "end": 1320.5, "text": " So this is what the longformer basically does." }, { "start": 1320.5, "end": 1323.5, "text": " Now they have written custom CUDA kernels" }, { "start": 1323.5, "end": 1329.5, "text": " for doing this dilated attention and so on," }, { "start": 1329.5, "end": 1330.5, "text": " which is pretty cool." }, { "start": 1330.5, "end": 1333.5, "text": " And they have code available for the model." }, { "start": 1333.5, "end": 1338.5, "text": " They test this on a number of language tasks." }, { "start": 1338.5, "end": 1342.5, "text": " And what I find interesting is," }, { "start": 1342.5, "end": 1346.5, "text": " actually, they start from the Roberta checkpoint," }, { "start": 1346.5, "end": 1350.5, "text": " which Roberta, where is it said?" }, { "start": 1350.5, "end": 1354.3, "text": " Somewhere, oh yeah, this Roberta model right here" }, { "start": 1354.3, "end": 1356.1, "text": " is a variant of BERT." }, { "start": 1356.1, "end": 1358.5, "text": " Right, you can see the name in here." }, { "start": 1358.5, "end": 1360.1, "text": " It's a variant of BERT." }, { "start": 1360.1, "end": 1361.5, "text": " And that's their baseline." }, { "start": 1361.5, "end": 1363.3, "text": " And they start from these checkpoints," }, { "start": 1363.3, "end": 1364.7, "text": " as far as I understand," }, { "start": 1364.7, "end": 1368.1, "text": " and they kind of copy over the position embeddings and so on." }, { "start": 1368.1, "end": 1372.8999999999999, "text": " And therefore, they only need to train not very much" }, { "start": 1372.8999999999999, "end": 1374.3, "text": " past the Roberta." }, { "start": 1374.3, "end": 1377.6999999999998, "text": " Now the reason why they can copy it over actually is," }, { "start": 1377.6999999999998, "end": 1380.1, "text": " and this I find very interesting," }, { "start": 1380.1, "end": 1383.8999999999999, "text": " is they use a window size of 512." }, { "start": 1383.8999999999999, "end": 1385.6999999999998, "text": " So until I read this," }, { "start": 1385.6999999999998, "end": 1389.6999999999998, "text": " I got away from reading the paper" }, { "start": 1389.6999999999998, "end": 1394.8999999999999, "text": " thinking that this window size here might be fairly small." }, { "start": 1394.8999999999999, "end": 1395.5, "text": " Right." }, { "start": 1395.5, "end": 1398.9, "text": " So this window size, it might be, you know," }, { "start": 1398.9, "end": 1402.9, "text": " maybe 10, 20, 30 tokens or something, right?" }, { "start": 1402.9, "end": 1411.5, "text": " But actually, this window size is 512 in their formulation," }, { "start": 1411.5, "end": 1416.1, "text": " which basically means that this is as much" }, { "start": 1416.1, "end": 1419.9, "text": " as one of the classic models could take as a document." }, { "start": 1419.9, "end": 1420.5, "text": " Right." }, { "start": 1420.5, "end": 1423.1, "text": " So, sorry, let's go over." }, { "start": 1423.1, "end": 1426.5, "text": " So this here is 512." }, { "start": 1426.5, "end": 1436.6999999999998, "text": " So this is what a classic model could take as an entire document." }, { "start": 1436.6999999999998, "end": 1437.6999999999998, "text": " And in the classic model," }, { "start": 1437.6999999999998, "end": 1441.1, "text": " you simply split up the document, feed chunks, right?" }, { "start": 1441.1, "end": 1442.6999999999998, "text": " And then aggregate over them." }, { "start": 1442.6999999999998, "end": 1446.6999999999998, "text": " Now the longformer basically has this." }, { "start": 1446.6999999999998, "end": 1451.3, "text": " So right now, for now, I said it has less memory requirements." }, { "start": 1451.3, "end": 1455.5, "text": " Actually, it has the same memory requirements as a classic model," }, { "start": 1455.5, "end": 1456.8999999999999, "text": " but it is also able," }, { "start": 1456.8999999999999, "end": 1458.5, "text": " because of these global attention," }, { "start": 1458.5, "end": 1462.8999999999999, "text": " to kind of incorporate information from the surrounding things." }, { "start": 1462.8999999999999, "end": 1466.1, "text": " So that's the new part." }, { "start": 1466.1, "end": 1468.3, "text": " Because if you think about it," }, { "start": 1468.3, "end": 1474.8999999999999, "text": " if this W here is 512, 512 was the original N." }, { "start": 1474.8999999999999, "end": 1480.5, "text": " So 512 was the N0." }, { "start": 1480.5, "end": 1483.7, "text": " Whatever the old models had as an N." }, { "start": 1483.7, "end": 1489.7, "text": " So right now, if I replace this," }, { "start": 1489.7, "end": 1492.5, "text": " and let's not take care of this." }, { "start": 1492.5, "end": 1496.1, "text": " If I replace this, it's actually N times N0." }, { "start": 1496.1, "end": 1501.7, "text": " And that regresses to the classic model if you plug in N0 here, right?" }, { "start": 1501.7, "end": 1508.3, "text": " So the new part really is the fact that you have this sliding window," }, { "start": 1508.3, "end": 1515.3, "text": " and the global attention is able to incorporate information from these special tokens as well." }, { "start": 1515.3, "end": 1520.7, "text": " Because sliding window, that was done before." }, { "start": 1520.7, "end": 1524.7, "text": " So I just don't want to get to you the wrong impression" }, { "start": 1524.7, "end": 1528.1, "text": " that now we can run transformers on like very small memory machines." }, { "start": 1528.1, "end": 1529.7, "text": " We can't." }, { "start": 1529.7, "end": 1533.5, "text": " But we can run them on the same memory machines," }, { "start": 1533.5, "end": 1535.8999999999999, "text": " because this is the same length, right?" }, { "start": 1535.9, "end": 1539.1000000000001, "text": " But also feed in longer documents," }, { "start": 1539.1000000000001, "end": 1547.3000000000002, "text": " and have some information of the entire document be propagated to these blocks," }, { "start": 1547.3000000000002, "end": 1548.7, "text": " which before we couldn't." }, { "start": 1548.7, "end": 1554.3000000000002, "text": " Before we could just simply feed these blocks as one and not have global information." }, { "start": 1554.3000000000002, "end": 1555.9, "text": " So that's the new thing." }, { "start": 1555.9, "end": 1559.3000000000002, "text": " At least they haven't tested it on the smaller things," }, { "start": 1559.3000000000002, "end": 1561.3000000000002, "text": " which is cool from an engineering point, right?" }, { "start": 1561.3000000000002, "end": 1562.9, "text": " You would want to," }, { "start": 1562.9, "end": 1564.7, "text": " because if you want to show that you're better," }, { "start": 1564.7, "end": 1571.1000000000001, "text": " you would want to basically be able to be as powerful as the old model," }, { "start": 1571.1000000000001, "end": 1573.5, "text": " but then be more powerful." }, { "start": 1573.5, "end": 1575.5, "text": " And that's what they do." }, { "start": 1575.5, "end": 1575.9, "text": " All right." }, { "start": 1575.9, "end": 1579.1000000000001, "text": " So if you want to check out the experiments and the ablations," }, { "start": 1579.1000000000001, "end": 1583.9, "text": " it's very interesting because they turn on and off a lot of things in their model," }, { "start": 1583.9, "end": 1586.1000000000001, "text": " and kind of check out where things come from," }, { "start": 1586.1000000000001, "end": 1587.9, "text": " what helps, what doesn't." }, { "start": 1587.9, "end": 1590.5, "text": " And I'll leave this to you, and I'll link it." }, { "start": 1590.5, "end": 1595.1, "text": " And with that, thanks for listening, watching, and bye-bye." } ]
a0f07M2uj_A
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Backpropagation and the brain
[ "Science & Technology" ]
[ "deep learning", "machine learning", "biologically plausible", "neural networks", "spiking", "neurons", "neuroscience", "hinton", "google", "deepmind", "brain", "cells", "soma", "axon", "interneurons", "action potential", "backprop" ]
Geoffrey Hinton and his co-authors describe a biologically plausible variant of backpropagation and report evidence that such an algorithm might be responsible for learning in the brain. https://www.nature.com/articles/s41583-020-0277-3 Abstract: During learning, the brain modifies synapses to improve behaviour. In the cortex, synapses are embedded within multilayered networks, making it difficult to determine the effect of an individual synaptic modification on the behaviour of the system. The backpropagation algorithm solves this problem in deep artificial neural networks, but historically it has been viewed as biologically problematic. Nonetheless, recent developments in neuroscience and the successes of artificial neural networks have reinvigorated interest in whether backpropagation offers insights for understanding learning in the cortex. The backpropagation algorithm learns quickly by computing synaptic updates using feedback connections to deliver error signals. Although feedback connections are ubiquitous in the cortex, it is difficult to see how they could deliver the error signals required by strict formulations of backpropagation. Here we build on past and recent developments to argue that feedback connections may instead induce neural activities whose differences can be used to locally approximate these signals and hence drive effective learning in deep networks in the brain. Authors: Timothy P. Lillicrap, Adam Santoro, Luke Marris, Colin J. Akerman & Geoffrey Hinton 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 Backpropagation and the Brain by Timothy Lilikrup, Adam Santoro, Luke Morris, Colin Ackerman and Jeffrey Hinton. So this is a bit of an unusual paper for the machine learning community but nevertheless it's interesting and let's be honest at least half of our interest comes from the fact that Jeffrey Hinton is one of the authors of this paper. So this is a paper that basically proposes a hypothesis on how the algorithm of backpropagation works in the brain because previously there has been a lot of evidence against there being something like backpropagation in the brain. So the question is how do neural networks in the brain learn? And they say there can be many different ways that neural networks learn and they list them up in in this kind of diagram where you have a network and it maps from input to output by having these weighted connections between neurons. So the input is two-dimensional and then it maps using this weights to a three-dimensional hidden layer. Usually there is a nonlinear function somewhere at the output here of these so they do a weighted sum of the inputs and then they do a nonlinear function and then they propagate that signal to the next layer and to then to finally to the output. Alright so how do these networks learn? The one way of learning is called Hebbian learning. The interesting thing here is that it requires no feedback from the outside world. Basically what you want to do in Hebbian learning is you want to update the connections such that they kind of match their own previous outputs or even increase their own previous outputs. So you propagate a signal and then maybe this neuron spikes really hard and this neuron spikes really low then if you propagate the signal again right then you want to match that those those activations or if you if you propagate similar signals no feedback required so basically it's a self-amplifying or self dampening process. Ultimately though you want to learn something about the world and that means you have to have some some feedback from outside right so with feedback what we mean is usually that the output here let's put this away the output here is goes into the world let's say this is a motor neuron right you do something with your arm like you hammer on a nail and then you either hit the nail or you don't let's say you don't hit the nail so after it looks like crooked there you have feedback right so feedback usually in the form of some sort of error signal right so feedback it can be like this was good or this was bad or it can be this was a bit too much to the left or so on the important part is you get kind of one number of feedback right and how bad you were and now your goal is to adjust all of the individual neurons or weights between neurons such that the error will be lower so in Hebbian learning there is no feedback it's just simply a self reinforcing pattern activation machine in the first in these kind of first instances of perturbation learning what you'll have is you'll have one single feedback and that you can see this is a diffuse cloud here what you're basically saying is that every single neuron is kind of punished let's say the the feedback here was negative one that means every single neuron is is punished for that so how you can imagine something if you have your input X and you map it through through your function F and the function F has a weight W1 and so on right so you map X through it right and then you get a feedback of negative one and then you map X with a little bit of noise plus M right da da da da and you get a feedback of negative two right then you that means that the direction of this noise was probably a bad direction so ultimately you want to update X into the direction of negative that noise by modulated of course by by some some factor here that's that it kind of tells you how bad it was so this could be the negative two minus negative one yeah that makes big sense no yes that would be no it would be negative one minus negative never mind so basically with a scalar feedback you simply tell each neuron what it did right or sorry if if the entire network right the entire network did right or wrong so the entire network will lead to this feedback you don't have accountability of the individual neurons all you can say is that whatever I'm doing here is wrong and whatever I'm doing here is right so I'm going to do more of the right things now in back propagation it is very different right in back propagation what you'll do is you'll have your feedback here let's say that's negative one and then you do a reverse computation so the forward computation in this case was these weighted sum of this layer now you do a little layer wise reverse computation which means that you know how this function here this output came to be out of the out of the inputs and that means you can inverse and you can do an inverse propagation of the error signal which is of course the gradient so this would be your your you would derive your error by the inputs to the layer right so this basically tells in the back propagation algorithm you can exactly determine if you are this node how do I have to adjust my input weights how do I have to adjust them in order to make this number here go down right and then because you always propagate the error according to that what you'll have in each in each layer is basically a vector target so it's no longer just one number but each layer now has a target of vectors and it says okay these are the outputs that would be beneficial please this layer please change your outputs in the direction of negative 2 negative 3 plus 4 so you see this is so the negative 2 would be this unit the negative 3 would be this unit and the plus 4 would be this unit so each unit is instructed individually to say please this is the direction that each unit should change in in order to make this number go lower you see how this is much more information than the perturbation learning in the perturbation learning all the units simply know well before was bad and now is better so let's you know change a bit and here you have detailed instructions for each unit because of the back propagation algorithm so ultimately people have kind of thought that since back propagation wasn't really possible with biological neurons that the brain might be doing something like perturbation learning but this paper argues that something like back propagation is not only possible but likely in the brain and they propose this kind of back prop like learning with the feedback network so they basically concern all the they differentiate hard between these two regimes here in this hand you have the scalar feedback which means that the entire network gets one number as a feedback and each neuron just gets that number and here you have vector feedback where each neuron gets an individual instruction of how to update and they achieve this not by back propagation because still the original formulation of back prop as we use it in neural networks is not biologically plausible but they achieve this with this back prop like learning with the feedback network and we'll see how this does but in in essence this feedback network is constructed such that it can give each neuron in the forward pass here detailed instructions on how to update itself alright so yeah they have a little bit of a diagram here of if you do heavy in if this if this is an error landscape if you do heavy in learning you're basically you don't care about the error you're just reinforcing yourself if you do perturbation learning then you it's very slow because you don't have a detailed signal you just you just relying on this one number it's kind of if you were to update every single neuron in your neural network with reinforcement learning considering the output the of the neural networks or the error considering that the reward not using back prop and then with back prop you have a much smoother much faster optimization trajectory so they look at this and they they come to some some conclusions first of all so here's here's back prop basically so in back prop as we said you have the forward pass and there you simply compute these weighted averages and you you also pass them usually through some sort of non linear activation right and the cool thing about this is in artificial neural networks is that once the error comes in you can exactly reverse that so you can do a backward pass of errors where you can propagate these errors through because you know it's kind of invertible the function doesn't have to be invertible but that the gradients will flow backwards if you know how the forward pass was computed so first of all they go into a discussion of back prop in the brain how can we even expect that and one cool piece of evidence is where I find is that they cite several examples where they use artificial neural networks to learn the same task as humans right and or as as animal brains and then I have no clue how how they measure any of this but then they compare the hidden representations of the living neural networks and the artificial neural networks and it turns out that the these the networks that were trained with back prop can clear up much more of the variance of these hidden activations than networks that were not trained with back prop so basically that means if you train a network with back prop it matches the biological networks much closer in how they form their hidden representations and they they do number they cite a number of experiments here that show this so this gives you very good evidence that if the hidden representations they look as if they had been computed by back prop and not by any of these scalar updating algorithms so it is conceivable that we find back prop in the brain that's why they go here next they go into problems with back prop so basically why why would we why so far have we believed that back prop isn't happening in the brain so now let's I want to highlight two factors here that I find think are suffice they have more but first of all back prop demands synaptic symmetry in the forward and backward paths right so basically if you have a neuron and it has output to another neuron what you need to be able to do is to pass back information along that neuron so it kind of has to be a symmetric connection idea of the forward and the backward paths and these need to be exact right and this is just not if you know how neurons are structured they have kind of input dendrites and then there's this accent action potential and along the axon the signal travels and the back traveling of the signal just I think is very is very very very slow if even possible and so it's generally not invertible or inverse compute capable so this is one reason why back prop seems unlikely and then the second reason here is error signals are signed and potentially extreme valued and I want to add to that they also talk about this somewhere that error signals are of a different type right that's a different type so first let's see what signed error signals are signed yes we need to be able to adjust neurons in a specific directions right if you look at again what we've drawn before here we said here this is how these neurons must update so the first neuron must decrease by two this must decrease by three and this must increase by four now in back prop we need this but in if if we assume that there is something like a reverse computation or signaling here happening then we still have the problem that usually these output signals are in the form of spiking rates which means that over time right so if a neuron wants to if a neuron has zero activation there's just no signal but if a neuron has a high activation it spikes a lot if has a low activation it kind of spikes sometimes what what it can't do is negative spike right like zero is as low as it goes so the the thought that there are signed information in in the backward pass is conceivable even if you have something like a second so you can imagine here instead of this backward connection because of the symmetry problem that we have some kind of second neural network that goes in this direction still you'd have the problem that here you can only have positive signal or zero and they might be extreme valued which okay it can't be really encoded with these spiking because they are they're limited in the range they can assume but they are also of a different type and I'm what I mean by that is basically if you think of this as a programming problem then the forward passes here are activations right and the backward passes here they are deltas so in the backward passes you either propagate deltas or you propagate kind of directions so the activations are sort of impulses whereas the backward signals are this is how you need to change their gradients ultimately so it's fundamentally a different type of data that is propagated along would be propagated along these directions and that makes it very unlikely because we are not aware as this paper says that the neural networks get neurons can kind of switch the data type that they're they're transmitting alright so then the paper goes into their n-grad hypothesis and what this is the hypothesis basically states that the brain could implement something like neural networks by using by using an approximate backprop like algorithm based on autoencoders and I want to jump straight into the algorithm no actually first they do talk about autoencoders which which I find very interesting so if you think of auto encoders what is an autoencoder an autoencoder is a network that basically starts out with an input layer and then has a bunch of hidden layers and at the end it tries to reconstruct its own input right so you feed a data in here you get data out here and then your error the error signal it will be your difference to your original input now that the usually when we train auto encoders in deep learning we also train this by backprop right we feed and this error here and this goes back but if you just think of single layer auto encoders so let's let's go over here single layer autoencoder with let's say the the same number of the same number of of units in the in this layer what you'll have is so this this is input this is output and this is the hidden layer right you'll have a weight matrix here and you'll probably have some sort of nonlinear function and then you have another weight matrix here and they call them W and B another way to draw this is I have weight matrix going up then I have a nonlinear function going transforming this into this signal and then I have the B going back right so I'm drawing I'm drawing it in two different ways up here or over here and with the second way you can see that it is kind of a forward backward algorithm where now the error if you look at what is the error here the error is the difference between this and this and the difference between this and this and the difference between this and this right and you can train an autoencoder simply by saying W please make sure that the that the the the input here gets mapped closer to the output and the B the same thing this will become clear in a second so but basically sorry this I mean the the hidden representations you'll see basically the idea is that you can train an autoencoder only by using local update rules you don't have to do backprop and that's what this algorithm is proposing namely if you think of a stack of autoencoders this this this transforming one hidden representation into the next right this is the feed forward function right what you can do is you first of all you can assume that for each of these functions here you have a perfect inverse right you can you can perfectly compute the inverse function that's this this G here of course this doesn't exist but assume you have it what you then could do is you could if if you knew in one layer and on the top layer of course you know if you knew that okay I got this from my forward pass but I would like to have this this is my desired output right so in the output layer you get this this is your error signal if you knew you you you could compute an error right here this is what you do in the output right now in backprop we would back propagate this error along the layers but now we don't do this instead of what we do is we use this G function to invert the F function right and by that what we'll say is what hidden representation in layer 2 what should the hidden representation have been in order for us to obtain this thing right so the the claim here is if in layer 2 we had had h2 as a hidden representation then we would have landed exactly where we want it right that's what this G function does right because here we use F so had we had F H2 and used F on it we would be exactly where we want instead we had H2 here and used F on it and then we landed here where we don't want so this is where we want we would want to be in layer 2 and this is where we were so again we can compute an error here again instead of back propagating that error what we'll do is we'll use the inverse of the forward function in order to back propagate our desired hidden representation and you can see there is of course a relationship to the true back prop here but the the important distinction is we are not trying to back propagate the error signal we're trying to invert the desired hidden states of the network and then in each layer we can compute from the forward pass we can compute the difference to the desired hidden state and thereby compute an error signal and now we have achieved what we wanted we want an algorithm that doesn't do backprop that only uses local information in order to compute the error signal that it needs to adjust and by local I mean information in the same layer and also the data type that is propagated by F is activations right of hidden representations and by G is also activations of hidden representations both of them are always positive can be encoded by spiking neurons and so on so this algorithm achieves what we want they go a bit into detail how the actual error update here can be achieved and apparently neurons can achieve you know in the same layer to to adjust themselves to a given desired activation so this algorithm achieves it of course we don't have this G we don't have it and therefore we need to go a bit more complicated what they introduce is the this following algorithm the goals are the same but now we assume we do not have a perfect inverse but we have something that is a bit like an inverse so we have an approximate inverse and they basically suggest if we have an approximate inverse we can do the following so G is now an approximate inverse to F what we can do is this is our input signal right we use F to map it forward to this and so on all the way up until we get our true our error right here this is our error from the environment right this is the nail being wrong and then we do two applications of G right so this is an application of F we do two applications of G one we apply G to this to what we got in the forward pass right and this now gives us a measure of how bad our inverse is right so if G is now an approximate inverse and this now we see here oh okay we we had H2 in the forward pass and we basically forward passed and then went through our inverse and we didn't land quite exactly where we started but we know that okay this this is basically the difference between our our inverse our forward inverse H and our true H and then we also back project using G again the desired outcome so we invert the desired outcome here now before we have adjusted directly these two right because we said this is what we got this is what we want but now we include for the fact that G isn't a perfect inverse and our assumption is that G here probably makes about the same mistakes as G here so what we'll do is we'll take this vector right here and apply it here in order to achieve this thing and this thing is now the corrected thing our corrected desired hidden representation corrected for the fact that we don't have a perfect inverse and now again we have our error here that we can locally adjust again all the signals propagated here here and here are just neural activations and all the information required to update a layer of neurons is now contained within that layer of neurons right and and this goes back through the network so this is how they achieve how they achieve this this is a bit of a of a close-up look and here are the computations to do this so basically for the forward updates you want to adjust W into the direction of the H minus the H tilde and the H tilde in this case would be this the the hidden representation that you would like to have so you would update your forward forward weights into the direction such that your hidden representations are closer sorry that your forward hidden representation is closer to your backward hidden representation and the backward updates now your goal is to get a more better to make G so sorry W here these are W are the weight of F and B are the weights of G so in the backward updates your goal is to make G a better inverse right so what you'll do is again you'll take the difference between now you see the difference here here here right not the same error so here you use you in the W update use what we labeled error here in the G update you use this error here so this is the error of G so when you update the function G you want to make these two closer together such that G becomes a better inverse right because you're dealing with an approximate inverse you still need to obtain that approximate inverse and and this here is how you learn it this algorithm now achieves what we wanted right local updates data types check assigned check and so on I hope this was enough clear in essence is pretty simple but it's pretty cool how they work around this they call this a difference target propagation and I'm not these these kind of papers I don't think they invented this maybe I'm not sure maybe they did and maybe they didn't and this paper just kind of frames it in this hypothesis it is unclear to me I I'm not familiar with this kind of papers so sorry if I misattribute something here all right then they go into into how could these things be implemented biologically and they go for some evidence and they also state that we used to look at neurons basically in this way where you had input and feedback here very simple simplistic view of neurons whereas nowadays even the the company to computational community use neurons in a more differentiated way where you have for example different regions here on the soma that can be separated from each other and you have interneuron interference and so on I'm not qualified too much to comment on this stuff but I invite you to read it for yourself if you want alright so this was my take on this paper I find the algorithm they proposed pretty cool if you I hope you liked it and check it out bye bye
[ { "start": 0, "end": 5.22, "text": " Hi there! Today we're looking at Backpropagation and the Brain by Timothy" }, { "start": 5.22, "end": 13.200000000000001, "text": " Lilikrup, Adam Santoro, Luke Morris, Colin Ackerman and Jeffrey Hinton. So this is a" }, { "start": 13.200000000000001, "end": 18.12, "text": " bit of an unusual paper for the machine learning community but nevertheless it's" }, { "start": 18.12, "end": 22.96, "text": " interesting and let's be honest at least half of our interest comes from the fact" }, { "start": 22.96, "end": 30.520000000000003, "text": " that Jeffrey Hinton is one of the authors of this paper. So this is a paper" }, { "start": 30.520000000000003, "end": 38.160000000000004, "text": " that basically proposes a hypothesis on how the algorithm of backpropagation" }, { "start": 38.160000000000004, "end": 44.96, "text": " works in the brain because previously there has been a lot of evidence against" }, { "start": 44.96, "end": 50.52, "text": " there being something like backpropagation in the brain. So the" }, { "start": 50.52, "end": 57.96, "text": " question is how do neural networks in the brain learn? And they say there" }, { "start": 57.96, "end": 65.28, "text": " can be many different ways that neural networks learn and they list them up in" }, { "start": 65.28, "end": 72.56, "text": " in this kind of diagram where you have a network and it maps from input to output" }, { "start": 72.56, "end": 76.76, "text": " by having these weighted connections between neurons. So the input is" }, { "start": 76.76, "end": 81.2, "text": " two-dimensional and then it maps using this weights to a three-dimensional" }, { "start": 81.2, "end": 87.80000000000001, "text": " hidden layer. Usually there is a nonlinear function somewhere at the" }, { "start": 87.80000000000001, "end": 93.80000000000001, "text": " output here of these so they do a weighted sum of the inputs and then they" }, { "start": 93.80000000000001, "end": 99.08000000000001, "text": " do a nonlinear function and then they propagate that signal to the" }, { "start": 99.08000000000001, "end": 106.24000000000001, "text": " next layer and to then to finally to the output. Alright so how do these networks" }, { "start": 106.24, "end": 112.72, "text": " learn? The one way of learning is called Hebbian learning. The interesting thing" }, { "start": 112.72, "end": 117.28, "text": " here is that it requires no feedback from the outside world. Basically what" }, { "start": 117.28, "end": 122.39999999999999, "text": " you want to do in Hebbian learning is you want to update the connections such" }, { "start": 122.39999999999999, "end": 127.08, "text": " that they kind of match their own previous outputs or even increase their" }, { "start": 127.08, "end": 132.48, "text": " own previous outputs. So you propagate a signal and then maybe this neuron spikes" }, { "start": 132.48, "end": 137.07999999999998, "text": " really hard and this neuron spikes really low then if you propagate the" }, { "start": 137.07999999999998, "end": 143.76, "text": " signal again right then you want to match that those those activations or if you" }, { "start": 143.76, "end": 151.16, "text": " if you propagate similar signals no feedback required so basically it's a" }, { "start": 151.16, "end": 157.83999999999997, "text": " self-amplifying or self dampening process. Ultimately though you want to" }, { "start": 157.83999999999997, "end": 161.88, "text": " learn something about the world and that means you have to have some some" }, { "start": 161.88, "end": 167.32, "text": " feedback from outside right so with feedback what we mean is usually that" }, { "start": 167.32, "end": 177.96, "text": " the output here let's put this away the output here is goes into the world let's" }, { "start": 177.96, "end": 184.16, "text": " say this is a motor neuron right you do something with your arm like you hammer" }, { "start": 184.16, "end": 192.04, "text": " on a nail and then you either hit the nail or you don't let's say you don't" }, { "start": 192.04, "end": 198.88, "text": " hit the nail so after it looks like crooked there you have feedback right so" }, { "start": 198.88, "end": 205.2, "text": " feedback usually in the form of some sort of error signal right so feedback" }, { "start": 205.2, "end": 210.35999999999999, "text": " it can be like this was good or this was bad or it can be this was a bit too much" }, { "start": 210.36, "end": 215.44000000000003, "text": " to the left or so on the important part is you get kind of one number of" }, { "start": 215.44000000000003, "end": 223.08, "text": " feedback right and how bad you were and now your goal is to adjust all of the" }, { "start": 223.08, "end": 230.08, "text": " individual neurons or weights between neurons such that the error will be" }, { "start": 230.08, "end": 234.20000000000002, "text": " lower so in Hebbian learning there is no feedback it's just simply a self" }, { "start": 234.2, "end": 242.35999999999999, "text": " reinforcing pattern activation machine in the first in these kind of first" }, { "start": 242.35999999999999, "end": 249.48, "text": " instances of perturbation learning what you'll have is you'll have one single" }, { "start": 249.48, "end": 255.04, "text": " feedback and that you can see this is a diffuse cloud here what you're basically" }, { "start": 255.04, "end": 260.03999999999996, "text": " saying is that every single neuron is kind of punished let's say the the" }, { "start": 260.04, "end": 266.48, "text": " feedback here was negative one that means every single neuron is is punished" }, { "start": 266.48, "end": 273.44, "text": " for that so how you can imagine something if you have your input X and" }, { "start": 273.44, "end": 281.52000000000004, "text": " you map it through through your function F and the function F has a weight W1 and" }, { "start": 281.52, "end": 290.12, "text": " so on right so you map X through it right and then you get a feedback of" }, { "start": 290.12, "end": 298.76, "text": " negative one and then you map X with a little bit of noise plus M right da da" }, { "start": 298.76, "end": 304.71999999999997, "text": " da da and you get a feedback of negative two right then you that means that the" }, { "start": 304.71999999999997, "end": 310.44, "text": " direction of this noise was probably a bad direction so ultimately you want to" }, { "start": 310.44, "end": 321.6, "text": " update X into the direction of negative that noise by modulated of course by by" }, { "start": 321.6, "end": 326.6, "text": " some some factor here that's that it kind of tells you how bad it was so this" }, { "start": 326.6, "end": 337.72, "text": " could be the negative two minus negative one yeah that makes big sense" }, { "start": 337.72, "end": 345.44000000000005, "text": " no yes that would be no it would be negative one minus negative never mind" }, { "start": 345.44000000000005, "end": 350.52000000000004, "text": " so basically with a scalar feedback you simply tell each neuron what it did" }, { "start": 350.52000000000004, "end": 357.16, "text": " right or sorry if if the entire network right the entire network did right or" }, { "start": 357.16, "end": 361.32000000000005, "text": " wrong so the entire network will lead to this feedback you don't have" }, { "start": 361.32000000000005, "end": 365.88000000000005, "text": " accountability of the individual neurons all you can say is that whatever I'm" }, { "start": 365.88, "end": 369.56, "text": " doing here is wrong and whatever I'm doing here is right so I'm going to do" }, { "start": 369.56, "end": 376.32, "text": " more of the right things now in back propagation it is very different right" }, { "start": 376.32, "end": 380.92, "text": " in back propagation what you'll do is you'll have your feedback here let's say" }, { "start": 380.92, "end": 387.28, "text": " that's negative one and then you do a reverse computation so the forward" }, { "start": 387.28, "end": 392.88, "text": " computation in this case was these weighted sum of this layer now you do a" }, { "start": 392.88, "end": 400.24, "text": " little layer wise reverse computation which means that you know how this" }, { "start": 400.24, "end": 405.48, "text": " function here this output came to be out of the out of the inputs and that means" }, { "start": 405.48, "end": 411.28, "text": " you can inverse and you can do an inverse propagation of the error signal" }, { "start": 411.28, "end": 419.36, "text": " which is of course the gradient so this would be your your you would derive your" }, { "start": 419.36, "end": 427.72, "text": " error by the inputs to the layer right so this basically tells in the back" }, { "start": 427.72, "end": 434, "text": " propagation algorithm you can exactly determine if you are this node how do I" }, { "start": 434, "end": 441.32, "text": " have to adjust my input weights how do I have to adjust them in order to make" }, { "start": 441.32, "end": 448.44, "text": " this number here go down right and then because you always propagate the error" }, { "start": 448.44, "end": 453.84, "text": " according to that what you'll have in each in each layer is basically a vector" }, { "start": 453.84, "end": 458.12, "text": " target so it's no longer just one number but each layer now has a target of" }, { "start": 458.12, "end": 465.72, "text": " vectors and it says okay these are the outputs that would be beneficial please" }, { "start": 465.72, "end": 470.48, "text": " this layer please change your outputs in the direction of negative 2 negative 3" }, { "start": 470.48, "end": 475.68, "text": " plus 4 so you see this is so the negative 2 would be this unit the" }, { "start": 475.68, "end": 479.64, "text": " negative 3 would be this unit and the plus 4 would be this unit so each unit" }, { "start": 479.64, "end": 486.84000000000003, "text": " is instructed individually to say please this is the direction that each unit" }, { "start": 486.84000000000003, "end": 492.8, "text": " should change in in order to make this number go lower you see how this is much" }, { "start": 492.8, "end": 496.04, "text": " more information than the perturbation learning in the perturbation learning" }, { "start": 496.04, "end": 501.44, "text": " all the units simply know well before was bad and now is better so let's you" }, { "start": 501.44, "end": 507.56, "text": " know change a bit and here you have detailed instructions for each unit" }, { "start": 507.56, "end": 513.96, "text": " because of the back propagation algorithm so ultimately people have kind" }, { "start": 513.96, "end": 520.28, "text": " of thought that since back propagation wasn't really possible with biological" }, { "start": 520.28, "end": 526.8, "text": " neurons that the brain might be doing something like perturbation learning but" }, { "start": 526.8, "end": 532.12, "text": " this paper argues that something like back propagation is not only possible" }, { "start": 532.12, "end": 539.12, "text": " but likely in the brain and they propose this kind of back prop like learning" }, { "start": 539.12, "end": 545.4, "text": " with the feedback network so they basically concern all the they" }, { "start": 545.4, "end": 550.1999999999999, "text": " differentiate hard between these two regimes here in this hand you have the" }, { "start": 550.1999999999999, "end": 555.92, "text": " scalar feedback which means that the entire network gets one number as a" }, { "start": 555.92, "end": 562.4, "text": " feedback and each neuron just gets that number and here you have vector feedback" }, { "start": 562.4, "end": 568.52, "text": " where each neuron gets an individual instruction of how to update and they" }, { "start": 568.52, "end": 573.9599999999999, "text": " achieve this not by back propagation because still the original formulation" }, { "start": 573.9599999999999, "end": 579.5999999999999, "text": " of back prop as we use it in neural networks is not biologically plausible" }, { "start": 579.5999999999999, "end": 583.36, "text": " but they achieve this with this back prop like learning with the feedback" }, { "start": 583.36, "end": 590.24, "text": " network and we'll see how this does but in in essence this feedback network is" }, { "start": 590.24, "end": 595.6, "text": " constructed such that it can give each neuron in the forward pass here detailed" }, { "start": 595.6, "end": 606.6800000000001, "text": " instructions on how to update itself alright so yeah they have a little bit" }, { "start": 606.6800000000001, "end": 611.72, "text": " of a diagram here of if you do heavy in if this if this is an error landscape" }, { "start": 611.72, "end": 615.24, "text": " if you do heavy in learning you're basically you don't care about the error" }, { "start": 615.24, "end": 621.9200000000001, "text": " you're just reinforcing yourself if you do perturbation learning then you it's" }, { "start": 621.9200000000001, "end": 626.36, "text": " very slow because you don't have a detailed signal you just you just" }, { "start": 626.36, "end": 631.48, "text": " relying on this one number it's kind of if you were to update every single neuron" }, { "start": 631.48, "end": 636.02, "text": " in your neural network with reinforcement learning considering the" }, { "start": 636.02, "end": 642.28, "text": " output the of the neural networks or the error considering that the reward not" }, { "start": 642.28, "end": 646.76, "text": " using back prop and then with back prop you have a much smoother much faster" }, { "start": 646.76, "end": 655.28, "text": " optimization trajectory so they look at this and they they come to some some" }, { "start": 655.28, "end": 660.88, "text": " conclusions first of all so here's here's back prop basically so in back" }, { "start": 660.88, "end": 668.28, "text": " prop as we said you have the forward pass and there you simply compute these" }, { "start": 668.28, "end": 676.72, "text": " weighted averages and you you also pass them usually through some sort of non" }, { "start": 676.72, "end": 683.88, "text": " linear activation right and the cool thing about this is in artificial" }, { "start": 683.88, "end": 690.48, "text": " neural networks is that once the error comes in you can exactly reverse that so" }, { "start": 690.48, "end": 694.5600000000001, "text": " you can do a backward pass of errors where you can propagate these errors" }, { "start": 694.5600000000001, "end": 699.9200000000001, "text": " through because you know it's kind of invertible the function doesn't have to" }, { "start": 699.9200000000001, "end": 705.16, "text": " be invertible but that the gradients will flow backwards if you know how the" }, { "start": 705.16, "end": 713.88, "text": " forward pass was computed so first of all they go into a discussion of back" }, { "start": 713.88, "end": 721.2, "text": " prop in the brain how can we even expect that and one cool piece of evidence is" }, { "start": 721.2, "end": 730.12, "text": " where I find is that they cite several examples where they use artificial" }, { "start": 730.12, "end": 738.52, "text": " neural networks to learn the same task as humans right and or as as animal" }, { "start": 738.52, "end": 743.6, "text": " brains and then I have no clue how how they measure any of this but then they" }, { "start": 743.6, "end": 750.4, "text": " compare the hidden representations of the living neural networks and the" }, { "start": 750.4, "end": 755.96, "text": " artificial neural networks and it turns out that the these the networks that" }, { "start": 755.96, "end": 765.12, "text": " were trained with back prop can clear up much more of the variance of these hidden" }, { "start": 765.12, "end": 770.24, "text": " activations than networks that were not trained with back prop so basically that" }, { "start": 770.24, "end": 776.28, "text": " means if you train a network with back prop it matches the biological networks" }, { "start": 776.28, "end": 782.52, "text": " much closer in how they form their hidden representations and they they do" }, { "start": 782.52, "end": 786.96, "text": " number they cite a number of experiments here that show this so this gives you" }, { "start": 786.96, "end": 793.76, "text": " very good evidence that if the hidden representations they look as if they had" }, { "start": 793.76, "end": 799.76, "text": " been computed by back prop and not by any of these scalar updating algorithms" }, { "start": 799.76, "end": 808.72, "text": " so it is conceivable that we find back prop in the brain that's why they go" }, { "start": 808.72, "end": 814.84, "text": " here next they go into problems with back prop so basically why why would we" }, { "start": 814.84, "end": 823, "text": " why so far have we believed that back prop isn't happening in the brain so now" }, { "start": 823, "end": 829.52, "text": " let's I want to highlight two factors here that I find think are suffice they" }, { "start": 829.52, "end": 835.36, "text": " have more but first of all back prop demands synaptic symmetry in the forward" }, { "start": 835.36, "end": 842.04, "text": " and backward paths right so basically if you have a neuron and it has output to" }, { "start": 842.04, "end": 848.42, "text": " another neuron what you need to be able to do is to pass back information along" }, { "start": 848.42, "end": 855.12, "text": " that neuron so it kind of has to be a symmetric connection idea of the forward" }, { "start": 855.12, "end": 861.5600000000001, "text": " and the backward paths and these need to be exact right and this is just not if" }, { "start": 861.5600000000001, "end": 865.4, "text": " you know how neurons are structured they have kind of input dendrites and then" }, { "start": 865.4, "end": 872.76, "text": " there's this accent action potential and along the axon the signal travels and" }, { "start": 872.76, "end": 878.88, "text": " the back traveling of the signal just I think is very is very very very slow if" }, { "start": 878.88, "end": 889.08, "text": " even possible and so it's generally not invertible or inverse compute capable so" }, { "start": 889.08, "end": 894.04, "text": " this is one reason why back prop seems unlikely and then the second reason here" }, { "start": 894.04, "end": 899.4399999999999, "text": " is error signals are signed and potentially extreme valued and I want to" }, { "start": 899.4399999999999, "end": 905.88, "text": " add to that they also talk about this somewhere that error signals are of a" }, { "start": 905.88, "end": 916.28, "text": " different type right that's a different type so first let's see what signed error" }, { "start": 916.28, "end": 921.48, "text": " signals are signed yes we need to be able to adjust neurons in a specific" }, { "start": 921.48, "end": 927.4, "text": " directions right if you look at again what we've drawn before here we said" }, { "start": 927.4, "end": 936.8, "text": " here this is how these neurons must update so the first neuron must decrease" }, { "start": 936.8, "end": 941.6, "text": " by two this must decrease by three and this must increase by four now in" }, { "start": 941.6, "end": 949.28, "text": " back prop we need this but in if if we assume that there is something like a" }, { "start": 949.28, "end": 956.96, "text": " reverse computation or signaling here happening then we still have the problem" }, { "start": 956.96, "end": 963.2, "text": " that usually these output signals are in the form of spiking rates which means" }, { "start": 963.2, "end": 971.0400000000001, "text": " that over time right so if a neuron wants to if a neuron has zero activation" }, { "start": 971.0400000000001, "end": 977.84, "text": " there's just no signal but if a neuron has a high activation it spikes a lot if" }, { "start": 977.84, "end": 983.48, "text": " has a low activation it kind of spikes sometimes what what it can't do is" }, { "start": 983.48, "end": 989.44, "text": " negative spike right like zero is as low as it goes so the the thought that there" }, { "start": 989.44, "end": 996.28, "text": " are signed information in in the backward pass is conceivable even if you" }, { "start": 996.28, "end": 1000.16, "text": " have something like a second so you can imagine here instead of this backward" }, { "start": 1000.16, "end": 1003.72, "text": " connection because of the symmetry problem that we have some kind of second" }, { "start": 1003.72, "end": 1007.72, "text": " neural network that goes in this direction still you'd have the problem" }, { "start": 1007.72, "end": 1016.0400000000001, "text": " that here you can only have positive signal or zero and they might be extreme" }, { "start": 1016.0400000000001, "end": 1020.76, "text": " valued which okay it can't be really encoded with these spiking because they" }, { "start": 1020.76, "end": 1026.1200000000001, "text": " are they're limited in the range they can assume but they are also of a" }, { "start": 1026.1200000000001, "end": 1030.96, "text": " different type and I'm what I mean by that is basically if you think of this" }, { "start": 1030.96, "end": 1037.88, "text": " as a programming problem then the forward passes here are activations" }, { "start": 1037.88, "end": 1044.64, "text": " right and the backward passes here they are deltas so in the backward passes you" }, { "start": 1044.64, "end": 1053.04, "text": " either propagate deltas or you propagate kind of directions so the activations" }, { "start": 1053.04, "end": 1062.52, "text": " are sort of impulses whereas the backward signals are this is how you" }, { "start": 1062.52, "end": 1066.8799999999999, "text": " need to change their gradients ultimately so it's fundamentally a" }, { "start": 1066.8799999999999, "end": 1071.8799999999999, "text": " different type of data that is propagated along would be propagated" }, { "start": 1071.8799999999999, "end": 1077.32, "text": " along these directions and that makes it very unlikely because we are not aware" }, { "start": 1077.32, "end": 1084.6, "text": " as this paper says that the neural networks get neurons can kind of switch" }, { "start": 1084.6, "end": 1091.4399999999998, "text": " the data type that they're they're transmitting alright so then the paper" }, { "start": 1091.4399999999998, "end": 1098.4399999999998, "text": " goes into their n-grad hypothesis and what this is the hypothesis basically" }, { "start": 1098.4399999999998, "end": 1105.4399999999998, "text": " states that the brain could implement something like neural networks by using" }, { "start": 1105.44, "end": 1112.16, "text": " by using an approximate backprop like algorithm based on autoencoders and I" }, { "start": 1112.16, "end": 1119.16, "text": " want to jump straight into the algorithm no actually first they do talk about" }, { "start": 1119.16, "end": 1124.04, "text": " autoencoders which which I find very interesting so if you think of auto" }, { "start": 1124.04, "end": 1129.6000000000001, "text": " encoders what is an autoencoder an autoencoder is a network that basically" }, { "start": 1129.6, "end": 1136.1999999999998, "text": " starts out with an input layer and then has a bunch of hidden layers and at the" }, { "start": 1136.1999999999998, "end": 1143.48, "text": " end it tries to reconstruct its own input right so you feed a data in here" }, { "start": 1143.48, "end": 1150.76, "text": " you get data out here and then your error the error signal it will be your" }, { "start": 1150.76, "end": 1162.76, "text": " difference to your original input now that the usually when we train auto" }, { "start": 1162.76, "end": 1166.28, "text": " encoders in deep learning we also train this by backprop right we feed and this" }, { "start": 1166.28, "end": 1170.68, "text": " error here and this goes back but if you just think of single layer auto encoders" }, { "start": 1170.68, "end": 1178.28, "text": " so let's let's go over here single layer autoencoder with let's say the the same" }, { "start": 1178.28, "end": 1189.3999999999999, "text": " number of the same number of of units in the in this layer what you'll have is so" }, { "start": 1189.3999999999999, "end": 1197.56, "text": " this this is input this is output and this is the hidden layer right you'll" }, { "start": 1197.56, "end": 1202.12, "text": " have a weight matrix here and you'll probably have some sort of nonlinear" }, { "start": 1202.12, "end": 1206.84, "text": " function and then you have another weight matrix here and they call them W" }, { "start": 1206.84, "end": 1213, "text": " and B another way to draw this is I have weight matrix going up then I have a" }, { "start": 1213, "end": 1219.72, "text": " nonlinear function going transforming this into this signal and then I have" }, { "start": 1219.72, "end": 1228.32, "text": " the B going back right so I'm drawing I'm drawing it in two different ways up" }, { "start": 1228.32, "end": 1233.3999999999999, "text": " here or over here and with the second way you can see that it is kind of a" }, { "start": 1233.4, "end": 1239.96, "text": " forward backward algorithm where now the error if you look at what is the error" }, { "start": 1239.96, "end": 1245.2800000000002, "text": " here the error is the difference between this and this and the difference between" }, { "start": 1245.2800000000002, "end": 1252.76, "text": " this and this and the difference between this and this right and you can train an" }, { "start": 1252.76, "end": 1264.32, "text": " autoencoder simply by saying W please make sure that the that the the the" }, { "start": 1264.32, "end": 1273.4, "text": " input here gets mapped closer to the output and the B the same thing this" }, { "start": 1273.4, "end": 1284.2, "text": " will become clear in a second so but basically sorry this I mean the the" }, { "start": 1284.2, "end": 1289.2800000000002, "text": " hidden representations you'll see basically the idea is that you can train" }, { "start": 1289.2800000000002, "end": 1296.1200000000001, "text": " an autoencoder only by using local update rules you don't have to do" }, { "start": 1296.1200000000001, "end": 1301.3200000000002, "text": " backprop and that's what this algorithm is proposing namely if you think of a" }, { "start": 1301.32, "end": 1307.1599999999999, "text": " stack of autoencoders this this this transforming one hidden representation" }, { "start": 1307.1599999999999, "end": 1313.08, "text": " into the next right this is the feed forward function right what you can do" }, { "start": 1313.08, "end": 1319.04, "text": " is you first of all you can assume that for each of these functions here you" }, { "start": 1319.04, "end": 1324.28, "text": " have a perfect inverse right you can you can perfectly compute the inverse" }, { "start": 1324.28, "end": 1330.56, "text": " function that's this this G here of course this doesn't exist but assume you" }, { "start": 1330.56, "end": 1342.12, "text": " have it what you then could do is you could if if you knew in one layer and on" }, { "start": 1342.12, "end": 1348.52, "text": " the top layer of course you know if you knew that okay I got this from my" }, { "start": 1348.52, "end": 1353.72, "text": " forward pass but I would like to have this this is my desired output right so" }, { "start": 1353.72, "end": 1360.84, "text": " in the output layer you get this this is your error signal if you knew you you" }, { "start": 1360.84, "end": 1365.1200000000001, "text": " you could compute an error right here this is what you do in the output right" }, { "start": 1365.1200000000001, "end": 1371, "text": " now in backprop we would back propagate this error along the layers but now we" }, { "start": 1371, "end": 1378.68, "text": " don't do this instead of what we do is we use this G function to invert the F" }, { "start": 1378.68, "end": 1388.92, "text": " function right and by that what we'll say is what hidden representation in" }, { "start": 1388.92, "end": 1395.0800000000002, "text": " layer 2 what should the hidden representation have been in order for us" }, { "start": 1395.0800000000002, "end": 1404.28, "text": " to obtain this thing right so the the claim here is if in layer 2 we had had" }, { "start": 1404.28, "end": 1411.04, "text": " h2 as a hidden representation then we would have landed exactly where we want" }, { "start": 1411.04, "end": 1416.84, "text": " it right that's what this G function does right because here we use F so had" }, { "start": 1416.84, "end": 1424.96, "text": " we had F H2 and used F on it we would be exactly where we want instead we had H2" }, { "start": 1424.96, "end": 1431.76, "text": " here and used F on it and then we landed here where we don't want so this is" }, { "start": 1431.76, "end": 1438.16, "text": " where we want we would want to be in layer 2 and this is where we were so" }, { "start": 1438.16, "end": 1444, "text": " again we can compute an error here again instead of back propagating that error" }, { "start": 1444, "end": 1449.16, "text": " what we'll do is we'll use the inverse of the forward function in order to" }, { "start": 1449.16, "end": 1455.8799999999999, "text": " back propagate our desired hidden representation and you can see there is" }, { "start": 1455.8799999999999, "end": 1461.36, "text": " of course a relationship to the true back prop here but the the important" }, { "start": 1461.36, "end": 1465.8, "text": " distinction is we are not trying to back propagate the error signal we're trying" }, { "start": 1465.8, "end": 1472.24, "text": " to invert the desired hidden states of the network and then in each layer we" }, { "start": 1472.24, "end": 1478.56, "text": " can compute from the forward pass we can compute the difference to the desired" }, { "start": 1478.56, "end": 1484.04, "text": " hidden state and thereby compute an error signal and now we have achieved" }, { "start": 1484.04, "end": 1490.76, "text": " what we wanted we want an algorithm that doesn't do backprop that only uses local" }, { "start": 1490.76, "end": 1497.32, "text": " information in order to compute the error signal that it needs to adjust and" }, { "start": 1497.32, "end": 1503.6, "text": " by local I mean information in the same layer and also the data type that is" }, { "start": 1503.6, "end": 1511, "text": " propagated by F is activations right of hidden representations and by G is also" }, { "start": 1511, "end": 1516.4, "text": " activations of hidden representations both of them are always positive can be" }, { "start": 1516.4, "end": 1522.76, "text": " encoded by spiking neurons and so on so this algorithm achieves what we want they" }, { "start": 1522.76, "end": 1528.72, "text": " go a bit into detail how the actual error update here can be achieved and" }, { "start": 1528.72, "end": 1534.64, "text": " apparently neurons can achieve you know in the same layer to to adjust" }, { "start": 1534.64, "end": 1542.16, "text": " themselves to a given desired activation so this algorithm achieves it of course" }, { "start": 1542.16, "end": 1547.52, "text": " we don't have this G we don't have it and therefore we need to go a bit more" }, { "start": 1547.52, "end": 1554.8000000000002, "text": " complicated what they introduce is the this following algorithm the goals are" }, { "start": 1554.8000000000002, "end": 1560, "text": " the same but now we assume we do not have a perfect inverse but we have" }, { "start": 1560, "end": 1566.64, "text": " something that is a bit like an inverse so we have an approximate inverse and" }, { "start": 1566.64, "end": 1570.5800000000002, "text": " they basically suggest if we have an approximate inverse we can do the" }, { "start": 1570.58, "end": 1575.36, "text": " following so G is now an approximate inverse to F what we can do is this is" }, { "start": 1575.36, "end": 1582.96, "text": " our input signal right we use F to map it forward to this and so on all the way" }, { "start": 1582.96, "end": 1588.48, "text": " up until we get our true our error right here this is our error from the" }, { "start": 1588.48, "end": 1595.6, "text": " environment right this is the nail being wrong and then we do two applications of" }, { "start": 1595.6, "end": 1601.84, "text": " G right so this is an application of F we do two applications of G one we" }, { "start": 1601.84, "end": 1610.8799999999999, "text": " apply G to this to what we got in the forward pass right and this now gives us" }, { "start": 1610.8799999999999, "end": 1616.52, "text": " a measure of how bad our inverse is right so if G is now an approximate" }, { "start": 1616.52, "end": 1623.3, "text": " inverse and this now we see here oh okay we we had H2 in the forward pass and we" }, { "start": 1623.3, "end": 1628.52, "text": " basically forward passed and then went through our inverse and we didn't land" }, { "start": 1628.52, "end": 1635.12, "text": " quite exactly where we started but we know that okay this this is basically" }, { "start": 1635.12, "end": 1642.48, "text": " the difference between our our inverse our forward inverse H and our true H and" }, { "start": 1642.48, "end": 1653.2, "text": " then we also back project using G again the desired outcome so we invert the" }, { "start": 1653.2, "end": 1659.0800000000002, "text": " desired outcome here now before we have adjusted directly these two right" }, { "start": 1659.0800000000002, "end": 1666.56, "text": " because we said this is what we got this is what we want but now we include for" }, { "start": 1666.56, "end": 1672.32, "text": " the fact that G isn't a perfect inverse and our assumption is that G here" }, { "start": 1672.32, "end": 1678.52, "text": " probably makes about the same mistakes as G here so what we'll do is we'll take" }, { "start": 1678.52, "end": 1685.8, "text": " this vector right here and apply it here in order to achieve this thing and this" }, { "start": 1685.8, "end": 1692.08, "text": " thing is now the corrected thing our corrected desired hidden representation" }, { "start": 1692.08, "end": 1696.34, "text": " corrected for the fact that we don't have a perfect inverse and now again we" }, { "start": 1696.34, "end": 1702.36, "text": " have our error here that we can locally adjust again all the signals propagated" }, { "start": 1702.36, "end": 1709.6, "text": " here here and here are just neural activations and all the information" }, { "start": 1709.6, "end": 1714.36, "text": " required to update a layer of neurons is now contained within that layer of" }, { "start": 1714.36, "end": 1721.9599999999998, "text": " neurons right and and this goes back through the network so this is how they" }, { "start": 1721.9599999999998, "end": 1729.84, "text": " achieve how they achieve this this is a bit of a of a close-up look and here are" }, { "start": 1729.84, "end": 1736.3799999999999, "text": " the computations to do this so basically for the forward updates you want to" }, { "start": 1736.3799999999999, "end": 1744.4399999999998, "text": " adjust W into the direction of the H minus the H tilde and the H tilde in" }, { "start": 1744.4399999999998, "end": 1749.28, "text": " this case would be this the the hidden representation that you would like to" }, { "start": 1749.28, "end": 1755.04, "text": " have so you would update your forward forward weights into the direction such" }, { "start": 1755.04, "end": 1759.4399999999998, "text": " that your hidden representations are closer sorry that your forward hidden" }, { "start": 1759.44, "end": 1764.48, "text": " representation is closer to your backward hidden representation and the" }, { "start": 1764.48, "end": 1773.6000000000001, "text": " backward updates now your goal is to get a more better to make G so sorry W here" }, { "start": 1773.6000000000001, "end": 1782.1200000000001, "text": " these are W are the weight of F and B are the weights of G so in the backward" }, { "start": 1782.1200000000001, "end": 1788.04, "text": " updates your goal is to make G a better inverse right so what you'll do is again" }, { "start": 1788.04, "end": 1794.72, "text": " you'll take the difference between now you see the difference here here here" }, { "start": 1794.72, "end": 1801.8, "text": " right not the same error so here you use you in the W update use what we labeled" }, { "start": 1801.8, "end": 1812.6, "text": " error here in the G update you use this error here so this is the error of G so" }, { "start": 1812.6, "end": 1819.1999999999998, "text": " when you update the function G you want to make these two closer together such" }, { "start": 1819.1999999999998, "end": 1823.12, "text": " that G becomes a better inverse right because you're dealing with an" }, { "start": 1823.12, "end": 1827.28, "text": " approximate inverse you still need to obtain that approximate inverse and and" }, { "start": 1827.28, "end": 1834.24, "text": " this here is how you learn it this algorithm now achieves what we wanted" }, { "start": 1834.24, "end": 1842.32, "text": " right local updates data types check assigned check and so on I hope this was" }, { "start": 1842.32, "end": 1848.9199999999998, "text": " enough clear in essence is pretty simple but it's pretty cool how they work" }, { "start": 1848.9199999999998, "end": 1857.1599999999999, "text": " around this they call this a difference target propagation and I'm not these" }, { "start": 1857.1599999999999, "end": 1866.28, "text": " these kind of papers I don't think they invented this maybe I'm not sure maybe" }, { "start": 1866.28, "end": 1871.2, "text": " they did and maybe they didn't and this paper just kind of frames it in this" }, { "start": 1871.2, "end": 1879.76, "text": " hypothesis it is unclear to me I I'm not familiar with this kind of papers so" }, { "start": 1879.76, "end": 1886.16, "text": " sorry if I misattribute something here all right then they go into into how" }, { "start": 1886.16, "end": 1891, "text": " could these things be implemented biologically and they go for some" }, { "start": 1891, "end": 1895.16, "text": " evidence and they also state that we used to look at neurons basically in" }, { "start": 1895.16, "end": 1903.3200000000002, "text": " this way where you had input and feedback here very simple simplistic" }, { "start": 1903.3200000000002, "end": 1907.96, "text": " view of neurons whereas nowadays even the the company to computational" }, { "start": 1907.96, "end": 1914.8400000000001, "text": " community use neurons in a more differentiated way where you have for" }, { "start": 1914.8400000000001, "end": 1921.24, "text": " example different regions here on the soma that can be separated from each" }, { "start": 1921.24, "end": 1925.72, "text": " other and you have interneuron interference and so on I'm not qualified" }, { "start": 1925.72, "end": 1933.68, "text": " too much to comment on this stuff but I invite you to read it for yourself if" }, { "start": 1933.68, "end": 1939.36, "text": " you want alright so this was my take on this paper I find the algorithm they" }, { "start": 1939.36, "end": 1952.24, "text": " proposed pretty cool if you I hope you liked it and check it out bye bye" } ]
D-eg7k8YSfs
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Shortcut Learning in Deep Neural Networks
[ "Science & Technology" ]
[ "deep learning", "machine learning", "adversarial examples", "iid", "ood", "distribution", "bias", "discrimination", "neural networks", "bugs", "distortions", "data pipeline", "causality", "intention", "grounding" ]
This paper establishes a framework for looking at out-of-distribution generalization failures of modern deep learning as the models learning false shortcuts that are present in the training data. The paper characterizes why and when shortcut learning can happen and gives recommendations for how to counter its effect. https://arxiv.org/abs/2004.07780 Abstract: Deep learning has triggered the current rise of artificial intelligence and is the workhorse of today's machine intelligence. Numerous success stories have rapidly spread all over science, industry and society, but its limitations have only recently come into focus. In this perspective we seek to distil how many of deep learning's problem can be seen as different symptoms of the same underlying problem: shortcut learning. Shortcuts are decision rules that perform well on standard benchmarks but fail to transfer to more challenging testing conditions, such as real-world scenarios. Related issues are known in Comparative Psychology, Education and Linguistics, suggesting that shortcut learning may be a common characteristic of learning systems, biological and artificial alike. Based on these observations, we develop a set of recommendations for model interpretation and benchmarking, highlighting recent advances in machine learning to improve robustness and transferability from the lab to real-world applications. Authors: Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, Felix A. Wichmann 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, today we're looking at shortcut learning in deep neural networks by a number of authors from the University of Tubingen, the Max Planck Research Center and the University of Toronto. So I'm not gonna read all of them but all of them are either joint first authors or joint senior authors. What is this? It's just a team of people who did this work together. This whole I have a star, I don't have a star, I have a cross, whatever. Okay, sorry, bit of a rant. Alright, so this paper discusses what they call shortcut learning and they actually don't propose something new here. They discuss this phenomenon and they try to link several things together under the name of shortcut learning which they claim is a problem in current deep learning and they discuss why it happens and what can be done about it. I just want to jump into this example real quick. So in this case you can see you have a training set of images and the training set is these four images here along with these labels and also these four images along with these labels. So you can think you can train a machine learning model, let's say you have a bunch of those and then you're gonna test them on the IID test set on this test set and what you'll find is that if you let a human do this task, the human would give this an A, this an A, this a B and this a B which is what you can think of is probably what a human would do is like these are the stars and these are the moons and the human would see the stars and the humans would see the moons and if you do this by the neural network also you'd get the labels AA, B and B and now you go about this out of distribution test set and we'll go over it why that is out of distribution in a second. Again you'll see that the human will classify this as the A's because it has the stars and these as B's but the neural network will classify these as B's and these as A's so I'm not saying this is what's gonna happen every time but imagine that happens and this is a conceivable situation and you can think of what happens here so you see in the training set all of the stars were either on the bottom left right or in the top right of the image where if I you know whereas the moons were either in the bottom right or the top left right you see that so the neural network might have learned that this is moon and this is moon and this is star and this is star. And then if it applies that rule to this new test set right then you can see that it'll classify these as moons and these as stars which is incorrect. So this might happen for example if the person that wrote the generator for the data set for some reason it produced only data here that had this property of the bottom left top right being a star and otherwise being a moon. So what generally happens if we do machine learning test set is we collect a data set a big data set but we collect it in a single pass right so this is our data set and what we'll do then is we'll split it right into a fairly large train and maybe a bit of a smaller test set right but this it's important that we first collect the data and then second we randomly split it. Now this out of distribution test set what that might be is that might be a second person right so this was done in the first step but then later right a person collects another bunch of data so this is data too and and they think it's it should be the same as this data but then you apply the the the classifier that you learned in train and test you apply that here right so what is different in this case is the data collection process that happens beforehand right so somewhere here is the real world I'm gonna draw the real world this is it's a globe this is the real world and you draw data sets from the real world and you draw this data set first and then you split it in train and test and then you draw this data set second so the second data set has a fundamentally is a different sample of data and this data whereas these train and test you can think of them they are closer together than these two data sets are here I think that's that's all that's kind of intuitive so what we usually do is we train here and then we evaluate on the test set right but the train and test that they've they've just they're just like randomly split versions of the same data set and that means that if there is some kind of bias in the training set it's probably also in the test set like we saw here with the moons right so this training set is this this test set is this and both have this this moon moon star star property because that was introduced so this pattern here by accident in this case was introduced when the data was produced right whereas the OOD test set now is maybe a second person writing their own generator that doesn't have this property and then that will lead to this data and of course since we train on the this training then evaluate on IID data this is now the IID assumption and evaluate on the IID test data we're gonna do fairly well with our you know crooked decision rule because it has the same bias but then if we once we evaluate on the on the out of distribution data then we we will fail right because now this doesn't have this in this bias in it right this this is not here so shortcut learning refers to the phenomenon that there might be features in the training set that the model starts to learn such such that it learns something else that we want it to learn right we want it to learn the shape here but it learns something else it learns the position and usually these things will not be recognized by generalizing to this test set right because the test set being an IID split from the same training set will have these same biases and therefore they will only become apparent once we do out of distribution generalization evaluation so this is shortcut learning and this paper goes into the origins and kind of descriptions of this and while I think this is a good approach and paper and it says many correct things I think the framing is a bit off at times and we'll go through it so first of all they say they give some examples in biological neural networks so they have this one example where they have a rat and the rat learned to navigate a complex maze right based on color differences of the walls and this was surprising because rats don't really have color vision or it was kind of known that rats don't have super good color vision so it was very surprising and then they discovered that the rats did actually not use the visual system at all they simply discriminated the colors by the odor of the color paint right so if you painted the wall red or blue that smelled differently and the rats could smell it once they controlled for the smell the remarkable color discrimination ability disappeared right so the second example they gave here is so Alice loves history and Alice had spent weeks immersing herself in the world of Hannibal and his exploits in the Roman Empire and now the exam questions are just like how many elephants did Hannibal employ in his army so the exam question are multiple choice not focus on understanding and Bob had just learned it by heart and is now doing much better than Alice who has actually understood the topic right so they give this as examples of shortcut learning where the model learns something that we don't intend it to do right all right and I I think this is the crucial point right the model learns something that we don't intend it to do and so here and this seems this this this might be pretty clear to when you observe it but what do we want we want we want shape and the model learns something else right just something else and the crucial part here and I think this paper isn't putting that much as much emphasis as it deserves is the two words we and want so my my basically my answer to this is first of all the word want we want shape and my answer my comment to this is you can't you can't formulate that you can't formulate it this this is very crucial and I think the the paper it almost ignores this point you cannot formulate what it means to classify things by shape and that this seems so oblivious to us because we're so used to it as humans right we were just like oh it's just use the shape right this is the shape right but you cannot you cannot program a computer to do this that's why we use deep learning in the first place right because we have no freaking idea how to program an algorithm that extracts the shape of something it might be possible for like a star and the moon but not for a cat or a car or anything right so you cannot formulate your objective that's the problem right and and it's easy to then say oh the model doesn't do what we wanted to do it's like you can't even formulate what you wanted to do in a precise way so basically all all you're you're saying here what you're saying here is I'll train a shape classifier right once you've gone through this process of training and evaluating you you say ah now I have a now I have a shape classifier right so say you haven't you hadn't done this OOD evaluation you've gone through this and you you know you now claim you proclaim I have trained a shape classifier no no you have trained something that given the entire process of how you create your data can classify these two images right so at here is your generator this is your little program that you wrote to produce these images and your generator assigns either the star right at random it produces these things the star or the moon it does these two things and then it creates the image from it and that will give you your data set right what you have trained is not a shape classifier what you have trained is a classifier that can distinguish data that comes from this data generation process right the entire notion of calling it a shape classifier is because you as a human have thought of shape when you programmed this generator right when you collected the data set that's what you thought of but this isn't the case you can't call it a shape classifier just because you like this is what your intent was you have a classifier that classifies images from this particular data generation process and you can't actually formulate a shape classifier right okay the second word is we we sorry we humans right we want a shape classifier now I've I've said this before and this this very much refers back to the two for example the paper about the contrast sets in NLP and so on humans have grounded knowledge right humans sorry humans have grounding this is very important here grounding means that the humans live in a world of physics and culture sorry physics and culture and the need for food biology humans live in this world and this this generated our brain right so what that means is that humans live in a world of objects and of of people sorry of people and of being eaten right being eaten or needing to eat food right humans lit grew up and live in this world your brain was literally structured according to these things and thus we understand everything with an eye to this grounded knowledge of reality where there is such a thing as objects now if you have image net and you train a classifier for objects right this is what I find so crazy right and in the you know you collect this thing and there's a car and you say that's a car right you know this is a car because there is an object of a car and and and but the the neural network is not does not have a bias for object in neural network simply sees these pixels same here what you will do immediately here is you'll recognize the object of the star right you will transform this into a 3d scene right into a 3d cube where you are here watching in 3d space and there is this star object somewhere here right and then you understand that the star could move around then it would still be the same star but that's because you have the inherent bias of there being objects and shape for example the word shape is nothing more than a property of an object and the neural network simply do not have a inherent bias for objects right or people or intent or what it means to eat right this this becomes super super obvious if you ever try to solve for example a jigsaw puzzle you know like these these things here I'm terrible at this if you solve this on its head right say this has like a face on it and you try to solve it like this and you try to solve it on its head like try it you'll do it's the same task you simply need to match the the border shapes right and you need to make sure that the lines are continuous of the picture it becomes so much harder just because you have this brain and so that is my my entire criticism and it will it will pull through this entire paper and we'll go through it for now relatively quickly because we've already like touched touched on it keep in mind this is my commentary on it this is not superior superior knowledge or something that's just me all right so what they do is they have this taxonomy of decision rules that they they point out what they're saying is okay you're you these there's a set of all possible decision rules right and this is the this is the outer set here all possible decision rules that one could think of to discriminate data and let's say we'll talk about images here right to to discriminate images most of them will just be crap and these will be using these uninformative features what they say but then there are some decision rules that perform well on training data right this is this big circle here right so that there are some decision rules that perform well on the training set and they call these overfitting features so these are all the features that perform well on the training set only on the training set sorry the overfitting features but to me it's it's a bit unclear I think they only call this band the overfitting features but they call the entire circle the all possible training solutions any case so there are decision rules that perform well on the training set but some of them are overfitting as you know that problem right then the next circle inside of that are all decision rules that perform well on the training set and the IID test set and this would be our our location classifier from before would fall into this category right and now there these are still a much larger set as you see here as this inside set of the intended solution performs well on training set IID and all relevant out-of-distribution test sets and they draw this in here the out-of-distribution test sets are subsets of the IID test set or the sorry the solutions that work on the OOD test sets are subsets of the solutions that work well on the IID test sets I don't have a problem with this characterization of decision rules right here is specifically these are decision rules what I have a problem of characterization with is the fact that you cannot specify what the intended solution is you cannot and therefore this diagram I think is misleading because you have ultimately you have no idea where this dot is right you you can't you can't specify it beforehand you can't even specify the rules how you get there all you can do is give better data and they kind of advocate for this here with these OOD test sets but again I think when they say all relevant out-of-distribution test sets I'm a bit I'm a bit wary because they they suggest this as one of the measures to assess whether or not a model has learned these shortcut rules is to measure its performance on out-of-distribution test sets and this is very much like the contrast sets in in in the NLP but I I think actually this is a pretty pretty pretty pretty bad solution in most cases and let me explain why so if we go back to here right what we saw is that these these discrepancy it comes about because here from the real world we produce the data in a very specific form right and then this other out-of-distribution test set is produced in a slightly different form right now what you can think of this is if you look at your cost function that you train right what usually says my cost function is some sort of a loss for my data points and my labels right but this is often left out I mean you write it in your introductory classes what is important is that this is an expected loss that you're minimizing here over a data distribution right over X and Y sampled from a particular data distribution now when you talk about this this out-of-distribution classifiers what you'll have is you'll have a slightly different data distribution D prime right so but if you simply have one out of distribution thing think of this as the contrast set right if you haven't seen the video about contrast sets it's it's basically an out handcrafted out of distribution test set right my problem with this it's just one it's one it's a single one and I I think even if you try ten of them ten of those sets you won't even get close to a true measure because so the cool thing about an IID test set is at least it is precisely the same distribution right so it kind of gives you an unbiased number that for this particular data generation pipeline you get this number if you evaluate on an out-of-distribution test set you now have two effects you first have this generalization effect and you have the effect of having produced this in a different fashion here but you only have one of them what you would like to do is you would what you would like to assess is your loss of X and Y in expectation with X and Y coming from data in expectation let me a different color in expectation with your data distribution coming from all possible data distributions in the real world right that's what you would like to to say to do now if you only have a single contrast set it is a kin you can think of what if like how how well how well of a machine learning engineer would I be if my test set here only had one sample right so so I give you a train and the test set and I'm saying your performance will be if I make a Kaggle challenge and I say your performance will be evaluated on this one single sample test set right that's basically what you're doing if you have a single OOD test set is you're saying I'm going to give you one out-of-distribution data set that I have biased in one particular way right and will measure how well you capture our intent right our shape classifier intent will measure how well you capture that using this one single out-of-distribution thing I think what that will do is right you say I want to approximate this by a sum of I equals one to one that will just pump the variance beyond what beyond any reasonable meaning that the upcoming number will will be able to give you what you'd have to do is you'd have to have this entire process and sample train and test sets according to this day or at least test sets according to this data distribution this underlying data distribution which you have no clue what it is because if you could specify this directly you could get the solution for free right if you could specify the underlying mechanism you could you you would already know the solution you would need machine learning so I think the model puts like way too little emphasis sorry the paper puts a bit too little emphasis suffice to say they with their taxonomy they can say if you use for example only the overfitting features right then you will do well on the training set but not on the IID and OD test sets if you use the intended features again intended no one knows what that is no one can specify it you'll do well on all the OD test sets if you use the shortcut features you will do well on the training and ID test set but not on the OD test this is valid right I'm not discrediting this paper here and they do allude to a lot of the things I'm saying but not not all and I don't think they frame it correctly so they ask shortcuts where do they come from and they say a lot of the things that I've been saying here but for example they ask what makes a cow a cow and they give this example here where they say familiar background can be as important for recognition to deep neural networks where the deep neural networks will misclassify this picture because they used to seeing a cow in grass now consider this in our framework right if let's say this is an image net classifier image net is not an object classifier it is not right that's what we say that's our intent but what it is it is a classifier if you go through the pipeline what how do you generate the data image net is a classifier of naturally taken images right with a certain camera cropped center cropped to a particular object labeled by human radars filtered in some capacity right from flickr and for that particular data set we train a classifier it is not an object classifier it is a classifier for that and it doesn't has no clue of objects so in fact and also what you have to see is that the output isn't even if the output is shape it isn't shape it is actually probability of shape right or probability of object or probability of something right and it is completely conceivable right that if it's not grass in the background it's probably not as much a cow now I see the problem here this is clearly a cow and this is actually a conceivable natural image but imagine a picture of the cow oops what happened on the moon right this is the moon and here's the cow cow moo this is terrible horns tell a cow on the moon like who can fault the neural network it it it and I would say that's not a cow either because it in terms of the data generation process if you ask me please classify this as a natural image that has been taken blah blah blah blah blah right I'm gonna say there's no way there's a cow on the moon so I don't know what this is but it is very improbable that this is a cow right because all the training examples I've seen cow on grass so yeah so I mean they do they do actually allude to this right they call this data set biases and so on but I'm pretty sure that yet the interpretation is just a bit off where they say they the stat the point of this is like ah it's it's you know we want an object classifier but this we want the second I find even more kind of strange is they say shortcuts from discriminative learning and they allude to this picture here and they ask what makes a cat a cat and they basically their argument is that the neural networks they don't understand things they just discriminate right they have these thousand classes and the output layer this is the neural network and they just need to discriminate so they just need to learn what is different from one class to the other class and they will often rely on features such as texture like here so they rely on detection they classify this as an elephant right so they say what makes a cat a cat to standard DNNs the example image on the left clearly shows an elephant not a cat and again I agree if you tell me this is data from naturally to it taken images with standard cameras right then I will I will have two possibilities I will say is this a cat there's no way that if you take anywhere in the universe a picture with a like a phone camera of anything of a cat it will look like this no way I don't like this just not possible right however is it possible that there is an elephant that as a skin fold pattern by random chance elephant big ears raw trunk as a skin fold pattern looks like a cat like looks like the shape of a cat yes that's possible so if you ask me according to the data generation process this is way more likely to be an elephant than a cat right and the paper here makes it seem like it is so obvious that this is a cat but what do these standard stupid DNNs think it's an elephant not a cat and the DNN oh it's just looking at object text and other local structures and not that shape right what we like what we wanted to do and this this is I find just stop calling things object classifiers if they're not object classifiers that classifier between images of a data generation process if you want them to be object classifiers make up a data set that actually has different objects but you can't specify that so yeah and then they go into some sort of adversarial examples and I find this to be I also find this to be a bit maybe not belonging here like where they say oh look here the DNNs predict guitar with high certainty again it's just a discriminator but this this pattern why not a guitar if you had to you know if you had to get one of the thousand classes out why it could this not be most likely a guitar but I have a further problem with this is I see I kind of see this in so what what would you have is I ID data let's go with their taxonomy and say I ID data has from from the same generation process and then there is OOD data now I think there are a number of effects here that they try to lump together with this thing where they just say oh oh D data whenever my model doesn't work on OOD data it has learned a shortcut but it's very very weird so first of all there I would say the OOD data you can probably divide into what I would call unnatural OOD data let's say our task here is to build an object an object detector whatever that means for natural images so then there's unnatural OOD data which which in here you'll find something like adversarial examples adversarial examples are constructed at least if you go by the interpretation of modri and adversarial examples are features not bugs then you'll go into the direction of adversarial examples actually constructed by combining features that don't naturally go together so you'll you'll get the low frequency features of a cat and add the high frequency for example features of a dog so much with this with this lambda factor here so high that it to a DNN it looks like a dog because it has many of the features but to a human that kind of ignores the high frequency features it'll look like a cat right but these are unnatural because the features in actual nature in the real world they never occur in this combination so it seems like this is a very very very different phenomenon from what I would call natural OOD OOD data where simply the the features that you're seeing have never occurred in the training data set but there is there is if you go from the real world and you construct in different ways data set there is some data set where where the where the data actually occurs in the way that you have here so natural OOD data is what most of the examples for now were were about like a cow on the beach it's just because you've never you've never seen that because your data generation here always get cow plus grass right so I think these are very different and then the last thing they also lump in here is fairness like the the fairness and bias literature where for example you have a resume classifier and the resume classifier ends up being biased by gender or something like this and again so I I kind of struggle with this although they say not all the fairness problems come from here but I would also like to stress that some of the fairness problem goes exactly here it occurs because your data generation process is different from what you want for example if you do this this hiring classifier you have to understand what that is what your training is a system that will tell you how would my human data set creators have decided on this particular application now of course there is this problem of bias amplification and so on but it is not it is not an infallible system it simply tells you how the humans would have predicted if you collect the data set in a biased way of course the the machine will inherit that but on the other hand the fairness why I don't think this really belongs in here because in fairness you have a you actually have kind of an alternate world draw this in green prime world prime right where in this OOD and IID setting you always assume that the world is is the world and you want to kind of really learn a system that understands the world where in fairness you this here this is your super world so actually for the fairness literature it doesn't really matter if in the real world to let's say two groups of people are equal in some respect or not equal in the true world right what they care about is that they are treated equally by the system right so they will impose they will impose some restrictions or some some some condition on their model and they don't they don't naturally I'm like this sounds bad but it is the mathematical formulation is such that you start with the super knowledge of two things must be equal and then you this is how you imagine your world you think I know the world and then I try to learn the model such that that happens right whereas over here you do something different now some of it is in as I said is in the same category but it is I think a different different take and a different literature so I would I would focus on let's say this part right here sorry on this part and not on the adversarial examples and also not in the fairness literature too much alright so yeah you can see here like like no wonder this this and this screws up and this screws up an image net classifier yeah and even even this like how do we know that that is naturally natural though I can see that that is that looks pretty natural but still it's probably like really specifically constructed such that the probability that someone would take this picture with a camera in the real world is zero cool so they give some examples where they say okay shortcut learning exists in computer vision for example adversarial examples you see shifting the image by a few pixels though you have to say shifting the image very precisely by a few pixels such that the probability of this occurring the data generation pipeline is zero and so on then they call it domain transfer that that of course is I think that's the that's a good example they say natural language processing where BERT has been found to rely on superficial keywords for instance it learned within a data set of natural language arguments detecting the presence of not was sufficient to perform above chance in finding the correct line of argumentation again this is like all we can do is construct datasets we cannot if we could tell the model what to look at we would we would we would just program the solution so the solution is there's only one solution program better datasets get better datasets or I mean okay the second solution is get better inductive biases but if we knew the correct inductive biases we wouldn't have the problem yeah I like that there is a in NLP this is very this is very very prevalent even more than in vision right this this fact of hey these spurious correlations in NLP the models usually just learn kind of correlation between some words and then they they don't learn to understand the sentences at all right but this this is because in NLP we have even more problems with constructing datasets that force the model to learn to understand the the text again I could not tell you what understanding the text means they go in by the way humans do that too humans most in most of NLP that happens in humans humans do this right in many many many forms this is simply because the cost function is not aligned with what you would want what is the specific oh well a specific example is that news stories nowadays right you have a news you say news what do people expect what is the intent of news the intent of news is to inform you maybe but the cost right the cost function is clicks so what do you do you news story and very on the top in the title you say orange man bad and then people and you highlight this right so a news story I don't know Brad Pitt had a new baby you just append but orange man bad people click on it much more your cost goes up and sorry your clicks go up your cost function goes up and so I think this happens everywhere right you can't even do this with humans right how do you expect neural networks to to do that all right agent based reinforcement learning I think this pretty funny where is it where it learned how to play Tetris yeah instead of learning how to play Tetris an algorithm simply learned to pause the game to fit come on is genius right like it is objectively genius and then of course fairness and algorithmic decision-making right so they say understanding these shortcuts and they they touch on a lot of the things that I've touched on including these what I find what I find well is for example this Morgan's can for machine learning where you say probably a machine learning system will learn the easiest feature it can and that's oftentimes not what you want right so this even now amplifies things they also touch on this thing of anthropomorphism where you view everything through a human lens and that is not correct if you look at these neural networks they're not humans and we should never attribute human nests to their solutions never attribute to high level abilities that which can be adequately explained by shortcut learning yes I agree with this like I agree with this paper in in all the things it says right except this detecting shortcuts making od generalization tests a standard practice for the reasons I specified before I think that is counterproductive and yeah I think I've already said enough right designing good od tests this you can only design good od tests if you know the real underlying data distribution which you don't and let's go through yeah again the principle of least effort they say why are they learned because it's just easier right to it's just easier to write a news story with just the words you know people will click on right like or these top 10 things of blah blah blah number seven will surprise you you don't actually have to come up with 10 relevant things the entire title is enough to get you the clicks so it's the least effort to solve the cost function might not align with what you want and also the inductive biases as I said we are humans we have some inductive biases the neural networks don't have them and we need to take this into account but the solution is to make training data sets that take this into account all right they say beyond shortcut learnings is kind of an outlook and then a conclusion where they remind but we're already at some 45 minutes of video and if you're still here like respect or maybe you just have this in the background and have some company during this time I will finish with saying thank you for watching and leave your comments since this is mostly opinion I would be interested in hearing your comments on this with that I say bye bye
[ { "start": 0, "end": 6.32, "text": " Hi, today we're looking at shortcut learning in deep neural networks by a" }, { "start": 6.32, "end": 11.44, "text": " number of authors from the University of Tubingen, the Max Planck Research Center" }, { "start": 11.44, "end": 18.04, "text": " and the University of Toronto. So I'm not gonna read all of them but all of" }, { "start": 18.04, "end": 27.52, "text": " them are either joint first authors or joint senior authors. What is" }, { "start": 27.52, "end": 33.4, "text": " this? It's just a team of people who did this work together. This whole" }, { "start": 33.4, "end": 40.24, "text": " I have a star, I don't have a star, I have a cross, whatever. Okay, sorry, bit of a rant." }, { "start": 40.24, "end": 46.72, "text": " Alright, so this paper discusses what they call shortcut learning and" }, { "start": 46.72, "end": 52.2, "text": " they actually don't propose something new here. They discuss this" }, { "start": 52.2, "end": 57.92, "text": " phenomenon and they try to link several things together under the name of" }, { "start": 57.92, "end": 63.24, "text": " shortcut learning which they claim is a problem in current deep learning" }, { "start": 63.24, "end": 69.72, "text": " and they discuss why it happens and what can be done about it. I just" }, { "start": 69.72, "end": 74.80000000000001, "text": " want to jump into this example real quick. So in this case you can see" }, { "start": 74.80000000000001, "end": 81.48, "text": " you have a training set of images and the training set is these four images" }, { "start": 81.48, "end": 87.2, "text": " here along with these labels and also these four images along with these" }, { "start": 87.2, "end": 93.52000000000001, "text": " labels. So you can think you can train a machine learning model, let's say you" }, { "start": 93.52000000000001, "end": 99.84, "text": " have a bunch of those and then you're gonna test them on the IID test set" }, { "start": 99.84, "end": 107.72, "text": " on this test set and what you'll find is that if you let a human do this" }, { "start": 107.72, "end": 113.36, "text": " task, the human would give this an A, this an A, this a B and this a B which" }, { "start": 113.36, "end": 117.96, "text": " is what you can think of is probably what a human would do is like these are" }, { "start": 117.96, "end": 123.28, "text": " the stars and these are the moons and the human would see the stars and the" }, { "start": 123.28, "end": 127.92, "text": " humans would see the moons and if you do this by the neural network also you'd" }, { "start": 127.92, "end": 135.64, "text": " get the labels AA, B and B and now you go about this out of distribution test set" }, { "start": 135.64, "end": 140.67999999999998, "text": " and we'll go over it why that is out of distribution in a second. Again you'll" }, { "start": 140.67999999999998, "end": 146.6, "text": " see that the human will classify this as the A's because it has the stars and" }, { "start": 146.6, "end": 154.67999999999998, "text": " these as B's but the neural network will classify these as B's and these as A's" }, { "start": 154.67999999999998, "end": 159.95999999999998, "text": " so I'm not saying this is what's gonna happen every time but imagine that" }, { "start": 159.96, "end": 166.16, "text": " happens and this is a conceivable situation and you can think of" }, { "start": 166.16, "end": 171.84, "text": " what happens here so you see in the training set all of the stars were" }, { "start": 171.84, "end": 180.68, "text": " either on the bottom left right or in the top right of the image where if I" }, { "start": 180.68, "end": 187, "text": " you know whereas the moons were either in the bottom right or the top left" }, { "start": 187, "end": 194.04, "text": " right you see that so the neural network might have learned that this is moon and" }, { "start": 194.04, "end": 207.92000000000002, "text": " this is moon and this is star and this is star. And then if it applies that" }, { "start": 207.92000000000002, "end": 216.76, "text": " rule to this new test set right then you can see that it'll classify these as" }, { "start": 216.76, "end": 222.72, "text": " moons and these as stars which is incorrect. So this might happen for" }, { "start": 222.72, "end": 229.23999999999998, "text": " example if the person that wrote the generator for the data set for" }, { "start": 229.23999999999998, "end": 239.64, "text": " some reason it produced only data here that had this property of the bottom" }, { "start": 239.64, "end": 244.35999999999999, "text": " left top right being a star and otherwise being a moon. So what generally" }, { "start": 244.36, "end": 250, "text": " happens if we do machine learning test set is we collect a data set a big data" }, { "start": 250, "end": 256.28000000000003, "text": " set but we collect it in a single pass right so this is our data set and what" }, { "start": 256.28000000000003, "end": 264.72, "text": " we'll do then is we'll split it right into a fairly large train and maybe a" }, { "start": 264.72, "end": 271.16, "text": " bit of a smaller test set right but this it's important that we first collect the" }, { "start": 271.16, "end": 281.28000000000003, "text": " data and then second we randomly split it. Now this out of distribution test set" }, { "start": 281.28000000000003, "end": 286.84000000000003, "text": " what that might be is that might be a second person right so this was done in" }, { "start": 286.84000000000003, "end": 293.96000000000004, "text": " the first step but then later right a person collects another bunch of data so" }, { "start": 293.96000000000004, "end": 300.08000000000004, "text": " this is data too and and they think it's it should be the same as this data but" }, { "start": 300.08, "end": 306.8, "text": " then you apply the the the classifier that you learned in train and test you" }, { "start": 306.8, "end": 312.32, "text": " apply that here right so what is different in this case is the data" }, { "start": 312.32, "end": 317.68, "text": " collection process that happens beforehand right so somewhere here is" }, { "start": 317.68, "end": 323.12, "text": " the real world I'm gonna draw the real world this is it's a globe this is the" }, { "start": 323.12, "end": 328.79999999999995, "text": " real world and you draw data sets from the real world and you draw this data" }, { "start": 328.8, "end": 333.56, "text": " set first and then you split it in train and test and then you draw this data set" }, { "start": 333.56, "end": 340.08, "text": " second so the second data set has a fundamentally is a different sample of" }, { "start": 340.08, "end": 344.92, "text": " data and this data whereas these train and test you can think of them they are" }, { "start": 344.92, "end": 352.72, "text": " closer together than these two data sets are here I think that's that's all" }, { "start": 352.72, "end": 361.28000000000003, "text": " that's kind of intuitive so what we usually do is we train here and then we" }, { "start": 361.28000000000003, "end": 367.56, "text": " evaluate on the test set right but the train and test that they've they've just" }, { "start": 367.56, "end": 371.44000000000005, "text": " they're just like randomly split versions of the same data set and that" }, { "start": 371.44000000000005, "end": 378.16, "text": " means that if there is some kind of bias in the training set it's probably also" }, { "start": 378.16, "end": 383.6, "text": " in the test set like we saw here with the moons right so this training set is" }, { "start": 383.6, "end": 391.08000000000004, "text": " this this test set is this and both have this this moon moon star star property" }, { "start": 391.08000000000004, "end": 397.16, "text": " because that was introduced so this pattern here by accident in this case" }, { "start": 397.16, "end": 404.16, "text": " was introduced when the data was produced right whereas the OOD test set" }, { "start": 404.16, "end": 408.56, "text": " now is maybe a second person writing their own generator that doesn't have" }, { "start": 408.56, "end": 415, "text": " this property and then that will lead to this data and of course since we train" }, { "start": 415, "end": 420.84000000000003, "text": " on the this training then evaluate on IID data this is now the IID assumption" }, { "start": 420.84000000000003, "end": 427.76000000000005, "text": " and evaluate on the IID test data we're gonna do fairly well with our you know" }, { "start": 427.76000000000005, "end": 432, "text": " crooked decision rule because it has the same bias but then if we once we" }, { "start": 432, "end": 442.84, "text": " evaluate on the on the out of distribution data then we we will fail" }, { "start": 442.84, "end": 448.86, "text": " right because now this doesn't have this in this bias in it right this this is" }, { "start": 448.86, "end": 457.68, "text": " not here so shortcut learning refers to the phenomenon that there might be" }, { "start": 457.68, "end": 467.04, "text": " features in the training set that the model starts to learn such such that it" }, { "start": 467.04, "end": 472.2, "text": " learns something else that we want it to learn right we want it to learn the" }, { "start": 472.2, "end": 478.68, "text": " shape here but it learns something else it learns the position and usually these" }, { "start": 478.68, "end": 485.88, "text": " things will not be recognized by generalizing to this test set right" }, { "start": 485.88, "end": 491.96, "text": " because the test set being an IID split from the same training set will have" }, { "start": 491.96, "end": 496.84, "text": " these same biases and therefore they will only become apparent once we do out" }, { "start": 496.84, "end": 502.88, "text": " of distribution generalization evaluation so this is shortcut learning" }, { "start": 502.88, "end": 510.76, "text": " and this paper goes into the origins and kind of descriptions of this and while I" }, { "start": 510.76, "end": 517.04, "text": " think this is a good approach and paper and it says many correct things I think" }, { "start": 517.04, "end": 524.4399999999999, "text": " the framing is a bit off at times and we'll go through it so first of all they" }, { "start": 524.4399999999999, "end": 530.92, "text": " say they give some examples in biological neural networks so they have" }, { "start": 530.92, "end": 537.6, "text": " this one example where they have a rat and the rat learned to navigate a complex" }, { "start": 537.6, "end": 543.84, "text": " maze right based on color differences of the walls and this was surprising" }, { "start": 543.84, "end": 550.32, "text": " because rats don't really have color vision or it was kind of known that rats" }, { "start": 550.32, "end": 555.2, "text": " don't have super good color vision so it was very surprising and then they" }, { "start": 555.2, "end": 560.6800000000001, "text": " discovered that the rats did actually not use the visual system at all they" }, { "start": 560.6800000000001, "end": 566.9200000000001, "text": " simply discriminated the colors by the odor of the color paint right so if you" }, { "start": 566.92, "end": 571.12, "text": " painted the wall red or blue that smelled differently and the rats could" }, { "start": 571.12, "end": 576.3199999999999, "text": " smell it once they controlled for the smell the remarkable color" }, { "start": 576.3199999999999, "end": 584.16, "text": " discrimination ability disappeared right so the second example they gave here is" }, { "start": 584.16, "end": 592.4399999999999, "text": " so Alice loves history and Alice had spent weeks immersing herself in the" }, { "start": 592.44, "end": 597.6400000000001, "text": " world of Hannibal and his exploits in the Roman Empire and now the exam" }, { "start": 597.6400000000001, "end": 601.44, "text": " questions are just like how many elephants did Hannibal employ in his" }, { "start": 601.44, "end": 606.8000000000001, "text": " army so the exam question are multiple choice not focus on understanding and" }, { "start": 606.8000000000001, "end": 613.5600000000001, "text": " Bob had just learned it by heart and is now doing much better than Alice who has" }, { "start": 613.5600000000001, "end": 620.0400000000001, "text": " actually understood the topic right so they give this as examples of shortcut" }, { "start": 620.04, "end": 625.16, "text": " learning where the model learns something that we don't intend it to do" }, { "start": 625.16, "end": 633.28, "text": " right all right and I I think this is the crucial point right the model learns" }, { "start": 633.28, "end": 641.56, "text": " something that we don't intend it to do and so here and this seems this this" }, { "start": 641.56, "end": 647.88, "text": " this might be pretty clear to when you observe it but what do we want we want" }, { "start": 647.88, "end": 662.56, "text": " we want shape and the model learns something else right just something else" }, { "start": 662.56, "end": 670.6, "text": " and the crucial part here and I think this paper isn't putting that much as" }, { "start": 670.6, "end": 681.08, "text": " much emphasis as it deserves is the two words we and want so my my basically my" }, { "start": 681.08, "end": 691.48, "text": " answer to this is first of all the word want we want shape and my answer my" }, { "start": 691.48, "end": 703.44, "text": " comment to this is you can't you can't formulate that you can't formulate it" }, { "start": 704.28, "end": 714.12, "text": " this this is very crucial and I think the the paper it almost ignores this" }, { "start": 714.12, "end": 720.6, "text": " point you cannot formulate what it means to classify things by shape and that" }, { "start": 720.6, "end": 726.5600000000001, "text": " this seems so oblivious to us because we're so used to it as humans right we" }, { "start": 726.5600000000001, "end": 730.96, "text": " were just like oh it's just use the shape right this is the shape right but" }, { "start": 730.96, "end": 736.96, "text": " you cannot you cannot program a computer to do this that's why we use deep" }, { "start": 736.96, "end": 742.32, "text": " learning in the first place right because we have no freaking idea how to" }, { "start": 742.32, "end": 747.88, "text": " program an algorithm that extracts the shape of something it might be possible" }, { "start": 747.88, "end": 755.2, "text": " for like a star and the moon but not for a cat or a car or anything right so you" }, { "start": 755.2, "end": 761.12, "text": " cannot formulate your objective that's the problem right and and it's easy to" }, { "start": 761.12, "end": 766.92, "text": " then say oh the model doesn't do what we wanted to do it's like you can't even" }, { "start": 766.92, "end": 774.56, "text": " formulate what you wanted to do in a precise way so basically all all you're" }, { "start": 774.56, "end": 779.5999999999999, "text": " you're saying here what you're saying here is I'll train a shape classifier" }, { "start": 779.5999999999999, "end": 784.3599999999999, "text": " right once you've gone through this process of training and evaluating you" }, { "start": 784.3599999999999, "end": 791.56, "text": " you say ah now I have a now I have a shape classifier right so say you" }, { "start": 791.56, "end": 797.16, "text": " haven't you hadn't done this OOD evaluation you've gone through this and" }, { "start": 797.16, "end": 804.1199999999999, "text": " you you know you now claim you proclaim I have trained a shape classifier no no" }, { "start": 804.12, "end": 812.84, "text": " you have trained something that given the entire process of how you create" }, { "start": 812.84, "end": 821, "text": " your data can classify these two images right so at here is your generator this" }, { "start": 821, "end": 825.72, "text": " is your little program that you wrote to produce these images and your generator" }, { "start": 825.72, "end": 834.08, "text": " assigns either the star right at random it produces these things the star or the" }, { "start": 834.08, "end": 841.12, "text": " moon it does these two things and then it creates the image from it and that" }, { "start": 841.12, "end": 845.96, "text": " will give you your data set right what you have trained is not a shape" }, { "start": 845.96, "end": 851.2, "text": " classifier what you have trained is a classifier that can distinguish data" }, { "start": 851.2, "end": 858.88, "text": " that comes from this data generation process right the entire notion of" }, { "start": 858.88, "end": 867.4, "text": " calling it a shape classifier is because you as a human have thought of shape" }, { "start": 867.4, "end": 874.84, "text": " when you programmed this generator right when you collected the data set that's" }, { "start": 874.84, "end": 878.6, "text": " what you thought of but this isn't the case you can't call it a shape" }, { "start": 878.6, "end": 883.36, "text": " classifier just because you like this is what your intent was you have a" }, { "start": 883.36, "end": 888.76, "text": " classifier that classifies images from this particular data generation" }, { "start": 888.76, "end": 897.28, "text": " process and you can't actually formulate a shape classifier right okay the second" }, { "start": 897.28, "end": 914.8, "text": " word is we we sorry we humans right we want a shape classifier now I've I've" }, { "start": 914.8, "end": 919.24, "text": " said this before and this this very much refers back to the two for example the" }, { "start": 919.24, "end": 928.3199999999999, "text": " paper about the contrast sets in NLP and so on humans have grounded knowledge" }, { "start": 928.3199999999999, "end": 940.0799999999999, "text": " right humans sorry humans have grounding this is very important here grounding" }, { "start": 940.08, "end": 950.96, "text": " means that the humans live in a world of physics and culture sorry physics and" }, { "start": 950.96, "end": 965.12, "text": " culture and the need for food biology humans live in this world and this this" }, { "start": 965.12, "end": 972.4, "text": " generated our brain right so what that means is that humans live in a world of" }, { "start": 972.4, "end": 988.08, "text": " objects and of of people sorry of people and of being eaten right being eaten or" }, { "start": 988.08, "end": 995.2, "text": " needing to eat food right humans lit grew up and live in this world your" }, { "start": 995.2, "end": 1003.0400000000001, "text": " brain was literally structured according to these things and thus we understand" }, { "start": 1003.0400000000001, "end": 1007.9200000000001, "text": " everything with an eye to this grounded knowledge of reality where there is" }, { "start": 1007.9200000000001, "end": 1015.24, "text": " such a thing as objects now if you have image net and you train a classifier for" }, { "start": 1015.24, "end": 1020.24, "text": " objects right this is what I find so crazy right and in the you know you" }, { "start": 1020.24, "end": 1027, "text": " collect this thing and there's a car and you say that's a car right you know this" }, { "start": 1027, "end": 1033, "text": " is a car because there is an object of a car and and and but the the neural" }, { "start": 1033, "end": 1037.84, "text": " network is not does not have a bias for object in neural network simply sees" }, { "start": 1037.84, "end": 1045.08, "text": " these pixels same here what you will do immediately here is you'll recognize the" }, { "start": 1045.08, "end": 1051.84, "text": " object of the star right you will transform this into a 3d scene right" }, { "start": 1051.84, "end": 1060.84, "text": " into a 3d cube where you are here watching in 3d space and there is this" }, { "start": 1060.84, "end": 1067.72, "text": " star object somewhere here right and then you understand that the star could" }, { "start": 1067.72, "end": 1071.48, "text": " move around then it would still be the same star but that's because you have" }, { "start": 1071.48, "end": 1076.88, "text": " the inherent bias of there being objects and shape for example the word shape is" }, { "start": 1076.88, "end": 1083.56, "text": " nothing more than a property of an object and the neural network simply do" }, { "start": 1083.56, "end": 1093.48, "text": " not have a inherent bias for objects right or people or intent or what it" }, { "start": 1093.48, "end": 1099.48, "text": " means to eat right this this becomes super super obvious if you ever try to" }, { "start": 1099.48, "end": 1106.56, "text": " solve for example a jigsaw puzzle you know like these these things here I'm" }, { "start": 1106.56, "end": 1115.08, "text": " terrible at this if you solve this on its head right say this has like a face" }, { "start": 1115.08, "end": 1120.92, "text": " on it and you try to solve it like this and you try to solve it on its head like" }, { "start": 1120.92, "end": 1126.88, "text": " try it you'll do it's the same task you simply need to match the the border" }, { "start": 1126.88, "end": 1131.92, "text": " shapes right and you need to make sure that the lines are continuous of the" }, { "start": 1131.92, "end": 1141.16, "text": " picture it becomes so much harder just because you have this brain and so that" }, { "start": 1141.16, "end": 1147.24, "text": " is my my entire criticism and it will it will pull through this entire paper and" }, { "start": 1147.24, "end": 1153.0400000000002, "text": " we'll go through it for now relatively quickly because we've already like" }, { "start": 1153.04, "end": 1159.52, "text": " touched touched on it keep in mind this is my commentary on it this is not" }, { "start": 1161, "end": 1167.84, "text": " superior superior knowledge or something that's just me all right so what they do" }, { "start": 1167.84, "end": 1173.2, "text": " is they have this taxonomy of decision rules that they they point out what" }, { "start": 1173.2, "end": 1179.34, "text": " they're saying is okay you're you these there's a set of all possible decision" }, { "start": 1179.34, "end": 1184.6399999999999, "text": " rules right and this is the this is the outer set here all possible decision" }, { "start": 1184.6399999999999, "end": 1189.24, "text": " rules that one could think of to discriminate data and let's say we'll" }, { "start": 1189.24, "end": 1194.08, "text": " talk about images here right to to discriminate images most of them will" }, { "start": 1194.08, "end": 1198.48, "text": " just be crap and these will be using these uninformative features what they" }, { "start": 1198.48, "end": 1203.3999999999999, "text": " say but then there are some decision rules that perform well on training data" }, { "start": 1203.4, "end": 1209.8000000000002, "text": " right this is this big circle here right so that there are some decision rules" }, { "start": 1209.8000000000002, "end": 1216.44, "text": " that perform well on the training set and they call these overfitting features" }, { "start": 1216.44, "end": 1222.8400000000001, "text": " so these are all the features that perform well on the training set only on" }, { "start": 1222.8400000000001, "end": 1227.6000000000001, "text": " the training set sorry the overfitting features but to me it's it's a bit" }, { "start": 1227.6000000000001, "end": 1232.2800000000002, "text": " unclear I think they only call this band the overfitting features but they call" }, { "start": 1232.28, "end": 1237.56, "text": " the entire circle the all possible training solutions any case so there are" }, { "start": 1237.56, "end": 1241.16, "text": " decision rules that perform well on the training set but some of them are" }, { "start": 1241.16, "end": 1247.62, "text": " overfitting as you know that problem right then the next circle inside of" }, { "start": 1247.62, "end": 1253.96, "text": " that are all decision rules that perform well on the training set and the IID" }, { "start": 1253.96, "end": 1260.08, "text": " test set and this would be our our location classifier from before would" }, { "start": 1260.08, "end": 1268.6399999999999, "text": " fall into this category right and now there these are still a much larger set" }, { "start": 1268.6399999999999, "end": 1275.28, "text": " as you see here as this inside set of the intended solution performs well on" }, { "start": 1275.28, "end": 1280.76, "text": " training set IID and all relevant out-of-distribution test sets and they" }, { "start": 1280.76, "end": 1284.9199999999998, "text": " draw this in here the out-of-distribution test sets are subsets of" }, { "start": 1284.92, "end": 1293, "text": " the IID test set or the sorry the solutions that work on the OOD test sets" }, { "start": 1293, "end": 1298.88, "text": " are subsets of the solutions that work well on the IID test sets I don't have a" }, { "start": 1298.88, "end": 1305.0800000000002, "text": " problem with this characterization of decision rules right here is" }, { "start": 1305.0800000000002, "end": 1310, "text": " specifically these are decision rules what I have a problem of characterization" }, { "start": 1310, "end": 1318.96, "text": " with is the fact that you cannot specify what the intended solution is you cannot" }, { "start": 1318.96, "end": 1325.48, "text": " and therefore this diagram I think is misleading because you have ultimately" }, { "start": 1325.48, "end": 1331.12, "text": " you have no idea where this dot is right you you can't you can't specify it" }, { "start": 1331.12, "end": 1336.08, "text": " beforehand you can't even specify the rules how you get there all you can do" }, { "start": 1336.08, "end": 1340.6, "text": " is give better data and they kind of advocate for this here with these OOD" }, { "start": 1340.6, "end": 1345.6, "text": " test sets but again I think when they say all relevant out-of-distribution test" }, { "start": 1345.6, "end": 1353.32, "text": " sets I'm a bit I'm a bit wary because they they suggest this as one of the" }, { "start": 1353.32, "end": 1357.52, "text": " measures to assess whether or not a model has learned these shortcut rules" }, { "start": 1357.52, "end": 1363.54, "text": " is to measure its performance on out-of-distribution test sets and this is" }, { "start": 1363.54, "end": 1372.96, "text": " very much like the contrast sets in in in the NLP but I I think actually this" }, { "start": 1372.96, "end": 1379.28, "text": " is a pretty pretty pretty pretty bad solution in most cases and let me" }, { "start": 1379.28, "end": 1387.36, "text": " explain why so if we go back to here right what we saw is that these these" }, { "start": 1387.36, "end": 1395.76, "text": " discrepancy it comes about because here from the real world we produce the data" }, { "start": 1395.76, "end": 1400.9199999999998, "text": " in a very specific form right and then this other out-of-distribution test set" }, { "start": 1400.9199999999998, "end": 1408.52, "text": " is produced in a slightly different form right now what you can think of this is" }, { "start": 1408.52, "end": 1414.32, "text": " if you look at your cost function that you train right what usually says my" }, { "start": 1414.32, "end": 1425.8, "text": " cost function is some sort of a loss for my data points and my labels right but" }, { "start": 1425.8, "end": 1430.6799999999998, "text": " this is often left out I mean you write it in your introductory classes what is" }, { "start": 1430.6799999999998, "end": 1436.52, "text": " important is that this is an expected loss that you're minimizing here over a" }, { "start": 1436.52, "end": 1444.72, "text": " data distribution right over X and Y sampled from a particular data" }, { "start": 1444.72, "end": 1451.92, "text": " distribution now when you talk about this this out-of-distribution classifiers" }, { "start": 1451.92, "end": 1457.76, "text": " what you'll have is you'll have a slightly different data distribution D" }, { "start": 1457.76, "end": 1467.4, "text": " prime right so but if you simply have one out of distribution thing think of" }, { "start": 1467.4, "end": 1474, "text": " this as the contrast set right if you haven't seen the video about contrast" }, { "start": 1474, "end": 1478.32, "text": " sets it's it's basically an out handcrafted out of distribution test" }, { "start": 1478.32, "end": 1488.24, "text": " set right my problem with this it's just one it's one it's a single one and I I" }, { "start": 1488.24, "end": 1493.8799999999999, "text": " think even if you try ten of them ten of those sets you won't even get close to a" }, { "start": 1493.8799999999999, "end": 1502, "text": " true measure because so the cool thing about an IID test set is at least it is" }, { "start": 1502, "end": 1507.04, "text": " precisely the same distribution right so it kind of gives you an unbiased number" }, { "start": 1507.04, "end": 1512.8, "text": " that for this particular data generation pipeline you get this number if you" }, { "start": 1512.8, "end": 1519.04, "text": " evaluate on an out-of-distribution test set you now have two effects you first" }, { "start": 1519.04, "end": 1528.8, "text": " have this generalization effect and you have the effect of having produced this" }, { "start": 1528.8, "end": 1534.04, "text": " in a different fashion here but you only have one of them what you would like to" }, { "start": 1534.04, "end": 1543.96, "text": " do is you would what you would like to assess is your loss of X and Y in" }, { "start": 1543.96, "end": 1553.84, "text": " expectation with X and Y coming from data in expectation let me a different" }, { "start": 1553.84, "end": 1560.6399999999999, "text": " color in expectation with your data distribution coming from all possible" }, { "start": 1560.64, "end": 1565.8000000000002, "text": " data distributions in the real world right that's what you would like to to" }, { "start": 1565.8000000000002, "end": 1573.0400000000002, "text": " say to do now if you only have a single contrast set it is a kin you can think" }, { "start": 1573.0400000000002, "end": 1579.8000000000002, "text": " of what if like how how well how well of a machine learning engineer would I be" }, { "start": 1579.8000000000002, "end": 1589.2, "text": " if my test set here only had one sample right so so I give you a train and the" }, { "start": 1589.2, "end": 1595.04, "text": " test set and I'm saying your performance will be if I make a Kaggle challenge and" }, { "start": 1595.04, "end": 1601.88, "text": " I say your performance will be evaluated on this one single sample test set right" }, { "start": 1601.88, "end": 1607.32, "text": " that's basically what you're doing if you have a single OOD test set is you're" }, { "start": 1607.32, "end": 1613.8, "text": " saying I'm going to give you one out-of-distribution data set that I have" }, { "start": 1613.8, "end": 1620.9199999999998, "text": " biased in one particular way right and will measure how well you capture our" }, { "start": 1620.9199999999998, "end": 1628.56, "text": " intent right our shape classifier intent will measure how well you capture that" }, { "start": 1628.56, "end": 1634.96, "text": " using this one single out-of-distribution thing I think what that" }, { "start": 1634.96, "end": 1642.52, "text": " will do is right you say I want to approximate this by a sum of I equals" }, { "start": 1642.52, "end": 1652.52, "text": " one to one that will just pump the variance beyond what beyond any" }, { "start": 1652.52, "end": 1658.68, "text": " reasonable meaning that the upcoming number will will be able to give you" }, { "start": 1658.68, "end": 1665.32, "text": " what you'd have to do is you'd have to have this entire process and sample" }, { "start": 1665.32, "end": 1670.76, "text": " train and test sets according to this day or at least test sets according to" }, { "start": 1670.76, "end": 1676.12, "text": " this data distribution this underlying data distribution which you have no clue" }, { "start": 1676.12, "end": 1682.8799999999999, "text": " what it is because if you could specify this directly you could get the solution" }, { "start": 1682.8799999999999, "end": 1688.16, "text": " for free right if you could specify the underlying mechanism you could you you" }, { "start": 1688.16, "end": 1693.5, "text": " would already know the solution you would need machine learning so I think" }, { "start": 1693.5, "end": 1698.68, "text": " the model puts like way too little emphasis sorry the paper puts a bit too" }, { "start": 1698.68, "end": 1704.8, "text": " little emphasis suffice to say they with their taxonomy they can say if you use" }, { "start": 1704.8, "end": 1710.44, "text": " for example only the overfitting features right then you will do well on" }, { "start": 1710.44, "end": 1716.6000000000001, "text": " the training set but not on the IID and OD test sets if you use the intended" }, { "start": 1716.6000000000001, "end": 1721.72, "text": " features again intended no one knows what that is no one can specify it you'll" }, { "start": 1721.72, "end": 1726.98, "text": " do well on all the OD test sets if you use the shortcut features you will do" }, { "start": 1726.98, "end": 1732.44, "text": " well on the training and ID test set but not on the OD test this is valid right" }, { "start": 1732.44, "end": 1737.64, "text": " I'm not discrediting this paper here and they do allude to a lot of the things" }, { "start": 1737.64, "end": 1744.28, "text": " I'm saying but not not all and I don't think they frame it correctly so they" }, { "start": 1744.28, "end": 1747.76, "text": " ask shortcuts where do they come from and they say a lot of the things that" }, { "start": 1747.76, "end": 1754.8, "text": " I've been saying here but for example they ask what makes a cow a cow and they" }, { "start": 1754.8, "end": 1760.08, "text": " give this example here where they say familiar background can be as important" }, { "start": 1760.08, "end": 1764.52, "text": " for recognition to deep neural networks where the deep neural networks will" }, { "start": 1764.52, "end": 1770.52, "text": " misclassify this picture because they used to seeing a cow in grass now" }, { "start": 1770.52, "end": 1775.12, "text": " consider this in our framework right if let's say this is an image net" }, { "start": 1775.12, "end": 1781.96, "text": " classifier image net is not an object classifier it is not right that's what" }, { "start": 1781.96, "end": 1787.44, "text": " we say that's our intent but what it is it is a classifier if you go through the" }, { "start": 1787.44, "end": 1792.4, "text": " pipeline what how do you generate the data image net is a classifier of" }, { "start": 1792.4, "end": 1800.88, "text": " naturally taken images right with a certain camera cropped center cropped to" }, { "start": 1800.88, "end": 1806.2, "text": " a particular object labeled by human radars filtered in some capacity right" }, { "start": 1806.2, "end": 1812.44, "text": " from flickr and for that particular data set we train a classifier it is not an" }, { "start": 1812.44, "end": 1817.2, "text": " object classifier it is a classifier for that and it doesn't has no clue of" }, { "start": 1817.2, "end": 1824.0800000000002, "text": " objects so in fact and also what you have to see is that the output isn't" }, { "start": 1824.0800000000002, "end": 1828.32, "text": " even if the output is shape it isn't shape it is actually probability of" }, { "start": 1828.32, "end": 1837.2, "text": " shape right or probability of object or probability of something right and it is" }, { "start": 1837.2, "end": 1843.76, "text": " completely conceivable right that if it's not grass in the background it's" }, { "start": 1843.76, "end": 1850.08, "text": " probably not as much a cow now I see the problem here this is clearly a cow and" }, { "start": 1850.08, "end": 1857.4399999999998, "text": " this is actually a conceivable natural image but imagine a picture of the cow" }, { "start": 1857.44, "end": 1864.8, "text": " oops what happened on the moon right this is the moon and here's the cow" }, { "start": 1864.8, "end": 1877.44, "text": " cow moo this is terrible horns tell a cow on the moon like who can fault the" }, { "start": 1877.44, "end": 1883.16, "text": " neural network it it it and I would say that's not a cow either because it in" }, { "start": 1883.16, "end": 1889.0400000000002, "text": " terms of the data generation process if you ask me please classify this as a" }, { "start": 1889.0400000000002, "end": 1893.5600000000002, "text": " natural image that has been taken blah blah blah blah blah right I'm gonna say" }, { "start": 1893.5600000000002, "end": 1897.4, "text": " there's no way there's a cow on the moon so I don't know what this is but it is" }, { "start": 1897.4, "end": 1903.5600000000002, "text": " very improbable that this is a cow right because all the training examples I've" }, { "start": 1903.5600000000002, "end": 1912.3200000000002, "text": " seen cow on grass so yeah so I mean they do they do actually allude to this" }, { "start": 1912.32, "end": 1920.2, "text": " right they call this data set biases and so on but I'm pretty sure that yet the" }, { "start": 1920.2, "end": 1925.8, "text": " interpretation is just a bit off where they say they the stat the point of this" }, { "start": 1925.8, "end": 1931.72, "text": " is like ah it's it's you know we want an object classifier but this we want the" }, { "start": 1931.72, "end": 1938.4399999999998, "text": " second I find even more kind of strange is they say shortcuts from discriminative" }, { "start": 1938.44, "end": 1944.44, "text": " learning and they allude to this picture here and they ask what makes a cat a cat" }, { "start": 1944.44, "end": 1948.4, "text": " and they basically their argument is that the neural networks they don't" }, { "start": 1948.4, "end": 1952.8400000000001, "text": " understand things they just discriminate right they have these thousand classes" }, { "start": 1952.8400000000001, "end": 1957.1200000000001, "text": " and the output layer this is the neural network and they just need to" }, { "start": 1957.1200000000001, "end": 1962.3200000000002, "text": " discriminate so they just need to learn what is different from one class to the" }, { "start": 1962.32, "end": 1970.76, "text": " other class and they will often rely on features such as texture like here so" }, { "start": 1970.76, "end": 1975.28, "text": " they rely on detection they classify this as an elephant right so they say" }, { "start": 1975.28, "end": 1979.04, "text": " what makes a cat a cat to standard DNNs the example image on the left clearly" }, { "start": 1979.04, "end": 1988.52, "text": " shows an elephant not a cat and again I agree if you tell me this is data from" }, { "start": 1988.52, "end": 1996.48, "text": " naturally to it taken images with standard cameras right then I will I" }, { "start": 1996.48, "end": 2002.4, "text": " will have two possibilities I will say is this a cat there's no way that if you" }, { "start": 2002.4, "end": 2007.8799999999999, "text": " take anywhere in the universe a picture with a like a phone camera of anything" }, { "start": 2007.8799999999999, "end": 2014.72, "text": " of a cat it will look like this no way I don't like this just not possible right" }, { "start": 2014.72, "end": 2025.56, "text": " however is it possible that there is an elephant that as a skin fold pattern by" }, { "start": 2025.56, "end": 2036.56, "text": " random chance elephant big ears raw trunk as a skin fold pattern looks like" }, { "start": 2036.56, "end": 2043.2, "text": " a cat like looks like the shape of a cat yes that's possible so if you ask me" }, { "start": 2043.2, "end": 2050.2, "text": " according to the data generation process this is way more likely to be an elephant" }, { "start": 2050.2, "end": 2056.4, "text": " than a cat right and the paper here makes it seem like it is so" }, { "start": 2056.4, "end": 2061.6, "text": " obvious that this is a cat but what do these standard stupid DNNs think it's an" }, { "start": 2061.6, "end": 2066.76, "text": " elephant not a cat and the DNN oh it's just looking at object text and other" }, { "start": 2066.76, "end": 2072.52, "text": " local structures and not that shape right what we like what we wanted to do" }, { "start": 2072.52, "end": 2078.48, "text": " and this this is I find just stop calling things object classifiers if" }, { "start": 2078.48, "end": 2082.6, "text": " they're not object classifiers that classifier between images of a data" }, { "start": 2082.6, "end": 2089.08, "text": " generation process if you want them to be object classifiers make up a data set" }, { "start": 2089.08, "end": 2096.72, "text": " that actually has different objects but you can't specify that so yeah and then" }, { "start": 2096.72, "end": 2102.9199999999996, "text": " they go into some sort of adversarial examples and I find this to be I also" }, { "start": 2102.9199999999996, "end": 2108.9199999999996, "text": " find this to be a bit maybe not belonging here like where they say oh" }, { "start": 2108.9199999999996, "end": 2114.8399999999997, "text": " look here the DNNs predict guitar with high certainty again it's just a" }, { "start": 2114.8399999999997, "end": 2121.24, "text": " discriminator but this this pattern why not a guitar if you had to you know if" }, { "start": 2121.24, "end": 2125.3199999999997, "text": " you had to get one of the thousand classes out why it could this not be" }, { "start": 2125.32, "end": 2131.2400000000002, "text": " most likely a guitar but I have a further problem with this is I see I" }, { "start": 2131.2400000000002, "end": 2137.76, "text": " kind of see this in so what what would you have is I ID data let's go with" }, { "start": 2137.76, "end": 2141.6800000000003, "text": " their taxonomy and say I ID data has from from the same generation process" }, { "start": 2141.6800000000003, "end": 2150.04, "text": " and then there is OOD data now I think there are a number of effects here that" }, { "start": 2150.04, "end": 2155.2000000000003, "text": " they try to lump together with this thing where they just say oh oh D data" }, { "start": 2155.2, "end": 2158.68, "text": " whenever my model doesn't work on OOD data it has learned a shortcut but it's" }, { "start": 2158.68, "end": 2165.52, "text": " very very weird so first of all there I would say the OOD data you can probably" }, { "start": 2165.52, "end": 2172.6, "text": " divide into what I would call unnatural OOD data let's say our task here is to" }, { "start": 2172.6, "end": 2177.68, "text": " build an object an object detector whatever that means for natural images" }, { "start": 2177.68, "end": 2183.3599999999997, "text": " so then there's unnatural OOD data which which in here you'll find something" }, { "start": 2183.36, "end": 2189.08, "text": " like adversarial examples adversarial examples are constructed at least if you" }, { "start": 2189.08, "end": 2194.3, "text": " go by the interpretation of modri and adversarial examples are features not" }, { "start": 2194.3, "end": 2199.56, "text": " bugs then you'll go into the direction of adversarial examples actually" }, { "start": 2199.56, "end": 2206.4, "text": " constructed by combining features that don't naturally go together so you'll" }, { "start": 2206.4, "end": 2213.4, "text": " you'll get the low frequency features of a cat and add the high frequency for" }, { "start": 2213.4, "end": 2219.6800000000003, "text": " example features of a dog so much with this with this lambda factor here so" }, { "start": 2219.6800000000003, "end": 2224.52, "text": " high that it to a DNN it looks like a dog because it has many of the features" }, { "start": 2224.52, "end": 2228.76, "text": " but to a human that kind of ignores the high frequency features it'll look like" }, { "start": 2228.76, "end": 2235.44, "text": " a cat right but these are unnatural because the features in actual nature in" }, { "start": 2235.44, "end": 2242.32, "text": " the real world they never occur in this combination so it seems like this is a" }, { "start": 2242.32, "end": 2250.96, "text": " very very very different phenomenon from what I would call natural OOD OOD data" }, { "start": 2250.96, "end": 2257.04, "text": " where simply the the features that you're seeing have never occurred in the" }, { "start": 2257.04, "end": 2262.48, "text": " training data set but there is there is if you go from the real world and you" }, { "start": 2262.48, "end": 2269.84, "text": " construct in different ways data set there is some data set where where the" }, { "start": 2269.84, "end": 2274.48, "text": " where the data actually occurs in the way that you have here so natural OOD" }, { "start": 2274.48, "end": 2280.64, "text": " data is what most of the examples for now were were about like a cow on the" }, { "start": 2280.64, "end": 2284.56, "text": " beach it's just because you've never you've never seen that because your data" }, { "start": 2284.56, "end": 2290.96, "text": " generation here always get cow plus grass right so I think these are very" }, { "start": 2290.96, "end": 2296.88, "text": " different and then the last thing they also lump in here is fairness like the" }, { "start": 2296.88, "end": 2302.2400000000002, "text": " the fairness and bias literature where for example you have a resume classifier" }, { "start": 2302.2400000000002, "end": 2307.56, "text": " and the resume classifier ends up being biased by gender or something like this" }, { "start": 2307.56, "end": 2316.64, "text": " and again so I I kind of struggle with this although they say not all the" }, { "start": 2316.64, "end": 2320.8, "text": " fairness problems come from here but I would also like to stress that some of" }, { "start": 2320.8, "end": 2328.1200000000003, "text": " the fairness problem goes exactly here it occurs because your data generation" }, { "start": 2328.1200000000003, "end": 2334.04, "text": " process is different from what you want for example if you do this this hiring" }, { "start": 2334.04, "end": 2341.38, "text": " classifier you have to understand what that is what your training is a system" }, { "start": 2341.38, "end": 2346.44, "text": " that will tell you how would my human data set creators have decided on this" }, { "start": 2346.44, "end": 2351.06, "text": " particular application now of course there is this problem of bias amplification" }, { "start": 2351.06, "end": 2354.96, "text": " and so on but it is not it is not an infallible system it simply tells you" }, { "start": 2354.96, "end": 2358.68, "text": " how the humans would have predicted if you collect the data set in a biased way" }, { "start": 2358.68, "end": 2366.44, "text": " of course the the machine will inherit that but on the other hand the fairness" }, { "start": 2366.44, "end": 2373.48, "text": " why I don't think this really belongs in here because in fairness you have a you" }, { "start": 2373.48, "end": 2379.44, "text": " actually have kind of an alternate world draw this in green prime world prime" }, { "start": 2379.44, "end": 2387.2400000000002, "text": " right where in this OOD and IID setting you always assume that the world is is" }, { "start": 2387.2400000000002, "end": 2393.96, "text": " the world and you want to kind of really learn a system that understands the" }, { "start": 2393.96, "end": 2404.68, "text": " world where in fairness you this here this is your super world so actually for" }, { "start": 2404.68, "end": 2409.56, "text": " the fairness literature it doesn't really matter if in the real world to" }, { "start": 2409.56, "end": 2414.32, "text": " let's say two groups of people are equal in some respect or not equal in the true" }, { "start": 2414.32, "end": 2419.44, "text": " world right what they care about is that they are treated equally by the system" }, { "start": 2419.44, "end": 2427.7200000000003, "text": " right so they will impose they will impose some restrictions or some some" }, { "start": 2427.7200000000003, "end": 2433.36, "text": " some condition on their model and they don't they don't naturally I'm like this" }, { "start": 2433.36, "end": 2438.36, "text": " sounds bad but it is the mathematical formulation is such that you start with" }, { "start": 2438.36, "end": 2445, "text": " the super knowledge of two things must be equal and then you this is how you" }, { "start": 2445, "end": 2450.24, "text": " imagine your world you think I know the world and then I try to learn the model" }, { "start": 2450.24, "end": 2455.92, "text": " such that that happens right whereas over here you do something different now" }, { "start": 2455.92, "end": 2461.88, "text": " some of it is in as I said is in the same category but it is I think a" }, { "start": 2461.88, "end": 2470.76, "text": " different different take and a different literature so I would I would focus on" }, { "start": 2470.76, "end": 2479, "text": " let's say this part right here sorry on this part and not on the adversarial" }, { "start": 2479, "end": 2487.88, "text": " examples and also not in the fairness literature too much alright so yeah you" }, { "start": 2487.88, "end": 2494.1600000000003, "text": " can see here like like no wonder this this and this screws up and this screws" }, { "start": 2494.16, "end": 2502.7999999999997, "text": " up an image net classifier yeah and even even this like how do we know that that" }, { "start": 2502.7999999999997, "end": 2507.2, "text": " is naturally natural though I can see that that is that looks pretty natural" }, { "start": 2507.2, "end": 2512.48, "text": " but still it's probably like really specifically constructed such that the" }, { "start": 2512.48, "end": 2517.68, "text": " probability that someone would take this picture with a camera in the real world" }, { "start": 2517.68, "end": 2529.7999999999997, "text": " is zero cool so they give some examples where they say okay shortcut learning" }, { "start": 2529.7999999999997, "end": 2534.8799999999997, "text": " exists in computer vision for example adversarial examples you see shifting" }, { "start": 2534.8799999999997, "end": 2538.3599999999997, "text": " the image by a few pixels though you have to say shifting the image very" }, { "start": 2538.3599999999997, "end": 2542.52, "text": " precisely by a few pixels such that the probability of this occurring the data" }, { "start": 2542.52, "end": 2551.08, "text": " generation pipeline is zero and so on then they call it domain transfer that" }, { "start": 2551.08, "end": 2557.08, "text": " that of course is I think that's the that's a good example they say natural" }, { "start": 2557.08, "end": 2563.64, "text": " language processing where BERT has been found to rely on superficial keywords for" }, { "start": 2563.64, "end": 2568.44, "text": " instance it learned within a data set of natural language arguments detecting the" }, { "start": 2568.44, "end": 2572.96, "text": " presence of not was sufficient to perform above chance in finding the" }, { "start": 2572.96, "end": 2578.52, "text": " correct line of argumentation again this is like all we can do is construct" }, { "start": 2578.52, "end": 2587.32, "text": " datasets we cannot if we could tell the model what to look at we would we would" }, { "start": 2587.32, "end": 2592.92, "text": " we would just program the solution so the solution is there's only one" }, { "start": 2592.92, "end": 2598.6800000000003, "text": " solution program better datasets get better datasets or I mean okay the" }, { "start": 2598.6800000000003, "end": 2603.36, "text": " second solution is get better inductive biases but if we knew the correct" }, { "start": 2603.36, "end": 2613.4, "text": " inductive biases we wouldn't have the problem yeah I like that there is a in" }, { "start": 2613.4, "end": 2618.44, "text": " NLP this is very this is very very prevalent even more than in vision" }, { "start": 2618.44, "end": 2627.48, "text": " right this this fact of hey these spurious correlations in NLP the models" }, { "start": 2627.48, "end": 2632.52, "text": " usually just learn kind of correlation between some words and then they they" }, { "start": 2632.52, "end": 2637.52, "text": " don't learn to understand the sentences at all right but this this is because in" }, { "start": 2637.52, "end": 2641.96, "text": " NLP we have even more problems with constructing datasets that force the" }, { "start": 2641.96, "end": 2648.16, "text": " model to learn to understand the the text again I could not tell you what" }, { "start": 2648.16, "end": 2654.52, "text": " understanding the text means they go in by the way humans do that too humans" }, { "start": 2654.52, "end": 2660, "text": " most in most of NLP that happens in humans humans do this right in many many" }, { "start": 2660, "end": 2664.52, "text": " many forms this is simply because the cost function is not aligned with what" }, { "start": 2664.52, "end": 2673.3599999999997, "text": " you would want what is the specific oh well a specific example is that news" }, { "start": 2673.36, "end": 2680.32, "text": " stories nowadays right you have a news you say news what do people expect what" }, { "start": 2680.32, "end": 2685.1200000000003, "text": " is the intent of news the intent of news is to inform you maybe but the cost" }, { "start": 2685.1200000000003, "end": 2694.04, "text": " right the cost function is clicks so what do you do you news story and very" }, { "start": 2694.04, "end": 2702.6, "text": " on the top in the title you say orange man bad and then people and you highlight" }, { "start": 2702.6, "end": 2707.7599999999998, "text": " this right so a news story I don't know Brad Pitt had a new baby you just append" }, { "start": 2707.7599999999998, "end": 2713.52, "text": " but orange man bad people click on it much more your cost goes up and sorry" }, { "start": 2713.52, "end": 2719.52, "text": " your clicks go up your cost function goes up and so I think this happens" }, { "start": 2719.52, "end": 2724.96, "text": " everywhere right you can't even do this with humans right how do you expect" }, { "start": 2724.96, "end": 2733.12, "text": " neural networks to to do that all right agent based reinforcement learning I" }, { "start": 2733.12, "end": 2743.56, "text": " think this pretty funny where is it where it learned how to play Tetris yeah" }, { "start": 2743.56, "end": 2747.8, "text": " instead of learning how to play Tetris an algorithm simply learned to pause the" }, { "start": 2747.8, "end": 2760.8, "text": " game to fit come on is genius right like it is objectively genius and then of" }, { "start": 2760.8, "end": 2765, "text": " course fairness and algorithmic decision-making right so they say" }, { "start": 2765, "end": 2770.7200000000003, "text": " understanding these shortcuts and they they touch on a lot of the things that" }, { "start": 2770.72, "end": 2780.2799999999997, "text": " I've touched on including these what I find what I find well is for example this" }, { "start": 2780.2799999999997, "end": 2783.56, "text": " Morgan's can for machine learning where you say probably a machine learning" }, { "start": 2783.56, "end": 2788.9199999999996, "text": " system will learn the easiest feature it can and that's oftentimes not what you" }, { "start": 2788.9199999999996, "end": 2794.2799999999997, "text": " want right so this even now amplifies things they also touch on this thing of" }, { "start": 2794.28, "end": 2800.92, "text": " anthropomorphism where you view everything through a human lens and that" }, { "start": 2800.92, "end": 2806.44, "text": " is not correct if you look at these neural networks they're not humans and" }, { "start": 2806.44, "end": 2812.48, "text": " we should never attribute human nests to their solutions never attribute to high" }, { "start": 2812.48, "end": 2815.96, "text": " level abilities that which can be adequately explained by shortcut" }, { "start": 2815.96, "end": 2821, "text": " learning yes I agree with this like I agree with this paper in in all the" }, { "start": 2821, "end": 2827.04, "text": " things it says right except this detecting shortcuts making od" }, { "start": 2827.04, "end": 2832.12, "text": " generalization tests a standard practice for the reasons I specified before I" }, { "start": 2832.12, "end": 2838.52, "text": " think that is counterproductive and yeah I think I've already said enough" }, { "start": 2838.52, "end": 2844.58, "text": " right designing good od tests this you can only design good od tests if you" }, { "start": 2844.58, "end": 2853, "text": " know the real underlying data distribution which you don't and let's" }, { "start": 2853, "end": 2856.88, "text": " go through yeah again the principle of least effort they say why are they" }, { "start": 2856.88, "end": 2865.84, "text": " learned because it's just easier right to it's just easier to write a news story" }, { "start": 2865.84, "end": 2872.3199999999997, "text": " with just the words you know people will click on right like or these top 10" }, { "start": 2872.32, "end": 2877, "text": " things of blah blah blah number seven will surprise you you don't actually" }, { "start": 2877, "end": 2883.7200000000003, "text": " have to come up with 10 relevant things the entire title is enough to get you" }, { "start": 2883.7200000000003, "end": 2890.8, "text": " the clicks so it's the least effort to solve the cost function might not align" }, { "start": 2890.8, "end": 2898.36, "text": " with what you want and also the inductive biases as I said we are humans" }, { "start": 2898.36, "end": 2904, "text": " we have some inductive biases the neural networks don't have them and we need to" }, { "start": 2904, "end": 2910.28, "text": " take this into account but the solution is to make training data sets that take" }, { "start": 2910.28, "end": 2917, "text": " this into account all right they say beyond shortcut learnings is kind of an" }, { "start": 2917, "end": 2925.04, "text": " outlook and then a conclusion where they remind but we're already at some 45" }, { "start": 2925.04, "end": 2930.7599999999998, "text": " minutes of video and if you're still here like respect or maybe you just have" }, { "start": 2930.7599999999998, "end": 2935.96, "text": " this in the background and have some company during this time I will finish" }, { "start": 2935.96, "end": 2942.92, "text": " with saying thank you for watching and leave your comments since this is mostly" }, { "start": 2942.92, "end": 2949.56, "text": " opinion I would be interested in hearing your comments on this with that I say" }, { "start": 2949.56, "end": 2955.36, "text": " bye bye" } ]
Ok44otx90D4
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Feature Visualization & The OpenAI microscope
[ "Science & Technology" ]
[ "deep learning", "machine learning", "imagenet", "visualization", "features", "intermediate", "hidden layers", "activations", "patterns", "openai", "google", "interactive", "explanation" ]
A closer look at the OpenAI microscope, a database of visualizations of the inner workings of ImageNet classifiers, along with an explanation of how to obtain these visualizations. https://distill.pub/2017/feature-visualization/ https://microscope.openai.com/models https://github.com/tensorflow/lucid 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 look at the OpenAI microscope and this article on Distill called Feature Visualization. So the Feature Visualization article is by Chris Ola, Alexander Mortwintsev and Ludwig Schubert of the Google Brain team, while the OpenAI microscope is by OpenAI. So keep that in mind. These tools are tools for visualizing what neural networks learn and specifically here we're dealing with image classifiers and even more specifically ImageNet classifiers. So you know ImageNet is this big data set with a thousand classes of images and the images are somewhat like 200 by 200 pixels and you're just supposed to put them into one of these 1000 classes and networks have become really good at these kinds of things. So our question is what do these networks learn? And there are a number of very cool works that have started to investigate what these networks learn. So this started with work like Deep Dream or even before that but this is a very good summary and also an overview of this. So in this article they first showcase these patterns here where you can see that as you go through the network in the layer, this is layer conf2d0, which is a very low layer in the network, you have things what looks like pattern, just pattern detectors. So these are the things that the network is excited by and we'll just get, we'll get in a second at how you create these things. Just be sure these are the things that these particular layers in the networks are most excited by. So this layer is super excited by these textures. But as you go higher the network gets excited by these kind of textures, then it gets excited by more complex things. So the pattern is the higher you go in the layers and these people have been seeing and claiming this and measuring this since RBF networks and whatnot, that the higher you go in these networks the more complex features that they build. So they always build hypothesis is they build very complex features from the lower layers and the lower layers they have less less complex features and until you're the very bottom layer they simply extract edges and patterns of texture like this. Whereas in the top layers all of these are hierarchically assembled to give you very very intricate features. So these usually look pretty funky that's why I like to investigate. So this article focuses on how is this done and the answer is by optimization. Now what do we mean? I actually have the article here somewhat printed out but the graphics they don't really print very well to the notebook here. So imagine this here. So what you want to do is you want to see how much activation is in the network for a particular input and you can do this in many many different ways. The easiest form, let's actually start over here, if you have a neural network here and this is the softmax classifier and these are the classes in this case let's say this is dog, this is cat and this is car, house. Let's go with house. You can think of okay I want to know when the network sees a cat. What does the network think of cats? So what I would do is I would take an image that is just noise, just random noise like this one on the left here and I would start to optimize using backpropagation. I would start to optimize this image. Now you usually know backpropagation as the thing that will optimize these weights if we have given an image and a label. But right now you have to, so and we optimize the weights here, sorry I should say that, but right now you have to rethink what we have given is the label and the weights. We keep them constant but we optimize the input image to maximize this label as much as possible. So we ask of xx please please update yourself such that the output is as much cat as possible. And then we just optimize for that. So we hope that this picture would turn out to be as much cat as we like. And usually here, I don't know exactly which class they have here, but you won't get a cat. Sorry over here. You won't get a cat or here if you optimize the logits it's the same, just you do the same thing before the softmax. What you will get is some weird trippy thing. So in our classifier you might get something like there's a cat here but there's also one here right because two cats are more cat than one cat and there's like a giant cat head here and inside the cat head there is another cat head and there's like a cat tail somewhere here and again there's a cat eye right here. So you get like something super trippy that is as much cat as possible. Alright now so this is somewhat interesting because you can find out what does the network think is the most cat-like thing there is and the most dog-like thing there is. But what you can also do is you can see what do the intermediate layers of the networks, what do they get excited by. So what you can do is for example you can take an individual neuron in one of the layers right so this here might be a convolutional layer with its convolutional filters right and these are the different channels of the convolutional layer and then this thing here is just a single neuron there and what you can do is you can say okay X we have now again we input the image X and we optimize the image X such that with a given weight this particular neuron let's call it N and N is maybe this neuron right here right this particular neuron is as much activated as possible right so we no longer optimize for a label but we optimize for a particular neuron to be activated as much as possible and then we can sort of see what is an image that activates this neuron as much as possible in this case that thing you can actually do the same thing with an entire channel if you simply say when is the channel as a whole activated as much as possible and something like deep dream did the same thing but with an entire layer in the neural network like what is this layer activated by they can imagine there's not only one image that activates it the most but probably depending on your start here it's it's it's a you'll get different different results for depending on where you start we'll go into that later as well so these are the kinds of things you can do to investigate these neural networks and see what they what they pay attention to in each of the layers right so let's go on here and so they say they say okay if we optimize by optimization you get something like this here on the bottom row looks pretty funky right but what you could also do is you can visualize by what there's called data set examples and date with data set examples you don't do this thing you don't do the optimization procedure but you go into your into your database into your data set and you find the images that activate so the XI from your data set that activate a particular neuron the most so you simply sort all the images in your database and you just pick the ten or so that activate that particular neuron the most and that would also give you an understanding it's actually a valid thing and the AI microscope combines both of them so on the bottom you see what particular neurons are most excited by and at the top you see that that the data set examples they're most excited by so you can see that there is a there's a healthy diversity in the data set examples but they also all kind of map to the to the what it's most excited by it's pretty cool the last point they make in this article is that of diversity with the data set examples you do get naturally sort of a diverse set of images of course where you can guess you can also say okay whether the maximum activations and only slightly positive you can even give negative examples but with the positive you can only either maximize fully or you can you know take the negative and you can say okay what is this neuron not excited by at all but you you won't get kind of a spectrum of what the neuron is excited by or the unit or the layer and what they're doing is simply they add a diversity term they say that works best so what does that mean it means that here if we optimize X and Y right let's go up here if we optimize X in that right and try to maximize the activation of n we don't want to do X by itself but we want to do is we want to do an entire set of X I right so we feed an entire mini batch in there and we want to maximize n but also maximize a diversity term let's call that D between X 1 to X be right so you want to maximize the activation of the neuron but at the same time in your loss function that you optimize you also have this diversity term where you say the images that you produce should be far apart from each other or kind of apart from each other and thus you do get diverse samples okay the printing again doesn't work so here you see that if you just simply optimize you get the thing on the left but if you have a batch of things and you optimize them to be diverse from each other but also activate the layer or the unit you get a variety of high activations and you can see here that this is some sort of curve this could be a beak of a bird but on the right here this could also be kind of a snout of a monkey or something okay so it's just curvy curvy things that is activated by here they give another example you can clearly see that there is like some sort of eye in the picture but then if you optimize with diversity you can see that some of them do not have this eye thing and in fact also some of the data set examples do not have this eye thing so it might be interesting to to to optimize here with diversity and even in they say in higher layers it gets even more more diverse with what you achieve with this ball detector they also say they research interactions between neurons where they can interpolate between them right so you can here have two different new units let's say this top left one here is the thing that we've just seen with the curvature activator and then on the right we can select this thing here that is appears to be activated by these bird like bird like things and if you optimize an image that activates both of them you get the thing on the bottom left and this is very good for understanding how neural networks work because what a neural network will do is exactly it will take the thing on the top left and the top right from lower layers and it will combine them to form features of higher layers so while the top right thing looks like generic birds the bottom left thing looks much more like birds with let's say long necks and then kind of curved necks so more stork ish birds right because we've added in this curvature thing so this is very very cool to play around you can also here interpolate between into neurons like you would interpolate in a in a GAN right and yeah so they do make a point of regularization I don't want to go into that particularly but you have to be careful you can't just apply the optimization procedure as I said right now you have to actually have to do some regularization and to get to get rid of what are essentially adversarial examples in this process because if you just straight-up optimize you will get pretty high frequency crappy results I actually want to jump over now to this OpenAI microscope so this is a tool that lets you explore these visualizations so at the beginning you can pick one of these models and I'll pick inception v1 just because some of the other ones they don't have everything done quite yet the all the all the all the visualization so on the right here you can actually see the architecture of the network if you know what an inception network is this what this looks like and you would be able from here to select one of these units straight away but I'm gonna sorry we're gonna go to the left here so you have deep dream activated which means the entire layer is optimized for so per layer on the right side you have an image here and you can already see that if we go from the bottom what we saw before we get patterns that become more and more complex as you go up the layers and then more and more until you finally have what the network appears to be most activated by is mostly dogs which is okay because image net is dominated by dogs so you can click on any of these right here like this one and now you'll be able to inspect the individual nodes in this layer so before we had the whole layer right the whole layer was activated by something but these layers they have different channels and also different neurons within the channel so you can select this here you can go neuron activation or channel activation and these are the images that these channels are excited by the most you see you get pretty funky pattern if we select one interesting one maybe this this one right here you can see on the left this is the channel optimizing optimization on the right this is the neuron optimization and here you get the data set examples that are most activated that mostly activate this particular channel or neuron so sorry this particular yeah channel so you can see this is pretty similar to the thing I drew where except for it being a cat it's some sort of a fox dog thing right and and you can explore the neural network in this fashion so you can go through the layer here and look at that good units this seems to be whiskers classifier and lo and behold things with whiskers will activate the the neuron and as you go up the layer and this is the the cool thing right so we're right now we're here in this layer for as you go up you will see more and more intricate patterns of activations I I could play around this for very very long time but I won't I won't waste your time too much they there is a dist sorry there is a slack workspace where people discuss interesting patterns what is this okay yes this is a some sort of temple temple constructor very cool there is a slack workspace where people discuss interesting things for example they discuss how the car detector that you see right here is one of the units there is literally endless units to look at that detects cars can be clearly seen to be built from lower level features such as this wheel detector you see this wheel detector here is the unit three three seven in the mixed four layer and this car hood detector right here is unit two three seven also in the in one of the layer fours right so these are both from layer four and then the car detector I haven't looked this up ah isn't layer four as well but let's check it out this isn't layer 4b this isn't layer 4b and this isn't layer 4c ah so you see I this was a risk the car detector is built from lower level features of car hood and car wheel right the car wheel right here detects wheels and the car hood detector detects hoods and then the car detector detects cars so there are very like I really invite you to go look at it check out what people find and explore these models all of this is based on this lucid library right here also invite you to check that out where you can perform such optimizations yourself I'll link to that and with that bye bye
[ { "start": 0, "end": 6.8, "text": " Hi there! Today we're going to take a look at the OpenAI microscope and this" }, { "start": 6.8, "end": 11.46, "text": " article on Distill called Feature Visualization. So the Feature" }, { "start": 11.46, "end": 17.72, "text": " Visualization article is by Chris Ola, Alexander Mortwintsev and Ludwig" }, { "start": 17.72, "end": 25.32, "text": " Schubert of the Google Brain team, while the OpenAI microscope is by OpenAI." }, { "start": 25.32, "end": 31.64, "text": " So keep that in mind. These tools are tools for visualizing what neural" }, { "start": 31.64, "end": 37.56, "text": " networks learn and specifically here we're dealing with image classifiers and" }, { "start": 37.56, "end": 41.879999999999995, "text": " even more specifically ImageNet classifiers. So you know ImageNet is this big" }, { "start": 41.879999999999995, "end": 47.2, "text": " data set with a thousand classes of images and the images are somewhat like" }, { "start": 47.2, "end": 51.84, "text": " 200 by 200 pixels and you're just supposed to put them into one of these" }, { "start": 51.84, "end": 59.120000000000005, "text": " 1000 classes and networks have become really good at these kinds of things." }, { "start": 59.120000000000005, "end": 64.64, "text": " So our question is what do these networks learn? And there are a number of very cool" }, { "start": 64.64, "end": 71.12, "text": " works that have started to investigate what these networks learn. So this" }, { "start": 71.12, "end": 77.52000000000001, "text": " started with work like Deep Dream or even before that but this is a very good" }, { "start": 77.52, "end": 83.52, "text": " summary and also an overview of this. So in this article they first" }, { "start": 83.52, "end": 89.75999999999999, "text": " showcase these patterns here where you can see that as you go through the" }, { "start": 89.75999999999999, "end": 96.64, "text": " network in the layer, this is layer conf2d0, which is a very low layer in" }, { "start": 96.64, "end": 102.75999999999999, "text": " the network, you have things what looks like pattern, just pattern detectors. So" }, { "start": 102.75999999999999, "end": 106.56, "text": " these are the things that the network is excited by and we'll just get, we'll get" }, { "start": 106.56, "end": 113, "text": " in a second at how you create these things. Just be sure these are the things" }, { "start": 113, "end": 120.36, "text": " that these particular layers in the networks are most excited by. So this" }, { "start": 120.36, "end": 126.96000000000001, "text": " layer is super excited by these textures. But as you go higher the" }, { "start": 126.96000000000001, "end": 132.88, "text": " network gets excited by these kind of textures, then it gets excited by more" }, { "start": 132.88, "end": 138.96, "text": " complex things. So the pattern is the higher you go in the layers and" }, { "start": 138.96, "end": 143.72, "text": " these people have been seeing and claiming this and measuring this since" }, { "start": 143.72, "end": 152.24, "text": " RBF networks and whatnot, that the higher you go in these networks the" }, { "start": 152.24, "end": 159.07999999999998, "text": " more complex features that they build. So they always build hypothesis is they" }, { "start": 159.08, "end": 164.20000000000002, "text": " build very complex features from the lower layers and the lower layers they" }, { "start": 164.20000000000002, "end": 168.96, "text": " have less less complex features and until you're the very bottom layer they" }, { "start": 168.96, "end": 174.64000000000001, "text": " simply extract edges and patterns of texture like this. Whereas in the top" }, { "start": 174.64000000000001, "end": 180.60000000000002, "text": " layers all of these are hierarchically assembled to give you very very intricate" }, { "start": 180.60000000000002, "end": 188.08, "text": " features. So these usually look pretty funky that's why I like to investigate." }, { "start": 188.08, "end": 194.84, "text": " So this article focuses on how is this done and the answer is by optimization." }, { "start": 194.84, "end": 199.4, "text": " Now what do we mean? I actually have the article here somewhat printed out but" }, { "start": 199.4, "end": 206.84, "text": " the graphics they don't really print very well to the notebook here. So" }, { "start": 206.84, "end": 217.52, "text": " imagine this here. So what you want to do is you want to see how much" }, { "start": 217.52, "end": 222.32000000000002, "text": " activation is in the network for a particular input and you can do this in" }, { "start": 222.32000000000002, "end": 229.8, "text": " many many different ways. The easiest form, let's actually start over here, if" }, { "start": 229.8, "end": 235.76000000000002, "text": " you have a neural network here and this is the softmax classifier and these are" }, { "start": 235.76000000000002, "end": 242.96, "text": " the classes in this case let's say this is dog, this is cat and this is car, house." }, { "start": 242.96, "end": 253.64000000000001, "text": " Let's go with house. You can think of okay I want to know when" }, { "start": 253.64000000000001, "end": 259, "text": " the network sees a cat. What does the network think of cats? So what I would do" }, { "start": 259, "end": 267.2, "text": " is I would take an image that is just noise, just random noise like this" }, { "start": 267.2, "end": 274.28, "text": " one on the left here and I would start to optimize using backpropagation. I would" }, { "start": 274.28, "end": 279.12, "text": " start to optimize this image. Now you usually know backpropagation as the" }, { "start": 279.12, "end": 284.4, "text": " thing that will optimize these weights if we have given an image and a label." }, { "start": 284.4, "end": 291.2, "text": " But right now you have to, so and we optimize the weights here, sorry I" }, { "start": 291.2, "end": 297.92, "text": " should say that, but right now you have to rethink what we have given is the" }, { "start": 297.92, "end": 303.03999999999996, "text": " label and the weights. We keep them constant but we optimize the input image" }, { "start": 303.03999999999996, "end": 309.84, "text": " to maximize this label as much as possible. So we ask of xx please please" }, { "start": 309.84, "end": 316.71999999999997, "text": " update yourself such that the output is as much cat as possible. And then" }, { "start": 316.72, "end": 325.72, "text": " we just optimize for that. So we hope that this picture would turn out to" }, { "start": 325.72, "end": 333.32000000000005, "text": " be as much cat as we like. And usually here, I don't know exactly which class" }, { "start": 333.32000000000005, "end": 340, "text": " they have here, but you won't get a cat. Sorry over here. You won't get a cat or" }, { "start": 340, "end": 343.76000000000005, "text": " here if you optimize the logits it's the same, just you do the same thing before" }, { "start": 343.76, "end": 350.4, "text": " the softmax. What you will get is some weird trippy thing. So in our classifier" }, { "start": 350.4, "end": 358.03999999999996, "text": " you might get something like there's a cat here but there's also one here right" }, { "start": 358.03999999999996, "end": 362.64, "text": " because two cats are more cat than one cat and there's like a giant cat head" }, { "start": 362.64, "end": 368.52, "text": " here and inside the cat head there is another cat head and there's like a cat" }, { "start": 368.52, "end": 373.96, "text": " tail somewhere here and again there's a cat eye right here. So you get like" }, { "start": 373.96, "end": 378.71999999999997, "text": " something super trippy that is as much cat as possible." }, { "start": 378.71999999999997, "end": 385.32, "text": " Alright now so this is somewhat interesting because you can find" }, { "start": 385.32, "end": 389.2, "text": " out what does the network think is the most cat-like thing there is and" }, { "start": 389.2, "end": 394.59999999999997, "text": " the most dog-like thing there is. But what you can also do is you can see what" }, { "start": 394.6, "end": 400.8, "text": " do the intermediate layers of the networks, what do they get excited by. So" }, { "start": 400.8, "end": 405.12, "text": " what you can do is for example you can take an individual neuron in one of the" }, { "start": 405.12, "end": 410.88, "text": " layers right so this here might be a convolutional layer with its" }, { "start": 410.88, "end": 414.96000000000004, "text": " convolutional filters right and these are the different channels of the" }, { "start": 414.96000000000004, "end": 421.12, "text": " convolutional layer and then this thing here is just a single neuron there and" }, { "start": 421.12, "end": 433.72, "text": " what you can do is you can say okay X we have now again we input the" }, { "start": 433.72, "end": 441.64, "text": " image X and we optimize the image X such that with a given weight this" }, { "start": 441.64, "end": 447.92, "text": " particular neuron let's call it N and N is maybe this neuron right" }, { "start": 447.92, "end": 454.68, "text": " here right this particular neuron is as much activated as possible right so we" }, { "start": 454.68, "end": 459.08000000000004, "text": " no longer optimize for a label but we optimize for a particular neuron to be" }, { "start": 459.08000000000004, "end": 466.16, "text": " activated as much as possible and then we can sort of see what is an image that" }, { "start": 466.16, "end": 473.24, "text": " activates this neuron as much as possible in this case that thing you can" }, { "start": 473.24, "end": 476.88, "text": " actually do the same thing with an entire channel if you simply say when is" }, { "start": 476.88, "end": 482.08, "text": " the channel as a whole activated as much as possible and something like deep" }, { "start": 482.08, "end": 486.24, "text": " dream did the same thing but with an entire layer in the neural network like" }, { "start": 486.24, "end": 492.84, "text": " what is this layer activated by they can imagine there's not only one image that" }, { "start": 492.84, "end": 499.28, "text": " activates it the most but probably depending on your start here it's it's" }, { "start": 499.28, "end": 505.96, "text": " it's a you'll get different different results for depending on where you start" }, { "start": 505.96, "end": 511.79999999999995, "text": " we'll go into that later as well so these are the kinds of things you can do" }, { "start": 511.79999999999995, "end": 517, "text": " to investigate these neural networks and see what they what they pay attention to" }, { "start": 517, "end": 528.64, "text": " in each of the layers right so let's go on here and so they say they say okay if" }, { "start": 528.64, "end": 535.16, "text": " we optimize by optimization you get something like this here on the bottom" }, { "start": 535.16, "end": 542.52, "text": " row looks pretty funky right but what you could also do is you can visualize by" }, { "start": 542.52, "end": 547.52, "text": " what there's called data set examples and date with data set examples you" }, { "start": 547.52, "end": 552.64, "text": " don't do this thing you don't do the optimization procedure but you go into" }, { "start": 552.64, "end": 560.6, "text": " your into your database into your data set and you find the images that" }, { "start": 560.6, "end": 566.2, "text": " activate so the XI from your data set that activate a particular neuron the" }, { "start": 566.2, "end": 570, "text": " most so you simply sort all the images in your database and you just pick the" }, { "start": 570, "end": 574.9200000000001, "text": " ten or so that activate that particular neuron the most and that would also" }, { "start": 574.9200000000001, "end": 580.72, "text": " give you an understanding it's actually a valid thing and the AI microscope" }, { "start": 580.72, "end": 585.4, "text": " combines both of them so on the bottom you see what particular neurons are most" }, { "start": 585.4, "end": 592.72, "text": " excited by and at the top you see that that the data set examples they're most" }, { "start": 592.72, "end": 597.56, "text": " excited by so you can see that there is a there's a healthy diversity in the" }, { "start": 597.56, "end": 602.4, "text": " data set examples but they also all kind of map to the to the what it's most" }, { "start": 602.4, "end": 609.92, "text": " excited by it's pretty cool the last point they make in this article is that" }, { "start": 609.92, "end": 618.04, "text": " of diversity with the data set examples you do get naturally sort of a diverse" }, { "start": 618.04, "end": 622.36, "text": " set of images of course where you can guess you can also say okay whether the" }, { "start": 622.36, "end": 626.56, "text": " maximum activations and only slightly positive you can even give negative" }, { "start": 626.56, "end": 633.68, "text": " examples but with the positive you can only either maximize fully or you can" }, { "start": 633.68, "end": 638, "text": " you know take the negative and you can say okay what is this neuron not excited" }, { "start": 638, "end": 645.12, "text": " by at all but you you won't get kind of a spectrum of what the neuron is" }, { "start": 645.12, "end": 650.8, "text": " excited by or the unit or the layer and what they're doing is simply they add a" }, { "start": 650.8, "end": 657.52, "text": " diversity term they say that works best so what does that mean it means that" }, { "start": 657.52, "end": 666.32, "text": " here if we optimize X and Y right let's go up here if we optimize X in that" }, { "start": 666.32, "end": 675, "text": " right and try to maximize the activation of n we don't want to do X by itself but" }, { "start": 675, "end": 683.12, "text": " we want to do is we want to do an entire set of X I right so we feed an entire" }, { "start": 683.12, "end": 692.12, "text": " mini batch in there and we want to maximize n but also maximize a diversity" }, { "start": 692.12, "end": 703.64, "text": " term let's call that D between X 1 to X be right so you want to maximize the" }, { "start": 703.64, "end": 707.32, "text": " activation of the neuron but at the same time in your loss function that you" }, { "start": 707.32, "end": 713.12, "text": " optimize you also have this diversity term where you say the images that you" }, { "start": 713.12, "end": 717.32, "text": " produce should be far apart from each other or kind of apart from each other" }, { "start": 717.32, "end": 725.5600000000001, "text": " and thus you do get diverse samples okay the printing again doesn't work so here" }, { "start": 725.5600000000001, "end": 730.96, "text": " you see that if you just simply optimize you get the thing on the left but if you" }, { "start": 730.96, "end": 736.08, "text": " have a batch of things and you optimize them to be diverse from each other but" }, { "start": 736.08, "end": 742.7600000000001, "text": " also activate the layer or the unit you get a variety of high activations and" }, { "start": 742.76, "end": 747.76, "text": " you can see here that this is some sort of curve this could be a beak of a bird" }, { "start": 747.76, "end": 752.76, "text": " but on the right here this could also be kind of a snout of a monkey or something" }, { "start": 752.76, "end": 760.24, "text": " okay so it's just curvy curvy things that is activated by here they give" }, { "start": 760.24, "end": 764.8, "text": " another example you can clearly see that there is like some sort of eye in the" }, { "start": 764.8, "end": 769.4, "text": " picture but then if you optimize with diversity you can see that some of them" }, { "start": 769.4, "end": 776.88, "text": " do not have this eye thing and in fact also some of the data set examples do" }, { "start": 776.88, "end": 782.64, "text": " not have this eye thing so it might be interesting to to to optimize here with" }, { "start": 782.64, "end": 790.88, "text": " diversity and even in they say in higher layers it gets even more more diverse" }, { "start": 790.88, "end": 800.12, "text": " with what you achieve with this ball detector they also say they research" }, { "start": 800.12, "end": 805.28, "text": " interactions between neurons where they can interpolate between them right so" }, { "start": 805.28, "end": 811.76, "text": " you can here have two different new units let's say this top left one here" }, { "start": 811.76, "end": 816.44, "text": " is the thing that we've just seen with the curvature activator and then on the" }, { "start": 816.44, "end": 821.6, "text": " right we can select this thing here that is appears to be activated by these bird" }, { "start": 821.6, "end": 826.0400000000001, "text": " like bird like things and if you optimize an image that activates both of" }, { "start": 826.0400000000001, "end": 830.4000000000001, "text": " them you get the thing on the bottom left and this is very good for" }, { "start": 830.4000000000001, "end": 834.4000000000001, "text": " understanding how neural networks work because what a neural network will do is" }, { "start": 834.4000000000001, "end": 839.5600000000001, "text": " exactly it will take the thing on the top left and the top right from lower" }, { "start": 839.5600000000001, "end": 844.48, "text": " layers and it will combine them to form features of higher layers so while the" }, { "start": 844.48, "end": 850.52, "text": " top right thing looks like generic birds the bottom left thing looks much more" }, { "start": 850.52, "end": 854.6, "text": " like birds with let's say long necks and then kind of curved necks so more" }, { "start": 854.6, "end": 861.9200000000001, "text": " stork ish birds right because we've added in this curvature thing so this is" }, { "start": 861.9200000000001, "end": 867.02, "text": " very very cool to play around you can also here interpolate between into" }, { "start": 867.02, "end": 875.92, "text": " neurons like you would interpolate in a in a GAN right and yeah so they do make" }, { "start": 875.92, "end": 880.16, "text": " a point of regularization I don't want to go into that particularly but you" }, { "start": 880.16, "end": 885, "text": " have to be careful you can't just apply the optimization procedure as I said" }, { "start": 885, "end": 891.52, "text": " right now you have to actually have to do some regularization and to get to" }, { "start": 891.52, "end": 895.36, "text": " get rid of what are essentially adversarial examples in this process" }, { "start": 895.36, "end": 901.48, "text": " because if you just straight-up optimize you will get pretty high frequency" }, { "start": 901.48, "end": 909.84, "text": " crappy results I actually want to jump over now to this OpenAI microscope so" }, { "start": 909.84, "end": 914.6800000000001, "text": " this is a tool that lets you explore these visualizations so at the beginning" }, { "start": 914.6800000000001, "end": 919.4, "text": " you can pick one of these models and I'll pick inception v1 just because some" }, { "start": 919.4, "end": 925.8, "text": " of the other ones they don't have everything done quite yet the all the" }, { "start": 925.8, "end": 931.84, "text": " all the all the visualization so on the right here you can actually see the" }, { "start": 931.84, "end": 935.88, "text": " architecture of the network if you know what an inception network is this what" }, { "start": 935.88, "end": 941.28, "text": " this looks like and you would be able from here to select one of these units" }, { "start": 941.28, "end": 948.48, "text": " straight away but I'm gonna sorry we're gonna go to the left here so you have" }, { "start": 948.48, "end": 958.24, "text": " deep dream activated which means the entire layer is optimized for so per" }, { "start": 958.24, "end": 964.44, "text": " layer on the right side you have an image here and you can already see that" }, { "start": 964.44, "end": 970.08, "text": " if we go from the bottom what we saw before we get patterns that become more" }, { "start": 970.08, "end": 976.5600000000001, "text": " and more complex as you go up the layers and then more and more until you finally" }, { "start": 976.56, "end": 982.4, "text": " have what the network appears to be most activated by is mostly dogs which is" }, { "start": 982.4, "end": 989.5999999999999, "text": " okay because image net is dominated by dogs so you can click on any of these" }, { "start": 989.5999999999999, "end": 998.9599999999999, "text": " right here like this one and now you'll be able to inspect the individual nodes" }, { "start": 998.9599999999999, "end": 1002.4, "text": " in this layer so before we had the whole layer right the whole layer was" }, { "start": 1002.4, "end": 1007.9599999999999, "text": " activated by something but these layers they have different channels and also" }, { "start": 1007.9599999999999, "end": 1013.12, "text": " different neurons within the channel so you can select this here you can go" }, { "start": 1013.12, "end": 1021.52, "text": " neuron activation or channel activation and these are the images that these" }, { "start": 1021.52, "end": 1027.08, "text": " channels are excited by the most you see you get pretty funky pattern if we" }, { "start": 1027.08, "end": 1034.6, "text": " select one interesting one maybe this this one right here you can see on the" }, { "start": 1034.6, "end": 1038.32, "text": " left this is the channel optimizing optimization on the right this is the" }, { "start": 1038.32, "end": 1044.48, "text": " neuron optimization and here you get the data set examples that are most" }, { "start": 1044.48, "end": 1053.32, "text": " activated that mostly activate this particular channel or neuron so sorry" }, { "start": 1053.32, "end": 1060.24, "text": " this particular yeah channel so you can see this is pretty similar to the thing" }, { "start": 1060.24, "end": 1068, "text": " I drew where except for it being a cat it's some sort of a fox dog thing right" }, { "start": 1068, "end": 1074.8799999999999, "text": " and and you can explore the neural network in this fashion so you can go" }, { "start": 1074.88, "end": 1085.2800000000002, "text": " through the layer here and look at that good units this seems to be whiskers" }, { "start": 1085.2800000000002, "end": 1094.1200000000001, "text": " classifier and lo and behold things with whiskers will activate the the neuron" }, { "start": 1094.1200000000001, "end": 1098.24, "text": " and as you go up the layer and this is the the cool thing right so we're right" }, { "start": 1098.24, "end": 1103.2800000000002, "text": " now we're here in this layer for as you go up you will see more and more" }, { "start": 1103.28, "end": 1112.52, "text": " intricate patterns of activations I I could play around this for very very" }, { "start": 1112.52, "end": 1119.76, "text": " long time but I won't I won't waste your time too much they there is a dist sorry" }, { "start": 1119.76, "end": 1128.16, "text": " there is a slack workspace where people discuss interesting patterns what is" }, { "start": 1128.16, "end": 1141.52, "text": " this okay yes this is a some sort of temple temple constructor very cool" }, { "start": 1141.52, "end": 1146.92, "text": " there is a slack workspace where people discuss interesting things for example" }, { "start": 1146.92, "end": 1153.6000000000001, "text": " they discuss how the car detector that you see right here is one of the units" }, { "start": 1153.6, "end": 1159.6, "text": " there is literally endless units to look at that detects cars can be clearly seen" }, { "start": 1159.6, "end": 1165.12, "text": " to be built from lower level features such as this wheel detector you see this" }, { "start": 1165.12, "end": 1175.24, "text": " wheel detector here is the unit three three seven in the mixed four layer and" }, { "start": 1175.24, "end": 1183.52, "text": " this car hood detector right here is unit two three seven also in the in one" }, { "start": 1183.52, "end": 1188.32, "text": " of the layer fours right so these are both from layer four and then the car" }, { "start": 1188.32, "end": 1194.88, "text": " detector I haven't looked this up ah isn't layer four as well but let's check" }, { "start": 1194.88, "end": 1203.08, "text": " it out this isn't layer 4b this isn't layer 4b and this isn't layer 4c ah so" }, { "start": 1203.08, "end": 1211.8, "text": " you see I this was a risk the car detector is built from lower level" }, { "start": 1211.8, "end": 1218.36, "text": " features of car hood and car wheel right the car wheel right here detects wheels" }, { "start": 1218.36, "end": 1226.4399999999998, "text": " and the car hood detector detects hoods and then the car detector detects cars so" }, { "start": 1226.4399999999998, "end": 1232.24, "text": " there are very like I really invite you to go look at it check out what people" }, { "start": 1232.24, "end": 1239.36, "text": " find and explore these models all of this is based on this lucid library" }, { "start": 1239.36, "end": 1244.48, "text": " right here also invite you to check that out where you can perform such" }, { "start": 1244.48, "end": 1262.68, "text": " optimizations yourself I'll link to that and with that bye bye" } ]
-h1KB8ps11A
Yannic Kilcher
UCZHmQk67mSJgfCCTn7xBfew
Datasets for Data-Driven Reinforcement Learning
[ "Science & Technology" ]
[ "deep learning", "machine learning", "reinforcement learning", "deep rl", "off-policy", "on-policy", "replay buffer", "dataset", "benchmark", "berkeley", "rail", "offline", "online" ]
Offline Reinforcement Learning has come more and more into focus recently in domains where classic on-policy RL algorithms are infeasible to train, such as safety-critical tasks or learning from expert demonstrations. This paper presents an extensive benchmark for evaluating offline RL algorithms in a variety of settings. Paper: https://arxiv.org/abs/2004.07219 Code: https://github.com/rail-berkeley/offline_rl Abstract: The offline reinforcement learning (RL) problem, also referred to as batch RL, refers to the setting where a policy must be learned from a dataset of previously collected data, without additional online data collection. In supervised learning, large datasets and complex deep neural networks have fueled impressive progress, but in contrast, conventional RL algorithms must collect large amounts of on-policy data and have had little success leveraging previously collected datasets. As a result, existing RL benchmarks are not well-suited for the offline setting, making progress in this area difficult to measure. To design a benchmark tailored to offline RL, we start by outlining key properties of datasets relevant to applications of offline RL. Based on these properties, we design a set of benchmark tasks and datasets that evaluate offline RL algorithms under these conditions. Examples of such properties include: datasets generated via hand-designed controllers and human demonstrators, multi-objective datasets, where an agent can perform different tasks in the same environment, and datasets consisting of a heterogeneous mix of high-quality and low-quality trajectories. By designing the benchmark tasks and datasets to reflect properties of real-world offline RL problems, our benchmark will focus research effort on methods that drive substantial improvements not just on simulated benchmarks, but ultimately on the kinds of real-world problems where offline RL will have the largest impact. Authors: Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, 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 datasets for data-driven reinforcement learning by Justin Fu, Aviral Kumar, Ofer Natschum, George Tucker and Sergei Levine. So this is what you would call a dataset paper or a benchmark paper. And the main point or the main area of the paper was called offline reinforcement learning. So offline reinforcement learning, usually in reinforcement learning you have this task, right? You have the agent and you have the environment. And the agent gets some sort of observation and has to come up with an action in response to that observation. And then it gets back a reward and another observation. And again, it has to come up with an action. And the goal is to maximize the rewards over time that the agent gets while interacting with the environment. So usually this is organized in what are called episodes, which basically means if you have some sort of environment, right, and here is the agent and here is the goal, right, the goal is a inverted triangle. And there are a bunch of walls right here, right? So it looks kind of a maze that the agent has to navigate. Then one episode could be the agent moving around until it either finds the target or hits a wall or just kind of goes around and around. And then at some point you say, all right, that's enough, game over. And usually in reinforcement learning, you perform many of these episodes and then you learn from them. So you perform episodes and each episode gets into usually some sort of replay buffer, right? Let's call this replay buffer. And you do this many times and at the same time that you're doing this, you're using the things that you stored here in order to learn, right? So the agent learns from these things, right? So it acts with the environment in this loop, in this fashion. Then once it has done an episode, it puts it into the replay buffer and then it learns from the actions it has performed. This is what is usually called online reinforcement learning, right? So this loop is online. Online means because the agent learns from its own actions, right? Now in contrast to this, there is offline reinforcement learning. So in offline reinforcement learning, the agent has to learn from someone else's actions, right? So this connection here is severed. Instead you have other agents. Let's call these agent one, agent two, multiple agents, agent three. They all have their own interaction with the environment, right? Environment environment interactions and they feed their experience into they perform these episodes. They feed their experience into the replay buffer. And then the agent just has to learn from that. So whatever happened here, this was previous, right? And now the agent has to learn how to maximize its reward just from the experience that is in the replay buffer from these other agents. This is what's called offline reinforcement learning means the agent learns from someone else's actions. Basically the power of reinforcement learning of course comes from the fact that you learn from your own actions. It means that for example, if you already have some successful trajectories here, right? You found the target. You can try to replicate that because you know which actions you performed. And if you don't, you know, change anything, you're probably going to find the target again just by randomness. All right, because you've done it already once and so on. So you kind of know all the intrinsics of your own algorithm that led you to reach the target. Now this is an entirely different case with all of these other agents. You have no clue how they were acting, why they were acting, right? You just know, okay, they did a series of actions and that gave them some kind of reward. And you have no idea what their reasoning was or anything. All you really can learn from is their sequence of actions. Now why is that problematic, right? So if all of the agents, for example, if this is an actual platform and this is really steep here, this is all of here is really steep cliffs, right? And you can actually fall off. But the agents, they're humans, right? So they don't want to fall off. So what they're going to do is they're just going to take steps that are maybe like this or maybe like this, but they're humans, they're smart. They're never going to fall off here, right? Why is this a problem? If you're not trying to learn from this experience and your policy by some chance, because you might have some entropy in there or something, you do know what happens if you make a move like this. And you also know what happens if you make a move like this, right? Already two humans have done these moves. But what happens if you make a move like this? You just don't know, right? In classic reinforcement learning, you would get a negative reward and you could learn from that to not do this action anymore. But in this case, you simply don't have any data to tell you what happens when you go off there. So you see that there's a problem if you are not able to learn from your own experience, but you have to learn from something or someone else's experience. The distribution of experience that you have available to you might be not fully specific of the environment. It might be very different from what you would do. And it might be very not conducive to what you want to do with it. So the task of offline reinforcement learning is harder than online reinforcement learning. But it also has many, many applications. Sometimes it's just not possible to do online reinforcement learning. When for example, in medical field, right? Think of the medical field where you want a robot to perform a surgery. You can't just do reinforcement learning with our online techniques because they're just going to try a bunch of things and see what works. Maybe you want that, I don't want that. So necessarily, you're going to be left with, let's have this robot learn from human experts. So that's a task for offline reinforcement learning. There are many more tasks. For example, if you think of search engine, you will have many, many, many logs from human searching things, and you simply store them, you simply have them in a buffer. Now you want to maybe train a reinforcement learning agent that serves the best possible ads or something like this. You want to do this in a way that you can use all of that data, even though that data wasn't collected by that particular agent. The crucial difference to supervised learning again, is that you have this interactive structure, this multi-step interactive structure. Because in a supervised learning, you also have this buffer here. In supervised learning, you simply have your labeled data set. But the difference is in supervised learning, you always know what the right action is currently, because you have the labels. In offline reinforcement learning, you don't know. You might be here, and there are three actions available. All you know is that the demonstrator, these actors here, one of them has done this, and then this, and then this, and then got a two. You have no clue what happens if you do this, and then this, and then this. All you know is that this action here might eventually lead to a two. You also can't try it out, because you can't try out this path, because you don't get a reward here. You have to find, and this is the task here, you'll have to find some other example or stitch together. They make a good example here. This paper basically proposes a benchmark for offline RL algorithms. What they do is they have a bunch of data sets. They have a bunch of these replay buffers around for different tasks, a collection of this, that they collected with various techniques. There is human demonstration, there is other agents, and so on. They have that, and you're supposed to take one of them, learn something, learn an agent, and then evaluate it on an environment. They propose which ones are suitable for this. They give you the data, and they give you the environment to evaluate it on. In the end, you'll get a score, and you can compare your offline RL algorithm with others. They also provide some benchmark implementations for algorithms that already do this. They show that they don't really work well. One of the tasks is this maze here. In this maze, the task is you are somewhere, let's say here, and you need to go somewhere, let's say here, and you need to find your way. The demonstrations you have, the data in your replay buffer, is such that this is the same task, but never the same start and end points like you are tasked to. You might have one in your replay buffer, you might have one trajectory, one episode that went like this from one to two. And you'll be able to see the reward of that. And you might have one trajectory that was from two to three, like this. Both of these things actually give you really high reward. If you were an agent, and you had to learn, and now the task is please go from one to three, what you could do is you could simply say, I know the green thing gave a pretty high reward, and the yellow thing gave a pretty high reward. I know the green thing started at one, and I know the yellow thing ended at three, and I know they both have this common location. So what I might do just is I might go to that common location, and then go on on the different path, right? So you have to somehow stitch together experience from other agents in order to make your task work. This is a very explicit example, of course, what we want to do is we want to do this in a more implicit deep learning way, ideally, and not manually stitch together other trajectories. Though I'm pretty sure that would not be so dumb, right? I'm pretty sure there's a lot of data augmentation you could do during training simply by stitching together other trajectories, right? So from this trajectory, you could actually, not only could you make other gold conditioned ways, for example, from here to here, or from here to here, you could make from here to here anywhere where you have shared points, you could train a policy that goes there and then goes further or something like this. I'm pretty sure there's already an algorithm that does things like this, but I'm just thinking aloud here. Alright, so this is one of the tasks and you see that the that that you will have to learn a policy to go as fast as possible from any point to any other point. And you're all you're given is a database of experience that already exists from some other agent, but never will probably never the exact route that you need to learn right now. Alright, so the goal is how fast or how efficiently can you do this? This is one task in this data set. The next task is very similar is this grid world here where there is this red square, red triangle, that's your agent. And then there is the green square, that's your goal or vice versa. And so you're basically tasked to not hit the walls here and to go about your way finding the target. There are more elaborate things like this mojo co environment here, or the ant maze where you have this little ant with you know, the spider legs. So this is no longer you can just move in either direction, you have to actually control the legs. And there's also this arm, this robotic arm. So you see there is a wide diversity of tasks. And also, there is a wide diversity of how the replay buffer was constructed. So in some cases, the replay buffer is actually constructed by a human performing in this environment. So in this hand manipulation task, you'll have demonstrations from humans. You see it's not particularly many samples here. It's 5000 samples, which I guess are is a chopped up version of I'm not really sure how the human things were constructed. But you can clearly guess that the degrees of freedom that you have in a robotic hand is much, much higher than you could learn just from these 5000 samples if you were to, you know, an online or algorithm that just does random exploration will need much more than these 5000 samples. And the 5000 samples won't be I ID distributed with all the degrees of freedom, it will just be here's what a human does, right. And so you can think of algorithms like inverse reinforcement learning or something like this. But here in inverse reinforcement learning, usually you assume that the expert the expert is kind of trying to achieve the same reward as you do. But this is not necessarily the case here. You have a given reward structure, but you are tasked to simply learn from these demonstrations. You can see it's also possible that there is this is constructed by a policy. And that usually means that they so either it's it's constructed by let's say a reinforcement learning algorithm that was trained in an online fashion, but maybe not as well. But also I think they have behavior cloning policy that they got from human demonstration, I think so that there are many ways. Also sometimes you have a planner which is, can you imagine it's it's a it's an algorithm that wasn't machine learned. So I know almost unthinkable, but in these in these kind of mazes, you can actually do planning algorithms that can can sort of so I know this is crazy and crazy talk, the niche topic but there exists things like a star search where where where you can construct the kind of shortest path through these mazes and things like this. So yeah, that's I know, I know that that is that is very niche. But you can construct policies like this. And then you can use those as your replay buffer filling. And you can already see that this also will be a massively different distribution of data than you would get with an online RL algorithm, right. So in conclusion, they do test other they do test other algorithms on this. In conclusion, they say that most offline RL algorithms nowadays, they don't work well on these on these data sets. The only data sets where they do work well is where the replay buffer was generated by some sort of like here, by some sort of policy by some sort of reinforcement learning policy. So what they would do is they would train an online policy and the experience generated by that online policy while it learns will make up the replay buffer. And if you use that replay buffer for offline learning, then they say it tends to work okay. But if you have other methods of collecting the data that are very different from this offline, sorry, from an from a reinforcement learning collection approach, then it tends not to work as well. Alright, so if you are interested in offline RL, please check out this paper, all their code is available right here. Note that the link in the paper doesn't seem to work. The true link is here. I'll also put it in the description. And with that, I wish you a good day. Bye!
[ { "start": 0, "end": 5.26, "text": " Hi there, today we're looking at datasets for data-driven reinforcement learning by" }, { "start": 5.26, "end": 12.76, "text": " Justin Fu, Aviral Kumar, Ofer Natschum, George Tucker and Sergei Levine." }, { "start": 12.76, "end": 18.34, "text": " So this is what you would call a dataset paper or a benchmark paper." }, { "start": 18.34, "end": 26.16, "text": " And the main point or the main area of the paper was called offline reinforcement learning." }, { "start": 26.16, "end": 31.92, "text": " So offline reinforcement learning, usually in reinforcement learning you have this task," }, { "start": 31.92, "end": 32.92, "text": " right?" }, { "start": 32.92, "end": 36.32, "text": " You have the agent and you have the environment." }, { "start": 36.32, "end": 43.22, "text": " And the agent gets some sort of observation and has to come up with an action in response" }, { "start": 43.22, "end": 44.879999999999995, "text": " to that observation." }, { "start": 44.879999999999995, "end": 50.019999999999996, "text": " And then it gets back a reward and another observation." }, { "start": 50.019999999999996, "end": 53.28, "text": " And again, it has to come up with an action." }, { "start": 53.28, "end": 59.92, "text": " And the goal is to maximize the rewards over time that the agent gets while interacting" }, { "start": 59.92, "end": 62.38, "text": " with the environment." }, { "start": 62.38, "end": 68.16, "text": " So usually this is organized in what are called episodes, which basically means if you have" }, { "start": 68.16, "end": 75.44, "text": " some sort of environment, right, and here is the agent and here is the goal, right," }, { "start": 75.44, "end": 79.86, "text": " the goal is a inverted triangle." }, { "start": 79.86, "end": 83.8, "text": " And there are a bunch of walls right here, right?" }, { "start": 83.8, "end": 87.68, "text": " So it looks kind of a maze that the agent has to navigate." }, { "start": 87.68, "end": 98.62, "text": " Then one episode could be the agent moving around until it either finds the target or" }, { "start": 98.62, "end": 102.4, "text": " hits a wall or just kind of goes around and around." }, { "start": 102.4, "end": 107.44, "text": " And then at some point you say, all right, that's enough, game over." }, { "start": 107.44, "end": 113.39999999999999, "text": " And usually in reinforcement learning, you perform many of these episodes and then you" }, { "start": 113.39999999999999, "end": 115.08, "text": " learn from them." }, { "start": 115.08, "end": 124.64, "text": " So you perform episodes and each episode gets into usually some sort of replay buffer, right?" }, { "start": 124.64, "end": 127.32, "text": " Let's call this replay buffer." }, { "start": 127.32, "end": 134.72, "text": " And you do this many times and at the same time that you're doing this, you're using" }, { "start": 134.72, "end": 138.52, "text": " the things that you stored here in order to learn, right?" }, { "start": 138.52, "end": 142.62, "text": " So the agent learns from these things, right?" }, { "start": 142.62, "end": 148.42, "text": " So it acts with the environment in this loop, in this fashion." }, { "start": 148.42, "end": 154.2, "text": " Then once it has done an episode, it puts it into the replay buffer and then it learns" }, { "start": 154.2, "end": 156.86, "text": " from the actions it has performed." }, { "start": 156.86, "end": 161.24, "text": " This is what is usually called online reinforcement learning, right?" }, { "start": 161.24, "end": 164.56, "text": " So this loop is online." }, { "start": 164.56, "end": 172.04, "text": " Online means because the agent learns from its own actions, right?" }, { "start": 172.04, "end": 176.28, "text": " Now in contrast to this, there is offline reinforcement learning." }, { "start": 176.28, "end": 187.04, "text": " So in offline reinforcement learning, the agent has to learn from someone else's actions," }, { "start": 187.04, "end": 188.04, "text": " right?" }, { "start": 188.04, "end": 194.42000000000002, "text": " So this connection here is severed." }, { "start": 194.42, "end": 198.11999999999998, "text": " Instead you have other agents." }, { "start": 198.11999999999998, "end": 202.64, "text": " Let's call these agent one, agent two, multiple agents, agent three." }, { "start": 202.64, "end": 208.11999999999998, "text": " They all have their own interaction with the environment, right?" }, { "start": 208.11999999999998, "end": 218.48, "text": " Environment environment interactions and they feed their experience into they perform these" }, { "start": 218.48, "end": 219.61999999999998, "text": " episodes." }, { "start": 219.61999999999998, "end": 222.56, "text": " They feed their experience into the replay buffer." }, { "start": 222.56, "end": 225.42000000000002, "text": " And then the agent just has to learn from that." }, { "start": 225.42000000000002, "end": 230.8, "text": " So whatever happened here, this was previous, right?" }, { "start": 230.8, "end": 237.56, "text": " And now the agent has to learn how to maximize its reward just from the experience that is" }, { "start": 237.56, "end": 241.08, "text": " in the replay buffer from these other agents." }, { "start": 241.08, "end": 245.62, "text": " This is what's called offline reinforcement learning means the agent learns from someone" }, { "start": 245.62, "end": 248.88, "text": " else's actions." }, { "start": 248.88, "end": 253.6, "text": " Basically the power of reinforcement learning of course comes from the fact that you learn" }, { "start": 253.6, "end": 255.85999999999999, "text": " from your own actions." }, { "start": 255.85999999999999, "end": 263.52, "text": " It means that for example, if you already have some successful trajectories here, right?" }, { "start": 263.52, "end": 265.14, "text": " You found the target." }, { "start": 265.14, "end": 270.84, "text": " You can try to replicate that because you know which actions you performed." }, { "start": 270.84, "end": 275.4, "text": " And if you don't, you know, change anything, you're probably going to find the target again" }, { "start": 275.4, "end": 276.96, "text": " just by randomness." }, { "start": 276.96, "end": 280.84, "text": " All right, because you've done it already once and so on." }, { "start": 280.84, "end": 286, "text": " So you kind of know all the intrinsics of your own algorithm that led you to reach the" }, { "start": 286, "end": 287.64, "text": " target." }, { "start": 287.64, "end": 291.52, "text": " Now this is an entirely different case with all of these other agents." }, { "start": 291.52, "end": 296.29999999999995, "text": " You have no clue how they were acting, why they were acting, right?" }, { "start": 296.29999999999995, "end": 301.91999999999996, "text": " You just know, okay, they did a series of actions and that gave them some kind of reward." }, { "start": 301.92, "end": 307, "text": " And you have no idea what their reasoning was or anything." }, { "start": 307, "end": 310.88, "text": " All you really can learn from is their sequence of actions." }, { "start": 310.88, "end": 313.14000000000004, "text": " Now why is that problematic, right?" }, { "start": 313.14000000000004, "end": 322.92, "text": " So if all of the agents, for example, if this is an actual platform and this is really steep" }, { "start": 322.92, "end": 328.86, "text": " here, this is all of here is really steep cliffs, right?" }, { "start": 328.86, "end": 331.02000000000004, "text": " And you can actually fall off." }, { "start": 331.02, "end": 333.88, "text": " But the agents, they're humans, right?" }, { "start": 333.88, "end": 335.24, "text": " So they don't want to fall off." }, { "start": 335.24, "end": 341.03999999999996, "text": " So what they're going to do is they're just going to take steps that are maybe like this" }, { "start": 341.03999999999996, "end": 345.2, "text": " or maybe like this, but they're humans, they're smart." }, { "start": 345.2, "end": 350.08, "text": " They're never going to fall off here, right?" }, { "start": 350.08, "end": 351.08, "text": " Why is this a problem?" }, { "start": 351.08, "end": 359.47999999999996, "text": " If you're not trying to learn from this experience and your policy by some chance, because you" }, { "start": 359.48, "end": 365.76, "text": " might have some entropy in there or something, you do know what happens if you make a move" }, { "start": 365.76, "end": 366.76, "text": " like this." }, { "start": 366.76, "end": 369.54, "text": " And you also know what happens if you make a move like this, right?" }, { "start": 369.54, "end": 372.12, "text": " Already two humans have done these moves." }, { "start": 372.12, "end": 374.8, "text": " But what happens if you make a move like this?" }, { "start": 374.8, "end": 376.70000000000005, "text": " You just don't know, right?" }, { "start": 376.70000000000005, "end": 380.12, "text": " In classic reinforcement learning, you would get a negative reward and you could learn" }, { "start": 380.12, "end": 383.54, "text": " from that to not do this action anymore." }, { "start": 383.54, "end": 391.52000000000004, "text": " But in this case, you simply don't have any data to tell you what happens when you go" }, { "start": 391.52000000000004, "end": 392.52000000000004, "text": " off there." }, { "start": 392.52000000000004, "end": 398.32000000000005, "text": " So you see that there's a problem if you are not able to learn from your own experience," }, { "start": 398.32000000000005, "end": 402.84000000000003, "text": " but you have to learn from something or someone else's experience." }, { "start": 402.84, "end": 414.2, "text": " The distribution of experience that you have available to you might be not fully specific" }, { "start": 414.2, "end": 415.94, "text": " of the environment." }, { "start": 415.94, "end": 418.84, "text": " It might be very different from what you would do." }, { "start": 418.84, "end": 423.76, "text": " And it might be very not conducive to what you want to do with it." }, { "start": 423.76, "end": 429.35999999999996, "text": " So the task of offline reinforcement learning is harder than online reinforcement learning." }, { "start": 429.36, "end": 434.6, "text": " But it also has many, many applications." }, { "start": 434.6, "end": 439.92, "text": " Sometimes it's just not possible to do online reinforcement learning." }, { "start": 439.92, "end": 444.24, "text": " When for example, in medical field, right?" }, { "start": 444.24, "end": 450.64, "text": " Think of the medical field where you want a robot to perform a surgery." }, { "start": 450.64, "end": 456.44, "text": " You can't just do reinforcement learning with our online techniques because they're just" }, { "start": 456.44, "end": 461.28, "text": " going to try a bunch of things and see what works." }, { "start": 461.28, "end": 463.6, "text": " Maybe you want that, I don't want that." }, { "start": 463.6, "end": 472.48, "text": " So necessarily, you're going to be left with, let's have this robot learn from human experts." }, { "start": 472.48, "end": 475.78, "text": " So that's a task for offline reinforcement learning." }, { "start": 475.78, "end": 476.92, "text": " There are many more tasks." }, { "start": 476.92, "end": 483.84, "text": " For example, if you think of search engine, you will have many, many, many logs from human" }, { "start": 483.84, "end": 489.03999999999996, "text": " searching things, and you simply store them, you simply have them in a buffer." }, { "start": 489.03999999999996, "end": 495.44, "text": " Now you want to maybe train a reinforcement learning agent that serves the best possible" }, { "start": 495.44, "end": 498.03999999999996, "text": " ads or something like this." }, { "start": 498.03999999999996, "end": 503.88, "text": " You want to do this in a way that you can use all of that data, even though that data" }, { "start": 503.88, "end": 508.64, "text": " wasn't collected by that particular agent." }, { "start": 508.64, "end": 515.12, "text": " The crucial difference to supervised learning again, is that you have this interactive structure," }, { "start": 515.12, "end": 518.3199999999999, "text": " this multi-step interactive structure." }, { "start": 518.3199999999999, "end": 523, "text": " Because in a supervised learning, you also have this buffer here." }, { "start": 523, "end": 526.48, "text": " In supervised learning, you simply have your labeled data set." }, { "start": 526.48, "end": 533.48, "text": " But the difference is in supervised learning, you always know what the right action is currently," }, { "start": 533.48, "end": 535.22, "text": " because you have the labels." }, { "start": 535.22, "end": 538.3199999999999, "text": " In offline reinforcement learning, you don't know." }, { "start": 538.32, "end": 547.12, "text": " You might be here, and there are three actions available." }, { "start": 547.12, "end": 555.08, "text": " All you know is that the demonstrator, these actors here, one of them has done this, and" }, { "start": 555.08, "end": 558.36, "text": " then this, and then this, and then got a two." }, { "start": 558.36, "end": 567.32, "text": " You have no clue what happens if you do this, and then this, and then this." }, { "start": 567.32, "end": 573.44, "text": " All you know is that this action here might eventually lead to a two." }, { "start": 573.44, "end": 578.86, "text": " You also can't try it out, because you can't try out this path, because you don't get a" }, { "start": 578.86, "end": 579.98, "text": " reward here." }, { "start": 579.98, "end": 586.46, "text": " You have to find, and this is the task here, you'll have to find some other example or" }, { "start": 586.46, "end": 588.1, "text": " stitch together." }, { "start": 588.1, "end": 589.5600000000001, "text": " They make a good example here." }, { "start": 589.5600000000001, "end": 596.86, "text": " This paper basically proposes a benchmark for offline RL algorithms." }, { "start": 596.86, "end": 600.28, "text": " What they do is they have a bunch of data sets." }, { "start": 600.28, "end": 606.16, "text": " They have a bunch of these replay buffers around for different tasks, a collection of" }, { "start": 606.16, "end": 609.72, "text": " this, that they collected with various techniques." }, { "start": 609.72, "end": 614.6, "text": " There is human demonstration, there is other agents, and so on." }, { "start": 614.6, "end": 621.88, "text": " They have that, and you're supposed to take one of them, learn something, learn an agent," }, { "start": 621.88, "end": 627.2, "text": " and then evaluate it on an environment." }, { "start": 627.2, "end": 632.08, "text": " They propose which ones are suitable for this." }, { "start": 632.08, "end": 637.9, "text": " They give you the data, and they give you the environment to evaluate it on." }, { "start": 637.9, "end": 643.2, "text": " In the end, you'll get a score, and you can compare your offline RL algorithm with others." }, { "start": 643.2, "end": 649.72, "text": " They also provide some benchmark implementations for algorithms that already do this." }, { "start": 649.72, "end": 656.96, "text": " They show that they don't really work well." }, { "start": 656.96, "end": 661.44, "text": " One of the tasks is this maze here." }, { "start": 661.44, "end": 668.5600000000001, "text": " In this maze, the task is you are somewhere, let's say here, and you need to go somewhere," }, { "start": 668.5600000000001, "end": 673.08, "text": " let's say here, and you need to find your way." }, { "start": 673.08, "end": 680.1600000000001, "text": " The demonstrations you have, the data in your replay buffer, is such that this is the same" }, { "start": 680.1600000000001, "end": 685.24, "text": " task, but never the same start and end points like you are tasked to." }, { "start": 685.24, "end": 691.76, "text": " You might have one in your replay buffer, you might have one trajectory, one episode" }, { "start": 691.76, "end": 695.8000000000001, "text": " that went like this from one to two." }, { "start": 695.8000000000001, "end": 699.84, "text": " And you'll be able to see the reward of that." }, { "start": 699.84, "end": 707.12, "text": " And you might have one trajectory that was from two to three, like this." }, { "start": 707.12, "end": 711.9, "text": " Both of these things actually give you really high reward." }, { "start": 711.9, "end": 718.4, "text": " If you were an agent, and you had to learn, and now the task is please go from one to" }, { "start": 718.4, "end": 725.52, "text": " three, what you could do is you could simply say, I know the green thing gave a pretty" }, { "start": 725.52, "end": 729.12, "text": " high reward, and the yellow thing gave a pretty high reward." }, { "start": 729.12, "end": 734.08, "text": " I know the green thing started at one, and I know the yellow thing ended at three, and" }, { "start": 734.08, "end": 738.64, "text": " I know they both have this common location." }, { "start": 738.64, "end": 746.92, "text": " So what I might do just is I might go to that common location, and then go on on the different" }, { "start": 746.92, "end": 747.92, "text": " path, right?" }, { "start": 747.92, "end": 755, "text": " So you have to somehow stitch together experience from other agents in order to make your task" }, { "start": 755, "end": 756, "text": " work." }, { "start": 756, "end": 760.36, "text": " This is a very explicit example, of course, what we want to do is we want to do this in" }, { "start": 760.36, "end": 767.96, "text": " a more implicit deep learning way, ideally, and not manually stitch together other trajectories." }, { "start": 767.96, "end": 776.24, "text": " Though I'm pretty sure that would not be so dumb, right?" }, { "start": 776.24, "end": 781.28, "text": " I'm pretty sure there's a lot of data augmentation you could do during training simply by stitching" }, { "start": 781.28, "end": 786.04, "text": " together other trajectories, right?" }, { "start": 786.04, "end": 791.28, "text": " So from this trajectory, you could actually, not only could you make other gold conditioned" }, { "start": 791.28, "end": 796.88, "text": " ways, for example, from here to here, or from here to here, you could make from here to" }, { "start": 796.88, "end": 805.12, "text": " here anywhere where you have shared points, you could train a policy that goes there and" }, { "start": 805.12, "end": 807.36, "text": " then goes further or something like this." }, { "start": 807.36, "end": 812.24, "text": " I'm pretty sure there's already an algorithm that does things like this, but I'm just thinking" }, { "start": 812.24, "end": 813.44, "text": " aloud here." }, { "start": 813.44, "end": 821.48, "text": " Alright, so this is one of the tasks and you see that the that that you will have to learn" }, { "start": 821.48, "end": 827.04, "text": " a policy to go as fast as possible from any point to any other point." }, { "start": 827.04, "end": 832.28, "text": " And you're all you're given is a database of experience that already exists from some" }, { "start": 832.28, "end": 840.04, "text": " other agent, but never will probably never the exact route that you need to learn right" }, { "start": 840.04, "end": 841.56, "text": " now." }, { "start": 841.56, "end": 847.02, "text": " Alright, so the goal is how fast or how efficiently can you do this?" }, { "start": 847.02, "end": 849.8399999999999, "text": " This is one task in this data set." }, { "start": 849.8399999999999, "end": 857.0799999999999, "text": " The next task is very similar is this grid world here where there is this red square," }, { "start": 857.0799999999999, "end": 859.02, "text": " red triangle, that's your agent." }, { "start": 859.02, "end": 863.96, "text": " And then there is the green square, that's your goal or vice versa." }, { "start": 863.96, "end": 873.16, "text": " And so you're basically tasked to not hit the walls here and to go about your way finding" }, { "start": 873.16, "end": 874.9, "text": " the target." }, { "start": 874.9, "end": 882.4, "text": " There are more elaborate things like this mojo co environment here, or the ant maze" }, { "start": 882.4, "end": 886.6, "text": " where you have this little ant with you know, the spider legs." }, { "start": 886.6, "end": 890.08, "text": " So this is no longer you can just move in either direction, you have to actually control" }, { "start": 890.08, "end": 891.52, "text": " the legs." }, { "start": 891.52, "end": 899.14, "text": " And there's also this arm, this robotic arm." }, { "start": 899.14, "end": 903.9200000000001, "text": " So you see there is a wide diversity of tasks." }, { "start": 903.9200000000001, "end": 911.48, "text": " And also, there is a wide diversity of how the replay buffer was constructed." }, { "start": 911.48, "end": 918.72, "text": " So in some cases, the replay buffer is actually constructed by a human performing in this" }, { "start": 918.72, "end": 919.72, "text": " environment." }, { "start": 919.72, "end": 926, "text": " So in this hand manipulation task, you'll have demonstrations from humans." }, { "start": 926, "end": 929, "text": " You see it's not particularly many samples here." }, { "start": 929, "end": 939.5600000000001, "text": " It's 5000 samples, which I guess are is a chopped up version of I'm not really sure" }, { "start": 939.56, "end": 941.64, "text": " how the human things were constructed." }, { "start": 941.64, "end": 947.92, "text": " But you can clearly guess that the degrees of freedom that you have in a robotic hand" }, { "start": 947.92, "end": 954.0799999999999, "text": " is much, much higher than you could learn just from these 5000 samples if you were to," }, { "start": 954.0799999999999, "end": 958.76, "text": " you know, an online or algorithm that just does random exploration will need much more" }, { "start": 958.76, "end": 961.1999999999999, "text": " than these 5000 samples." }, { "start": 961.1999999999999, "end": 966.76, "text": " And the 5000 samples won't be I ID distributed with all the degrees of freedom, it will just" }, { "start": 966.76, "end": 969.64, "text": " be here's what a human does, right." }, { "start": 969.64, "end": 977.42, "text": " And so you can think of algorithms like inverse reinforcement learning or something like this." }, { "start": 977.42, "end": 986.76, "text": " But here in inverse reinforcement learning, usually you assume that the expert the expert" }, { "start": 986.76, "end": 991.3, "text": " is kind of trying to achieve the same reward as you do." }, { "start": 991.3, "end": 994.36, "text": " But this is not necessarily the case here." }, { "start": 994.36, "end": 1006.28, "text": " You have a given reward structure, but you are tasked to simply learn from these demonstrations." }, { "start": 1006.28, "end": 1011.16, "text": " You can see it's also possible that there is this is constructed by a policy." }, { "start": 1011.16, "end": 1020.7, "text": " And that usually means that they so either it's it's constructed by let's say a reinforcement" }, { "start": 1020.7, "end": 1026.2, "text": " learning algorithm that was trained in an online fashion, but maybe not as well." }, { "start": 1026.2, "end": 1032, "text": " But also I think they have behavior cloning policy that they got from human demonstration," }, { "start": 1032, "end": 1034.56, "text": " I think so that there are many ways." }, { "start": 1034.56, "end": 1041.3600000000001, "text": " Also sometimes you have a planner which is, can you imagine it's it's a it's an algorithm" }, { "start": 1041.3600000000001, "end": 1043.88, "text": " that wasn't machine learned." }, { "start": 1043.88, "end": 1052.8000000000002, "text": " So I know almost unthinkable, but in these in these kind of mazes, you can actually do" }, { "start": 1052.8000000000002, "end": 1061.2800000000002, "text": " planning algorithms that can can sort of so I know this is crazy and crazy talk, the niche" }, { "start": 1061.2800000000002, "end": 1068.16, "text": " topic but there exists things like a star search where where where you can construct" }, { "start": 1068.16, "end": 1074.1200000000001, "text": " the kind of shortest path through these mazes and things like this." }, { "start": 1074.1200000000001, "end": 1081.0400000000002, "text": " So yeah, that's I know, I know that that is that is very niche." }, { "start": 1081.0400000000002, "end": 1085.8400000000001, "text": " But you can construct policies like this." }, { "start": 1085.8400000000001, "end": 1090.18, "text": " And then you can use those as your replay buffer filling." }, { "start": 1090.18, "end": 1094.92, "text": " And you can already see that this also will be a massively different distribution of data" }, { "start": 1094.92, "end": 1100.72, "text": " than you would get with an online RL algorithm, right." }, { "start": 1100.72, "end": 1106.96, "text": " So in conclusion, they do test other they do test other algorithms on this." }, { "start": 1106.96, "end": 1115.0800000000002, "text": " In conclusion, they say that most offline RL algorithms nowadays, they don't work well" }, { "start": 1115.0800000000002, "end": 1118.76, "text": " on these on these data sets." }, { "start": 1118.76, "end": 1128.36, "text": " The only data sets where they do work well is where the replay buffer was generated by" }, { "start": 1128.36, "end": 1135.18, "text": " some sort of like here, by some sort of policy by some sort of reinforcement learning policy." }, { "start": 1135.18, "end": 1141.44, "text": " So what they would do is they would train an online policy and the experience generated" }, { "start": 1141.44, "end": 1147.26, "text": " by that online policy while it learns will make up the replay buffer." }, { "start": 1147.26, "end": 1155.04, "text": " And if you use that replay buffer for offline learning, then they say it tends to work okay." }, { "start": 1155.04, "end": 1163.2, "text": " But if you have other methods of collecting the data that are very different from this" }, { "start": 1163.2, "end": 1169.92, "text": " offline, sorry, from an from a reinforcement learning collection approach, then it tends" }, { "start": 1169.92, "end": 1172.32, "text": " not to work as well." }, { "start": 1172.32, "end": 1178.24, "text": " Alright, so if you are interested in offline RL, please check out this paper, all their" }, { "start": 1178.24, "end": 1181.08, "text": " code is available right here." }, { "start": 1181.08, "end": 1184.08, "text": " Note that the link in the paper doesn't seem to work." }, { "start": 1184.08, "end": 1187.9199999999998, "text": " The true link is here." }, { "start": 1187.9199999999998, "end": 1190.6, "text": " I'll also put it in the description." }, { "start": 1190.6, "end": 1193.52, "text": " And with that, I wish you a good day." }, { "start": 1193.52, "end": 1210.32, "text": " Bye!" } ]