Spherical Leech Quantization for Visual Tokenization and Generation

Yue Zhao, Hanwen Jiang, Zhenlin Xu, Chutong Yang, Ehsan Adeli, Philipp Kraehenbuehl

TL;DR

This paper introduces Spherical Leech Quantization ($\Lambda_{24}$-SQ), a novel non-parametric quantization method that scales visual codebooks to over 196,000 tokens. By leveraging the highly symmetric geometry of the 24-dimensional Leech lattice, $\Lambda_{24}$-SQ eliminates the need for complex entropy regularization during autoencoder training, achieving state-of-the-art results in image reconstruction, compression, and autoregressive generation.

What Problem Does This Paper Address?

In modern AI, discrete tokenization has revolutionized both language and vision modeling. However, a stark paradox exists: while visual data is arguably far richer and more diverse than text, the vocabulary sizes of visual tokenizers (typically 1,024 to 16,384) lag far behind Large Language Models (which often exceed 100,000 tokens).

Scaling up standard Vector Quantization (VQ) codebooks is notoriously difficult due to "codebook collapse," where only a fraction of the available tokens are actually used. While recent non-parametric quantization (NPQ) methods like Binary Spherical Quantization (BSQ) offer a workaround by using fixed codebooks, they still rely on ad-hoc entropy regularization penalties to force the model to distribute its codes evenly. The authors address this lack of a principled design by viewing quantization through the mathematical lens of lattice coding.

Figure 1. Upper left: A Venn Diagram that contains all definitions and quantization methods covered in this paper. We provide a unified formulation of various non-parametric quantization methods [56, 86, 91] from a lattice-coding perspective in Section 3.1. The geometric interpretation of the entropy penalties in Section 3.2 then leads to a family of densest hypersphere packing lattices (Section 3.3). Based on the spherical Leech lattice, a 24-d case of the densest hypersphere packing lattices, we instantiate Spherical Leech Quantization (!24-SQ) in Section 3.4 and apply it to modern discrete auto-encoders (middle) and visual autoregressive models (right). Lower left: An illustrative 2D comparison between BSQ and spherical densest-packing lattice quantization (A2). Middle: An auto-encoder with !24-SQ outperforms BSQ in image reconstruction and compression (Qualitative results on the top). Right: Qualitative and quantitative results of a visual autoregressive generation model with !24-SQ on ImageNet-1k. For the first time, we train a discrete visual autoregressive generation model with a codebook of 196, 560 without bells and whistles and achieve an oracle-like performance.

Methods

The authors first unify existing NPQ methods under a single lattice-based framework. They demonstrate that the commonly used entropy regularization terms are essentially trying to solve a geometric problem: maximizing the volume of the Voronoi cells (the regions mapped to each codebook vector) to ensure perfect class balance.

Instead of forcing an uneven codebook to behave via loss functions, the authors propose using an inherently optimal geometric structure: the Leech lattice ($\Lambda_{24}$), which provides the densest known sphere packing in 24 dimensions.

By taking the 196,560 vectors in the first shell of the Leech lattice and projecting them onto a unit hypersphere, they create a fixed, highly symmetric codebook ($\Lambda_{24}$-SQ). Because these vectors are perfectly and evenly distributed by nature, the autoencoder can be trained using only a standard trio of losses (MAE, GAN, and perceptual loss) without any commitment or entropy penalties.

To handle this massive vocabulary in downstream autoregressive (AR) generation models, the authors introduce:

  • Cut Cross Entropy (CCE) and Kahan summation to optimize memory and maintain numerical stability.
  • Z-loss regularization to prevent final output logits from exploding due to severe codebook usage imbalance during the AR stage.
  • Distributed Orthonormalized Updates (Dion optimizer) for smoother training dynamics.

Datasets

The proposed framework was trained and evaluated on several standard benchmarks:

  • ImageNet-1k: Used for training the image tokenizer and the visual autoregressive generation models, as well as evaluating reconstruction and generation metrics.
  • COCO 2017: Used to evaluate the generalization capability of the image reconstruction model.
  • Kodak Lossless True Color Image Suite: A benchmark consisting of 24 high-quality images used to evaluate image compression performance (measured in bits per pixel vs. PSNR/MS-SSIM).

Key Insights and Ideas

  • Geometry Over Regularization: The core "aha moment" is that codebook collapse and imbalance are geometric flaws. By switching from hypercubes (like BSQ) to the densest possible hypersphere packing ($\Lambda_{24}$), the mathematical properties of the lattice completely replace the need for complex optimization tricks during tokenization.
  • Vocabulary Size Matters for Vision: Echoing a well-known law in LLMs, larger visual models perform significantly better when paired with larger vocabularies. Scaling the codebook to ~200k tokens pushes the precision-recall frontier of autoregressive image generation remarkably close to the validation oracle.

Key Results

Image Reconstruction & Compression

When evaluated on ImageNet-1k and COCO, a ViT autoencoder equipped with $\Lambda_{24}$-SQ outperformed the best prior art (BSQ) across all metrics. Specifically, it reduced the reconstruction FID (rFID) from 1.14 to 0.83 while using a slightly lower effective bitrate. On the Kodak dataset, it achieved superior PSNR and MS-SSIM scores compared to traditional codecs like JPEG2000 and WebP.

Qualitative comparison showing sharper text reconstruction with $\Lambda_{24}$-SQ

Autoregressive Generation

For the first time, the authors successfully trained a discrete visual autoregressive model with a ~200k codebook without complex index subgrouping. On ImageNet-1k generation, their 2.8B parameter model achieved a generation FID (gFID) of 1.82, nearly matching the validation oracle performance of 1.78.

Quantitative metrics showing $\Lambda_{24}$-SQ outperforming BSQ across the board

Limitations and Future Work

While $\Lambda_{24}$-SQ simplifies autoencoder training, it shifts the challenge of codebook imbalance to the autoregressive generation stage. Because the data distribution itself is highly skewed, the model uses some Leech lattice tokens far more frequently than others, requiring specialized optimization techniques (like Z-loss and Dion) to prevent training instability.

Additionally, the current implementation is focused on class-conditioned image generation on ImageNet. The authors note that exploring its effectiveness in larger-scale, text-conditioned visual generation remains an exciting direction for future work.

Summary updated

BibTeX
@inproceedings{zhao2026spherical,
  author = {Yue Zhao and Hanwen Jiang and Zhenlin Xu and Chutong Yang and Ehsan Adeli and Philipp Kraehenbuehl},
  title = {{Spherical Leech Quantization for Visual Tokenization and Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=MJeyMzPLCF},
}
Figure