The evolution of generative vision models has largely been constrained by a rigid architectural assumption: images are fixed-size grids. Most state-of-the-art diffusion models, including the Diffusion Transformer (DiT), are "resolution-locked," typically trained on square crops (e.g., 256x256). This constraint introduces significant cropping bias—where peripheral information is lost—and results in poor generalization when the model is tasked with generating non-square aspect ratios or higher resolutions.
FiT (Flexible Vision Transformer) proposes a paradigm shift, reimagining image generation by treating images as dynamic sequences of tokens rather than static grids. By combining a flexible training pipeline with 2D Rotary Positional Embeddings (RoPE), FiT enables high-quality image synthesis at any resolution or aspect ratio, significantly outperforming traditional models on non-square and out-of-distribution tasks.
Overcoming the Resolution Lock
Traditional models suffer from two primary issues due to their fixed-grid nature:
- Cropping Bias: Training on center-cropped images forces the model to learn an artificial framing, losing the natural context of the original scene.
- Poor Generalization: Absolute positional embeddings cannot effectively map coordinates outside the specific range seen during training. When asked to generate a panoramic or portrait image, these models often produce repetitive artifacts or structural failures because they lack a concept of relative distance beyond their fixed training grid.
FiT addresses these by adopting the philosophy that "nature is infinitely resolution-free," suggesting that generative models should be equally unconstrained.
Architectural Innovations
To achieve true resolution independence, FiT introduces three core technical components:
1. Flexible Training Pipeline
Instead of forcing every image into a square crop, FiT treats images as sequences of variable-length tokens. During training, images are resized to fit within a maximum token limit ($L_{max} = 256$ in base experiments) while preserving their original aspect ratio. Shorter sequences are padded, and Masked Multi-Head Self-Attention (MHSA) is employed to ensure the model ignores padding tokens, allowing it to learn from diverse geometries simultaneously.
2. 2D Rotary Positional Embedding (RoPE)
FiT replaces the standard absolute positional embeddings used in DiT with a 2D adaptation of RoPE. By encoding relative positional information into hidden states, the model becomes sensitive to the distance between tokens rather than their absolute grid coordinates. By calculating RoPE for height and width separately and then concatenating them, the model learns to handle aspect ratio changes independently, allowing it to generalize to unseen resolutions far more effectively.
3. Training-Free Extrapolation (VisionNTK & VisionYaRN)
Drawing inspiration from Large Language Model (LLM) research, the authors adapted "Neural Tangent Kernel" (NTK) and "YaRN" techniques for the vision domain. These methods allow FiT to adjust its positional frequencies at inference time. Consequently, the model can generate images at resolutions significantly higher than those encountered during training without requiring any additional fine-tuning.
4. Architectural Refinements
The authors replaced the standard Multilayer Perceptron (MLP) with SwiGLU (Swish-Gated Linear Units). This modification, which has become a standard in high-performance LLMs like LLaMA, enhances training stability and overall performance in the diffusion context.
Performance and Results
The FiT-XL/2 model was trained on ImageNet-256 for 1.8 million steps and evaluated against the baseline DiT across various in-distribution and out-of-distribution (OOD) resolutions.
- Aspect Ratio Generalization: In tests with a 1:3 aspect ratio (128x384), FiT achieved an FID of 16.81, a massive improvement over DiT’s 107.2.
- Out-of-Distribution Excellence: For resolutions larger than the training limit (e.g., 320x320), FiT maintained high quality with an FID of 5.42, significantly outperforming DiT’s 9.98.
- Training Efficiency: Despite being trained for significantly fewer steps than DiT (1.8M vs. 7M), FiT outperformed the baseline on nearly every metric, trailing only slightly on the exact 256x256 resolution it was trained on—a gap likely to close with further training.
Conclusion and Future Outlook
FiT demonstrates that the challenges of "context window extension" in text are mathematically analogous to "resolution extrapolation" in images. By treating images as sequences and utilizing relative positional metadata, FiT breaks the "resolution lock" of previous diffusion models.
While the current work focuses on ImageNet, the implications for scaling are significant. Future research may explore applying this architecture to massive, uncurated web-scale datasets and pushing the boundaries of training-based extrapolation to further increase the upper limits of generated resolution.
Summary updated