ArticleslgStudy

computer science

Wasserstein GAN

Wasserstein GAN is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Wasserstein GAN rather than just read about it. In short: The Wasserstein Generative Adversarial Network (WGAN) is a variant of generative adversarial network (GAN) proposed in 2017 that aims to "improve the stability of learning, get rid of problems like mode collapse, and provide meaningful learning curves useful for debugging and hyperparameter searches". Compared with the original GAN discriminator, the Wasserstein GAN discriminator provides a better learning signal to…

Wasserstein GAN — main illustration
Wasserstein GAN — illustration

Key takeaways

  • Wasserstein GAN belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Wasserstein GAN to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Wasserstein GAN from memory before moving on to harder problems.

Reference excerpt

The Wasserstein Generative Adversarial Network (WGAN) is a variant of generative adversarial network (GAN) proposed in 2017 that aims to "improve the stability of learning, get rid of problems like mode collapse, and provide meaningful learning curves useful for debugging and hyperparameter searches". Compared with the original GAN discriminator, the Wasserstein GAN discriminator provides a better learning signal to the generator. This allows the training to be more stable when generator is learning distributions in very high dimensional spaces.

Motivation

The GAN game The original GAN method is based on the GAN game, a zero-sum game with 2 players: generator and discriminator. The game is defined over a probability space (Ω,ℬ,μref), The generator's strategy set is the set of all probability measures μG on (Ω,ℬ), and the discriminator's strategy set is the set of measurable functions D:Ω→[0,1]. The objective of the game isL(μG,D):=𝔼x∼μref[ln⁡D(x)]+𝔼x∼μG[ln⁡(1−D(x))]. The generator aims to minimize it, and the discriminator aims to maximize it.

A basic theorem of the GAN game states that Repeat the GAN game many times, each time with the generator moving first, and the discriminator moving second. Each time the generator μG changes, the discriminator must adapt by approaching the idealD∗(x)=dμrefd(μref+μG). Since we are really interested in μref, the discriminator function D is by itself rather uninteresting. It merely keeps track of the likelihood ratio between the generator distribution and the reference distribution. At equilibrium, the discriminator is just outputting 12 constantly, having given up trying to perceive any difference. Concretely, in the GAN game, let us fix a generator μG, and improve the discriminator step-by-step, with μD,t being the discriminator at step t. Then we (ideally) haveL(μG,μD,1)≤L(μG,μD,2)≤⋯≤maxμDL(μG,μD)=2DJS(μref‖μG)−2ln⁡2,so we see that the discriminator is actually lower-bounding DJS(μref‖μG).

Wasserstein distance Thus, we see that the point of the discriminator is mainly as a critic to provide feedback for the generator, about "how far it is from perfection", where "far" is defined as Jensen–Shannon divergence. Naturally, this brings the possibility of using a different criteria of farness. There are many possible divergences to choose from, such as the f-divergence family, which would give the f-GAN. The Wasserstein GAN is obtained by using the Wasserstein metric, which satisfies a "dual representation theorem" that renders it highly efficient to compute:

A proof can be found in the main page on Wasserstein metric.

Definition By the Kantorovich-Rubenstein duality, the definition of Wasserstein GAN is clear:A Wasserstein GAN game is defined by a probability space (Ω,ℬ,μref), where Ω is a metric space, and a constant K>0. There are 2 players: generator and discriminator (also called "critic"). The generator's strategy set is the set of all probability measures μG on (Ω,ℬ). The discriminator's strategy set is the set of measurable functions of type D:Ω→ℝ with bounded Lipschitz-norm: ‖D‖L≤K. The Wasserstein GAN game is a zero-sum game, with objective functionLWGAN(μG,D):=𝔼x∼μG[D(x)]−𝔼x∼μref[D(x)].

The generator goes first, and the discriminator goes second. The generator aims to minimize the objective, and the discriminator aims to maximize the objective:minμGmaxDLWGAN(μG,D). By the Kantorovich-Rubenstein duality, for any generator strategy μG, the optimal reply by the discriminator is D∗, such that LWGAN(μG,D∗)=K⋅W1(μG,μref).Consequently, if the discriminator is good, the generator would be constantly pushed to minimize W1(μG,μref), and the optimal strategy for the generator is just μG=μref, as it should.

Comparison with GAN In the Wasserstein GAN game, the discriminator provides a better gradient than in the GAN game. Consider for example a game on the real line where both μG and μref are Gaussian. Then the optimal Wasserstein critic DWGAN and the optimal GAN discriminator D are plotted as below:

For fixed discriminator, the generator needs to minimize the following objectives:

For GAN, 𝔼x∼μG[ln⁡(1−D(x))]. For Wasserstein GAN, 𝔼x∼μG[DWGAN(x)]. Let μG be parametrized by θ, then we can perform stochastic gradient descent by using two unbiased estimators of the gradient:∇θ𝔼x∼μG[ln⁡(1−D(x))]=𝔼x∼μG[ln⁡(1−D(x))⋅∇θln⁡ρμG(x)]∇θ𝔼x∼μG[DWGAN(x)]=𝔼x∼μG[DWGAN(x)⋅∇θln⁡ρμG(x)]where we used the reparameterization trick.

As shown, the generator in GAN is motivated to let its μG "slide down the peak" of ln⁡(1−D(x)). Similarly for the generator in Wasserstein GAN. For Wasserstein GAN, DWGAN has gradient 1 almost everywhere, while for GAN, ln⁡(1−D) has flat gradient in the middle, and steep gradient elsewhere. As a result, the variance for the estimator in GAN is usually much larger than that in Wasserstein GAN. See also Figure 3 of. The problem with DJS is much more severe in actual machine learning situations. Consider training a GAN to generate ImageNet, a collection of photos of size 256-by-256. The space of all such photos is ℝ2562, and the distribution of ImageNet pictures, μref, concentrates on a manifold of much lower dimension in it. Consequently, any generator strategy μG would almost surely be entirely disjoint from μref, making DJS(μG‖μref)=+∞. Thus, a good discriminator can almost perfectly distinguish μref from μG, as well as any μG′ close to μG. Thus, the gradient ∇μGL(μG,D)≈0, creating no learning signal for the generator. Detailed theorems can be found in.

Training Wasserstein GANs Training the generator in Wasserstein GAN is just gradient descent, the same as in GAN (or most deep learning methods), but training the discriminator is different, as the discriminator is now restricted to have bounded Lipschitz norm. There are several methods for this.

… excerpt ends here. Continue reading the full article.

Illustrations

Wasserstein GAN: The same plot, but with the GAN discriminator D replaced by ln⁡(1−D) (and scaled down to fit the plot)
The same plot, but with the GAN discriminator D replaced by ln⁡(1−D) (and scaled down to fit the plot)

Worked examples

Example 1 — a first encounter with Wasserstein GAN

Start with the simplest possible case. Write down what Wasserstein GAN claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Wasserstein GAN before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Wasserstein GAN ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Wasserstein GAN

In research
Wasserstein GAN appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Wasserstein GAN in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Wasserstein GAN is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cognitive science, Neural network architectures, Unsupervised learning, so understanding it makes those chapters shorter.
In everyday life
Look for Wasserstein GAN outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Wasserstein GAN” →

How to study Wasserstein GAN in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Wasserstein GAN means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Wasserstein GAN out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Wasserstein GAN in simple terms?

The Wasserstein Generative Adversarial Network (WGAN) is a variant of generative adversarial network (GAN) proposed in 2017 that aims to "improve the stability of learning, get rid of problems like mode collapse, and provide meaningful learning curves useful for debugging and hyperparameter searche…

Why does Wasserstein GAN matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Wasserstein GAN?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Wasserstein GAN.

Tags

  • Cognitive science
  • Neural network architectures
  • Unsupervised learning

Keep exploring