And I wonder why wouldn't I expect this to be,


Memory-assisted prompt editing to improve GPT-3 after deployment (Machine Learning Paper Explained)

only half the gains,


because it only in half the time,


it actually gets any clarification.


So half the time,


GPT-3 would still output the wrong answer.


I might confuse something here,


but it seems to me that that's what should happen.


They shouldn't end up at like almost the same performance.


So that is the overview largely over the results.


They have these other tasks as well.


They're much kind of less clear.


They say, well, there's not too many ways to misunderstand


in please turn a word around or so.


They also do experiments in low resource languages,


which is also cool.


Turns out about the same, as you can see right here.


So in conclusion, I think this is a neat idea.


I like that it is essentially a suggestion


on how to personalize these language models


or how to adjust them,


how to make them learn from very, very few things


that are nonetheless bigger than prompt, right?


So if you want to teach GPT-3 a new trick


and it sort of exceeds the prompt size,


this might be a very good way to go


if you don't wanna go ahead and fine tune it,


which would require much, much more data.


What I don't really like about this paper


is the fact that they say,


oh, we just present the framework.


It has its good things, but also its bad things.


They do actually implement something,


which is to be commended.


But there, I think the sort of comparison


with the baseline is shaky


because it's not an exact ablation of what they do.


There would be better things.


And their results, though, are convincing,


apart from the fact that I suspect the dataset creation


was done by the same people who run the study.


And since as far as I can understand it,


everything except for the actual synonyms of words,


everything else was done in a manual fashion,


like coming up with prompts,


coming up with potential feedback.


That would warrant at least some caution,


or maybe one would need to look at the exact dataset.


And as far as I understand it, that is actually available.


So we're able to do that.


All right, that was it for this paper.


Thanks for listening.


Let me know what you think of this paper.


It seems like a pretty neat idea,


and I am excited to see what other people will expand on it.


Bye-bye.


Faster Neural Network Training with Data Echoing (Paper Explained)

Hi there, today we're looking at faster neural network training with data


echoing by Dami Choi, Alexander Passo, Christopher J. Shalu and George E. Dahl.


So on a high level this paper basically says you should repeat data that's


already in memory in order to speed up the entire process of neural network


training and it also says that this can speed up your wall time without hurting


your performance too much and I have mixed feelings about it. So let's jump in.


So they basically make a point of saying that machine learning doesn't happen in


just one thing. It's not like sklearn.fit anymore, it is more of a pipeline.


So what do we mean by this? If you have, if you think of something like you want


to train an ImageNet model, what you want to do is you have like your data set


somewhere and that could be on in a database, it could be in the network


somewhere. So if you have even something larger than ImageNet you'll probably


store it on a central server on an Amazon bucket somewhere, so this is in AWS


and the first thing you actually need to do is you need to read that data set.


Now usually you're not gonna have enough memory on a machine to just load in the


entire data set into memory, so that means this process here is streaming.


So this is continuously streaming data points and once you have used the data


points you're gonna throw it away because you need space for the next one, right?


And so the streaming is done continuously. The next process is read


and decode. That means you have to you know read it from the network and


actually bring it into a format where you can use it, usually something like a


NumPy array or a TensorFlow tensor. You need to apply some shuffling because


usually the order, you can't really trust the order that it is stored in,


oftentimes there is like a bias in the ordering so you need some sort of a


shuffle buffer here. Then often you want to apply some data


augmentation to it, that means that you have one image and we know for these


models, if this is your cat, we know for these models that what can help is to


basically make many many different images from one image. So this could be


by cropping part of it and saying well if it was a cat before the small upper


right part here is still a cat. So this is one, it's called data


augmentation and you're gonna apply a whole bunch of these things so you can


crop, you can rotate the image a bit, it's still a cat right and you can also


change its luminance and a bit of its colors, you can jitter the colors, you can


horizontally flip it and it'll still be a cat and that's basically how you make


many data points from one data point and we know that helps. Then what you want to


do is you want to batch this data so you want to put it into mini batches. Since


you've shuffled here that means when the next time the same data point comes


along it's going to be batched with a different group of images


and of course augmented differently with a different group of images and that


basically means it's a different training batch for the model. So this


entire pipeline is basically a way that we take data points that we have and we


make a whole bunch of variations and various groupings and batchings of it


and we know that helps enormously with the generalization capability of your


final models and then here you do your apply your SGD update so that's usually


where you forward propagate your data through your network which here is F


you'll get like some Y hat as an output and then you have your labels that also


come through the pipeline and you have some sort of loss function L that takes


both as an input and gives you an output and then you do your back propagation so


the back propagation would go through your loss function through your network


and update the network parameters such that your network learned something


right now this step to the right here is usually what what we focus on when we do


deep learning the step on the right here all of this this can be done on a GPU or


is usually done on something like a GPU or a TPU right but in these things are


getting faster and faster the point the paper makes is that the TPUs and GPUs of


the world are getting faster but this entire other thing right here this is


basically CPU land now I know there is some data augmentation now happening on


the GPU and so on but in essence you can think of a pipeline where the thing to


the left is happening on CPU and the thing to the right is happening on TPU


and even even worse let's say the speed is continuously is continuously


increasing so in your pipeline the kind of speed would be so here is the network


reading and here over here is the GPU SGD step and this is speed basically the


further to the right in your pipeline you go the faster your the faster your


hardware gets and that means that if if this since this is a continuous pipeline


right that basically means that if I input something here it goes through the


pipeline and even if this is all running in parallel at this thing over here is


going to idle this since this is the fastest part of the pipeline it is going


to just idle a lot right it because because it can only consume things as


fast as this thing can produce now if you if you have some sort of a multi


GPU machine and just train image net like you just around the code usually


your this is not the bottleneck usually your GPUs here are at 100 100% capacity


so this paper is not for you but if you are let's say a big company have this


network storage have a big data set have very expensive data augmentation this


happens for example this can happen in NLP and so on this can be quite your


situation where the earlier in the pipeline the slower it is and don't you


just love these graphics so here's here's time and apparently it goes in


both directions and so does it go like this I think what they mean is just time


goes in this direction and you're here and you're upstream so you're upstream


is your network this is your network reading or your pre-processing and the


downstream this is the GPU so as you are pre-processing things you you and this


should be this should be different it should me okay to correct this right


here this is idle and this is running so as your upstream processes images right


at the beginning your GPU is idle but then as soon as it ships off the first


batch of images your GPU can run now and now it's running while you're doing that


your upstream your network is still reading new images pre-processing them


and so on but it cannot is too slow to insert a batch at the time that the GPU


is done the time the GPU is done it's still processing this batch so the GPU


is idle until here where it finally manages to process that batch and then


the GPU is running again I think that would have been a much better graphic


but you know so their goal basically is that what you'll have is right here


for example after the batch what you'll do is you scrap this connection you take


this and you put it into a smaller buffer and the buffer is is a repeat


buffer so what it does is it simply will repeat the whatever you have in the


buffer until something new comes in right so new data point comes in you


just output that data point again again again again the for the GPU it's gonna


feel like these are all new batches and they continuously come in but it's


always the same until the next data point comes in and then you output that


one again and again and again and again now the the actual factor here you can


of course tune by hand or you can just say repeat until something else comes in


in this paper they have an explicit factor where they say we repeat each


data point four times or three times or so on so this is data echoing you


basically echo the data point multiple times and this can be done in various


places so they experiment with echoing in any of these places right here so the


egg they experiment with it right here after reading and decoding after shuffling no I


think always before shuffling because if you if you have a shuffle buffer anyway


they say it makes sense that if you do the echoing you you do your shuffle


buffer after you're echoing so here then after augmentation and after batching so


they experiment with these three locations in in echoing now what could


be the downturn of something like this the downturn of course is that this SGD


procedure right here basically it relies on the data incoming being an IID sample


from your data distribution right that's that's how we formulate SGD is that


there's always new data incoming now if you just output the same data point all


the time that could that is like no new information first of all and second of


all it could bias the SGD update such that you it because it sees the same


date it doesn't it sees the same information over and over is going to


think that's the whole data set right so potentially it can make too many steps


into the wrong direction that just happens to be the bias in this


particular data point so the IID assumption is is is invalid now why do


you experiment with this in different locations because what you expect is


that it hurts more or it hurts less the earlier you introduce this so if you


introduce echoing right here so if you echo your data until new data from the


network comes in it's still going to be shuffled differently right it's and


it's still going to be augmented differently so each time the data point


comes out of the echo buffer it is going to be shuffled and it is going to be


augmented in a different way than the last time the same data point came out


and this is going to be batched together because you've shuffled differently it's


going to be batched together with a different bunch of data points and that


means SGD gets new information but if you go on to the very last thing where


you just after the batch right here where you input the echo that means SGD


you get just gets to see the same batch of data augmented in the same way all


the time right so the of course where you exactly have to echo you have to


trade this off so you have to trade off the how much you basically violate the


IID fresh data assumption against where in your data pipeline is the bottleneck


so if your bottleneck is in the data augmentation it may make little sense to


echo before that because your bottleneck is the data augmentation and that being


said if the bottleneck is that you don't have enough GPUs then it probably


doesn't make sense to data echo at all though their experiments are somehow


wonky on this but so let's dive in they make the following claims let's just go


through them really quick data I can reduces the amount of upstream that so


it think of network reading or augmentation computation needed to reach


a competitive out-of-sample error rate on various data sets and model


architectures second data echoing can provide a wall time speed up in practice


third data echoing can support a wide range of echoing factors and that's the


echoing factor is how often you repeat the data fourth the effectiveness of data


echoing depends on the intersection point in the training pipeline sorry in


the insertion point that's what that's what our hypothesis was right fifth data


echoing can benefit from additional shuffling after echoing but does not


require it and six countering expectations data echoing reaches the


same final error rate as well tuned baselines so I am can absolutely accept


one through five especially in like an actual practical in the wild setting but


six we'll see about six so let's jump into their their models they sorry about


that they train the following four models so they train a transformer on


these two data sets LM 1b and common crawl so that gets technically it's five


models on language modeling they train the resnet 32 on c410 they train the


resnet 50 on image net and they train as the on cocoa now here is the accuracies


they get and here is sorry this is the target so what they do is they train


these models and then they say okay what's the accuracy we reach and then


they set a target value so on on resnet 50 on image net a very common number to


reach is something like 76.5 if you look at for example torch vision models they


reach something like like this and so they say well our target accuracy here


is just a little bit below that so and then we just measure how many steps or


how many their measurement here is fresh data points so how many actual fresh


training samples do we need to reach this target and this is this is where it


gets wonky because for example take the 91 percent here on c410 that is quite


quite low and also the resnet 50 is I mean this is standard but still image


net is much further nowadays and I think the effectiveness of something like this


has a lot to do with how competitive you want to get maybe this is all just an


effect of how much under par your this target performance really is and I I


would I would expect that even though they say it doesn't hurt their


performance in their experiments I would at least expect it will hurt your


performance in general if you try to get competitive because these things aren't


as as as of now at least the ones I know like the the resonance aren't really


competitive but so what do they do the they measure data echoing with an echoing


factor of two so that means data that's incoming is output twice in a row and


every data point that's coming in is just emitted twice from the buffer and


then the next data point is emitted twice and so on and what they measure


again is the fresh examples read so how many fresh data points do you need to


achieve something this is a good measurement because this is kind of


independent of hardware so if you're if you are really in the situation where


your GPU is twice as fast as the as your the rest of your pipeline then an echoing


factor of two will speed up at most your your training procedure by a factor of


two all right so you have the baseline in red and then you have a batch echoing


which is where you echo what we said at the worst possible time right after


batching so this might hurt your performance the most but also it has the


potential to be the fastest if your if maybe your augmentation is very expensive


then sorry or your batching you have example echoing after augmentation so


that would mean you you use the augmentation is very expensive so you


save the augmented data points and then you emit it multiple times but each time


it is batched differently so it is it is shuffled and then batched with different


other data points so you have a shuffle buffer after it and then you have example


account before data augmentation so that means the same data point emitted


multiple times will be augmented in different ways and basically will lead


to slightly different data points so the results here are pretty much what you


could expect in that the earlier you do the echoing as you can see here the more


this echoing helps so the number if you for example this is the object


segmentation task the baseline needs this many fresh examples to reach this


target accuracy with batch echoing not only do you sorry sorry with batch


echoing you need less fresh training examples so that means even though you


kind of train on the same data twice you you this helps you more or this helps


you it doesn't help you fully because the dashed line here is the if if it


would help you as much as a fresh data point you'd be at the dashed line right


this is exactly half of this because the echoing factor is two so if you're if a


repeated data point was as useful as a fresh data point you'd be at the dashed


line as you can see right here you're not at the dashed line but at least it


doesn't hurt you might expect that it hurts but it doesn't hurt it actually


speeds up so the repeated data points at least have some utility again this is


only useful if you're here if you have this asymmetry in your pipeline if your


pipeline is actually symmetric and you do an echoing factor of two the wall


time here the wall time plot would look this for the baseline and then almost


twice as high for the batch echoing because even though it needs the same


amount of fresh or almost the same amount of fresh example it you echo each


one twice so it needs to process it twice so you'll it'll take much longer


so again this is useful if you have this asymmetry and if the echoing factor is


kind of smaller than your asymmetry otherwise you simply wasting time


repeating data points then if you do example echoing here after augmentation


you use even less fresh data points and if you do it before augmentation this is


really surprising you almost get the benefit of fresh data points which is


something you you might expect right because an augmented newly shuffled data


point is kind of almost a new data point but still it's quite surprising that you


almost get to the level of the of of the theoretical possible and also here on


the image net task now here is actually an example where you can see that it


hurts to do this batch echoing because the reasons why it could hurt is just


that you have you violate this I ID assumption you basically have correlated


data points this is a big big problem for example in reinforcement learning


where already by nature of you running episodes and then feeding the episodes


back into the training procedure you have correlated data points and that


hurts your performance here actually compared to the to the baseline but then


if you go to example echoing and the example echoing before augmentation


again you get a speed up which is pretty cool okay so they do a bunch of other


experiments and I appreciate these experiments here to really show what's


going on and until when can you push this so here they have a plot of example


echoing before augmentation can reduce training time for resonant 50 on image


net so this is before augmentation and the echoing factor describes how often


you repeat each data point so this goes from two to five and you can see that


basically you you get the speed up you you just sort of get it for free as you


can see the dashed line again is as if if at repeated data point were as useful


as a fresh data point you'd be at the dashed line and you can see right here


that you are just above this dashed line so this can help a lot and so this is


the fresh examples read and this is the wall time in their particular situation


in this case it doesn't help as much but again it if that very much depends on


how the asymmetry in your pipeline yes now in these experiments I would


actually appreciate something like they do down here where I would always like


to see where it breaks so how far can you go with the echoing factor until it


doesn't help anymore because this sort of tells me pretty much nothing I want


to see where is the low point where is kind of the optimal echoing factor and


what can you tell me about this optimal echoing factor how can we determine it


sort of beforehand or how can you reason how does it connect to the different


parts of your architecture if I had to point out a flaw in this paper it would


be that right here I would expect the them to continue this echoing factor


increase until it breaks sort of like they do down here this is for I believe


this is for the transformer on LM 1b now here they have a batch size of 1024 and


you can see and this is the this is their standard setting for the


transformer the 1024 batch size you can see that the baseline uses this many 1.5


times 10 to the 7th fresh examples to train until their target if you increase


the echoing factor by 2 you basically need half as many fresh examples as long


as you echo each one twice again very surprising the fact how close you can


get to the as if each batch were a a perfect fresh data point but you can see


as you increase this echoing factor and here is exactly what I said right you at


some point this hurts at some point you get to the point where the non I ID nests


the correlation of date of successive data points will actually hurt you and


they make a point here of saying that this is for example dependent on batch


size now in this experiment over here they have a larger batch size and here


is again the the baseline number of data points to reach the target and you can


see again it goes down but now with the echoing factor where before you had a


you had an increase again now it continues to decrease again it will be


interesting to see where it goes up here and how the number at the lowest like


here the four and here the I don't know what it's going to be maybe the 16 how


this will kind of depend on your batch size and here is another problem and


that's what I alluded to at the beginning this this performance


dependence now I have not read anything differently in the paper so I had to


assume that they trained this here this number of fresh examples to reach the


target is still the target that they determined at the beginning so it's that


3.9 in the table that 3.9 was achieved with this batch size with a thousand


and twenty-four and we know especially in language models that larger batch


sizes will lead to a better performance even if you need let's say more sample


so here you can see that the samples here it's 1.5 and here it's actually 4


because you increase that batch size so that will tell you something 1.5 and 4


that is that is like a times okay that's like an times 2.5 so you go with the


batch size of times 4 and you need 2.5 more more fresh training samples to


reach the same target accuracy first of all we know that the larger batch sizes


can reach higher target accuracies so again this this these results the


dependence of them on the actual performance to the maximum achievable


value to me that's kind of a shady world here to always to always say okay how


long does it take to reach that particular target because we know that


this model right here can reach a much higher target but we don't know this


about these models here what is their kind of performance in the limit and


they try to make these experiments but I don't really believe them maybe yeah and


yeah and the second right that will that will be that would that is already


interesting so this ratio right here this 2.5 to 4 this ratio must mean


something right it's it's I'd go to a higher batch size 4 times higher batch


size and I need 2.5 many more fresh training samples to reach the same


target that must somehow tell you something about the usefulness of a


single data point versus a succession of data points right so it doesn't seem


because I would expect if each data point was valuable I would expect this


to be times 4 and if it were if it were times 1 so if it were no no speed up at


all sorry not times 4 if it would be times 1 it would mean I'd need the same


number of fresh training samples right no matter how I batch them but it were


times 4 that means basically that it doesn't matter really how many training


points I have in a batch as long as I have enough and the 1024 seems to be


enough it just it just matters how many you know SGD steps I do so basically


what we're saying SGD isn't getting the most out of these data points and this


ratio this 2.5 this this tells you something about the information content


of a of an additional data point versus the usefulness content of an additional


step of SGD and I would expect that to depend to intrinsically be connected to


the where the low point of this echoing factor is because that's exactly what


the echoing does it trades off freshness of data point versus doing more steps on


the on the on the same information and for a paper especially paper by Google


brain I this this is a connection that I would love to see investigated but


enough of the ranting they do investigate other things they do


investigate for example what happens if we just up the batch size and you can


see here yeah this is interesting in the baseline needs more fresh samples as you


up the batch size but and at the beginning this batch echoing for example


doesn't help doesn't hurt but doesn't help but as you go to higher and higher


batch sizes this batch echoing starts to help more and more again I believe this


is connected to the usefulness of the single data point at some point your


batch size is just too large for the problem you'd rather do more steps and


that's why this helps but also this model right here might have a higher


ceiling accuracy so and it is the question whether this model right here


has the same or whether this model right here the batch echoing model would


actually fall back to the ceiling accuracy of one of these models over


here yeah in any case their point is basically that as you increase the batch


size this echoing tends to help more relatively because maybe it's because


what I said right they say as batch size increases the performance of batch


echoing relative to the baseline stays either stays the same or improves while


for example echoing it either stays the same or it gets sorry while for example


echoing it either stays the same or gets worse dashed lines indicate the expected


values if repeated examples were as useful as fresh examples yeah so I but


there is an intrinsic connection here between the usefulness of more data and


usefulness of doing additional steps and here the example echoing you can almost


see it as more data because especially here you're gonna do augmentation on top


of it and you see the non-augmented versus the augmented ratio changes


dramatically from here to here okay final set of experiments as you can tell


this is more mostly an experimental paper and it is always easy to criticize


experimental papers and rightfully so because I would not trust this very much


but given that it comes from a big institution and it is a very very well


written paper I would trust it more than I would a regular paper and I would say


if you're in practice this is certainly worth trying absolutely I'm just I just


think that some of the things aren't aren't researched like some of my


questions aren't answered of this so they investigate sizes so they now build


shuffle buffers so you have batch echoing but they say ah but we can do


batch echoing with shuffle buffers so after the batch echoing right we have


this state where we have the batching and then we have the echoing these are


this is our echo buffer where we output the each data point multiple times and


then we have another buffer which is a shuffle buffer now the shuffle buffer


just collects data points and then shuffles them around before outputting


them and that means even though we you know output this five times it might not


come out five times after each other it might be that it comes out once and then


another data point that was already in the shuffle buffer comes out and then


it'll just say that in total it comes out five times but it is first shuffled


together with a bunch of other data points of course this uses more memory


but of it returns to that more I ID setting and you can see here as the


buffer size increases then the performance gets more and more to the


performance that you would have with completely fresh data right so again


trading off freshness and freshness and doing multiple steps with by by


basically repeating repeating data points straight out versus repeating


data points shuffled and also here you have the same with example echoing so if


you apply the shuffle buffer to example echoing and you increase its size you


can get very very very close to the performance that you would get with


fresh data which of course if you increase the shuffle buffer to the size


of the data set you are at the situation that's the limit you are at the


situation of fresh data right if you do example echoing right so here is where


it gets into the funky part where they say we actually measure the validation


cross entropy and the validation accuracy versus the number of fresh


examples read and here I want to concentrate on the ResNet 50 on ImageNet


and as you can see most of these models they pretty much end up in the same


place here it's just that the echoing models end up there faster right and


this this is I mean this is where it gets a bit confusing honestly because


why do you have this super sharp thing here because usually and here it sort of


speeds up in the middle you see you see that and then it kind of sharply declines


is this maybe because they drop the learning rate or something now my main


thing is that the performance here even though this target thing is lower than


then the even though this target thing is the same for everyone it is lower


than the best reachable accuracy and I'm I'm just this this is just confusing if


this is really true whoa if this is really true I think we have a lot to


learn about SGD yet and how we're not actually doing SGD correctly and because


it seems like almost the the echo versions are better or reach a better


accuracy than the baseline I don't know do they just cap it at the performance I


don't think so I think they say they let it reach they also have these things


right here these these curves where they say this is the best we reach and this


is the ResNet 32 on c410 again 91% on c410 is just very very low and I'm


almost thinking that okay this might help if you just throw something that we


know is kind of overpowered because we can reach 99% or at least you can reach


something like 94% on c410 easily easily with a network smaller than ResNet 32


maybe this effect manifests if you if you have actually something that could


reach higher but for some reason you only reach this low I'm not sure but


this is confusing and if this is really true yeah I would just if it's true


which I believe I believe this paper it might be just an effect of not reaching


the actual ceiling and again look at this this is just the curves are just


strange right you have the echoing before augmentation like it seems like


it's outperforming the the fresh data points I don't know there's a little


bell in my head that doesn't like this if it's actually true then you know


that's cool but yeah so my main criticisms are a bit with the


experimental methodology for example where they increase the batch size but


still reach the same target accuracy even though we know that there is a


higher ceiling if you increase the batch size for a language models my other


criticism is the non investigation of this connection this connection right


here maybe but all in all it's a pretty cool paper if I had a big company with


these pipeline issues I would absolutely implement this this seems like a


no-brainer to do this and can help you tremendously all right that was it thank


On the Measure of Intelligence by François Chollet - Part 4: The ARC Challenge (Paper Explained)

Hi there and welcome to the last part of On the Measure of Intelligence by Francois Chollet.


This last part concerns the ARC challenge that Chollet has proposed, or the ARC dataset,


which stands for the Abstraction and Reasoning Corpus.


And we're just quickly going over the dataset, look how it's built and discuss what kind


of solutions might be relevant right here.


So if you haven't seen the last videos in this series, this is the last one of a series,


you might not exactly know what's going on.


But I think you can you can keep up pretty well because this part is fairly independent


of the other parts.


And it's just cool to think about even if you haven't seen the other ones, I encourage


you to go see the other ones, but it's not necessary.


Okay, let's jump in.


So the ARC is a challenge currently running a Kaggle challenge.


But in essence, it is a dataset.


And let me just jump into one of the tasks of the dataset.


So in this dataset, you always have the task in the following form.


So you always have multiple input examples, like this, or say, these are called the training


examples.


And then you have a test example.


In this case, you have three training example, one test example.


So an entire, if you think of this in a machine learning way, this entire thing here is your


x.


And this thing here is your y.


Okay, so the label is going to be the output of the last example that you you don't know


that.


Now in the in the course in the training dataset, you do, but in the test, you don't.


So each one of these, as I said, is, is, is demonstrated, these are the demonstration


examples, and then you're supposed to sort of learn the regularity out of the demonstration


And then on this test example, you are supposed to apply this regularity that you learned.


So in here, a human can fairly accurately see that there are these black squares in


each image, and that in the training samples, the output will always sort of exactly match


into the place of these black squares.


As you can see, this is like a high rectangle, it goes here, it has the same amount of tiles


and so on.


And you can also see that whatever colors are in here sort of are the continuation of


a symmetric pattern.


So here, this is exactly the same as up here, but you know, flipped or turned by 180 degrees.


So there is a notion of symmetry right here.


So technically, one could compute this one would say, Oh, that's probably going to be


the three rows and this bunch of things.


And it's probably going to be the same as this one down here, but just flipped on its


head.


So as a human, you get this, even without a description, you realize like, Oh, this


is like a regular pattern, it's symmetric, there's a hole in it.


And apparently the thing here always fills the hole, I can see that, you know, three


examples are enough for me to confirm that that's what's going on.


And I see the hole here.


So I'm going to do the same thing.


So you can already see how these things are constructed in every, this is not the only


task by the way, this is just one task, okay, there are 1000 tasks in this data set of this


sort of nature.


Now, there are not always three demonstration examples, I believe there can be more or less.


But what's always the case is they always, each of these training examples consists of


these demonstration examples.


And this test example, each of the demonstration examples consists of an input grid and an


output grid.


And the input grid and output grid, they can be anywhere from one by one to 30 by 30.


Okay, anywhere in between that.


And the colors here, I believe there are nine different colors that can go, they're just


encoded by nine different numbers.


But there are nine different colors that these things can have, you can see black, blue,


orange, red, dark blue, and so on.


And the output grid exactly the same.


Now in this test example, you can only see the input grid, you cannot see the output


grid.


And that means you don't even know how large it should be, you can see right here, they're


not all the same size, the output grids.


In fact, not even the input grids have to be always the same size.


But you have to now come up with an output grid, you have to first decide how big it


is.


And we've here we've determined since the whole has three rows, we're probably going


to make three rows and it has like seven columns, we're probably going to make seven columns.


And that's the sort of thing you have to do.


And then not only do you have to decide how big it is, you now have to decide in each


cell what color you put in.


And only if this thing exactly matches the train or the test label, you get a you get


a point.


Otherwise, you get no point.


Okay, so in the training task, there are I believe 400 of these tasks.


And then there are 400 more as test split, but these are still public.


And then there are 200 that are secret.


That are I guess, part of this Kaggle challenge.


Yes, the training set features 400 tasks, while the evaluation set features 600 tasks.


The evaluation set is further split into a public evaluation set of 400 tasks and a private


evaluation set of 200 tasks.


All tasks are unique.


And the set of tasks and the set of training tasks are disjoint, sorry, of test tasks and


training tasks.


The task data is available at this, as you can see right here.


So I really hope that Sholay will keep these 200 tasks as a secret, even after the Kaggle


challenge, because it's going to be fun for people that might want to get into this later.


So here are the goals of this data set.


They want to stay close to these psychometric intelligence tests.


They say in particular, it should be solvable by humans without any specific practice or


training and probably also without any language instructions.


So you should be able to set a human in front of it and the human should be able to solve


it or a large portion of humans should be able to solve it, right?


Ideally, this test would also differentiate humans from each other.


But at this point, we want to simply assess machines.


So they say focus on measuring developer aware generalization rather than task specific skill


by only featuring novel tasks in the evaluation set.


And the novel tasks are unknown to the developer of a test taker.


So if I develop a system, I don't know what are these 200 tasks that Sholay keeps hidden,


I simply submit my code, and I'll figure out if my code does well on them.


So they say they want to feature highly abstract tasks must be understood by a test taker using


very few examples.


That's what you saw, you don't have a big training example to learn that this task is


about symmetry and whole filling.


You only have three.


And from three, you need to recognize what's going on and produce the output of the test


sample, right?


Quality of control for experience by only providing a fixed amount of training data


for each task.


That's what we saw, and only featuring tasks that do not lend themselves well to artificially


generating new data.


So it's not like ImageNet, where you can go on the internet and find a whole bunch of


images or you know, some NLP tasks where people pre train on all of Wikipedia and all of the


books in the world, because they want to understand language better.


These tasks are supposed to be such that it's, it's makes no sense for you to go out and


try to find more data or find similar data or pre train your model on something.


And then lastly, and this refers to the last few chapters we looked at explicitly described


the complete set of priors that it assumes, and enable a fair general intelligence comparison


between human and machines by only requiring priors to those innate human, close to innate


human prior knowledge.


So that means that whatever human have, whatever humans have as a prior built into them by


let's say evolution, or that most humans have picked up through life.


Those are the things that you have to explicitly point out.


So and you require that.


And you have to point them out.


Sorry, explicitly describe them such that I as a developer of a system can build them


into my system such that it's a fair comparison.


In the last chapters, we looked at the fact that a fair intelligence comparison is only


fair if two systems that are compared to each other have the same amount of experience.


And here we control that by only providing a fixed amount of training data, and also


have the same prior knowledge.


And here, we simply do that by listing the human priors that are required for the tasks


that we think that humans have.


And then we enable the developers to explicitly build those into machines.


So I would maybe build a little calculator module into my AI that solves this tasks.


Okay.


So they say each task consists of a small number of demonstration examples, 3.3 on average,


and a small number of test examples, generally one, although it might be two or three in


rare cases.


Each example consists of an input grid and an output grid.


Each grid is a literal grid of symbols.


Each symbol is visualized by color.


There are 10 unique symbols, a grid can be any height or width between one by one and


30 by 30.


So it doesn't even need to be square, right.


And as I said, you need to provide your own output grid as an AI taking this test.


So here are the priors that this test assumes.


And we're going to look at some examples that make it explicit, like some tasks in the training


set that where you can see these priors in action.


So there's an objectness prior, where the task assumes that the AI or the task tests,


that the AI understands something about objects.


So these are tasks that you can only reasonably solve if you know something about objects,


like you would, a human would recognize or would, you know, would recognize that these


things might represent different objects, right.


Now that's mainly, I think also due to the black background helps, but you would even


recognize this with another background.


Or here, the different colors indicate that those are two different things, even though


those two pixels here touch and are different from black, you would recognize that those


are two different things because they have different color.


But you would generally recognize one of these things as an individual object.


If you're not given anything, here you see, for example, a denoising task.


As a human, you can pretty quickly see what the task is about, right?


There appear to be these green things.


They're all rectangles, and there appear to be these blue things.


And on the right side, there are no more blue things.


But the now it's not always that when there was a blue thing, there is now a green thing.


Only here where it was sort of inside a green thing is now a green pixel.


Whenever there was a blue pixel outside in this black area, then there is now black.


So this is sort of like the blue things were noise and you're able to remove it.


This already tests a lot of assumptions.


A lot of these priors, a lot of understanding of the world.


So there are objects, right?


Objects, human understands that objects are square in this case, or rectangles.


The human understands that we need to remove the blue things going over.


And the human understands that somehow this inside relation, right, if something is inside


or outside of one of these rectangles, and that determines whether we have to turn the


pixel green or black.


You can, I mean, think about how you would train a machine to do something like this.


It's not easy, especially if you don't know that this task is coming.


Imagine for all of these things, you don't know that the task is coming.


This is just one of 400 tasks that you know of, there are 600 tasks that you don't know


of that are similar, but also, in a way completely different.


Here's another tasks that object influence via contact.


So this is your first demonstration example.


A human pretty quickly recognizes there appears to be red thing and a blue thing.


And then they appear to be together.


And then in the next thing, you see, oh, there appears to be a blue thing and the red thing


in the next thing, they appear to be together.


And if you look here, it always appears to be the red thing going to the blue thing in


the most direct way.


So in the, in the along the grid, that's all that the human needs to see two examples and


the human, most humans will already make that inference and can now solve if there is like,


if there now is a test example, where the blue thing is like, the blue thing is down


here.


And the red thing is here like this.


And it asks you what comes next, you know, you know that the red thing is going down


to the blue thing.


But it's very hard to train a machine to do this.


So I like this test, because it's sort of a different test.


And I believe the test, these tests weren't procedurally generated.


These tests were actually generated by show lay or, you know, by by actual humans.


That's pretty cool.


And 1000 tasks like this, it's going to be very hard to solve.


There are even more abstract priors like goal directedness.


So now you here you can already see this a little bit in that you can say, well, the


red thing wants to go to the blue thing.


So there is a notion of time involved, maybe.


There's also counting and numbers and numbers prior.


So here you see like a time process.


So in this demonstration example, you see blue things here, red big thing.


And then the next the output grid is this green thing.


And as a human immediately recognize, okay, so it shoots out from the blue thing, the


green thing shoots from the blue thing hits the red wall and goes here.


Try to make a machine understand this.


This is insane, right?


So if you look at the more examples, it all it appears that the blue thing always comes


from somewhere like the side of the image.


And the green thing comes out obviously, from whatever is not at the at the border of the


image and then bounces off the red thing if it hits the red thing.


Now here you can, you can already see what's going to happen.


Remember your AI would need to first determine aha, okay, all of these output grids, they


seem to be the same as the input grid.


So it would need to explicitly construct the output grid in the same manner as the input


grid because it understands this right, this is not the same in every task, then it needs


to recognize the red thing that stays in every one.


So it needs to put the red thing here right from from here.


And then it needs to recognize the blue thing stays as well.


And then most, most shockingly needs to recognize, okay, I will draw a line in pixels and lines


in pixels are hard here.


And then as soon as it would hit the red thing, it bounces off into the other direction.


So from just these three examples, the machine has to understand that and correctly output


the exact solution, not an approximate solution, the exact solution.


Okay, so yeah, there are these basic geometry and topology priors like lines, rectangular


shapes, symmetries, rotations, translations, shape upscaling, containing, being contained,


drawing lines, connecting points, and so on.


Now, let's look at some more examples.


These are fun, right?


Check out this one here.


So you see green, red, and then somehow the green connected to the red.


So this is an example of that has many of these priors in many of these concepts in


there is goal directedness, you can already sort of form the hypothesis that the green


wants to go to the red.


But also you see that somehow it sort of appears to the blue things seem to be maybe obstacles


and it appears to change direction when it encounters an obstacle like here.


So here, you see the example, and you probably confirm so your hypothesis could be it always


goes until it hits and then it changes direction towards the red thing, right always towards


red thing because it's not always towards the right because you return towards the left.


So it goes somehow towards the red thing.


And so it's pretty ambiguous in this situation.


But you can also make the assumption that it if it's ambiguous, it goes towards the


middle maybe maybe.


So here, again, now we're actually confirming probably so we go towards the red thing, which


would be towards this direction, then we hit an object, then we go towards the red thing


until we hit an object.


And then we go here.


All also see that these grids here are not the same size.


So it's not always the case that the grids of in within the same tasks are even the same


size.


So now here, you're again here AI would need to recognize what size of grid it needs to


draw and what the result is.


So it would need to copy this entire grid and also change these pixels right here to


be green pixels.


That's hard.


I mean, that's I find I find this to be pretty hard.


This is the line extrapolation and turning on obstacle and efficiently reaching a goal


prior.


That's crazy.


And is there more?


Yes, there is two more, I believe.


Yeah, those are the last examples.


So in this one, you can see right here, there appear to be objects, which there's this blue


objects appear to be the same and there are these red and then the output grid is one


of these blue objects.


Okay, so here we again see different objects, the output grid is one of them.


So as a human, you can already recognize the output grid is probably always going to be


one of these objects.


And now we need to decide on which one so we can formulate the hypothesis that it's


probably going to be the one that's the most like here, there's three of the blue ones


here, there's four of the yellow ones, that's more than any other.


And this here confirms our hypothesis that the it's the object that appears most often.


Now again, see that there is this notion of objectness.


You need to upscale somehow.


No, this is not upscaling because the grid is the same size.


It's simply the image that's upscaled.


But you need to somehow focus be able to focus in on one of these objects, I need to count


them you need to compare the counts via each other.


And now here you can pretty easily see that the output grid is going to contain one of


those blue things as a human.


And here it's it's sort of a symmetry filling task.


Now as a human, you need one demonstration to get this.


Maybe you need more, but many tasks involve some sort of symmetry, okay, drawing the symmetrized


version around the version of a shape around a marker, that's going to be fairly hard for


a machine to learn without without the developer knowing that this task is coming.


Okay.


They highlight some differentiations to standard psychometric tests.


But what I find interesting here is that this thing, what a solution to arc may look like


and what it would imply for AI applications.


They say we have found arc to be fully solvable by humans.


So they've set a human in front of every, every one of these tasks and it's solvable.


While many arc tasks are intellectually challenging human test takes us appear to be able to solve


the majority of tasks on their first try without any practice or verbal explanations.


In effect, in this task, you get three tries at each at each of the at each of the problems


you get three, three tries and the humans can already solve it in one.


So that just show you it shows you how cool humans are.


So here is a show they suggest a solution approach says by start by developing a domain


specific language capable of expressing all possible situations, all possible solution


programs for any arc task.


Since the exact set of arc tasks is purposely not formally definable, this may be challenging.


The space of tasks is defined as anything expressible in terms of arc pairs that would


only involve core knowledge.


So core knowledge is this set of human priors that we discussed last time like objectness


and symmetries and geometric shapes and navigation and so on.


So he asks you to basically develop a DSL that can capture all the different tasks.


So so kept basically define a formalism of these tasks.


But it's hard because you don't know what the tasks are going to be.


So your best bet is probably to make a formalism that completely over represents what the tasks


can be right.


It would require hard coding the core knowledge priors from 3.1.2 in a sufficiently abstract


and combinable program form to serve as a basis functions for a kind of human like reasoning


DSL.


We believe that solving this specific sub problem is critical to a to general AI progress.


So he says whenever we can describe this is like saying that this AI progress will make


a big step once we can formally describe human priors.


And while true, this I feel the hardness of this problem is as hard as actually building


general artificial intelligence or very close to it.


So it is a bit of a like how to how to how to go how to build a GI step one build a GI


that's sort of and not exactly but it's kind of what this says, right?


If I could actually have this DSL to describe every single task and I could do it, you know,


such that it is not not super over capturing all the tasks, then I would be able then I


would have described human core knowledge in a sufficiently accurate degree that I could


just you know, build a GI.


But he goes on says given a task use the DSL to generate a set of candidate programs that


turn the input grids into the corresponding output grids.


This step would reuse and recombine sub programs that previously proved useful in other arc


tasks.


So it says, whenever you have captured the core knowledge or whenever you have captured


the problem space in a formal language, you can simply use that formal language to express


whatever your input is.


So the that turn the input grids into the corresponding output grids.


So you would put in these demonstration examples and describe this with your formal language


that you have and you can somehow reuse and recombine sub programs that previously proved


useful.


So basically asking you to write to come up with source code that would generate these


demonstration examples in the language of your DSL.


And then he says select top candidates among these programs.


So you would generate multiple versions of source code that generates these these things


based on a criterion such as a program simplicity or program likelihood.


Note that we do not expect that merely selecting the simplest possible program that works on


training pairs will generalize well to test pairs.


And then use the top three candidates to generate output grids for the test examples.


So I hope the the approach here, I feel it makes sense, but it is sort of over hopeful


in in my mind.


And that's mainly because of of step one.


So step one asks you to come up with like a programming language that can capture all


the tasks in this all the tasks in the data set, even though you don't know what the tasks


are, and that has this human core knowledge in inside of it in a in a formally describable


way.


And then once you have that programming language, you would, if you're given this task where


you have, you know, a bunch of these demonstration, you have a bunch of these demonstration things,


and then you have the test thing, you would generate all the programs that would produce


these demonstration examples, or that would given the demo given the input grade would


produce the output grid, right, you would generate all the programs.


And then you would select somehow among all these programs, the one that you think generalizes


the most and you would use that program to put this in and get out the solution.


They say it's probably it's not always the simplest program, not always the shortest


program, maybe who knows, like, I feel step one is the kind of the crucial issue here.


Okay, so they say they make some claims here and about what this what this would bring


the community, we posit that the existence of human level arc solver would represent


the ability to program an AI from demonstrations alone, only requiring a handful of demonstrations


to specify complex tasks to do a wide range of human relatable tasks of a kind that would


normally require human level human like fluid intelligence.


As supporting evidence, we note that human performance on psychometric intelligent tests,


which are similar to our is predictive of success across all human cognitive tasks.


Further, we posit that since an arc solver and human intelligence would be both founded


on the same knowledge priors, the scope of application of an arc solver would be closer


to that of human cognition, making it such a solver both practically valuable and easy


to interact with, and would produce behavior that is in line with human expectations.


Okay, so they're making the same argument that anyone before has made, but they condition


it on some things.


And this is, I think, the conclusion of the entire article here of on the measure of intelligence,


because people had this hope and they say that here claims are highly speculative and


may prove incorrect, much like Newell's 1973 hopes that progress on chess playing would


translate into meaningful progress and achieving a broad range of cognitive abilities, especially


if arc turns out to feature unforeseen vulnerabilities to unintelligent shortcuts.


This is the AI effect, and basically means that whenever you think a task, the solving


of a task represents AI, and then you actually see the solution, then the solution turns


out to be not AI in the eyes of the human.


So the human at first, they would say, Oh, this task really requires intelligence, and


then someone solves the task, and they'll see all that's not intelligence, you can hack


your way to that.


And the expectation is that in this arc challenge, there might be a hacky way to that.


But I mean, the good question is, when at what, is there even a task like this arc challenge


here?


Could that is there even a possibility of a task where you wouldn't say that?


And I'm not so sure about this.


They seem to be more hopeful than I am.


But at least they say, the arc challenge is founded on the same priors as a human has,


it gives you the same amount of experience as a human has, right.


And therefore, it is much more comparable to human intelligence.


All right, they go over some weaknesses right here, of criticizing their own thing.


Generalization is not quantified.


So they have a measure of generalization in the previous chapter, but they don't use it


right here.


Test validity is not established, data set size and diversity may be limited, and so


on.


But I, in my mind, this, I would not consider this as like an AGI task or anything like


this.


I'm pretty sure the solution to this will come in a form again, where people don't really


think it's, it exhibits intelligence.


But I do like the task as such.


And as a machine learner, I am very excited to think about how machine learning can go


about solving this task.


And especially with what we've seen from something like GPT-3, that has exactly this kind of


structure where you train on a giant data set, blah, blah, blah, you pre train your


language model, but then at inference time, you input a bunch of these demonstration examples,


and you ask it for the next output.


So I feel that might be a good start for for doing it.


The question of course, is what, what then do you pre train this model on this GPT-3


for ARC?


What's the pre training data set for it?


And I guess that's going to be the challenge and probably going to require people to specifically


program all of these priors into a data set generator for pre training.


So that would be my approach.


My approach would be write a data set generator for pre training and GPT-3 model to do these


kind of tasks.


And in order to write the data set generator, you'd have to basically program in all of


these priors and that's not going to be easy because your best bet is to sort of put yourself


into the shoes of shoal and be like, oh, if I were to design a task, what kind of things


would I do and then try to capture that?


That's going to be your best bet.


Your most honest bet with respect to the challenge is to try to as faithfully as possible implement


something like an objectness prior where cohesion and persistence are captured.


That would be the most scientifically sound approach to my approach.


All right, so that was my take on the ARC data set.


If you have any comments, I'm very excited to hear comments on this.


If you have already tried the ARC challenge, have some insight.


I also welcome comments on that.


And with that, I'll see you next time.


A Deep Dream of a Neural Network


Pretrained Transformers as Universal Computation Engines (Machine Learning Research Paper Explained)

Hi there, today we're looking at pre trained transformers as universal computation engines


by Kevin Lu, Adita Grover, Pieter Abbeel and Igor Mordach. On a high level, this paper argues that


pre trained transformers, specifically transformers pre trained on language modeling, are doing


something called universal computation. And the way they prove it is by transfer learning these


transformers to completely new domains. So not language modeling, they do things like x or tasks


or c for 10. So computer vision, they transfer learn these transformers to these completely


new domains, and they don't just do it in a regular transfer learning way, they freeze almost


all of the parameters of that transformers, specifically, they freeze all of the attention


and all of the feed forward layers in the transformer. Therefore, they only fine tune about


point 01% or so or point 1% of the parameters of the model. And they show that on these specific


tasks, these frozen pre trained transformers, as you can see right here, are competitive,


if not outperforming a transformer that is fully trained from scratch on these tasks. And it also


mostly outperforms LSTMs that are fully trained from scratch on these tasks. So this is pretty


interesting. And it gives rise to a number of sort of questions about what happens in these


transformers. So we're going to look at what the claims are, and what the let's the evidence brought


forth by this paper is about why language pre trained transformers are universal computation


engines. And yeah, I'll have some comments on my own, as always, if you do like content like this,


share it out, leave a like and tell me what you think is going on here in the comments.


Right, so the abstract reads, we investigate the capability of transformer pre trained on natural


language to generalize to other modalities with minimal fine tuning. And they say in particular


without fine tuning of the self attention and feed forward layers of the residual blocks. So as you


know, or as you might know, a transformer is built approximately like this. So what you have is you


have input, so you have the positional embeddings, and you have the input embeddings. Now, if it is


a language model, that is simply one vector for every word or word piece. If it is an image model,


like in the vision transformer in the VIP, it is you simply take the image and you make it into


these patches. And then each patch patch, you simply unroll the patch into one long vector.


So you simply unroll the pixels. And that is a patch and that in the sequence of such patches is


your inputs. Now, what follows is these self attention blocks. And this is the majority of


the transformer is L times the self attention blocks, you always have a attention layer. And


if you if you don't know what an attention layer is, I'm sure you'll find some video on YouTube


that explains it. This is followed by layer norm. This is followed by a element wise feed forward


layer. And it is again followed by a layer norm, you also have the residual connections, as you


can see right here. And then all of this is followed by an output layer. And the output


layer is very task specific. In language modeling, it's obviously classifying into the vocabulary,


so into one of whatever the 30,000 possible continuations in computer vision, it might be


classifying into the classes of the data set. So for example, in image net, you'd have 1000 classes


or 21,000, depending on which, which version you use. So what they're saying is they are not


fine tuning, they are freezing the multi head attention. And they're also freezing the feed


forward layers. Now these make up like 99 some percent of the transformer. So what they get is


they get a frozen pre trained transformers and frozen specifically refers to these parts I marked


in blue. In fact, they just keep the attention and they keep the feed forward layers as they come out


of the of the language pre training, and then they train the things on different tasks. So


these tasks are as follows, there's bit memory, they consider a bit memory task where the model


is shown five bit strings, each of length 1000. Afterwards, the model is shown a masked version


of one of the bit strings, where each bit is masked with probability point five, and a model


is tasked with reproducing the original bit strings. So you give it you give it five bit


strings in sequence. And then you give it a sixth one that is kind of corrupted. And the model must


figure out which one of these five it is. And then it must successfully reproduce that bit string. So


if it figures out it's probably number three, the model has to look at the overlap between the


strings and then where there's the most overlap, it needs to copy over that string or the non


overlapping parts. So this is a fairly complicated task for a model like this that is just trained


with backprop, right? There is bit soar, where you have two bit strings of length five, and you need


to compute the element wise x or this is a long standing difficult task for neural networks,


we know that there is list ops where you get a sequence like this, and you must compute the


result. So it's acting a little bit like a calculator. So now it turns actually out that


if you think of the bit bit memory, that's already pretty similar to language, right? bit soar,


maybe not list ops, you were going to see that these models perform fairly poorly on the list ops


task. And then the last one is computer vision. So mnist and c410 is the classic like vision


transformer domain where but still they take the transformer that's pre trained on language


and simply fine tune the positional embeddings, the input embeddings, the output layer, and the


layer norm parameters. That's all they do. And the last one is c410 from the long range arena,


where instead of forming patches like this, in the long range arena task, you simply take every


single pixel into as its own kind of, so you don't do patches anymore, you do your own role pixel by


pixel, that is significantly longer vector for the model to to compute over. So it's going to make


the task a bit more difficult, because you completely lose all localization information.


And the last one is this remote homology detection. It's a task from protein folding.


Okay, so how do these? How do these things do you've already seen this here in the overview,


namely, if you train these things on these bit tasks, a bit memory or bit soar, you can see that


a if you the frozen transformer here reaches 100%, so does the full transformer. So what that shows


you, it's not necessarily which one's better, it's just that both are are able to completely


solve this task. Well, for example, an LSTM is not that we have no idea here what the size of


the LSTM is, I don't think they stated anywhere. So the comparison with an LSTM, it is cool to see


that the LSTM doesn't get this relatively simple task, but it also might just be a function of how


large the LSTM is and how much rigor goes into training one. Nevertheless, the LSTM can't solve


it. And that's because the LSTM takes in a sequence as just one at a time, and it needs to


sort of remember in its hidden state, what the individual elements are, and it can't go back,


right, the transformer, it can always look back, the LSTM needs to remember everything. And I think


that makes it much harder to do these kind of sequence tasks. I already told you list ops,


they all perform badly. But interestingly, they perform equally badly. So the full transformer


here is no better than the frozen transformer, which is very interesting. And if you look at


MNIST and CIFAR-10, actually all of the other tasks, you'll see that the frozen transformer is


not worse than the full transformer. In fact, it's sometimes better. And that is going to be


an interesting, an interesting thing also to look at. So the whole paper is actually just ablation


studies into this phenomenon, like why does this happen? And it's very cool. And the result is


going to be so the authors claim that there is something special about language pre training


that already primes the transformer to be receptive to these new tasks. Now, there are two different


possibilities if you if you think what's happening here. Actually, let's first go to the ablations and


do the discussion at the end. Because once you see what is happening, you will, you'll be able to


form your own opinion. What I would like to record remind you though, is that they do,


they do train these layer norm, sorry, they do train the layer norm parameters, right. So when I


saw this, when I when I saw this, and they said, well, we only train the input embeddings, because


of course, it's a different modality. So adjusting the input embeddings makes sense, right? And the


position embeddings, maybe two, and the output layer, because we have a different task that makes


sense to and the rest, we freeze, but we also adjust the layer norm parameters, right? But we


don't adjust the attention. My immediate thought was you probably probably tried doing it without


the layer norm parameters at the beginning, they probably tried just adjusting input and output


embeddings. And that probably didn't work too well. And in the ablations, you're actually going to see


this. So and there, I think this hinges on the fact and we've seen this with transformers before,


I think they're called adapter layers. So if you have your kind of transformer layers, one after


another, what you can do is you can build in these adapter layers that have very few parameter that


are kind of compressing and uncompressing the data. And that's a way you can fine tune the


transformer. So this kind of goes in and out again in dimensionality. That is a way you can adapt.


And we know that these things are very possible with transformers that you can sort of have the


transformer ready and then only adjust very few parameters to transfer learn. And I think the same


is going on here. Now what the the authors sort of hint at is that in in the schematically, if you


have the transformer, you have the attention part, which is sort of the cross information routing


part, right. And then after that, you have the feed forward part, which is element wise like this.


And then you sort of have a layer norm part and the layer norm part. What it essentially is in


terms of learnable parameter is that you take one element here or even one channel or one layer and


this depends on the exact type of norm. But you in the input signal, you have two parameters that


you learn. So your output of the layer norm is going to be a normalized x. So this is a normalization


and you do it either over the batch or over the layer or something like this. In layer norm, you


do it over the layer, and you have two parameters that you can learn. One is a scaling, and one is


an offset. And I think, you know, by learning these, you can adapt and this is this is, I think


these two things have a lot of relation to each other, even though the authors say, we don't learn


any of the attention, I can by influencing this a and this B right here, and this y then goes into


the next layer of attention. I can very much influence how the attention works, right? If the


y is then in the next layer from the y, I construct the W, sorry, I construct the keys, queries and


values keep of this particular element, and that decides what information gets routed where and so


on. So I have very much an influence over the over the attention in the next layer. By adjusting


this a, I might not have a direct influence, like I can only if of course, if I want to change


something in an element in the key, an effect of this because I have to change the y, I can


change the y as a whole is going to be there also change something in here. But certainly


backprop will figure out some way I can make this happen. Okay, so I, I think this this whole notion


of we don't influence the attention at all. It's not as clear cut. It's true, they don't change the


attention parameters. However, they are very, they are able to influence how information is routed


by changing the signal itself in these layer norm parameters. Also, they here they call it zero shot,


they say, improves performance and compute efficiency on non language downstream tasks.


In particular, we find that such pre training enables the frozen pre transformers to generalize


in zero shot to these modalities, zero shot, I think that's a bit of an it's a bit of an over


claim. Like I get it use you pre train, whatever how many few percent, like only fine tuning


point 1% of the total number of parameters of the transformer model, and none of the self attention


parameters. I don't think it's entirely fair to call this zero shot on less I completely have


overseen and misread the paper, which of course is possible because I'm just one per person


reading a paper. Okay. So again, we fine tune the output layer, the input layer, the layer norm


parameters and the positional embeddings. My claim is this here does most of the work. Like we know


we already know that for example, for CNNs, we can do we can take a randomly initialized CNN and by


just adjusting the batch norm parameters, we can already gain a non trivial result. And I think the


layer norm here is doing a lot of the work, of course, the input and output layer as well,


we also know that we can take like a randomly initialized neural network and simply training


an output layer can already also give us a good performance. This is all stuff they do in this


paper. However, I think the layer norm does a lot of the a lot of the crucial work here,


too. But there are still some interesting things that come out of these experiments,


because it's not just that. Okay. So, as I said, the paper is a big piece of ablation studies.


Oh, yeah, that's what I forgot. The interesting thing, of course, is that the fully trained


transformer isn't better, right? That's the interesting thing, like if you fully train


a transformer on the same tasks, and this is due, I think, and I think the paper agrees,


due to the fact that we are in sort of the low data regime, at least for the things here that


are like the natural data sets, like MNIST or CIFAR-10, we don't have too many, we don't have


too many data points. So training a big transformer with all the parameters could even be counter


productive, because we're just going to overfit or shoot ourselves in the foot.


All right, let's go through these experiments. Can pre trained language models transfer to


different modalities? And the answer here is going to be yes, absolutely. So their base thing


is like a GPT-2 model that is trained on language. And it's so interesting, right, that if you


transfer to these tasks, and you can see, right here, you compare it, so these are the results


from figure one, this is just what you saw in the bar diagram. Again, it's pretty interesting


that these fully the frozen pre trained transformers match the performance of the full


and outperform the LSTMs on these tasks. Pretty cool. So in some tasks, you can see right here in


the homology, they even outperform the fully trained transformers. The second one, what is


the importance of the pre training modality? So here, they're going to compare what if we just


randomly initialize a transformer and then keep just keep we freeze the same layers, but they're


not trained, they're randomly initialized. Or we pre train it on this bit memory tasks, it's just


this one task, or we pre train it on ImageNet, ImageNet 21k. In fact, we so we pre train instead


of on language on images, or we pre train on languages, this is this FPT is pre trained on


languages, which one is going to be the best. So this is to counter people, they're making the


claim that language modeling has a specific specific property that language is sort of a good


task to pre train these transformers better than other modalities. So you can't just pre train the


transformer on any old task. That's what they're saying here, that language is somehow special,


or the best out of these ones. So in order to demonstrate that you can see right here, the


this is the language one, the randomly initialized one already kind of under performs throughout


here. So actually not that much in these things here. But you can see on MNIST or on C410, it does


not perform too well all across the bit memory one, obviously performs well in the bit memory


task that is was pre trained on. But also it kind of sucks on the rest of these tasks. It's okay,


in MNIST it's the performance is kind of shaky. And the vision transformer is better. But it still


lags behind except on C410. Because, you know, being pre trained as a vision model might, you


know, it seems like it's okay that it performs well on image modeling. The whole point here,


though, is to generalize to domains out of your pre training thing. And on these domains,


the language one is better than all the other ones. Now, the question, there is multiple


questions here. I think it is a bit too early from just this paper to say that language modeling has


this special property, right? What I think might also be an explanation is, for example, how


difficult is your pre training task? Now, when you look at language modeling, you can look at simply


how many classes does it have? So the number of classes is in language modeling, something like


30k, like these vocabularies are fairly large, random, it's absolutely nothing. These bit memory


tasks is so you have two classes. And in the vision transformer, you have 21k classes, but you


only need to apply it once per sequence, right, you only have to have one output. Whereas in


language modeling, you need to output every single, so every single token is a classification. So in


fact, the, this is not necessarily more classes, but it is, let's say more training examples per


training data point that you get, because every token is a training example, essentially. So it


might not be a language thing, it might just be how, how hard the task is in terms of number of


classes and how much training data you have available. I think there are a lot of variables


that they haven't necessarily controlled for here. And it might be a bit too early to say language


modeling is the task, though, what I'm completely prepared to accept is to say language modeling is


a good task. In fact, it's the best task out of these ones. But I think the it could be a cool,


it could be cool to research more in this direction and say, okay, can we find a better task? Can we


find a task that is even more complex? And that depends on what is really going on here. So I see


two possibilities, possibility one, why this even works is to say that somehow natural signals


are all somehow equal. So pre training on language somehow makes the transformer the attention layers


just adjust themselves to the sort of natural signals that we see around us. So when we feed


in an image recognition task, or any other tasks that kind of humans care about in the natural


world, the transformer is already sort of prepared about what that could entail like about the types


of computation. And then second of all, and this, this is different, this is simply with enough


complexity, you see, there is simply what I'm going to say, computational,


computational utility, computational utility. What I mean by that is that there are simple when when


you pre train on a task, certain types of computation are going to be important for that


task. And the more complex and the bigger your model, the more sort of print computational


primitives you can encode into the attention layers. Now, when you encode these computational


primitives, it's not necessarily of course, it has something to do with the type of signal.


But I think what's up, what could be happening is that these transformers, they simply they prepare


a lot of good features that are just useful to compute different stuff, like X or like remembering


things, and so on. I think this could definitely be the case that in these attention layers, there


are these just computational primitives encoded. And if you pre train on a task, and the harder


the task is, the more of these primitives need to be encoded. And what you do when you adjust the


layers in between is simply that you recombine these primitives in a better way. But sort of all


of the computational primitives are already there. I think I think the two are not necessarily even


exclusive. And I think the paper hints at both might be playing a role right here. I don't think


they say exactly the same thing. But this would also give sort of meaning to this word of


computation or universal computation engine, there of the that these transformers, and we might even


extend that to probably any machine learning model, if we could scale it up and train it correctly,


probably evolves or trains to have these computational primitives inside of it. And that's


why we can adjust it with just a little bit. Now they're going to claim there is something about


um, there is something about language pre training later. So first of all, they say how important is


the transformer architecture. And here they simply say, if we take a randomly initialized transformer,


and compare it with a randomly initialized LSTM, we freeze, we freeze the attention layers,


and then we just do our frozen training, then the transformer performs a lot better than the LSTM


here in most actually all of the tasks. However, this is a very shaky comparison, of course,


because how do you fairly compare a transformer architectures within LSTM architectures? Do you


control number of parameters number of computation? Speed? I don't know. Okay, so I don't know what's


fair. Next, does language pre training improve efficiency over random initialization? The answer


is yes, it converges much faster if you pre train with language. And do the frozen attention layers


attend to modality specific tokens. So here, they're just going to look at the first attention


layer. And they see that the attention matrix, for example, in this bit XOR task attends. So here are


the two, here are the two, this is string number one, this is string number two. And in the output


from here, you need to compute the, the XOR, you can see that the attention first is it's on the,


on the first one, and then it's also on the second one, right in the output, it always looks at the


corresponding position. So here, you can see clearly that the attention matrix already attends


to the correct things for the task, which is cool, because we've never trained the attention,


right. But it's I think that goes into my claim that, look, we are still able to influence the


attention matrix, even though we don't train the attention weights, we are able to influence it by


training these in between parameters. The same goes for these bit memory tasks, you can see the


attention matrices are very much attuned to the task right here. Next one, does freezing the


transformer prevent overfitting or underfitting? And here they, they train this frozen transformer,


and they compare it to training a transformer that just has three layers. So they say,


our general finding is that in contrast to their fully trained counterparts, FPT models


underfit the data, which lends them to further improvements by increasing model capacity. So


if you compare it to a three layer transformer, the three layer transformer does outperform the


12 layer frozen transformer. However, it does so by reaching a much higher training accuracy. So


overfitting is much more of a problem if you fully train the transformer. However, if you use this


frozen transformer, you're probably underfitting, as you can see right here. So you could technically


scale up and gain more power with this frozen fine tuning. Does performance scale with model size?


Yes. So you can see as you increase from small to medium to large, as you increase the number of


layers, the performance increases. However, the performance also increases for a randomly


initialized one. So it just seems to be like, the more parameters, the better it's the same. And


here is something I find interesting. Can performance be attributed simply to better


statistics for initializations? Here, they're going to, let's say, make the point that there is


something about language model pre training that actually makes the transformer conducive to all


these tasks. And you can't just reach that by better initialization, which is more point one


from here than point two, because point two, you could just reach by initializing in a better way,


like these, we could, we could characterize these computational primitives. And we could


build them in from the start, whereas natural signals, we can't characterize them, otherwise,


we wouldn't need machine learning. So what they're going to do is they're simply going to


take a fully trained transformer, which they call an Oracle. And then they they're going to


compute the mean and the standard deviation, so that the Gaussian from those, and then they're


going to initialize this new transformer. So they're going to take the pre trained, which


they have, they're going to do default, which is the randomly initialized one, we've already seen


those one as well. And then they're going to take a randomly initialized one, but not randomly with


a default randomization, but randomly with the statistics they got from the Oracle. So this


transformer is going to be randomly initialized, but it has the same statistics as the as the full


transformer, or as a trained transformer. So the statistics are correct. And that does not seem,


it seems to help a little bit, as you can see, but it does not seem to help. In fact, here,


it even it even hurts. However, I think that's a bit of a weak experiment. And I think there is


still a possibility that we could initialize these transformers much better if we could,


if we could correctly capture the essence of these computational primitives that are there in that are


learned by gradient descent, I think if we can capture those in a theoretically sound way,


we might be able to initialize or if we could just Yeah, if we could find like a not a natural


language, but if we could find a synthetic pre training task that is just so hard, but it


completely initializes all of these computational primitives, that might still be better. And that's


going to be the ultimate experiment that differentiates between option one, natural


language pre training is somehow important because of grammar and natural signals, or option two,


what we're doing is just inputting computational primitives into these layers.


Thus fine tuning self attention and feed forward layers further improve performance. And the


answer is actually no, it degrades, you can see right here, this is worse than this. And that's


because probably of overfitting, if you fine tune the whole transformer, you're going to fall down.


And now here is where it really comes in that, you know, these tasks, they are in the low data


regime, I know, if you go back five years, that sounds ridiculous. But right now they are these


things will overfit if you train everything. And here it comes, which parameters of the model are


important to fine tune. And you can go look at the you can go look at the look at the table,


it's in the appendix, but they say, in particular, we find orthogonal initialization, wait, we run


ablations. Here, we generally find the layer norm parameters to be most important. The layer norm


parameters, right. And that sort of gives it gives a gives credence to the fact this is not so the,


I think what what they're doing, yeah, these layer norms, they carry a lot of the weight


of these things right here. It's still pretty cool, because there are very few parameters that


you need to fine tune. And okay, now they do a bunch of more ablations, like only training the


output layer, which gives non trivial performance, but not a good enough performance. So, and yeah,


for some reason, I have another set of the paper right here. But this was essentially the paper,


it's very cool. And the paper is super, I think it's well written. And it's easy to read, because


it's like, hey, here's a phenomenon we've discovered. And now we're just going to investigate


all kinds of things that explain this phenomenon, we're going to rule out some stuff, some hypotheses,


and we're going to arrive at some kind of conclusion in here. And yeah, that was my two


Big Transfer (BiT): General Visual Representation Learning (Paper Explained)

Hi there. Today we're talking about Big Transfer,


General Visual Representation Learning by Alexander Kolesnikov,


Lukas Bayer, Yawa Chai, and others of Google Brain.


So this paper is basically an application slash engineering paper for the community.


It is about the task of transfer learning for visual tasks.


So what does that mean?


In a visual task, the meaning is basically that the input is an image.


So it could be a classifier where you have an image and you have to say that this is a cat.


Or it could be, let's say, a medical image of a lung


and you have to point out where the defect in the lung is or if there is a defect in the lung or something like this.


As we all know, this field is pretty much dominated by CNNs, by convolutional neural networks


that take in these images through many layers of convolution,


especially residual networks are doing particularly well on these tasks.


The problem, of course, is that in some tasks you have lots of data and that's fine because CNNs need lots of data to train.


But in some tasks, especially these medical tasks, you only have like very small database.


Look at the small database.


You only have very few labeled samples where the model could learn from.


And that just is not enough to learn these big models that would perform well.


So you will have to settle for a less performing model.


Now, the solution or one of the solutions is transfer learning.


In transfer learning, what you do is you take a large data set, for example, the ImageNet data set.


You have this big data set right here and you train your CNN on that.


And then you take that CNN and you do what's called a fine tuning step on this small data set.


So you take the CNN that you gained from the large data set as a starting point


and then you just train for a few steps, you just kind of adapt it to this final data set that you actually want to train it on.


And that usually helps.


And why does that help?


Because you sort of hope that the large data set and the small data set are at least somewhat overlapping in there.


So the images in the large data set are somewhat similar to the images in the small data set.


It doesn't need to be super similar, but just somewhat.


And you hope that the features that the CNN learns from the large data set are useful in the small data set.


Because then if that is the case, when you fine tune on the small data set, that's this step down here, that's called fine tuning.


When you fine tune, you can pretty much reuse those features.


You only have to adjust them a little bit and you just have to learn how to map the features to the output,


which now is of course different than in the original task, but you won't have to rediscover the features.


So that's why transfer learning can help.


So the first phase is called pre-training.


The second phase is called fine tuning.


Now, the ultimate goal in this is the following.


Imagine you have like a giant database of data, right?


This is giant.


Look at the size comparison to the others.


And so you have this big, big database of images and you train a CNN on that big database of labeled images.


Now, what you're hoping is that you can do this once and then this one CNN trained on this giant data set will become the starting point for all kinds of small tasks now.


So basically, you can post this on a repository online and everyone that has a visual task will not train from scratch,


but they will basically take this one CNN as a starting point.


It is very similar to what people are doing right now with BERT or generally these transformer language models.


You never want to train them from scratch.


You always want to train from a pre-trained state that someone else has done because usually the big work is now shifted to the pre-training.


So the goal is to find this one universal starting point for visual learning.


And of course, no better place to do this than Google.


They certainly do have a giant databases of images.


They certainly have lots of computation, which we're going to see is very necessary for something like this.


Now, they do train three different models.


Their model is called BIT and they train three different variants BIT, small, medium and large.


So the L model is trained on 300 million images.


The medium model is trained on 14 million images.


So this is the I think it's called JFT dataset.


This here is called the ImageNet 21K dataset, which looks pretty funky.


It has like objects in front of weird backgrounds and stuff like that.


And the small is simply trained on the 1.3 million ImageNet dataset.


So I mean, just look at this.


We're in a situation where the small model is pre-trained on ImageNet just for reference.


If you had imagined this five years ago, this you would not have, maybe you would have guessed it, but it's still impressive.


So they do release these two models here, the medium and the small one.


Pre-trained, I believe they don't release the large one, which maybe that's the price we have to pay for getting the medium and the small one.


The fact that now Google can use this in their products, because they have probably spent a considerable amount of money in doing this.


I'm not sure this is a philosophical discussion, whether in the interest of science they should release all, because they do give the sort of exact training protocol.


You just need the money basically.


All right, but that's not the topic of this video.


So the models here are all pretty much just residual networks.


They're all these ResNet-152, I think, X4, which means that basically scale the width of each layer by a number of four from the original ResNet architecture.


And that's pretty much it.


They just, this is the architecture.


There's nothing really new in this paper.


It's the paper just details what exactly you have to do, which things exactly matter when you pre-train these things and which ones don't.


And therefore, I believe it is a pretty good paper.


And I think that these models here, the M and S models, and maybe someone else trains an L model and releases it, will sort of become the standard like we have in BERT now.


So whenever you have a visual task, you're just going to start from those in practice.


So this, I think, is mainly relevant for people in practice.


All right, here you can see these models.


First of all, excellent, excellent not labeling of your x-axis.


Absolutely beautiful.


The x-axis, I believe, is the number of samples per data class.


So now they take their pre-trained model, this bit L, and they fine tune it on these data sets.


So ImageNet is one of the tasks they fine tune on, or CIFAR-10, CIFAR-100, and so on.


And first of all, look on the right side, this full thing.


This is when you take the entire data set.


So often they outperform, they get state of the art on the full data sets.


Now they do compare against what they call generalist models.


So generalist models are ones that have this particular training protocol where they train on one big giant database and then fine tune to all the other tasks.


They do not achieve state of the art on all data sets in what they call specialist models.