images of a scene, and y is going to be the scene itself, or whatnot, like the tree or the mesh of


NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis (ML Research Paper Explained)

the tree or something like this. And I need this many, many times. So I need a data set with 30


images of, I don't know, a house, and the y is the house, and so on. So that's my training data set,


then my test data set, it can be something else, right? So it can be things that are now want to


test. However, in this particular case, this is not the case. Here, it is one neural network that


is one neural network that is fit to one scene. So what we have is a neural network that has a


bunch of layers. And all the neural network cares about is this particular scene, right? If we want


to render a new scene, we take a new neural network. That's what I mean, we overfit a single


neural network to this particular scene, we use the 30 images or so we got to train to completely


overfit this neural network. And the goal is going to be that the tree itself, like the scene itself,


is going to be in the weights of this neural network. So the weights of the neural network


now represent the scene. And this has various advantages, right? If the we already saw this


with the sirens, that very often, this is a much, much better representation, more compact


representation of the entire mesh than a any other way, like if you store it in voxels or something.


But I hope this is a bit clear. Now, of course, the question is, what's the input? And what's the


output of this neural network? So the input is the following. Imagine you have a coordinate system


here. So you get you get a coordinate system x, y, and z. Okay. And the neural network gets two


things as an input, it gets as an input a position in that coordinate system, which we call,


we call x, and x is a is actually x, y, z is a three dimensional vector, right? For example,


right here, this is our x now. And also, we get an D, which is a viewing direction. Okay, so the,


for example, if my camera is the top camera right here, the viewing direction would be


this ray here, well, everything's orange, and I make that blue. So the viewing direction,


D would be that, okay, so that the angle here, we care about the angle. It's actually two angles,


you need to describe this viewing direction. So a position and the viewing direction,


and the output of the neural network, what does it output? The output of the neural network is


going to be a color C, like what color is at that particular location? And the density? Is there even


something at that particular location, right? So the density tells you whether there is something


or not. And if there is something, the color tells you what color it is. All right. This is a really


different way. I want to stress that again, of using neural networks, there is no longer images


going in and you know, something coming out, what goes in is a position and a direction. So you ask


the neural network, hey, neural network, you, in your entirety, you represent the scene you represent.


If you're trained well, if you're overfit, well, you're you're overfit on the tree. Now, I want to


know at a particular location in this scene, viewed from a particular angle, what am I going to see?


So on this picture right here, I'm wondering for this pixel, if I send the array to this location,


what am I going to see? And the network will tell you, you're probably not going to see anything,


because there's nothing there. Or if there is something there, you're going to see the color,


I don't know, red. Okay, so how from this, you can pretty easily get a picture, namely, if I have


my frame of the picture, for each pixel, I need to send a ray through the scene. So I send the


ray through the scene. And what I need to do is I need simply need to query this model at each


location. So here, here, here, here, here, here, here, and so on. At each location, I will ask the


neural network, is there something there? And if there is, what kind of color am I gonna what am


I gonna see? And what you'll get is a bit of a curve, thank you, is a bit of a curve. So if here


is your zero, and you send the ray out into the scene, and this is the density going up, they have


these graphs in the paper, by the way, I'm not, I'm not smart enough to come up with them by myself.


But they say, well, maybe at the beginning, you're not going to see anything, because there's nothing


there. But then, you know, at some point, you're going to see something, there is something there,


you get you hit the tree, right? And you're inside the tree. And then you're out of the tree again.


At the same time, at every point, it gives you color. Now here, it actually doesn't matter what


the color is, it will still output a color, but it doesn't matter. And here is going to say, green,


right? It's going to say at every point here is going to say green, green, green, green. And here,


I guess it doesn't matter, it's probably going to say green as well. But in any case, what you can


now do is you can simply look at where do I hit the first time the object which is here, right,


when the density goes up, and what colors there. And now I know what I need to render at that


particular pixel. Now, you can simply do this for all pixels, and you got yourself an image. And the


neural network is powerful enough that for the same location, you can see this right here, it can


give you different results depending on the different viewing directions. So that makes it


such that it can kind of depend on where you view it from, it can capture these lighting effects,


these these reflections. And also it can capture transparency, because imagine you have a curve


that is not as clear as this one, but you have a curve that is something like here. So here is a


one wall of a glass, and here is another wall of the glass, and they go up in density, but they're


not fully dense, right? And the front of the glass is maybe blue, and the back of the glass is red.


And now, if you integrate your ray along this, and you integrate weighted by the density,


you're going to get a mixture of, you know, preferably blue, because that's in the front,


but also a little bit of red, right? You can see the, like if a ray goes through here,


you can handle transparency. And so this is a really powerful model right here. And again,


there's no need for a data set other than the date the scene that is right in front of you.


So the goal is going to be that if in the future, we want to, you know,


we want to make augmented reality applications, we want to make games and so on, you are not


actually going to store a mesh or kind of a voxel grid of some scene, what you're going to store is


a neural network that can be queried from anywhere you want to look at the scene and the neural


network will tell you what you're going to see. It just happens that these things work extraordinarily


well. So here's the process. Again, the task, you get a set of input images right here, you


want to find out where they're taken from. So for each input image, you need to determine where was


the camera and in which direction did it look, this is this is a known problem, you can so all


these kind of classic also structure from motion, slam and so on, they need to determine the camera


positions from the pictures. And so that that's a that's a thing you can take from existing research,


and then you want to render the new views. And yeah, here is I think where they get into it,


where all this is, yeah, we represent, they say, a continuous scene as a 5d vector valued function,


and this vector function is going to be a neural network, it has a five dimensional input, and it


has a the output is going to be a color, which is three dimensions and a density, which is one


dimension. Okay, so the input is a 3d location, and a 2d viewing direction. And the output is a color


and a volume density. So in practice, we express direction as a 3d Cartesian unit vector. And they


say we approximate this continuous 5d scene representation with an MLP network. So the network,


as we said, this is the input, this is the output, and we optimize its weights to map from each input


5d coordinate to its corresponding volume density and directional emitted color. Now the, the only


question is, of course, we have these images, we don't actually we don't actually have,


we don't actually have the as a training set, kind of the the the densities at that place. So


everything needs to be sort of grounded into the images that we have. Now, luckily, the whole


process that I've described here, which you see again here, so if you want to render an image,


you take an image, you pick a pixel, you shoot array, and you sample along the ray, and you ask


your network, what's there, the network will tell you if there's something there. And if so, what


color, you're going to see the density over time. And then you can render an image. Now you if,


if you already have an image, right, which is we are given a set of these images, if you already


have one, you can now calculate a loss, namely, what do I see? And what does the network tell me,


I should see right, if the network is not trained yet, that's going to be a pretty big loss.


And if you make the loss as something differentiable, then this whole process is in fact


differentiable. That's the next cool thing about this, the whole process of sending the ray,


sampling the position, integrating over it. And at the end, coming up with a pixel color.


That is a differentiable process, if of course, if you do it correctly. But that means that


we can use those 30 images or 50 or whatever we have, in order to construct a big loss, right,


every ray. So every pixel in every picture that we have defines a ray. So every ray essentially


is a data point that we can fit to. So at the end, we get a pretty sizable data set for the network,


which is going to be number of pixels times number of pictures. However, again, it is a different


problem than having a data set of many of these scenes. So the whole process is differentiable.


And that means you can just fit the neural network to this scene, you overfit it to these 30 images


that you have. And that's going to be your network. And this network is going to be your


network. And this network, then, is going to represent the scene in its weights.


So the weights are the scene at the end. There is a bit of a, so there are lots of engineering


tricks here. So for example, we encourage the representation to be multi view consistent


by restricting the network to predict the volume density as a function of only the location x,


while allowing the RGB color to be predicted as a function of both location and viewing direction.


So the reasoning here is that the volume density is not dependent on the direction, like either,


even if something is kind of transparent, it's going to be transparent, it's going to be the


same transparency in from different direction, there's only very limited amount of materials


where that is not the case, right. So as a simplifying concept, we're going to see the


transparency of the object is always the same, which is kind of where stuff is, is independent


of where you look from, it's only how stuff looks, that is dependent. So the RGB color


is going to be a function of both location and viewing direction. And what they do is essentially,


so they input x right here, they, so the location, they yank this through a network, they get out two


things. So they first get out this density, and they also get out a hidden representation,


that hidden representation, they then concatenate with the viewing direction. And that goes through


another stack of layers in order to give them the color. Okay, I think it's also, you know,


you could do something with a transformer here and some causal masking, though I'm pretty sure


someone has already done this, given that the paper is almost ancient at one year of age in


the machine learning world, that's really old. So, exactly. So this is the formula for newt for


rendering. This is a technique called volume rendering with radiance fields. If you have a


radiance field, a radiance field is a function that tells you exactly what we train in our network to


do. Namely, you know, if I look from here, and I look at that point, what do I see? What you want


to do is you want to send a ray through the scene, and you want to integrate along that ray. So you


have kind of a far bound and a near bound. And you want to integrate from the near bound to the far


bound. So that means you send the ray through the thing you want to integrate. This thing,


this T thing right here, that tells you, you can see the density is in here along the ray from the


beginning to the point where you are, that is the probability that the ray doesn't hit anything,


right? It's the probability that the ray goes on through that room, basically, it's the probability


of empty space. So, or, you know, the inverse of that, like this distinguishes whether there is


something or not, whether the ray continues up until the point T or not. So you have whether or


not the ray is actually at that particular point, how dense that particular point is, so how much


stuff there is in terms of occludence for your ray. So if this is high, your ray is going to stop,


and you're going to adopt the color that is there, you can see it's this is multiplied by the color


at that particular place. So you send the ray, and as soon as your system determine, you know,


there's something here, you're going to, since this is multiplied, the density is multiplied by


the color, your, your ray is going to adopt the color of whatever's there. And then after that,


this quantity here is going to be small, because this quantity is again, an inner integral that


tells you whether or not the ray even reaches that location. So the ray reaches the first location,


at which point it's going to adopt the color. And after that, the it, even though there is stuff,


right, even though the density is high, the ray is not reaching it. So the whole formula captures


all of this. And as we said, with a bit of nuance, it like, if this is not always zero one, it can


handle transparency as well. And here they demonstrate again, from the scene, so you have two


different points in the same scene, but viewed from different locations. And on the right, they


show you, this is all the same point in the scene, but the circle represents kind of different angles


at which you can view it from. And you can see that the color is really different depending on


the angle where you look from. There are, what do we have here? There are a lot of tricks. Oh, yeah,


so they, they approximate the integral with like quadrature, which also has existed. And


they have a bunch of tricks. So the first trick to really get this to work is a novel, like not a


novel, but kind of the employment of positional encoding, that a positional encoding is not the


same as you might know it from transformers or something, the positional encoding here, it simply


means that you send the input data point, which is this thing right here, XYZ theta five, Greek


theta five, Greek letter, you send that to a higher dimensional space, right, in a very deterministic


way. So if you have these low dimensional input, and especially if you want to represent this,


this is really fine structure right here, you can see that this stuff right here, it's quite


fine grained, okay. And so you need a way to handle fine differences between things, but you also need


a way to handle, you know, coarse differences. And just a single floating point number probably


isn't going to do it for a continuous function like this. So what you do is you send this to a


higher dimensionality with these positional encodings that we know from transformers. So


these encodings right here, they will send, so what you do, and so in my video on attention is


all you need, I explain those in detail, but you construct a hierarchy of sine waves, or like sine


and cosine waves, but we can we can just do it with with sine waves. So the the lowest hierarchy


is like this, and then the next thing in the hierarchy would be like double as fast. And then


the next thing, well this is four times as fast isn't it? Well you get the point right? It's, so I


need up, down, up, wow, and then up, down, up, down, up. This is not a sine wave, but you, I hope you get the


point. And then you want to take a look, for example your x, you take your x, you put it here, like okay x


is, so this is like negative, I think they go from negative one to one, the coordinates they have,


and your high dimensional output is going to be, you know, this point, this point, this point, and this


point in the in their respective coordinate systems, right? So that's, you can, what this does is you can


still clearly identify every point here, in fact, yeah you can, you can identify every single point


in your input space by, you know, looking at, looking at the combination of where it is in


these sine waves, but it gives the network a better chance to focus, for example, on details. If it


wants to focus on details, it's going to look at this scale right here, because tiny changes in the


underlying x is going to result in a large change in this feature. If you want to focus on coarse


grain stuff, then you look at this, where you can, you know, you have to move pretty far to have a


change, whereas if you look at this scale for coarse grain things, it means almost nothing, because


you know, if you want to make little difference between these two things, if you look at coarse


grained structure, but they have, as you can see, like there's a lot of difference between those,


like this may be zero, and this is maybe negative one. However, if you look at the two data points


right here, sorry about that, so the same, let's say the orange distance and the blue distance,


you can see that the two aren't so different in this representation. So it gives the network the


choice at which scale it wants to look at for particular positions. So ultimately, you're going


to map this five dimensional vector into a higher dimensional vector, and they consider like 10,


10 layers or four layers of these, how many of these different sine and cosine waves they construct.


So again, they call it positional ketting, they say, this is referred to as a positional encoding.


However, transformers use it for a different goal of providing discrete representations as input to


an architecture, yada yada yada. In contrast, we use these functions to map continuous input


coordinates into a higher dimensional space to enable our MLP to more easily approximate a higher


frequency functions. The second thing they do is they do hierarchical volume sampling. So when we


said I send a ray through the scene, and then I sample along, this either would take a lot of time


or it would not be accurate enough. So what they do is they have actually two layers of neural


network, one they call a course, and one they call a fine. And as I understand it, here is a ray,


here is a ray, they first sample with the course one at rather coarse locations. And then they use


that to evaluate where they should sample more, let's say, this thing right here has a real high


density in the course network, they then sample around that a lot more, maybe one here too, but


a lot more, you know, sampling around where the course network things the important stuff is,


they optimize both networks at the same time. And that actually works out well. So here you see the


loss, the loss is a combination now of the course network and the fine grained network. And you need


to optimize both even though the final view is only going to come from the fine grained network,


right? You need to optimize both because the coarse grain network can tell you where the important


stuff is. So the results you have already seen, there are a bunch of metrics that prove that this


one is really good. And it can, as you can see, like it can handle fine grained structure right


here in the microphone that others can't. And it also so they say it fits into a few. So one neural


network of one scene fits into like a few megabytes. And this is it fits into five megabytes.


And this is a lot better than things that use like voxel grid representations, which I think this


other thing they compare to uses over 15 gigabytes for the same scene. Which and this is interesting,


which is even less memory than the input images alone for a single scene from any of our data sets.


So this is really like, it's even smaller than the pictures. So even if you maybe want to show


this to another human, it'd be better you send the train nerve than the pictures if space is a


consideration, though I don't know how they measure the pictures like you can probably


compress if it's different pictures from the same scene, I guess there's some compression


potential if you want to transmit them as a bone, nevermind. So they also do ablations. And the only


downside here is that it does take a long time to fit one of these neural networks. I don't exactly


remember where they say it, but they say they calculate like, oh, here. So it's not too bad,


but the optimization for a single scene typically take around 100 to 300 k iterations to converge


on a single Nvidia v100 GPU, which is about one to two days. So it's a single GPU. So it is, you know,


you don't need a data center for it. But you're going to wait a while until you train one, though


you only need to train it once and then you can render new views as you please. Right. So the idea


I think is going to be that let's say you make a video game or so you're going to render this,


you know, at your servers, then you transmit the neural network to the clients and the clients can


just render it out right there. And yeah, there's a bunch of results and a bunch of ablations where


they kind of leave away different parts. And they show that especially kind of the positional


encodings. I think this is the positional encodings are really important. As you can see on


the right, there is no positional encodings. The view dependence is also quite important. You see,


if there's no view dependence, as you can see here, you do get the fine grain structure since


you do have positional encodings, but you don't get these kind of light effects, right? This is


this thing here is not a different color. It's simply the fact that the line light shines on it.


And it's just not there here because, you know, all the network can do is output the same color


for all directions and most directions simply don't have that reflection. All right, so that is


it. The code is available on this website that I've showed you. I'm certainly going to link it.


Tell me what you think. I think this is pretty cool. I know this has given rise to a lot of work


following up on this. I have very little overview over what's going on in the NERF space, but I


OpenAI CLIP: ConnectingText and Images (Paper Explained)

So here you see a classifier that takes a look at this image and assigns one of


many many labels actually one of a hundred and one labels as you can see


here and one of the labels is a photo of guacamole a type of food and it assigns


a really high probability to that as opposed to like the the second


prediction which is ceviche. So you know classifier pretty good okay take a look


at this classifier out of 397 labels it correctly identifies that this is a


television studio. You can go on right here and so this is a photo of an


airplane whenever there's a green bar at the top it means that the respective


classifier has this correctly whenever there is an orange bar it's an incorrect


label with the the green bar being the correct label. So you can see here these


classifiers perform sometimes pretty well on these examples and sometimes not


but what you can distinctly see is that these are all from different data sets


so different tasks there is a satellite image there is a car and you're supposed


to classify which car it is not only that it is a car so very diverse set of


tasks and the interesting thing is that this is all the same classifier so


this classifier is it's not even fine-tuned it is a zero-shot classifier


that handles all of these different training data sets sorry not training


data sets all of these different test data sets in one go so that's already


pretty cool but what you may have noticed is that the labels aren't labels


that you would usually see in a classifier so you know these these 101


labels here they are it says it here


guacamole that's the label interestingly the label the classifier assigns is not


just the word it's the a photo of guacamole a type of food


ok that's the label the classifier assigns and the second highest label is


a photo of ceviche a type of food it's not always a photo though it is often a


photo but here you can see for example the label that the classifier assigns is


a centered satellite photo of permanent crop land where the the correct label


here is the annual crop land which is down here again the label is longer so


there's something interesting going on here is the same classifier it's zero


shot so that means the classifier is not trained on these data sets it's not


trained to fulfill these tasks yet still it seems to perform ok and the labels


are quite weird so this is this is a new paper by open AI which we're going to


look at today you can see it's a pretty long paper but we'll cut it short I


promise


and it's called learning transferable visual modes from natural language


supervision and the model colloquially or or even also in this paper is referred


to as clip so this is the model has been released along with the dolly model


which you know can do the chair made of avocado and so on the dolly model is a


generative model that generates images clip is a more of a I want I want to say


discriminative model but clip is a model that takes in images and text and


connects them in a in a non generative way so we're going to see what that


entails it's by Alec Radford and Jong-Woo Kim and others as I said of open AI so


the idea here is to connect text and images and this has been done in a in a


number of ways previously even in this way it has been done in one fashion or


another I find the introduction and discussion of related related works in


this paper to be very very thorough and and superb so they do assign a lot of


credit to people who have had the various ideas so the goal here is that


we want to get a model that can represent images and text really really


well ok so how do we connect images and text first of all what what if what if


we have a data set of images and text ok so they construct a new data set where


there's an image something like this cat and a text a little piece of text to it


like my my cute cat images and text like this you'll find on you know for


example social media you can scrape that Pinterest what not flicker people write


descriptions along with their pictures so it's pretty easy to get these pairs


of images and text from the Internet without having to label them right so


one motivation of doing this kind of work is if we train a image classifier


model we always need labeled examples into you know into a very predefined set


of classes so in image net we have a thousand classes are 22,000


respectively in MNIST we have 10 however if we could just somehow learn


to connect images with the text that comes along we wouldn't be bound by the


classifier labels and we could get very good representations so the original idea


or one of the original ideas we take the image and we predict predict the text


from the image of course Dali goes the other way so Dali somehow goes the other


way taking the text and predicting the image but the idea is if we can take an


image and from it predict the text what we get out of it is not only a model


that can label images but what we hope to get out of it is this process right


here may be very very good representer so if this is like the image goes into


a neural network with a bunch of layers and then out comes you know the text my


cat and so on then somewhere in here in the intermediate representation of the


neural network there must be a pretty pretty good representation of what is in


the image so not not only you know the pixel values but there must be actually


some kind of representation of the concept of cat because otherwise it


could not predict the word cat at the end okay so the idea is to get a really


good representer and then you could take that representation and fine-tune it to


other tasks and so on so that's one of the ideas that we're going to work off


here and it turns out this is pretty useful there have been papers before


predicting the simply predicting the caption of images but it doesn't work too


well so what this model here is going for and we're simply simply let's look


at this graph right here so they tried first to predict the text and you can


see that zero shot and we're going to look at what exactly zero shot image net


accuracy means in this context but you can see here that they had some success


with using a transformer language model to predict the text in images and


evaluating that on on ImageNet however they seem to have more success by


using just a bag of words prediction so what that means is you you're not trying


to predict the exact words you're simply trying to predict which words occur in


the description so you see the photo if you predict cat and my and cute in you


know any not non-ordered you're already correct and that already gives a sort of


a better efficiency you can see the models here they tend to go up but it's


questionable if that will ever reach the orange line and with their new objective


with what this paper suggests you can see right here the contrastive method


you get a way bigger performance so we'll look at what this zero shot


accuracy means and why it might be that these simply predicting the text from an


image might not be a good enough idea so let's say we have a model that can do


this we have a model that can take an image and it can predict the the text


that appears in it right most of the time this model right here is also going


to give you something like a probability ok like a likelihood so if this is a a


transformer you can you can ask you know for its log it's and then you can compute


the likelihood of a given label so if you have such a model what you can do is


exactly what what they allude to right here if you have an image task right and


you have a you have a model that can predict the the text of an image you can


take that image and you can run this sort of through your image and through


your encoding pipeline and then you can ask the model instead of you know


predicting a text you can ask the model how likely is the text dog how likely is


the text cat for this image how likely is the text mouse and then you can you


get some sort of likelihood right so maybe it says dog is this likely cat is


this likely mouse is this likely and immediately you have built a classifier


so I hope you can see if if I have a model that can predict how likely a


piece of text goes with an image I can buy simply asking my model for each of


the for each of the classes that are possible in the task I immediately get a


classifier out of that I mean I have to normalize or something by that but I


immediately get a classifier and now you can already see why we might want to


phrase the things a bit so I don't want to just put dog and cat right here even


though those are the labels in that task right if if I had an image net


classifier I would put here I would put all of the 1000 possible classes and ask


the model for each how likely is that label to go with this image and the


model you know can produce text but the model can not only produce you know the


single word dog the model can also tell me how likely is the phrase a photo of a


dog a photo of a dog or how likely is the phrase a photo of a cat and so on


right so and you can you can see that this result here the classifier result


it might change actually depending on how you phrase so here you can use the


exact same classes as you used above but by rephrasing the prompt so to say you


might get a better quality classifier or a worse quality classifier so if you


already know that your images are all photographs and you will get a better


accuracy because simply you know the model if you you might get a better


accuracy by asking the model hey how likely is the phrase a photo of a dog


going with this image versus the phrase a photo of a cat that might give you a


better signal so less noise in whatever you get as an output than simply going


with the single word because again this model is trained to predict this just


from a data set scrape from the internet so how often do people you know post


something I don't know an Instagram of their cat and simply write cat with it


whereas you know maybe they they all right here's a photo of my cat right so


the the phrase a photo of a cat is or they do like hashtag photo hashtag cat


or something like this so that's why these classifiers at the bottom they


were constructed from the labels of the data set but with a prompt that has been


adapted by humans to work you know fine to work particularly well on that data


set so we're sort of back to prompt engineering here so this is how we go


from a model that can assess predict text to a classifier and that's a


zero-shot classifier we don't need to train this classifier on the actual task


we simply need to restrict its possible outputs to the classes at hand right this


is a bit it's a bit like a tiny bit like like you know in in Q learning in where


for in in each step you ask your model well what if I do action one and then


the model tells you what that's five good probably that your Q value is five


and then you says well what if I do action two and then your the model says


well that's seven good and so on so it's it's sort of a similar concept in except


you know Q learning we usually train end-to-end with an actual classifier but


I said simply predicting text objective might not be good enough right so we're


going to retain this property of being able to zero shot to classifier but


we're going to now switch out our task of how we get to such a model so instead


of predicting text what does clip do clip does the following so what we're


going to do is we're going to take the image right here and we're going to pass


it through an image encoder and that gives us an image representation so a


vector in some latent space so this is image one and then image two right here


would be image two here ok so we have a mini batch of images and that's


important then we're going to take the text and feed it to the text encoder


also obtaining a representation for the text at a single vector for this entire


text right here and then of course if we go to the second sample in the mini


batch we get the second representation and the batches of course in the


training data set we know that the first the first text goes with the first image


the second text goes with the second image the third text goes with the third


image because that's how we scraped it from the Internet and then what we ask


the model to do is simply to tell us not so previously we tried to predict from


the image the text right we went through the image encoder and from this


representation here we try to predict the text so we no longer do that what


we're trying to do is simply ask ask the model which for so for this


representation which of these texts is most appropriate to that particular


image ok so this is what why it's called a contrastive objective we know


because this is training data we of course know that image one goes with


description one and image two goes with description two but we're going to train


this in the way that you know we feed in this image and we ask it to which of all


of these texts right here to which of all of these is this image the closest


and we're going to train it such that it is maximally close to the correct one


and minimally and far away from all the other so this this is why it's


contrastive it contrasts what we know goes together right the diagonal


elements in this matrix with what we know doesn't go together in actually we


don't know if a different description wouldn't fit the same image but we can


safely assume that a random piece of text since we do the mini batches


randomly a random piece of text will probably not go with this particular


image at least not as well as the piece of text that we founded with on the


Internet ok so you get what you get is effectively for each input you get a


classification task in this direction you can see right here for image three


there is one correct text that it goes with and for each text you get a


classification task in this direction by the way this is simply an inner product


right here right you simply trying to maximize the inner product of things


that go together and minimize the inner product of things that don't go together


so you you multiply the two for the inner product you interpret that as a


log it and then you do a softmax classification in this direction and the


softmax classification in this direction so this is a symmetric loss from the


text and image perspective and yeah so so it's a classification problem


classification problem viewed from two different angles so you can immediately


see that this relies on having large enough mini batches right so the larger


your mini batch as your mini batch size approximates the entire data set your


representations are going to be more and more detailed right so so you wanna so


pepper the Aussie pop being close together to this particular image means


that in the ideal case it is close to this image and far away from anything


else in in the data set and as an approximation far away from anything in


this particular mini batch and at inference time you do very much what we


did so far so you take if you want to build an image classifier and the


interesting thing is you can also build a text classifier right if you have


multiple images to go with a text then you you can do that it's entirely


symmetric but in this case you take an image you put it through the image


encoder you get a representation here you get all the labels of your


classification tasks right so this is the label is this right here you


engineer a prompt and that you do as a human right this is heuristic this you


as a human think aha okay I'm going to put whatever this is here you encode all


of these labels in their prompt context through the text encoder you get the


representations here and you simply ask to which of these labels is it closest


right so the is the inner product the highest and then and that's how you


obtain the label zero training needed on the actual task right so the tape the


data set that you do this with can be an entirely different data set that then


you do this with and this is extremely extremely interesting I've actually seen


some some posts on on Twitter and Reddit where people use this to guide a style


GAN to produce given pictures with given descriptions and so on so the


possibilities for this are pretty pretty huge okay so that's that's the model the


model it encodes images encodes text it does this contrastive objective what


goes together what needs a part and now you see why this might be a better


representer than for example simply pre training a model on an image


classification task because if you pre train a model on an image classification


task it is going to simply lump together every all the dogs you know if this is


if this is your classification task it's going to lump together all the dogs


because there's no need to differentiate the individual dogs from


each other right it's going to lump all of them together and forget that they


are actually different right it's also going to forget everything that doesn't


concern the immediate classification problem whereas this model here this


model is specific as as it gets better and better it will pick up at more of


the text right so in this case maybe if the model is pretty weak still it will


focus on this pop and that's about the same as saying okay it's a classifier of


a dog but then we can also all see pop if it incorporates that if it gets


better well it can differentiate it from other dogs and by the way it's a pop so


it's a young dog I can also learn eventually learn its actual name right


and and so on so you can see this as the model gets stronger can pick up more and


more nuances of the data set so they test this and they tested fairly fairly


fairly extensively and I don't think we'll have to go through all of it for


me to convince you that this is a good idea you're going to maybe see it


approximately or immediately so yes so they use different different types of


yes that's what I wanted to say they use different types of encoders for the


image encoder so for the text encoder this is a transformer so transformer it's


not a particularly big transformer even and they simply take the end of sentence


token the representation of that at the end and that's their vector if you don't


know what a transformer is I've done many many videos on transformers find one of


them any of them for the image encoder they test out a bunch of different


things so they test out a bunch of variants of resnet I've done a video on


that and they also test out a bunch of variants of the visual transformer the


the VIT that has recently been popularized I've also made a video on


that so that's why their model shows up in sort of different flavors and sort of


different different points here they scale the amount of data I believe with


the model so they scale everything together compute data and model size and


that's why you see different variants of the same model they also do ensembling


so you know you have to engineer these prompts and what you can do is you can


engineer better prompts and that will gain performance and you can also


ensemble over prompts and you can see right here that that gets you both an


efficiency gain if you want to stay at the same performance and also sorry yeah


and also it gives you a performance improvement for the same compute with


the same model right so here the corresponding dots are the same model


that's why they have the same compute so that's just one of the fun things you


can do and again I think prompt engineering will become quite a bit more


relevant so here you can see you can see the comparison zero shot clip is


competitive with a fully supervised baseline right so the baseline here


isn't too good so it's a fully supervised linear classifier fitted on


ResNet 50 features on 16 datasets including ImageNet so the ResNet 50 is a


popular architecture it's not nowhere near the absolute best we have but it's


a popular architecture so this ResNet 50 what it's what it has been trained on


is that's been trained on ImageNet right so you get so and that results in a


neural network with a bunch of layers including a classification layer at the


end right into a thousand classes so what you do is you pre-train this on


ImageNet and then you simply take this part right here up until the last layer


and you take it so that's this part right here and you assume that this has


a sort of a good representational power since it can do ImageNet and then you


simply train a new linear classifier on top that does the classification into


whatever new task you want so this is called it's called linear probing so


linear probing you can also do it in the middle sort of but in this case they


mean linear probing at the second to last layer like before the classification


layer so you assume that whatever this is is a good representation function you


keep it constant and then you train a linear probe on top of it this is


compared to fine-tuning where you would fine-tune the entire network on your new


task but they elect to do most of their experiments with linear probing since it


gives you a better indication of the representational power of the bases so


here they compare to ImageNet right in so on 16 data is it including ImageNet


so for ImageNet you would expect the ResNet-50 to perform quite well because


it's been its representational base has been trained on ImageNet and training a


linear classifier on top it should simply give you back the performance


that it had on ImageNet here you can see how zero shot clip compares to linear


probe on ResNet-50 right zero shot clip compared to an actual trained thing not


not the best but a trained thing and you can see that on many many many data sets


clip outperforms the ResNet-50 zero shot right and so no training required


beyond the pre-training that being said the pre-training is huge but it's


similar to GPT-3 right you train it once huge training but then you can do lots


of things ImageNet interestingly you see right here only it's actually improving


ImageNet over ResNet-50 crazy right whereas so ResNet-50 still better in


various other tasks so this is not to say that this is the new state of the


art or anything except in STL-10 where it actually appears to be the new state


of the art against all the previously including all the supervised whatever


it's the new state of the art on this data set and the reason is this STL-10


data set it has very few training examples per class only so supervised is


very difficult transfer learning is kind of difficult as I understand it it's not


that similar to ImageNet so that transfer learning is kind of different


so this really seems to be this zero shot clip objective seems to be good if


you have images that are sort of natural that happen a lot on the internet but


are not really like ImageNet so there exists quite a number of those and that


you have few labeled examples of if any right so that's a that's a good


application domain however on more specialized things they say things like


you know tumor classification and so on satellite images this clip objective


still does pretty poorly probably because you know that that's not the


type of images you find on the internet with a piece of text super interesting


MNIST one of the easiest tasks in deep learning it also quite underperforms in


this in this thing so that they do they do an analysis of these different data


sets so they they compare to ResNet 50 and also to visual N grams right here


and they discuss the the importance of the different data sets oh I find I


found this to I found this to be very interesting most standard image


classification that data sets treat the information naming or describing classes


which enables natural language based zero shot transfer as an afterthought


the vast majority of data sets annotate images with just a numeric ID of the


label and contain a file mapping these IDs back to their names in English some


data sets such as flowers and the GTSRB that's a German transport street sign or


data set I don't exactly know don't appear to include this mapping at all in


their released versions preventing zero shot transfer entirely so what these


authors had to do is they had to like look at the classes and then sort of


label them themselves because their model works on language whereas this


street sign data set probably just came with this is sign type one this is sign


type two they have a footnote here Alec learned much more about flower species


and German traffic signs over the course of this project than he originally


anticipated I love that I love a bit of humor in the papers and I thought I made


this meme where the street sign is specifically tractors and trucks with an


authorized loaded weight of more than 3.5 tons prohibited I wonder actually how


the model does on exactly this sign but yeah we'll find out by the way the clip


model is available in not the big one but a small one is available actually


trained so you can test it out and maybe we'll do a video on it where we actually


do something with it so here you can see that if they compare their model to few


shot linear probes so here they compare zero shot clip with few shot linear


probe so before we compare to linear probe which mean means we just trained


this linear classifier but we did it on the whole data set ok so here we


simulate only having very few examples per class which is where pre-training


really comes in and you can see that zero shot clip outperforms a lot of


models if you only give them very few labeled examples per class in fact it is


comparative to a 16 it is comparative to a 16 label bit M so this is one of the


best models that is currently in the public and that is doing this transfer


learning if you transfer learn with a linear probe again this is not fine


tuning with a linear probe on 16 samples per class with this model you are still


only as good as the zero shot no training at all of the clip model that


is pretty pretty interesting and pretty cool the other noteworthy thing is that


if you linearly probe the clip model you way outperform the the largest models


there and also what is also interesting is that when you do labeled examples for


clip when you do linear probe on clip the performance decreases first and only


increases once you get to like four labeled examples per class and that you


know is is pretty intuitive when you think about it so what you're doing is


it's a in clip the zero shot classifier is actually a different one than the


linear classifier so the zero shot classifier is in a way already trained


so it has already trained the sort of last layer where as if you do linear


probing you throw that away you know that the whole part where you encode the


text and you blah blah blah you throw that away and you simply do the old


school so the linear probe here this is no more that is which text is close this


is simply I take this I throw away the last layer I put in a new last layer and


I do my original classification task and of course this layer right here is


initialized randomly and it's going to require some training and maybe you know


one example per class isn't enough it's just going to pick up on some spurious


correlation in the feature and it's going that's why it's getting worse


initially but it recovers at four examples per class and it severely


outperforms the other models so we'll forgive it they do discover in various


experiments here that it is very very different from data set to data set how


this model performs zero shot how it performs versus linear probing they they


find that they find that very often in in in some data sets that are far away


from sort of natural images they perform worse in again in some data sets they


require lots of labels to match zero short performance so it is really a


study into sort of I want to say it's a study into what kind of images appear on


the Internet they do interestingly there is a trend in machine learning that if


you give more data and compute then your error goes down even with the same type


of models and that seems to hold pretty well here as you can see here as they


scale up this is the same this is a ResNet backbone as you scale that up zero


shot clip performance scales smoothly as a function of model compute however they


do note that there is a whole bunch of variations of the curve you're seeing as


the average but for the individual tasks in their task data sets it it varies


wildly so there's a lot of noise here this could be because of how the data


sets are selected this could be because of how the prompts are engineered there


are still a lot on known right here they compare various other things like linear


probe linear probe performance of clip models in comparison with state-of-the-


art computer vision models and they do outperform all of these other models as


you can see here so there is 12 data sets in previous experiments but the 12


are still sort of similar to ImageNet but if you include more data sets of


course that's sort of a selection bias or whatnot but then these model severely


outperforms all of the other models so the red models here are the red ones are


the clip models compared to the other ones so yeah this seems to be a step


forward in the sort of in the sort of building classifiers for the average


user right so I can now go ahead take this model and build my own classifier


pretty pretty easily they also make some interesting discoveries in terms of


robustness and robustness to perturbations so previously all these


models they sort of pre-trained on ImageNet and so on and people have


discovered that as soon as you go away from ImageNet these the performance of


these models decreases heavily so if for example ImageNet v2 is just ImageNet but


is it they try to collect I've made a video about that by the way they try to


collect ImageNet as closely as possible to the original test set they try to


collect a new test set and immediately the performance of all the classifiers


dropped in the light of this just slightly data shifted data set and if


you if you sort of try to go away a little bit further so you just have


sketches of these objects you sort of have this this adversarial placement of


objects you can see right here it's you know it's pretty it's pretty mean but


still a human could do this right you see right here these are just variations


on the themes of ImageNet they have the same classes so a classifier trained on


ImageNet should be able to also classify these images right so here they compare


zero shot clip to models that have been trained on ImageNet and they find that


zero shot clip even though it matches so this zero shot clip matches the


performance of ImageNet by the way huge achievement right this is a fully


trained model on ImageNet and this is a not the state-of-the-art but respectable


top one performance on ImageNet and zero shot classifier matches that


performance this is crazy okay you can see as this classifier degrades degrades


degrades degrades degrades as you go to harder and harder data sets that are all


technically ImageNet images like in the same classes this classifier it


sometimes even you know gets better but it you know it keeps up its performance


which you can see here the difference between it gets just larger and larger


so the clip is way more robust and of course this model right here is trained


to predict these specific types of images so it knows very well like how to


keep them apart the only thing it has to do as a classifier of ImageNet is keep


apart the individual instances of exactly those classes in exactly the


status set so it forgets about everything else right and as a result it


has never seen a sketch it like a banana is yellow what are you talking about so


it heavily degrades right and whereas clip it simply knows how to sort of


connect images to text so while clip realizes that of course both are


described as banana it somehow has to account for the fact that there are also


lemons in here right it has to somehow represent that it has to represent that


this is a bunch of fruit and that this is here maybe a you know high-grade


picture like on a magazine where this here might be more of a sort of random


GoPro fallen into some bunch of bananas it has to somehow represent all of this


if it performs well on its task and thereby its representation will be


nuanced enough such that it can transfer more easily it picks up on different


features only distinguishing banana from you know other classes in the ImageNet


data set and that results so here is the the curve in that if you had the ideally


robust model you'd have this right here so the exact same performance on the


natural distortions then on ImageNet in the original ImageNet you can see that


all of the standard ImageNet training examples including all the robustness


techniques that barely lift away from this curve are massively outperformed by


a zero again a zero shot classifier that hasn't even been trained on ImageNet and


the fact that it hasn't been trained on ImageNet might be one of the you know


things that it actually is is very helpful so they do they do some


investigation into it in including that you can in fact adapt to ImageNet so you


can in I think that's the that's a linear probe if you linear probe clip


you can improve the performance on ImageNet where interestingly you can


improve the performance on ImageNet by doing a linear probe on top of clip this


is logistic regression clip while only mildly degrading your performance on


these other data sets so there seems to be a value to only have to just having


the representation so the representation itself seems to be more stable


ok so you can see as you adapt to ImageNet this performance improves massively but it


only degrades a little bit across the other data sets so that means yeah as I


said the representation itself is more nuanced such that even if you train a


linear classifier on pure classification you'll still keep up the performance on


the other tasks you can also adapt to class shift so by better prompt sort of


prompt engineering for some of these subtasks but I think that's a sort of a


minor thing


alright yeah I don't want to go you know too much they also compare to humans


which is very interesting and they discover that in you know samples that


are hard for the clip model are also hard for the human model they do some


sort of duplicate detection from their training data set because their training


data set is 400 million images together with text right so it's conceivable that


there's some duplicates but they find even if there is this generally not a


problem and they have like a three or four page broader impact section as you


can see right here which you know is so if you read it it reads sort of like


yeah there are problems with these models we are better than other models


but we're still not good enough or things like this or they always they're


like yeah this is of course we're better like they're better at everything but


then again you know this is only preliminary more study is needed and so


on but I so they have some fairly interesting interesting results so they


what they do is since there is such a focus on prompt engineering right it


actually matters what you give to the model as possible labels so this is no


longer fixed labels you can give any labels so they have these data sets


where you know for example this fair face fair face race where you try to


categorize faces into different ethnic ethnicities or races these seven things


that are given here they also include some non-human categories or is it so


they include they include categories such as here such as animal chimpanzee


gorilla orangutan and they also include sort of crime categories like thief


suspicious person criminal and then they research how how the model misbehaves


and these models they do do a fair bit of you know kind of misclassification


right here as you can see they also so they notice that the misclassification


is especially there for younger people so these are the ages of people and here


are the misclassification rates you can see the misclassifications are mostly


for younger people then they simply add a child category and then the


misclassification for young people all of a sudden drops because the model now


has the option to classify them as a child so this I think the result of the


paper and especially of the broader impact section one of the results is


that it matters a lot how you engineer the prompts which is something we


already knew but of course this can be particularly particularly crucial in


some applications in some concerning applications that's kind of one of their


points right here you can see that the paper is huge and it also has a huge


appendix and they do as I said a lot more experiments right here but all in


all this is a very very cool approach I feel and it's as I said a step towards


making it easier for you know the everyday person to build their own


classifier for you know you can do quite niche tasks as long as they're sort of


natural images this will work fairly fairly well I think it's pretty cool it


gives it gives a little bit of more freedom in how you work with these


models and I'm excited for people to come up with ideas of how to use this


how to connect this to other models such as you can connect it as we already saw


with Dolly you can connect it with style Gann as some people are doing and sure


you can connect it to something like GPT-3 and it's going to be an exciting


[ML News] CVPR bans social media paper promotion | AI restores Rembrandt | GPU prices down

CVPR forbids tweeting about papers, AI is used to restore Rembrandt, and a potential


deepfake has big consequences in the country of Myanmar.


Welcome to this week's ML news.


Hello and welcome to ML news, your absolutely regular every week on Monday update on what's


going on in the machine learning world.


The first one fresh of the press Walter Schirer writes the result of the CVPR 2021 POMYTC votes


are in all four motions passed.


This decides over the future of the CVPR conference in the next few years.


Now you can see the motions here and particularly interesting is motion number four social media


limitation during review overwhelmingly accepted.


This motion was proposed by Michael Black and says social media promotion of papers


is prohibited during the review period for CVPR except for automatic posting of new pre


prints by archive.


So essentially means during the review period, you're not allowed to go and tweet about your


papers, you're only allowed to upload them to archive and there is an exception because


archive sometimes automatically tweets new papers, anything else, no go.


Now there is a bit of an outrage about this.


I have to say it's not as big of a rule change as it seems.


So the reasoning behind this is there already used to be a press release ban during the


review period.


And this motion simply extends the press release ban to social media because effectively while


you can do a press release, you could still tweet about your papers and get the word out


this way.


The big concern here is that groups with a lot of following or a lot of press influence


will have their papers exposed to more people which could bias the review process.


Now in the light of already existing press ban, extending the ban to social media makes


sense.


However, I feel the bigger issue is why is there a press ban at all?


Why aren't you allowed to talk about your papers as they're under review?


So the argumentation of the proposal is that this can bias the reviewers judgment if they're


exposed to this work.


Now as much as I like the idea of peer review, it's really not working currently.


They say peer review is the backbone of science.


The process helps detect mistakes or false claims before the work appears in public.


Yeah, right.


When has this happened the last time I've exposed more false claims on my channel than


the entire ZVPR conference in the review process.


We have to get away from this notion that peer review is adequately constituted by


three dudes sitting on the toilet whilst flicking through your paper on their smartphone and


then giving a weak reject.


I argue that social media is the actual peer review.


What seems weird to me is that they have sort of an FAQ here answering some of the worries


about this.


So there are questions why won't this slow down scientific progress?


And what about archive and their claim here is that no, this won't slow down scientific


progress because experts in the field make scientific progress, not the general public.


And here again, archive tweets are largely followed by experts in the field and not the


general public.


Wait, I thought the peer review was supposed to be experts.


Aren't the peer reviewers exactly the people who would follow the archive publications?


Like if it was just a general public receiving the social media posts, why are we worried?


After all, experts make the contributions in the scientific field, not the general public.


The truth is that currently social media imperfect unbalanced with different followings as it


is constitutes a much more rigorous peer review process than what we have at conferences.


The social network that we've built up online effectively highlights interesting papers.


And yes, a lot of them come from big companies.


But let's face it, they have really good researchers and a lot of resources.


But often it happens enough that some no name paper gets surfaced because it is interesting,


whereas in a conference proceedings, it would just get lost.


This is in the light of other conferences doing things like archive blackouts before


submitting and people calling for entirely banning archive uploads before conferences.


All of this is highly suspicious.


Now who is really profiting from the current system?


And who's really going to lose from a more open approach to publishing?


It's going to be people that take part in the nice little collusion rings that we have.


These are people publishing dozens and dozens and dozens of paper each year in some niche


field where everyone knows everyone and everyone knows who everyone's paper is from.


And they just kind of accept each other.


However, when the public encounters these papers, they're generally boring, not interesting,


and don't actually contribute anything to the knowledge of humankind.


So yeah, if research is more in public, that's not going to fly anymore, which is a good


thing.


So future CVP or submitters, all the youtubers inboxes are at your disposal.


Enough of us are bribeable.


So you still have good outlets if you have money.


Well won't that tilt the balance even more into the direction of big corporations.


So in conclusions, conferences are hellbent on making themselves not important even faster


than they already are.


Next news, supermarket news writes Walmart enlists artificial intelligence for online


grocery substitution.


So this is actually pretty interesting in that Walmart has people going around shopping


for you.


So you place an online order and these people go and they buy stuff for you.


However, sometimes items are out of stock.


And when that happens, a substitution needs to happen.


So Walmart apparently has built some sort of a recommender system that tells these shoppers


which product they can substitute.


I originally thought this was a pretty simple problem like, oh, we don't have this milk


have this other milk, but it seems to be that it's not that easy.


And they claim since deploying the AI solution customer acceptance of online grocery substitutions


has climbed over 95%.


So good for them real world problem AI solves it all good.


Is this a marketing piece?


Absolutely, but still kind of cool.


Okay, Nvidia releases alias free GAN and this fixes the supposed problem of the strong dependence


of GANs on the exact coordinates of the pixels.


Now I won't go through the paper here.


But you should look at these visualizations.


They're pretty, pretty cool.


So on the left, you see the old style again, and it's so freaky.


Look at the hair, it kind of stays in place while the face goes around.


Well, of course, their method fixes this particular problem.


Here's the same, it just kind of looks like a head that's kind of sliding under a foreground


layer of hair.


What's also praised about the new model is the sort of better interpolations that you


can see right here.


And again, you can see the less dependence on the actual pixel coordinates, particularly


impressive I find to be this beach interpolation where you can see style gun just kind of keeps


everything at the same place ish, while as the alias free GAN tends to move around a


lot.


Now whether these are cherry picked or not, and whether in the final analysis, the alias


free GAN is really better than the style gun, who knows?


Safe to say when it comes to GANs, we are pushing the limits of what's doable.


And we are really getting into the territories of fine tuning these things are to believe


that like five years ago, we could barely make a face.


So yeah.


Speaking of GANs, apparently in the country of Myanmar, there is a confession video going


around of a politician confessing to transferring some money.


And due to artifacts in the video, people claim it's a deepfake.


Now this article here explores this claim and comes to the conclusion that probably


the artifacts are more a compression artifact because the video is very low quality.


But it does raise important questions as if we get better and better and better at producing


realistic looking images, sound and video in the future, we'll have to develop new expectations


of what counts as real evidence of something happening.


A video of you saying something or doing something might no longer be enough as you could just


always claim that is a deepfake.


Now I wouldn't be so overly worried about this because we have the same situation right


now with writing.


If I simply claim to that a certain person who recently passed away and once founded


an antivirus company has sent me an email briefly before his death and the email said


certain things.


I could even present you the email on a sheet of paper yet you wouldn't necessarily believe


me.


So what we'll have to change is just our expectations of which mediums are valid forms of evidence


and not easily tampered with.


I don't know what's going to be the solution in the future, but I'm sure we'll come up


with something.


Smithsonian magazine writes lost edges of Rembrandt's Night Watch are restored using artificial


intelligence.


Apparently this painting had been cut at some point to hang it on some wall and the cuts


have been lost.


Now artificial intelligence has been used to restore this painting.


How nice.


So apparently this is a multi million dollar restoration project and at the same time it


seems like a really really concerted effort but also from what they tell it it also seems


like you could do it in five minutes.


On one hand the input data seems to be really rich so there is x ray scanners 528 digital


exposures and so on.


On the other hand they write things like though many museums employ painters to reconstruct


masterworks the senior scientist Robert Aardman was able to use a computer to recreate the


missing panels computer.


So they apparently they use this new technology called convolutional neural networks, a type


of artificial intelligence algorithm that helps computers figure out what images may


have once looked like.


Okay, the crux of the thing now comes when they say apparently there is a copy of the


original painting that sort of shows what it should look like.


So essentially what these researchers did appears to be something like a sophisticated


style transfer where they use the copy of the image as a base and then transfer the


style of Rembrandt on top of it.


Now this is both pretty cool in that we now have technology that can do these things but


we also have to be honest about what this is.


This is a believable way this could have looked like.


There is no way of knowing if Rembrandt actually drew this particular thing or something else


that resulted in the same copy of this other painter.


In any case, the picture is now complete thanks to computer.


Thanks computer.


Okay, Greenville Business magazine writes Prisma Health announces artificial intelligence


partnership to make doctors more efficient to inform them with their decisions and so


on and at the same time the verge writes a hospital algorithm designed to predict a deadly


condition misses most cases and it also had many false alarms.


So the algorithm was tasked with detecting sepsis, a complicated condition that can bring


patients into critical state.


Now the way this was trained was with data labeled not whether the patient has sepsis


or not, but whether the doctor would submit a bill for treatment of sepsis.


So essentially it's trying to replicate what the doctors do and not actually predict the


patient's state.


I get that this is easier labels than actually figuring out what happened but also don't


be surprised if then it doesn't work better than the doctors.


They say it's essentially trying to predict what physicians are already doing.


Suffice to say, while AI is a powerful tool that can definitely help with many things,


we still have to be careful when we deploy it in the real world and actually measure


its performance.


And given that this article exists, performance has been measured and we're going to go back


to the drawing board.


Chip Yuan and others released a book called Introduction to Machine Learning Interviews.


The book is mostly for interviewees but also for interviewers to prepare for machine learning


interviews.


So if you have an interview soon, or if you're looking to interview someone, this might be


a nice resource for you.


The book is free and available.


Give it a try.


It might just get you a job.


As fast as one can go, turn sketches into stunning landscapes with NVIDIA canvas written


by NVIDIA.


So NVIDIA has released this new application called canvas in which you're able to sort


of draw a doodle and it will transform it into really nice looking pictures.


This is part of the NVIDIA sort of artists suite that helps people be more creative,


I guess, or less or differently.


I'm not sure how to characterize this.


The canvas app is available as a beta you can download it if you do have an NVIDIA graphics


card, I believe.


I haven't tried it out myself because all the graphics card I have access to don't actually


have a monitor on them.


So what do I do?


Speaking of GPUs, good news for deep learners as the register writes now that China has


all but banned cryptocurrencies GPU prices are falling like Bitcoin.


So China hasn't fully banned cryptocurrencies but is cracking down majorly on them.


And that means that some of the mining power is going away and with it the GPU demand is


lower than it used to be.


So if you wanted to buy yourself a data center now might be the time.


Facebook is looking to make your shopping experience easier using AI.


They have a selection of software called product match that helps identify products from pictures.


Among other things.


So this allows sellers to tag their products easily, but it also allows you to find products


that you see somewhere or on someone.


So artificial intelligence might help you with shopping in the future.


And I can't wait to see all the adversarial attacks on these systems.


Yes, for sure.


I'm going to sell you a Rolex.


It's right here.


The AI system even says it's one 3000 bucks.


Thank you.


Google AI releases deep lab two for TensorFlow, which is a library to do pixel based segmentation,


or any sort of pixel based labeling tasks.


So this is on GitHub, you can go check it out.


If you are in that space.


It seems like it's a good code base.


If you're in the research directions or tasks of pixel based labeling, such as semantic


segmentation or textual labeling or explainable AI, give it a look.


Alright, besides all the news, I feel we should also cover some non news.


So I've seen this paper, the experts decoding time control text generation with experts


and anti experts.


Now, this seems to be a good paper.


As far as I can tell, it takes on the tasks of mitigating toxicity in language generation.


So as you can see right here, we have some sort of a base language model that has some


output and then you have what they call the experts and some of them are non toxic and


some of them are deliberately toxic.


And by contrasting non toxic experts and the toxic experts, you can then make sure that


you re weigh the outputs towards a non toxic behavior.


Now I got nothing against this paper.


However, what I want to say is that this is like a 100% recipe of making a super toxic


language model.


All I have to do is flip this one sign right here, I can just take whatever this is, I


can flip one bit in the algorithm and I make the most toxic language model ever.


To the big credits of the authors, this is even acknowledged in the broader impact statement,


they say, we acknowledge that any controllable detoxification method runs the risk of dual


use.


Specifically, this technology could be used to automatically generate hateful texts.


For a broader discussion of such risks and the risks of large pre trained language models


in general, please see the Stochastic Parrots paper.


Now there are enough people that with every face upsampling method cry that we shouldn't


develop these things and all of this is dangerous.


It should be measured by the harm it causes and so on.


And here I have a method that flipping one single bit will make it super duper toxic


and harmful.


Is there anyone complaining about this paper?


No, zero.


Where are these people?


Are you really telling me that a little paragraph in the broader impact statement is gonna not


cause the harm?


No, I think I know how this works, because we gave the proper citation, we have the proper


friends, we frame it in the proper way, and the narrative uphold.


So in my personal opinion, we should not give too much power to these ethics people unless


papers like this one are met with at least as much scrutiny as the papers they're usually


criticizing.


Again, I'm totally fine with this paper.


Then again, I'm also totally fine with pretty much all the other papers.


I'm just calling for a bit of consistency here.


Okay, last news, a deal in Beatrice in analytics inside rights.


Yes, artificial intelligence can't do these things.


It's an article about what artificial intelligence isn't able to do.


And also a bit of an argument of why it won't be able to do it in the near future.


Among these things is the classic use common sense to make decisions argument.


And I love the example that they give right here.


For example, if we say a woman went shopping, she bought a beautiful dress, she left the


place with a big smile.


If asked what the woman shopped, a human would instantly say a beautiful dress.


But answering these simple questions is very difficult for artificial intelligence.


All right, hold on.


Here's GPTJ of Eleuther AI.


A woman went shopping, she bought a beautiful dress, she left the place with a big smile.


Now she wants to return her purchase of and the model says the dress, she wants her money


back.


Totally lacking common sense.


I get it is just one example.


But I think there are much more effective ways to criticize artificial intelligence


than it doesn't have common sense.


Like if common sense is sort of your intuitive gut feeling of things like it has common sense.


Alright, this was it for this week's ML news.


How did you do today?


Did you win?


Did you lose?


Did you even know there was a game involved?


Who knows?


We'll be here next week at Monday, nine o'clock.


No questions asked.


AI-Based Game Engines with GameGAN research paper

What's going on everybody? Today I want to talk about the latest research from NVIDIA surrounding GameGan.


So, you know, historically most of the time when we have AI in games, the idea is the AI is acting as some sort of agent within some game environment.


Well, with GameGan the idea is instead to have the AI be the game itself.


So the AI is replacing the game engine.


So either you or maybe some reinforcement learning agent can play within this game that is kind of dictated by an AI rather than a game engine.


So the AI is in control of not only what you see but the rules, the logic, and all of that of the actual game environment itself.


Now we've seen lots of similar examples to this such as research from Georgia Tech that recreated a game scenes in a playthrough


showing that the AI at least understood concepts like a character landing on a surface and not being able to just clip through walls and so on.


But this was actually a replay of scenes it had already seen.


We've also seen lots of examples where AI can predict next frames.


So that's pretty similar to a video game, right?


You're trying to move and the next frame should look something like what you would expect if you move.


And we've even seen AI that does things like pix2pix so it can either enhance images or reskin something and so on.


And then maybe the closest related thing to this would be the World Models paper back in late 2018


where the kind of concept here was very similar.


It was like let the agent learn the environment and then kind of sort of dream the environment and interact within this dream of an environment.


The big difference here though, I think if you just even look at some of the clips from there, is it's very clearly a very blurry dream.


There's no consistency and in terms of creating an environment, it's not reliable as an environment.


You definitely, I mean it clearly looks like the thing that we saw and maybe reinforcement learning agents can learn some things from this environment.


But there obviously is a huge amount of improvement that needs to be made here.


And that's where the research around GameGan has kind of changed everything where the


what is produced is an actual playable environment either by you or theoretically some sort of AI agent.


But it's a realistic environment that is mapped from the games that it was trained on.


In this case they were trained on both Pac-Man and Doom. You can actually play them.


Various rules are in place like you can't go through walls for example.


If you leave an area and then come back it should hopefully look the same.


Obviously that won't always be the case. There will be screw ups.


But this is the concept. So it's not like a dream where things are just constantly able to just change on you moving forward.


It's an actual map. So with like world models for example they would use like a race car game.


Well that's okay because as you continue through that road the road can constantly be changing into the future and there's really no big deal there.


But in the case of something like Pac-Man where there's a maze that you have to get through


it's going to be highly troubling if the maze is changing on you as you're going through it.


I mean definitely Pac-Man hard mode there.


So with Pac-Man the training data consisted of these partially observed states which were effectively zoomed in views


with Pac-Man at the center moving around the much larger map.


And I think the idea was initially when you have the full Pac-Man map


your agent, you could see the whole map so it was maybe less likely the map would change.


But if you zoom in on Pac-Man and you're moving around the map you could later recreate that map


and then see how well did we remember where certain elements were.


And at least looking at the paper and the very anecdotal examples that they shared


it looks like it does a pretty impressive job.


And what's really cool about that is it kind of comes down to like I think generative adversarial networks in general


generating something that looks about what you might see.


That's not very impressive anymore but what is impressive is


this like environmental knowledge which requires long term memory.


So this is memory that we really have never seen before.


You know this is a problem that plagues machine learning and deep learning in all aspects.


Both natural language trying to carry on a conversation or remember the topic that was talked about


maybe even just five minutes ago is an eternity to AI.


Same thing in a game so if you leave a room and come back you would expect that room to be the same


but AI is not typically very good at that.


So I think that's the biggest breakthrough here is that you can leave and come back


and this is all thanks to the memory module as they're calling it


which seems to do a pretty good job of keeping the game map static.


Now obviously Pac-Man in general that game map is a pretty small map


but again just like five minutes ago in a conversation is an eternity for an AI.


I think the Pac-Man map is an incredible start of being able to leave some area and come back


and that area looks the same. That really truly is incredible.


So I will put links in the description to the research paper and any other links that we end up getting.


There's a short video on YouTube that I can link and then hopefully at some point they're going to post the code.


I do say that the code will come soon so whenever that is.


And I definitely look forward to playing with it. I think both just trying to transfer it to other games.


I'd like to look deeper into that memory module that they've done because I think that


there's certain concepts there that could possibly be extrapolated out to other areas of research


so that's going to be very interesting to check out.


And obviously play the game.


So yes you can do world models and you can kind of play in a dream scenario


but it's nothing like what we're seeing here.


And so I think that's the coolest thing is to be able to play in some AI generated environment.


That's really cool where it's not just the visuals it's the logic and other assets


like the enemies and the food and all that kind of stuff. That's pretty crazy.


Now I know the graphics aren't Unreal 5 graphics or anything


but it's kind of cool to think that possibly in the future this could be the game engine.


We struggle writing even some of the most basic physics engines for games


so it wouldn't be too surprising if the first realistic kind of Turing test physics engine


is really made by an AI rather than some hard coded rules.


So yeah I think the whole concept is really interesting.


Also obviously just for reinforcement learning in general and training agents.


We spend so much time writing these environments for agents to learn within


when we could in theory just kind of record some sequences


and have an AI that just handles it from there.


So that's very interesting.


So anyways really cool stuff coming out of NVIDIA.


I look forward to being able to play with this code.


I hope that they release it soon.


Alright, till next time.


Player of Games: All the games, one algorithm! (w/ author Martin Schmid)

Hello everyone. Today is a special day. I'm here, as you can see, not alone, not by myself as usual.


I'm joined by Martin Schmidt who is the first author of the paper called Player of Games.


This is joint work with others by DeepMind and I have to say it's a very in-depth paper.


It presents an algorithm called Player of Games that is sort of a unified algorithm to play all sorts of games.


This starts at things like chess and go which you might know from AlphaZero, but it goes beyond.


It goes to things like poker and Scotland Yard which I found really interesting that it appears here.


But sort of the common denominator is that these new games, they have hidden information.


So other than chess or go in Scotland Yard, you don't know where Mr. X is hiding.


In poker, you have no clue what cards the other players hold.


So you can't just look at like the table and poker and decide what's the best thing to do because you don't know a lot of things.


And yeah, same in Scotland Yard. There have been algorithms for poker, right?


There have been algorithms for Scotland Yard, but they were always a bit tailored to sort of the specifics of the games.


And Player of Games combines a large set of techniques and these techniques are things like let's do search.


So as we play the game, we do local search.


We sort of invest some computation at inference time to tell us what the best possible move is.


But we don't want to search throughout all the game because these game trees, they just get very big.


So that's the part that comes in from AlphaZero a little bit.


But then the other part with the unknown information that is coming in mostly from algorithms like counterfactual regret minimization and so on.


But yeah, the counterfactual regret minimization, if I understand these correctly, they were sort of solvers.


Like they either solved a complete game or they didn't.


You'd have to like traverse the whole game and then at the end you knew, okay, in this situation I need to do this and so on.


And yeah, I was very excited when I saw this paper and then I tried to read it and it was, I have to say it was dense.


And I'm very happy to have Martin here today to guide us a little bit through the paper.


So Martin, welcome. Thank you very much for being here.


Hey, I'm happy to be here.


Was it sort of a good description of what I said so far about Player of Games?


Oh yes, very much so.


If you could summarize sort of the main components of this algorithm.


This is a single algorithm that I can train on many, many games.


What is the set of games I can train it on?


So currently we use four games.


The games that you mentioned, we have chess, we have Go, we have Scotlandia, which I find as a very cool and fun game.


And we have no limit poker.


So it's just to show the generality of it, because this is all about generality.


That's why we picked like two perfect and two imperfect information games.


Yeah.


So currently it should be able to handle most perfect and imperfect information games as it plans from scratch, from self play, just like AlphaZero does.


There are some limitations for games that this can handle.


And it's best to understand the limitations only after we understand a bit more about the algorithm itself.


So the algorithm itself is composed of many parts, but the central concepts here, I think, are...


And that's what people...


I think people kind of know what AlphaZero does, right?


It uses self play and it searches a game tree to a certain depth, right?


So in these games, we usually have like some sort of a state, right?


And then we have various different actions that we could take in that state.


And every action leads to a next state and so on.


And we have various different actions we could take right here.


And every action leads to a next state.


And you can quickly see how this explodes, right?


So what AlphaZero and all these search algorithms do, they do this kind of limited depth search, right?


They look maybe one or two moves ahead, but at some point they say,


okay, no further.


We can't afford to compute all of this tree.


And that's why at a certain depth or after a certain time, they say,


okay, here we cut off and we use like a neural network to tell us how good this node is.


Even though we're not at the end of the game where we would either win or lose,


we could still have a neural network that sort of predicts this node is very good for you


or this node is very bad for you.


And that's essentially AlphaZero in a nutshell.


Let's say uses self play, uses this tree search at a certain depth.


It simply asks the neural network.


Now, what's the problem when you have imperfect information?


How does this change?


Okay, that's the right question.


Unfortunately, we probably spent quite some time to understand the intuition of it, right?


But even for AlphaZero, it's good to step back and see where it came from.


It's not that AlphaZero introduced search for say perfect information games, right?


Search has been here since 1950s, like first algorithms for chess,


the combination of search and some value functions.


AlphaZero is amazing in the sense that it learns those value functions that you just described


for self play.


And it's also really, really smart about how it's going to expand its search.


It's not like it's going to always look two steps ahead.


It's very smart about building this tree that goes deep where they need it to go deep.


But it still has those components, which these components are simply having some search tree


that it ideally expands as it thinks about a policy in the search tree


and then using some value function at the end of the search tree.


Yeah, that is one of the hallmarks of AlphaZero.


I think that, for example, in Go, you have so many actions, even at step one, right?


If you were to consider only like even three steps ahead or so,


this would just blow your computation budget.


But in AlphaZero, it sort of always starts from the root


and then it kind of goes down one of these branches that it has already explored a little bit.


And in every new iteration, it re-decides which direction it should investigate.


And that's a combination of sort of what the neural network says,


but also how often it's been, it's explored something.


So it says, you know, like this direction is very promising,


but I've explored it a lot already, so now I'll go a different branch or so.


And then at the end, it always gets to a leaf node that it hasn't expanded yet, right?


And at that point, it asks the neural network, okay, you know, what's my policy here?


What's my value?


And then it prepares sort of the next iteration that it could expand it even more.


And so over time, it builds this very targeted plan.


So the neural networks guide the tree search, as you say.


That's very, very cool.


Now, in imperfect information games, that is, yeah, that is different, right?


Yeah, so it's somewhat different, but we still wanted to have exactly what you just described.


This is like why AlphaZero works so well, and we still wanted it.


So on a high level, you can think of playoff games as combining AlphaZero and DeepStack,


which if you were to Google DeepStack, it was the first AI to beat professional players in no limit poker.


And it already introduced some of the ingredients that we will see in this paper,


which is it introduced this notion of local search in poker and these value functions.


And playoff games is really just putting together AlphaZero and DeepStack into a single big unified algorithm.


So let's maybe start with the component that you just talked about, which is value function.


And the value function, if we get to a point where we understand value function in playoff games,


say it's then you understand like 60 to 80 percent of the algorithm and complexity that imperfect information brings.


So value function, if you think about how to use it, exactly as you said,


rather than searching all the way to the end of the game, because it would be like way too long of a search,


you just trumpet your search and use value function as a substitute for continued search.


And that's how you use it.


But what it really does, it maps some subproblem that you are thinking of to a game value of that subproblem or subgame.


In chess or in Go, it's really easy to think about what it really is.


You get to a new board, chess or Go board, and the value function ideally should tell you,


hey, this is the value of this subgame.


What it really means is what would be the outcome if two optimal players were to continue playing this game forward.


So that's all the value functions do.


And the same thing they do if you try to generalize them into imperfect information games,


except that suddenly this notion of subgame and subproblem gets way more complicated.


Yeah, so this bases on this notion of information states and sort of public beliefs about things.


So on the left here, you've tried to show this in a diagram.


And I think the notion is when I come to a poker table, I only see what's called the public state, right?


I see and actually, if I come to a poker table and observe a hand with all of its history,


that is the public state.


So I know, you know, who bet how much in which round and so on, who acted how.


But I don't see people's cards.


So there could be many different cards that people hold and some might be impossible just from the rules of the game.


You know, maybe not in poker, but you know, in Scotland Yard, you have this over here.


There are certain locations this Mr. X can be and we want to assign probabilities to each one of them.


Right. If we knew, if we knew where Mr. X was, the game would be easy.


But since we don't know, we must estimate.


And I think that's also something you highlight in the paper.


An interesting property of these games is that if I am Mr. X or if I play poker, I have to not be deterministic.


Right. Otherwise, the game would be very easy for my opponents.


If that's in poker, usually, you know, people, they look at their cards, they go,


and then they like bet everything they have and you immediately know which hand they have if they don't also do the same thing with other,


other whole cards or if they don't randomize a bit.


So necessarily, other than, let's say, in chess, the optimal strategy is kind of a distribution over actions.


And you have to sort of randomize that in order to almost a bit hide your private state.


So what we see are these public states.


Right. And what we can estimate is these things which are called the ranges.


So these are distributions over what private states the players could hold.


And I think the difficulty in this tree search comes from the fact that you can only go from a public state,


yet you need to consider all the possibilities of the private states.


So you can't just say this is the situation. You have to sort of consider all of them at the same time. Right.


Yes, exactly. That's what you basically need in order to generalize those sub games or sub programs to improve information.


It's not hard to see that all perfect information games are just a special case where you have just a single possible state for the player.


Like poker, you just talk about poker and public states.


And that's a perfect example.


Like the sub program in poker, it makes little to no sense to say what's the value of a sub game or sub program in a poker


where I hold a pair of aces. That's pretty much an ill-defined sub game.