Contrastive Variational Autoencoder Enhances Salient Features

Abubakar Abid, James Y. ZouarXiv 2019

Introduction: The Challenge of Salient Feature Extraction

In unsupervised learning, the primary goal is typically to identify the most dominant patterns within a dataset. However, in many real-world applications, the most statistically dominant patterns are not necessarily the most informative or "salient." For instance, in medical imaging, a standard generative model might prioritize modeling common demographic variations like skin tone or age over subtle pathological features that indicate disease.

While linear methods like Contrastive PCA (cPCA) exist to isolate features unique to a target group relative to a background group, they are limited by their inability to capture complex, non-linear relationships. To address this, the Contrastive Variational Autoencoder (cVAE) provides a deep generative framework designed to disentangle salient features from irrelevant background noise and shared characteristics.

The cVAE Architecture: Latent Space Decomposition

The core innovation of the cVAE is the explicit partitioning of the latent space into two distinct components:

  1. Salient Latent Variables ($s$): These capture features present in the target dataset but absent or minimal in the background.
  2. Irrelevant Latent Variables ($z$): These capture features shared by both datasets, such as common background patterns, technical noise, or shared demographics.
Probabilistic graphical model of the cVAE, illustrating the decomposition of the latent space into salient variables ($s_i$) and irrelevant variables ($z_i$).

The model utilizes dual shared encoders—one for each latent space—and a single shared decoder. To ensure that $s$ and $z$ remain truly independent and do not "leak" information into one another, the authors incorporate a Total Correlation (TC) penalty. This encourages statistical independence between the two latent representations, preventing the entanglement that often plagues standard VAEs.

Training via Contrastive Learning

The cVAE is trained using a "contrastive trick." During the training phase, the model is presented with pairs of samples from a target dataset and a background dataset.

  • For target samples, the model utilizes both the salient ($s$) and irrelevant ($z$) encoders to reconstruct the data.
  • For background samples, the model is restricted to using only the irrelevant ($z$) encoder, with the salient variables $s$ forced to zero.

This constraint forces the $z$-encoder to capture all variations common to both datasets. Consequently, the $s$-encoder is left to model only the unique, salient features that distinguish the target data from the background. This allows for "denoising" via latent manipulation: by encoding a target image and setting $z$ to zero before decoding, the model can strip away background noise while preserving the salient object.

Results and Applications

The authors validated the cVAE across several domains, demonstrating its superiority in isolating specific signals from noisy environments.

Grassy-MNIST

To test the model's ability to handle complex backgrounds, the authors created "Grassy-MNIST," where standard MNIST digits are superimposed on high-variance grass textures. While a standard VAE failed to cluster the digits due to the overwhelming background noise (Silhouette Score ~0.01), the cVAE successfully isolated the digits, achieving a significantly higher Silhouette Score (~0.34).

Comparison of target and background datasets alongside cVAE reconstructions, demonstrating successful isolation of salient digit features from complex backgrounds.

Genomic Data and Facial Attributes

In biological applications, the cVAE was applied to RNA-Seq data from leukemia patients. It successfully isolated the "pre- vs. post-transplant" status of patients by treating technical "batch effects" as background noise. Similarly, on the CelebA dataset, the model isolated specific attributes like "wearing glasses." By manipulating only the salient latent variables, the authors could add or remove glasses from a face without altering the subject's identity or other facial features, a task where standard VAEs often struggled with entanglement.

Conclusion

The Contrastive Variational Autoencoder represents a significant advancement in non-linear feature discovery. By leveraging a background dataset to define what is "irrelevant," the cVAE can uncover subtle but critical signals that are otherwise buried in high-dimensional noise. This capability makes it a powerful tool for fields ranging from medical diagnostics to robust computer vision, where distinguishing signal from noise is paramount.

Summary updated

BibTeX
@misc{abid2019contrastive,
  author = {Abubakar Abid and James Y. Zou},
  title = {{Contrastive Variational Autoencoder Enhances Salient Features}},
  year = {2019},
  eprint = {1902.04601},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.04601},
}
Figure