GAN 生成式对抗网络

非常热门的GAN的论文,能用来做很多有趣的事情。数学知识有点多,看得不是特别明白。不再全篇翻译后,阅读论文速度提高了不少,一个工作日摸摸鱼,晚上加个班就能完成。

Generative Adversarial Networks

Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Ward-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio,
Universite de Montreal, 2014

1. Introduction

深度学习的期望是发现富有、层级化的模型,表达AI应用遇到的数据类的概率分布。深度学习的长足进步来自于模型,通常将高维感知映射到类标签。其成功主要基于反向传播和dropout。深度生成模型影响较小,因极大似然估计的许多棘手概率计算,以及在生成上下文利用分段线性单元好处的困难。我们提出了新的生成模型估计流程,规避了这些困难。

在提出的对抗网络框架,生成模型为一个对抗挖坑:它训练来判断一个样本是来自模型分布还是数据分布。生成模型可以想成一队伪造者,试图生成伪币,而对抗模型可想做警察,试图检测伪币。竞争驱动两队提升它们的方法,直到伪币无法被区分。

3. Adversarial nets

当模型都是多层感知机时,对抗模型最容易直接应用。要训练生成器在数据x上的分布$p_g$,我们定义一个噪音输入变量prior $p_z(z)$,接着表达一个到数据空间的映射$G(z; \theta_g)$,其中G是一个参数为$\theta_g$的多层感知机表达的可微函数。我们定义另一个多层感知机$D(x;\theta_d)$,输出一个标量。$D(x)$表达了x来自数据而不是$p_g$的概率。我们训练D,使它为来自数据和来自G的样本赋予正确标签的概率最高。我们同时训练G来最小化$\log (1 - (D(G(z)))$。

换句话说,D和G玩双人minimax游戏,得分函数V(G, D):

译者注:$\mathbb E$指期望值,见wiki

我们进行k步优化D,一步优化G。使D保持在接近最优解,G变化得足够慢。这一策略类似SML/PCD。

图1

实际应用中,等式1也许不能为G训练提供有效的梯度。训练早期,G还不充分时,D很容易拒绝来自它的样本,因为与训练集差得比较远。这一情况下$\log (1 - D(G(z)))$就饱和了。与其训练G,让它最小化$\log (1 - D(G(z)))$,不如让它最大化$\log D(G(z))$。这一目标函数在训练早期能提供强得多的梯度。

4. Theoretical Results

生成器G隐式地定义了当$z \sim p_z$时获得的样本G(z)的概率分布$p_g$。因此我们希望当容量和时间足够时,算法1能收敛到$p_data$的好估计。

算法1

4.1 Global Optimality of $p_g = p_{data}$

先考虑一个不管给什么生成器G,最优的discriminator D。

Proposition 1. 当G固定时,最优D是:

Proof 对于D的训练标准是,给予任何G,最大化数量V(G, D)

对于任意$(a,b) \in \mathbb R ^2 $\ $\{0,0 \}$,函数 $y \to a \log (y) + b \log (1-y) $在[0, 1]间极值点在$\frac a {a+b}$

D的训练目标可解读为最大化估计条件概率$P(Y = y | x)$的log-likelihood,其中Y指示了x来自$p_{data}$(y = 1)还是$p_g$(y=0)。等式1中的minimax游戏可以变换为:

定理Theorem 1 Virtual training criterion C(G)的全局最小值当且仅当$p_g = p_{data}$时取得,该点C(G)的值为 log4

Proof. 当$p_g = p_{data}$时,$D^{\star}_G(x) = \frac 1 2$(等式2),因此通过查看等式4$D^{\star}_G(x) = \frac 1 2$时,我们发现$C(G) = \log \frac 1 2 + \log \frac 1 2 = - \log 4$。要确定这是C(G)的最优值,且仅在$p_g = p_{data}$时达到,观察:

通过从$C(G) = V(D^{\star}_G, G)$中减去这一表达式,我们得到:

其中KL是Kullback-Leibler divergence。我们认出了这个表达式中模型分布和数据生成过程中的Jensen-Shannon divergence:

译者注:Kullback-Leibler divergence,又称相对熵,是两个概率分布差异的度量。应用包括信息系统中的相对(香农)熵 relative (Shanno) entropy,连续时间序列中的随机性 randomness in continuous time-series,还有与统计模型相比时的信息增益information gain。

因为两个分布的JSD总是非负的,且在它们相等时为0,我们已证明$C^{\star} = - \log (4)$是C(G)的全局最小,当且仅当$p_g = p_{data}$时取得,也就是生成模型完美复制了数据生成过程。

4.2 Convergence of Algorithm 1

Proposition 2. 如果G和D容量足够,而且在算法1中的每一步,discriminator都能达到给定G下其最优,且$p_g$被更新以提升标准:

那么$p_g$能收敛为$p_{data}$

Proof. 假设$V(G, D) = U(p_g, D)$是之前标准下完成的$p_g$的一个函数。注意$U(p_g, D)$是$p_g$的一个凸面contex。凸函数的上确界supremum的次导数subderivative包含了函数达到极大值时的偏导数。换句话说,如果$f(x) = \sup _{\alpha \in A} f_{\alpha} (x)$对任何$\alpha$都是x中的凸,那么$ \partial f _{\beta} (x) \in \partial f \ ,if \beta = \arg \sup _{\alpha \in A} f_{\alpha} (x) $。这等价于在给定G时,计算$p_g$在最优D的一个梯度下降。如定理1中证明过,$\sup _D U(p_g,D)$是$p_g$中的一个凸,且有全局最优值,因此$p_g$有充分小的更新时,它能收敛为$p_x$,得证。

实际中,对抗网络通过函数$G(z;\theta_g)$表达一个$p_g$分布的limited family,所以我们优化$\theta_g$而不是$p_g$本身。使用一个多层感知机来定义G会为参数空间引入多个关键点。但实际应用中多层感知机的优秀性能说明它们是一个合理的模型,尽管缺乏理论支持。

5. Experiments

我们在多个数据集上训练对抗网络,生成网络混合使用ReLU和sigmoid激活,辨识网络使用maxout$^{[10]}$激活。训练辨识网络时使用了Dropout。尽管理论上生成网络可以使用Dropout,中间层也能使用noise,我们仅在生成器最底层使用了noise作为输入。

表1

我们通过将G生成的样本拟合到一个Gaussian Parzen window并报告在这个分布下的log似然率,估计测试集数据在$p_g$下的概率。高斯的参数$\sigma$通过在验证集上的交叉验证获得。结果见表1。这个估计似然率的方法有很高的差异,在高维空间表现不好,但已是已知最好方法。

图2图3中是训练后的生成器的样本。

图2
图3

6. Advantages and disadvantages

与之前的模型框架相比,这一新框架有着优缺点。缺点主要在于没有$p_g(x)$的显示表达,而且在训练中D和G必须同步得很好(特别是在不更新D时,G不能训练太多,来避免“the Helvetica scenario”模式坍塌),如同波兹曼机的Negative chain必须在训练步骤中保持最新。优点是不需要马尔科夫链,仅需反向传播以获得梯度,训练中无需inference,许多函数都能包含进这一模型。表2是总结。

表2

7. Conclusions and future work

本框架可以有许多直接扩展:

  1. 为G和D增加c作为输入,就能得到条件生成模型$p(x|c)$
  2. 通过训练一个额外的给定x预测z的网络,能得到learned approximate inference。这类似于wake-sleep算法训练得到的inference,但优点在于它是被训练完成的固定生成器训练的。
  3. 可以通过训练共享参数的family of conditional模型近似所有条件$p(x_S | x_{\sout S})$,其中S是x的指数的子集。本质上,可以使用对抗网络来实现MP-DBM的随机扩展。
  4. 半监督学习:当标注数据受限时,来自discriminator或推理网的特征能有助于分类器的性能。
  5. 效率提升:training could be accelerated greatly by divising better methods for coordinating G and D or determining better distributions to sample z from during training.

References

[1] Bastien, F., Lamblin, P., Pascanu, R., Bergstra, J., Goodfellow, I. J., Bergeron, A., Bouchard, N., and Bengio, Y. (2012). Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop.
[2] Bengio, Y. (2009). Learning deep architectures for AI. Now Publishers.
[3] Bengio, Y., Mesnil, G., Dauphin, Y., and Rifai, S. (2013a). Better mixing via deep representations. In ICML’13.
[4] Bengio, Y., Yao, L., Alain, G., and Vincent, P. (2013b). Generalized denoising auto-encoders as generative models. In NIPS26. Nips Foundation.
[5] Bengio, Y., Thibodeau-Laufer, E., and Yosinski, J. (2014a). Deep generative stochastic networks trainable by backprop. In ICML’14.
[6] Bengio, Y., Thibodeau-Laufer, E., Alain, G., and Yosinski, J. (2014b). Deep generative stochastic networks trainable by backprop. In Proceedings of the 30th International Conference on Machine Learning (ICML’14).
[7] Bergstra, J., Breuleux, O., Bastien, F., Lamblin, P., Pascanu, R., Desjardins, G., Turian, J., Warde-Farley, D., and Bengio, Y. (2010). Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference (SciPy). Oral Presentation.
[8] Breuleux, O., Bengio, Y., and Vincent, P. (2011). Quickly generating representative samples from an RBM-derived process. Neural Computation, 23(8), 2053–2073.
[9] Glorot, X., Bordes, A., and Bengio, Y. (2011). Deep sparse rectifier neural networks. In AISTATS’2011.
[10] Goodfellow, I. J., Warde-Farley, D., Mirza, M., Courville, A., and Bengio, Y. (2013a). Maxout networks. In ICML’2013.
[11] Goodfellow, I. J., Mirza, M., Courville, A., and Bengio, Y. (2013b). Multi-prediction deep Boltzmann machines. In NIPS’2013.
[12] Goodfellow, I. J., Warde-Farley, D., Lamblin, P., Dumoulin, V., Mirza, M., Pascanu, R., Bergstra, J., Bastien, F., and Bengio, Y. (2013c). Pylearn2: a machine learning research library. arXiv preprint arXiv:1308.4214.
[13] Gutmann, M. and Hyvarinen, A. (2010). Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In AISTATS’2010.
[14] Hinton, G., Deng, L., Dahl, G. E., Mohamed, A., Jaitly, N., Senior, A., Vanhoucke, V., Nguyen, P., Sainath, T., and Kingsbury, B. (2012a). Deep neural networks for acoustic modeling in speech recognition. IEEE Signal Processing Magazine, 29(6), 82–97.
[15] Hinton, G. E., Dayan, P., Frey, B. J., and Neal, R. M. (1995). The wake-sleep algorithm for unsupervised neural networks. Science, 268, 1558–1161.
[16] Hinton, G. E., Osindero, S., and Teh, Y. (2006). A fast learning algorithm for deep belief nets. Neural Computation, 18, 1527–1554.
[17] Hinton, G. E., Srivastava, N., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. (2012b). Improving neural networks by preventing co adaptation of feature detectors. Technical report, arXiv:1207.0580.
[18] Hyvarinen, A. (2005). Estimation of non-normalized statistical models using score matching. ¨ J. Machine Learning Res., 6.
[19] Jarrett, K., Kavukcuoglu, K., Ranzato, M., and LeCun, Y. (2009). What is the best multi-stage architecture for object recognition? In Proc. International Conference on Computer Vision (ICCV’09), pages 2146–2153. IEEE.
[20] Kingma, D. P. and Welling, M. (2014). Auto-encoding variational bayes. In Proceedings of the International Conference on Learning Representations (ICLR).
[21] Krizhevsky, A. and Hinton, G. (2009). Learning multiple layers of features from tiny images. Technical report, University of Toronto.
[22] Krizhevsky, A., Sutskever, I., and Hinton, G. (2012). ImageNet classification with deep convolutional neural networks. In NIPS’2012.
[23] LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11), 2278–2324.
[24] Rezende, D. J., Mohamed, S., and Wierstra, D. (2014). Stochastic backpropagation and approximate inference in deep generative models. Technical report, arXiv:1401.4082.
[25] Rifai, S., Bengio, Y., Dauphin, Y., and Vincent, P. (2012). A generative process for sampling contractive auto-encoders. In ICML’12.
[26] Salakhutdinov, R. and Hinton, G. E. (2009). Deep Boltzmann machines. In AISTATS’2009, pages 448– 455.
[27] Smolensky, P. (1986). Information processing in dynamical systems: Foundations of harmony theory. In D. E. Rumelhart and J. L. McClelland, editors, Parallel Distributed Processing, volume 1, chapter 6, pages 194–281. MIT Press, Cambridge.
[28] Susskind, J., Anderson, A., and Hinton, G. E. (2010). The Toronto face dataset. Technical Report UTML TR 2010-001, U. Toronto.
[29] Tieleman, T. (2008). Training restricted Boltzmann machines using approximations to the likelihood gradient. In W. W. Cohen, A. McCallum, and S. T. Roweis, editors, ICML 2008, pages 1064–1071. ACM.
[30] Vincent, P., Larochelle, H., Bengio, Y., and Manzagol, P.-A. (2008). Extracting and composing robust features with denoising autoencoders. In ICML 2008.
[31] Younes, L. (1999). On the convergence of Markovian stochastic algorithms with rapidly decreasing ergodicity rates. Stochastics and Stochastic Reports, 65(3), 177–228.