Straightening Out the Straight-Through Estimator: Overcoming Optimization Challenges in Vector Quantized Networks
Minyoung Huh, Brian Cheung, Pulkit Agrawal, Phillip Isola
TL;DR
This work tackles training instability in vector-quantized networks using straight-through estimation by identifying misalignment between embedding and codebook distributions as the root cause of index collapse. It introduces three techniques—affine re-parameterization of code-vectors, alternating optimization, and a synchronized commitment update—to better align distributions and reduce gradient estimation error. Empirical results across AlexNet, ResNet, and ViT for classification and across CIFAR10/CelebA with MaskGIT for generative modeling demonstrate improved codebook utilization, reduced sparsity, and enhanced performance. These contributions offer practical, mathematically grounded strategies to stabilize discrete latent representations in deep networks and provide insight into the optimization dynamics of VQNs.
Abstract
This work examines the challenges of training neural networks using vector quantization using straight-through estimation. We find that a primary cause of training instability is the discrepancy between the model embedding and the code-vector distribution. We identify the factors that contribute to this issue, including the codebook gradient sparsity and the asymmetric nature of the commitment loss, which leads to misaligned code-vector assignments. We propose to address this issue via affine re-parameterization of the code vectors. Additionally, we introduce an alternating optimization to reduce the gradient error introduced by the straight-through estimation. Moreover, we propose an improvement to the commitment loss to ensure better alignment between the codebook representation and the model embedding. These optimization methods improve the mathematical approximation of the straight-through estimation and, ultimately, the model performance. We demonstrate the effectiveness of our methods on several common model architectures, such as AlexNet, ResNet, and ViT, across various tasks, including image classification and generative modeling.
