Goodfellow I, Pouget-Abadie J, Mirza M, et al. Generative adversarial nets[C]//Advances in neural information processing systems. 2014: 2672-2680.
GitHub: https://github.com/goodfeli/adversarial
Abstract:
GAN 是一个通过对抗过程来估计生成模型的框架。我们同事训练两个模型:a generative model G 来你和数据的概率分布,a discriminative model D 来判断数据来自真实数据还是生成数据。训练是一个两人游戏的最大最小化过程,G最大化D判断错误的概率, D最大化判断正确的概率。在任意的函数空间内,G和D的解唯一存在,此时G完全你和训练数据的分布,D的的结果永远为1/2。当G和D被定义为 multilayer perceptrons 时,可以通过 backpropagation 训练。在训练过程中完全不需要 Markov chains or unrolled approximate inference networks。
Introduction
在论文发表之前的 deap learning 中,判别模型有了很强大的应用,但是生成模型进展不大,本文把神经网络应用在生成模型,并且有很好的效果。
Adversarial nets
为了通过数据x来学习分布pg,我们定义一个先验的输入噪声变量分布pz(z),然后把先验的随机变量z映射到数据空间G(z;θg)。同样的我们定义另外一个 multilayer perceptron D(x;θd),输出x是否来自真实数据的概率。我们通过最大化分辨真实数据和生成数据来训练D,通过最小化log(1−D(G(z)))来训练G。
换句话说,G和D相当于玩一个 two-player minimax game with value function V(G,D):
minGmaxDV(G,D)=Ex∼Pdata(x)[logD(x)]+Ez∼pz(z)[log(1−D(G(z)))]
下图是一个训练过程的示意图,绿线是生成模型生成的数据,蓝色虚线是判别模型判别的概率,黑色虚线是真实数据。

Theoretical Results
本文采用的 GAN 算法
Algorithm 1: Minibatch stochastic gradient descent training of generative adversarial nets. The number of steps to apply to the discriminator, k, is a hyperparameter. We used k=1, the least expensive option, in our experiments.
- for number of training iterations do
- for k steps do
- Sample minibatch of m noise samples {z(1),…,z(m)} from noise prior pg(z).
- Sample minibatch of m examples {x(1),...,x(m)} from data generating distribution pdata(x).
- Update the discriminator by ascending its stochastic gradient
- end for
- Sample minibatch of m noise samples {z(1),…,z(m)} from noise prior pg(z).
- Update the generator by descending its stochastic gradient
- end for
The gradient-based updates can use any standard gradient-based learning rule. We used momentum in our experiments.
Global Optimality of pg=pdata
Proposition 1. 如果固定G,最佳的判别器为:DG∗(x)=pdata(x)+pg(x)pdata(x)
Proof.
V(G,D)=∫xpdata(x)log(D(x))dx+∫xpz(z)log(1−D(g(z)))dz
=∫xpdata(x)log(DG(x))+pg(x)log(1−DG(x))dx
求极值,由导数为0可证。
Theorem 1. 当且仅当pg=pdata时,C(G)=−log4,C(G)为代价函数也就是V(G,DG∗)
Proof.
显然pg=pdata时,C(G)=−log4
在一般情况下
C(G)=maxDV(G,D)
=Ex∼pdata[logDG∗(x)]+Ez∼pz[log(1−DG∗(G(z)))]
=Ex∼pdata[logDG∗(x)]+Ex∼pg[log(1−DG∗(x))]
=Ex∼pdata[pdata(x)+pg(x)pdata(x)]+Ex∼pg[pdata(x)+pg(x)pg(x)]
=−log4+KL(pdata∣∣2pdata+pg)+KL(pg∣∣2pdata+pg)=−log4+2⋅JSD(pdata∣∣pg)
得证。
Convergence of Algorithm 1
Proposition 2. 只要G和D容量足够,Algorithm 1总可以使得pg收敛于pdata
Proof. 因为pg关于V(G,D)是个凸函数,所以一定收敛到最小值。
Experiments
效果当然比其他的方法好,这里就不列出来了,其他的方法暂时也用不到。
Advantages and disadvantages
优点就是效果很好,缺点时不稳定,可能出现不收敛和崩溃的情况,还有没法通过损失函数看出来训练的情况,只能人工来看,在 nlp 这种离散的情况下,效果一般。