Loading video...

Video Failed to Load

Go Home

Do diffusion models want Perlin-like noise? SDXL-turbo spends the first blocks simply creating Perlin-like noise of different frequencies, amplitudes and orientations. The model ignores the prompt conditioning during these layers.

59,764 views • 1 year ago •via X (Twitter)

12 Comments

Rudy Gilman's profile picture
Rudy Gilman1 year ago

You can ablate the conditioning prompt info during those layers. The model doesn't care. It's busy building a noise latticework. This infrastructure it's creating here is completely independent of the prompt.

Rudy Gilman's profile picture
Rudy Gilman1 year ago

Ken Perlin made his eponymous noise explicitly so that it would look natural when used for procedural generation of textures and terrains—it's cool that models have learned something similar! Here's link to SDXL-turbo. Will open to a layer showing the Perlin-like noise:

Rainmaker's profile picture
Rainmaker2 years ago

Can Machine Learning beat the market? Check out this post on my free Substack where I share code and commentary for an XGBoost model and a Random Forest model that both deliver powerful performances.

Ethan is in SF's profile picture
Ethan is in SF1 year ago

Have a section here back in the days of guided diffusion where you could init with perlin noise instead of Gaussian and skip the first whole 10-20% of steps!

Rudy Gilman's profile picture
Rudy Gilman1 year ago

oh nice! that was exactly my thinking, you're way ahead!

Diego Porres's profile picture
Diego Porres1 year ago

StableDiffusion yearns for Perlin

Rudy Gilman's profile picture
Rudy Gilman1 year ago

excellent! this was exactly the hope of reply I was hoping to get.

Peter Baylies's profile picture
Peter Baylies1 year ago

👍 I wasn't the first, and I'm sure I won't be the last; but yeah, I think a little perlin noise can often help.

FeepingCreature's profile picture
FeepingCreature1 year ago

If you inject randomized perlin noise at these layers, does the output break? That is, does it want that specific noise or just any noise? Or is it doing octave shifting on the input noisemap?

Rudy Gilman's profile picture
Rudy Gilman1 year ago

Great question. The noise maintains scale, orientation and stretch across seeds. Watch what happens when cycle through seeds below. Also note that when change the prompt nothing happens.

Sasha's profile picture
Sasha1 year ago

it seems to be similar to DiT study shows that conditioning mostly affects on mid blocks

Rudy Gilman's profile picture
Rudy Gilman1 year ago

Nice. Yes I would imagine that's what the research should show. I think often the models just aren't ready yet to bring in the semantic payload.

Related Videos

SORA by Hand ✍️ OpenAI’s #SORA took over the Internet when it was announced earlier this year. The technology behind Sora is the Diffusion Transformer (DiT) developed by William Peebles and Shining Xie. How does DiT work? 𝗚𝗼𝗮𝗹: Generate a video conditioned by a text prompt and a series of diffusion steps [1] Given ↳ Video ↳ Prompt: "sora is sky" ↳ Diffusion step: t = 3 [2] Video → Patches ↳ Divide all pixels in all frames into 4 spacetime patches [3] Visual Encoder: Pixels 🟨 → Latent 🟩 ↳ Multiply the patches with weights and biases, followed by ReLU ↳ The result is a latent feature vector per patch ↳ The purpose is dimension reduction from 4 (2x2x1) to 2 (2x1). ↳ In the paper, the reduction is 196,608 (256x256x3)→ 4096 (32x32x4) [4] ⬛ Add Noise ↳ Sample a noise according to the diffusion time step t. Typically, the larger the t, the smaller the noise. ↳ Add the Sampled Noise to latent features to obtain Noised Latent. ↳ The goal is to purposely add noise to a video and ask the model to guess what that noise is. ↳ This is analogous to training a language model by purposely deleting a word in a sentence and ask the model to guess what the deleted word was. [5-7] 🟪 Conditioning by Adaptive Layer Norm [5] Encode Conditions ↳ Encode "sora is sky" into a text embedding vector [0,1,-1]. ↳ Encode t = 3 to as a binary vector [1,1]. ↳ Concatenate the two vectors in to a 5D column vector. [6] Estimate Scale/Shift ↳ Multiply the combined vector with weights and biases ↳ The goal is to estimate the scale [2,-1] and shift [-1,5]. ↳ Copy the result to (X) and (+) [7] Apply Scale/Sift ↳ Scale the noised latent by [2,-1] ↳ Shifted the scaled noised latent by [-1, 5] ↳ The result is "conditioned" noise latent. [8-10] Transformer [8] Self-Attention ↳ Feed the conditioned noised latent to Query-Key function to obtain a self-attention matrix ↳ Value is omitted for simplicity [9] Attention Pooling ↳ Multiply the conditioned noised latent with the self-attention matrix ↳ The result are attention weighted features [10] Pointwise Feed Forward Network ↳ Multiply the attention weighted features with weights and biases ↳ The result is the Predicted Noise 🏋️‍♂️ 𝗧𝗿𝗮𝗶𝗻 [11] ↳ Calculate MSE loss gradients by taking the different between the Predicted Noise and the Sampled Noise (ground truth). ↳ Use the loss gradients to kick off backpropagation to update all learnable parameters (red borders) ↳ Note the visual encoder and decoder's parameters are frozen (blue borders) 🎨 𝗚𝗲𝗻𝗲𝗿𝗮𝘁𝗲 (𝗦𝗮𝗺𝗽𝗹𝗲) [12] Denoise ↳ Subtract the predicted noise from the noised latent to obtain the noise-free latent [13] Visual Decoder: Latent 🟩 → Pixels 🟨 ↳ Multiply the patches with weights and biases, followed by ReLU [14] Patches → Video ↳ Rearrange patches into a sequence of video frames.

Tom Yeh

238,166 views • 2 years ago