Discriminator optimal transport

Akinori Tanaka

Generative Adversarial Networks (GANs) are powerful but notoriously finicky. Even when a GAN reaches a stable equilibrium, the generator often produces "almost-good" images plagued by artifacts like strange shadows, blurred edges, or nonsensical structures. Traditionally, fixing this requires scaling up the model or the dataset, which is computationally expensive.

Furthermore, there is a conceptual inefficiency in the standard GAN framework. In models like Variational Autoencoders (VAEs), both the encoder and decoder remain useful after training. In GANs, however, the discriminator—which has spent the entire training process learning the intricate nuances of the real data distribution—is usually discarded once the generator is deemed ready. This raises a compelling question: Can we use the discriminator's acquired knowledge to refine the generator's output after training is complete?

Bridging GANs and Optimal Transport

To address this, researchers introduce Discriminator Optimal Transport (DOT), a post-processing technique that nudges generated samples toward the real data distribution without requiring any retraining.

The core insight is that the discriminator is not just a "critic"; it acts as a potential function defining the optimal way to transport "fake" mass to "real" mass. By bridging the gap between GAN training and Optimal Transport (OT) theory, the authors prove that within a broad class of GANs (including those using hinge or Wasserstein loss), the discriminator optimization process essentially maximizes a lower bound of the dual cost function for the Wasserstein distance.

This theoretical foundation leads to two practical refinement schemes:

  1. Target Space DOT: This approach attempts to modify the generated image $y$ directly. By adding a small perturbation $\delta y$ that increases the discriminator's score $D(y)$ while minimizing the $l_2$ distance to the original image, the sample is moved closer to the real data distribution. However, in high-dimensional spaces like real images, this often produces "adversarial noise" rather than meaningful semantic improvements.
  2. Latent Space DOT: To overcome the limitations of Target Space DOT, optimization is performed in the latent space ($z$). The noise vector $z$ is updated before it passes through the generator. This effectively "cleans" the image by moving to a better point within the generator's own learned vocabulary, forcing the improvements to be semantically meaningful.

A crucial practical contribution for making this work is the use of an effective Lipschitz constant ($K_{eff}$). While theoretical bounds exist (especially with Spectral Normalization, often defaulting to 1.0), the empirical gradient of the discriminator is usually much smaller (closer to 0.08). Using this smaller, empirical value is vital for keeping the DOT optimization stable during gradient descent.

Results: A Free Lunch for Image Quality?

The authors validated DOT across various settings, from synthetic datasets (25-Gaussians, Swiss Roll) to standard benchmarks (CIFAR-10, STL-10) and large-scale data (ImageNet), using architectures like DCGAN, ResNet, WGAN-GP, SNGAN, and SAGAN.

The quantitative improvements are significant and consistent across different GAN variants. For instance, on CIFAR-10 using an SNGAN, the Fréchet Inception Distance (FID) dropped from 20.74 to 15.78. On STL-10, FID improved from 41.18 to 34.84. Even on highly optimized, pre-trained ImageNet models, DOT provided mild but consistent improvements in both Inception Score and FID.

Qualitatively, DOT effectively removes blurred shapes and unnecessary shadows, resulting in cleaner, more distinct objects.

Qualitative improvements using DOT. The original generated images (blue borders) often contain artifacts or blurred regions, which are noticeably refined and sharpened after applying Discriminator Optimal Transport (red borders).

This method is particularly valuable as it provides a way to squeeze extra performance out of "compact" models deployed on edge devices, where massive scaling isn't an option.

Limitations and Future Directions

While DOT offers a "post-training polish," it comes with trade-offs:

  • Inference Overhead: Because DOT requires several iterations of gradient descent for every generated image, it makes the sampling process slower than a standard one-pass GAN.
  • Hyperparameter Tuning: The method requires careful tuning of the learning rate ($\epsilon$) and the number of update steps. Excessive optimization steps can eventually lead to a loss of diversity.

Future work could explore training the latent prior distribution ($p_Z$) simultaneously using these OT techniques, or leveraging fast adversarial-example algorithms to accelerate the DOT refinement process, making it more viable for real-time applications.

Summary updated

BibTeX
@inproceedings{tanaka2019discriminator,
  author = {Akinori Tanaka},
  title = {{Discriminator optimal transport}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure