Visual token counts can scale with square root of image area in diffusion transformers
ScaleTok: How Should Latent Token Budgets Scale for Diffusion Transformers?
Computer Vision and Pattern Recognition
Summary
Processing images for AI models that create pictures can get very expensive as image size grows, because the computing cost rises quickly with more tiny pieces (tokens) an image is split into. The authors introduce ScaleTok, a method that controls how many tokens are used so it doesn't grow too fast with bigger images. They found that using about the square root number of tokens relative to image size keeps quality high while cutting down the computing work significantly. This means AI models can handle bigger or differently shaped images more efficiently.
What this means in practice
- •For computer vision engineers: Optimize generative image models to process larger and varied image sizes while reducing computational costs by applying ScaleTok's square-root token scaling.
- •For cloud ai service providers: Reduce operational costs for image generation services by adopting token budget scaling that halves the token count without sacrificing output quality.$Commercial implications: Enables more efficient deployment of costly AI image generation at scale, lowering cloud compute expenses and improving service margins.
Authors
Yusuf Dalva, Arpit Bansal, Ashwini Pokle, Peyman Milanfar, Mauricio Delbracio
Abstract
Training generative vision models natively across multiple resolutions and aspect ratios is costly with standard patch-based tokenizers. The visual token count grows linearly with image area, while the cost of computing self-attention scores in a diffusion transformer (DiT) grows quadratically with token count. We introduce ScaleTok, a continuous visual tokenizer that decouples latent sequence length from the patch grid. Its Continuous Aspect-Aware Positional Embeddings (CAPE) crop a shared coordinate grid to each aspect ratio before interpolation, enabling us to compare fixed, square-root, and linear allocation while training a single tokenizer per configuration jointly across four ImageNet-1K geometries. To distinguish the capacity available inside the tokenizer from the visual budget passed to the generator, we vary the number of padded text positions while holding the class name and visual budget fixed. With a ViT-B/16 backbone, these additional positions improve reconstruction FID under fixed and square-root allocation at larger image sizes but worsen it under linear allocation, suggesting a register-like role when the visual budget is constrained. We show that the visual budget can grow with the square root of image area while retaining both reconstruction fidelity and generation quality. At 512x512 with 256 text-token positions, square-root allocation approaches linear reconstruction fidelity with half as many visual tokens and yields comparable generation FID at roughly half the estimated DiT-XL cost per denoising step.