Variable-Length Tokenization via Learnable Global Merging for Diffusion Transformers
This paper introduces a novel variable-length tokenizer for Diffusion Transformers that achieves superior quality-compute trade-offs by employing learnable global merging to enable data-independent, cross-length representation alignment, overcoming the semantic misalignment issues inherent in traditional truncation-based methods.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to send a high-definition movie to a friend. If you send the whole thing uncompressed, it takes forever to download and uses a massive amount of data. If you compress it too much, the picture becomes blurry and pixelated.
For a long time, AI image generators (like the ones that create pictures from text) faced this exact problem. They use a "tokenizer"—a translator that breaks an image down into small chunks called tokens.
- High compression (few tokens) = Fast and cheap, but the image looks bad.
- Low compression (many tokens) = Great quality, but slow and expensive.
Previously, if you wanted a different balance between speed and quality, you had to train a completely different AI model for each setting. It was like needing a different car engine just to drive 10 mph slower.
The Problem with "Cutting"
Some researchers tried to fix this by creating "variable-length" tokenizers. Their idea was simple: "Let's just cut off the end of the token list if we want to save space."
Think of this like a book where the most important plot points are on page 1, and the tiny details are on page 100. If you want a shorter version, you just tear off the last 50 pages.
- The Catch: This changes the story. The "short" version focuses only on the big picture, while the "long" version includes the tiny details. Because the content is so different, the AI gets confused. It's like trying to teach a student to read a short story and a long novel using the same textbook, but the chapters are completely different. The AI struggles to learn both at once, leading to blurry or weird images.
The Solution: "Merging" Instead of Cutting
The authors of this paper propose a smarter way: Merging instead of cutting.
Imagine you have a group of 100 people (tokens) standing in a line.
- The Old Way (Cutting): If you need fewer people, you just tell the last 50 to go home. The remaining 50 are still standing in the exact same spots.
- The New Way (Merging): If you need fewer people, you ask similar-looking people to huddle together and form a single "super-person." If two people are wearing the same red shirt, they merge into one representative of that group.
Why is this better?
- Consistency: Whether you have 100 people or 10 "super-people," the groups represent the same underlying structure. The "red shirt group" is still there, just condensed. This keeps the "story" consistent for the AI, no matter how many tokens you use.
- Alignment: Because the groups are formed based on similarity (not just position), the AI can learn one single model that works perfectly for both short and long lists.
The Secret Sauce: "Learnable Global Merging"
There was one big hurdle. Usually, to decide who merges with whom, you look at the specific image (e.g., "These two pixels look like a cat's ear, so merge them"). But when an AI is creating a new image from scratch, it doesn't have the image yet! It can't look at the image to decide how to merge.
The authors solved this with Learnable Global Merging.
Think of this as a pre-set rulebook or a "master plan" that the AI learns during training. Instead of looking at the image to decide who merges, the AI uses a fixed, learned pattern (like a universal instruction manual) that says, "Token 1 always merges with Token 2, Token 3 merges with Token 4," regardless of what the final image looks like.
Even though this rulebook is fixed (it doesn't change based on the image), the AI trains it so well that it naturally groups similar things together. This allows the AI to know exactly how to handle the "merged" tokens even before it generates the picture.
The Results
The researchers tested this on ImageNet (a huge database of images). They found that:
- Their method allows a single AI model to generate images at different speeds and qualities without needing to be retrained for each setting.
- The images look better and the math works out more efficiently than previous methods that just "cut" the tokens.
- They even added a tiny "fine-tuning" step (using a technique called LoRA) that makes the AI even better at specific token counts with almost no extra cost.
In short: They figured out how to make AI image generators flexible. Instead of forcing the AI to choose between a "fast" model and a "good" model, they built a single, smart translator that can shrink or expand the image data by intelligently grouping similar parts together, keeping the quality high and the cost low.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.