Intro0:00
Cool.
Um, I'm going to get started.
The sound's alright? Okay, yeah, I can— I can hear myself. Okay, great. Thanks for coming, everyone. I'm Sander, I'm a research scientist at Google DeepMind, have been there for over a decade now. I'm on the generative media team, so we work on models like Veo and Nano Banana.
And I want to— this talk is kind of a bit of a behind-the-scenes perspective on, like, everything that goes into training these models at scale. And so it's going to be focused on diffusion models, because that's sort of the modeling paradigm that, at least nowadays, people tend to use for generating audio-visual data, which is a bit different from the language modeling situation where we primarily rely on auto-regression, although, of course, not exclusively these days.
So yeah, I have— this is kind of a whirlwind tour of everything that goes into it. So I have 8 sections, which is quite a lot to get through. They're not all equally long. I have more to say about some things than others, so I have more to say about the modeling and the sampling side of things, for example.
But I'll just try to cover a little bit of everything, and then hopefully leave enough time for questions as well at the end about any of these things. So the topics I want to cover are data curation, representation— also because you don't necessarily just shove pixels into a transformer,right?
You might use a more advanced representation to sort of simplify things. Modeling is going to be sort of about the core mechanism behind diffusion models. I just like to explain that in an intuitive way, and I think that's kind of useful to understand why these models are able to work as well as they do for audio-visual data generation.
We'll talk a little bit about architecture as well, like the core neural network architecture that's behind all this. And then, very briefly, some things about training at scale. I'll talk a bit more about sampling as well, because diffusion models have sort of a very flexible
sampling regime. Like, there's sort of more stuff you can do with diffusion models than you can do with auto-regressive models, so I'll talk a little bit about that. I'll talk about distillation, which in the context of diffusion is not so much about making the model smaller, but more about reducing the number of steps that you need to get a good sample.
And then finally talk about control, like the various control signals that we want to use to actually make the models do our bidding and make them do what we want them to do. Alright. Before I start with that, I have a blog.
You don't have to remember all these individual URLs. Just go to sander.ai, you can find all my blog posts there. They're mostly about diffusion these days, but in general I like to talk about sort of the intuition behind how generative models actually work.
Cool. So let's talk a little bit about data first. I think it's really important to emphasize just how important data curation is in training these large-scale models. It's really, really essential for high-quality results. And like, for me, coming from a research background, it's actually something— like, when I was doing my PhD, it's not something that's incentivized.
Data2:55
Like, you're not incentivized to look at your data, because you're actually incentivized to use a predefined dataset that everyone else uses so that you can compare your results to the state of the art. And so that's sort of something that we are sort of collectively having to unlearn in this era, because you really just have to look at your data.
To the point where I think time spent on improving the data is sometimes a better investment of that time than actually sort of trying to tweak the model and trying to make the optimizer better or things like that.
I think this is still sort of an— even today it's still sort of an underrated aspect of training these models. But yeah, I'm not going to say too much more about that, because it's a topic that you won't find a lot of publications on, and it's also a topic that I won't be able to share a lot of details on, because obviously it's also part of the secret sauce of what makes the models good.
Latents4:02
So let's talk about representation next. So the sort of typical digital representation of audio-visual data— sorry, of visual data, I should say— is pixels,right? Grids of pixels. You get a 2D grid for images, you get a 3D pixel grid for video.
And you could actually just shove that into a diffusion model as-is, and that's what we did at the start, you know, when diffusion sort of started being a thing. That's what people were doing. We were sort of directly training on pixels, and it worked remarkably well.
But that's not actually what people do nowadays, because once you sort of start scaling up the size of the objects that you're modeling, like the resolution or the duration in the case of video, these pixel tensors in memory get very, very large.
Right? You have like— okay, let's say you have 1080p video,right? 30 seconds of 1080p video at 30 fps. We're talking many— like, several gigabytes of data,right, to store that in memory. That's one training example. So that's just not feasible.
So what we end up doing is we actually use compressed representations,right? But we're not just going to use sort of pre-existing compressed representations. You know, there's many sort of like video codecs out there, you know, the JPEG standard for images.
We tend not to use those representations, because those are really focused on making things small, and in the process they actually obscure the structure of the data to a degree that generative modeling becomes really hard. So what typically happens in this context is we actually learn our own compressor.
We— and we do that based on autoencoders. So this is like the top row on this slide. It's basically a neural network that consists of an encoder and a decoder. And the task of this neural network is just, like, reproduce your input,right?
You put an image in, you want the same image out, but you're sort of forcing it through a bottleneck in the middle, and that bottleneck is going to learn what's typically called a latent representation. So it's like a more compact representation of the data.
And that is then the representation that we're actually going to use as a basis for diffu— like, for training our diffusion models. So in the second stage, we take these latent representations, we extract them from our inputs. I usually use images as examples, because obviously that's easier to show on a slide, but you can imagine this is a video as well.
It's basically the exact same procedure. So we extract the latent representations, and then we train on top of that a generative model, which could actually be an auto-regressive model or a diffusion model. Sort of doesn't really matter, but people have found, in general, for audio-visual data, diffusion sort of has the edge in terms of being able to get good results with a certain parameter budget.
So that's what we mostly tend to use nowadays. And then once you've trained your generative model in latent space, of course, once— if you sample from that model, you're going to get a sample in latent space. So it's a compressed sample, so you still want to use the decoder that you trained before to bring that back to pixel space as well.
And so what does that actually look like in practice? So I have this sort of concrete example here, and this is actually— I think these dimensions sort of correspond to what the autoencoder in the original stable diffusion model does.
So stable diffusion is also a latent diffusion model. Let's say you have, like, an RGB image, 256 by 256 pixels. You represent that as a 3D tensor on the left, so these are the dimensions that you get. And then when we extract our latent representation with our encoder, so one thing that's worth noticing is it still has the same spatial structure, it still has the same topology, but the resolution is greatly reduced,right?
So now we have 32 by 32 latent grid, and we sort of compensate for that reduction by adding a few extra channels so that we can encode some of the information that would get lost if you were to just resize the image,right?
If you just take the original image and resize it to 32 by 32, you lose a lot of high-frequency detail, and these latent representations sort of try to hold onto that a little bit by adding— by using these extra channels to encode that information.
Of course, it's still lossy compression, because if you look at the total sort of tensor size of the latents versus the original image, it's still much, much smaller,right? And that's the key idea. That's the point. We want to make this smaller, and especially for video also, where you have this extra time dimension, you have even more redundancy,right?
You're often able to reduce the size of these tensors that you have to work with by two orders of magnitude. And that's the difference between, like, being able to fit your data in memory and just not being able to do anything at all,right?
But so one thing to note about these compression mechanisms is they're actually sort of slightly more primitive than sort of the, you know, like the H.265 or like the other sort of codecs that people tend to use these days.
And that's actually by design, because you kind of want to preserve a lot of the topological structure of the original pixel representation, because our neural network architectures that we use to build these models, they kind of rely on the structure being present,right?
They have these strong inductive biases. And so we end up with these latent representations that are still— that still have the same grid structure as the original pixels, but sort of at a more coarse-grained scale,right? And the image that I'm showing here is actually from a paper called EQVAE.
It's a paper about, like, improving the training of these autoencoders. And they did a really nice thing. They sort of tried to visualize the latent space by taking the principal components of the— across the latent channels, and then mapping that onto RGB so that you can actually visualize what these are.
And you can kind of see, looking at these latent visualizations, you can still tell what animal is in the image,right? So the latents are not really making abstraction of any semantic content of the image. They're basically just sort of abstracting the local texture and very fine-grained structure,right?
That's sort of the information that's sort of compressed and that's removed to some degree, and everything else is just preserved as in the original pixel space. And that's kind of by design. Alright. So once we have our latent representation, we can start doing some generative modeling.
I've already mentioned you could do that either with auto-regression or with diffusion. With auto-regression, you sort of have to turn everything into a sequence, and then you predict the sequence step by step. This is a very natural thing to do for language, which is already kind of sequence-structured.
Diffusion9:44
Slightly less natural to do for an image,right? Because an image is sort of a 2D pixel grid, so you have to sort of decide an arbitrary sequence order in which to generate the pixels. Diffusion is kind of a different approach to achieving a very similar thing, which is sort of this iterative refinement,right?
You generate something not in one go, but step by step. And diffusion does that in a slightly different way, which is by first defining a corruption process, sort of destroying information in the image or in the video by adding noise gradually, so adding more and more noise, and then you learn a denoiser model that tries to remove that noise.
And then you can use that denoiser, as we'll show, you can use that denoiser to generate images or videos step by step. So yeah, just to visualize what that looks like, so I have an example image here on the left.
If you gradually add more and more Gaussian noise to that image, one thing to note is that eventually, when you add a lot of noise, you can't see the image anymore,right? So it's sort of destroyed all the structure.
But sort of in the intermediate stages, you can see that if I add a little bit of noise, it's sort of removing the detail,right? Because, for example, you might not be able to make out the whiskers anymore of this bunny, but you can still see the silhouette, so you can still tell that it's a bunny,right?
So you're sort of losing fine-grained detail initially, but not the global structure. And only when you add more noise, that global structure also starts to fade. So that's the corruption process. And then I'm going to try and explain to you how we can use a denoiser that tries to reverse this process to do generative modeling,right?
So sort of an intuitive view of how diffusion models actually do this. So I like to do this with a 2D diagram. So images and video are actually high-dimensional objects,right? If you sort of flatten an image into a single vector, it's very high-dimensional.
I'm going to reduce that down to two dimensions so that I can actually plot it on a slide. It's a slightly risky thing to do, like generalizing from low dimensions to high dimensions, but in this case it's actually quite instructive.
So I'm going to try to explain how this backward process in diffusion actually works. So we start here with a clean image from our dataset, so that's what I'm going to call X0. Put that in the bottom left corner on the slide there.
And then I'm going to add some amount of noise to it. So I'm actually going to sort of simulate this corruption process and add some amount of noise to it, and then we end up in an arbitrary
step of this corruption process. I'm going to call that XT. T is like a time step that's indexing the corruption process. And so that's a noisy version of our image in the topright corner. So what's going to happen in diffusion sampling is we're going to start from noise,right?
But I'm just going to sort of zoom in on a particular step in the process where we've sort of already partially noised the image, so we might end up at something like XT. And then I'm going to tell you, like, how does the process continue from there.
So the first thing that our diffusion model is going to do, as I said, it's a denoiser,right? So it's going to try to predict a clean version of the image given the noisy version. It observes the noisy version, that's all it gets, and then we ask the model, where could this have come from,right?
What image could have given rise to this particular noisy observation? And that's actually an ill-post problem, because, as I just said, the noise actually removes information,right? So there's actually many different images that could have given rise to this particular noisy observation.
And so what ends up happening is the model just doesn't know which one to predict, and it has to make a single prediction, so it's just going to predict the average of all of them. And that's why you get a blurry prediction out of a diffusion model.
Like, if you just ask a diffusion model to do a one-step prediction, you're going to get a very blurry image that looks sort of like this. And the way to think about this is that it's not predicting a particular image per se, but rather it's sort of predicting a region of image space, the direction that we roughly want to go in.
And so that's what I'm trying to visualize here with these circles, is that there's sort of a region of images that all potentially could have given rise to this noisy observation, and that's sort of roughly the direction that we want to go in.
And so how does sampling work then? Well, we predict that direction, and then we take a small step in that direction. We don't make a big jump all the way to our predicted X0, because obviously then we would just end up with a blurry image.
That's not what we want. So we're only going to take a small step and then ask the model again, basically,right? You can compare this to how optimization of neural networks works,right? When you're doing optimization, of course that's happening in parameter space.
Here we're working in pixel space or in latent space. But when you're doing optimization in parameter space, you're doing something very similar. Like, the optimizer gives you an update direction. You don't want to take a step that's too large, because actually this update direction is only valid locally, and it's the exact same thing here.
One thing that's a bit different from a typical optimization algorithm is that after we've done this small denoising step, in many diffusion sampling algorithms you actually add a little bit of the noise back. And this is new noise.
This is not sort of like the noise that you just removed, but you just add a little bit of new noise. Obviously less than the amount that you just removed,right? Because otherwise you wouldn't make any progress. And the reason you do that is often to sort of avoid accumulation of errors along the process.
Because obviously this denoiser that we've trained is a neural network, so its predictions are not perfect. So it's going to make mistakes. And if you keep feeding the network its own mistakes back, you're going to go off the rails,right?
And so what it turns out that this is actually a useful trick to greatly reduce the risk of that. Like, you add a little bit of new noise, and it sort of obscures the mistakes that the denoiser is making.
Not all diffusion sampling algorithms use this trick, but many do. And then, yeah, as I said, the process just repeats. So we're now in a new iterate. We're in XT minus 1, which is basically a slightly less noisy version of the image, because we've partially denoised it.
And we're just going to ask our denoiser to make a new prediction. And that's going to be different this time,right? It's still trying to predict where we came from, but now it has a little bit more information, because there's less noise in the image.
So that corresponds to a new prediction, and that new prediction corresponds to a smaller region of input space,right? And so that region is just going to sort of continually shrink as we go along until it sort of collapses to a single point.
And at that point we've sampled an image from the distribution that we're trying to generate. Yeah, so this kind of continues, as I said, like sort of exactly the same procedure. Denoise, add a little bit of noise back, and so on and so on.
And that's how we sample from a diffusion model. So I want to now take a slightly different perspective to try and explain why doing this particular thing works so well for images and video. And for that, we're going to bring out Fourier analysis.
We're going to do frequency analysis of what's actually happening in a diffusion model. So I have here four images from the ImageNet dataset. And what I've done is I've taken their Fourier transforms. And a Fourier transform of an image is a 2D object,right?
An image is a 2D object, so you also get a 2D Fourier transform, and it's a complex valued thing. So I'm going to pull that apart into the magnitude and the phase. So the magnitude is the middle row, and then the phase is the bottom row.
The phase is kind of hard to work with. We're going to ignore that for now. We're just going to look at the magnitude spectrum. And then, to make this even more convenient, we're going to summarize the magnitude spectrum into a 1D plot.
And we're going to do that by radial averaging. So we're just going to sort of take these radial slices and sort of see what they are, and then just average them all together. And if you do that, and you plot that on a log-log plot, here's what you get for these images.
So what's very interesting about this, I think, is they look like straight lines,right? And this is a log-log plot. So if you're familiar with scaling laws in language models, this says power law,right? There is a power law relationship in the spectra.
And this is sort of a natural phenomenon with images and also with video. Like, if you take a photo, you calculate the spectrum, you'll typically get this power law relationship between the frequencies and then the corresponding power or energy of those frequencies.
So what does that mean for diffusion? Well, if you add noise to an image, here's what that looks like on the spectrum. So the spectrum of Gaussian noise is basically such that it contains all frequencies in equal measure, in expectation,right?
So it's sort of flat in the frequency domain. So you can see that here. Like, this is a spectrum of actual Gaussian noise, this blue line,right? So you get sort of this horizontal line. And then for an image, you're going to get this power law spectrum, so you get this downward sloping line.
Now, if I add both of them together, if I add the noise to the image, I can again calculate the spectrum, and what you get then is the green line. So you can kind of see that it's following the image spectrum up to the point where the noise starts to drown it out,right?
And then it just follows the noise spectrum. So what does that mean concretely for our corruption process? It means that the more noise you add, the more of the high-frequency components you're starting to obscure,right? So you add a little bit of noise, you only obscure the highest frequency components.
If you add a bit more noise, then you're actually obscuring more of the lower and lower frequency components, until eventually, if you add a lot of noise, you're obscuring all the frequency components in the signal, and they're completely indistinguishable.
And so that observation, I've sort of summarized that myself as diffusion is basically spectral autoregression,right? Because it's essentially allowing you to generate images from coarse to fine. You start with the low frequencies, and then you gradually add higher and higher frequencies, and that corresponds to coarse-grained features and fine-grained features.
Of course, yeah, it's an approximation,right? It's not the same as hard autoregression, but it is sort of, in principle, it's doing a very similar thing, just in a representation space that makes more sense for image generation, where you can sort of go coarse to fine, which typically means that you can sort of sketch out the semantics of your image before you add all the details, which is a very natural way to do image generation.
And it also means that when we train these models, we can actually put more weight on the frequencies, on the scales that matter more perceptually. And that's a very important aspect of this as well. Allright, so let me now talk a little bit about network architectures for these denoisers.
Architecture20:01
Like, the network itself is very simple,right? It's just doing denoising. You feed in a noisy image, and you ask it, like, what is the clean version of this image? And so people initially started using U-Nets for this. So U-Nets are convolutional neural networks that are sort of designed.
They were originally designed for things like image segmentation, but you can also use them for any sort of image restoration task or whatever, anything where the output dimension is the same as the input dimension, basically. And yeah, they worked really well for this particular use case as well.
So people sort of adopted them. Early stable diffusion models are U-Net based as well. But then people figured out, actually, can we use a transformer for this? And the answer is yes, of course you can.
You obviously don't use the sort of exact recipe that you would use for a large language model. You don't use a causal mask, for example, because you're not going to, you know, it's okay for attention to be fully bidirectional in this context, so it's actually slightly more expressive than a typical LLM transformer.
But yeah, it works just fine with transformers. And because we've learned so much about how to scale transformers from the LLM side, it just makes practical sense to also use this for diffusion models, because we can reuse a lot of that knowledge.
One more architectural aspect that I want to talk about in the context of video generation is sort of the tension between autoregression and diffusion. So you can train a fully autoregressive video model, but it would mean that you have to take this sort of height times width times time cube, and then flatten it out into a sequence,right?
And then generate it token by token. You can also treat this whole 3D volume of the video, this 3D pixel volume, as a thing that you just jointly noise and denoise, and that's what most modern video generation models do.
So they're sort of adding noise across the whole time dimension as well as the spatial dimensions. That works pretty well, but there's actually, it's not a dichotomy. Like, it's not a binary choice. There's actually an intermediate sort of setup where you do autoregression in time, so you generate frame by frame, but you use diffusion to generate each of the frames.
And that's actually a really nice sort of hybrid setup for many applications, especially when you want to do things like real-time video generation, for example. You kind of have to do autoregression in time,right? So like, Genie is a good example of sort of this compromise.
Training22:25
Cool. Allright, I'll talk very briefly about sort of what goes into actually training a model. Like, we scale these things up,right? More parameters is better. I would say they're probably not at the scale where large language models are today.
They tend to still be a little bit smaller. I'll also explain a little bit why that might be. But we still scale them to reasonable sizes, and so it's very important to figure out how to do parallelism and sharding across many chips.
So up to a certain scale, you can rely on data parallelism,right? You just split up your batch across many chips for training. But at some point, you just need to go into model parallelism as well, so you actually need to start sort of spreading your model across different chips.
We tend to use JAX to build these models. JAX has some really good tooling that sort of does that for you,right? So you can use JAX.pg to basically ask it
to shard the model in a way that's going to be ideally close to optimal. And it sort of automatically minimizes communication between the chips for you, so you don't have to do that manually. Cool. Yeah, I think that's all I'll say about that for now.
I'll move on to sampling, because I want to talk a little bit more about sort of this contrast between stochastic and deterministic sampling. So I already mentioned that some of these algorithms add a little bit of noise back after every step.
Sampling23:33
Other algorithms do not. This has different trade-offs. We'll talk about distillation a bit later. In that context, it's actually really useful to have a deterministic sampling algorithm, because you sort of have a one-to-one mapping between initial noise and samples from your data distribution.
But as I said, stochastic algorithms can be a bit more robust to accumulation of errors. So there's like interesting trade-offs there. The main thing I want to talk about in the context of sampling is this idea of guidance,right?
This is something that's commonly associated with diffusion models, but you can actually also do it for autoregressive models. It just seems to work exceptionally well for diffusion models specifically. So what guidance enables you to do is to trade off sample quality for diversity.
So if you crank up what's called the guidance scale, if you crank up this hyperparameter, diversity of your samples is going to greatly reduce. They're going to start looking more alike, but the quality is going to massively improve, to the point where these models are punching well above their weight.
And this is what I was saying earlier, why I think these diffusion models tend to still be a bit smaller than their sort of LLM counterpart, is that they have this very powerful trick that really allows them to punch above their weight.
I'll show you some examples in a bit. But first, I want to explain what guidance actually does. So I'm going to go back to this diagram that I had before, and I'm going to show you how guidance actually modifies the sampling procedure.
So we're going to start the exact same way. We're just going to try and predict where we came from. It's going to be a blurry prediction. But now we're going to make a second prediction as well, because we're going to have trained our model with a conditioning signal.
So this could be a text prompt, for example, and we can basically sample from the model by giving it a text prompt and also without a text prompt. So if this is a prediction without the text prompt, then I can make another prediction with the text prompt.
And typically, what's going to happen is that's going to be a slightly less blurry prediction, because obviously the number of images that this noisy observation could have come from is greatly restricted by what's described in the prompt,right? If the prompt says this is an image of a rabbit, and it gives you some details and stuff, then obviously you know a bit more about what the original image might have been.
So there's a difference between these two predictions, and it's precisely that difference that we're interested in. So we're going to call this delta, and we're going to basically amplify this. We're going to say, OK, if this is the delta between not having the prompt and having the prompt, what if we just scale this up?
And then we say this is our new direction that we're going to actually denoise in. It turns out this is super powerful. It seems almost childish. Like, it seems so simple, but actually there's sort of like a Bayesian reasoning type thing behind this that makes this work really well.
And then, yeah, so this is basically the only change that we make to the sampling algorithm. So everything else proceeds as normal. Again, we might add a little bit of noise back, and then we just take the steps as normal.
So you do need to do two model evaluations per step, but you get a huge increase in sort of sample quality from that. In fact, let me show you. So this is a comparison of some samples from a model without guidance and with guidance.
This is from a 2021 paper, so positively ancient in AI,right? Because things move pretty fast. But this is one of the last sort of papers where they trained diffusion models at scale, where they actually showed a difference between not using guidance and using guidance.
After this paper, everyone just always uses guidance. Like, nobody ever turns it off anymore, because it's so essential to getting good samples from these models. And the differences, you can see here, are sort of, you can see that reduction in diversity,right?
Like, from the left to theright, you can see the samples
on theright are actually much less diverse, but also individually, they're much higher quality with respect to the prompt. And so you get this trade-off. And if you only want one sample, why would you even care about diversity,right? So you can sort of use this, or you can even reintroduce diversity in different ways if you wanted to.
But yeah, basically, guidance is sort of a no-brainer these days. So everyone just always leaves it on. And I think a lot of people would be surprised at how bad today's models are if you take guidance away, like, just if you use them as they are.
Another example here from the same paper, so this is a glide paper from OpenAI, one of the first sort of pixel-space diffusion models at scale. Cool. Right, let me talk briefly about distillation. So sort of to speed up the sampling procedure, what we're going to try is we're not going to try and make the model smaller, which is usually what distillation refers to in the context of large language models.
Distillation28:03
But here, what we're actually going to try and do is reduce the number of steps that we require. So sampling from a diffusion model, you could say, is sort of tracing out this nonlinear path through input space,right? I've showed you a few steps before.
Now here I'm sort of trying to interpolate that path with this dashed red line. I'm sort of trying to show, like, this is the trajectory that we might follow through input space during sampling. And that's a nonlinear trajectory.
And what a diffusion model does, it sort of gives you, at each point on the trajectory, it gives you the direction that you should move in next,right? So it predicts a tangent to this path, basically. And then a question that arises is, OK, once we know what this path is, especially if we have like a deterministic sampling algorithm, there's like one path between a particular noise sample and a particular data point.
Once we know that path, why are we predicting the tangent to this path? Why can't we just predict where we're going to end up,right? Just like where we are, let's just try to predict where this path is going to end up when all the noise is gone, and then we can just sample in one step,right?
And this is exactly what consistency models do. So you can take a diffusion model and then distill it into a consistency model. And this is just one of the many ways that people have developed to reduce the number of steps that are required to sample from diffusion models.
Now, in practice, when you try to do this and try to sample in one step from a consistency model, it usually won't work that well. And it's mostly because you're asking the neural network to do in a single pass what it did before in like 50 passes or something like that,right?
So like, that's a tall order. So usually, that's not going to work super well out of the box. But so one trade-off that you can sort of make is you can basically say, I'm going to do consistency modeling, but only for like certain intervals of my sampling path, so that I can still sample in like maybe three steps, and maybe then I'm going to get better results.
This is just one of the many ways to achieve this, but I just wanted to kind of show this intuitively what this is actually doing. Allright, let's talk briefly about controls. This is the last thing I want to talk about.
Control30:01
So these models only are as useful as our ability to actually influence at sort of a semantically high level what they actually produce,right? And so the canonical way that we've been doing this with these models is to give them a text prompt.
You give them a text prompt, and then that describes what the image should look like, what the video should look like. That's great. That works pretty well. But more and more, we're starting to see that people want more than that,right?
They don't just want to try to, oh, lost my slide. They don't just want to try and, is this on my side, or is this? It's back.
Oh, it's back. Awesome, yeah. They don't just want to try and describe everything in great detail in language. You want to be able to do reference-based generation, for example. You want to be able to generate a video and put yourself in it,right?
And you're not going to do that by describing what you look like in intricate detail. You're going to do that by taking a photo or a short video of yourself and then conditioning the model on that. So we want these other types of conditioning signals as well.
In video generation specifically, we might want to sort of explicitly control camera motion, the speed of events happening, like the specific timing of events. That's not something that you should sort of try to shoehorn into a textual representation,right?
So you need sort of more advanced conditioning signals. And then a big question that arises is, when should we introduce these conditioning signals to the model? Because often, you don't have this kind of conditioning information for most of your pre-training data set.
So it can actually be quite useful to do that in post-training. Like, pretrain a model with just the text prompts, and then maybe add some of these extra conditioning signals in a post-training phase. And of course, other things we can do in post-training are like preference tuning based on human evaluations, like using reinforcement learning or direct preference optimization.
Allright, that was sort of a whirlwind overview of all eight of these things. I'm going to stop there so we have some time for questions. Allright, thank you very much for listening.
Q&A31:48
You're talking about how you increase guidance, which improves quality. Is that kind of why lots of these models have a certain style? Like, you can look at a narrower image and then it's more complex.
That's part of it. I mean, I think part of it is probably the post-training recipe that tends to sort of make these models a lot more opinionated. I like to think of post-training as sort of taking, like pre-training sort of models, the distribution of images, let's say.
And then post-training is more about, like, which sliver of that distribution am I actually interested in? And that's a very opinionated type of thing. So that's playing a big role in that. I think there's specific effects, though, that you can observe that are easily attributed to guidance.
Like, if you get images that look sort of very saturated, that's usually a sign that the guidance scale is too high,right? It's like, because the guidance scale is sort of amplifying this difference between the unconditional and the conditional prediction, but it's doing that at every noise level.
And so if you do that at, depending on which noise level you're sort of manipulating this direction at, you sort of get these different effects. So what people have often started doing is like varying the scale of the guidance across the sampling procedure.
Like, often there's a paper that says it's actually best to not do guidance at the very start and at the very end, but you should sort of ramp it up in the middle. And that tends to give you the best sort of trade-off.
But yeah, it's definitely playing a role, but I think probably a bigger role in that is played by the post-training, yeah.
How does the guidance for the conditional work for text?
Sorry, can you just repeat that question?
Yeah.
Thank you very much.
Hi. How would you do this guidance or like a conditional sampling for text diffusion, let's say?
You could use exactly the same procedure, provided that you have a sort of prompt that you're giving the model,right? You can treat that prompt as a conditioning signal, and then you could apply guidance to that. Now, how well that's going to work is sort of an open question.
Like, it clearly is applicable to this setting as well. But I think typically what we found is that guidance tends to work best when there is sort of a bit of a semantic gap between the thing that you're guiding with and the thing that you're generating.
And so that's why it works so exceptionally well with this sort of prompting setup. Like, if you guide on a text prompt, text prompt tends to capture sort of the high-level semantics of what's in an image. And that seems to be like a really good way to sort of steer the model in a sort of semantic space, so to speak.
But if you're guiding, like, you have the same problem in image generation. Like, if you do guidance on, like, let's say you provide a segmentation mask, and you want the model to fill in the different parts of the segmentation mask,right?
Actually, guidance will work a lot less well for that, because it's sort of a low-level conditioning signal that's sort of at the same level of abstraction as the pixels that you're trying to generate. It seems like guidance just works better when you have that gap.
I think that's also why people don't typically use it as much for language models, even though it's perfectly applicable to auto-aggressive models as well.
Thank you.
Over there.
I have a question back here.
Hi. You mentioned JAX is better suited for model sharding and parallelism. Is there any particular reason for that, especially compared to PyTorch?
OK, I have to caveat my answer with the fact that I've been at Google for over a decade. So PyTorch didn't exist when I joined Google,right? So I've never had a lot of hands-on experience with PyTorch. I think JAX is just kind of designed with that in mind from the get-go, because we've had TPUs for a while at Google, and it was really just, I think, conceived to try and make that as easy as possible,right?
To make using TPUs as easy as possible. And with TPUs, like, you very rarely use just one chip,right? You kind of want to take advantage of the fact that they have this really fast interconnect and sort of scale up pretty quickly.
So yeah, I think it was sort of designed with this in mind from the get-go. But PyTorch can do these things as well,right? It's not unique to JAX.
Thank you for your presentation. If you slow down the process of denoising and noising, do you get better images, or?
Slow down as in take more steps?
Yes, take more steps.
Up to a point, yeah. Because as I said, you're sort of approximating this nonlinear path through input space,right? And you're approximating that by taking finite steps. So that means you're actually approximating that with sort of a piecewise linear path through input space,right?
And so the more that piecewise linear path starts to deviate from your true nonlinear pathway, the worse your samples are going to get. But there is obviously a limit. And there's also been a lot of research on, like, how can we train diffusion models or models like this that actually produce straighter paths from the get-go so that you can actually get a more accurate approximation with fewer steps?
This is something called rectified flow or re-flow that sort of tries to dig into this. So yeah, so up to a point is the answer, yeah.
Thanks.
I was wondering if you could maybe talk a little bit more about how you could get these other types of control signals in for, like, a special camera movement. Is this something that you would do, like, with a simulator or something where you can actually control all the parameters?
Or like, how?
That's a very good question. Well, obviously, I can't comment on what we actually do. I can sort of speculate. That's actually, like, I don't actually know the details about this, because the team at this point is quite large.
And there's like people working specifically on what we call capabilities, like endowing the model with this ability to, for example, be conditioned on a camera control signal and things like that. I'm not actually actively involved in that part of the work.
But yeah, it's like, it's very, as I said, it's sort of like, it's quite important to have these conditioning signals that are sort of semantically abstract. So you kind of have to find theright representation that makes the most sense to condition a model on.
I think also what's very important is your sort of, if your model is a transformer, you actually have quite a few ways to insert conditioning information. Like, you could add a bunch of extra tokens. That's one way to do it.
Sometimes you might rather sort of broadcast the conditioning information to all the tokens. Like, for example, if the noise level input that we give to the diffusion model, like, to tell it how much noise there is in it, we're going to typically broadcast that to all the tokens.
We're not going to just add a single token for that.
And then there's, I think there's like a third way that people have started doing conditioning. But yeah, these are all things that you have to think about when you sort of try to figure out how to introduce a new conditioning signal, yeah.
I think we have time for maybe one more.
Thanks for the really, really nice talk.
Thank you.
Just to understand, in the denoising part, if you didn't add that error in each step, would it be fully deterministic?
Yes.
OK.
Yeah. So there's basically, once you have a denoiser, there's sort of two different types of generative models that you can construct. One of them is stochastic, and the other is fully deterministic,right? And it's kind of a magical feat.
Like, I still don't really believe that this works, but it really does. So you can kind of, yeah, you can have a deterministic model. And as I said, this can be useful in many applications, like, especially if you want to sort of go both ways.
Like, if you want to go from your data distribution to your noise distribution and back, it's really useful. And then also for many distillation techniques, it's a requirement for the teacher to be deterministic. So that's the case with these consistency models, for example.
You need a deterministic sampling algorithm to start from, yeah.
Thanks.
Cheers. Allright, thank you, everyone. I have a longer version of this talk on YouTube. Like, if you want a bit more detail for some of these sections, you can check that out as well. Cool. Thank you.





