Hijack-GAN: Unintended-Use of Pretrained, Black-Box GANs

Hui-Po Wang, Ning Yu, Mario Fritz

TL;DR

This paper introduces Hijack-GAN, a framework that allows users to gain high-level control over pre-trained, black-box Generative Adversarial Networks (GANs) for unintended tasks like facial attribute editing and pose manipulation. By training a proxy model to estimate gradients and iteratively traversing the highly non-linear latent space, the authors demonstrate that publicly released GANs can be easily repurposed without requiring access to model parameters or training data, raising significant security and intellectual property concerns.

What Problem Does This Paper Address?

Training state-of-the-art GANs (such as StyleGAN) requires massive computational power and enormous datasets—for instance, training a single high-quality face model can take a week on eight high-end GPUs. Naturally, researchers and industry practitioners prefer to share and reuse pre-trained models to build "Green AI" systems.

However, controlling how these models generate images typically requires either:

  1. White-box access to the model's internal parameters and gradients.
  2. Linear assumptions about the model's latent space (e.g., assuming that moving in a straight line in the latent space cleanly changes an attribute like "age" or "smile").

The authors point out that the latent spaces of modern GANs (specifically the $Z$-space) are highly non-linear and entangled. Linear baselines fail to manipulate rare attributes effectively and often cause unintended distortions in other features. Hijack-GAN addresses this gap by enabling precise, disentangled attribute manipulation under a strict black-box setting, where only the input noise and output images are accessible.

Methods

The Hijack-GAN framework operates in two main phases:

Figure 1. An overview of the proposed framework. The framework takes two steps to reuse GANs: (a) train a proxy model to distill information from pre-trained models, circumventing accessing the gradients of pre-trained models; (b) identify and iteratively traverse a non-linear trajectory under the guidance of gradients.
  1. Information Distillation via a Proxy Model: Because the target GAN and downstream task models (e.g., classifiers) are black boxes, their gradients are impassable. To circumvent this, the authors train a fully connected neural network as a proxy model. This proxy learns the direct mapping from the GAN's input noise ($z$) to the final attribute space predicted by the task models.
  2. Non-linear Iterative Traversal: Instead of calculating a single constant direction vector, Hijack-GAN computes the Jacobian matrix of the proxy model at each step. It dynamically updates the noise vector along the steepest local gradient direction, accurately tracking the non-linear manifold of the latent space.
  3. Constraint for Disentanglement: To edit a target attribute (e.g., adding eyeglasses) without altering other features (e.g., gender or age), the authors introduce an orthogonal constraint formulated as a linear program. At each iteration, it finds a direction that maximizes the target attribute change while remaining orthogonal to all non-target attribute vectors.

Datasets

The authors evaluated their approach using the following setups:

  • Generative Backbones: Pre-trained PGGAN and StyleGAN models trained on the CelebAHQ dataset.
  • Task Models: A ResNet-50 classifier pre-trained on CelebAHQ (for facial attributes), HopeNet pre-trained on 300W-LP (for head pose estimation), and MTCNN (for facial landmark detection).
  • Proxy Training Data: For each attribute, the authors synthesized a balanced dataset of 200k samples (100k positive, 100k negative) using the black-box models to train the proxy networks.

Key Insights and Ideas

  • The Non-Linearity of $Z$-space: While linear methods work passably for common attributes (like gender), they fail dramatically on rare attributes (like baldness or pale skin). The latent space manifolds for these rare features are highly curved, meaning an iterative, step-by-step gradient re-computation is essential.
  • The Illusion of Black-Box Security: Model creators often assume that releasing only black-box API access protects their models from unauthorized reuse or malicious modification (like deepfakes). Hijack-GAN proves that black-box access is sufficient to fully "hijack" and control the model for unintended applications.

Key Results

The authors compared Hijack-GAN against two linear baselines: Linear and InterFaceGAN.

  • Qualitative Superiority: As shown in the paper's visualizations, Hijack-GAN achieves significantly smoother transitions with fewer facial distortions. For example, when adding eyeglasses or changing age, the identity and other facial features of the subject remain remarkably stable compared to the baselines.
Figure 2. Unconditional attribute manipulation on PGGAN (left) and StyleGAN (right) with respect to Eyeglasses, Gender, Smile, and Age. We compare our method to Linear and InterfaceGAN.
  • Attribute Preservation: Quantitatively, Hijack-GAN achieved a much higher attribute preservation ratio across various facial features, meaning it successfully decoupled the target attribute from non-target attributes.
  • Smoothness and Accuracy: Using the Modified Perceptual Path Length (mPPL) metric, the proposed method demonstrated significantly smoother image transitions on StyleGAN in conditional settings. It also yielded lower first-order Taylor approximation errors, proving it models the underlying latent manifold far more accurately than linear alternatives.

Limitations and Future Work

Despite its success, Hijack-GAN is fundamentally bound by the underlying distribution of the pre-trained GAN. For example, because CelebAHQ images are strictly aligned by eye coordinates, the framework cannot manipulate the "roll" axis of a head pose. Furthermore, attempting to push an attribute too far beyond the distribution boundaries introduces noticeable visual artifacts.

The authors suggest that future work should explore defensive mechanisms to prevent this style of black-box hijacking, urging model owners to carefully weigh the risks before making generative models publicly available.

Summary updated

BibTeX
@inproceedings{wang2021hijack,
  author = {Hui-Po Wang and Ning Yu and Mario Fritz},
  title = {{Hijack-GAN: Unintended-Use of Pretrained, Black-Box GANs}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=rcMwxlR-bc},
}
Figure