Introduction
Variational Autoencoders (VAEs) are powerful tools for unsupervised representation learning, designed to map high-dimensional data into a structured latent space. A fundamental assumption in the VAE framework is the existence of a consistent bidirectional mapping between the data space and the latent space. However, in practice, standard VAEs often suffer from "latent drift," where the encoding of a reconstructed data point does not align with its original latent representation. This paper, originally presented as a student abstract at AAAI-20, introduces a novel consistency loss to address this discrepancy.
The Inconsistency Problem
In a standard VAE, an input $x$ is mapped to a latent distribution $q(z|x)$ by an encoder. A sample $z$ from this distribution is then mapped back to the data space as a reconstruction $x'$ by a decoder. Ideally, re-encoding $x'$ should yield the same latent distribution $q(z|x)$.
Due to the approximation gap in the inference model, a drift occurs: the re-encoded distribution $q(z'|x')$ often deviates significantly from the original $q(z|x)$. This inconsistency indicates that the model has failed to learn a robust, reversible mapping, potentially leading to suboptimal latent representations and lower fidelity in generated samples.
Proposed Consistency Loss
The authors propose a straightforward modification to the VAE training objective to enforce consistency. By introducing a third term to the Evidence Lower Bound (ELBO), the model is explicitly penalized for latent drift.
The proposed consistency loss is defined as the Kullback-Leibler (KL) divergence between the original encoding and the re-encoding of the reconstruction: $D_{KL}(z' || z)$. The augmented loss function is: $$\mathcal{L}_{total} = \text{ELBO} - \alpha \cdot D_{KL}(z' || z)$$ where $\alpha$ is a hyperparameter that weights the importance of the consistency constraint.
Crucially, this method requires no additional parameters and can be integrated into existing VAE architectures with minimal computational overhead during training.
Experimental Results
The effectiveness of the consistency loss was evaluated on the MNIST and Fashion MNIST datasets. The results demonstrate a significant reduction in latent drift both qualitatively and quantitatively.
Latent Space Alignment
Visualizing the latent space reveals the impact of the consistency loss. In a standard VAE, there is a visible gap between the original encoding and the re-encoding of its reconstruction. The proposed method effectively collapses this gap, forcing the encoder and decoder to become more mathematically consistent.
Quantitative Improvements
On the MNIST test set, the inconsistency (measured by the KL divergence between $z$ and $z'$) was reduced by nearly a factor of four, dropping from 3.09 in the standard VAE to 0.79 with the proposed method. Furthermore, the consistency loss provides greater stability during training; while the standard VAE's drift remains high and fluctuates, the proposed method maintains a low and stable drift level from the early stages of training.
Conclusion
This work presents a simple yet effective approach to improving the consistency of Variational Autoencoders. By adding a latent-space consistency term to the training objective, the authors achieve a more reliable bidirectional mapping between data and latent representations without increasing model complexity. Future research will focus on automated hyperparameter tuning and scaling the approach to more complex, high-resolution datasets.
Summary updated