NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Generalized Adversarially Learned Inference

Yatin Dandi, Homanga Bharadhwaj, Abhishek Kumar, Piyush Rai

Abstract

Allowing effective inference of latent vectors while training GANs can greatly increase their applicability in various downstream tasks. Recent approaches, such as ALI and BiGAN frameworks, develop methods of inference of latent variables in GANs by adversarially training an image generator along with an encoder to match two joint distributions of image and latent vector pairs. We generalize these approaches to incorporate multiple layers of feedback on reconstructions, self-supervision, and other forms of supervision based on prior or learned knowledge about the desired solutions. We achieve this by modifying the discriminator's objective to correctly identify more than two joint distributions of tuples of an arbitrary number of random variables consisting of images, latent vectors, and other variables generated through auxiliary tasks, such as reconstruction and inpainting or as outputs of suitable pre-trained models. We design a non-saturating maximization objective for the generator-encoder pair and prove that the resulting adversarial game corresponds to a global optimum that simultaneously matches all the distributions. Within our proposed framework, we introduce a novel set of techniques for providing self-supervised feedback to the model based on properties, such as patch-level correspondence and cycle consistency of reconstructions.

Introduction

Generative Adversarial Networks (GANs) are excellent at generating highly realistic images, but they natively lack an inference mechanism—they cannot map an existing image back into its latent representation. Variational Autoencoders (VAEs) have this inference capability via an encoder, but they tend to produce blurry images due to their reliance on pixel-level reconstruction losses like $L_1$ or $L_2$ error.

Previous hybrid approaches like Adversarially Learned Inference (ALI) and BiGAN attempted to solve this by training a discriminator to distinguish between two pairs: (real image, inferred latent) and (generated image, sampled latent). While elegant, this binary matching is limited. When researchers tried to enforce better cycle consistency by adding standard pixel-level reconstruction losses (as seen in the ALICE model), the dreaded blurriness returned. The Generalized Adversarially Learned Inference (GALI) framework tackles the challenge of providing rich, multi-layered reconstructive and task-specific feedback to the generator and encoder without resorting to pixel-level losses that degrade image quality.

Methodology

The authors generalize the ALI/BiGAN framework from a binary classification problem to an $n$-way multi-class classification problem.

Multi-Class Discriminator

Instead of just looking at two pairs, the discriminator evaluates multiple tuples of images and latent vectors. For example, it might look at the original image and its encoding $(x, E(x))$, the generated image and its latent prior $(G(z), z)$, the reconstruction of an image $(x, E(G(E(x))))$, and the reconstruction of a latent vector $(G(E(G(z))), z)$.

The GALI framework generalizes adversarial inference by matching multiple joint distributions of images, latents, and auxiliary variables.

The "Product of Terms" Objective

A naive multi-class minimax objective fails here. If the discriminator easily rejects a "fake" class, the gradients for the generator/encoder vanish, halting learning. To fix this, the authors propose a novel non-saturating objective that maximizes the product of the discriminator's probabilities for all the "wrong" classes. This explicitly forces the generator and encoder to make all distributions indistinguishable simultaneously.

Self-Supervised & Learned Feedback

Because the framework can handle arbitrary tuples, the authors introduce "mixed images" (combining inpainted sections of reconstructions with real images) to enforce self-supervised spatial consistency. They also show how to include features from pre-trained networks as additional variables in the tuples to inject learned knowledge into the adversarial game.

Experimental Results

The GALI framework was evaluated on the SVHN (Street View House Numbers) and CelebA datasets.

Reconstruction and Generation Quality

GALI significantly outperformed baselines in reconstruction quality. On SVHN, GALI-8 achieved a pixel-MSE of 0.0095 (vs. ALI's 0.023). On CelebA, GALI-4 hit 0.036 pixel-MSE (vs. ALI's 0.074). Importantly, improved inference did not come at the cost of generation quality. GALI-4 achieved a Frechet Inception Distance (FID) of 23.11 on CelebA, significantly outperforming ALI (24.49) and crushing the blurry ALICE baseline (36.91).

Image Inpainting

By incorporating "mixed images" into the tuples, GALI-mix achieved a pixel-MSE of 0.031 on CelebA inpainting, beating ALICE (0.047) while maintaining sharp, realistic textures.

Qualitative comparison of inpainting and reconstruction on CelebA. GALI variants maintain sharp, realistic textures compared to the blurry outputs of ALICE.

Representation Learning

Features extracted from the GALI-4 encoder proved highly useful for downstream tasks. A linear SVM trained on GALI-4 features for SVHN achieved a 16.58% misclassification rate, beating both ALI (19.11%) and ALICE (18.89%).

Conclusion

GALI demonstrates that adversarial inference doesn't have to be limited to two joint distributions. Expanding the discriminator to evaluate multiple chains of reconstructions provides richer, deeper feedback to the encoder and generator. By enforcing cycle consistency adversarially rather than via explicit pixel loss, the model achieves tight reconstructions while avoiding the blurriness associated with autoencoders. The framework is highly extensible, accommodating self-supervision and external knowledge simply by adding new tuple classes to the discriminator's objective.

The appendix of the paper can be found at: https://drive.google.com/file/d/1i99e682CqYWMEDXlnqkqrctGLVA9viiz/view?usp=sharing

Summary updated

BibTeX
@inproceedings{dandi2021generalized,
  author = {Yatin Dandi and Homanga Bharadhwaj and Abhishek Kumar and Piyush Rai},
  title = {{Generalized Adversarially Learned Inference}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  url = {https://openreview.net/forum?id=44K1z7pve_U},
}
Figure