Switchable Token-Specific Codebook Quantization For Face Image Compression

Yongbo Wang, Haonan Wang, Guodong Mu, Ruixin Zhang, Chen Jiaqi, Jingyun Zhang, Jun Wang, Yuan Xie, zhizhong zhang, Shouhong Ding

Introduction

Modern image compression frameworks increasingly rely on Vector Quantization (VQ), where images are decomposed into discrete tokens mapped to indices in a shared codebook. While effective for general-purpose compression, standard VQ methods—such as VQ-VAE or TiTok—utilize a single "one-size-fits-all" global codebook. This approach is mathematically suboptimal for specialized domains like facial imagery for two primary reasons: attribute blindness and spatial uniformity.

Human faces exhibit vast diversity in age, gender, and ethnicity, requiring a massive global codebook to represent all variations accurately. Furthermore, facial features are spatially structured; a token representing an eye has a fundamentally different feature distribution than one representing the background. Forcing these distinct features to share the same quantization space leads to inefficiencies. When bitrates are lowered, traditional VQ methods often suffer from a significant drop in reconstruction quality and, more critically, the performance of downstream machine tasks like face recognition. This paper introduces Switchable Token-Specific Codebook Quantization (STSCQ), a hierarchical system designed to achieve state-of-the-art recognition accuracy at extremely low bitrates.

Methodology

STSCQ replaces the static global codebook with a "divide and conquer" strategy operating at two distinct levels: the image level and the token level.

Image-level: Switchable Codebook Groups

To address attribute diversity, the framework employs a learnable router. This router analyzes the input image and selects the most appropriate "codebook group" from a predefined pool. This allows the model to specialize; for instance, specific groups can optimize for features common to certain ethnicities or lighting conditions. By routing images to specialized experts, the model maintains high representational power without requiring a single, bloated codebook.

Token-level: Spatial Specialization

Within the selected group, STSCQ assigns an independent sub-codebook to every individual token position. This ensures that the "vocabulary" used to describe an eye is distinct from the vocabulary used for a mouth or the background. This spatial prior allows the model to learn that certain indices only belong in specific regions, significantly increasing codebook utilization rates.

Mathematical Efficiency

In a standard VQ model with a codebook of size $N$, each of the $T$ tokens requires $\log_2 N$ bits. In the STSCQ framework, if there are $M$ groups each containing a smaller sub-codebook of size $K$, the total bitrate cost is defined as:

$$\text{Bitrate} \propto (\log_2 M) + T \log_2 K$$

Because $K$ can be significantly smaller than $N$ while maintaining high precision through specialization, the total bitrate drops substantially without sacrificing the fidelity of critical facial features.

Training and Implementation

The authors utilize a three-stage progressive training pipeline to optimize the architecture:

  1. Stage 1: Optimization of the switchable router and the group-level codebooks.
  2. Stage 2: Refinement of the token-specific sub-codebooks to capture fine-grained spatial details.
  3. Stage 3: Decoder fine-tuning using a combination of perceptual loss and ArcFace loss. The inclusion of ArcFace loss is pivotal, as it ensures the compressed images retain the identity-specific features necessary for accurate biometric recognition.

The model was trained on the CASIA-WebFace dataset, comprising approximately 500,000 images across 10,000 individuals. Evaluation was conducted across five standard benchmarks: LFW, CFP-FP, AgeDB, CPLFW, and CALFW.

Experimental Results

STSCQ demonstrates significant improvements over established baselines like TiTok and VQGAN in both reconstruction quality and machine task performance:

  • State-of-the-Art Accuracy: Built upon the MaskGit-VQGAN baseline, STSCQ achieved a 93.51% Mean Accuracy at a bitrate of only 0.0469 bpp. This represents a 2.81% absolute improvement over standard VQ methods at comparable bitrates.
  • Bitrate Reduction: When applied to the TiTok-S model, the STSCQ framework reduced the bitrate by 32.9% (from 0.0234 to 0.0157 bpp) while maintaining a consistent recognition accuracy of approximately 87%.
  • Identity Preservation: The model maintains high Identity Similarity (IDS) scores even at bitrates where traditional methods like JPEG2000 produce unrecognizable artifacts. This makes STSCQ particularly valuable for remote biometric systems and surveillance applications where bandwidth is limited.

Conclusion

By moving away from global codebooks toward a hierarchical, switchable architecture, STSCQ proves that specialization is more efficient than scale in facial image compression. The framework's ability to learn implicit attribute routing and spatial priors allows for drastic bitrate reductions while preserving the identity features essential for face recognition. Future research may focus on co-designing the entire VAE pipeline to further exploit the benefits of token-specific quantization beyond the current "plug-and-play" implementation.

Summary updated

BibTeX
@inproceedings{wang2025switchable,
  author = {Yongbo Wang and Haonan Wang and Guodong Mu and Ruixin Zhang and Chen Jiaqi and Jingyun Zhang and Jun Wang and Yuan Xie and zhizhong zhang and Shouhong Ding},
  title = {{Switchable Token-Specific Codebook Quantization For Face Image Compression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=8AtYSW3VdX},
}
Figure