Wasserstein GAN | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
1 引言2 不同距离例 1(学习平行直线)。 设 $Z\sim U[0,1]$ 为单位区间上的均匀分布。令 $\mathbb{P}{0}$ 为 $(0,Z)\in\mathbb{R}^{2}$ 的分布($x$ 轴为 0,$y$ 轴为随机变量 $Z$),即过原点的竖直直线上的均匀分布。再令 $g{\theta}(z)=(\theta,z)$,其中 $\theta$ 为单一实参数。容易看出此时定理 1。 设 $\mathbb{P}{r}$ 为 $\mathcal{X}$ 上的固定分布。设 $Z$ 为另一空间 $\mathcal{Z}$ 上的随机变量(例如高斯)。设 $g:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}$ 为函数,记第一坐标为 $z$、第二坐标为 $\theta$ 时写作 $g{\theta}(z)$。令 $\mathbb{P}{\theta}$ 表示 $g{\theta}(Z)$ 的分布。则证明。 见附录 C ∎推论 1。 设 $g{\theta}$ 为任意由 $\theta$ 参数化的前馈神经网络[^4],$p(z)$ 为 $z$ 上的先验且 $\mathbb{E}{z\sim p(z)}[\|z\|]<\infty$(例如高斯、均匀等)。则假设 1 成立,因而 $W(\mathbb{P}{r},\mathbb{P}{\theta})$ 处处连续且几乎处处可微。证明。 见附录 C ∎定理 2。 设 $\mathbb{P}$ 为紧空间 $\mathcal{X}$ 上的分布,$(\mathbb{P}{n}){n\in\mathbb{N}}$ 为 $\mathcal{X}$ 上的分布序列。以下极限均指 $n\to\infty$ 时,证明。 见附录 C ∎3 Wasserstein GAN定理 3。 设 $\mathbb{P}{r}$ 为任意分布。设 $\mathbb{P}{\theta}$ 为 $g{\theta}(Z)$ 的分布,其中 $Z$ 有密度 $p$,且 $g{\theta}$ 满足假设 1。则问题证明。 见附录 C ∎4 实验结果4.1 实验设定4.2 有意义的损失度量4.3 稳定性提升5 相关工作6 结论致谢参考文献附录 A 为何 Wasserstein 确实更弱附录 B 假设的定义假设 1。 设 $g:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}$ 为有限维向量空间之间的局部 Lipschitz 映射。在坐标 $(z,\theta)$ 上的取值记为 $g{\theta}(z)$。若存在局部 Lipschitz 常数 $L(\theta,z)$ 使得附录 C 证明定理 1 的证明。 设 $\theta$ 与 $\theta^{\prime}$ 为 $\mathbb{R}^{d}$ 中两个参数向量。我们先尝试界住 $W(\mathbb{P}{\theta},\mathbb{P}{\theta^{\prime}})$,定理将由此容易得出。证明的关键要素是使用耦合 $\gamma$,即联合 $(g{\theta}(Z),g{\theta^{\prime}}(Z))$ 的分布,显然 $\gamma\in\Pi(\mathbb{P}{\theta},\mathbb{P}{\theta^{\prime}})$。推论 1 的证明。 先考虑光滑非线性。由于 $g$ 作为 $(\theta,z)$ 的函数属于 $C^{1}$,对任意固定 $(\theta,z)$,$L(\theta,Z)\leq\|\nabla{\theta,x}g{\theta}(z)\|+\epsilon$ 对所有 $\epsilon>0$ 都是可接受的局部 Lipschitz 常数。因此只需证明定理 2 的证明。定理 3 的证明。 定义附录 D 基于能量的 GAN 优化的是全变差定理 4。 设 $\mathbb{P}{r}$ 为紧空间 $\mathcal{X}$ 上的真实数据分布。设 $g{\theta}:\mathcal{Z}\rightarrow\mathcal{X}$ 为可测函数(例如任意神经网络)。则对 $\mathbb{P}{r}$ 与 $\mathbb{P}{\theta}$ 存在最优判别器 $D^{}$,且证明。 首先证明最优判别器存在。设 $D:\mathcal{X}\rightarrow[0,+\infty)$ 可测,则 $D^{\prime}(x):=\min(D(x),m)$ 亦可测,且 $L{D}(D^{\prime},g{\theta})\leq L{D}(D,g{\theta})$。因此 $D^{}:\mathcal{X}\rightarrow[0,+\infty)$ 最优当且仅当 ${D^{}}^{\prime}$ 最优。进一步,它最优当且仅当对所有 $D:\mathcal{X}\rightarrow[0,m]$ 有 $L{D}(D^{},g{\theta})\leq L{D}(D,g{\theta})$。于是我们关心问题 $\min{0\leq D(x)\leq m}L{D}(D,g{\theta})$ 是否有最优判别器。附录 E 普通 GAN 训练中生成器的代价附录 F 样本图页
返回论文列表
目录

Wasserstein GAN

收录于 ICML 2017;arXiv:1701.07875
打开论文来源

Wasserstein GAN

Martin Arjovsky Affiliation:  Courant Institute of Mathematical Sciences    Soumith Chintala Affiliation:  Facebook AI Research    Léon Bottou Affiliation:  Courant Institute of Mathematical Sciences Affiliation:  Facebook AI Research

1 Introduction

1 引言

The problem this paper is concerned with is that of unsupervised learning. Mainly, what does it mean to learn a probability distribution? The classical answer to this is to learn a probability density. This is often done by defining a parametric family of densities (Pθ)θ∈Rd(P_{\theta})_{\theta\in\mathbb{R}^{d}}(Pθ​)θ∈Rd​ and finding the one that maximized the likelihood on our data: if we have real data examples {x(i)}i=1m\{x^{(i)}\}_{i=1}^{m}{x(i)}i=1m​, we would solve the problem

本文关心的是无监督学习问题。核心是:学习一个概率分布究竟意味着什么?经典回答是学习概率密度。常见做法是定义参数化密度族 (Pθ)θ∈Rd(P_{\theta})_{\theta\in\mathbb{R}^{d}}(Pθ​)θ∈Rd​,再在数据上最大化似然:若有真实样本 {x(i)}i=1m\{x^{(i)}\}_{i=1}^{m}{x(i)}i=1m​,就求解

max⁡θ∈Rd1m∑i=1mlog⁡Pθ(x(i))\max_{\theta\in\mathbb{R}^{d}}\frac{1}{m}\sum_{i=1}^{m}\log P_{\theta}(x^{(i)})θ∈Rdmax​m1​i=1∑m​logPθ​(x(i))

If the real data distribution Pr\mathbb{P}_{r}Pr​ admits a density and Pθ\mathbb{P}_{\theta}Pθ​ is the distribution of the parametrized density PθP_{\theta}Pθ​, then, asymptotically, this amounts to minimizing the Kullback-Leibler divergence KL(Pr∥Pθ)KL(\mathbb{P}_{r}\|\mathbb{P}_{\theta})KL(Pr​∥Pθ​).

若真实数据分布 Pr\mathbb{P}_{r}Pr​ 存在密度,且 Pθ\mathbb{P}_{\theta}Pθ​ 是参数化密度 PθP_{\theta}Pθ​ 所对应的分布,则在渐近意义下,这等价于最小化 Kullback-Leibler 散度 KL(Pr∥Pθ)KL(\mathbb{P}_{r}\|\mathbb{P}_{\theta})KL(Pr​∥Pθ​)。

For this to make sense, we need the model density PθP_{\theta}Pθ​ to exist. This is not the case in the rather common situation where we are dealing with distributions supported by low dimensional manifolds. It is then unlikely that the model manifold and the true distribution’s support have a non-negligible intersection (see [1]), and this means that the KL distance is not defined (or simply infinite).

要使上述做法有意义,模型密度 PθP_{\theta}Pθ​ 必须存在。当分布支撑在低维流形上时,这一点常常不成立。此时模型流形与真实分布支撑几乎不太可能有不可忽略的交集(见 [1]),于是 KL 距离要么无定义,要么直接取无穷。

The typical remedy is to add a noise term to the model distribution. This is why virtually all generative models described in the classical machine learning literature include a noise component. In the simplest case, one assumes a Gaussian noise with relatively high bandwidth in order to cover all the examples. It is well known, for instance, that in the case of image generation models, this noise degrades the quality of the samples and makes them blurry. For example, we can see in the recent paper [23] that the optimal standard deviation of the noise added to the model when maximizing likelihood is around 0.1 to each pixel in a generated image, when the pixels were already normalized to be in the range [0,1][0,1][0,1]. This is a very high amount of noise, so much that when papers report the samples of their models, they don’t add the noise term on which they report likelihood numbers. In other words, the added noise term is clearly incorrect for the problem, but is needed to make the maximum likelihood approach work.

常见补救是给模型分布加上噪声项。这也是经典机器学习文献里几乎所有生成模型都带噪声成分的原因。最简单的情形是假设带宽较高的高斯噪声,以便盖住全部样本。以图像生成为例,这类噪声会降低样本质量并导致模糊,这是众所周知的。例如近期工作 [23] 指出:像素已归一化到 [0,1][0,1][0,1] 时,为最大化似然而加入模型的噪声,最优标准差大约是每个像素 0.1。噪声量很大,以至于论文展示样本时往往不加上报似然数字时所依赖的那项噪声。换句话说,所加噪声对问题本身并不正确,却是最大似然方法能够运转所必需的。

Rather than estimating the density of Pr\mathbb{P}_{r}Pr​ which may not exist, we can define a random variable ZZZ with a fixed distribution p(z)p(z)p(z) and pass it through a parametric function gθ:Z→Xg_{\theta}:\mathcal{Z}\rightarrow\mathcal{X}gθ​:Z→X (typically a neural network of some kind) that directly generates samples following a certain distribution Pθ\mathbb{P}_{\theta}Pθ​. By varying θ\thetaθ, we can change this distribution and make it close to the real data distribution Pr\mathbb{P}_{r}Pr​. This is useful in two ways. First of all, unlike densities, this approach can represent distributions confined to a low dimensional manifold. Second, the ability to easily generate samples is often more useful than knowing the numerical value of the density (for example in image superresolution or semantic segmentation when considering the conditional distribution of the output image given the input image). In general, it is computationally difficult to generate samples given an arbitrary high dimensional density [16].

与其估计可能根本不存在的 Pr\mathbb{P}_{r}Pr​ 密度,不如定义服从固定分布 p(z)p(z)p(z) 的随机变量 ZZZ,再把它送进参数化映射 gθ:Z→Xg_{\theta}:\mathcal{Z}\rightarrow\mathcal{X}gθ​:Z→X(通常是某种神经网络),直接生成服从某分布 Pθ\mathbb{P}_{\theta}Pθ​ 的样本。调节 θ\thetaθ 就能改变该分布,使其靠近真实数据分布 Pr\mathbb{P}_{r}Pr​。这样做有两点好处。第一,与密度不同,它能表示被限制在低维流形上的分布。第二,能方便地采样往往比知道密度数值更有用(例如在图像超分辨或语义分割里,考虑给定输入图像时输出图像的条件分布)。一般而言,任意给定高维密度再去采样在计算上很困难 [16]。

Variational Auto-Encoders (VAEs) [9] and Generative Adversarial Networks (GANs) [4] are well known examples of this approach. Because VAEs focus on the approximate likelihood of the examples, they share the limitation of the standard models and need to fiddle with additional noise terms. GANs offer much more flexibility in the definition of the objective function, including Jensen-Shannon [4], and all fff-divergences [17] as well as some exotic combinations [6]. On the other hand, training GANs is well known for being delicate and unstable, for reasons theoretically investigated in [1].

变分自编码器(VAE)[9] 与生成对抗网络(GAN)[4] 是这一思路的著名例子。VAE 关注样本的近似似然,因此仍带有标准模型的局限,需要摆弄额外噪声项。GAN 在目标函数定义上更灵活,包括 Jensen-Shannon [4]、全部 fff-散度 [17],以及一些更奇特的组合 [6]。另一方面,GAN 训练以脆弱、不稳定著称,理论原因在 [1] 中有分析。

In this paper, we direct our attention on the various ways to measure how close the model distribution and the real distribution are, or equivalently, on the various ways to define a distance or divergence ρ(Pθ,Pr)\rho(\mathbb{P}_{\theta},\mathbb{P}_{r})ρ(Pθ​,Pr​). The most fundamental difference between such distances is their impact on the convergence of sequences of probability distributions. A sequence of distributions (Pt)t∈N(\mathbb{P}_{t})_{t\in\mathbb{N}}(Pt​)t∈N​ converges if and only if there is a distribution P∞\mathbb{P}_{\infty}P∞​ such that ρ(Pt,P∞)\rho(\mathbb{P}_{t},\mathbb{P}_{\infty})ρ(Pt​,P∞​) tends to zero, something that depends on how exactly the distance ρ\rhoρ is defined. Informally, a distance ρ\rhoρ induces a weaker topology when it makes it easier for a sequence of distribution to converge.[^1] Section 2 clarifies how popular probability distances differ in that respect.

本文把注意力放在如何度量模型分布与真实分布的接近程度,或者说如何定义距离或散度 ρ(Pθ,Pr)\rho(\mathbb{P}_{\theta},\mathbb{P}_{r})ρ(Pθ​,Pr​)。这些距离之间最根本的差别,在于它们如何影响概率分布序列的收敛。序列 (Pt)t∈N(\mathbb{P}_{t})_{t\in\mathbb{N}}(Pt​)t∈N​ 收敛,当且仅当存在 P∞\mathbb{P}_{\infty}P∞​ 使 ρ(Pt,P∞)\rho(\mathbb{P}_{t},\mathbb{P}_{\infty})ρ(Pt​,P∞​) 趋于零,而这取决于 ρ\rhoρ 究竟如何定义。非正式地说,若某种距离更容易让分布序列收敛,它就诱导更弱的拓扑。[^1] 第 2 节将说明常见概率距离在这一点上如何不同。

In order to optimize the parameter θ\thetaθ, it is of course desirable to define our model distribution Pθ\mathbb{P}_{\theta}Pθ​ in a manner that makes the mapping θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ continuous. Continuity means that when a sequence of parameters θt\theta_{t}θt​ converges to θ\thetaθ, the distributions Pθt\mathbb{P}_{\theta_{t}}Pθt​​ also converge to Pθ\mathbb{P}_{\theta}Pθ​. However, it is essential to remember that the notion of the convergence of the distributions Pθt\mathbb{P}_{\theta_{t}}Pθt​​ depends on the way we compute the distance between distributions. The weaker this distance, the easier it is to define a continuous mapping from θ\thetaθ-space to Pθ\mathbb{P}_{\theta}Pθ​-space, since it’s easier for the distributions to converge. The main reason we care about the mapping θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ to be continuous is as follows. If ρ\rhoρ is our notion of distance between two distributions, we would like to have a loss function θ↦ρ(Pθ,Pr)\theta\mapsto\rho(\mathbb{P}_{\theta},\mathbb{P}_{r})θ↦ρ(Pθ​,Pr​) that is continuous, and this is equivalent to having the mapping θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ be continuous when using the distance between distributions ρ\rhoρ.

为了优化参数 θ\thetaθ,当然希望把模型分布 Pθ\mathbb{P}_{\theta}Pθ​ 定义成使映射 θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ 连续。连续性意味着:当参数序列 θt\theta_{t}θt​ 收敛到 θ\thetaθ 时,分布 Pθt\mathbb{P}_{\theta_{t}}Pθt​​ 也收敛到 Pθ\mathbb{P}_{\theta}Pθ​。但必须记住,Pθt\mathbb{P}_{\theta_{t}}Pθt​​ 的收敛概念取决于我们如何计算分布之间的距离。距离越弱,就越容易定义从 θ\thetaθ 空间到 Pθ\mathbb{P}_{\theta}Pθ​ 空间的连续映射,因为分布更容易收敛。我们关心 θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ 连续的主要理由如下。若 ρ\rhoρ 是两种分布之间的距离概念,我们希望损失函数 θ↦ρ(Pθ,Pr)\theta\mapsto\rho(\mathbb{P}_{\theta},\mathbb{P}_{r})θ↦ρ(Pθ​,Pr​) 连续,而这等价于在使用距离 ρ\rhoρ 时映射 θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ 连续。

The contributions of this paper are:

本文贡献如下:

  • • In Section 2, we provide a comprehensive theoretical analysis of how the Earth Mover (EM) distance behaves in comparison to popular probability distances and divergences used in the context of learning distributions.
  • • 在第 2 节,我们系统比较 Earth Mover(EM,推土机)距离与学习分布时常用的概率距离与散度,给出全面的理论分析。
  • • In Section 3, we define a form of GAN called Wasserstein-GAN that minimizes a reasonable and efficient approximation of the EM distance, and we theoretically show that the corresponding optimization problem is sound.
  • • 在第 3 节,我们定义一类称为 Wasserstein-GAN 的 GAN,它最小化 EM 距离的合理且高效近似,并从理论上说明相应优化问题是可靠的。
  • • In Section 4, we empirically show that WGANs cure the main training problems of GANs. In particular, training WGANs does not require maintaining a careful balance in training of the discriminator and the generator, and does not require a careful design of the network architecture either. The mode dropping phenomenon that is typical in GANs is also drastically reduced. One of the most compelling practical benefits of WGANs is the ability to continuously estimate the EM distance by training the discriminator to optimality. Plotting these learning curves is not only useful for debugging and hyperparameter searches, but also correlate remarkably well with the observed sample quality.
  • • 在第 4 节,我们用实验表明 WGAN 缓解了 GAN 的主要训练问题。具体而言,训练 WGAN 不必在判别器与生成器之间小心维持平衡,也不必精心设计网络结构。GAN 中典型的模式崩塌现象也大幅减轻。WGAN 最有说服力的实践收益之一,是能够通过把判别器训练到最优,持续估计 EM 距离。画出这些学习曲线不仅便于调试与超参搜索,还与观察到的样本质量高度相关。

2 Different Distances

2 不同距离

We now introduce our notation. Let X\mathcal{X}X be a compact metric set (such as the space of images [0,1]d[0,1]^{d}[0,1]d) and let Σ\SigmaΣ denote the set of all the Borel subsets of X\mathcal{X}X. Let Prob(X)\text{Prob}(\mathcal{X})Prob(X) denote the space of probability measures defined on X\mathcal{X}X. We can now define elementary distances and divergences between two distributions Pr,Pg∈Prob(X)\mathbb{P}_{r},\mathbb{P}_{g}\in\text{Prob}(\mathcal{X})Pr​,Pg​∈Prob(X):

先约定记号。设 X\mathcal{X}X 为紧度量集(例如图像空间 [0,1]d[0,1]^{d}[0,1]d),Σ\SigmaΣ 表示 X\mathcal{X}X 的全体 Borel 子集。令 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 为定义在 X\mathcal{X}X 上的概率测度空间。下面给出两种分布 Pr,Pg∈Prob(X)\mathbb{P}_{r},\mathbb{P}_{g}\in\text{Prob}(\mathcal{X})Pr​,Pg​∈Prob(X) 之间若干基本距离与散度:

  • • The Total Variation (TV) distance δ(Pr,Pg)=sup⁡A∈Σ∣Pr(A)−Pg(A)∣ .\delta(\mathbb{P}_{r},\mathbb{P}_{g})=\sup_{A\in\Sigma}|\mathbb{P}_{r}(A)-\mathbb{P}_{g}(A)|~.δ(Pr​,Pg​)=A∈Σsup​∣Pr​(A)−Pg​(A)∣ .
  • • 全变差(Total Variation, TV)距离 δ(Pr,Pg)=sup⁡A∈Σ∣Pr(A)−Pg(A)∣ 。\delta(\mathbb{P}_{r},\mathbb{P}_{g})=\sup_{A\in\Sigma}|\mathbb{P}_{r}(A)-\mathbb{P}_{g}(A)|~。δ(Pr​,Pg​)=A∈Σsup​∣Pr​(A)−Pg​(A)∣ 。
  • • The Kullback-Leibler (KL) divergence KL(Pr∥Pg)=∫log⁡(Pr(x)Pg(x))Pr(x)dμ(x) ,KL(\mathbb{P}_{r}\|\mathbb{P}_{g})=\int\log\left(\frac{P_{r}(x)}{P_{g}(x)}\right)P_{r}(x)d\mu(x)~,KL(Pr​∥Pg​)=∫log(Pg​(x)Pr​(x)​)Pr​(x)dμ(x) , where both Pr\mathbb{P}_{r}Pr​ and Pg\mathbb{P}_{g}Pg​ are assumed to be absolutely continuous, and therefore admit densities, with respect to a same measure μ\muμ defined on X\mathcal{X}X.[^2] The KL divergence is famously assymetric and possibly infinite when there are points such that Pg(x)=0P_{g}(x)=0Pg​(x)=0 and Pr(x)>0P_{r}(x)>0Pr​(x)>0.
  • • Kullback-Leibler(KL)散度 KL(Pr∥Pg)=∫log⁡(Pr(x)Pg(x))Pr(x)dμ(x) ,KL(\mathbb{P}_{r}\|\mathbb{P}_{g})=\int\log\left(\frac{P_{r}(x)}{P_{g}(x)}\right)P_{r}(x)d\mu(x)~,KL(Pr​∥Pg​)=∫log(Pg​(x)Pr​(x)​)Pr​(x)dμ(x) , 其中假定 Pr\mathbb{P}_{r}Pr​ 与 Pg\mathbb{P}_{g}Pg​ 关于 X\mathcal{X}X 上同一测度 μ\muμ 绝对连续,因而都有密度。[^2] KL 散度以不对称著称,且当存在点使 Pg(x)=0P_{g}(x)=0Pg​(x)=0 而 Pr(x)>0P_{r}(x)>0Pr​(x)>0 时可能取无穷。
  • • The Jensen-Shannon (JS) divergence JS(Pr,Pg)=KL(Pr∥Pm)+KL(Pg∥Pm) ,JS(\mathbb{P}_{r},\mathbb{P}_{g})=KL(\mathbb{P}_{r}\|\mathbb{P}_{m})+KL(\mathbb{P}_{g}\|\mathbb{P}_{m})~,JS(Pr​,Pg​)=KL(Pr​∥Pm​)+KL(Pg​∥Pm​) , where Pm\mathbb{P}_{m}Pm​ is the mixture (Pr+Pg)/2(\mathbb{P}_{r}+\mathbb{P}_{g})/2(Pr​+Pg​)/2. This divergence is symmetrical and always defined because we can choose μ=Pm\mu=\mathbb{P}_{m}μ=Pm​.
  • • Jensen-Shannon(JS)散度 JS(Pr,Pg)=KL(Pr∥Pm)+KL(Pg∥Pm) ,JS(\mathbb{P}_{r},\mathbb{P}_{g})=KL(\mathbb{P}_{r}\|\mathbb{P}_{m})+KL(\mathbb{P}_{g}\|\mathbb{P}_{m})~,JS(Pr​,Pg​)=KL(Pr​∥Pm​)+KL(Pg​∥Pm​) , 其中 Pm\mathbb{P}_{m}Pm​ 为混合分布 (Pr+Pg)/2(\mathbb{P}_{r}+\mathbb{P}_{g})/2(Pr​+Pg​)/2。该散度对称,且因可取 μ=Pm\mu=\mathbb{P}_{m}μ=Pm​ 而总有定义。
  • • The Earth-Mover (EM) distance or Wasserstein-1 W(Pr,Pg)=inf⁡γ∈Π(Pr,Pg)E(x,y)∼γ[ ∥x−y∥ ] ,W(\mathbb{P}_{r},\mathbb{P}_{g})=\inf_{\gamma\in\Pi(\mathbb{P}_{r},\mathbb{P}_{g})}\mathbb{E}_{(x,y)\sim\gamma}\big[\>\|x-y\|\>\big]~,W(Pr​,Pg​)=γ∈Π(Pr​,Pg​)inf​E(x,y)∼γ​[∥x−y∥] , (1) where Π(Pr,Pg)\Pi(\mathbb{P}_{r},\mathbb{P}_{g})Π(Pr​,Pg​) denotes the set of all joint distributions γ(x,y)\gamma(x,y)γ(x,y) whose marginals are respectively Pr\mathbb{P}_{r}Pr​ and Pg\mathbb{P}_{g}Pg​. Intuitively, γ(x,y)\gamma(x,y)γ(x,y) indicates how much “mass” must be transported from xxx to yyy in order to transform the distributions Pr\mathbb{P}_{r}Pr​ into the distribution Pg\mathbb{P}_{g}Pg​. The EM distance then is the “cost” of the optimal transport plan.
  • • Earth-Mover(EM)距离,亦即 Wasserstein-1 W(Pr,Pg)=inf⁡γ∈Π(Pr,Pg)E(x,y)∼γ[ ∥x−y∥ ] ,W(\mathbb{P}_{r},\mathbb{P}_{g})=\inf_{\gamma\in\Pi(\mathbb{P}_{r},\mathbb{P}_{g})}\mathbb{E}_{(x,y)\sim\gamma}\big[\>\|x-y\|\>\big]~,W(Pr​,Pg​)=γ∈Π(Pr​,Pg​)inf​E(x,y)∼γ​[∥x−y∥] , (1) 其中 Π(Pr,Pg)\Pi(\mathbb{P}_{r},\mathbb{P}_{g})Π(Pr​,Pg​) 表示边缘分别为 Pr\mathbb{P}_{r}Pr​ 与 Pg\mathbb{P}_{g}Pg​ 的全体联合分布 γ(x,y)\gamma(x,y)γ(x,y)。直观上,γ(x,y)\gamma(x,y)γ(x,y) 表示要把 Pr\mathbb{P}_{r}Pr​ 变成 Pg\mathbb{P}_{g}Pg​,需要从 xxx 「搬运」多少「质量」到 yyy。EM 距离就是最优搬运方案的「代价」。

The following example illustrates how apparently simple sequences of probability distributions converge under the EM distance but do not converge under the other distances and divergences defined above.

下面的例子说明:看似简单的概率分布序列可以在 EM 距离下收敛,却在上述其他距离与散度下不收敛。

Example 1(Learning parallel lines).

Let Z∼U[0,1]Z\sim U[0,1]Z∼U[0,1] the uniform distribution on the unit interval. Let P0\mathbb{P}_{0}P0​ be the distribution of (0,Z)∈R2(0,Z)\in\mathbb{R}^{2}(0,Z)∈R2 (a 0 on the x-axis and the random variable ZZZ on the y-axis), uniform on a straight vertical line passing through the origin. Now let gθ(z)=(θ,z)g_{\theta}(z)=(\theta,z)gθ​(z)=(θ,z) with θ\thetaθ a single real parameter. It is easy to see that in this case,

例 1(学习平行直线)。 设 Z∼U[0,1]Z\sim U[0,1]Z∼U[0,1] 为单位区间上的均匀分布。令 P0\mathbb{P}_{0}P0​ 为 (0,Z)∈R2(0,Z)\in\mathbb{R}^{2}(0,Z)∈R2 的分布(xxx 轴为 0,yyy 轴为随机变量 ZZZ),即过原点的竖直直线上的均匀分布。再令 gθ(z)=(θ,z)g_{\theta}(z)=(\theta,z)gθ​(z)=(θ,z),其中 θ\thetaθ 为单一实参数。容易看出此时

  • • W(P0,Pθ)=∣θ∣W(\mathbb{P}_{0},\mathbb{P}_{\theta})=|\theta|W(P0​,Pθ​)=∣θ∣,
  • • W(P0,Pθ)=∣θ∣W(\mathbb{P}_{0},\mathbb{P}_{\theta})=|\theta|W(P0​,Pθ​)=∣θ∣,
  • • JS(P0,Pθ)={log⁡2if θ≠0 ,0if θ=0 ,\displaystyle JS(\mathbb{P}_{0},\mathbb{P}_{\theta})=\begin{cases}\log 2&\quad\text{if }\theta\neq 0~,\\ 0&\quad\text{if }\theta=0~,\end{cases}JS(P0​,Pθ​)={log20​if θ=0 ,if θ=0 ,​
  • • KL(Pθ∥P0)=KL(P0∥Pθ)={+∞if θ≠0 ,0if θ=0 ,\displaystyle KL(\mathbb{P}_{\theta}\|\mathbb{P}_{0})=KL(\mathbb{P}_{0}\|\mathbb{P}_{\theta})=\begin{cases}+\infty&\quad\text{if }\theta\neq 0~,\\ 0&\quad\text{if }\theta=0~,\end{cases}KL(Pθ​∥P0​)=KL(P0​∥Pθ​)={+∞0​if θ=0 ,if θ=0 ,​
  • • and δ(P0,Pθ)={1if θ≠0 ,0if θ=0 .\displaystyle\delta(\mathbb{P}_{0},\mathbb{P}_{\theta})=\begin{cases}1&\quad\text{if }\theta\neq 0~,\\ 0&\quad\text{if }\theta=0~.\end{cases}δ(P0​,Pθ​)={10​if θ=0 ,if θ=0 .​
  • • 以及 δ(P0,Pθ)={1if θ≠0 ,0if θ=0 。\displaystyle\delta(\mathbb{P}_{0},\mathbb{P}_{\theta})=\begin{cases}1&\quad\text{if }\theta\neq 0~,\\ 0&\quad\text{if }\theta=0~。\end{cases}δ(P0​,Pθ​)={10​if θ=0 ,if θ=0 。​

When θt→0\theta_{t}\rightarrow 0θt​→0, the sequence (Pθt)t∈N(\mathbb{P}_{\theta_{t}})_{t\in\mathbb{N}}(Pθt​​)t∈N​ converges to P0\mathbb{P}_{0}P0​ under the EM distance, but does not converge at all under either the JS, KL, reverse KL, or TV divergences. Figure 1 illustrates this for the case of the EM and JS distances.

当 θt→0\theta_{t}\rightarrow 0θt​→0 时,序列 (Pθt)t∈N(\mathbb{P}_{\theta_{t}})_{t\in\mathbb{N}}(Pθt​​)t∈N​ 在 EM 距离下收敛到 P0\mathbb{P}_{0}P0​,但在 JS、KL、反向 KL 或 TV 散度下根本不收敛。图 1 对 EM 与 JS 距离展示了这一点。

Figure 1

Figure 1: These plots show ρ(Pθ,P0)\rho(\mathbb{P}_{\theta},\mathbb{P}_{0})ρ(Pθ​,P0​) as a function of θ\thetaθ when ρ\rhoρ is the EM distance (left plot) or the JS divergence (right plot). The EM plot is continuous and provides a usable gradient everywhere. The JS plot is not continuous and does not provide a usable gradient.

图 1:这些图给出 ρ(Pθ,P0)\rho(\mathbb{P}_{\theta},\mathbb{P}_{0})ρ(Pθ​,P0​) 作为 θ\thetaθ 的函数,其中 ρ\rhoρ 分别为 EM 距离(左)与 JS 散度(右)。EM 曲线连续,处处提供可用梯度;JS 曲线不连续,无法提供可用梯度。

Example 1 gives us a case where we can learn a probability distribution over a low dimensional manifold by doing gradient descent on the EM distance. This cannot be done with the other distances and divergences because the resulting loss function is not even continuous. Although this simple example features distributions with disjoint supports, the same conclusion holds when the supports have a non empty intersection contained in a set of measure zero. This happens to be the case when two low dimensional manifolds intersect in general position [1].

例 1 给出了一种情形:我们可以对 EM 距离做梯度下降,从而学习支撑在低维流形上的概率分布。对其他距离与散度则不行,因为得到的损失函数甚至不连续。尽管这个简单例子中分布支撑互不相交,但当支撑的非空交集落在零测集上时,同样结论成立。两条低维流形一般位置相交时正是如此 [1]。

Since the Wasserstein distance is much weaker than the JS distance[^3], we can now ask whether W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) is a continuous loss function on θ\thetaθ under mild assumptions. This, and more, is true, as we now state and prove.

由于 Wasserstein 距离远弱于 JS 距离[^3],自然要问:在温和假设下,W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 是否关于 θ\thetaθ 连续。这一点以及更多结论成立,我们陈述并证明如下。

Theorem 1.

Let Pr\mathbb{P}_{r}Pr​ be a fixed distribution over X\mathcal{X}X. Let ZZZ be a random variable (e.g Gaussian) over another space Z\mathcal{Z}Z. Let g:Z×Rd→Xg:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}g:Z×Rd→X be a function, that will be denoted gθ(z)g_{\theta}(z)gθ​(z) with zzz the first coordinate and θ\thetaθ the second. Let Pθ\mathbb{P}_{\theta}Pθ​ denote the distribution of gθ(Z)g_{\theta}(Z)gθ​(Z). Then,

定理 1。 设 Pr\mathbb{P}_{r}Pr​ 为 X\mathcal{X}X 上的固定分布。设 ZZZ 为另一空间 Z\mathcal{Z}Z 上的随机变量(例如高斯)。设 g:Z×Rd→Xg:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}g:Z×Rd→X 为函数,记第一坐标为 zzz、第二坐标为 θ\thetaθ 时写作 gθ(z)g_{\theta}(z)gθ​(z)。令 Pθ\mathbb{P}_{\theta}Pθ​ 表示 gθ(Z)g_{\theta}(Z)gθ​(Z) 的分布。则

  1. Ifgggis continuous inθ\thetaθ, so isW(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​).
  1. 若ggg关于θ\thetaθ连续,则W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)亦连续。
  1. Ifgggis locally Lipschitz and satisfies regularity assumption*1, then*W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)is continuous everywhere, and differentiable almost everywhere.
  1. 若ggg局部 Lipschitz 且满足正则假设*1,则*W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)处处连续,且几乎处处可微。
  1. Statements 1-2 are false for the Jensen-Shannon divergenceJS(Pr,Pθ)JS(\mathbb{P}_{r},\mathbb{P}_{\theta})JS(Pr​,Pθ​)and all the KLs.
  1. 对 Jensen-Shannon 散度JS(Pr,Pθ)JS(\mathbb{P}_{r},\mathbb{P}_{\theta})JS(Pr​,Pθ​)以及所有 KL,陈述 1–2 均不成立。

Proof.

See Appendix C ∎

证明。 见附录 C ∎

The following corollary tells us that learning by minimizing the EM distance makes sense (at least in theory) with neural networks.

下面的推论告诉我们:至少在理论上,用神经网络通过最小化 EM 距离来学习是说得通的。

Corollary 1.

Let gθg_{\theta}gθ​ be any feedforward neural network[^4] parameterized by θ\thetaθ, and p(z)p(z)p(z) a prior over zzz such that Ez∼p(z)[∥z∥]<∞\mathbb{E}_{z\sim p(z)}[\|z\|]<\inftyEz∼p(z)​[∥z∥]<∞ (e.g. Gaussian, uniform, etc.). Then assumption 1 is satisfied and therefore W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) is continuous everywhere and differentiable almost everywhere.

推论 1。 设 gθg_{\theta}gθ​ 为任意由 θ\thetaθ 参数化的前馈神经网络[^4],p(z)p(z)p(z) 为 zzz 上的先验且 Ez∼p(z)[∥z∥]<∞\mathbb{E}_{z\sim p(z)}[\|z\|]<\inftyEz∼p(z)​[∥z∥]<∞(例如高斯、均匀等)。则假设 1 成立,因而 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 处处连续且几乎处处可微。

Proof.

See Appendix C ∎

证明。 见附录 C ∎

All this shows that EM is a much more sensible cost function for our problem than at least the Jensen-Shannon divergence. The following theorem describes the relative strength of the topologies induced by these distances and divergences, with KL the strongest, followed by JS and TV, and EM the weakest.

以上表明,至少相对 Jensen-Shannon 散度,EM 作为我们问题的代价函数合理得多。下面的定理描述这些距离与散度所诱导拓扑的相对强弱:KL 最强,其次是 JS 与 TV,EM 最弱。

Theorem 2.

Let P\mathbb{P}P be a distribution on a compact space X\mathcal{X}X and (Pn)n∈N(\mathbb{P}_{n})_{n\in\mathbb{N}}(Pn​)n∈N​ be a sequence of distributions on X\mathcal{X}X. Then, considering all limits as n→∞n\to\inftyn→∞,

定理 2。 设 P\mathbb{P}P 为紧空间 X\mathcal{X}X 上的分布,(Pn)n∈N(\mathbb{P}_{n})_{n\in\mathbb{N}}(Pn​)n∈N​ 为 X\mathcal{X}X 上的分布序列。以下极限均指 n→∞n\to\inftyn→∞ 时,

  1. The following statements are equivalent • δ(Pn,P)→0\delta(\mathbb{P}_{n},\mathbb{P})\to 0δ(Pn​,P)→0withδ\deltaδthe total variation distance. • JS(Pn,P)→0JS(\mathbb{P}_{n},\mathbb{P})\to 0JS(Pn​,P)→0withJSJSJSthe Jensen-Shannon divergence.
  1. 下列陈述等价 • δ(Pn,P)→0\delta(\mathbb{P}_{n},\mathbb{P})\to 0δ(Pn​,P)→0,δ\deltaδ为全变差距离。 • JS(Pn,P)→0JS(\mathbb{P}_{n},\mathbb{P})\to 0JS(Pn​,P)→0,JSJSJS为 Jensen-Shannon 散度。
  1. The following statements are equivalent • W(Pn,P)→0W(\mathbb{P}_{n},\mathbb{P})\to 0W(Pn​,P)→0. • Pn→DP\mathbb{P}_{n}\xrightarrow{\mathcal{D}}\mathbb{P}Pn​D​Pwhere→D\xrightarrow{\mathcal{D}}D​represents convergence in distribution for random variables.
  1. 下列陈述等价 • W(Pn,P)→0W(\mathbb{P}_{n},\mathbb{P})\to 0W(Pn​,P)→0。 • Pn→DP\mathbb{P}_{n}\xrightarrow{\mathcal{D}}\mathbb{P}Pn​D​P,其中→D\xrightarrow{\mathcal{D}}D​表示随机变量依分布收敛。
  1. KL(Pn∥P)→0KL(\mathbb{P}_{n}\|\mathbb{P})\to 0KL(Pn​∥P)→0orKL(P∥Pn)→0KL(\mathbb{P}\|\mathbb{P}_{n})\to 0KL(P∥Pn​)→0imply the statements in (1).
  1. KL(Pn∥P)→0KL(\mathbb{P}_{n}\|\mathbb{P})\to 0KL(Pn​∥P)→0或KL(P∥Pn)→0KL(\mathbb{P}\|\mathbb{P}_{n})\to 0KL(P∥Pn​)→0蕴含 (1) 中的陈述。
  1. The statements in (1) imply the statements in (2).
  1. (1) 中的陈述蕴含 (2) 中的陈述。

Proof.

See Appendix C ∎

证明。 见附录 C ∎

This highlights the fact that the KL, JS, and TV distances are not sensible cost functions when learning distributions supported by low dimensional manifolds. However the EM distance is sensible in that setup. This obviously leads us to the next section where we introduce a practical approximation of optimizing the EM distance.

这说明:在学习支撑于低维流形的分布时,KL、JS 与 TV 距离都不是合理的代价函数;而 EM 距离在该设定下是合理的。这自然导向下一节:我们引入优化 EM 距离的实用近似。

3 Wasserstein GAN

Again, Theorem 2 points to the fact that W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) might have nicer properties when optimized than JS(Pr,Pθ)JS(\mathbb{P}_{r},\mathbb{P}_{\theta})JS(Pr​,Pθ​). However, the infimum in (1) is highly intractable. On the other hand, the Kantorovich-Rubinstein duality [22] tells us that

再次地,定理 2 表明:优化 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 可能比优化 JS(Pr,Pθ)JS(\mathbb{P}_{r},\mathbb{P}_{\theta})JS(Pr​,Pθ​) 性质更好。然而 (1) 中的下确界极难计算。另一方面,Kantorovich-Rubinstein 对偶 [22] 告诉我们

W(Pr,Pθ)=sup⁡∥f∥L≤1Ex∼Pr[f(x)]−Ex∼Pθ[f(x)](2)W(\mathbb{P}_{r},\mathbb{P}_{\theta})=\sup_{\|f\|_{L}\leq 1}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)] \tag{2}W(Pr​,Pθ​)=∥f∥L​≤1sup​Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)](2)

where the supremum is over all the 1-Lipschitz functions f:X→Rf:\mathcal{X}\rightarrow\mathbb{R}f:X→R. Note that if we replace ∥f∥L≤1\|f\|_{L}\leq 1∥f∥L​≤1 for ∥f∥L≤K\|f\|_{L}\leq K∥f∥L​≤K (consider KKK-Lipschitz for some constant KKK), then we end up with K⋅W(Pr,Pg)K\cdot W(\mathbb{P}_{r},\mathbb{P}_{g})K⋅W(Pr​,Pg​). Therefore, if we have a parameterized family of functions {fw}w∈W\{f_{w}\}_{w\in\mathcal{W}}{fw​}w∈W​ that are all KKK-Lipschitz for some KKK, we could consider solving the problem

其中上确界取遍所有 1-Lipschitz 函数 f:X→Rf:\mathcal{X}\rightarrow\mathbb{R}f:X→R。注意:若把 ∥f∥L≤1\|f\|_{L}\leq 1∥f∥L​≤1 换成 ∥f∥L≤K\|f\|_{L}\leq K∥f∥L​≤K(即考虑某个常数 KKK 的 KKK-Lipschitz),则得到 K⋅W(Pr,Pg)K\cdot W(\mathbb{P}_{r},\mathbb{P}_{g})K⋅W(Pr​,Pg​)。因此,若有参数化函数族 {fw}w∈W\{f_{w}\}_{w\in\mathcal{W}}{fw​}w∈W​,且它们对某个 KKK 全是 KKK-Lipschitz,则可考虑求解问题

max⁡w∈WEx∼Pr[fw(x)]−Ez∼p(z)[fw(gθ(z)](3)\max_{w\in\mathcal{W}}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f_{w}(x)]-\mathbb{E}_{z\sim p(z)}[f_{w}(g_{\theta}(z)] \tag{3}w∈Wmax​Ex∼Pr​​[fw​(x)]−Ez∼p(z)​[fw​(gθ​(z)](3)

and if the supremum in (2) is attained for some w∈Ww\in\mathcal{W}w∈W (a pretty strong assumption akin to what’s assumed when proving consistency of an estimator), this process would yield a calculation of W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) up to a multiplicative constant. Furthermore, we could consider differentiating W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) (again, up to a constant) by back-proping through equation (2) via estimating Ez∼p(z)[∇θfw(gθ(z))]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f_{w}(g_{\theta}(z))]Ez∼p(z)​[∇θ​fw​(gθ​(z))]. While this is all intuition, we now prove that this process is principled under the optimality assumption.

并且若 (2) 中的上确界在某个 w∈Ww\in\mathcal{W}w∈W 处达到(这是相当强的假设,类似证明估计量一致性时所做的假定),该过程将得到 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 乘以某个常数因子的计算。进一步,我们还可通过估计 Ez∼p(z)[∇θfw(gθ(z))]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f_{w}(g_{\theta}(z))]Ez∼p(z)​[∇θ​fw​(gθ​(z))],沿着方程 (2) 反向传播,从而对 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)(同样差一个常数因子)求导。以上全是直觉;下面我们证明:在最优性假设下,这一过程是有原理依据的。

Theorem 3.

Let Pr\mathbb{P}_{r}Pr​ be any distribution. Let Pθ\mathbb{P}_{\theta}Pθ​ be the distribution of gθ(Z)g_{\theta}(Z)gθ​(Z) with ZZZ a random variable with density ppp and gθg_{\theta}gθ​ a function satisfying assumption 1. Then, there is a solution f:X→Rf:\mathcal{X}\rightarrow\mathbb{R}f:X→R to the problem

定理 3。 设 Pr\mathbb{P}_{r}Pr​ 为任意分布。设 Pθ\mathbb{P}_{\theta}Pθ​ 为 gθ(Z)g_{\theta}(Z)gθ​(Z) 的分布,其中 ZZZ 有密度 ppp,且 gθg_{\theta}gθ​ 满足假设 1。则问题

max⁡∥f∥L≤1Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]\max_{\|f\|_{L}\leq 1}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]∥f∥L​≤1max​Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]

and we have

存在解 f:X→Rf:\mathcal{X}\rightarrow\mathbb{R}f:X→R,并且有

∇θW(Pr,Pθ)=−Ez∼p(z)[∇θf(gθ(z))]\nabla_{\theta}W(\mathbb{P}_{r},\mathbb{P}_{\theta})=-\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))]∇θ​W(Pr​,Pθ​)=−Ez∼p(z)​[∇θ​f(gθ​(z))]

when both terms are well-defined.

在两项均有定义时成立。

Proof.

See Appendix Appendix C ∎

证明。 见附录 C ∎

Now comes the question of finding the function fff that solves the maximization problem in equation (2). To roughly approximate this, something that we can do is train a neural network parameterized with weights www lying in a compact space W\mathcal{W}W and then backprop through Ez∼p(z)[∇θfw(gθ(z))]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f_{w}(g_{\theta}(z))]Ez∼p(z)​[∇θ​fw​(gθ​(z))], as we would do with a typical GAN. Note that the fact that W\mathcal{W}W is compact implies that all the functions fwf_{w}fw​ will be KKK-Lipschitz for some KKK that only depends on W\mathcal{W}W and not the individual weights, therefore approximating (2) up to an irrelevant scaling factor and the capacity of the ‘critic’ fwf_{w}fw​. In order to have parameters www lie in a compact space, something simple we can do is clamp the weights to a fixed box (say W=[−0.01,0.01]l\mathcal{W}=[-0.01,0.01]^{l}W=[−0.01,0.01]l) after each gradient update. The Wasserstein Generative Adversarial Network (WGAN) procedure is described in Algorithm 1.

接下来的问题是找出求解方程 (2) 最大化问题的函数 fff。粗略近似的做法是:训练权重落在紧集 W\mathcal{W}W 上的神经网络,再对 Ez∼p(z)[∇θfw(gθ(z))]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f_{w}(g_{\theta}(z))]Ez∼p(z)​[∇θ​fw​(gθ​(z))] 反向传播,就像典型 GAN 那样。注意 W\mathcal{W}W 紧意味着所有 fwf_{w}fw​ 对某个只依赖 W\mathcal{W}W、而不依赖个别权重的 KKK 都是 KKK-Lipschitz,因而在差一个无关紧要的缩放因子以及「评判器」fwf_{w}fw​ 容量的意义下近似 (2)。为使参数 www 落在紧集上,简单做法是每次梯度更新后把权重裁剪到固定盒子(例如 W=[−0.01,0.01]l\mathcal{W}=[-0.01,0.01]^{l}W=[−0.01,0.01]l)。Wasserstein 生成对抗网络(WGAN)流程见算法 1。

Weight clipping is a clearly terrible way to enforce a Lipschitz constraint. If the clipping parameter is large, then it can take a long time for any weights to reach their limit, thereby making it harder to train the critic till optimality. If the clipping is small, this can easily lead to vanishing gradients when the number of layers is big, or batch normalization is not used (such as in RNNs). We experimented with simple variants (such as projecting the weights to a sphere) with little difference, and we stuck with weight clipping due to its simplicity and already good performance. However, we do leave the topic of enforcing Lipschitz constraints in a neural network setting for further investigation, and we actively encourage interested researchers to improve on this method.

用权重裁剪强制 Lipschitz 约束显然很粗糙。若裁剪参数过大,权重要很久才能碰到边界,评判器就更难训到最优;若裁剪过小,层数一多或不用批归一化(例如 RNN)时又容易梯度消失。我们试过简单变体(例如把权重投影到球面),差别不大,于是仍采用权重裁剪,因为它简单且已经表现不错。不过,如何在神经网络设定下更好强制 Lipschitz 约束,我们留给后续研究,并积极鼓励感兴趣的研究者改进这一方法。

1: : α\alphaα, the learning rate. ccc, the clipping parameter. mmm, the batch size. ncriticn_{\text{critic}}ncritic​, the number of iterations of the critic per generator iteration.
2: : w0w_{0}w0​, initial critic parameters. θ0\theta_{0}θ0​, initial generator’s parameters.
3: while θ\thetaθ has not converged do
4:   for t=0,...,ncritict=0,...,n_{\text{critic}}t=0,...,ncritic​ do
5:    Sample {x(i)}i=1m∼Pr\{x^{(i)}\}_{i=1}^{m}\sim\mathbb{P}_{r}{x(i)}i=1m​∼Pr​ a batch from the real data.
6:    Sample {z(i)}i=1m∼p(z)\{z^{(i)}\}_{i=1}^{m}\sim p(z){z(i)}i=1m​∼p(z) a batch of prior samples.
7:    gw←∇w[1m∑i=1mfw(x(i))−1m∑i=1mfw(gθ(z(i)))]g_{w}\leftarrow\nabla_{w}\left[\frac{1}{m}\sum_{i=1}^{m}f_{w}(x^{(i)})-\frac{1}{m}\sum_{i=1}^{m}f_{w}(g_{\theta}(z^{(i)}))\right]gw​←∇w​[m1​∑i=1m​fw​(x(i))−m1​∑i=1m​fw​(gθ​(z(i)))]
8:    w←w+α⋅RMSProp(w,gw)w\leftarrow w+\alpha\cdot\text{RMSProp}(w,g_{w})w←w+α⋅RMSProp(w,gw​)
9:    w←clip(w,−c,c)w\leftarrow\text{clip}(w,-c,c)w←clip(w,−c,c)
10:   end for
11:   Sample {z(i)}i=1m∼p(z)\{z^{(i)}\}_{i=1}^{m}\sim p(z){z(i)}i=1m​∼p(z) a batch of prior samples.
12:   gθ←−∇θ1m∑i=1mfw(gθ(z(i)))g_{\theta}\leftarrow-\nabla_{\theta}\frac{1}{m}\sum_{i=1}^{m}f_{w}(g_{\theta}(z^{(i)}))gθ​←−∇θ​m1​∑i=1m​fw​(gθ​(z(i)))
13:   θ←θ−α⋅RMSProp(θ,gθ)\theta\leftarrow\theta-\alpha\cdot\text{RMSProp}(\theta,g_{\theta})θ←θ−α⋅RMSProp(θ,gθ​)
14: end while

Algorithm 1 WGAN, our proposed algorithm. All experiments in the paper used the default values α=0.00005\alpha=0.00005α=0.00005, c=0.01c=0.01c=0.01, m=64m=64m=64, ncritic=5n_{\text{critic}}=5ncritic​=5.

1: :α\alphaα,学习率。ccc,裁剪参数。mmm,批大小。ncriticn_{\text{critic}}ncritic​,每更新一次生成器时评判器的迭代次数。
2: :w0w_{0}w0​,评判器初始参数。θ0\theta_{0}θ0​,生成器初始参数。
3: while θ\thetaθ 尚未收敛 do
4:   for t=0,...,ncritict=0,...,n_{\text{critic}}t=0,...,ncritic​ do
5:    从真实数据采样一批 {x(i)}i=1m∼Pr\{x^{(i)}\}_{i=1}^{m}\sim\mathbb{P}_{r}{x(i)}i=1m​∼Pr​。
6:    从先验采样一批 {z(i)}i=1m∼p(z)\{z^{(i)}\}_{i=1}^{m}\sim p(z){z(i)}i=1m​∼p(z)。
7:    gw←∇w[1m∑i=1mfw(x(i))−1m∑i=1mfw(gθ(z(i)))]g_{w}\leftarrow\nabla_{w}\left[\frac{1}{m}\sum_{i=1}^{m}f_{w}(x^{(i)})-\frac{1}{m}\sum_{i=1}^{m}f_{w}(g_{\theta}(z^{(i)}))\right]gw​←∇w​[m1​∑i=1m​fw​(x(i))−m1​∑i=1m​fw​(gθ​(z(i)))]
8:    w←w+α⋅RMSProp(w,gw)w\leftarrow w+\alpha\cdot\text{RMSProp}(w,g_{w})w←w+α⋅RMSProp(w,gw​)
9:    w←clip(w,−c,c)w\leftarrow\text{clip}(w,-c,c)w←clip(w,−c,c)
10:   end for
11:   从先验采样一批 {z(i)}i=1m∼p(z)\{z^{(i)}\}_{i=1}^{m}\sim p(z){z(i)}i=1m​∼p(z)。
12:   gθ←−∇θ1m∑i=1mfw(gθ(z(i)))g_{\theta}\leftarrow-\nabla_{\theta}\frac{1}{m}\sum_{i=1}^{m}f_{w}(g_{\theta}(z^{(i)}))gθ​←−∇θ​m1​∑i=1m​fw​(gθ​(z(i)))
13:   θ←θ−α⋅RMSProp(θ,gθ)\theta\leftarrow\theta-\alpha\cdot\text{RMSProp}(\theta,g_{\theta})θ←θ−α⋅RMSProp(θ,gθ​)
14: end while

算法 1 WGAN,本文提出的算法。文中所有实验使用默认值 α=0.00005\alpha=0.00005α=0.00005,c=0.01c=0.01c=0.01,m=64m=64m=64,ncritic=5n_{\text{critic}}=5ncritic​=5。

The fact that the EM distance is continuous and differentiable a.e. means that we can (and should) train the critic till optimality. The argument is simple, the more we train the critic, the more reliable gradient of the Wasserstein we get, which is actually useful by the fact that Wasserstein is differentiable almost everywhere. For the JS, as the discriminator gets better the gradients get more reliable but the true gradient is 0 since the JS is locally saturated and we get vanishing gradients, as can be seen in Figure 1 of this paper and Theorem 2.4 of [1]. In Figure 2 we show a proof of concept of this, where we train a GAN discriminator and a WGAN critic till optimality. The discriminator learns very quickly to distinguish between fake and real, and as expected provides no reliable gradient information. The critic, however, can’t saturate, and converges to a linear function that gives remarkably clean gradients everywhere. The fact that we constrain the weights limits the possible growth of the function to be at most linear in different parts of the space, forcing the optimal critic to have this behaviour.

EM 距离连续且几乎处处可微,意味着我们可以(也应该)把评判器训到最优。理由很简单:评判器训得越充分,得到的 Wasserstein 梯度就越可靠;而 Wasserstein 几乎处处可微,这些梯度确实有用。对 JS 而言,判别器变好时梯度看起来更「可靠」,但真正的梯度是 0,因为 JS 局部饱和,会出现梯度消失,见图 1 以及 [1] 的定理 2.4。图 2 给出概念验证:把 GAN 判别器与 WGAN 评判器都训到最优。判别器很快学会区分真假,并如预期不再提供可靠梯度信息;评判器则无法饱和,收敛到在空间各处给出异常干净梯度的线性函数。权重受约束,使得函数在空间不同区域至多线性增长,从而迫使最优评判器呈现这种行为。

Figure 2

Figure 2: Optimal discriminator and critic when learning to differentiate two Gaussians. As we can see, the discriminator of a minimax GAN saturates and results in vanishing gradients. Our WGAN critic provides very clean gradients on all parts of the space.

图 2:区分两个高斯时的最优判别器与评判器。可见,minimax GAN 的判别器饱和并导致梯度消失;我们的 WGAN 评判器在空间各处都提供非常干净的梯度。

Perhaps more importantly, the fact that we can train the critic till optimality makes it impossible to collapse modes when we do. This is due to the fact that mode collapse comes from the fact that the optimal generator for a fixed discriminator is a sum of deltas on the points the discriminator assigns the highest values, as observed by [4] and highlighted in [11].

或许更重要的是:能够把评判器训到最优,使得在这种设定下不可能发生模式崩塌。原因在于:对固定判别器,最优生成器是判别器赋值最高的那些点上的 delta 之和,这一点由 [4] 观察到、并由 [11] 强调;模式崩塌正源于此。

In the following section we display the practical benefits of our new algorithm, and we provide an in-depth comparison of its behaviour and that of traditional GANs.

下一节展示新算法的实践收益,并深入比较它与传统 GAN 的行为。

4 Empirical Results

4 实验结果

We run experiments on image generation using our Wasserstein-GAN algorithm and show that there are significant practical benefits to using it over the formulation used in standard GANs.

我们用 Wasserstein-GAN 算法做图像生成实验,表明相对标准 GAN 的目标形式,它带来显著的实践收益。

We claim two main benefits:

我们声称两项主要收益:

  • • a meaningful loss metric that correlates with the generator’s convergence and sample quality
  • • 有意义的损失度量,与生成器收敛及样本质量相关
  • • improved stability of the optimization process
  • • 优化过程稳定性更好

4.1 Experimental Procedure

4.1 实验设定

We run experiments on image generation. The target distribution to learn is the LSUN-Bedrooms dataset [24] – a collection of natural images of indoor bedrooms. Our baseline comparison is DCGAN [18], a GAN with a convolutional architecture trained with the standard GAN procedure using the −log⁡D-\log D−logD trick [4]. The generated samples are 3-channel images of 64x64 pixels in size. We use the hyper-parameters specified in Algorithm 1 for all of our experiments.

我们做图像生成实验。要学习的目标分布是 LSUN-Bedrooms 数据集 [24]——室内卧室自然图像集合。基线对照是 DCGAN [18],即以卷积架构、按标准 GAN 流程并用 −log⁡D-\log D−logD 技巧 [4] 训练的 GAN。生成样本为 64×64 像素的三通道图像。全部实验使用算法 1 中指定的超参数。

4.2 Meaningful loss metric

4.2 有意义的损失度量

Because the WGAN algorithm attempts to train the critic fff (lines 2–8 in Algorithm 1) relatively well before each generator update (line 10 in Algorithm 1), the loss function at this point is an estimate of the EM distance, up to constant factors related to the way we constrain the Lipschitz constant of fff.

由于 WGAN 算法在每次更新生成器(算法 1 第 10 行)之前,都尽量把评判器 fff(算法 1 第 2–8 行)训得较好,此时的损失函数就是 EM 距离的估计,至多差与约束 fff 的 Lipschitz 常数相关的常数因子。

Our first experiment illustrates how this estimate correlates well with the quality of the generated samples. Besides the convolutional DCGAN architecture, we also ran experiments where we replace the generator or both the generator and the critic by 4-layer ReLU-MLP with 512 hidden units.

第一个实验说明该估计与生成样本质量相关性很好。除卷积 DCGAN 架构外,我们还把生成器、或生成器与评判器二者,替换为每层 512 隐单元的 4 层 ReLU-MLP,再跑实验。

Figure 3

Figure 3: Training curves and samples at different stages of training. We can see a clear correlation between lower error and better sample quality. Upper left: the generator is an MLP with 4 hidden layers and 512 units at each layer. The loss decreases constistently as training progresses and sample quality increases. Upper right: the generator is a standard DCGAN. The loss decreases quickly and sample quality increases as well. In both upper plots the critic is a DCGAN without the sigmoid so losses can be subjected to comparison. Lower half: both the generator and the discriminator are MLPs with substantially high learning rates (so training failed). Loss is constant and samples are constant as well. The training curves were passed through a median filter for visualization purposes.

图 3:训练不同阶段的训练曲线与样本。可见误差越低、样本质量越好,相关清晰。左上:生成器为 4 隐层、每层 512 单元的 MLP。损失随训练持续下降,样本质量上升。右上:生成器为标准 DCGAN。损失快速下降,样本质量同样上升。两幅上图的评判器都是去掉 sigmoid 的 DCGAN,以便损失可比较。下半:生成器与判别器均为 MLP,学习率很高(因而训练失败)。损失几乎不变,样本也几乎不变。训练曲线经中值滤波以便可视化。

Figure 4

Figure 4: JSJSJS estimates for an MLP generator (upper left) and a DCGAN generator (upper right) trained with the standard GAN procedure. Both had a DCGAN discriminator. Both curves have increasing error. Samples get better for the DCGAN but the JS estimate increases or stays constant, pointing towards no significant correlation between sample quality and loss. Bottom: MLPMLPMLP with both generator and discriminator. The curve goes up and down regardless of sample quality. All training curves were passed through the same median filter as in Figure 3.

图 4:用标准 GAN 流程训练时,MLP 生成器(左上)与 DCGAN 生成器(右上)的 JSJSJS 估计;二者判别器均为 DCGAN。两条曲线误差都在上升。DCGAN 的样本变好,但 JS 估计上升或持平,说明样本质量与损失无明显相关。底部:生成器与判别器都是 MLP。曲线上下起伏,与样本质量无关。所有训练曲线使用与图 3 相同的中值滤波。

Figure 3p

Figure 3plots the evolution of the WGAN estimate (3) of the EM distance during WGAN training for all three architectures. The plots clearly show that these curves correlate well with the visual quality of the generated samples.

图 3 画出三种架构在 WGAN 训练过程中,EM 距离的 WGAN 估计 (3) 如何演变。图清楚表明这些曲线与生成样本的视觉质量相关性很好。

To our knowledge, this is the first time in GAN literature that such a property is shown, where the loss of the GAN shows properties of convergence. This property is extremely useful when doing research in adversarial networks as one does not need to stare at the generated samples to figure out failure modes and to gain information on which models are doing better over others.

据我们所知,这是 GAN 文献中首次展示这种性质:GAN 的损失表现出收敛特征。对抗网络研究里这一点极为有用——不必盯着生成样本才能判断失败模式,也能比较哪些模型做得更好。

However, we do not claim that this is a new method to quantitatively evaluate generative models yet. The constant scaling factor that depends on the critic’s architecture means it’s hard to compare models with different critics. Even more, in practice the fact that the critic doesn’t have infinite capacity makes it hard to know just how close to the EM distance our estimate really is. This being said, we have succesfully used the loss metric to validate our experiments repeatedly and without failure, and we see this as a huge improvement in training GANs which previously had no such facility.

不过,我们并不声称这已经是定量评价生成模型的新方法。依赖评判器架构的常数缩放因子,使得不同评判器的模型难以横向比较。更进一步,实践中评判器容量有限,也很难说估计究竟离真正的 EM 距离有多近。尽管如此,我们已反复、无失败地用该损失度量验证实验,并视之为 GAN 训练的重大改进——此前完全没有这种便利。

In contrast, Figure 4 plots the evolution of the GAN estimate of the JS distance during GAN training. More precisely, during GAN training, the discriminator is trained to maximize

作为对照,图 4 画出 GAN 训练过程中 JS 距离的 GAN 估计如何演变。更精确地说,GAN 训练中判别器被训练以最大化

L(D,gθ)=Ex∼Pr[log⁡D(x)]+Ex∼Pθ[log⁡(1−D(x))]L(D,g_{\theta})=\mathbb{E}_{x\sim\mathbb{P}_{r}}[\log D(x)]+\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[\log(1-D(x))]L(D,gθ​)=Ex∼Pr​​[logD(x)]+Ex∼Pθ​​[log(1−D(x))]

which is is a lower bound of 2JS(Pr,Pθ)−2log⁡22JS(\mathbb{P}_{r},\mathbb{P}_{\theta})-2\log 22JS(Pr​,Pθ​)−2log2. In the figure, we plot the quantity 12L(D,gθ)+log⁡2\frac{1}{2}L(D,g_{\theta})+\log 221​L(D,gθ​)+log2, which is a lower bound of the JS distance.

它是 2JS(Pr,Pθ)−2log⁡22JS(\mathbb{P}_{r},\mathbb{P}_{\theta})-2\log 22JS(Pr​,Pθ​)−2log2 的下界。图中我们画出量 12L(D,gθ)+log⁡2\frac{1}{2}L(D,g_{\theta})+\log 221​L(D,gθ​)+log2,它是 JS 距离的下界。

This quantity clearly correlates poorly the sample quality. Note also that the JS estimate usually stays constant or goes up instead of going down. In fact it often remains very close to log⁡2≈0.69\log 2\approx 0.69log2≈0.69 which is the highest value taken by the JS distance. In other words, the JS distance saturates, the discriminator has zero loss, and the generated samples are in some cases meaningful (DCGAN generator, top right plot) and in other cases collapse to a single nonsensical image [4]. This last phenomenon has been theoretically explained in [1] and highlighted in [11].

该量与样本质量相关性明显很差。还要注意:JS 估计通常持平或上升,而不是下降。事实上它往往非常接近 log⁡2≈0.69\log 2\approx 0.69log2≈0.69,即 JS 距离所能取的最大值。换句话说,JS 距离饱和,判别器损失为零;生成样本有时仍有意义(DCGAN 生成器,右上图),有时则崩塌成一张无意义图像 [4]。后一现象在 [1] 中有理论解释,并在 [11] 中被强调。

When using the −log⁡D-\log D−logD trick [4], the discriminator loss and the generator loss are different. Figure 8 in Appendix E reports the same plots for GAN training, but using the generator loss instead of the discriminator loss. This does not change the conclusions.

使用 −log⁡D-\log D−logD 技巧 [4] 时,判别器损失与生成器损失不同。附录 E 的图 8 报告了同样的 GAN 训练图,但改用生成器损失而非判别器损失。结论不变。

Finally, as a negative result, we report that WGAN training becomes unstable at times when one uses a momentum based optimizer such as Adam [8] (with β1>0\beta_{1}>0β1​>0) on the critic, or when one uses high learning rates. Since the loss for the critic is nonstationary, momentum based methods seemed to perform worse. We identified momentum as a potential cause because, as the loss blew up and samples got worse, the cosine between the Adam step and the gradient usually turned negative. The only places where this cosine was negative was in these situations of instability. We therefore switched to RMSProp [21] which is known to perform well even on very nonstationary problems [13].

最后,作为负面结果,我们报告:若对评判器使用基于动量的优化器如 Adam [8](且 β1>0\beta_{1}>0β1​>0),或使用过高学习率,WGAN 训练有时会不稳定。由于评判器损失非平稳,基于动量的方法似乎表现更差。我们把动量视为可能原因,是因为当损失爆炸、样本变差时,Adam 步与梯度的余弦通常变为负值;该余弦为负的地方,恰恰就是这些不稳定情形。因此我们改用 RMSProp [21],它在非常非平稳的问题上也表现良好 [13]。

4.3 Improved stability

4.3 稳定性提升

One of the benefits of WGAN is that it allows us to train the critic till optimality. When the critic is trained to completion, it simply provides a loss to the generator that we can train as any other neural network. This tells us that we no longer need to balance generator and discriminator’s capacity properly. The better the critic, the higher quality the gradients we use to train the generator.

WGAN 的收益之一是允许把评判器训到最优。当评判器训充分后,它只是向生成器提供一个损失,我们便可像训练任何其他神经网络一样训练生成器。这说明不再需要恰当地平衡生成器与判别器的容量。评判器越好,用来训练生成器的梯度质量越高。

We observe that WGANs are much more robust than GANs when one varies the architectural choices for the generator. We illustrate this by running experiments on three generator architectures: (1) a convolutional DCGAN generator, (2) a convolutional DCGAN generator without batch normalization and with a constant number of filters, and (3) a 4-layer ReLU-MLP with 512 hidden units. The last two are known to perform very poorly with GANs. We keep the convolutional DCGAN architecture for the WGAN critic or the GAN discriminator.

我们观察到:改变生成器的架构选择时,WGAN 比 GAN 稳健得多。我们用三种生成器架构说明:(1) 卷积 DCGAN 生成器;(2) 去掉批归一化、滤波器数量恒定的卷积 DCGAN 生成器;(3) 每层 512 隐单元的 4 层 ReLU-MLP。后两种对 GAN 以表现很差著称。WGAN 评判器或 GAN 判别器则保持卷积 DCGAN 架构。

Figure 5

Figure 5: Algorithms trained with a DCGAN generator. Left: WGAN algorithm. Right: standard GAN formulation. Both algorithms produce high quality samples.

图 5:使用 DCGAN 生成器训练的算法。左:WGAN 算法。右:标准 GAN 形式。两种算法都产生高质量样本。

Figures 7, 7, and 7 show samples generated for these three architectures using both the WGAN and GAN algorithms. We refer the reader to Appendix Appendix F for full sheets of generated samples. Samples were not cherry-picked.

图 7、7 与 7 展示这三种架构分别用 WGAN 与 GAN 算法生成的样本。完整样本页见附录 F。样本未经挑拣。

In no experiment did we see evidence of mode collapse for the WGAN algorithm.

在任何实验中,我们都未看到 WGAN 算法出现模式崩塌的迹象。

5 Related Work

5 相关工作

There’s been a number of works on the so called Integral Probability Metrics (IPMs) [15]. Given F\mathcal{F}F a set of functions from X\mathcal{X}X to R\mathbb{R}R, we can define

所谓积分概率度量(Integral Probability Metrics, IPM)[15] 已有不少工作。给定从 X\mathcal{X}X 到 R\mathbb{R}R 的函数类 F\mathcal{F}F,可定义

dF(Pr,Pθ)=sup⁡f∈FEx∼Pr[f(x)]−Ex∼Pθ[f(x)](4)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})=\sup_{f\in\mathcal{F}}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)] \tag{4}dF​(Pr​,Pθ​)=f∈Fsup​Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)](4)

as an integral probability metric associated with the function class F\mathcal{F}F. It is easily verified that if for every f∈Ff\in\mathcal{F}f∈F we have −f∈F-f\in\mathcal{F}−f∈F (such as all examples we’ll consider), then dFd_{\mathcal{F}}dF​ is nonnegative, satisfies the triangular inequality, and is symmetric. Thus, dFd_{\mathcal{F}}dF​ is a pseudometric over Prob(X)\text{Prob}(\mathcal{X})Prob(X).

为与函数类 F\mathcal{F}F 相伴的积分概率度量。容易验证:若对每个 f∈Ff\in\mathcal{F}f∈F 都有 −f∈F-f\in\mathcal{F}−f∈F(我们将考虑的例子皆如此),则 dFd_{\mathcal{F}}dF​ 非负、满足三角不等式且对称。因此 dFd_{\mathcal{F}}dF​ 是 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 上的伪度量。

While IPMs might seem to share a similar formula, as we will see different classes of functions can yeald to radically different metrics.

尽管 IPM 看起来公式相近,我们将看到:不同的函数类会给出截然不同的度量。

  • • By the Kantorovich-Rubinstein duality [22], we know that W(Pr,Pθ)=dF(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})=d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)=dF​(Pr​,Pθ​) when F\mathcal{F}F is the set of 1-Lipschitz functions. Furthermore, if F\mathcal{F}F is the set of KKK-Lipschitz functions, we get K⋅W(Pr,Pθ)=dF(Pr,Pθ)K\cdot W(\mathbb{P}_{r},\mathbb{P}_{\theta})=d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})K⋅W(Pr​,Pθ​)=dF​(Pr​,Pθ​).
  • • 由 Kantorovich-Rubinstein 对偶 [22],当 F\mathcal{F}F 为 1-Lipschitz 函数全体时,W(Pr,Pθ)=dF(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})=d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​)=dF​(Pr​,Pθ​)。进一步,若 F\mathcal{F}F 为 KKK-Lipschitz 函数全体,则 K⋅W(Pr,Pθ)=dF(Pr,Pθ)K\cdot W(\mathbb{P}_{r},\mathbb{P}_{\theta})=d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})K⋅W(Pr​,Pθ​)=dF​(Pr​,Pθ​)。
  • • When F\mathcal{F}F is the set of all measurable functions bounded between -1 and 1 (or all continuous functions between -1 and 1), we retrieve dF(Pr,Pθ)=δ(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})=\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​)=δ(Pr​,Pθ​) the total variation distance [15]. This already tells us that going from 1-Lipschitz to 1-Bounded functions drastically changes the topology of the space, and the regularity of dF(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​) as a loss function (as by Theorems 1 and 2).
  • • 当 F\mathcal{F}F 为取值介于 −1-1−1 与 111 的全体可测函数(或介于 −1-1−1 与 111 的全体连续函数)时,得到 dF(Pr,Pθ)=δ(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})=\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​)=δ(Pr​,Pθ​),即全变差距离 [15]。这说明从 1-Lipschitz 换成 1-有界函数会剧烈改变空间拓扑,以及 dF(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​) 作为损失函数的正则性(见定理 1 与 2)。
  • • Energy-based GANs (EBGANs) [25] can be thought of as the generative approach to the total variation distance. This connection is stated and proven in depth in Appendix Appendix D. At the core of the connection is that the discriminator will play the role of fff maximizing equation (4) while its only restriction is being between 000 and mmm for some constant mmm. This will yeald the same behaviour as being restricted to be between −1-1−1 and 111 up to a constant scaling factor irrelevant to optimization. Thus, when the discriminator approaches optimality the cost for the generator will aproximate the total variation distance δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​). Since the total variation distance displays the same regularity as the JS, it can be seen that EBGANs will suffer from the same problems of classical GANs regarding not being able to train the discriminator till optimality and thus limiting itself to very imperfect gradients.
  • • 基于能量的 GAN(EBGAN)[25] 可视为全变差距离的生成式做法。这一联系在附录 D 中有完整陈述与证明。核心在于:判别器扮演最大化方程 (4) 中 fff 的角色,其唯一限制是取值介于 000 与某个常数 mmm 之间。这与限制在 −1-1−1 与 111 之间行为相同,只差一个对优化无关紧要的常数缩放。因此当判别器接近最优时,生成器的代价会近似全变差距离 δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​)。由于全变差与 JS 具有相同的正则性,可见 EBGAN 会遭受与经典 GAN 同样的问题:无法把判别器训到最优,从而只能拿到非常不完美的梯度。
  • • Maximum Mean Discrepancy (MMD) [5] is a specific case of integral probability metrics when F={f∈H:∥f∥∞≤1}\mathcal{F}=\{f\in\mathcal{H}:\|f\|_{\infty}\leq 1\}F={f∈H:∥f∥∞​≤1} for H\mathcal{H}H some Reproducing Kernel Hilbert Space (RKHS) associated with a given kernel k:X×X→Rk:\mathcal{X}\times\mathcal{X}\rightarrow\mathbb{R}k:X×X→R. As proved on [5] we know that MMD is a proper metric and not only a pseudometric when the kernel is universal. In the specific case where H=L2(X,m)\mathcal{H}=L^{2}(\mathcal{X},m)H=L2(X,m) for mmm the normalized Lebesgue measure on X\mathcal{X}X, we know that {f∈Cb(X),∥f∥∞≤1}\{f\in C_{b}(\mathcal{X}),\|f\|_{\infty}\leq 1\}{f∈Cb​(X),∥f∥∞​≤1} will be contained in F\mathcal{F}F, and therefore dF(Pr,Pθ)≤δ(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})\leq\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​)≤δ(Pr​,Pθ​) so the regularity of the MMD distance as a loss function will be at least as bad as the one of the total variation. Nevertheless this is a very extreme case, since we would need a very powerful kernel to approximate the whole L2L^{2}L2. However, even Gaussian kernels are able to detect tiny noise patterns as recently evidenced by [20]. This points to the fact that especially with low bandwidth kernels, the distance might be close to a saturating regime similar as with total variation or the JS. This obviously doesn’t need to be the case for every kernel, and figuring out how and which different MMDs are closer to Wasserstein or total variation distances is an interesting topic of research. The great aspect of MMD is that via the kernel trick there is no need to train a separate network to maximize equation (4) for the ball of a RKHS. However, this has the disadvantage that evaluating the MMD distance has computational cost that grows quadratically with the amount of samples used to estimate the expectations in (4). This last point makes MMD have limited scalability, and is sometimes inapplicable to many real life applications because of it. There are estimates with linear computational cost for the MMD [5] which in a lot of cases makes MMD very useful, but they also have worse sample complexity.
  • • 最大均值差异(Maximum Mean Discrepancy, MMD)[5] 是积分概率度量的特例:取 F={f∈H:∥f∥∞≤1}\mathcal{F}=\{f\in\mathcal{H}:\|f\|_{\infty}\leq 1\}F={f∈H:∥f∥∞​≤1},其中 H\mathcal{H}H 为与给定核 k:X×X→Rk:\mathcal{X}\times\mathcal{X}\rightarrow\mathbb{R}k:X×X→R 相伴的再生核希尔伯特空间(RKHS)。[5] 证明:当核普遍(universal)时,MMD 是真正的度量而非仅伪度量。在 H=L2(X,m)\mathcal{H}=L^{2}(\mathcal{X},m)H=L2(X,m)、mmm 为 X\mathcal{X}X 上归一化 Lebesgue 测度这一特例中,{f∈Cb(X),∥f∥∞≤1}\{f\in C_{b}(\mathcal{X}),\|f\|_{\infty}\leq 1\}{f∈Cb​(X),∥f∥∞​≤1} 含于 F\mathcal{F}F,因而 dF(Pr,Pθ)≤δ(Pr,Pθ)d_{\mathcal{F}}(\mathbb{P}_{r},\mathbb{P}_{\theta})\leq\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})dF​(Pr​,Pθ​)≤δ(Pr​,Pθ​),于是 MMD 作为损失函数的正则性至少与全变差一样差。不过这是极端情形,因为需要很强的核才能逼近整个 L2L^{2}L2。即便高斯核也能检测极细微的噪声模式,[20] 最近的证据即是。这说明尤其在低带宽核下,该距离可能接近类似全变差或 JS 的饱和区间。当然并非每个核都会如此;弄清不同 MMD 如何更接近 Wasserstein 或全变差,是有趣的研究方向。MMD 的一大优点是:借助核技巧,不必另训网络去最大化 RKHS 球上的方程 (4)。缺点是:估计 MMD 的计算代价随用于估计 (4) 中期望的样本数二次增长。这使 MMD 可扩展性受限,有时因代价过高而不适用于许多实际问题。存在计算代价线性于样本数的 MMD 估计 [5],很多情形下很有用,但样本复杂度更差。
  • • Generative Moment Matching Networks (GMMNs) [10, 2] are the generative counterpart of MMD. By backproping through the kernelized formula for equation (4), they directly optimize dMMD(Pr,Pθ)d_{MMD}(\mathbb{P}_{r},\mathbb{P}_{\theta})dMMD​(Pr​,Pθ​) (the IPM when F\mathcal{F}F is as in the previous item). As mentioned, this has the advantage of not requiring a separate network to approximately maximize equation (4). However, GMMNs have enjoyed limited applicability. Partial explanations for their unsuccess are the quadratic cost as a function of the number of samples and vanishing gradients for low-bandwidth kernels. Furthermore, it may be possible that some kernels used in practice are unsuitable for capturing very complex distances in high dimensional sample spaces such as natural images. This is properly justified by the fact that [19] shows that for the typical Gaussian MMD test to be reliable (as in it’s power as a statistical test approaching 1), we need the number of samples to grow linearly with the number of dimensions. Since the MMD computational cost grows quadratically with the number of samples in the batch used to estimate equation (4), this makes the cost of having a reliable estimator grow quadratically with the number of dimensions, which makes it very inapplicable for high dimensional problems. Indeed, for something as standard as 646464x646464 images, we would need minibatches of size at least 409640964096 (without taking into account the constants in the bounds of [19] which would make this number substantially larger) and a total cost per iteration of 409624096^{2}40962, over 5 orders of magnitude more than a GAN iteration when using the standard batch size of 64. That being said, these numbers can be a bit unfair to the MMD, in the sense that we are comparing empirical sample complexity of GANs with the theoretical sample complexity of MMDs, which tends to be worse. However, in the original GMMN paper [10] they indeed used a minibatch of size 1000, much larger than the standard 32 or 64 (even when this incurred in quadratic computational cost). While estimates that have linear computational cost as a function of the number of samples exist [5], they have worse sample complexity, and to the best of our knowledge they haven’t been yet applied in a generative context such as in GMMNs.
  • • 生成矩匹配网络(Generative Moment Matching Networks, GMMN)[10, 2] 是 MMD 的生成式对应。通过对方程 (4) 的核化公式反向传播,它们直接优化 dMMD(Pr,Pθ)d_{MMD}(\mathbb{P}_{r},\mathbb{P}_{\theta})dMMD​(Pr​,Pθ​)(即 F\mathcal{F}F 如上一项时的 IPM)。如前所述,优点是不必另训网络近似最大化 (4)。然而 GMMN 应用有限。部分解释包括:代价随样本数二次增长,以及低带宽核下的梯度消失。此外,实践中使用的某些核可能不适合刻画自然图像等高维样本空间中的复杂距离。[19] 表明:要使典型高斯 MMD 检验可靠(功效趋于 1),样本数需随维数线性增长。由于估计 (4) 的 MMD 计算代价随批内样本数二次增长,可靠估计器的代价将随维数二次增长,对高维问题很不实用。的确,对标准的 64×6464\times 6464×64 图像,至少需要大小为 409640964096 的小批量(尚未计入 [19] 界中的常数,那些常数会使该数字显著更大),每步总代价 409624096^{2}40962,比标准批大小 64 的 GAN 迭代高出五个数量级以上。当然,这些数字对 MMD 可能略欠公允:我们是在用 GAN 的经验样本复杂度对照 MMD 的理论样本复杂度,后者往往更差。不过原 GMMN 论文 [10] 确实使用大小 1000 的小批量,远大于标准的 32 或 64(即便这会带来二次计算代价)。虽存在对样本数线性代价的估计 [5],但样本复杂度更差,且据我们所知尚未用于类似 GMMN 的生成设定。

On another great line of research, the recent work of [14] has explored the use of Wasserstein distances in the context of learning for Restricted Boltzmann Machines for discrete spaces. The motivations at a first glance might seem quite different, since the manifold setting is restricted to continuous spaces and in finite discrete spaces the weak and strong topologies (the ones of W and JS respectively) coincide. However, in the end there is more in commmon than not about our motivations. We both want to compare distributions in a way that leverages the geometry of the underlying space, and Wasserstein allows us to do exactly that.

另一条重要研究线是 [14] 近期的工作:在离散空间上把 Wasserstein 距离用于受限玻尔兹曼机的学习。乍看动机似乎很不同,因为流形设定限于连续空间,而在有限离散空间上弱拓扑与强拓扑(分别对应 W 与 JS)重合。不过归根结底,双方动机的共同点多于差异。我们都希望以利用底层空间几何的方式比较分布,而 Wasserstein 恰好允许我们这样做。

Finally, the work of [3] shows new algorithms for calculating Wasserstein distances between different distributions. We believe this direction is quite important, and perhaps could lead to new ways of evaluating generative models.

最后,[3] 给出计算不同分布之间 Wasserstein 距离的新算法。我们认为这一方向相当重要,或许能带来评价生成模型的新途径。

6 Conclusion

6 结论

We introduced an algorithm that we deemed WGAN, an alternative to traditional GAN training. In this new model, we showed that we can improve the stability of learning, get rid of problems like mode collapse, and provide meaningful learning curves useful for debugging and hyperparameter searches. Furthermore, we showed that the corresponding optimization problem is sound, and provided extensive theoretical work highlighting the deep connections to other distances between distributions.

我们引入称为 WGAN 的算法,作为传统 GAN 训练的替代。在这一新模型中,我们表明可以改善学习稳定性、摆脱模式崩塌等问题,并提供对调试与超参搜索有用的、有意义的学习曲线。此外,我们说明相应优化问题可靠,并给出大量理论工作,突出它与其他分布间距离的深层联系。

Acknowledgments

致谢

We would like to thank Mohamed Ishmael Belghazi, Emily Denton, Ian Goodfellow, Ishaan Gulrajani, Alex Lamb, David Lopez-Paz, Eric Martin, Maxime Oquab, Aditya Ramesh, Ronan Riochet, Uri Shalit, Pablo Sprechmann, Arthur Szlam, Ruohan Wang, for helpful comments and advice.

感谢 Mohamed Ishmael Belghazi、Emily Denton、Ian Goodfellow、Ishaan Gulrajani、Alex Lamb、David Lopez-Paz、Eric Martin、Maxime Oquab、Aditya Ramesh、Ronan Riochet、Uri Shalit、Pablo Sprechmann、Arthur Szlam、Ruohan Wang 提供有益评论与建议。

References

参考文献

[1] Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. In International Conference on Learning Representations , 2017. Under review.

[2] Gintare Karolina Dziugaite, Daniel M. Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. CoRR , abs/1505.03906, 2015.

[3] Aude Genevay, Marco Cuturi, Gabriel Peyré, and Francis Bach. Stochastic optimization for large-scale optimal transport. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems 29 , pages 3440–3448. Curran Associates, Inc., 2016.

[4] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems 27 , pages 2672–2680. Curran Associates, Inc., 2014.

[5] Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. J. Mach. Learn. Res. , 13:723–773, 2012.

[6] Ferenc Huszar. How (not) to train your generative model: Scheduled sampling, likelihood, adversary? CoRR , abs/1511.05101, 2015.

[7] Shizuo Kakutani. Concrete representation of abstract (m)-spaces (a characterization of the space of continuous functions). Annals of Mathematics , 42(4):994–1024, 1941.

[8] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR , abs/1412.6980, 2014.

[9] Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR , abs/1312.6114, 2013.

[10] Yujia Li, Kevin Swersky, and Rich Zemel. Generative moment matching networks. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15) , pages 1718–1727. JMLR Workshop and Conference Proceedings, 2015.

[11] Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. Corr , abs/1611.02163, 2016.

[12] Paul Milgrom and Ilya Segal. Envelope theorems for arbitrary choice sets. Econometrica , 70(2):583–601, 2002.

[13] Volodymyr Mnih, Adrià Puigdomènech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016 , pages 1928–1937, 2016.

[14] Grégoire Montavon, Klaus-Robert Müller, and Marco Cuturi. Wasserstein training of restricted boltzmann machines. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems 29 , pages 3718–3726. Curran Associates, Inc., 2016.

[15] Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in Applied Probability , 29(2):429–443, 1997.

[16] Radford M. Neal. Annealed importance sampling. Statistics and Computing , 11(2):125–139, April 2001.

[17] Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. pages 271–279, 2016.

[18] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR , abs/1511.06434, 2015.

[19] Aaditya Ramdas, Sashank J. Reddi, Barnabas Poczos, Aarti Singh, and Larry Wasserman. On the high-dimensional power of linear-time kernel two-sample testing under mean-difference alternatives. Corr , abs/1411.6314, 2014.

[20] Dougal J Sutherland, Hsiao-Yu Tung, Heiko Strathmann, Soumyajit De, Aaditya Ramdas, Alex Smola, and Arthur Gretton. Generative models and model criticism via optimized maximum mean discrepancy. In International Conference on Learning Representations , 2017. Under review.

[21] T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.

[22] Cédric Villani. Optimal Transport: Old and New . Grundlehren der mathematischen Wissenschaften. Springer, Berlin, 2009.

[23] Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger B. Grosse. On the quantitative analysis of decoder-based generative models. CoRR , abs/1611.04273, 2016.

[24] Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. LSUN: Construction of a large-scale image dataset using deep learning with humans in the loop. Corr , abs/1506.03365, 2015.

[25] Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. Corr , abs/1609.03126, 2016.

Appendix A Why Wasserstein is indeed weak

附录 A 为何 Wasserstein 确实更弱

We now introduce our notation. Let X⊆Rd\mathcal{X}\subseteq{\mathbb{R}^{d}}X⊆Rd be a compact set (such as [0,1]d[0,1]^{d}[0,1]d the space of images). We define Prob(X)\text{Prob}(\mathcal{X})Prob(X) to be the space of probability measures over X\mathcal{X}X. We note

先约定记号。设 X⊆Rd\mathcal{X}\subseteq{\mathbb{R}^{d}}X⊆Rd 为紧集(例如图像空间 [0,1]d[0,1]^{d}[0,1]d)。定义 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 为 X\mathcal{X}X 上的概率测度空间。记

Cb(X)={f:X→R, f is continuous and bounded}C_{b}(\mathcal{X})=\{f:\mathcal{X}\to\mathbb{R}\text{, $f$ is continuous and bounded}\}Cb​(X)={f:X→R, f is continuous and bounded}

Note that if f∈Cb(X)f\in C_{b}(\mathcal{X})f∈Cb​(X), we can define ∥f∥∞=max⁡x∈X∣f(x)∣\|f\|_{\infty}=\max_{x\in\mathcal{X}}|f(x)|∥f∥∞​=maxx∈X​∣f(x)∣, since fff is bounded. With this norm, the space (Cb(X),∥⋅∥∞)(C_{b}(\mathcal{X}),\|\cdot\|_{\infty})(Cb​(X),∥⋅∥∞​) is a normed vector space. As for any normed vector space, we can define its dual

注意:若 f∈Cb(X)f\in C_{b}(\mathcal{X})f∈Cb​(X),可定义 ∥f∥∞=max⁡x∈X∣f(x)∣\|f\|_{\infty}=\max_{x\in\mathcal{X}}|f(x)|∥f∥∞​=maxx∈X​∣f(x)∣,因为 fff 有界。配备该范数后,(Cb(X),∥⋅∥∞)(C_{b}(\mathcal{X}),\|\cdot\|_{\infty})(Cb​(X),∥⋅∥∞​) 为赋范向量空间。对任意赋范向量空间,可定义其对偶

$C_{b}(\mathcal{X})^{*}=\{\phi:C_{b}(\mathcal{X})\rightarrow\mathbb{R}\text{,\phi$ is linear
and continuous}}$$

and give it the dual norm ∥ϕ∥=sup⁡f∈Cb(X),∥f∥∞≤1∣ϕ(f)∣\|\phi\|=\sup_{f\in C_{b}(\mathcal{X}),\|f\|_{\infty}\leq 1}|\phi(f)|∥ϕ∥=supf∈Cb​(X),∥f∥∞​≤1​∣ϕ(f)∣.

并赋予对偶范数 ∥ϕ∥=sup⁡f∈Cb(X),∥f∥∞≤1∣ϕ(f)∣\|\phi\|=\sup_{f\in C_{b}(\mathcal{X}),\|f\|_{\infty}\leq 1}|\phi(f)|∥ϕ∥=supf∈Cb​(X),∥f∥∞​≤1​∣ϕ(f)∣。

With this definitions, (Cb(X)∗,∥⋅∥)(C_{b}(\mathcal{X})^{*},\|\cdot\|)(Cb​(X)∗,∥⋅∥) is another normed space. Now let μ\muμ be a signed measure over X\mathcal{X}X, and let us define the total variation distance

在这些定义下,(Cb(X)∗,∥⋅∥)(C_{b}(\mathcal{X})^{*},\|\cdot\|)(Cb​(X)∗,∥⋅∥) 又是一个赋范空间。现设 μ\muμ 为 X\mathcal{X}X 上的符号测度,定义全变差距离

∥μ∥TV=sup⁡A⊆X∣μ(A)∣\|\mu\|_{TV}=\sup_{A\subseteq\mathcal{X}}|\mu(A)|∥μ∥TV​=A⊆Xsup​∣μ(A)∣

where the supremum is taken all Borel sets in X\mathcal{X}X. Since the total variation is a norm, then if we have Pr\mathbb{P}_{r}Pr​ and Pθ\mathbb{P}_{\theta}Pθ​ two probability distributions over X\mathcal{X}X,

其中上确界取遍 X\mathcal{X}X 的全体 Borel 集。由于全变差是范数,若 Pr\mathbb{P}_{r}Pr​ 与 Pθ\mathbb{P}_{\theta}Pθ​ 为 X\mathcal{X}X 上的两个概率分布,则

δ(Pr,Pθ):=∥Pr−Pθ∥TV\delta(\mathbb{P}_{r},\mathbb{P}_{\theta}):=\|\mathbb{P}_{r}-\mathbb{P}_{\theta}\|_{TV}δ(Pr​,Pθ​):=∥Pr​−Pθ​∥TV​

is a distance in Prob(X)\text{Prob}(\mathcal{X})Prob(X) (called the total variation distance).

是 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 上的距离(称为全变差距离)。

We can consider

我们可以考虑

Φ:(Prob(X),δ)→(Cb(X)∗,∥⋅∥)\Phi:(\text{Prob}(\mathcal{X}),\delta)\rightarrow(C_{b}(\mathcal{X})^{*},\|\cdot\|)Φ:(Prob(X),δ)→(Cb​(X)∗,∥⋅∥)

where Φ(P)(f):=Ex∼P[f(x)]\Phi(\mathbb{P})(f):=\mathbb{E}_{x\sim\mathbb{P}}[f(x)]Φ(P)(f):=Ex∼P​[f(x)] is a linear function over Cb(X)C_{b}(\mathcal{X})Cb​(X). The Riesz Representation theorem ([7], Theorem 10) tells us that Φ\PhiΦ is an isometric immersion. This tells us that we can effectively consider Prob(X)\text{Prob}(\mathcal{X})Prob(X) with the total variation distance as a subset of Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗ with the norm distance. Thus, just to accentuate it one more time, the total variation over Prob(X)\text{Prob}(\mathcal{X})Prob(X) is exactly the norm distance over Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗.

其中 Φ(P)(f):=Ex∼P[f(x)]\Phi(\mathbb{P})(f):=\mathbb{E}_{x\sim\mathbb{P}}[f(x)]Φ(P)(f):=Ex∼P​[f(x)] 是 Cb(X)C_{b}(\mathcal{X})Cb​(X) 上的线性泛函。Riesz 表示定理([7],定理 10)告诉我们 Φ\PhiΦ 是等距浸入。这意味着我们可以有效地把配备全变差距离的 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 视为配备范数距离的 Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗ 的子集。因此,再强调一次:Prob(X)\text{Prob}(\mathcal{X})Prob(X) 上的全变差恰好是 Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗ 上的范数距离。

Let us stop for a second and analyze what all this technicality meant. The main thing to carry is that we introduced a distance δ\deltaδ over probability distributions. When looked as a distance over a subset of Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗, this distance gives the norm topology. The norm topology is very strong. Therefore, we can expect that not many functions θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ will be continuous when measuring distances between distributions with δ\deltaδ. As we will show later in Theorem 2, δ\deltaδ gives the same topology as the Jensen-Shannon divergence, pointing to the fact that the JS is a very strong distance, and is thus more propense to give a discontinuous loss function.

停下来分析这些技术细节意味着什么。要带走的主要一点是:我们在概率分布上引入了距离 δ\deltaδ。当把它看作 Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗ 子集上的距离时,该距离给出范数拓扑。范数拓扑非常强。因此可以预期:用 δ\deltaδ 度量分布间距离时,不会有很多函数 θ↦Pθ\theta\mapsto\mathbb{P}_{\theta}θ↦Pθ​ 连续。后面定理 2 将表明 δ\deltaδ 与 Jensen-Shannon 散度给出相同拓扑,说明 JS 是很强的距离,因而更容易给出不连续的损失函数。

Now, all dual spaces (such as Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗ and thus Prob(X)\text{Prob}(\mathcal{X})Prob(X)) have a strong topology (induced by the norm), and a weak* topology. As the name suggests, the weak* topology is much weaker than the strong topology. In the case of Prob(X)\text{Prob}(\mathcal{X})Prob(X), the strong topology is given by the total variation distance, and the weak* topology is given by the Wasserstein distance (among others) [22].

所有对偶空间(例如 Cb(X)∗C_{b}(\mathcal{X})^{*}Cb​(X)∗,因而也包括 Prob(X)\text{Prob}(\mathcal{X})Prob(X))都有强拓扑(由范数诱导)与弱* 拓扑。顾名思义,弱* 拓扑远弱于强拓扑。对 Prob(X)\text{Prob}(\mathcal{X})Prob(X),强拓扑由全变差距离给出,弱* 拓扑则由 Wasserstein 距离(以及其他若干距离)给出 [22]。

Appendix B Assumption definitions

附录 B 假设的定义

Assumption 1.

Let g:Z×Rd→Xg:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}g:Z×Rd→X be locally Lipschitz between finite dimensional vector spaces. We will denote gθ(z)g_{\theta}(z)gθ​(z) it’s evaluation on coordinates (z,θ)(z,\theta)(z,θ). We say that ggg satisfies assumption 1 for a certain probability distribution ppp over Z\mathcal{Z}Z if there are local Lipschitz constants L(θ,z)L(\theta,z)L(θ,z) such that

假设 1。 设 g:Z×Rd→Xg:\mathcal{Z}\times\mathbb{R}^{d}\rightarrow\mathcal{X}g:Z×Rd→X 为有限维向量空间之间的局部 Lipschitz 映射。在坐标 (z,θ)(z,\theta)(z,θ) 上的取值记为 gθ(z)g_{\theta}(z)gθ​(z)。若存在局部 Lipschitz 常数 L(θ,z)L(\theta,z)L(θ,z) 使得

Ez∼p[L(θ,z)]<+∞\mathbb{E}_{z\sim p}[L(\theta,z)]<+\inftyEz∼p​[L(θ,z)]<+∞

Appendix C Proofs of things

附录 C 证明

Proof of Theorem 1.

Let θ\thetaθ and θ′\theta^{\prime}θ′ be two parameter vectors in Rd\mathbb{R}^{d}Rd. Then, we will first attempt to bound W(Pθ,Pθ′)W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})W(Pθ​,Pθ′​), from where the theorem will come easily. The main element of the proof is the use of the coupling γ\gammaγ, the distribution of the joint (gθ(Z),gθ′(Z))(g_{\theta}(Z),g_{\theta^{\prime}}(Z))(gθ​(Z),gθ′​(Z)), which clearly has γ∈Π(Pθ,Pθ′)\gamma\in\Pi(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})γ∈Π(Pθ​,Pθ′​).

定理 1 的证明。 设 θ\thetaθ 与 θ′\theta^{\prime}θ′ 为 Rd\mathbb{R}^{d}Rd 中两个参数向量。我们先尝试界住 W(Pθ,Pθ′)W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})W(Pθ​,Pθ′​),定理将由此容易得出。证明的关键要素是使用耦合 γ\gammaγ,即联合 (gθ(Z),gθ′(Z))(g_{\theta}(Z),g_{\theta^{\prime}}(Z))(gθ​(Z),gθ′​(Z)) 的分布,显然 γ∈Π(Pθ,Pθ′)\gamma\in\Pi(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})γ∈Π(Pθ​,Pθ′​)。

By the definition of the Wasserstein distance, we have

由 Wasserstein 距离的定义,有

W(Pθ,Pθ′)≤∫X×X∥x−y∥ ⁣dγ=E(x,y)∼γ[∥x−y∥]=Ez[∥gθ(z)−gθ′(z)∥]\displaystyle W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}}) \\ \displaystyle\leq\int_{\mathcal{X}\times\mathcal{X}}\|x-y\|\mathop{}\!\mathrm{d}\gamma \\ \displaystyle=\mathbb{E}_{(x,y)\sim\gamma}[\|x-y\|] \\ \displaystyle=\mathbb{E}_{z}[\|g_{\theta}(z)-g_{\theta^{\prime}}(z)\|]W(Pθ​,Pθ′​)≤∫X×X​∥x−y∥dγ=E(x,y)∼γ​[∥x−y∥]=Ez​[∥gθ​(z)−gθ′​(z)∥]

If ggg is continuous in θ\thetaθ, then gθ(z)→θ→θ′gθ′(z)g_{\theta}(z)\to_{\theta\to\theta^{\prime}}g_{\theta^{\prime}}(z)gθ​(z)→θ→θ′​gθ′​(z), so ∥gθ−gθ′∥→0\|g_{\theta}-g_{\theta^{\prime}}\|\to 0∥gθ​−gθ′​∥→0 pointwise as functions of zzz. Since X\mathcal{X}X is compact, the distance of any two elements in it has to be uniformly bounded by some constant MMM, and therefore ∥gθ(z)−gθ′(z)∥≤M\|g_{\theta}(z)-g_{\theta^{\prime}}(z)\|\leq M∥gθ​(z)−gθ′​(z)∥≤M for all θ\thetaθ and zzz uniformly. By the bounded convergence theorem, we therefore have

若 ggg 关于 θ\thetaθ 连续,则 gθ(z)→θ→θ′gθ′(z)g_{\theta}(z)\to_{\theta\to\theta^{\prime}}g_{\theta^{\prime}}(z)gθ​(z)→θ→θ′​gθ′​(z),因而 ∥gθ−gθ′∥\|g_{\theta}-g_{\theta^{\prime}}\|∥gθ​−gθ′​∥ 作为 zzz 的函数逐点趋于 0。由于 X\mathcal{X}X 紧,其中任意两点距离被某常数 MMM 一致上界,故对所有 θ\thetaθ 与 zzz 一致有 ∥gθ(z)−gθ′(z)∥≤M\|g_{\theta}(z)-g_{\theta^{\prime}}(z)\|\leq M∥gθ​(z)−gθ′​(z)∥≤M。由有界收敛定理,因而有

W(Pθ,Pθ′)≤Ez[∥gθ(z)−gθ′(z)∥]→θ→θ′0W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})\leq\mathbb{E}_{z}[\|g_{\theta}(z)-g_{\theta^{\prime}}(z)\|]\to_{\theta\to\theta^{\prime}}0W(Pθ​,Pθ′​)≤Ez​[∥gθ​(z)−gθ′​(z)∥]→θ→θ′​0

Finally, we have that

最后,我们有

∣W(Pr,Pθ)−W(Pr,Pθ′)∣≤W(Pθ,Pθ′)→θ→θ′0|W(\mathbb{P}_{r},\mathbb{P}_{\theta})-W(\mathbb{P}_{r},\mathbb{P}_{\theta^{\prime}})|\leq W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})\to_{\theta\to\theta^{\prime}}0∣W(Pr​,Pθ​)−W(Pr​,Pθ′​)∣≤W(Pθ​,Pθ′​)→θ→θ′​0

proving the continuity of W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​).

从而证明了 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 的连续性。

Now let ggg be locally Lipschitz. Then, for a given pair (θ,z)(\theta,z)(θ,z) there is a constant L(θ,z)L(\theta,z)L(θ,z) and an open set UUU such that (θ,z)∈U(\theta,z)\in U(θ,z)∈U, such that for every (θ′,z′)∈U(\theta^{\prime},z^{\prime})\in U(θ′,z′)∈U we have

现设 ggg 局部 Lipschitz。则对给定对 (θ,z)(\theta,z)(θ,z),存在常数 L(θ,z)L(\theta,z)L(θ,z) 与开集 UUU 使 (θ,z)∈U(\theta,z)\in U(θ,z)∈U,且对每个 (θ′,z′)∈U(\theta^{\prime},z^{\prime})\in U(θ′,z′)∈U 有

∥gθ(z)−gθ′(z′)∥≤L(θ,z)(∥θ−θ′∥+∥z−z′∥)\|g_{\theta}(z)-g_{\theta}^{\prime}(z^{\prime})\|\leq L(\theta,z)(\|\theta-\theta^{\prime}\|+\|z-z^{\prime}\|)∥gθ​(z)−gθ′​(z′)∥≤L(θ,z)(∥θ−θ′∥+∥z−z′∥)

By taking expectations and z′=zz^{\prime}=zz′=z we

取期望并令 z′=zz^{\prime}=zz′=z,得到

Ez[∥gθ(z)−gθ′(z)∥]≤∥θ−θ′∥Ez[L(θ,z)]\mathbb{E}_{z}[\|g_{\theta}(z)-g_{\theta^{\prime}}(z)\|]\leq\|\theta-\theta^{\prime}\|\mathbb{E}_{z}[L(\theta,z)]Ez​[∥gθ​(z)−gθ′​(z)∥]≤∥θ−θ′∥Ez​[L(θ,z)]

whenever (θ′,z)∈U(\theta^{\prime},z)\in U(θ′,z)∈U. Therefore, we can define Uθ={θ′∣(θ′,z)∈U}U_{\theta}=\{\theta^{\prime}|(\theta^{\prime},z)\in U\}Uθ​={θ′∣(θ′,z)∈U}. It’s easy to see that since UUU was open, UθU_{\theta}Uθ​ is as well. Furthermore, by assumption 1, we can define L(θ)=Ez[L(θ,z)]L(\theta)=\mathbb{E}_{z}[L(\theta,z)]L(θ)=Ez​[L(θ,z)] and achieve

只要 (θ′,z)∈U(\theta^{\prime},z)\in U(θ′,z)∈U。因此可定义 Uθ={θ′∣(θ′,z)∈U}U_{\theta}=\{\theta^{\prime}|(\theta^{\prime},z)\in U\}Uθ​={θ′∣(θ′,z)∈U}。易见因 UUU 开,UθU_{\theta}Uθ​ 亦开。进一步,由假设 1,可定义 L(θ)=Ez[L(θ,z)]L(\theta)=\mathbb{E}_{z}[L(\theta,z)]L(θ)=Ez​[L(θ,z)],并得到

∣W(Pr,Pθ)−W(Pr,Pθ′)∣≤W(Pθ,Pθ′)≤L(θ)∥θ−θ′∥|W(\mathbb{P}_{r},\mathbb{P}_{\theta})-W(\mathbb{P}_{r},\mathbb{P}_{\theta^{\prime}})|\leq W(\mathbb{P}_{\theta},\mathbb{P}_{\theta^{\prime}})\leq L(\theta)\|\theta-\theta^{\prime}\|∣W(Pr​,Pθ​)−W(Pr​,Pθ′​)∣≤W(Pθ​,Pθ′​)≤L(θ)∥θ−θ′∥

for all θ′∈Uθ\theta^{\prime}\in U_{\theta}θ′∈Uθ​, meaning that W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) is locally Lipschitz. This obviously implies that W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) is everywhere continuous, and by Radamacher’s theorem we know it has to be differentiable almost everywhere.

对所有 θ′∈Uθ\theta^{\prime}\in U_{\theta}θ′∈Uθ​ 成立,意味着 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 局部 Lipschitz。这显然蕴含 W(Pr,Pθ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})W(Pr​,Pθ​) 处处连续;由 Rademacher 定理,它几乎处处可微。

The counterexample for item 3 of the Theorem is indeed Example 1. ∎

定理第 3 项的反例正是例 1。∎

Proof of Corollary 1.

We begin with the case of smooth nonlinearities. Since ggg is C1C^{1}C1 as a function of (θ,z)(\theta,z)(θ,z) then for any fixed (θ,z)(\theta,z)(θ,z) we have L(θ,Z)≤∥∇θ,xgθ(z)∥+ϵL(\theta,Z)\leq\|\nabla_{\theta,x}g_{\theta}(z)\|+\epsilonL(θ,Z)≤∥∇θ,x​gθ​(z)∥+ϵ is an acceptable local Lipschitz constant for all ϵ>0\epsilon>0ϵ>0. Therefore, it suffices to prove

推论 1 的证明。 先考虑光滑非线性。由于 ggg 作为 (θ,z)(\theta,z)(θ,z) 的函数属于 C1C^{1}C1,对任意固定 (θ,z)(\theta,z)(θ,z),L(θ,Z)≤∥∇θ,xgθ(z)∥+ϵL(\theta,Z)\leq\|\nabla_{\theta,x}g_{\theta}(z)\|+\epsilonL(θ,Z)≤∥∇θ,x​gθ​(z)∥+ϵ 对所有 ϵ>0\epsilon>0ϵ>0 都是可接受的局部 Lipschitz 常数。因此只需证明

Ez∼p(z)[∥∇θ,zgθ(z)∥]<+∞\mathbb{E}_{z\sim p(z)}[\|\nabla_{\theta,z}g_{\theta}(z)\|]<+\inftyEz∼p(z)​[∥∇θ,z​gθ​(z)∥]<+∞

If HHH is the number of layers we know that ∇zgθ(z)=∏k=1HWkDk\nabla_{z}g_{\theta}(z)=\prod_{k=1}^{H}W_{k}D_{k}∇z​gθ​(z)=∏k=1H​Wk​Dk​ where WkW_{k}Wk​ are the weight matrices and DkD_{k}Dk​ is are the diagonal Jacobians of the nonlinearities. Let fi:jf_{i:j}fi:j​ be the application of layers iii to jjj inclusively (e.g. gθ=f1:Hg_{\theta}=f_{1:H}gθ​=f1:H​). Then, ∇Wkgθ(z)=((∏i=k+1HWiDi)Dk)f1:k−1(z)\nabla_{W_{k}}g_{\theta}(z)=\left(\left(\prod_{i=k+1}^{H}W_{i}D_{i}\right)D_{k}\right)f_{1:k-1}(z)∇Wk​​gθ​(z)=((∏i=k+1H​Wi​Di​)Dk​)f1:k−1​(z). We recall that if LLL is the Lipschitz constant of the nonlinearity, then ∥Di∥≤L\|D_{i}\|\leq L∥Di​∥≤L and ∥f1:k−1(z)∥≤∥z∥Lk−1∏i=1k−1Wi\|f_{1:k-1}(z)\|\leq\|z\|L^{k-1}\prod_{i=1}^{k-1}W_{i}∥f1:k−1​(z)∥≤∥z∥Lk−1∏i=1k−1​Wi​. Putting this together,

若 HHH 为层数,则知 ∇zgθ(z)=∏k=1HWkDk\nabla_{z}g_{\theta}(z)=\prod_{k=1}^{H}W_{k}D_{k}∇z​gθ​(z)=∏k=1H​Wk​Dk​,其中 WkW_{k}Wk​ 为权矩阵,DkD_{k}Dk​ 为非线性的对角雅可比。令 fi:jf_{i:j}fi:j​ 表示第 iii 到 jjj 层(含)的复合(例如 gθ=f1:Hg_{\theta}=f_{1:H}gθ​=f1:H​)。则 ∇Wkgθ(z)=((∏i=k+1HWiDi)Dk)f1:k−1(z)\nabla_{W_{k}}g_{\theta}(z)=\left(\left(\prod_{i=k+1}^{H}W_{i}D_{i}\right)D_{k}\right)f_{1:k-1}(z)∇Wk​​gθ​(z)=((∏i=k+1H​Wi​Di​)Dk​)f1:k−1​(z)。我们回忆:若 LLL 为非线性的 Lipschitz 常数,则 ∥Di∥≤L\|D_{i}\|\leq L∥Di​∥≤L 且 ∥f1:k−1(z)∥≤∥z∥Lk−1∏i=1k−1Wi\|f_{1:k-1}(z)\|\leq\|z\|L^{k-1}\prod_{i=1}^{k-1}W_{i}∥f1:k−1​(z)∥≤∥z∥Lk−1∏i=1k−1​Wi​。合在一起,

∥∇z,θgθ(z)∥≤∥∏i=1HWiDi∥+∑k=1H∥((∏i=k+1HWiDi)Dk)f1:k−1(z)∥≤LH∏i=HK∥Wi∥+∑k=1H∥z∥LH(∏i=1k−1∥Wi∥)(∏i=k+1H∥Wi∥)\displaystyle\|\nabla_{z,\theta}g_{\theta}(z)\| \\ \displaystyle\leq\|\prod_{i=1}^{H}W_{i}D_{i}\|+\sum_{k=1}^{H}\|\left(\left(\prod_{i=k+1}^{H}W_{i}D_{i}\right)D_{k}\right)f_{1:k-1}(z)\| \\ \displaystyle\leq L^{H}\prod_{i=H}^{K}\|W_{i}\|+\sum_{k=1}^{H}\|z\|L^{H}\left(\prod_{i=1}^{k-1}\|W_{i}\|\right)\left(\prod_{i=k+1}^{H}\|W_{i}\|\right)∥∇z,θ​gθ​(z)∥≤∥i=1∏H​Wi​Di​∥+k=1∑H​∥((i=k+1∏H​Wi​Di​)Dk​)f1:k−1​(z)∥≤LHi=H∏K​∥Wi​∥+k=1∑H​∥z∥LH(i=1∏k−1​∥Wi​∥)(i=k+1∏H​∥Wi​∥)

If C1(θ)=LH(∏i=1H∥Wi∥)C_{1}(\theta)=L^{H}\left(\prod_{i=1}^{H}\|W_{i}\|\right)C1​(θ)=LH(∏i=1H​∥Wi​∥) and C2(θ)=∑k=1HLH(∏i=1k−1∥Wi∥)(∏i=k+1H∥Wi∥)C_{2}(\theta)=\sum_{k=1}^{H}L^{H}\left(\prod_{i=1}^{k-1}\|W_{i}\|\right)\left(\prod_{i=k+1}^{H}\|W_{i}\|\right)C2​(θ)=∑k=1H​LH(∏i=1k−1​∥Wi​∥)(∏i=k+1H​∥Wi​∥) then

若 C1(θ)=LH(∏i=1H∥Wi∥)C_{1}(\theta)=L^{H}\left(\prod_{i=1}^{H}\|W_{i}\|\right)C1​(θ)=LH(∏i=1H​∥Wi​∥) 且 C2(θ)=∑k=1HLH(∏i=1k−1∥Wi∥)(∏i=k+1H∥Wi∥)C_{2}(\theta)=\sum_{k=1}^{H}L^{H}\left(\prod_{i=1}^{k-1}\|W_{i}\|\right)\left(\prod_{i=k+1}^{H}\|W_{i}\|\right)C2​(θ)=∑k=1H​LH(∏i=1k−1​∥Wi​∥)(∏i=k+1H​∥Wi​∥),则

Ez∼p(z)[∥∇θ,zgθ(z)∥]≤C1(θ)+C2(θ)Ez∼p(z)[∥z∥]<+∞\mathbb{E}_{z\sim p(z)}[\|\nabla_{\theta,z}g_{\theta}(z)\|]\leq C_{1}(\theta)+C_{2}(\theta)\mathbb{E}_{z\sim p(z)}[\|z\|]<+\inftyEz∼p(z)​[∥∇θ,z​gθ​(z)∥]≤C1​(θ)+C2​(θ)Ez∼p(z)​[∥z∥]<+∞

finishing the proof ∎

证毕 ∎

Proof of Theorem 2.

定理 2 的证明。

  1. • (δ(Pn,P)→0⇒JS(Pn,P)→0\delta(\mathbb{P}_{n},\mathbb{P})\to 0\Rightarrow JS(\mathbb{P}_{n},\mathbb{P})\to 0δ(Pn​,P)→0⇒JS(Pn​,P)→0)  —  Let Pm\mathbb{P}_{m}Pm​ be the mixture distribution Pm=12Pn+12P\mathbb{P}_{m}=\frac{1}{2}\mathbb{P}_{n}+\frac{1}{2}\mathbb{P}Pm​=21​Pn​+21​P (note that Pm\mathbb{P}_{m}Pm​ depends on nnn). It is easily verified that δ(Pm,Pn)≤δ(Pn,P)\delta(\mathbb{P}_{m},\mathbb{P}_{n})\leq\delta(\mathbb{P}_{n},\mathbb{P})δ(Pm​,Pn​)≤δ(Pn​,P), and in particular this tends to 0 (as does δ(Pm,P)\delta(\mathbb{P}_{m},\mathbb{P})δ(Pm​,P)). We now show this for completeness. Let μ\muμ be a signed measure, we define ∥μ∥TV=sup⁡A⊆X∣μ(A)∣\|\mu\|_{TV}=\sup_{A\subseteq\mathcal{X}}|\mu(A)|∥μ∥TV​=supA⊆X​∣μ(A)∣. for all Borel sets AAA. In this case, δ(Pm,Pn)\displaystyle\delta(\mathbb{P}_{m},\mathbb{P}_{n})δ(Pm​,Pn​) =∥Pm−Pn∥TV\displaystyle=\|\mathbb{P}_{m}-\mathbb{P}_{n}\|_{TV}=∥Pm​−Pn​∥TV​ =∥12P+12Pn−Pn∥TV\displaystyle=\|\frac{1}{2}\mathbb{P}+\frac{1}{2}\mathbb{P}_{n}-\mathbb{P}_{n}\|_{TV}=∥21​P+21​Pn​−Pn​∥TV​ =12∥P−Pn∥TV\displaystyle=\frac{1}{2}\|\mathbb{P}-\mathbb{P}_{n}\|_{TV}=21​∥P−Pn​∥TV​ =12δ(Pn,P)≤δ(Pn,P)\displaystyle=\frac{1}{2}\delta(\mathbb{P}_{n},\mathbb{P})\leq\delta(\mathbb{P}_{n},\mathbb{P})=21​δ(Pn​,P)≤δ(Pn​,P) Let fn=dPndPmf_{n}=\frac{d\mathbb{P}_{n}}{d\mathbb{P}_{m}}fn​=dPm​dPn​​ be the Radon-Nykodim derivative between Pn\mathbb{P}_{n}Pn​ and the mixture. Note that by construction for every Borel set AAA we have Pn(A)≤2Pm(A)\mathbb{P}_{n}(A)\leq 2\mathbb{P}_{m}(A)Pn​(A)≤2Pm​(A). If A={fn>3}A=\{f_{n}>3\}A={fn​>3} then we get Pn(A)=∫Afnd⁡ ⁣Pm≥3Pm(A)\mathbb{P}_{n}(A)=\int_{A}f_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq 3\mathbb{P}_{m}(A)Pn​(A)=∫A​fn​dPm​≥3Pm​(A) which implies Pm(A)=0\mathbb{P}_{m}(A)=0Pm​(A)=0. This means that fnf_{n}fn​ is bounded by 3 Pm\mathbb{P}_{m}Pm​(and therefore Pn\mathbb{P}_{n}Pn​ and P\mathbb{P}P)-almost everywhere. We could have done this for any constant larger than 2 but for our purposes 3 will sufice. Let ϵ>0\epsilon>0ϵ>0 fixed, and An={fn>1+ϵ}A_{n}=\{f_{n}>1+\epsilon\}An​={fn​>1+ϵ}. Then, Pn(An)=∫Anfnd⁡ ⁣Pm≥(1+ϵ)Pm(An)\mathbb{P}_{n}(A_{n})=\int_{A_{n}}f_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq(1+\epsilon)\mathbb{P}_{m}(A_{n})Pn​(An​)=∫An​​fn​dPm​≥(1+ϵ)Pm​(An​) Therefore, ϵPm(An)\displaystyle\epsilon\mathbb{P}_{m}(A_{n})ϵPm​(An​) ≤Pn(An)−Pm(An)\displaystyle\leq\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})≤Pn​(An​)−Pm​(An​) ≤∣Pn(An)−Pm(An)∣\displaystyle\leq|\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})|≤∣Pn​(An​)−Pm​(An​)∣ ≤δ(Pn,Pm)\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P}_{m})≤δ(Pn​,Pm​) ≤δ(Pn,P).\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P}).≤δ(Pn​,P). Which implies Pm(Am)≤1ϵδ(Pn,P)\mathbb{P}_{m}(A_{m})\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})Pm​(Am​)≤ϵ1​δ(Pn​,P). Furthermore, Pn(An)\displaystyle\mathbb{P}_{n}(A_{n})Pn​(An​) ≤Pm(An)+∣Pn(An)−Pm(An)∣\displaystyle\leq\mathbb{P}_{m}(A_{n})+|\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})|≤Pm​(An​)+∣Pn​(An​)−Pm​(An​)∣ ≤1ϵδ(Pn,P)+δ(Pn,Pm)\displaystyle\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})+\delta(\mathbb{P}_{n},\mathbb{P}_{m})≤ϵ1​δ(Pn​,P)+δ(Pn​,Pm​) ≤1ϵδ(Pn,P)+δ(Pn,P)\displaystyle\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})+\delta(\mathbb{P}_{n},\mathbb{P})≤ϵ1​δ(Pn​,P)+δ(Pn​,P) ≤(1ϵ+1)δ(Pn,P)\displaystyle\leq\left(\frac{1}{\epsilon}+1\right)\delta(\mathbb{P}_{n},\mathbb{P})≤(ϵ1​+1)δ(Pn​,P) We now can see that KL(Pn∥Pm)\displaystyle KL(\mathbb{P}_{n}\|\mathbb{P}_{m})KL(Pn​∥Pm​) =∫log⁡(fn)d⁡ ⁣Pn\displaystyle=\int\log(f_{n})\operatorname{d}\!{\mathbb{P}}_{n}=∫log(fn​)dPn​ ≤log⁡(1+ϵ)+∫Anlog⁡(fn)d⁡ ⁣Pn\displaystyle\leq\log(1+\epsilon)+\int_{A_{n}}\log(f_{n})\operatorname{d}\!{\mathbb{P}}_{n}≤log(1+ϵ)+∫An​​log(fn​)dPn​ ≤log⁡(1+ϵ)+log⁡(3)Pn(An)\displaystyle\leq\log(1+\epsilon)+\log(3)\mathbb{P}_{n}(A_{n})≤log(1+ϵ)+log(3)Pn​(An​) ≤log⁡(1+ϵ)+log⁡(3)(1ϵ+1)δ(Pn,P)\displaystyle\leq\log(1+\epsilon)+\log(3)\left(\frac{1}{\epsilon}+1\right)\delta(\mathbb{P}_{n},\mathbb{P})≤log(1+ϵ)+log(3)(ϵ1​+1)δ(Pn​,P) Taking limsup we get 0≤lim sup⁡KL(Pn∥Pm)≤log⁡(1+ϵ)0\leq\limsup KL(\mathbb{P}_{n}\|\mathbb{P}_{m})\leq\log(1+\epsilon)0≤limsupKL(Pn​∥Pm​)≤log(1+ϵ) for all ϵ>0\epsilon>0ϵ>0, which means KL(Pn∥Pm)→0KL(\mathbb{P}_{n}\|\mathbb{P}_{m})\to 0KL(Pn​∥Pm​)→0. In the same way, we can define gn=dPdPmg_{n}=\frac{d\mathbb{P}}{d\mathbb{P}_{m}}gn​=dPm​dP​, and 2Pm({gn>3})≥P({gn>3})≥3Pm({gn>3})2\mathbb{P}_{m}(\{g_{n}>3\})\geq\mathbb{P}(\{g_{n}>3\})\geq 3\mathbb{P}_{m}(\{g_{n}>3\})2Pm​({gn​>3})≥P({gn​>3})≥3Pm​({gn​>3}) meaning that Pm({gn>3})=0\mathbb{P}_{m}(\{g_{n}>3\})=0Pm​({gn​>3})=0 and therefore gng_{n}gn​ is bounded by 3 almost everywhere for Pn,Pm\mathbb{P}_{n},\mathbb{P}_{m}Pn​,Pm​ and P\mathbb{P}P. With the same calculation, Bn={gn>1+ϵ}B_{n}=\{g_{n}>1+\epsilon\}Bn​={gn​>1+ϵ} and P(Bn)=∫Bngnd⁡ ⁣Pm≥(1+ϵ)Pm(Bn)\mathbb{P}(B_{n})=\int_{B_{n}}g_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq(1+\epsilon)\mathbb{P}_{m}(B_{n})P(Bn​)=∫Bn​​gn​dPm​≥(1+ϵ)Pm​(Bn​) so Pm(Bn)≤1ϵδ(P,Pm)→0\mathbb{P}_{m}(B_{n})\leq\frac{1}{\epsilon}\delta(\mathbb{P},\mathbb{P}_{m})\to 0Pm​(Bn​)≤ϵ1​δ(P,Pm​)→0, and therefore P(Bn)→0\mathbb{P}(B_{n})\to 0P(Bn​)→0. We can now show KL(P∥Pm)\displaystyle KL(\mathbb{P}\|\mathbb{P}_{m})KL(P∥Pm​) =∫log⁡(gn)d⁡ ⁣P\displaystyle=\int\log(g_{n})\operatorname{d}\!{\mathbb{P}}=∫log(gn​)dP ≤log⁡(1+ϵ)+∫Bnlog⁡(gn)d⁡ ⁣P\displaystyle\leq\log(1+\epsilon)+\int_{B_{n}}\log(g_{n})\operatorname{d}\!{\mathbb{P}}≤log(1+ϵ)+∫Bn​​log(gn​)dP ≤log⁡(1+ϵ)+log⁡(3)P(Bn)\displaystyle\leq\log(1+\epsilon)+\log(3)\mathbb{P}(B_{n})≤log(1+ϵ)+log(3)P(Bn​) so we achieve 0≤lim sup⁡KL(P∥Pm)≤log⁡(1+ϵ)0\leq\limsup KL(\mathbb{P}\|\mathbb{P}_{m})\leq\log(1+\epsilon)0≤limsupKL(P∥Pm​)≤log(1+ϵ) and then KL(P∥Pm)→0KL(\mathbb{P}\|\mathbb{P}_{m})\to 0KL(P∥Pm​)→0. Finally, we conclude JS(Pn,P)=12KL(Pn∥Pm)+12KL(P∥Pm)→0JS(\mathbb{P}_{n},\mathbb{P})=\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P}_{m})+\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{m})\to 0JS(Pn​,P)=21​KL(Pn​∥Pm​)+21​KL(P∥Pm​)→0 • (JS(Pn,P)→0⇒δ(Pn,P)→0JS(\mathbb{P}_{n},\mathbb{P})\to 0\Rightarrow\delta(\mathbb{P}_{n},\mathbb{P})\to 0JS(Pn​,P)→0⇒δ(Pn​,P)→0)  —  by a simple application of the triangular and Pinsker’s inequalities we get δ(Pn,P)\displaystyle\delta(\mathbb{P}_{n},\mathbb{P})δ(Pn​,P) ≤δ(Pn,Pm)+δ(P,Pm)\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P}_{m})+\delta(\mathbb{P},\mathbb{P}_{m})≤δ(Pn​,Pm​)+δ(P,Pm​) ≤12KL(Pn∥Pm)+12KL(P∥Pm)\displaystyle\leq\sqrt{\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P}_{m})}+\sqrt{\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{m})}≤21​KL(Pn​∥Pm​)​+21​KL(P∥Pm​)​ ≤2JS(Pn,P)→0\displaystyle\leq 2\sqrt{JS(\mathbb{P}_{n},\mathbb{P})}\to 0≤2JS(Pn​,P)​→0
  1. • (δ(Pn,P)→0⇒JS(Pn,P)→0\delta(\mathbb{P}_{n},\mathbb{P})\to 0\Rightarrow JS(\mathbb{P}_{n},\mathbb{P})\to 0δ(Pn​,P)→0⇒JS(Pn​,P)→0)  —  令 Pm\mathbb{P}_{m}Pm​ 为混合分布 Pm=12Pn+12P\mathbb{P}_{m}=\frac{1}{2}\mathbb{P}_{n}+\frac{1}{2}\mathbb{P}Pm​=21​Pn​+21​P(注意 Pm\mathbb{P}_{m}Pm​ 依赖 nnn)。容易验证 δ(Pm,Pn)≤δ(Pn,P)\delta(\mathbb{P}_{m},\mathbb{P}_{n})\leq\delta(\mathbb{P}_{n},\mathbb{P})δ(Pm​,Pn​)≤δ(Pn​,P),因而它趋于 0(δ(Pm,P)\delta(\mathbb{P}_{m},\mathbb{P})δ(Pm​,P) 亦然)。为完整起见我们写出证明。设 μ\muμ 为符号测度,定义 ∥μ∥TV=sup⁡A⊆X∣μ(A)∣\|\mu\|_{TV}=\sup_{A\subseteq\mathcal{X}}|\mu(A)|∥μ∥TV​=supA⊆X​∣μ(A)∣,上确界取遍所有 Borel 集 AAA。此时,δ(Pm,Pn)\displaystyle\delta(\mathbb{P}_{m},\mathbb{P}_{n})δ(Pm​,Pn​) =∥Pm−Pn∥TV\displaystyle=\|\mathbb{P}_{m}-\mathbb{P}_{n}\|_{TV}=∥Pm​−Pn​∥TV​ =∥12P+12Pn−Pn∥TV\displaystyle=\|\frac{1}{2}\mathbb{P}+\frac{1}{2}\mathbb{P}_{n}-\mathbb{P}_{n}\|_{TV}=∥21​P+21​Pn​−Pn​∥TV​ =12∥P−Pn∥TV\displaystyle=\frac{1}{2}\|\mathbb{P}-\mathbb{P}_{n}\|_{TV}=21​∥P−Pn​∥TV​ =12δ(Pn,P)≤δ(Pn,P)\displaystyle=\frac{1}{2}\delta(\mathbb{P}_{n},\mathbb{P})\leq\delta(\mathbb{P}_{n},\mathbb{P})=21​δ(Pn​,P)≤δ(Pn​,P)。令 fn=dPndPmf_{n}=\frac{d\mathbb{P}_{n}}{d\mathbb{P}_{m}}fn​=dPm​dPn​​ 为 Pn\mathbb{P}_{n}Pn​ 关于混合分布的 Radon-Nikodym 导数。由构造,对每个 Borel 集 AAA 有 Pn(A)≤2Pm(A)\mathbb{P}_{n}(A)\leq 2\mathbb{P}_{m}(A)Pn​(A)≤2Pm​(A)。若 A={fn>3}A=\{f_{n}>3\}A={fn​>3},则 Pn(A)=∫Afnd⁡ ⁣Pm≥3Pm(A)\mathbb{P}_{n}(A)=\int_{A}f_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq 3\mathbb{P}_{m}(A)Pn​(A)=∫A​fn​dPm​≥3Pm​(A),从而 Pm(A)=0\mathbb{P}_{m}(A)=0Pm​(A)=0。这意味着 fnf_{n}fn​ 在 Pm\mathbb{P}_{m}Pm​(因而也在 Pn\mathbb{P}_{n}Pn​ 与 P\mathbb{P}P)几乎处处被 3 上界。对任意大于 2 的常数本也可做同样论证,对我们的目的取 3 已足够。固定 ϵ>0\epsilon>0ϵ>0,令 An={fn>1+ϵ}A_{n}=\{f_{n}>1+\epsilon\}An​={fn​>1+ϵ}。则 Pn(An)=∫Anfnd⁡ ⁣Pm≥(1+ϵ)Pm(An)\mathbb{P}_{n}(A_{n})=\int_{A_{n}}f_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq(1+\epsilon)\mathbb{P}_{m}(A_{n})Pn​(An​)=∫An​​fn​dPm​≥(1+ϵ)Pm​(An​)。因此 ϵPm(An)\displaystyle\epsilon\mathbb{P}_{m}(A_{n})ϵPm​(An​) ≤Pn(An)−Pm(An)\displaystyle\leq\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})≤Pn​(An​)−Pm​(An​) ≤∣Pn(An)−Pm(An)∣\displaystyle\leq|\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})|≤∣Pn​(An​)−Pm​(An​)∣ ≤δ(Pn,Pm)\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P}_{m})≤δ(Pn​,Pm​) ≤δ(Pn,P)\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P})≤δ(Pn​,P)。于是 Pm(An)≤1ϵδ(Pn,P)\mathbb{P}_{m}(A_{n})\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})Pm​(An​)≤ϵ1​δ(Pn​,P)。进一步,Pn(An)\displaystyle\mathbb{P}_{n}(A_{n})Pn​(An​) ≤Pm(An)+∣Pn(An)−Pm(An)∣\displaystyle\leq\mathbb{P}_{m}(A_{n})+|\mathbb{P}_{n}(A_{n})-\mathbb{P}_{m}(A_{n})|≤Pm​(An​)+∣Pn​(An​)−Pm​(An​)∣ ≤1ϵδ(Pn,P)+δ(Pn,Pm)\displaystyle\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})+\delta(\mathbb{P}_{n},\mathbb{P}_{m})≤ϵ1​δ(Pn​,P)+δ(Pn​,Pm​) ≤1ϵδ(Pn,P)+δ(Pn,P)\displaystyle\leq\frac{1}{\epsilon}\delta(\mathbb{P}_{n},\mathbb{P})+\delta(\mathbb{P}_{n},\mathbb{P})≤ϵ1​δ(Pn​,P)+δ(Pn​,P) ≤(1ϵ+1)δ(Pn,P)\displaystyle\leq\left(\frac{1}{\epsilon}+1\right)\delta(\mathbb{P}_{n},\mathbb{P})≤(ϵ1​+1)δ(Pn​,P)。于是可见 KL(Pn∥Pm)\displaystyle KL(\mathbb{P}_{n}\|\mathbb{P}_{m})KL(Pn​∥Pm​) =∫log⁡(fn)d⁡ ⁣Pn\displaystyle=\int\log(f_{n})\operatorname{d}\!{\mathbb{P}}_{n}=∫log(fn​)dPn​ ≤log⁡(1+ϵ)+∫Anlog⁡(fn)d⁡ ⁣Pn\displaystyle\leq\log(1+\epsilon)+\int_{A_{n}}\log(f_{n})\operatorname{d}\!{\mathbb{P}}_{n}≤log(1+ϵ)+∫An​​log(fn​)dPn​ ≤log⁡(1+ϵ)+log⁡(3)Pn(An)\displaystyle\leq\log(1+\epsilon)+\log(3)\mathbb{P}_{n}(A_{n})≤log(1+ϵ)+log(3)Pn​(An​) ≤log⁡(1+ϵ)+log⁡(3)(1ϵ+1)δ(Pn,P)\displaystyle\leq\log(1+\epsilon)+\log(3)\left(\frac{1}{\epsilon}+1\right)\delta(\mathbb{P}_{n},\mathbb{P})≤log(1+ϵ)+log(3)(ϵ1​+1)δ(Pn​,P)。取 limsup 得对所有 ϵ>0\epsilon>0ϵ>0 有 0≤lim sup⁡KL(Pn∥Pm)≤log⁡(1+ϵ)0\leq\limsup KL(\mathbb{P}_{n}\|\mathbb{P}_{m})\leq\log(1+\epsilon)0≤limsupKL(Pn​∥Pm​)≤log(1+ϵ),故 KL(Pn∥Pm)→0KL(\mathbb{P}_{n}\|\mathbb{P}_{m})\to 0KL(Pn​∥Pm​)→0。同理可定义 gn=dPdPmg_{n}=\frac{d\mathbb{P}}{d\mathbb{P}_{m}}gn​=dPm​dP​,且 2Pm({gn>3})≥P({gn>3})≥3Pm({gn>3})2\mathbb{P}_{m}(\{g_{n}>3\})\geq\mathbb{P}(\{g_{n}>3\})\geq 3\mathbb{P}_{m}(\{g_{n}>3\})2Pm​({gn​>3})≥P({gn​>3})≥3Pm​({gn​>3}),意味着 Pm({gn>3})=0\mathbb{P}_{m}(\{g_{n}>3\})=0Pm​({gn​>3})=0,因而 gng_{n}gn​ 对 Pn\mathbb{P}_{n}Pn​、Pm\mathbb{P}_{m}Pm​ 与 P\mathbb{P}P 几乎处处被 3 上界。同样计算:Bn={gn>1+ϵ}B_{n}=\{g_{n}>1+\epsilon\}Bn​={gn​>1+ϵ},且 P(Bn)=∫Bngnd⁡ ⁣Pm≥(1+ϵ)Pm(Bn)\mathbb{P}(B_{n})=\int_{B_{n}}g_{n}\operatorname{d}\!{\mathbb{P}}_{m}\geq(1+\epsilon)\mathbb{P}_{m}(B_{n})P(Bn​)=∫Bn​​gn​dPm​≥(1+ϵ)Pm​(Bn​),故 Pm(Bn)≤1ϵδ(P,Pm)→0\mathbb{P}_{m}(B_{n})\leq\frac{1}{\epsilon}\delta(\mathbb{P},\mathbb{P}_{m})\to 0Pm​(Bn​)≤ϵ1​δ(P,Pm​)→0,从而 P(Bn)→0\mathbb{P}(B_{n})\to 0P(Bn​)→0。现可证 KL(P∥Pm)\displaystyle KL(\mathbb{P}\|\mathbb{P}_{m})KL(P∥Pm​) =∫log⁡(gn)d⁡ ⁣P\displaystyle=\int\log(g_{n})\operatorname{d}\!{\mathbb{P}}=∫log(gn​)dP ≤log⁡(1+ϵ)+∫Bnlog⁡(gn)d⁡ ⁣P\displaystyle\leq\log(1+\epsilon)+\int_{B_{n}}\log(g_{n})\operatorname{d}\!{\mathbb{P}}≤log(1+ϵ)+∫Bn​​log(gn​)dP ≤log⁡(1+ϵ)+log⁡(3)P(Bn)\displaystyle\leq\log(1+\epsilon)+\log(3)\mathbb{P}(B_{n})≤log(1+ϵ)+log(3)P(Bn​),于是 0≤lim sup⁡KL(P∥Pm)≤log⁡(1+ϵ)0\leq\limsup KL(\mathbb{P}\|\mathbb{P}_{m})\leq\log(1+\epsilon)0≤limsupKL(P∥Pm​)≤log(1+ϵ),进而 KL(P∥Pm)→0KL(\mathbb{P}\|\mathbb{P}_{m})\to 0KL(P∥Pm​)→0。最后得出 JS(Pn,P)=12KL(Pn∥Pm)+12KL(P∥Pm)→0JS(\mathbb{P}_{n},\mathbb{P})=\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P}_{m})+\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{m})\to 0JS(Pn​,P)=21​KL(Pn​∥Pm​)+21​KL(P∥Pm​)→0。 • (JS(Pn,P)→0⇒δ(Pn,P)→0JS(\mathbb{P}_{n},\mathbb{P})\to 0\Rightarrow\delta(\mathbb{P}_{n},\mathbb{P})\to 0JS(Pn​,P)→0⇒δ(Pn​,P)→0)  —  由三角不等式与 Pinsker 不等式的简单应用得 δ(Pn,P)\displaystyle\delta(\mathbb{P}_{n},\mathbb{P})δ(Pn​,P) ≤δ(Pn,Pm)+δ(P,Pm)\displaystyle\leq\delta(\mathbb{P}_{n},\mathbb{P}_{m})+\delta(\mathbb{P},\mathbb{P}_{m})≤δ(Pn​,Pm​)+δ(P,Pm​) ≤12KL(Pn∥Pm)+12KL(P∥Pm)\displaystyle\leq\sqrt{\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P}_{m})}+\sqrt{\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{m})}≤21​KL(Pn​∥Pm​)​+21​KL(P∥Pm​)​ ≤2JS(Pn,P)→0\displaystyle\leq 2\sqrt{JS(\mathbb{P}_{n},\mathbb{P})}\to 0≤2JS(Pn​,P)​→0。
  1. This is a long known fact that WWW metrizes the weak* topology of (C(X),∥⋅∥∞)(C(\mathcal{X}),\|\cdot\|_{\infty})(C(X),∥⋅∥∞​) on Prob(X)\text{Prob}(\mathcal{X})Prob(X), and by definition this is the topology of convergence in distribution. A proof of this can be found (for example) in [22].
  1. 这是久为人知的事实:WWW 在 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 上度量化 (C(X),∥⋅∥∞)(C(\mathcal{X}),\|\cdot\|_{\infty})(C(X),∥⋅∥∞​) 的弱* 拓扑,而依定义这正是依分布收敛的拓扑。证明例如可见 [22]。
  1. This is a straightforward application of Pinsker’s inequality δ(Pn,P)≤12KL(Pn∥P)→0\displaystyle\delta(\mathbb{P}_{n},\mathbb{P})\leq\sqrt{\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P})}\to 0δ(Pn​,P)≤21​KL(Pn​∥P)​→0 δ(P,Pn)≤12KL(P∥Pn)→0\displaystyle\delta(\mathbb{P},\mathbb{P}_{n})\leq\sqrt{\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{n})}\to 0δ(P,Pn​)≤21​KL(P∥Pn​)​→0
  1. 这是 Pinsker 不等式的直接应用 δ(Pn,P)≤12KL(Pn∥P)→0\displaystyle\delta(\mathbb{P}_{n},\mathbb{P})\leq\sqrt{\frac{1}{2}KL(\mathbb{P}_{n}\|\mathbb{P})}\to 0δ(Pn​,P)≤21​KL(Pn​∥P)​→0 δ(P,Pn)≤12KL(P∥Pn)→0\displaystyle\delta(\mathbb{P},\mathbb{P}_{n})\leq\sqrt{\frac{1}{2}KL(\mathbb{P}\|\mathbb{P}_{n})}\to 0δ(P,Pn​)≤21​KL(P∥Pn​)​→0
  1. This is trivial by recalling the fact that δ\deltaδ and WWW give the strong and weak* topologies on the dual of (C(X),∥⋅∥∞)(C(\mathcal{X}),\|\cdot\|_{\infty})(C(X),∥⋅∥∞​) when restricted to Prob(X)\text{Prob}(\mathcal{X})Prob(X).
  1. 这是平凡的:只需回忆 δ\deltaδ 与 WWW 在限制到 Prob(X)\text{Prob}(\mathcal{X})Prob(X) 时,分别给出 (C(X),∥⋅∥∞)(C(\mathcal{X}),\|\cdot\|_{\infty})(C(X),∥⋅∥∞​) 对偶上的强拓扑与弱* 拓扑。

∎

Proof of Theorem 3.

Let us define

定理 3 的证明。 定义

V(f~,θ)=Ex∼Pr[f~(x)]−Ex∼Pθ[f~(x)]=Ex∼Pr[f~(x)]−Ez∼p(z)[f~(gθ(z))]\displaystyle V(\tilde{f},\theta) \\ \displaystyle=\mathbb{E}_{x\sim\mathbb{P}_{r}}[\tilde{f}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[\tilde{f}(x)] \\ \displaystyle=\mathbb{E}_{x\sim\mathbb{P}_{r}}[\tilde{f}(x)]-\mathbb{E}_{z\sim p(z)}[\tilde{f}(g_{\theta}(z))]V(f~​,θ)=Ex∼Pr​​[f~​(x)]−Ex∼Pθ​​[f~​(x)]=Ex∼Pr​​[f~​(x)]−Ez∼p(z)​[f~​(gθ​(z))]

where f~\tilde{f}f~​ lies in \mathcal{F}=\{\tilde{f}:\mathcal{X}\to\mathbb{R}\text{ ,\tilde{f}\in C_{b}(\mathcal{X}),,,|\tilde{f}|_{L}\leq 1}\} and θ∈Rd\theta\in\mathbb{R}^{d}θ∈Rd.

其中 f~\tilde{f}f~​ 属于 \mathcal{F}=\{\tilde{f}:\mathcal{X}\to\mathbb{R}\text{ ,\tilde{f}\in C_{b}(\mathcal{X}),,,|\tilde{f}|_{L}\leq 1}\},且 θ∈Rd\theta\in\mathbb{R}^{d}θ∈Rd。

Since X\mathcal{X}X is compact, we know by the Kantorovich-Rubenstein duality [22] that there is an f∈Ff\in\mathcal{F}f∈F that attains the value

由于 X\mathcal{X}X 紧,由 Kantorovich-Rubinstein 对偶 [22] 知存在 f∈Ff\in\mathcal{F}f∈F 达到

W(Pr,Pθ)=sup⁡f~∈FV(f~,θ)=V(f,θ)W(\mathbb{P}_{r},\mathbb{P}_{\theta})=\sup_{\tilde{f}\in\mathcal{F}}V(\tilde{f},\theta)=V(f,\theta)W(Pr​,Pθ​)=f~​∈Fsup​V(f~​,θ)=V(f,θ)

Let us define X∗(θ)={f∈F:V(f,θ)=W(Pr,Pθ)}X^{*}(\theta)=\{f\in\mathcal{F}:V(f,\theta)=W(\mathbb{P}_{r},\mathbb{P}_{\theta})\}X∗(θ)={f∈F:V(f,θ)=W(Pr​,Pθ​)}. By the above point we know then that X∗(θ)X^{*}(\theta)X∗(θ) is non-empty. We know that by a simple envelope theorem ([12], Theorem 1) that

定义 X∗(θ)={f∈F:V(f,θ)=W(Pr,Pθ)}X^{*}(\theta)=\{f\in\mathcal{F}:V(f,\theta)=W(\mathbb{P}_{r},\mathbb{P}_{\theta})\}X∗(θ)={f∈F:V(f,θ)=W(Pr​,Pθ​)}。由上知 X∗(θ)X^{*}(\theta)X∗(θ) 非空。由简单的包络定理([12],定理 1)知

∇θW(Pr,Pθ)=∇θV(f,θ)\nabla_{\theta}W(\mathbb{P}_{r},\mathbb{P}_{\theta})=\nabla_{\theta}V(f,\theta)∇θ​W(Pr​,Pθ​)=∇θ​V(f,θ)

for any f∈X∗(θ)f\in X^{*}(\theta)f∈X∗(θ) when both terms are well-defined.

对任意 f∈X∗(θ)f\in X^{*}(\theta)f∈X∗(θ),在两项均有定义时成立。

Let f∈X∗(θ)f\in X^{*}(\theta)f∈X∗(θ), which we knows exists since X∗(θ)X^{*}(\theta)X∗(θ) is non-empty for all θ\thetaθ. Then, we get

取 f∈X∗(θ)f\in X^{*}(\theta)f∈X∗(θ)(因对所有 θ\thetaθ,X∗(θ)X^{*}(\theta)X∗(θ) 非空,故知其存在)。则有

∇θW(Pr,Pθ)=∇θV(f,θ)=∇θ[Ex∼Pr[f(x)]−Ez∼p(z)[f(gθ(z))]=−∇θEz∼p(z)[f(gθ(z))]\displaystyle\nabla_{\theta}W(\mathbb{P}_{r},\mathbb{P}_{\theta}) \\ \displaystyle=\nabla_{\theta}V(f,\theta) \\ \displaystyle=\nabla_{\theta}[\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))] \\ \displaystyle=-\nabla_{\theta}\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]∇θ​W(Pr​,Pθ​)=∇θ​V(f,θ)=∇θ​[Ex∼Pr​​[f(x)]−Ez∼p(z)​[f(gθ​(z))]=−∇θ​Ez∼p(z)​[f(gθ​(z))]

under the condition that the first and last terms are well-defined. The rest of the proof will be dedicated to show that

前提是首末两项均有定义。证明的其余部分将表明

−∇θEz∼p(z)[f(gθ(z))]=−Ez∼p(z)[∇θf(gθ(z))](5)-\nabla_{\theta}\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]=-\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))] \tag{5}−∇θ​Ez∼p(z)​[f(gθ​(z))]=−Ez∼p(z)​[∇θ​f(gθ​(z))](5)

when the right hand side is defined. For the reader who is not interested in such technicalities, he or she can skip the rest of the proof.

在右端有定义时成立。对不关心此类技术细节的读者,可跳过余下证明。

Since f∈Ff\in\mathcal{F}f∈F, we know that it is 1-Lipschitz. Furthermore, gθ(z)g_{\theta}(z)gθ​(z) is locally Lipschitz as a function of (θ,z)(\theta,z)(θ,z). Therefore, f(gθ(z))f(g_{\theta}(z))f(gθ​(z)) is locally Lipschitz on (θ,z)(\theta,z)(θ,z) with constants L(θ,z)L(\theta,z)L(θ,z) (the same ones as ggg). By Radamacher’s Theorem, f(gθ(z))f(g_{\theta}(z))f(gθ​(z)) has to be differentiable almost everywhere for (θ,z)(\theta,z)(θ,z) jointly. Rewriting this, the set A=\{(\theta,z):\text{f\circ gis not differentiable}\} has measure 0. By Fubini’s Theorem, this implies that for almost every θ\thetaθ the section Aθ={z:(θ,z)∈A}A_{\theta}=\{z:(\theta,z)\in A\}Aθ​={z:(θ,z)∈A} has measure 0. Let’s now fix a θ0\theta_{0}θ0​ such that the measure of Aθ0A_{\theta_{0}}Aθ0​​ is null (such as when the right hand side of equation (5) is well defined). For this θ0\theta_{0}θ0​ we have ∇θf(gθ(z))∣θ0\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}∇θ​f(gθ​(z))∣θ0​​ is well-defined for almost any zzz, and since p(z)p(z)p(z) has a density, it is defined p(z)p(z)p(z)-a.e. By assumption 1 we know that

由于 f∈Ff\in\mathcal{F}f∈F,知其为 1-Lipschitz。又 gθ(z)g_{\theta}(z)gθ​(z) 作为 (θ,z)(\theta,z)(θ,z) 的函数局部 Lipschitz。因此 f(gθ(z))f(g_{\theta}(z))f(gθ​(z)) 在 (θ,z)(\theta,z)(θ,z) 上局部 Lipschitz,常数为 L(θ,z)L(\theta,z)L(θ,z)(与 ggg 相同)。由 Rademacher 定理,f(gθ(z))f(g_{\theta}(z))f(gθ​(z)) 对 (θ,z)(\theta,z)(θ,z) 联合几乎处处可微。换言之,集合 A=\{(\theta,z):\text{f\circ g不可微}\} 测度为 0。由 Fubini 定理,对几乎所有 θ\thetaθ,截面 Aθ={z:(θ,z)∈A}A_{\theta}=\{z:(\theta,z)\in A\}Aθ​={z:(θ,z)∈A} 测度为 0。现固定使 Aθ0A_{\theta_{0}}Aθ0​​ 测度为零的 θ0\theta_{0}θ0​(例如当方程 (5) 右端有定义时)。对该 θ0\theta_{0}θ0​,∇θf(gθ(z))∣θ0\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}∇θ​f(gθ​(z))∣θ0​​ 对几乎所有 zzz 有定义;又因 p(z)p(z)p(z) 有密度,它在 p(z)p(z)p(z)-几乎处处有定义。由假设 1 知

Ez∼p(z)[∥∇θf(gθ(z))∣θ0∥]≤Ez∼p(z)[L(θ0,z)]<+∞\mathbb{E}_{z\sim p(z)}[\|\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}\|]\leq\mathbb{E}_{z\sim p(z)}[L(\theta_{0},z)]<+\inftyEz∼p(z)​[∥∇θ​f(gθ​(z))∣θ0​​∥]≤Ez∼p(z)​[L(θ0​,z)]<+∞

so Ez∼p(z)[∇θf(gθ(z))∣θ0]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}]Ez∼p(z)​[∇θ​f(gθ​(z))∣θ0​​] is well-defined for almost every θ0\theta_{0}θ0​. Now, we can see

故 Ez∼p(z)[∇θf(gθ(z))∣θ0]\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}]Ez∼p(z)​[∇θ​f(gθ​(z))∣θ0​​] 对几乎所有 θ0\theta_{0}θ0​ 有定义。于是可见

Ez∼p(z)[f(gθ(z))]−Ez∼p(z)[f(gθ0(z))]−⟨(θ−θ0),Ez∼p(z)[∇θf(gθ(z))∣θ0]⟩∥θ−θ0∥(6)\frac{\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]-\mathbb{E}_{z\sim p(z)}[f(g_{\theta_{0}}(z))]-\langle(\theta-\theta_{0}),\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}]\rangle}{\|\theta-\theta_{0}\|} \tag{6}∥θ−θ0​∥Ez∼p(z)​[f(gθ​(z))]−Ez∼p(z)​[f(gθ0​​(z))]−⟨(θ−θ0​),Ez∼p(z)​[∇θ​f(gθ​(z))∣θ0​​]⟩​(6)

=Ez∼p(z)[f(gθ(z))−f(gθ0(z))−⟨(θ−θ0),∇θf(gθ(z))∣θ0⟩∥θ−θ0∥]\displaystyle=\mathbb{E}_{z\sim p(z)}\left[\frac{f(g_{\theta}(z))-f(g_{\theta_{0}}(z))-\langle(\theta-\theta_{0}),\nabla_{\theta}f(g_{\theta}(z))|_{\theta_{0}}\rangle}{\|\theta-\theta_{0}\|}\right]=Ez∼p(z)​[∥θ−θ0​∥f(gθ​(z))−f(gθ0​​(z))−⟨(θ−θ0​),∇θ​f(gθ​(z))∣θ0​​⟩​]

By differentiability, the term inside the integral converges p(z)p(z)p(z)-a.e. to 0 as θ→θ0\theta\to\theta_{0}θ→θ0​. Furthermore,

由可微性,积分号内的项在 θ→θ0\theta\to\theta_{0}θ→θ0​ 时 p(z)p(z)p(z)-几乎处处收敛到 0。进一步,

$$|\frac{f(g_{\theta}(z))-f(g_{\theta_{0}}(z))-\langle(\theta-\theta_{0}),\nabla_{\theta}f(g_{\theta}(z))|{\theta{0}}\rangle}{|\theta-\theta_{0}|}|\
\leq\frac{|\theta-\theta_{0}|L(\theta_{0},z)+|\theta-\theta_{0}||\nabla_{\theta}f(g_{\theta}(z))|{\theta{0}}|}{|\theta-\theta_{0}|}\
\leq 2L(\theta_{0},z)$$

and since Ez∼p(z)[2L(θ0,z)]<+∞\mathbb{E}_{z\sim p(z)}[2L(\theta_{0},z)]<+\inftyEz∼p(z)​[2L(θ0​,z)]<+∞ by assumption 1, we get by dominated convergence that Equation 6 converges to 0 as θ→θ0\theta\to\theta_{0}θ→θ0​ so

又因由假设 1 有 Ez∼p(z)[2L(θ0,z)]<+∞\mathbb{E}_{z\sim p(z)}[2L(\theta_{0},z)]<+\inftyEz∼p(z)​[2L(θ0​,z)]<+∞,由控制收敛定理,方程 6 在 θ→θ0\theta\to\theta_{0}θ→θ0​ 时收敛到 0,于是

∇θEz∼p(z)[f(gθ(z))]=Ez∼p(z)[∇θf(gθ(z))]\nabla_{\theta}\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]=\mathbb{E}_{z\sim p(z)}[\nabla_{\theta}f(g_{\theta}(z))]∇θ​Ez∼p(z)​[f(gθ​(z))]=Ez∼p(z)​[∇θ​f(gθ​(z))]

for almost every θ\thetaθ, and in particular when the right hand side is well defined. Note that the mere existance of the left hand side (meaning the differentiability a.e. of Ez∼p(z)[f(gθ(z))]\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]Ez∼p(z)​[f(gθ​(z))]) had to be proven, which we just did. ∎

对几乎所有 θ\thetaθ 成立,尤其是在右端有定义时。注意:左端的存在性本身(即 Ez∼p(z)[f(gθ(z))]\mathbb{E}_{z\sim p(z)}[f(g_{\theta}(z))]Ez∼p(z)​[f(gθ​(z))] 几乎处处可微)也需要证明,而我们刚刚完成了这一点。∎

Appendix D Energy-based GANs optimize total variation

附录 D 基于能量的 GAN 优化的是全变差

In this appendix we show that under an optimal discriminator, energy-based GANs (EBGANs) [25] optimize the total variation distance between the real and generated distributions.

本附录说明:在最优判别器下,基于能量的 GAN(EBGAN)[25] 优化的是真实分布与生成分布之间的全变差距离。

Energy-based GANs are trained in a similar fashion to GANs, only under a different loss function. They have a discriminator DDD who tries to minimize

基于能量的 GAN 训练方式类似 GAN,只是损失函数不同。它们有一个判别器 DDD,试图最小化

LD(D,gθ)=Ex∼Pr[D(x)]+Ez∼p(z)[[m−D(gθ(z))]+]L_{D}(D,g_{\theta})=\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]+\mathbb{E}_{z\sim p(z)}[[m-D(g_{\theta}(z))]^{+}]LD​(D,gθ​)=Ex∼Pr​​[D(x)]+Ez∼p(z)​[[m−D(gθ​(z))]+]

for some m>0m>0m>0 and [x]+=max⁡(0,x)[x]^{+}=\max(0,x)[x]+=max(0,x) and a generator network gθg_{\theta}gθ​ that’s trained to minimize

其中 m>0m>0m>0,[x]+=max⁡(0,x)[x]^{+}=\max(0,x)[x]+=max(0,x);生成网络 gθg_{\theta}gθ​ 被训练以最小化

LG(D,gθ)=Ez∼p(z)[D(gθ(z))]−Ex∼Pr[D(x)]L_{G}(D,g_{\theta})=\mathbb{E}_{z\sim p(z)}[D(g_{\theta}(z))]-\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]LG​(D,gθ​)=Ez∼p(z)​[D(gθ​(z))]−Ex∼Pr​​[D(x)]

Very importantly, DDD is constrained to be non-negative, since otherwise the trivial solution for DDD would be to set everything to arbitrarily low values. The original EBGAN paper used only Ez∼p(z)[D(gθ(z))]\mathbb{E}_{z\sim p(z)}[D(g_{\theta}(z))]Ez∼p(z)​[D(gθ​(z))] for the loss of the generator, but this is obviously equivalent to our definition since the term Ex∼Pr[D(x)]\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]Ex∼Pr​​[D(x)] does not dependent on θ\thetaθ for a fixed discriminator (such as when backproping to the generator in EBGAN training) and thus minimizing one or the other is equivalent.

极为重要的是:DDD 被约束为非负,否则 DDD 的平凡解会是把一切设为任意低的值。原 EBGAN 论文生成器损失只用 Ez∼p(z)[D(gθ(z))]\mathbb{E}_{z\sim p(z)}[D(g_{\theta}(z))]Ez∼p(z)​[D(gθ​(z))],但这显然与我们的定义等价,因为对固定判别器(例如在 EBGAN 训练中反向传播到生成器时)项 Ex∼Pr[D(x)]\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]Ex∼Pr​​[D(x)] 不依赖 θ\thetaθ,最小化其一或另一等价。

We say that a measurable function D∗:X→[0,+∞)D^{*}:\mathcal{X}\rightarrow[0,+\infty)D∗:X→[0,+∞) is optimal for gθg_{\theta}gθ​ (or Pθ)\mathbb{P}_{\theta})Pθ​) if LD(D∗,gθ)≤LD(D,gθ)L_{D}(D^{*},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D∗,gθ​)≤LD​(D,gθ​) for all other measurable functions DDD. We show that such a discriminator always exists for any two distributions Pr\mathbb{P}_{r}Pr​ and Pθ\mathbb{P}_{\theta}Pθ​, and that under such a discriminator, LG(D∗,gθ)L_{G}(D^{*},g_{\theta})LG​(D∗,gθ​) is proportional to δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​). As a simple corollary, we get the fact that LG(D∗,gθ)L_{G}(D^{*},g_{\theta})LG​(D∗,gθ​) attains its minimum value if and only if δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​) is at its minimum value, which is 0, and Pr=Pθ\mathbb{P}_{r}=\mathbb{P}_{\theta}Pr​=Pθ​ (Theorems 1-2 of [25]).

称可测函数 D∗:X→[0,+∞)D^{*}:\mathcal{X}\rightarrow[0,+\infty)D∗:X→[0,+∞) 对 gθg_{\theta}gθ​(或 Pθ\mathbb{P}_{\theta}Pθ​)最优,若对所有其他可测函数 DDD 都有 LD(D∗,gθ)≤LD(D,gθ)L_{D}(D^{*},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D∗,gθ​)≤LD​(D,gθ​)。我们证明:对任意两个分布 Pr\mathbb{P}_{r}Pr​ 与 Pθ\mathbb{P}_{\theta}Pθ​ 这样的判别器总存在;且在该判别器下,LG(D∗,gθ)L_{G}(D^{*},g_{\theta})LG​(D∗,gθ​) 与 δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​) 成比例。作为简单推论,LG(D∗,gθ)L_{G}(D^{*},g_{\theta})LG​(D∗,gθ​) 取到最小值当且仅当 δ(Pr,Pθ)\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})δ(Pr​,Pθ​) 取到最小值 0,且 Pr=Pθ\mathbb{P}_{r}=\mathbb{P}_{\theta}Pr​=Pθ​([25] 定理 1–2)。

Theorem 4.

Let Pr\mathbb{P}_{r}Pr​ be a the real data distribution over a compact space X\mathcal{X}X. Let gθ:Z→Xg_{\theta}:\mathcal{Z}\rightarrow\mathcal{X}gθ​:Z→X be a measurable function (such as any neural network). Then, an optimal discriminator $D^{}existsforexists forexistsfor\mathbb{P}{r}andandand\mathbb{P}{\theta}$, and*

定理 4。 设 Pr\mathbb{P}_{r}Pr​ 为紧空间 X\mathcal{X}X 上的真实数据分布。设 gθ:Z→Xg_{\theta}:\mathcal{Z}\rightarrow\mathcal{X}gθ​:Z→X 为可测函数(例如任意神经网络)。则对 Pr\mathbb{P}_{r}Pr​ 与 Pθ\mathbb{P}_{\theta}Pθ​ 存在最优判别器 $D^{}$,且*

LG(D∗,gθ)=m2δ(Pr,Pθ)L_{G}(D^{*},g_{\theta})=\frac{m}{2}\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})LG​(D∗,gθ​)=2m​δ(Pr​,Pθ​)

Proof.

First, we prove that there exists an optimal discriminator. Let D:X→[0,+∞)D:\mathcal{X}\rightarrow[0,+\infty)D:X→[0,+∞) be a measurable function, then D′(x):=min⁡(D(x),m)D^{\prime}(x):=\min(D(x),m)D′(x):=min(D(x),m) is also a measurable function, and LD(D′,gθ)≤LD(D,gθ)L_{D}(D^{\prime},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D′,gθ​)≤LD​(D,gθ​). Therefore, a function D∗:X→[0,+∞)D^{*}:\mathcal{X}\rightarrow[0,+\infty)D∗:X→[0,+∞) is optimal if and only if D∗′{D^{*}}^{\prime}D∗′ is. Furthermore, it is optimal if and only if LD(D∗,gθ)≤LD(D,gθ)L_{D}(D^{*},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D∗,gθ​)≤LD​(D,gθ​) for all D:X→[0,m]D:\mathcal{X}\rightarrow[0,m]D:X→[0,m]. We are then interested to see if there’s an optimal discriminator for the problem min⁡0≤D(x)≤mLD(D,gθ)\min_{0\leq D(x)\leq m}L_{D}(D,g_{\theta})min0≤D(x)≤m​LD​(D,gθ​).

证明。 首先证明最优判别器存在。设 D:X→[0,+∞)D:\mathcal{X}\rightarrow[0,+\infty)D:X→[0,+∞) 可测,则 D′(x):=min⁡(D(x),m)D^{\prime}(x):=\min(D(x),m)D′(x):=min(D(x),m) 亦可测,且 LD(D′,gθ)≤LD(D,gθ)L_{D}(D^{\prime},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D′,gθ​)≤LD​(D,gθ​)。因此 D∗:X→[0,+∞)D^{*}:\mathcal{X}\rightarrow[0,+\infty)D∗:X→[0,+∞) 最优当且仅当 D∗′{D^{*}}^{\prime}D∗′ 最优。进一步,它最优当且仅当对所有 D:X→[0,m]D:\mathcal{X}\rightarrow[0,m]D:X→[0,m] 有 LD(D∗,gθ)≤LD(D,gθ)L_{D}(D^{*},g_{\theta})\leq L_{D}(D,g_{\theta})LD​(D∗,gθ​)≤LD​(D,gθ​)。于是我们关心问题 min⁡0≤D(x)≤mLD(D,gθ)\min_{0\leq D(x)\leq m}L_{D}(D,g_{\theta})min0≤D(x)≤m​LD​(D,gθ​) 是否有最优判别器。

Note now that if 0≤D(x)≤m0\leq D(x)\leq m0≤D(x)≤m we have

注意:若 0≤D(x)≤m0\leq D(x)\leq m0≤D(x)≤m,则有

LD(D,gθ)=Ex∼Pr[D(x)]+Ez∼p(z)[[m−D(gθ(z))]+]=Ex∼Pr[D(x)]+Ez∼p(z)[m−D(gθ(z))]=m+Ex∼Pr[D(x)]−Ez∼p(z)[D(gθ(z))]=m+Ex∼Pr[D(x)]−Ex∼Pθ[D(x)]\displaystyle L_{D}(D,g_{\theta}) \\ \displaystyle=\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]+\mathbb{E}_{z\sim p(z)}[[m-D(g_{\theta}(z))]^{+}] \\ \displaystyle=\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]+\mathbb{E}_{z\sim p(z)}[m-D(g_{\theta}(z))] \\ \displaystyle=m+\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]-\mathbb{E}_{z\sim p(z)}[D(g_{\theta}(z))] \\ \displaystyle=m+\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[D(x)]LD​(D,gθ​)=Ex∼Pr​​[D(x)]+Ez∼p(z)​[[m−D(gθ​(z))]+]=Ex∼Pr​​[D(x)]+Ez∼p(z)​[m−D(gθ​(z))]=m+Ex∼Pr​​[D(x)]−Ez∼p(z)​[D(gθ​(z))]=m+Ex∼Pr​​[D(x)]−Ex∼Pθ​​[D(x)]

Therefore, we know that

因此可知

inf⁡0≤D(x)≤mLD(D,gθ)=m+inf⁡0≤D(x)≤mEx∼Pr[D(x)]−Ex∼Pθ[D(x)]=m+inf⁡−m2≤D(x)≤m2Ex∼Pr[D(x)]−Ex∼Pθ[D(x)]=m+m2inf⁡−1≤f(x)≤1Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]\displaystyle\inf_{0\leq D(x)\leq m}L_{D}(D,g_{\theta}) \\ \displaystyle=m+\inf_{0\leq D(x)\leq m}\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[D(x)] \\ \displaystyle=m+\inf_{-\frac{m}{2}\leq D(x)\leq\frac{m}{2}}\mathbb{E}_{x\sim\mathbb{P}_{r}}[D(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[D(x)] \\ \displaystyle=m+\frac{m}{2}\inf_{-1\leq f(x)\leq 1}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]0≤D(x)≤minf​LD​(D,gθ​)=m+0≤D(x)≤minf​Ex∼Pr​​[D(x)]−Ex∼Pθ​​[D(x)]=m+−2m​≤D(x)≤2m​inf​Ex∼Pr​​[D(x)]−Ex∼Pθ​​[D(x)]=m+2m​−1≤f(x)≤1inf​Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]

The interesting part is that

有趣的是

inf⁡−1≤f(x)≤1Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]=−δ(Pr,Pθ)(7)\inf_{-1\leq f(x)\leq 1}\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]=-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta}) \tag{7}−1≤f(x)≤1inf​Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]=−δ(Pr​,Pθ​)(7)

and there is an f∗:X→[−1,1]f^{*}:\mathcal{X}\rightarrow[-1,1]f∗:X→[−1,1] such that Ex∼Pr[f∗(x)]−Ex∼Pθ[f∗(x)]=−δ(Pr,Pθ)\mathbb{E}_{x\sim\mathbb{P}_{r}}[f^{*}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f^{*}(x)]=-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})Ex∼Pr​​[f∗(x)]−Ex∼Pθ​​[f∗(x)]=−δ(Pr​,Pθ​). This is a long known fact, found for example in [22], but we prove it later for completeness. In that case, we define D∗(x)=m2f∗(x)+m2D^{*}(x)=\frac{m}{2}f^{*}(x)+\frac{m}{2}D∗(x)=2m​f∗(x)+2m​. We then have 0≤D(x)≤m0\leq D(x)\leq m0≤D(x)≤m and

且存在 f∗:X→[−1,1]f^{*}:\mathcal{X}\rightarrow[-1,1]f∗:X→[−1,1] 使 Ex∼Pr[f∗(x)]−Ex∼Pθ[f∗(x)]=−δ(Pr,Pθ)\mathbb{E}_{x\sim\mathbb{P}_{r}}[f^{*}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f^{*}(x)]=-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})Ex∼Pr​​[f∗(x)]−Ex∼Pθ​​[f∗(x)]=−δ(Pr​,Pθ​)。这是久为人知的事实,例如见 [22],但为完整起见我们稍后证明。此时定义 D∗(x)=m2f∗(x)+m2D^{*}(x)=\frac{m}{2}f^{*}(x)+\frac{m}{2}D∗(x)=2m​f∗(x)+2m​。则 0≤D(x)≤m0\leq D(x)\leq m0≤D(x)≤m,且

LD(D∗,gθ)=m+Ex∼Pr[D∗(x)]−Ex∼Pθ[D∗(x)]=m+m2Ex∼Pr[D∗(x)]−Ex∼Pθ[f∗(x)]=m−m2δ(Pr,Pθ)=inf⁡0≤D(x)≤mLD(D,gθ)\displaystyle L_{D}(D^{*},g_{\theta}) \\ \displaystyle=m+\mathbb{E}_{x\sim\mathbb{P}_{r}}[D^{*}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[D^{*}(x)] \\ \displaystyle=m+\frac{m}{2}\mathbb{E}_{x\sim\mathbb{P}_{r}}[D^{*}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f^{*}(x)] \\ \displaystyle=m-\frac{m}{2}\delta(\mathbb{P}_{r},\mathbb{P}_{\theta}) \\ \displaystyle=\inf_{0\leq D(x)\leq m}L_{D}(D,g_{\theta})LD​(D∗,gθ​)=m+Ex∼Pr​​[D∗(x)]−Ex∼Pθ​​[D∗(x)]=m+2m​Ex∼Pr​​[D∗(x)]−Ex∼Pθ​​[f∗(x)]=m−2m​δ(Pr​,Pθ​)=0≤D(x)≤minf​LD​(D,gθ​)

This shows that D∗D^{*}D∗ is optimal and LD(D∗,gθ)=m−m2δ(Pr,Pθ)L_{D}(D^{*},g_{\theta})=m-\frac{m}{2}\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})LD​(D∗,gθ​)=m−2m​δ(Pr​,Pθ​). Furthermore,

这说明 D∗D^{*}D∗ 最优,且 LD(D∗,gθ)=m−m2δ(Pr,Pθ)L_{D}(D^{*},g_{\theta})=m-\frac{m}{2}\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})LD​(D∗,gθ​)=m−2m​δ(Pr​,Pθ​)。进一步,

LG(D∗,gθ)=Ez∼p(z)[D∗(gθ(z))]−Ex∼Pr[D∗(x)]=−LD(D∗,gθ)+m=m2δ(Pr,Pg)\displaystyle L_{G}(D^{*},g_{\theta}) \\ \displaystyle=\mathbb{E}_{z\sim p(z)}[D^{*}(g_{\theta}(z))]-\mathbb{E}_{x\sim\mathbb{P}_{r}}[D^{*}(x)] \\ \displaystyle=-L_{D}(D^{*},g_{\theta})+m \\ \displaystyle=\frac{m}{2}\delta(\mathbb{P}_{r},\mathbb{P}_{g})LG​(D∗,gθ​)=Ez∼p(z)​[D∗(gθ​(z))]−Ex∼Pr​​[D∗(x)]=−LD​(D∗,gθ​)+m=2m​δ(Pr​,Pg​)

concluding the proof.

证毕。

For completeness, we now show a proof for equation (7) and the existence of said f∗f^{*}f∗ that attains the value of the infimum. Take μ=Pr−Pθ\mu=\mathbb{P}_{r}-\mathbb{P}_{\theta}μ=Pr​−Pθ​, which is a signed measure, and (P,Q)(P,Q)(P,Q) its Hahn decomposition. Then, we can define f∗:=\mathbbm1Q−\mathbbm1Pf^{*}:=\mathbbm{1}_{Q}-\mathbbm{1}_{P}f∗:=\mathbbm1Q​−\mathbbm1P​. By construction, then

为完整起见,我们现给出方程 (7) 以及达到下确界的所述 f∗f^{*}f∗ 存在性的证明。取 μ=Pr−Pθ\mu=\mathbb{P}_{r}-\mathbb{P}_{\theta}μ=Pr​−Pθ​,它是符号测度,并取 (P,Q)(P,Q)(P,Q) 为其 Hahn 分解。则可定义 f∗:=\mathbbm1Q−\mathbbm1Pf^{*}:=\mathbbm{1}_{Q}-\mathbbm{1}_{P}f∗:=\mathbbm1Q​−\mathbbm1P​。由构造,

EEx∼Pr[f∗(x)]−Ex∼Pθ[f∗(x)]=∫f∗d⁡ ⁣μ=μ(Q)−μ(P)=−(μ(P)−μ(Q))=−∥μ∥TV=−∥Pr−Pθ∥TV=−δ(Pr,Pθ)\displaystyle EE_{x\sim\mathbb{P}_{r}}[f^{*}(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f^{*}(x)] \\ \displaystyle=\int f^{*}\operatorname{d}\!{\mu}=\mu(Q)-\mu(P) \\ \displaystyle=-(\mu(P)-\mu(Q))=-\|\mu\|_{TV} \\ \displaystyle=-\|\mathbb{P}_{r}-\mathbb{P}_{\theta}\|_{TV} \\ \displaystyle=-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})EEx∼Pr​​[f∗(x)]−Ex∼Pθ​​[f∗(x)]=∫f∗dμ=μ(Q)−μ(P)=−(μ(P)−μ(Q))=−∥μ∥TV​=−∥Pr​−Pθ​∥TV​=−δ(Pr​,Pθ​)

Furthermore, if fff is bounded between -1 and 1, we get

进一步,若 fff 介于 −1-1−1 与 111 之间,则有

∣Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]∣=∣∫fd⁡ ⁣Pr−∫fd⁡ ⁣Pθ∣=∣∫fd⁡ ⁣μ∣≤∫∣f∣d⁡ ⁣∣μ∣≤∫1d⁡ ⁣∣μ∣=∣μ∣(X)=∥μ∥TV=δ(Pr,Pθ)\displaystyle|\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]| \\ \displaystyle=|\int f\operatorname{d}\!{\mathbb{P}}_{r}-\int f\operatorname{d}\!{\mathbb{P}}_{\theta}| \\ \displaystyle=|\int f\operatorname{d}\!{\mu}| \\ \displaystyle\leq\int|f|\operatorname{d}\!{|}\mu|\leq\int 1\operatorname{d}\!{|}\mu| \\ \displaystyle=|\mu|(\mathcal{X})=\|\mu\|_{TV}=\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})∣Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]∣=∣∫fdPr​−∫fdPθ​∣=∣∫fdμ∣≤∫∣f∣d∣μ∣≤∫1d∣μ∣=∣μ∣(X)=∥μ∥TV​=δ(Pr​,Pθ​)

Since δ\deltaδ is positive, we can conclude Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]≥−δ(Pr,Pθ)\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]\geq-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]≥−δ(Pr​,Pθ​). ∎

由于 δ\deltaδ 为正,可结论 Ex∼Pr[f(x)]−Ex∼Pθ[f(x)]≥−δ(Pr,Pθ)\mathbb{E}_{x\sim\mathbb{P}_{r}}[f(x)]-\mathbb{E}_{x\sim\mathbb{P}_{\theta}}[f(x)]\geq-\delta(\mathbb{P}_{r},\mathbb{P}_{\theta})Ex∼Pr​​[f(x)]−Ex∼Pθ​​[f(x)]≥−δ(Pr​,Pθ​)。∎

Appendix E Generator’s cost during normal GAN training

附录 E 普通 GAN 训练中生成器的代价

Figure 8

Figure 8: Cost of the generator during normal GAN training, for an MLP generator (upper left) and a DCGAN generator (upper right). Both had a DCGAN discriminator. Both curves have increasing error. Samples get better for the DCGAN but the cost of the generator increases, pointing towards no significant correlation between sample quality and loss. Bottom: MLPMLPMLP with both generator and discriminator. The curve goes up and down regardless of sample quality. All training curves were passed through the same median filter as in Figure 3.

图 8:普通 GAN 训练中生成器的代价:MLP 生成器(左上)与 DCGAN 生成器(右上);二者判别器均为 DCGAN。两条曲线误差都在上升。DCGAN 的样本变好,但生成器代价上升,说明样本质量与损失无明显相关。底部:生成器与判别器都是 MLP。曲线上下起伏,与样本质量无关。所有训练曲线使用与图 3 相同的中值滤波。

Appendix F Sheets of samples

附录 F 样本图页

Figure 9

Figure 9: WGAN algorithm: generator and critic are DCGANs.

图 9:WGAN 算法:生成器与评判器均为 DCGAN。

Figure 11

Figure 11: WGAN algorithm: generator is a DCGAN without batchnorm and constant filter size. Critic is a DCGAN.

图 11:WGAN 算法:生成器为去掉批归一化、滤波器大小恒定的 DCGAN;评判器为 DCGAN。

Figure 13

Figure 13: WGAN algorithm: generator is an MLP with 4 hidden layers of 512 units, critic is a DCGAN.

图 13:WGAN 算法:生成器为 4 隐层、每层 512 单元的 MLP;评判器为 DCGAN。