TL;DR
Discrete image generators benefit from massive token vocabularies, but training them with standard cross-entropy loss suffers from severe data sparsity and brittle one-hot targets. This paper introduces Stochastic Neighbor Cross Entropy (SNCE), a geometry-aware training objective that replaces one-hot targets with soft distributions over neighboring tokens. SNCE significantly accelerates convergence and improves generation quality across text-to-image synthesis and image editing tasks.
What Problem Does This Paper Address?
Discrete image generation models (such as autoregressive or discrete diffusion models) work by quantizing continuous image features into discrete tokens using a Vector Quantization (VQ) codebook. Recent advancements show that larger codebooks drastically improve image reconstruction quality. However, scaling the codebook size introduces the codebook sparsity problem: as the vocabulary grows, individual tokens appear much less frequently during training, leading to highly diluted supervision signals.
Compounding this issue, standard cross-entropy loss uses "one-hot" targets. It treats the second-closest (and visually almost identical) token in the embedding space as completely wrong—exactly the same as a totally random, unrelated token. This makes the supervision signal brittle and diffuse, severely slowing down training and requiring massive models and datasets to converge.
Methods
The authors propose Stochastic Neighbor Cross Entropy Minimization (SNCE). Instead of forcing the model to predict a single hard one-hot target, SNCE constructs a soft categorical distribution over a set of neighboring tokens in the VQ embedding space. The probability assigned to each token is proportional to its geometric proximity (e.g., via negative dot product or $L_2$ distance) to the ground-truth continuous image embedding.
Inspired by t-SNE, SNCE adapts the neighborhood formulation for generative modeling by:
- Using a fixed temperature parameter ($\tau$) instead of a per-sample binary search for bandwidth, ensuring computational efficiency during training.
- Allowing a token to be its own neighbor, which is crucial since continuous latents can exactly match codebook entries.
SNCE acts as a seamless, drop-in replacement for standard cross-entropy loss in both autoregressive and discrete diffusion architectures.
Datasets
The authors validated their approach using several configurations:
- Training Datasets:
- Class-conditional generation on ImageNet-256.
- Large-scale text-to-image (T2I) training using a 50M image dataset combining LAION-2B, COYO-700M, BLIP3o-60k, and ShareGPT4o-Image.
- Image editing adaptation using 2M samples from ShareGPT4o-Image, GPT-Edit-1.5M, and UniWorld-V1.
- Evaluation Benchmarks:
- GenEval (high-level text-to-image alignment).
- DPG Benchmark (fine-grained alignment via dense captions).
- MJHQ-30k (image fidelity via FID).
- HPSv3 (human preference alignment).
- ImgEdit benchmark (evaluated via a GPT-4o judge).
Key Insights and Ideas
- Embedding Geometry Matters: Treating discrete tokens as independent categorical labels discards the rich semantic structure of the VQ space. Proximity in embedding space correlates strongly with visual similarity.
- Smoothing Mitigates Sparsity: By distributing positive learning signals to a neighborhood of tokens rather than a single target, SNCE effectively smooths out the sparse supervision problem inherent in large vocabularies.
- Multiple Theoretical Perspectives: SNCE can be elegantly interpreted in three ways:
- As a Categorical VAE with stochastic quantization, lowering variance compared to explicit Monte Carlo sampling.
- As Knowledge Distillation where the tokenizer acts as a weak teacher imparting a continuity inductive bias.
- As On-Policy Learning with continuous rewards based on embedding distance.
Key Results
- ImageNet-256: For an Emu3.5 tokenizer with 131,072 codes, SNCE achieved an FID of 3.62 at 100 epochs compared to 7.53 for standard cross-entropy—effectively doubling the convergence speed.
- Text-to-Image Synthesis: When scaling to a 10B parameter model, SNCE improved the GenEval score from 0.74 (with CE) to 0.78, and dramatically improved the MJHQ-30k FID from 10.10 down to 6.43. It also boosted the fine-grained text alignment on the DPG benchmark (83.3 vs 82.4).
- Image Editing: On the ImgEdit benchmark, SNCE achieved an overall score of 3.89, outperforming the CE baseline (3.76) and better preserving fine-grained details from the input image.
Limitations and Future Work
- Not Quite Pixel-Perfect: Despite clear improvements in text alignment and visual quality, generated images can still exhibit minor artifacts and are not entirely pixel-perfect.
- Inherited Biases: The model inherits downstream limitations from its base architecture (LaViDa-O), such as potential hallucinations and inherent social biases present in large-scale web datasets.
- Future Directions: The authors suggest that future work could explore optimizing the temperature hyperparameter dynamically or applying SNCE to other tokenized modalities like audio or video.
Summary updated