R2IR (Resolution Invariant Image Resampler) and R2ID (Resolution Invariant Image Diffuser) are a novel pair of architectures for diffusion, designed to address key limitations in traditional models such as UNet and DiT. They treat images as continuous functions rather than fixed pixel grids, enabling robust generalization to arbitrary resolutions and aspect ratios without artifacts like doubling or squishing. The model learns an underlying data function, ignoring pixel density, through dual positional embeddings and Gaussian coordinate jitter. The architectures employ Linear Attention so that they're fast and practical to use even at massive resolutions beyond 1MP.
The code was developed and tested in PyCharm, Python 3.14, on a consumer RTX 5080. For MNIST, R2IR took 40m to train, and R2ID took 30m to train. Both models consumed under 6GiB during the training process, using a batch size of 100. R2IR has 1,884,161 parameters and R2ID has 10,385,920 parameters. Diffusion, even on massive latents such as 256x256 ( resulting in a 2048x2048 image for MNIST, but realistically will be 4096x4096 for proper size models) is fast, at about 4.2 iterations per second. Diffusing on small latents such as 10x10 (sufficient for MNIST), results in speeds such as 70 iterations per second. The models were trained without any image augmentation, yet successfully show to generalize to resolutions way beyond and similarly so to aspect ratios.
With this architecture, I hope that R2IR and R2ID prove to powerful, competent, yet lightweight and fast diffusion models: fast to train and fast to run.
In short, after cloning the GitHub repository, download MNIST_R2IR.safetensors, MNIST_R2ID.safetensors, MNIST_TEXT.safetensors into MNIST/models/