Abstract
The latent variables learned by Variational Autoencoders (VAEs) have seen considerable interest as an unsupervised way of extracting features. However, VAE latent variables often focus on some factors of variation at the expense of others—a phenomenon we refer to as "feature imbalance." This leads to poor generalization when the latent variables are used in environments where the presence of features changes, and induces the VAE to generate less diverse samples. To address this, we propose Jigsaw-VAE, a regularization scheme that forces the encoder to process shuffled image tiles. We also introduce a simple metric, the Feature Presence Metric (FPM), to measure the balance of features in generated images. Our results demonstrate that Jigsaw-VAE substantially addresses the feature imbalance problem, improving both generative diversity and downstream task robustness.
The Problem: Feature Imbalance in VAEs
VAEs are popular for unsupervised feature extraction, but they often suffer from feature imbalance. During training, the model tends to optimize the Evidence Lower Bound (ELBO) by focusing on dominant, frequent features (like background color or overall face shape) while ignoring sporadic, "minor" features (like eyeglasses or specific hair colors).
This leads to two major issues:
- Biased Generation: The VAE generates samples that lack diversity, favoring the dominant features found in the training set.
- Poor Generalization: If the latent variables are used for a downstream task (like classification or clustering) in a new environment where those dominant features are absent or changed, the model fails because it never truly "learned" the more subtle, structural features.
Methods: The Jigsaw-VAE Approach
The authors propose Jigsaw-VAE, which adds a stochastic permutation layer at the very beginning of the VAE encoder.
Jigsaw Permutation and Spatial Reasoning
The input image is divided into a grid of tiles (e.g., a 4x4 grid). These tiles are randomly shuffled before being fed into the encoder.
To reconstruct the original (unshuffled) image, the VAE can no longer rely on global dominant features. It is forced to learn the spatial relationships between local parts—essentially learning how the "jigsaw pieces" of an object fit together. This process prioritizes structural information over simple appearance-based features like color.
Feature Presence Metric (FPM)
The authors introduce a new metric to quantify feature balance. It calculates the absolute difference between the frequency of a feature in the training set versus its frequency in the model's generated samples. A lower FPM indicates a more balanced, representative model.
Key Insights and Results
Jigsaw-VAE effectively breaks the "path of least resistance" for VAE optimizers. By shuffling the input, the model is prevented from taking the easy path of only learning global statistics.
Robustness to Bias on Colored MNIST
In the Colored MNIST experiment, each digit class is assigned a specific color during training, creating an intentional color bias. Most models, including $\beta$-VAE, failed to learn digit shapes, focusing entirely on color. When tested on single-color images, Jigsaw-VAE maintained a high Normalized Mutual Information (NMI) score of 0.379, whereas $\beta$-VAE dropped to nearly zero (7.8E-06). This proves Jigsaw-VAE actually learned the digit shapes.
Improved Diversity on CelebA
On the CelebA dataset, Jigsaw-VAE achieved lower (better) FPM scores across several under-represented attributes. For example, it was much better at preserving "Gray hair" and "Baldness" in generated samples compared to a vanilla VAE. Qualitatively, Jigsaw-VAE also showed smoother transitions when interpolating in the latent space, particularly for rare features like eyeglasses, which often "pop" in and out of existence abruptly in standard VAEs.
Limitations
The effectiveness of the model depends on the tile size. If tiles are too large, the "jigsaw" task is too easy; if they are too small, the encoder may lose too much context. Additionally, the current work focuses heavily on images; how this translates to non-spatial data (like audio or text) is an area for future work.
Conclusion
Jigsaw-VAE provides a simple, parameter-free way to encourage feature balance in VAEs. By prioritizing structure over appearance through spatial shuffling, it creates more robust latent representations that are better suited for downstream tasks and diverse image synthesis.
Summary updated