Invert and Defend: Model-based Approximate Inversion of Generative Adversarial Networks for Secure Inference

Wei-An Lin, Yogesh Balaji, Pouya Samangouei, Rama ChellappaarXiv 2019

Abstract

Generative Adversarial Networks (GANs) excel at image synthesis but present significant challenges for inversion—mapping images back to their latent representations. We present InvGAN, a novel data-free framework that learns to invert pre-trained GANs. By utilizing a learned encoder to provide an optimized initialization for manifold projection, InvGAN enhances the efficiency and efficacy of adversarial defenses like DefenseGAN. Furthermore, it facilitates rigorous security evaluations through reparameterization attacks.

Introduction

Generative Adversarial Networks (GANs) are powerful tools for synthesis, yet finding the specific latent code ($z$) that produces a given image—a process known as GAN inversion—remains difficult. The generator function is typically highly non-linear and non-injective, making the mapping from image space back to latent space complex.

Existing inversion methods generally fall into two categories: optimization-based approaches, which are slow and prone to local minima, and encoder-based approaches, which often require joint training that can degrade generator quality. InvGAN addresses these limitations by providing a fast, accurate inversion method compatible with any pre-trained generator without requiring access to the original training data.

The InvGAN Framework

InvGAN trains an inverter network ($I$) using only a pre-trained generator ($G$). By leveraging the generator's ability to produce infinite synthetic pairs $(z, G(z))$, the framework learns the inverse mapping in a data-free manner.

Overview of the InvGAN framework for inversion and adversarial defense.

To ensure high-quality reconstructions, the framework employs a multi-part loss function:

  • Latent Code Recovery: An $L_2$ loss ensuring the predicted code matches the original sampled code.
  • Approximate Semantic Consistency: A hinge loss on the $L_2$ distance between images to encourage sharp, semantically accurate reconstructions.
  • Inverted Image Distribution Consistency: An adversarial loss to ensure reconstructed images match the distribution of the original GAN outputs.

Adversarial Defense and Purification

In the context of secure inference, InvGAN acts as a "purifier." When presented with an adversarial image, the system projects it onto the GAN's learned manifold. InvGAN uses the encoder's output as a "warm start" for a limited number of gradient descent steps. This hybrid approach combines the speed of encoder-based methods with the precision of optimization-based refinement.

Furthermore, by creating a differentiable path from the image to the latent code and back ($G(I(x))$), InvGAN enables "reparameterization" white-box attacks. This allows for more rigorous stress-testing of defenses that were previously considered gradient-free or difficult to attack.

Experimental Results

InvGAN was evaluated on standard benchmarks including MNIST, Fashion-MNIST, CIFAR-10, and CelebA.

Reconstruction and Defense Performance

InvGAN demonstrates superior performance compared to existing encoder-based models like ALI and AGE. On CIFAR-10, InvGAN achieved a significantly higher Inception Score (7.72 vs. 6.43 for AGE) and a lower FID (22.35 vs. 39.93), indicating more realistic reconstructions. In terms of defense, the "warm start" provided by the encoder drastically reduces the number of iterations required to achieve high classification accuracy compared to standard DefenseGAN.

Qualitative Analysis

Visual results confirm that InvGAN reconstructions maintain semantic consistency (e.g., correct digit identity or facial orientation) where other methods often produce blurry or semantically incorrect outputs. Even under strong attacks like BPDA (Backward Pass Differentiable Approximation), InvGAN's reconstructions remain more faithful to the original clean data than baseline defenses.

Qualitative comparison of inversion results across different methods and datasets.

Conclusion

InvGAN proves that data-free training is a viable path for learning GAN inversion. By providing a smart initialization for manifold projection, it significantly improves the speed and robustness of adversarial purifiers. While exact inversion remains theoretically challenging due to the non-bijective nature of GANs, InvGAN represents a significant step forward in practical, secure inference using generative models.

Summary updated

BibTeX
@misc{lin2019invert,
  author = {Wei-An Lin and Yogesh Balaji and Pouya Samangouei and Rama Chellappa},
  title = {{Invert and Defend: Model-based Approximate Inversion of Generative Adversarial Networks for Secure Inference}},
  year = {2019},
  eprint = {1911.10291},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.10291},
}
Figure