U NDERSTANDING THE E FFECTIVENESS OF L IPSCHITZC ONTINUITY IN G ENERATIVE A DVERSARIAL N ETS
Anonymous authors
Paper under double-blind review
A BSTRACT
In this paper we investigate the underlying factor that leads to the failure and success in training of GANs.
Speciﬁcally, we study the property of the optimal discriminative function f ∗ ( x ) and show that f ∗ ( x ) in most GANs can only reﬂect the local densities at x , which means the value of f ∗ ( x ) for points in the fake distribution ( P g ) does not contain any information useful about the location of other points in the real distribution ( P r ).
Given that the supports of the real and fake distributions are usually disjoint, we argue that such a f ∗ ( x ) and its gradient tell nothing about “how to pull P g to P r ”, which turns out to be the fundamental cause of failure in training of GANs.
We further demonstrate that a well-deﬁned distance metric (including the dual form of Wasserstein distance with a compacted constraint) does not necessarily ensure the convergence of GANs.
Finally, we propose Lipschitz-continuity condition as a general solution and show that in a large family of GAN objectives, Lipschitz condition is capable of connecting P g and P r through f ∗ ( x ) such that the gradient ∇ x f ∗ ( x ) at each sample x ∼ P g points towards some real sample y ∼ P r .
I NTRODUCTION
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014), as a new way of learning generative models, have recently shown promising results in various challenging tasks.
Although GANs are popular and widely-used (Isola et al., 2016; Brock et al., 2016; Nguyen et al., 2016; Zhu et al., 2017; Karras et al., 2017), they are notoriously hard to train (Goodfellow, 2016).
The underlying obstacles, though have been widely studied (Arjovsky & Bottou, 2017;
Lucic et al., 2017; Heusel et al., 2017a; Mescheder et al., 2017; 2018; Yadav et al., 2017), are still not fully understood.
In this paper, we study the convergence of GANs from the perspective of the optimal discriminative function f ∗ ( x ) .
We show that in original GAN and its most variants, f ∗ ( x ) is a function of densities at the current point x but does not reﬂect any information about the densities/locations of other points in the real and fake distributions.
Moreover, Arjovsky & Bottou (2017) state that the supports of real and fake distributions are usually disjoint.
In this paper, we argue that the fundamental cause of failure in training of GANs (Section 2.1) stems from the combination of the above two facts.
The generator uses ∇ x f ∗ ( x ) as the guidance for updating the generated samples, but ∇ x f ∗ ( x ) actually tells nothing about where P r is.
Therefore, the generator is not guaranteed to converge to the case P g = P r .
Accordingly, Arjovsky et al.
(2017) proposed the Wasserstein distance (in its dual form) as an alternative objective, which can properly measure the distance between two distributions no matter whether their supports are disjoint.
However, as shown in Section 2.3, when the supports of the P g and P r are disjoint, the gradient of f ∗ ( x ) from the dual form of Wasserstein distance given a compacted dual constraint also does not reﬂect any useful information about other points in P r .
Based on this observation, we provide further investigation in Section 2.4 and argue that measuring the distance properly does not necessarily imply that the gradient is well-deﬁned in terms of ∇ x f ∗ ( x ) .
In Section 3, we propose incorporating Lipschitz-continuity condition in the objectives of GANs as a general solution, and prove that in a broad family of discriminator objectives, Lipschitz-continuity condition can build strong connections between P g and P r through f ∗ ( x ) such that when the supports of P g and P r are disjoint, ∇ x f ∗ ( x ) at each sample x ∼ P g will point towards some real sample y ∼
We extend our discussion on f ∗ ( x ) and ∇ x f ∗ ( x ) to the case where the supports of P g and P r are overlapped, and present the general arguments in Section 4.1.
Subsequently, in Section 4.2, we show that the locality of f ∗ ( x ) and ∇ x f ∗ ( x ) in traditional GANs turns out to be an intrinsic cause to mode collapse.
Finally, in Section 4.3, we explain the reason of empirical success of traditional GANs under the circumstance that they have no convergence guarantee.
[Table]
T HE F UNDAMENTAL C AUSE OF F AILURE IN T RAINING OF GAN S
Typically, the objectives of GANs can be formulated as follows:
[Equation]
(1) where P z is the source distribution of the generator (usually a Gaussian distribution) in R m and
P r is the target (real) distribution in R n .
The generative function g : R m → R n learns to output samples that shares the same dimension as P r , while the discriminative function f : R n → R learns to output a score indicating the authenticity of a given sample.
We denote the implicit distribution of the generated samples as P g , i.e., P g =
g
( P z ) .
F and G denote discriminative and generative function spaces parameterized by neural networks, respectively; functions φ , ϕ , ψ : R → R are loss metrics.
We list the choices of F , φ and ϕ in some representative GAN models in Table 1, where we denote f ∗ = arg min f ∈F J D .
In these GANs, the gradient that the generator receives from the discriminator with respect to a generated sample x ∼ P g is
[Equation]
In Eq.
(2), the ﬁrst term ∇ f ( x ) ψ ( f ( x )) is a step-related scalar that is out of the scope of our discussion in this paper; the second term ∇ x f ( x ) is a vector indicating the direction that the generator should follow for optimizing on sample x .
2. ∇ x f ∗ ( x ) ON P g DOES NOT REFLECT USEFUL INFORMATION ABOUT P r
In this section, we will show that when the supports of P g and P r are disjoint, ∇ x f ∗ ( x ) in traditional
GANs does not reﬂect any useful information about P r , and P g is not guaranteed to converge to P r .
We argue that this is the fundamental cause of non-convergence and instability in traditional GANs.
2.1. T HE ORIGINAL GAN AND L EAST -S QUARES GAN
In the simplest case of Eq.
(1), e.g., the original GAN (Goodfellow et al., 2014) and Least-Squares
GAN (Mao et al., 2016), there is no restriction on F .
Therefore, f ∗ ( x ) for each point x is independent of other points, and we have
[Equation]
Since we assume supports of P g and P r are disjoint, we further have
[Equation]
[Figure]
For x ∼ P g , the value of f ∗ ( x ) is irrelevant to P r .
Since P g and P r are disjoint 2 , ∇ x f ∗ ( x ) for x ∼ P g also tells nothing about P r .
In consequence, the generator can hardly learn useful information and is not guaranteed to converge to the case where P g =
P r .
2.1. T HE F ISHER GAN
Mroueh et al.
(2017) prove that the optimal f ∗ of µ -Fisher IPM F µ ( P r , P g ) , the objective used in
Fisher GAN (Mroueh & Sercu, 2017), has the following form
[Equation] [Equation]
where µ is a distribution whose support covers P r and P g .
Given P r and P g are disjoint, we have
[Equation]
[Equation]
Note that the scalar 1 F µ ( P r ,P g ) is a constant.
Eq.
(6) also deﬁnes f ∗ ( x ) on P g and P r independently.
Therefore, for x ∼ P g , f ∗ ( x ) and ∇ x f ∗ ( x ) tell nothing about P r .
2. C ONNECTION TO GRADIENT VANISHING
The non-convergence problem of the original GAN has once been considered as the gradient vanishing problem.
In (Goodfellow et al., 2014), it is addressed by using an alternative objective for the generator.
However, it actually only changes the scalar ∇ f ( x ) ψ ( f ( x )) while the aforementioned problem in ∇ x f ∗ ( x ) still exists.
The least-squares GAN (Mao et al., 2016) is proposed to address the gradient vanishing problem, but it also focuses on ∇ f ( x ) ψ ( f ( x )) basically.
As we have discussed, the least-squares GAN also belongs to traditional GANs, which is not guaranteed to converge when
P g and P r are disjoint.
Arjovsky et al.
(2017) provided a new perspective on understanding the gradient vanishing problem.
They argued that gradient vanishing stems from the ill-behaving of traditional metrics, i.e., the distance between P g and P r remains constant when they are disjoint.
Wasserstein distance is thus proposed as an alternative metric, which can properly measure the distance between two distributions no matter they are disjoint or not.
However, as we will show next, Wasserstein distance may also suffer from the same problem on ∇ x f ∗ ( x ) , if a more compact dual form is used.
In summary, gradient vanishing is about the scalar term ∇ f ( x ) ψ ( f ( x )) in ∇ x J G ( x ) or the overall scale of ∇ x J G ( x ) , and in this paper we investigate its direction ∇ x f ∗ ( x ) , where the problem is so fundamental and challenging that even the Wasserstein distance, which can properly measure the distance for disjoint distributions, may also suffer from the same issue.
2. W ASSERSTEIN DISTANCE IN COMPACT DUAL FORM SUFFERS FROM THE SAME PROBLEM
The ( 1 st -)Wasserstein distance is a distance function deﬁned between two probability distributions:
[Equation]
where Π( P r , P g ) denotes the collection of all probability measures with marginals P r and P g on the ﬁrst and second factors, respectively.
Since solving it in the primal form (Eq.
(7)) is burdensome,
Wasserstein distance is usually solved in its dual form.
Though Wasserstein distance in its dual form is usually written with Lipschitz constraint, we here provide a more compact version.
The proof of this dual form can be found in Appendix I.
[Equation]
We leave the detailed discussion on the relationship between Lipschitz-continuity and Wasserstein distance in Section 4.4.
In Eq.
(8), we replace the strong Lipschitz constraint with a looser constraint.
Note that Eq.
(7) and Eq.
(8) are still equivalent.
With this dual form, we will demonstrate that a well-deﬁned distance metric, i.e., Wasserstein distance in this compacted dual form, may also suffer from the same problem in ∇ x f ∗ ( x ) and does not necessarily ensure the convergence of GANs.
We now study the optimal discriminative function f ∗ ( x ) of Wasserstein distance in this dual form.
Since there is generally no closed-form solution for f ∗ ( x ) in Eq.
(8), we use an illustrative example for demonstration here, but the conclusion is general.
Let Z ∼ U
[0 , 1] be a uniform variable on interval [0 , 1] , P g be the distribution of (1 , Z ) ∈ R 2 , and P r be the distribution of (0 , Z ) ∈ R 2 , as shown in Figure 1.
According to Eq.
(8), one of the optimal f ∗ is as follows
[Equation]
Though having the constraint “ f ( x ) − f ( y ) ≤ d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g ”, Wasserstein distance in this dual form also only deﬁnes the value of f ∗ ( x ) on the supports of P g and P r , and the values of f ∗ ( x ) on P g contain no useful information about the location of P r .
Therefore, if P g and P r are disjoint, ∇ x f ∗ ( x ) hardly provides useful information to the generator about “how to change P g into
P r ” and the generator is not guaranteed to converge to the case P g = P r .
It is worth noticing that the value of f ∗ ( x ) on the region other than the supports of P g and P d is still undeﬁned.
2. A WELL - DEFINED METRIC DOES NOT NECESSARILY GUARANTEE THE CONVERGENCE
The objectives of GANs are usually deﬁned as (or proved equivalent to) minimizing a distance metric between P g and P r , which implies that “ P g =
P r is the unique global optimum,” and is in accordance with the ﬁnal goal of the generative model, i.e., estimating the distribution of real samples.
However, in this section, we emphasize that a smooth distance metric satisfying “ P g =
P r is the optimum” is not enough for guaranteeing the convergence of GANs.
Given an objective is convex with respect to P g and holds the property that “ P g = P r is the unique optimum”, the convergence of GANs is guaranteed if only they are directly optimizing P g , i.e., “dragging” P g to P r .
However, what they actually do is using ∇ x f ∗ ( x ) as the guidance to optimize the generated samples.
As shown in previous sections, when P g and P r are disjoint, ∇ x f ∗ ( x ) , i.e., the direction that the generator follows for updating the generated samples, tells nothing about how to pull P g to P r .
In this way, the convergence of GANs are not necessarily guaranteed.
∇ x f ∗ ( x ) indeed indicates the direction of decreasing the objective in terms of the current f ∗ ( x ) , but updating x to make the value of f ∗ ( x ) increase / decrease does not necessarily imply that P g is getting closer to P r .
Recall that in the failure case of Wasserstein distance dual form in the above section, the values of f ∗ ( x ) on P g is zero , while the values of f ∗ ( x ) around P g is undeﬁned.
In conclusion, a smooth distance metric satisfying “ P g =
P r is the optimum” does not guarantee the convergence and sample updating according to ∇ x f ∗ ( x ) does not necessarily decrease the distance between P g and P r .
Therefore, if we use ∇ x f ∗ ( x ) for updating the generator, it is necessary to make ∇ x f ∗ ( x ) aware of how to pull P g to P r .
Alternative strategies actually exist, for example,
Sanjabi et al.
(2018) use the optimal transport plan (Seguy et al., 2017) between P g and P r to update the generator.
However, their results tend to be blurry.
In the next section, we will introduce the
Lipschitz constraint as a general solution for making ∇ x f ∗ ( x ) well-behaving and guaranteeing the convergence of ∇ x f ∗ ( x ) -based GANs.
A G ENERAL S OLUTION : L IPSCHITZ C ONDITION
Lipschitz-continuity constraint becomes popular in GANs recently as part of the discriminator’s objective (Arjovsky et al., 2017; Kodali et al., 2017; Fedus et al., 2017; Miyato et al., 2018), achieving great success.
In this section, we explain the signiﬁcance of Lipschitz constraint when introduced into the objective of the discriminator.
In a nutshell, under a board family of GAN objectives, Lipschitz constraint is able to connect P g and P r through f ∗ ( x ) such that when P r and P g are disjoint, ∇ x f ∗ ( x ) for each generated sample x ∼ P g will point towards some real sample y ∼ P r , which guarantees the trend that “ P g is getting closer to P r at every step”.
3. T HE MAIN RESULT
A function f : X → Y is k -Lipschitz continuous if it satisﬁes the following property:
[Equation]
where d X and d Y are distances metrics in domains X and Y , respectively.
The smallest constant k is called the Lipschitz constant of function f .
In this paper (and most GAN papers), d X and d Y are deﬁned as Euclidean distance.
We let (cid:107) y − x (cid:107) denote Euclidean distance.
As proved by Gulrajani et al.
(2017), when the Lipschitz condition is combined with Wasserstein distance, we have the following property if f ∗ ( x ) is differentiable, then
[Equation]
where x t = tx + (1 − t )
y , 0 ≤ t ≤ 1 , and π ∗ is the optimal π in Eq.
The meaning of this proposition is two-fold: (i) for each x ∼ P g , there exists a y ∼ P r such that ∇ x f ∗ ( x t ) =
y − x (cid:107) y − x (cid:107) for all linear interpolations x t between x and y ;
(ii) these ( x, y ) pairs match the optimal coupling π ∗ .
Next we introduce our theorem on the Lipschitz condition.
It turns out when combining the Lipschitz condition with generalized objectives, Property-(i) still holds and Property-(ii) is naturally dismissed as it is now not restricted to Wasserstein distance.
Theorem 1.
Let J D (cid:44) E x ∼ P g
[ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))] and ∂ x J D denotes P g ( x ) φ ( f ( x ))
+
P r ( x ) ϕ ( f ( x )) .
Let ¯ P r and ¯ P g denote the supports of P r and P g , respectively.
Assume f ∗ =
arg min f
[ J D + λ · k ( f ) 2 ] , where k ( f ) is the Lipschitz constant of f .
If φ ( x ) and ϕ ( x ) in J D satisfy
[Equation]
) then we have that
(a) ∀ x ∈ ¯ P g ∪ ¯ P r , ∃ y (cid:54) = x ∈ ¯ P g ∪ ¯ P r such that | f ∗ ( y ) − f ∗ ( x ) | =
k
( f ∗ ) · (cid:107) x − y (cid:107) or ∇ f ∗ ( x ) ∂ x J D = 0 ; (b) ∀ x ∈ ¯ P g ∪ ¯ P r − ¯ P g ∩ ¯ P r , ∃ y (cid:54) = x ∈ ¯ P g ∪ ¯ P r such that | f ∗ ( y ) − f ∗ ( x ) |
= k ( f ∗ ) · (cid:107) x − y (cid:107) ; (c) if ¯ P g = ¯ P r and P g (cid:54) =
P r , then ∃ x , ∃ y (cid:54) = x such that | f ∗ ( y ) − f ∗ ( x ) | = k
( f ∗ ) · (cid:107) x − y (cid:107) ; (d) the only Nash Equilibrium of J D + λ · k ( f ) 2 is reached when P g
=
P
r , where k ( f ) = 0 .
The above theorem states that when the Lipschitz condition is combined with an objective that satisﬁes Eq.
(12), then: (a) for the optimal discriminative function f ∗ ( x ) at any point x ∈ ¯ P g ∪ ¯ P r , it either is bounded by the Lipschitz constant or ∂ x J D holds a zero-gradient with respect to f ∗ ( x ) ; (b) for any point that only appears in ¯ P g or ¯ P r , there must exist a point that bounds this point in terms of | f ∗ ( y )
− f ∗ ( x ) |
= k ( f ∗ ) · (cid:107) x − y (cid:107) , because for these points, ∂ x J D will never get zero gradient with respect to f ∗ ( x ) as we prove in the Appendix G; (c) when P g and P r are totally overlapped, as long as P g still not converges to P r , there exists at least one pair ( x, y ) that bounds each other; (d) the only Nash Equilibrium among P g and f ∗ ( x ) under this objective is “ P g
= P r with k ( f ∗ )
= 0 .”
The formal proof is in Appendix G.
Wasserstein distance, i.e., φ ( x ) = ϕ ( − x ) = x is one instance that satisﬁes Eq.
and it is a very special case, which holds φ (cid:48)(cid:48)
( x ) = 0 and ϕ (cid:48)(cid:48)
( x ) = 0 .
Eq.
(12) is actually quite general and there exists many other settings, e.g., φ ( x ) =
ϕ
( − x ) = − log( σ ( − x )) , φ ( x ) = ϕ ( − x ) = x + √ x 2 +and φ ( x ) = ϕ ( − x ) = exp( x ) .
Generally, it is feasible to set φ ( x ) =
ϕ
( − x ) .
As such, to build a new objective, one only needs to ﬁnd a function that is increasing and has non-decreasing derivative.
See Figure 12.
In addition, all linear combinations of feasible ( φ, ϕ ) pairs also lie in the family.
It is worth noting that k ( f ) is also optimized here and it is actually necessary for Property-(c) and Property-(d).
This is the key difference when the Lipschitz condition is extended to general objectives.
The underlying reason for the need of also minimizing k ( f ) comes from the existence of case “ ∇ f ∗ ( x ) ∂ x J D = 0 for P g ( x ) (cid:54) =
P r ( x ) ”, which does not hold when the objective is Wasserstein distance.
Minimizing k ( f ) guarantees that the only Nash Equilibrium is “ P g
= P r with k ( f ∗ )
= 0 .”
On the other hand, if k ( f ) is not minimized towards zero, Wasserstein distance dual form based
GANs are not guaranteed to have zero gradient ∇ x f ∗ ( x ) at the convergence state P g
= P r .
It indicates that minimizing k ( f ) is also beneﬁcial to the Wasserstein GAN (Arjovsky et al., 2017).
3. L IPSCHITZ CONDITION CONNECTS P g AND P r THROUGH f ∗ ( x )
From Theorem 1, we know that for any point x , as long as ∂ x J D does not hold a zero gradient with respect to f ∗ ( x ) , f ∗ ( x ) must be bounded by another point y such that | f ∗ ( y )
− f ∗ ( x ) | =
k ( f ∗ ) · (cid:107) x − y (cid:107) .
We here further clarify that, when there is a bounding relationship, it must involve both real sample(s) and fake sample(s).
More formally, we have
Theorem 2.
If f ∗ = arg min f
[ J D + λ · k ( f ) 2 ] , then
• ∀ x ∈ ¯ P g , if ∃ z (cid:54) = x ∈ ¯ P g ∪ ¯ P r such that | f ∗ ( x ) − f ∗ ( z ) |
=
k
( f ∗ ) · (cid:107) x − z (cid:107) , then ∃ y (cid:54) =
x ∈ ¯ P r such that f ∗ ( y ) − f ∗ ( x ) =
k ( f ∗ ) · (cid:107) x − y (cid:107) , • ∀ y ∈ ¯ P r , if ∃ z (cid:54) =
y ∈ ¯ P g ∪ ¯ P r such that | f ∗ ( z ) − f ∗ ( y ) |
= k ( f ∗ ) · (cid:107) z − y (cid:107) , then ∃ x (cid:54) =
y ∈ ¯ P g such that f ∗ ( y ) − f ∗ ( x ) =
k ( f ∗ ) · (cid:107) x − y (cid:107) .
The intuition behind the above theorem is that samples from the same distribution, e.g., the fake samples, will not bound each other.
It is worth noticing that there might exist a chain of bounding relationships that involves a dozen of fake samples and real samples, and these points all lie in the same line and bounds each other.
Under the Lipschitz condition, the bounded line in the value surface of f ∗ is the basic building block that connects P g and P r , and each fake sample lies in one of the bounded lines.
Next we will further interpret the implication of bounding relationship and show that it guarantees meaningful ∇ x f ∗ ( x ) for all involved points.
3. L IPSCHITZ CONDITION ENSURES THE CONVERGENCE OF ∇ x f ∗ ( x ) - BASED GAN S
Recall that the proposition in Eq.
(11) states that ∇ x f ∗ ( x t ) =
y − x (cid:107)
y − x (cid:107) .
This is actually a direct consequence of bounding relationship between x and y .
We formally state it as follows:
Theorem 3.
Assume f
( x ) is differentiable and k -Lipschitz continuous.
∀ x (cid:54) =
y , if f ( y ) − f ( x ) = k · (cid:107) x − y (cid:107) , then ∇ x f ( x t ) =
k · y − x (cid:107) y − x (cid:107) , where x t = tx + (1 − t )
y for 0 ≤ t ≤ 1 .
In other words, if two points x and y bound each other in terms of f ( y ) − f ( x )=
k · (cid:107) x − y (cid:107) , there is a straight line between x and y in the value surface of f .
Any point in this line holds the maximum gradient slope k , and the direction of these gradient all point towards the x → y direction.
The proof is provided in Appendix D. Combining Theorem 1 and Theorem 2, we can conclude that when P g and P r are disjoint, ∇ x f ∗ ( x ) for each sample x ∼ P g points to a sample y ∼ P r , which guarantees that P g is moving towards P r .
In fact, Theorem 1 provides further guarantee on the convergence.
Property-(b) implies that for any x ∼ P g that does not lies in P r , ∇ x f ∗ ( x ) points to some real sample y ∼ P r .
In the fully overlapped case, according to Property-(c), unless P g = P r , there exists a pair ( x, y ) in bounding relationship and ∇ x f ∗ ( x ) pulls x towards y .
Property-(d) guarantees that the only Nash Equilibrium is “ P g
= P r .”
10 x 0.
p ( x ) realfake     f
* ( x ) (a) Original GAN    10 x 0.
p ( x ) 1.
f * ( x ) (b
[Figure]
Least Square GAN    10 x 0.
p ( x ) 0.4 0.
f * ( x ) (
[Figure]
GAN with uniform µ
E XTENSIONS AND D ISCUSSIONS 4. F ROM DISJOINT CASE TO OVERLAPPING CASE
In Section 2, we discuss the problem of f ∗ ( x ) and ∇ x f ∗ ( x ) in the case where P g and P r are disjoint.
In this section, we extend our discussion to the overlapping case.
In the disjoint case, we argue that “ f ∗ ( x ) on P g does not reﬂect any information about the location of other points in P r ” will lead to an unfeasible ∇ x f ∗ ( x ) and thus non-convergence.
In the overlapping and continuous case, things are actually different, f ∗ ( x ) around each point is also deﬁned, and its gradient ∇ x f ∗ ( x ) now reﬂects the local variation of f ∗ ( x ) .
For most traditional GANs, f ∗ ( x ) mainly reﬂects the local information about the density P g ( x ) and P r ( x ) .
However, it is worth noting that f ∗ ( x ) is usually an increasing function with respect to
P r ( x ) while a decreasing function with respect to P g ( x ) .
For instance, f ∗ ( x ) in the original GAN is log P r ( x ) /P
g ( x ) .
Optimizing the generator according ∇ x f ∗ ( x ) will move sample x towards the direction of increasing f ∗ ( x ) .
Because f ∗ ( x ) positively correlates with P r ( x ) and negatively correlated with P g ( x ) , it in sense means x is becoming more real.
However, such a local greedy strategy turns out to be a fundamental cause of mode collapse.
4. T HE CAUSE OF MODE COLLAPSE : THE LOCALITY OF f ∗ ( x ) AND ∇
Mode collapse is a notorious problem in GANs’ training, which refers to the phenomenon that the generator only learns to produce part of P r .
Many literatures try to study the source of mode collapse (Che et al., 2016;
Metz et al., 2016; Kodali et al., 2017; Arora et al., 2017) and measure the degree of mode collapse (Odena et al., 2016; Arora & Zhang, 2017).
The most recognized cause of mode collapse is that, if the generator is much stronger than the discriminator, it may learn to only produce the sample(s) in the local or global maximum of f ( x ) for the current discriminator.
This argument is true for most of GAN models.
However, from our perspective on f ∗ ( x ) and its gradient, there actually exists a much more fundamental cause of mode collapse, i.e., the locality of f ∗ ( x ) in traditional GANs and the locality of gradient operator ∇ .
In traditional GANs, f ∗ ( x ) is a function of local densities P g ( x ) and P r ( x ) , which is local, and the gradient operator ∇ is also a local operator.
As the result, ∇ x f ∗ ( x ) only reﬂects its local variations and cannot capture the statistic of P r and P g that is far from itself.
If f ∗ ( x ) in the surrounding area of x is well-deﬁned, ∇ x f ∗ ( x ) will move x towards the nearby location where the value of f ∗ ( x ) is higher.
It does not take the global status into account.
The typical result is that when fake samples get close to a mode of the P r , they move towards the mode and get stuck there (due to the locality).
Assume P r consists of two Gaussian distributions (A and B) that are distant from each other, while the current P g is uniformly distributed over its support and close to real Gaussian A.
In this case, ∇ x f ( x ) of all fake samples will point towards the center of Gaussian A.
If P g is a Gaussian with the same standard deviation as Gaussian A, ∇ x f ( x ) in original GAN and Least-Square GAN shows almost identical behaviors, which is illustrated in
Figure 2.
In Fisher GAN, if µ ( x ) is uniform, the case is even worse: a large amount of points that are relatively far from Gaussian A will move away from A (but the direction is not necessarily towards
B, though in our 1-D case it is).
This observation again supports our argument that “a well-deﬁned distance metric does not necessarily guarantee the convergence”, and the validity of ∇ x f ∗ ( x ) is still necessary even if P g and P r is continuous and overlapped.
4. E XPLANATION ON THE EMPIRICAL SUCCESS OF TRADITIONAL GAN S
Though traditional GANs does not have any guarantee on its convergence, it has already achieved its great success.
The reason is that having no guarantee does not mean it cannot converge.
It turns out extensive parameter-tuning actually increases the probability of the convergence.
As shown in Appendix A, hyper-parameters are important in inﬂuencing the value surface of f ∗ ( x ) .
Some typical settings (e.g., simpliﬁed neural network architecture, relu or leaky relu activation, relatively high learning rate, Adam optimizer, etc.) tend to form a relatively smooth value surface (e.g., monotonically increasing from P g to P r ), making ∇ x f ∗ ( x ) much more meaningful.
That is, one can ﬁnd these settings, where ∇ x f ∗ ( x ) or ∇ x f ( x ) is more favourable, to enable traditional
GANs to work.
In opposite, we have tried highly-nonlinear activation such as swish (Ramachandran et al., 2018) in the discriminator.
It turns out traditional GANs are very likely to fail.
In contrast, our proposed Lipschitz constraint based GANs are compatible with highly-nonlinear activation.
Another important empirical technique is to delicately balance the generator and the discriminator or limit the capacity of the discriminator.
This is to avoid the fatal optimal f ∗ ( x ) .
All these could possibly make traditional GANs work.
However, the consequence is that these GANs are very sensitive to hyper-parameters and hard to use.
4. T HE RELATION BETWEEN L IPSCHITZ CONDITION AND W ASSERSTEIN DISTANCE
Most literature presents the dual form of Wasserstein distance with the Lipschitz condition.
However, it is worth noticing that the Lipschitz condition is actually stronger than the necessary one in the dual form of Wasserstein distance.
Recall that in the dual form of Wasserstein distance, the constraint can be more compactly written as (introduced in Section 2.3 and proved in Appendix I)
[Equation]
However, it is usually written as 1-Lipschitz condition, which is
[Equation]
The key difference is that the constraint in Eq.
(13) restricts the range of x and y , but Lipschitz condition (Eq.
(14)) does not have the restriction on the range, thus the latter is the sufﬁcient condition of the former one.
It is also worth noticing that, though Lipschitz condition is stronger than the compact one, it does not affect the ﬁnal solution (Appendix I).
In other words, Lipschitz condition is a safe extension of the compact constraint.
And if the supports of P g and P r are the entire space,
Eq.
(13) and Eq.
(14) are actually identical; in such condition, Wasserstein distance in its dual form always works.
However, P g and P r are usually disjoint in GANs .
Therefore, using the strong
Lipschitz condition is necessary to ensure the validity of the dual form of Wasserstein distance in ∇ x f ∗ ( x ) -based updating, and the constraint in Eq.
(13) is not enough as shown in Section 2.3.
4. C ONTRIBUTION CLARIFICATION
This work is substantially different from Wasserstein GAN (Arjovsky et al., 2017).
Though the ﬁnal solution in Wasserstein GAN is sound, its main argument is off the point.
The main argument for the beneﬁt of Wasserstein distance in (Arjovsky et al., 2017) is that it can properly measure the distance between two distributions no matter whether their supports are disjoint, i.e., Wasserstein distance is a good distance metric.
However, according to our analysis in Section 2.4, a proper distance metric does not necessarily ensure the convergence of GAN; more speciﬁcally, Wasserstein distance in the dual form with compacted constraint also cannot provide meaningful gradient through ∇ x f ∗ ( x ) .
In addition, we have shown that Lipschitz constraint is able to ensure the convergence of GANs in a family of GAN objectives, which is not restricted to Wasserstein distance.
For example, Lipschitz constraint is also introduced to original GAN in (Miyato et al., 2018; Kodali et al., 2017) and shows improvements on the quality of generated samples.
As a matter of fact, the original GAN objective φ ( x ) = ϕ
( − x ) = − log( σ ( − x )) is another instance in our proposed family and thus our analysis explains why and how it works.
It is also worth noticing that J D in our formulation is not derived from any well-established distance metric; it is derived based on Lipschitz constraint.
As we have shown that a well-established distance or divergence does not necessarily ensure the convergence, we hope our trial could shed light on the new direction of GANs.
Last but no least, though we do not discuss the generator’s objective, our analysis indicates that the minimax in terms of ψ in Eq.
(1) is not essential, because it only inﬂuences the scale of the gradient.
Nevertheless, the function ψ does inﬂuence the updating of the generator, and we leave the detailed investigation as future work.
Another example that has a theoretically meaningful ∇ x f ∗ ( x ) is Coulomb GAN (Unterthiner et al., 2017), which is also derived neither from minimax game nor from well-deﬁned distance metric.
4. R ELATED WORK
Fedus et al.
(2017) also argued that divergence is not the primary guide of the training of GANs and pointed out that the gradient does not necessarily related to the divergence.
However, they tended to believe that original GAN with non-saturating generator objective can somehow work.
As we have proved before, given the optimal f ∗ , the original GAN has no guarantee on its convergence.
And we argue that practical work scenarios beneﬁt from parameter-tuning.
Some work study the suboptimal f ( x ) (Mescheder et al., 2017; 2018; Arora et al., 2017), which is another important direction for understanding GANs theoretically.
While the behaviors of suboptimal can be slightly different, we think the optimal f ∗ ( x ) should well-behave in the ﬁrst place.
Researchers also found that applying Lipschitz constraint to the generator also beneﬁts the quality of generated samples (Zhang et al., 2018;
Odena et al., 2018).
In addition, researchers also investigated implementation of Lipschitz constraint in GANs (Gulrajani et al., 2017; Petzka et al., 2017; Miyato et al., 2018).
However, this branch of related work is out of scope of the discussion in this paper.
E XPERIMENTS
In this section, we present the experiment results on our proposed objectives for GANs.
The anonymous code is provided at http://bit.ly/2Kvbkje .
5. V ERIFYING THE OBJECTIVE FAMILY AND ITS GRADIENT ∇ x f
[Figure]
We verify a set of φ and ϕ satisfying Eq.
(12): (a) φ ( x ) = ϕ ( − x ) =
x ; (b) φ ( x ) = ϕ
( − x ) = − log( σ ( − x )) ; (c) φ ( x ) = ϕ ( − x ) = x + √ x 2 + 1 ; (d) φ ( x ) = ϕ ( − x ) = exp( x ) .
As shown in
Figure 3, the gradient of each generated sample is towards a real sample.
We further verify ∇ x f ∗ ( x ) with the real-world data, using ten CIFAR-10 images as P r and ten noise images as P g to make the solving of f ∗ ( x ) feasible.
The result is shown in Figure 4, where
The leftmost in each row are the x ∼ P g and the second are their gradient ∇ x f ( x ) .
The interior are x + (cid:15) · ∇ x f ( x ) with increasing (cid:15) , which will pass through a real sample, and the rightmost are the nearest y ∼ P r .
This result visually demonstrates that the gradient of a generated sample is towards the direction of one real sample.
Note that the ﬁnal results of this experiment keep almost identical when varying the loss metric φ ( x ) and ϕ ( x ) in the family.
[Figure]
[Figure]
5. S TABILIZING f ∗ ( x ) WITH NEW O BJECTIVES
Wasserstein distance is a special case in our proposed family of objectives where φ (cid:48)(cid:48)
( x ) =
ϕ (cid:48)(cid:48)
( x ) = 0 .
As a result, f ∗ ( x ) under the Wasserstein distance objective where φ ( x ) = ϕ ( − x ) = x has a free offset, which means given a f ∗ ( x ) , f ∗ ( x ) + b with any b ∈ R is also an optimal.
In practice, this behaves as an oscillatory f ( x ) during training.
Any other instance of our new proposed objectives does not have this problem.
We illustrate this practical difference in Figure 5.
5. B ENCHMARK ON UNSUPERVISED IMAGE GENERATION TASKS
[Table]
Finally, we ﬁx ψ ( x ) = − x in the generator’s objective
and compare various objectives on unsupervised image generation tasks.
The results of Inception Score (Salimans et al., 2016) and Frechet
Inception Distance (Heusel et al., 2017b) are presented in Table 2.
We also include the hinge loss φ ( x ) =
ϕ
( − x ) = − min(0 , − x − 1) which used in (Miyato et al., 2018).
We use a classiﬁer on
Oxford 102 Flower Dataset for the evaluation of FID and Inception Score for results on Oxford 102.
The gradient of exp( x ) varies signiﬁcantly and
we ﬁnd it requires a small learning rate to avoid explosion.
The objectives x + √ x 2 + 1 and − log( σ ( − x )) achieve the best performances.
This is probably because they have bounded gradient and reduce the gradient of well-identiﬁed points towards zero, which enables the discriminator to pay more attention to these ill-identiﬁed.
Hinge loss − min(0 , − x − 1) does not lie in our proposed objective family and turns out to be unstable and performs unsatisfactory in same cases.
We also plot the training curve in terms of FID in Figure 6.
Due to page limitation, we leave the details, visual results and more experiments in the Appendix.
C ONCLUSION
In this paper we have shown that the fundamental cause of failure in training of GANs stems from the unreliable ∇ x f ∗ ( x ) .
Speciﬁcally, when P g and P r are disjoint, ∇ x f ∗ ( x ) for fake sample x ∼ P g tells nothing about P r , making it impossible for P g to converge to P r .
We have further demonstrated that even Wasserstein distance in a more compact dual form (still is equivalent to Wasserstein distance and can properly measure the distance between distributions) also suffers from the same problem when P g and P r are disjoint.
This implies that “whether a distance metric can properly measure the distance” does not yet touch the key of non-convergence of GANs.
We have highlighted in this paper that a well-deﬁned distance metric is not enough for guaranteeing the convergence of GANs because its ∇ x f ∗ ( x ) can be meaningless.
Therefore, if we update the generator based on ∇ x f ∗ ( x ) , we need to pay more attention on the design of f ∗ ( x ) .
Furthermore, to address the aforementioned problem, we have proposed the Lipschitz-continuity condition as a general solution to make ∇ x f ∗ ( x ) reliable and ensure the convergence of GANs, which works well with a large family of GAN objectives.
In addition, we have shown that in the overlapping case, ∇ x f ∗ ( x ) is also problematic which turns out to be an intrinsic cause of mode collapse in traditional GANs.
A E XPERIMENTS : THE INFLUENCE OF HYPER -P ARAMETERS
The value surface of traditional GANs is highly depended on the network and training hyperparameters.
We here plot the value surface of Least-Square GAN with various hyper-parameter settings, to give directly impression on how these parameters inﬂuence GANs training.
Not very strictly, but our empirical code is: (i) a low-capacity network tends to learn a simple surface; (ii)
SGD tends to learn a more complex surface than ADAM; (iii) large learning rate tends to learns a simpler surface than small learning rate; (iv) highly nonlinear activation function tends to result in more complex value surface.
Though hyper-parameters tuning could possibly make traditional GANs work, it also makes these
GANs hard to use, sensitive to hyper-parameters and easily broken.
[Figure]
( x
[Figure]
x |
[Figure]
[Table]
[Figure] [Table] [Table] [Table]
[Table] [Figure] [Table]
[Figure]
[Table]
[Figure] [Figure]
[Figure] [Figure]
| f
( x ) x | =4.01E2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
Case
[Figure]
samples
[Figure]
samples 2.0 1.
| f
( x ) x | =2.48E+ 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
[Figure]
[Figure] [Figure]
[Figure] [Figure]
| f
( x ) x | =2.85E2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
[Figure] [Figure]
samples 2.0 1.
| f
( x ) x | =2.35E+ 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
Case 3 real samples fake samples 2.0 1.
| f
( x ) x | =3.85E+ 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
Case 1 real samples fake samples 2.0 1.
| f
( x ) x | =4.09E2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
Case 2 real samples fake samples 2.0 1.
| f
( x ) x | =2.81E+ 2.0 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 1.
Case 3 real samples fake samples 2.0 1.
B V ARIOUS φ ( x ) AND ϕ ( x ) THAT SATISFIES E Q .
For Lipschitz constraint based GANs, φ ( x ) and ϕ ( x ) are required to satisfy Eq.
Eq.
(12) is actually quite general and there exists many other instances, e.g., φ ( x ) =
ϕ
( − x ) = x , φ ( x ) =
ϕ
( − x ) = − log( σ ( − x )) , φ ( x ) = ϕ ( − x ) = x + √ x 2 + 1 , φ ( x ) = ϕ ( − x ) = exp( x ) , etc.
We plot these instances of φ ( x ) and ϕ ( x ) in Figure 12.
Generally, it is feasible to set φ ( x ) =
ϕ
( − x ) .
Note that rescaling and offsetting along the axes are trivial operation to found more φ ( x ) and ϕ ( x ) within a function class, and linear combination of two or more φ ( x ) or ϕ ( x ) from different function classes also keep satisfying Eq.
[Figure]
[Figure] [Figure]
C G ENERATED IMAGES AND T RAINING C URVES
Training curves on Tiny ImageNet are plotted in Figure 13.
And comparisons on the visual results among different objectives are also provided in Figure 14, Figure 15 and Figure
[Figure]
[Figure] [Figure]
[Figure]
D P ROOF OF T HEOREM 3 AND THE N ECESSITY OF E UCLIDEAN DISTANCE
In this section, we delve deeply into the relationship between gradient properties and different norms in Lipschitz-continuity condition.
We will prove Theorem 3, i.e. Lipschitz continuity with l 2norm (Euclidean Distance) can guarantee the gradient direction of ∇ f ∗ ( x ) , and at the same time, demonstrate that the other norms do not have this property.
To start with, we give the proof of
Theorem 3 in the following.
Proof.
Let ( x, y ) be such that x (cid:54) =
y , and we deﬁne x t = x + t · ( y − x ) with t ∈ [0 , 1] .
We claim that: if f ( x ) is k-Lipschitz with respect to (cid:13)(cid:13) .
(cid:13)(cid:13) p and f ( y ) − f ( x ) =
k (cid:13)(cid:13) x − y (cid:13)(cid:13) p , then f ( x t ) =
f
( x ) + t · k (cid:13)(cid:13) x − y (cid:13)(cid:13) p .
As we know f ( x ) is k-Lipschitz, with the property of norms, we have f ( y )
[Equation]
f ( x ) =
f
( y )
[Equation]
f ( x t ) + f ( x t )
[Equation]
f ( x ) ≤
[Equation]
( y )
[Equation]
+
[Equation]
p =
[Equation]
( y
[Equation]
( x
[Equation]
+
[Equation]
(cid:107) p ≤
[Equation]
=
[Equation]
x
[Equation]
p +
[Equation] [Equation]
(cid:107) x − y (cid:107) p =
k (cid:107) x − y (cid:107) p .
Given f ( x ) − f ( y ) =
k (cid:107) x − y (cid:107) p , it implies all the inequalities need to be equalities.
Therefore, f ( x t ) = f ( x ) + t · k (cid:107) x − y (cid:107) p .
It is clear that: given f ( x ) is k-Lipschitz with respect to (cid:107) .
(cid:107) 2 , if f ( x ) is differentiable at x t , then (cid:107)∇ f ( x t ) (cid:107) 2 ≤ k .
With f ( x t )
=
f
( x ) + t · k (cid:107) x − y (cid:107) 2 , the directional derivative of f ( x ) on the direction v = y − x
[Equation]
y − x
[Equation]
2 at x t is equal to k ,
[Equation]
Note that (cid:107) v (cid:107)
= (cid:107)
y − x (cid:107) y − x (cid:107) 2 (cid:107) 2 = 1 , i.e. v is a unit vector.
Now,
[Equation]
As the equality holds only when ∇ f ( x t )
=
kv =
k y − x (cid:107) y − x (cid:107) 2 , we prove that ∇ f ( x t ) =
k y − x (cid:107)
y − x (cid:107) 2 .
Above proof utilizes the property that (cid:107)∇ f ( x t ) (cid:107) 2 ≤ k , which is derived from that f ( x ) is kLipschitz with respect to (cid:107) .
(cid:107) 2 .
However, other norms do not hold this property.
Speciﬁcally, according to the theory in (Shalev-Shwartz et al., 2012): if a convex and differentiable function f is k-Lipschitz over S with respect to norm (cid:107) .
(cid:107) p , then the Lipschitz continuity actually implies a bound on the dual norm of gradients, i.e. (cid:107)∇ f (cid:107) q ≤ k .
Here (cid:107) .
(cid:107) q is the dual norm of (cid:107) .
(cid:107) p , which satisﬁes the equation that 1 p + 1 q = 1 .
As we could notice, a norm is equal to its dual norm if and only if p = 2 .
Switching to l p -norm with p (cid:54) =
2 , it is actually bounding the l q -norm of the gradients.
However, bounding the l q -norm of the gradients does not guarantee the gradient direction at fake samples point towards real samples.
A counter-example is provided as follows.
Consider a function g ( x, y )
=
x + y on R 2 .
∀ p 1 = ( x 1 , y 1 ) , p 2 = ( x 2 , y 2 ) , there is g ( p 1 ) − g
( p 2 )
=
g ( x 1 , y 1 ) − g ( x 2 , y 2 ) =
( x 1 − x 2 )
+( y 1 − y 2 ) ≤ | x 1 − x 2 | + | y 1 − y
| = (cid:107) p 1 − p 2 (cid:107) 1 , which means g is a 1-Lipschitz function with respect to l 1 -norm.
According to above analysis, the dual norm of ∇ g is bounded, i.e. (cid:107)∇ g (cid:107) ∞ ≤ 1 .
Actually ∇ g is equal to (1 , 1) at every point in R 2 with (cid:107)∇ g (cid:107) ∞ = 1 .
Selecting two points A =(0 , 0) and B =(2 , 1) , we have g ( A ) − g
( B )= (cid:107) A − B (cid:107) 1 , however, ∇ g ( A ) =(1 , 1) is not pointing towards B .
E O N THE IMPLEMENTATION OF K -L IPSCHITZ FOR GAN S
Typical techniques for enforcing k-Lipschitz includes: spectral normalization (Miyato et al., 2018), gradient penalty (Gulrajani et al., 2017), and Lipschitz penalty (Petzka et al., 2017).
Before moving into the detailed discussion of these methods, we would provide several important notes in the ﬁrst place.
Firstly , enforcing k-Lipschitz in the blending-region of P g and P r is actually sufﬁcient.
Deﬁne
B ( µ, ν ) =
{ ˆ x = x · t + y · (1 − t ) | x ∼ µ ∧ y ∼ ν ∧ t ∈ [0 , 1] } .
It is clear that f ( x ) is 1-Lipschitz in
B ( µ, ν ) implies f ( x ) − f ( y )
≤ d ( x, y ) , ∀ x ∈ µ, ∀ y ∈ ν .
Thus, it is a sufﬁcient constraint for
Wasserstein distance in Eq. 8.
In fact, f ( x ) is k-Lipschitz in B ( P g , P r ) is also a sufﬁcient condition for all properties described in Lipschitz constraint based GANs (Section 3).
Secondly , enforcing k-Lipschitz with regularization would provide a dynamic Lipschitz constant k .
Theorem 4.
With Wasserstein GAN objective, we have min
[Equation]
Assuming we know and can control the Lipschitz constant k of f ( x ) , by introducing a loss, saying square loss, on k respecting to a constant k 0 , the total loss of the discriminator (critic) becomes
J ( k ) (cid:44) min
f ∈F k-Lip J D ( f ) + λ · ( k − k 0 ) 2 .
With Lemma 4, let α =
− min
f ∈F 1-Lip J D ( f ) , then
J ( k ) =
− k · α + λ · ( k − k 0 ) 2 , and J ( k ) achieves its minimum when k = α 2 λ + k 0 .
When α goes to zero, i.e. P g converges to P r , the optimal k decreases.
And when P g = P r , we have α = 0 and optimal k = k 0 .
We choose k 0 = 0 in our experiments.
The similar analysis applies to Lipschitz constraint based GANs and we use λ · k 2 to enforcing k-Lipschitz for general Lipschitz constraint based GANs.
For practical methods , though spectral normalization (Miyato et al., 2018) recently demonstrates their excellent results in training GANs, spectral normalization is an absolute constraint for Lipschitz over the entire space, i.e., constricting the maximum gradient of the entire space, which is unnecessary.
On the other side, we also notice both penalty methods proposed in (Gulrajani et al., 2017) and (Petzka et al., 2017) are not the exactly implementing the Lipschitz continuity condition, because it does not simply penalty the maximum gradient, but penalties all gradients towards 1, or penalties all these greater than one towards 1.
We found in our experiments that the existing methods including spectral normalization (Miyato et al., 2018), gradient penalty (Gulrajani et al., 2017), and Lipschitz penalty (Petzka et al., 2017) all fail to converge to the optimal f ∗ ( x ) in many of our synthetic experiments.
We thus developed a new method for enforcing k-Lipschitz and we found in our experiments that the new method stably converges to the optimal f ∗ ( x ) .
[Figure]
The new method.
Note that the practical methods of imposing k-Lipschitz is not the key contribution of this work, and it is far from well-validated.
We plan a further work on this topic for a more rigorous study.
But for the necessity for understanding our paper and reproducing of experiments, we introduce it as follows.
Combining the idea of spectral normalization and gradient penalty, we developed an new regularization for Lipschitz continuity in our experiments.
Spectral normalization is actually constraining the maximum gradient over the entire space.
And as we argued previously, enforcing Lipschitz continuity in the blending region is sufﬁcient.
Therefore, we propose to restricting the maximum gradient over the blending region:
[Equation] [Equation]
In practice, we sample ˆ x from training batch as in (Gulrajani et al., 2017; Petzka et al., 2017).
To improve the stability and reduce the biased introduced via batch sampling, we propose the keep track ˆ x with the maximum (cid:13)(cid:13) ∇ f ( x ) (cid:13)(cid:13) 2 .
A practical and light weight method is to maintain a list
S max that has the currently highest (top-k) (cid:13) (cid:13) ∇ f ( x ) (cid:13) (cid:13) 2 (initialized with random ˆ x samples), using the S max as part of the batch estimation of J maxgp , and update the S max after each batch updating of the discriminator.
In our experiment, S max takes 1/2 batch, and the remaining 1/2 batch are random sampled.
S max always keeps track of the maximal 1/2 samples in the batch.
We compare the practical result of gradient penalty E ˆ x ∼ B
[ (cid:13)(cid:13) ∇ f ( x ) (cid:13)(cid:13) 2 2 ] and the proposed maximum gradient penalty in Figure 18.
Before switching to maximum gradient penalty, we struggled for a long time and cannot achieve a high quality result as showed in Figure 18b.
The other forms of gradient penalty (Gulrajani et al., 2017; Petzka et al., 2017) perform similar as E ˆ x ∼ B [ (cid:13)(cid:13) ∇ f ( x ) (cid:13)(cid:13) 2 2 ] .
F D ISCUSSION ON N O -D IFFERENTIABLE f ∗ ( x )
If f ∗ ( x ) is k-Lipschitz and f ∗ ( y ) − f ∗ ( x )
=
k · d ( x, y ) , we say that ( x, y ) are coupled.
When a sample x is coupled with more than one y and these y lie in different directions of x , f ∗ ( x ) is non-differentiable at x and it will has sub-gradient along each direction.
When the f ∗ ( x ) non-differentiable, due to the smoothness of practically-used neural network, as we noticed in the experiments, it usually behaviors as that the gradient direction is pointing in the middle of these sub-gradient (more strictly, a linear combination of these sub-gradients).
It seems that when the P g is discrete (simulating discrete token generation, such as language and music), it is easy to become non-differentiable: in the optimal transport perspective, once it is required to move to more than one targets, f ∗ ( x ) is non-differentiable at this point.
One way to alleviate this above problem is adding noise (e.g. Gaussian) to each discrete token from P g .
The discrete token with different noises now disperse to different targets.
In the practical generator for continuous token, such as images, this kind of non-differentiable problem naturally get solved.
The more serious non-differentiable problem traces back to the Monge problem (Villani, 2008), which theoretically discussed under which condition the optimal transport is a one-one mapping, which by nature solve the non-differentiable problem, as each sample now has a single target.
However, for the Monge problem is solvable, i.e. the mapping from P g and P r is one-one, it requires the d ( x, y ) to be a strictly convex and super-linear (Villani, 2008).
Unfortunately, the Euclidean distance, which is necessary to ensure the gradient direction from fake sample directly points toward real sample, does not ﬁt this condition.
So we currently does not ﬁgure out a practical solution to take advantage of the Monge problem related theories.
Nonetheless, even if f ∗ ( x ) is non-differentiable, the gradient is also usually somehow pointing towards the real samples.
And the empirical founding is that: when the P g get close to P r , the non-differentiable problem diminishes.
G P ROOF OF THE T HEOREM
Let J D = E x ∼ P g
[ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))]
= (cid:82) P g ( x ) φ ( f ( x ))
+ P r ( x ) ϕ
( f ( x )) dx.
Let ∂ x J D denotes P g ( x ) φ ( f ( x ))
+ P r ( x ) ϕ
( f ( x )) .
It has J D
= (cid:82) ∂
x J D dx .
Deﬁne J =
J D + λ · k ( f ) 2 , where k ( f ) is Lipschitz constant of f ( x ) . Let f ∗ ( x ) = arg min f [ J D + λ · k ( f ) 2 ] .
Let J ∗ D ( k ) =
min f ∈F k -Lip J D
=
min
f ∈F 1-Lip ,b E x ∼ P g [ φ ( k · f ( x )+ b )] + E x ∼ P r [ ϕ ( k · f ( x )+ b )] .
Lemma 1.
{+∀ x, ∂ [ ∂ x J D ] ∂f ∗ ( x ) = 
+}
if and only if k ( f ∗ ) = 0 .
Proof.
(i [Equation] implies k [Equation]
= 0 .
For the optimal f ∗ ( x ) , it holds that
[Equation]
[Equation]
0 implies ∂J
[Equation]
D [Equation]
f
[Equation]
) = 0 .
We thus conclude that k ( f ∗ ) = 0 .
(ii)
[Equation] f
[Equation] = 0 implies ∀ x,
[Equation]
For the optimal f ∗ ( x ) , it holds that [Equation]
So
[Equation] 0 implies ∂J ∗ D ∂k ( f ∗ ) = 0 .
k ( f ∗ ) = 0 also implies ∀ x, y, f ∗ ( x ) =
f ∗ ( y ) .
If there exists some point x such that ∂ [ ∂ x J D ] ∂f ∗ ( x ) (cid:54) = 0 , then, given ∀ x, y, f ∗ ( x ) = f ∗ ( y ) , it is obviously that ∂J ∗ D
∂k
( f ∗ ) (cid:54) = 0 .
It is contradictory to ∂J ∗ D
∂k ( f ∗ )
= 0 .
Thus we has ∀ x, ∂ [ ∂ x J D ] ∂f ∗ ( x ) = 0 .
Lemma 2.
If ∀ x, y, f ∗ ( x ) = f ∗ ( y ) , then P g
=
P
r .
Proof.
∀ x, y, f ∗ ( x ) = f ∗ ( y ) implies k ( f ∗ )
= 0 .
According to Lemma 1, ∀ x, ∂ [ ∂ x J D ] ∂f
[Equation]
( x [Equation] =
P
[Equation]
[Equation]
∂f ∗ ( x ) , and thus P g ( x ) P r ( x ) has a constant value, which straightforwardly implies P g
= P r .
Proof of Theorem 1 .
(i)
Considering the f ∗ ( x ) , ∀ x ∈ ¯ P g ∪ ¯ P r , if there does not exist a y such that | f ∗ ( y ) − f ∗ ( x ) |
= k ( f ∗ ) ·
d ( x, y ) , because f ∗ ( x ) is the optimal, it must hold that ∂
[ ∂ x J D ] ∂f ∗ ( x ) =
.(ii)
For x ∈ ¯ P g ∪ ¯ P r − ¯ P g ∩ ¯ P r , assuming P g ( x ) (cid:54) = 0 and P r ( x ) = 0 , we have ∂ [ ∂ x J D ]
∂f ∗ ( x ) =
P g
[Equation]
x
[Equation]
> 0 , because P g ( x ) > 0 and ∂φ ( f ∗ ( x ))
∂f ∗ ( x ) > 0 .
Then, according to (i), there must exist a y such that | f ∗ ( y ) − f ∗ ( x ) |
= k ( f ∗ ) ·
d ( x, y ) .
The other situation can be proved in the same way.
(iii)
According to Lemma 2, in this situation that P g (cid:54) =
P r , for the optimal f ∗ ( x ) , there must exist at least one pair of points x and y such that x (cid:54) =
y and f ∗ ( x ) (cid:54) =
f ∗ ( y ) .
If there are no x and y satisfying that | f ∗ ( y ) − f ∗ ( x ) |
= k ( f ∗ ) · d ( x, y ) , it will be contradictory to that f ∗ ( x ) is optimal, because we can construct a better f ∗ by decreasing the value of k ( f ) until there are two points, e.g. x and y , constrained by Lipschitz constraint, i.e. | f ∗ ( y ) − f ∗ ( x ) |
= k ( f ∗ ) ·
d ( x, y ) .
(iv) In Nash Equilibrium state, it holds that, for any x ∈ ¯ P g ∪ ¯ P r , ∂J∂k ( f ) =
∂J ∗ D ∂k ( f ) +2 λ · k ( f ) = 0 and ∂ [ ∂ x J D ]
∂f ( x ) ∂f ( x ) ∂x = 0 .
We claim that in the Nash Equilibrium state, the Lipschitz constant k ( f ) must be 0.
If k ( f ) (cid:54) = 0 , according to Lemma 1, there must exist a point ˆ x such that ∂ [ ∂ ˆ x J D ] ∂f
(ˆ x ) (cid:54) = 0 .
And according to (i), it must hold that ∃ ˆ y ﬁtting | f
(ˆ y ) − f (ˆ x ) | = k ( f ) · d (ˆ x, ˆ y ) .
According to Theorem 3, we have (cid:13)(cid:13)
∂f ( x ) ∂x (cid:12)(cid:12) x
=ˆ x (cid:13)(cid:13) 2 = k
( f ) (cid:54)
= 0 .
This is contradictory to that ∂
[ ∂ x J D ] ∂f ( x ) ∂f ( x ) ∂x (cid:12)(cid:12) x
=ˆ x = 0 .
Thus k ( f ) = 0 , that is, ∀ x ∈ ¯ P g ∪ ¯ P r , ∂f ( x ) ∂x = 0 , which means ∀ x, y, f ( x ) =
f
( y ) .
According to
Lemma 2, ∀ x, y, f ( x ) =
f ( y ) implies P g
= P r .
Thus P g =
P r is the only Nash Equilibrium of our system.
Remark:
For the Wasserstein distance, ∂ [ ∂ x J D ] ∂f ∗ ( x ) = 0 if and only if P g ( x ) =
P r ( x ) .
For the Wasserstein distance, penalizing the Lipschitz constant also beneﬁts: at the convergence state, it holds ∂f ∗ ( x ) ∂x = 0 .
H O N THE IMPORTANCE OF E Q .
Requiring φ ( x ) and ϕ ( x ) to satisfy Eq.
12 is important, because it is the non-trivial condition that makes sure E x ∼ P g
[ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))]
+ λ · k ( f ) 2 has attainable global minimum with respect to f .
Theorem 5.
If φ ( x ) and ϕ ( x ) satisﬁes Eq.
12, then for any ﬁxed P g and P r , E x ∼ P g [ φ ( f ( x ))]
+
E x ∼ P r [ ϕ ( f ( x ))] + λ · k ( f ) 2 has an lower bound with respect to f . Proof. Given ∃ a, φ (cid:48) ( a ) + ϕ (cid:48) ( a ) = 0 , φ (cid:48)(cid:48) ( x ) ≥ 0 and ϕ (cid:48)(cid:48) ( x ) ≥ 0 , we have:
E
[Equation]
f )
[Equation]
a
[Equation]
) −
[Equation]
a )
[Equation]
E
[Equation]
P
[Equation]
ϕ
[Equation]
[Equation]
Theorem 5 implies that there exists an inﬁmum for E x ∼ P g
[ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))]
+ λ · k ( f ) 2 . According to the deﬁnition of inﬁmum, there exists a sequence of { f n } ∞ n =1 such that E x ∼ P [Equation] [ φ
[Equation]
x )
[Equation]
[Equation]
E x ∼
[Equation]
r
[Equation]
ϕ [Equation] [Equation] 2 inﬁnitely approaches the inﬁmum.
We further present several simply Lemmas.
These Lemmas and their proofs would provide some intuitive impressions on why Eq.
12 is necessary and the properties of proposed objectives.
Lemma 3.
Assuming P g and P r are two delta distributions.
If φ ( x ) and ϕ ( x ) satisﬁes Eq.
12, then for any ﬁxed P g and P r , E x ∼ P g [ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))] has global minimum with respect to f , for any ﬁxed k ( f )
=
ˆ k .
Proof.
Given P g and P r are two delta distributions, according to Theorem 1 and Theorem 2, for x ∼ P g and y ∼ P r , f ∗ ( y ) − f ∗ ( x ) =
ˆ k · d ( x, y ) .
Let f ∗ ( x ) =
α and β
= ˆ k · d ( x, y ) , then f ∗ ( y ) =
α + β . Deﬁne J D ( α ) =
E x ∼ P g [ φ ( f ( x ))] + E x ∼ P r [ ϕ ( f ( x ))] =
φ ( α ) + ϕ ( α + β ) . Given ∃ a such that φ (cid:48) ( a )+ ϕ (cid:48) ( a ) = 0 , φ (cid:48)(cid:48) ( x ) ≥ 0 and ϕ (cid:48)(cid:48) ( x ) ≥ 0 , we have, when α is small enough (such that, α < a
and α + β < a ), J (cid:48) D ( α ) =
φ (cid:48)
( α )+ ϕ (cid:48) ( α + β ) ≤ φ (cid:48)
( a )+ ϕ (cid:48) ( a ) = 0 .
Similarly, when α is large enough (such that, α > a and α + β > a ), J (cid:48) D ( α )
=
φ (cid:48)
( α )+ ϕ (cid:48) ( α + β ) ≥ φ (cid:48) ( a )+ ϕ (cid:48) ( a ) = 0 .
Therefore, J D ( α ) is convex with respect to α and there exists an α 0 such that J (cid:48) D ( α 0 )
= 0 , where
J D achieves its the global minimum.
When φ (cid:48)(cid:48) ( x ) > 0 and ϕ (cid:48)(cid:48) ( x ) > 0 , it is the unique global minimum.
Lemma 4.
Assuming P g and P r are two delta distributions.
If φ ( x ) and ϕ ( x ) satisﬁes Eq.
12, then for any ﬁxed P g and P r , E x ∼ P g [ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))] monotonically increases as k ( f ) decreases.
Proof.
Given P g and P r are two delta distributions, according to Theorem 1 and Theorem 2, for x ∼ P g and y ∼ P r , f ∗ ( y ) − f ∗ ( x )
=
k · d ( x, y ) .
Let f ∗ ( x ) =
α and β =
k · d ( x, y ) > 0 , then f ∗ ( y ) =
α + β .
Deﬁne J D ( β ) =
min f ∈F k-Lip E x ∼ P g [ φ ( f ( x ))]
+ E x ∼ P r [ ϕ ( f ( x ))]
= min
α φ ( α ) + ϕ ( α + β ) .
We need to prove J D ( β ) is monotonically decreasing, for β ≥ 0 .
Let 0 ≤ β 1 < β 2 , let α 1 =
min
α φ ( α ) + ϕ ( α + β 1 ) and α 2 = min
α φ ( α ) + ϕ ( α + β 2 ) .
Given ϕ (cid:48) ( x ) < 0 and β 1 < β 2 , we have φ ( α 1 ) + ϕ
( α 1 + β 1 ) > φ ( α 1 ) + ϕ ( α 1 + β 2 ) .
Given α 2 = min
α φ ( α ) + ϕ ( α + β 2 ) , we further have φ ( α 1 ) + ϕ ( α 1 + β 1 ) >
φ ( α 1 ) + ϕ ( α 1 + β 2 ) ≥ φ ( α 2 ) + ϕ ( α 2 + β 2 ) .
Done.
Additionally , with φ (cid:48) ( α 1 ) + ϕ (cid:48) ( α 1 + β 1 ) = 0 and ϕ (cid:48)(cid:48)
( x ) ≥ 0 , we have φ (cid:48)
( α 1 ) + ϕ (cid:48) ( α 1 + β 2 ) ≥ 0 .
Providing φ (cid:48) ( α 2 ) + ϕ (cid:48) ( α 2 + β 2 ) = 0 , φ (cid:48)(cid:48) ( x ) ≥ 0 and ϕ (cid:48)(cid:48) ( x ) ≥ 0 , we get α 2 ≤ α 1 .
That is, α 2 ≤ α 1 < β [Table]
[Table] [Table]
I P ROOF ON THE DUAL FORM OF W ASSERSTEIN DISTANCE
We here provide a formal proof for our new dual form of Wasserstein distance.
The Wasserstein distance is given as follows:
[Equation]
where Π( P r , P g ) denotes the collection of all probability measures with marginals P r and P g on the ﬁrst and second factors respectively.
The dual form of Wasserstein distance is usually written as:
[Equation]
We will prove that Wasserstein distance in its dual form can also be written as:
[Equation]
which means the constraint in the dual form of Wasserstein distance can be more compact than the common formulation.
With the compacted formulation, we argued that a well-deﬁned metric, i.e., J ( P r , P g ) , which is equivalent to Wasserstein distance W 1 ( P r , P g ) and thus can properly measure the distance between two distributions, may also fail to provide a meaningful ∇ x f ∗ ( x ) .
This observation indicates that a well-deﬁned distance metric does not necessarily guarantee a meaningful ∇ x f ∗ ( x ) and thus does not guarantee the convergence of ∇ x f ∗ ( x ) -based GANs.
I. P ROVING THE EQUIVALENCE
Theorem 6.
Given I ( P r , P g )
=
W 1 ( P r , P g ) 5 , we have I ( P r , P g ) =
J ( P r , P g )
=
W 1 ( P r , P g )
Proof.
(i) For any f that satisﬁes “ f ( x ) − f ( y )
≤ d ( x, y ) , ∀ x, ∀ y ”, it must satisfy “ f ( x ) − f ( y ) ≤
d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g ”.
Thus, I ( P r , P g ) ≤ J ( P r , P g ) .
(ii) Let F J =
{ f | f ( x ) − f ( y ) ≤
d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g } .
Let A = { ( x, y )
| x ∼ P r , y ∼ P g } and I A
= (cid:26) 1 , ( x
, y ) ∈ A ; 0 , otherwise .
Let A c denote the complementary set of A and deﬁne I
A c accordingly.
∀ π ∈ Π( P r , P g )
We have the following:
[Equation]
≤ E ( x [Equation] ) ∼ π [ [Equation]
( x
[Equation]
y ) I A ] ≤ E ( x [Equation] y ) ∼ π [ d ( x
[Equation]
y )] .
J ( P r , P g ) ≤ E ( x,y ) ∼ π
[ d ( x, y )] , ∀ π ∈ Π( P r , P g )
⇒ J ( P r , P g ) ≤ inf π ∈ [Equation] ( P r ,P g [Equation]
E
[Equation] x,y ) [Equation] x
[Equation] y ) [Equation] = W
[Equation]
P [Equation] P g ) . (iii) Combining (i) and (ii), we have I ( P r , P g ) ≤ J ( P r , P g ) ≤ W 1 ( P r , P g ) .
Given I ( P r , P g ) =
W 1 ( P r , P g ) , we have I ( P r , P g ) =
J ( P r , P g )
=
W 1 ( P r , P g ) .
[Equation]
Let ¯ P r and ¯ P g denote the supports of P r and P g , respectively.
Because ∀ π ∈ Π( P r , P g ) , it must hold that π ( x, y ) =
for any ( x, y ) that outside ¯ P r × ¯ P g , i.e., P r ( x ) = 0 or P g ( y ) = 0 implies π ( x, y )
= 0 .
We let Γ( ¯ P r × ¯ P g ) denote the collection of all probability measures that deﬁned on ¯
P r × ¯ P g with marginals P r and P g on the ﬁrst and second factors respectively.
Let M + ( ¯ P r × ¯ P g ) be the collection of all non-negative measures (not necessarily probability measures) on ¯ P r × ¯ P g .
Before the proof, we would like to give several preliminary notes.
• A more formal and detailed proof for Kantorovich duality with same logic of justiﬁcation can be found in Theorem 2.3 of (Zemel, 2012).
And a more relevant version that focused on Wasserstein distance can be found in this blog 6 .
• The key change here is that we handle the support of P r and P g more carefully, which results in elimination of the unnecessary constraints f ( x ) − f ( y )
≤ d ( x, y ) that involve ( x, y ) pair where P r ( x ) = 0 or P g ( x ) = 0 .
• The validity of the use of the minimax-principle , i e., invert the order of inf and sup , in this case, is proved in (Zemel, 2012) and the blog.
Theorem 7.
J ( P r , P g )
=
W 1 ( P r , P g )
Proof.
[Equation]
− ( f ( x ) − f ( y ))]
π ( x, y ) dxdy (cid:105) =
sup f (cid:104) E s ∼ P
r
[ f ( s )]
− E t ∼ P g [ f ( t )] + (cid:26) 0 , f ( x ) − f ( y ) ≤ d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g −∞ , otherwise (cid:105) =
sup f E s ∼ P
r
[ f ( s )]
− E t ∼ P g [ f ( t )] , s.t. f
( x ) − f ( y ) ≤
d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g .
I
A NOTHER PERSPECTIVE : ELIMINATING REDUNDANT CONSTRAINT
To provide a more comprehensive understanding on why constraint f ( x ) − f ( y )
≤ d ( x, y ) that involves point ( x, y ) where P r ( x ) = 0 or P g ( x ) = 0 is unnecessary, we here give a intuitive explanation in the following way: one can safely remove all constraints that does not involve any point in the support of P g and P r , because give f ( x ) − f ( y ) ≤ d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g , it is sufﬁcient to bound the value of f ( x ) for x ∼ P r and f ( y ) for y ∼ P g .
In other words, given the existence of constraint f ( x ) − f ( y ) ≤ d ( x, y ) , ∀ x ∼ P r , ∀ y ∼ P g , the other constraints can be safely eliminated without affecting the ﬁnal solution.
J C ONNECTIONS WITH O PTIMAL T RANSPORT
The 1 st -Wasserstein distance, also named as the Earth Mover’s distance, is a special form of optimal transport (Villani, 2008), which measures the minimal cost of moving the source distribution to the target distribution, and the optimal coupling π ( x, y ) describes the transport plan, i.e. how much density we should move from x to y .
Naturally, updating the generator according to the optimal coupling would pull P g towards P r .
However, updating the generator according to the optimal coupling π ( x, y ) is a totally different mechanism for training GANs.
In typical GANs, we update the generator following ∇ x f ∗ ( x ) .
An interesting fact 7 is that when updating the generator according to ∇ x f ∗ ( x ) , it follows the optimal coupling π if and only if there is Lipschitz constraint and the d ( x, y ) represents the Euclidean distance.
In general optimal transport, the d ( x, y ) is not required to be a distance and can be any cost function.
To the best knowledge of the authors, it is hard to access the coupling information from ∇ x f ∗ ( x ) if d ( x, y ) is arbitrary.
However, fortunately, given the optimal coupling π , directly updating each sample towards its target is also possible.
An instance of this line of work can be found in (Sanjabi et al., 2018), where the objective (Seguy et al., 2017) of generator is E x ∼ P g
[ E y ∼ π ( ·| x )
[ d ( x, y )]] .
In summary, we think training GANs with optimal mapping and with Lipschitz constraint are two mechanisms with different underlying principles, and Wasserstein GAN in the Lipschitz dual form with Euclidean distance is the connecting point.
K H YPER - PARAMETER & N ETWORK A RCHITECTURE
We follow the network architecture proposed in (Gulrajani et al., 2017) to conduct our experiments on CIFAR-10, Tiny Imagenet, Oxford 102.
The details of network architecture are in Table 3.
[Table]