Vector quantization is common in deep models, yet its hard assignments block gradients and hinder end-to-end training. We propose DiVeQ, which treats quantization as adding an error vector that mimics the quantization distortion, keeping the forward pass hard while letting gradients flow. We also present a space-filling variant (SF-DiVeQ) that assigns to a curve constructed by the lines connecting codewords, resulting in less quantization error and full codebook usage. Both methods train end-to-end without requiring auxiliary losses or temperature schedules. On VQ-VAE compression and VQGAN generation across various data sets, they improve reconstruction and sample quality over alternative quantization approaches.
翻译:向量量化在深度模型中应用广泛,但其硬分配机制会阻断梯度传播并阻碍端到端训练。本文提出DiVeQ方法,将量化过程视为添加模拟量化失真的误差向量,在保持前向传播硬量化的同时允许梯度反向传播。我们还提出一种空间填充变体(SF-DiVeQ),该方法将向量分配到由码字连线构成的曲线上,从而降低量化误差并实现码本的完全利用。两种方法均支持端到端训练,无需辅助损失函数或温度调度机制。在多种数据集上的VQ-VAE压缩和VQGAN生成任务中,本方法相比其他量化方案显著提升了重建质量与样本生成质量。