[Paper Review] Hierarchical Vector Quantized Transformer for Multi-class Unsupervised Anomaly Detection
This paper proposes HVQ-Trans, a unified, multi-class unsupervised anomaly detection framework that uses hierarchical vector quantization and prototype-oriented optimal transport within a Transformer to suppress the identical shortcut and improve detection and localization across multiple object classes.
Unsupervised image Anomaly Detection (UAD) aims to learn robust and discriminative representations of normal samples. While separate solutions per class endow expensive computation and limited generalizability, this paper focuses on building a unified framework for multiple classes. Under such a challenging setting, popular reconstruction-based networks with continuous latent representation assumption always suffer from the "identical shortcut" issue, where both normal and abnormal samples can be well recovered and difficult to distinguish. To address this pivotal issue, we propose a hierarchical vector quantized prototype-oriented Transformer under a probabilistic framework. First, instead of learning the continuous representations, we preserve the typical normal patterns as discrete iconic prototypes, and confirm the importance of Vector Quantization in preventing the model from falling into the shortcut. The vector quantized iconic prototype is integrated into the Transformer for reconstruction, such that the abnormal data point is flipped to a normal data point.Second, we investigate an exquisite hierarchical framework to relieve the codebook collapse issue and replenish frail normal patterns. Third, a prototype-oriented optimal transport method is proposed to better regulate the prototypes and hierarchically evaluate the abnormal score. By evaluating on MVTec-AD and VisA datasets, our model surpasses the state-of-the-art alternatives and possesses good interpretability. The code is available at https://github.com/RuiyingLu/HVQ-Trans.
Motivation & Objective
- Motivate unified anomaly detection across multiple classes to reduce per-class models and improve generalization.
- Address the identical shortcut issue in reconstruction-based UAD by using discrete iconic prototypes instead of continuous latent representations.
- Develop a hierarchical vector quantization framework to prevent codebook collapse and preserve normal patterns at multiple levels.
- Introduce prototype-oriented optimal transport to calibrate prototypes and enhance anomaly scoring and interpretability.
Proposed method
- Replace continuous latent features with nearest iconic prototypes in learnable codebooks per category.
- Incorporate a cascaded VQ-based Transformer encoder/decoder to reconstruct using discrete prototypes.
- Implement a switching mechanism with multiple codebooks and experts to handle multi-class data without fine-tuning.
- Use hierarchical POT losses to align normal features with prototypes and calibrate anomaly scores across levels.
- Optimize with a composite objective including reconstruction loss, prototypical and commitment losses, POT loss, and cross-entropy for expert switching.

Experimental results
Research questions
- RQ1Can a unified, multi-class model outperform per-class models in unsupervised anomaly detection and localization?
- RQ2Does hierarchical vector quantization mitigate codebook collapse and reduce the identical shortcut compared to continuous latent spaces?
- RQ3How effective is prototype-oriented optimal transport in learning robust prototypes and calibrating multi-level anomaly scores?
- RQ4Does the switching mechanism improve reconstruction quality and detection accuracy across diverse object categories?
Key findings
- HVQ-Trans achieves state-of-the-art performance on MVTec-AD under the one-for-all setting, outperforming several baselines.
- Hierarchical VQ layers help prevent codebook collapse and improve localization by reconstructing normal patterns at multiplefeature levels.
- Prototype-oriented OT calibrates anomaly scoring, producing more robust detection across categories and complex scenes.
- The switching mechanism enables category-wise prototype and expert selection, enhancing robustness in multi-class anomaly detection.
- Qualitative results show improved anomaly localization by reconstructing abnormal regions toward normal patterns.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.