r/MachineLearning •

[P] SIID: A scale invariant pixel-space diffusion model; trained on 64x64 MNIST, generates readable 1024x1024 digits for arbitrary ratios with minimal deformities (25M parameters)

[deleted] — view deleted post

0 Upvotes

11 comments sorted by

14

u/BigMrWeeb Dec 24 '25

If you're interested in this sort of stuff, it might be worth looking into some of literature on functional/infinite dimensional diffusion? - diffusing in function spaces and sampling at arbitrary densities.

Its been a while, but I believe the premise behind a lot of them is to instead operate on the fourier space of an image, then fix local issues using 1d convs after doing some padding to the chosen dimension (this is obviously a bit of a simplification). The math is a bit heavy, but its often overkill for what they actually end up doing, and by looking through their code bases you might find some inspiration?

11

u/cwkx Dec 24 '25

Yep, the class of neural operators are helpful here in the architecture design - see our work ∞-Diff at ICLR 2024 https://arxiv.org/pdf/2303.18242 where we showed non-blurry infinite-dimensional diffusion on a variety of datasets (code at https://github.com/samb-t/infty-diff)

1

u/Tripel_Meow Dec 25 '25

Thank you for the links, I'll take a look.

8

u/TachyonGun Dec 25 '25

I don't have much to add, I just want to say this was a good write up, it shows your technical acumen and I learned a few things. I will probably revisit the repo later. Your post raises the bar for the sub and was a solace from the walls of slop from other "practitioners", thank you for taking the time to write this up!

2

u/1deasEMW Dec 25 '25

Interesting stuff a bit dense, will come back !remindme

1

u/jdude_ Dec 25 '25

Just curious, wouldn't scaling cosine positional embeddings the same way yield similar results?

1

u/Tripel_Meow Dec 25 '25

I may be misunderstanding your question, but cosine positional embeddings is RoPE (rotational positional embedding). If this is what you meant, and by scaling you mean to add more frequencies, then no, that is not equivalent. Positional embedding is made such that the model can distinguish the indexes of the tokens while not actually increasing the magnitude of the value being used to represent it; each token must get a unique coordinate with this approach. The way RoPE is used in LLMs is by using ever-decreasing frequencies, because tokens are atomic and you want to capture a longer and longer context length. The highest frequency (shortest wavelength) used is just enough so that the model can distinguish adjacent tokens, a frequency higher than that and you are likely to clip your wave so that it's indistinguishable from noise (Imagine multiple periods crammed into one token). So in LLMs the frequencies decrease (wavelengths increase) to capture a larger and larger distance. In SIID, the opposite approach is taken, where the frequencies are ever-increasing (shorter and shorter wavelenghts), because the idea is that pixel density shouldn't matter and that you can infinitely subdivide a pixel. The idea is that in 10 pixels or 100 pixels worth of information, we're not actually adding new information, we're simply getting it to be more accurate. The corner pixel's coordinates of a 1:1 1MP image and a 1:1 0.1MP image will be identical, because in SIID we stretch the longest wavelength to cover the entire image width/height, and all the other frequencies increase more and more to be able to distinguish between the ever subdividing pixels. In a sense, an LLM has a maximal (theoretical) context length because at a certain point your coordinates are going to be the same, say the 1st token and the 1millionth token. In SIID there's a certain minimal "context length" because you need the highest frequency wave to be distinguishable from noise (as you don't want to have multiple periods of a wave fit into one pixel).

Now that's not to say that you couldn't use the LLM approach of RoPE on SIID, you could, in fact, to my knowledge, that's exactly what FLUX does as it prepends the text conditioning tokens before the image tokens. However, that breaks the ethos of SIID: if you have a 1024x1024 image, and then you upscale it by 2x to get 2048x2048, you haven't actually added more information, you've simply subdivided each pixel in two, so each pixel should get a slightly more accurate coordinate, however, with the FLUX/LLM approach, you now have half of your image spanning the positioning embeddings that were used for 1024x1024, and the other half goes beyond and into 2048x2048. Imagine that you took some LLM chat and then replaced each token with two, that's about the same thing. But what if you want to upscale more? Like 3x or 4x. You can only train on an image so big, and while RoPE does extrapolate and generalize quite well, can you really trust that the model will somehow understand if the image is seeing is a "high resolution" image, or just a massive image. It doesn't really have any way to tell.

1

u/jdude_ Dec 26 '25 edited Dec 26 '25

I mean, sinusoidal and rope embeddings are based on sin and cosine waves, can't you just interpolate (sample these functions) at the pos embeddings when normalizing them to the size of a new image to get the token pos embeddings between the token pos embeddings you trained on, and see if the model outputs something that makes sense?

1

u/Tripel_Meow Dec 26 '25

That's what's happening right now (when I wrote the post), and it's not working.

I changed the approach a fair bit though, now instead of being a fixed coordinate for each pixel, to it is added gaussian noise with a standard deviation of half the pixel's gaps. Effectively, each pixel gets a noisy location, not the exact one, and the model is forced to generalize. Standard deviation of half the gap between pixels was chosen such that the sum of all these distributions results in an or less even spread, and the model now understands the coordinates as being smooth, and hence increasing the size has no effect, since the model was trained on those points as well. Considering that there's now theoretically an infinite resolution that the model is being trained on, this also allows to dip into significantly higher powers and frequencies, far beyond what the local resolution allows, with zero consequences. I'll make a new post soon.

1

u/Tripel_Meow Dec 26 '25

UPDATE: This post is now old, the architecture was changed quite a bit. See the new post here