Researchers from the University of Science and Technology of China and Tencent Hunyuan Research have introduced TokenSet, a novel paradigm that shifts image representation for generative AI from fixed-position sequences to unordered sets of tokens. By decoupling tokens from specific spatial coordinates, this approach addresses fundamental inefficiencies in modern image generation frameworks.
The Problem: Grid-Based Limitations
Most current image generation models, such as VQ-VAE or TiTok, rely on a grid-based logic where images are divided into patches and assigned discrete codes at fixed locations. This traditional approach suffers from two primary drawbacks:
- Uniform Allocation: Models allocate the same coding capacity to simple regions (like a clear sky) as they do to complex, high-entropy areas (like a human face), leading to computational waste.
- Positional Bias: Because tokens are strictly tied to coordinates, models often rely on local spatial shortcuts rather than developing a global semantic understanding of the image.
While unordered sets offer more flexibility, they are difficult to model using standard generative tools like Transformers, which are inherently designed for ordered sequences.
The TokenSet Framework
To bridge the gap between unordered sets and structured generative modeling, the authors propose a three-part architecture: the Set Tokenizer, Dual Transformation, and Fixed-Sum Discrete Diffusion (FSDD).
Set Tokenizer and Dual Transformation
The Set Tokenizer utilizes a Vision Transformer (ViT) to encode images into a set of tokens. To prevent the model from relying on hidden positional cues, tokens are randomly shuffled during training. This forces the decoder to reconstruct the image based solely on the content of the set, effectively making the representation permutation-invariant.
The Dual Transformation makes these sets compatible with standard models by converting them into a count vector. For a codebook of size $K$, the model generates a sequence of $K$ integers, where each integer represents the frequency of a specific visual "word" within the image set.
Fixed-Sum Discrete Diffusion (FSDD)
The core generative engine is Fixed-Sum Discrete Diffusion. Standard diffusion models do not naturally respect the constraint that the total number of tokens in an image must remain constant (e.g., if an image is represented by 128 tokens, the sum of the count vector must always be 128). FSDD introduces a Greedy Adjustment strategy to maintain this fixed-sum constraint during the denoising process.
As shown in the figure above, when the sum of predicted tokens $\tilde{X}_t$ deviates from the fixed total $M$, the model sorts the errors (deltas) and greedily adjusts the counts to ensure the final output $X_t$ satisfies the sum constraint while remaining as close as possible to the predicted distribution.
Key Insights and Performance
TokenSet offers several advantages over traditional grid-based methods:
- Semantic-Aware Allocation: The model naturally learns to allocate more tokens to complex regions and fewer to simple backgrounds.
- Global Receptive Fields: Every token represents a global feature (e.g., "texture" or "object part") that the decoder can place anywhere, rather than being restricted to a local patch.
- Robustness: The representation is significantly more robust to local perturbations and noise because it does not rely on fragile coordinate-based indexing.
Experimental Results
Evaluated on the ImageNet 256×256 benchmark, TokenSet demonstrated state-of-the-art potential:
- Reconstruction: The tokenizer achieved a reconstruction Frechet Inception Distance (rFID) of 2.74, competitive with top-tier sequential models.
- Generation: The FSDD model reached a generation FID (gFID) of 5.56, outperforming standard discrete diffusion (6.23) and autoregressive models (6.55) of comparable scale.
Limitations and Future Directions
While promising, the approach currently faces challenges in scaling. The study focused on models up to 137M parameters; testing on multi-billion parameter foundation models is a necessary next step. Additionally, the count vector's length is tied to the codebook size, which could become a bottleneck if extremely large codebooks are used.
Looking forward, the authors suggest that these semantically coherent token sets could revolutionize content-based image retrieval, allowing images to be indexed by their unique "set signatures" rather than raw pixel data.
Summary updated