[00:00] The way you train a diffusion model neural network is you take some images, that's the training data, and you tweak the RGB values of all the pixels randomly, that's called adding noise. [00:13] You then ask the model to tell you how it thinks you tweaked all of those pixels. Like, I think this pixel is too green by this much, this pixel is not red enough by a small amount, and so on. [00:26] And it gives you that as an array of values. In other words, you're asking it what the noise was that you added to the image. And remember, this is still the training stage. So at this point, you say, no, that's terrible what you came up with. [00:38] This was the actual noise that I added. Now go away and fix all of the parameters in your model so it does a better job next time. But actually, you're doing it with millions of images at the same time. So you're saying, look, you got all these pixels wrong by this much in this image. [00:54] And you got all these pixels wrong by this much in millions of images. tweak all of the parameters inside your neural network so that it's better for all of these images at the same time. I told you it was wild. So anyway, you train it on noisier and noisier images. [01:09] In other words, images where you've messed about with the values of all the pixels more and more and more until eventually you can give it an image that's just pure noise, completely random pixels. And so then when it gives you a prediction of the noise that was added to an image, [01:23] when you remove that prediction it will give you an image that looks like something recognizable from the training images Now at this point you have no control over what comes out at all It just gonna be random what you get [01:35] Well, the model is able to figure out what noise needs to be removed from an image because it has learned to understand features of images. And in some ways, it's very similar to the way a language model understands the meaning of text, [01:50] which is to say it goes through several iterations where its understanding of image features become more and more nuanced. So maybe in the first iteration, it's just picking up on where the edges are in the image. [02:02] And then in later iterations, maybe it's picking up on concepts like furriness or maybe light glinting off a shiny surface. And then later on, maybe that it's in the style of a Monet. It would just be a long list of values that represent these things. [02:16] And again, if you actually interrogate the values, it might be very difficult to actually pick out specific things that we would understand. And that's where a model called Clip comes in. Clip was trained on millions of images from the internet and their captions. [02:30] So during training, it was learning the meaning of the text and the features of the image and the vectors it was producing for both of those things. It was putting in the same place in a shared vector space of semantic meaning and image features. [02:46] And so the model will now guess what noise needs to be removed in a way that pushes the image towards having features that are encoded in this vector.